From owner-svn-src-head@FreeBSD.ORG Sun Sep 26 01:41:53 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7EBD8106564A; Sun, 26 Sep 2010 01:41:53 +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 6D59F8FC19; Sun, 26 Sep 2010 01:41:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8Q1fr9i078387; Sun, 26 Sep 2010 01:41:53 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8Q1fr2C078384; Sun, 26 Sep 2010 01:41:53 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201009260141.o8Q1fr2C078384@svn.freebsd.org> From: David Xu Date: Sun, 26 Sep 2010 01:41:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213180 - in head/sys: powerpc/conf sun4v/conf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Sep 2010 01:41:53 -0000 Author: davidxu Date: Sun Sep 26 01:41:53 2010 New Revision: 213180 URL: http://svn.freebsd.org/changeset/base/213180 Log: Follow r213098, kernel POSIX semaphore module is no longer needed. Modified: head/sys/powerpc/conf/GENERIC64 head/sys/sun4v/conf/GENERIC Modified: head/sys/powerpc/conf/GENERIC64 ============================================================================== --- head/sys/powerpc/conf/GENERIC64 Sat Sep 25 21:55:40 2010 (r213179) +++ head/sys/powerpc/conf/GENERIC64 Sun Sep 26 01:41:53 2010 (r213180) @@ -59,7 +59,6 @@ options STACK #stack(9) support options SYSVSHM #SYSV-style shared memory options SYSVMSG #SYSV-style message queues options SYSVSEM #SYSV-style semaphores -options P1003_1B_SEMAPHORES # POSIX-style semaphores options _KPOSIX_PRIORITY_SCHEDULING #Posix P1003_1B real-time extensions options HWPMC_HOOKS # Necessary kernel hooks for hwpmc(4) options AUDIT # Security event auditing Modified: head/sys/sun4v/conf/GENERIC ============================================================================== --- head/sys/sun4v/conf/GENERIC Sat Sep 25 21:55:40 2010 (r213179) +++ head/sys/sun4v/conf/GENERIC Sun Sep 26 01:41:53 2010 (r213180) @@ -57,7 +57,6 @@ options STACK # stack(9) support options SYSVSHM # SYSV-style shared memory options SYSVMSG # SYSV-style message queues options SYSVSEM # SYSV-style semaphores -options P1003_1B_SEMAPHORES # POSIX-style semaphores options _KPOSIX_PRIORITY_SCHEDULING # POSIX P1003_1B real-time extensions options AHC_REG_PRETTY_PRINT # Print register bitfields in debug # output. Adds ~128k to driver. From owner-svn-src-head@FreeBSD.ORG Sun Sep 26 01:45:34 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1881B106566B; Sun, 26 Sep 2010 01:45:34 +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 081078FC08; Sun, 26 Sep 2010 01:45: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 o8Q1jX0C078513; Sun, 26 Sep 2010 01:45:33 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8Q1jXUk078511; Sun, 26 Sep 2010 01:45:33 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201009260145.o8Q1jXUk078511@svn.freebsd.org> From: Ed Maste Date: Sun, 26 Sep 2010 01:45:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213181 - head/usr.sbin/watchdogd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Sep 2010 01:45:34 -0000 Author: emaste Date: Sun Sep 26 01:45:33 2010 New Revision: 213181 URL: http://svn.freebsd.org/changeset/base/213181 Log: Protect the watchdog daemon against swap OOM killer. This is similar to SVN r199804 which added protection to sshd, cron, syslogd, and inetd. Modified: head/usr.sbin/watchdogd/watchdogd.c Modified: head/usr.sbin/watchdogd/watchdogd.c ============================================================================== --- head/usr.sbin/watchdogd/watchdogd.c Sun Sep 26 01:41:53 2010 (r213180) +++ head/usr.sbin/watchdogd/watchdogd.c Sun Sep 26 01:45:33 2010 (r213181) @@ -31,6 +31,7 @@ #include __FBSDID("$FreeBSD$"); +#include #include #include #include @@ -115,6 +116,8 @@ main(int argc, char *argv[]) signal(SIGTERM, sighandler); pidfile_write(pfh); + if (madvise(0, 0, MADV_PROTECT) != 0) + warn("madvise failed"); watchdog_loop(); From owner-svn-src-head@FreeBSD.ORG Sun Sep 26 06:45:24 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8B1EC106564A; Sun, 26 Sep 2010 06:45:24 +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 7A92A8FC15; Sun, 26 Sep 2010 06:45: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 o8Q6jORA084458; Sun, 26 Sep 2010 06:45:24 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8Q6jOgA084456; Sun, 26 Sep 2010 06:45:24 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201009260645.o8Q6jOgA084456@svn.freebsd.org> From: David Xu Date: Sun, 26 Sep 2010 06:45:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213182 - head/lib/libthr/thread X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Sep 2010 06:45:24 -0000 Author: davidxu Date: Sun Sep 26 06:45:24 2010 New Revision: 213182 URL: http://svn.freebsd.org/changeset/base/213182 Log: Report death event to debugger before moving to gc list, otherwise debugger may can not find it on thread list. Modified: head/lib/libthr/thread/thr_exit.c Modified: head/lib/libthr/thread/thr_exit.c ============================================================================== --- head/lib/libthr/thread/thr_exit.c Sun Sep 26 01:45:33 2010 (r213181) +++ head/lib/libthr/thread/thr_exit.c Sun Sep 26 06:45:24 2010 (r213182) @@ -286,6 +286,8 @@ exit_thread(void) curthread->cycle++; _thr_umtx_wake(&curthread->cycle, INT_MAX, 0); } + if (!curthread->force_exit && SHOULD_REPORT_EVENT(curthread, TD_DEATH)) + _thr_report_death(curthread); /* * Thread was created with initial refcount 1, we drop the * reference count to allow it to be garbage collected. @@ -293,9 +295,6 @@ exit_thread(void) curthread->refcount--; _thr_try_gc(curthread, curthread); /* thread lock released */ - if (!curthread->force_exit && SHOULD_REPORT_EVENT(curthread, TD_DEATH)) - _thr_report_death(curthread); - #if defined(_PTHREADS_INVARIANTS) if (THR_IN_CRITICAL(curthread)) PANIC("thread exits with resources held!"); From owner-svn-src-head@FreeBSD.ORG Sun Sep 26 10:39:02 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 23C4B106566B; Sun, 26 Sep 2010 10:39:02 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1349A8FC08; Sun, 26 Sep 2010 10:39: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 o8QAd1kw088971; Sun, 26 Sep 2010 10:39:01 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8QAd1kQ088969; Sun, 26 Sep 2010 10:39:01 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201009261039.o8QAd1kQ088969@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 26 Sep 2010 10:39:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213183 - head/sbin/hastd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Sep 2010 10:39:02 -0000 Author: pjd Date: Sun Sep 26 10:39:01 2010 New Revision: 213183 URL: http://svn.freebsd.org/changeset/base/213183 Log: Plug memory leak on fork(2) failure. Submitted by: Mikolaj Golub MFC after: 3 days Modified: head/sbin/hastd/hooks.c Modified: head/sbin/hastd/hooks.c ============================================================================== --- head/sbin/hastd/hooks.c Sun Sep 26 06:45:24 2010 (r213182) +++ head/sbin/hastd/hooks.c Sun Sep 26 10:39:01 2010 (r213183) @@ -388,6 +388,7 @@ hook_execv(const char *path, va_list ap) switch (pid) { case -1: /* Error. */ pjdlog_errno(LOG_ERR, "Unable to fork to execute %s", path); + hook_free(hp); return; case 0: /* Child. */ descriptors(); From owner-svn-src-head@FreeBSD.ORG Sun Sep 26 11:18:43 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BA294106564A; Sun, 26 Sep 2010 11:18:43 +0000 (UTC) (envelope-from to.my.trociny@gmail.com) Received: from mail-ew0-f54.google.com (mail-ew0-f54.google.com [209.85.215.54]) by mx1.freebsd.org (Postfix) with ESMTP id BE6DD8FC0C; Sun, 26 Sep 2010 11:18:42 +0000 (UTC) Received: by ewy22 with SMTP id 22so1237068ewy.13 for ; Sun, 26 Sep 2010 04:18:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:references :x-comment-to:date:in-reply-to:message-id:user-agent:mime-version :content-type; bh=qLUifVsCCOipCp9c+Jx14xVLIVthkjx4jy0W0hnpUhw=; b=f7rJ5wlE+Dv9KwGAws80Qz86meLiWC80QpRqPtjiVddiSqoX8DUrwhBbYaaYRNzQer LsNbFvCVZ//kCwh+NfmRpJdzJwtT6j/zl+Ur3OrVoasF5JeTtCut+RncRIZX4oznNs8P 8nUbPCiwvpIHMzysTXYwg5gp6WidOQP/G1lEA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:references:x-comment-to:date:in-reply-to :message-id:user-agent:mime-version:content-type; b=mBZjXOYTz5bFUZPd/9dsfrIgybxzqZVzbEdov2sh4hhJnMawazPvTFSt8tvUeU/aAJ YyZRp1bWAq3ECd+8T67zslMQys2iENQcoAUfZGK6h9cZRVNOtoorkD6cg+KFO4Fa9CfB RV7Hqiss4aNvwNQO9ydYd8raxHt7NaBu3POUU= Received: by 10.213.32.79 with SMTP id b15mr4830895ebd.39.1285498100170; Sun, 26 Sep 2010 03:48:20 -0700 (PDT) Received: from localhost (vpn-195-69-247-132.customer.onet.com.ua [195.69.247.132]) by mx.google.com with ESMTPS id a48sm6479300eei.0.2010.09.26.03.48.17 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sun, 26 Sep 2010 03:48:18 -0700 (PDT) From: Mikolaj Golub To: Ed Maste References: <201009260145.o8Q1jXUk078511@svn.freebsd.org> X-Comment-To: Ed Maste Date: Sun, 26 Sep 2010 13:48:19 +0300 In-Reply-To: <201009260145.o8Q1jXUk078511@svn.freebsd.org> (Ed Maste's message of "Sun, 26 Sep 2010 01:45:33 +0000 (UTC)") Message-ID: <86mxr4eq6k.fsf@kopusha.home.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (berkeley-unix) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r213181 - head/usr.sbin/watchdogd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Sep 2010 11:18:43 -0000 --=-=-= On Sun, 26 Sep 2010 01:45:33 +0000 (UTC) Ed Maste wrote: EM> Log: EM> Protect the watchdog daemon against swap OOM killer. This is similar to EM> SVN r199804 which added protection to sshd, cron, syslogd, and inetd. May be there is a sense to have some utility in the system so that an admin could protect any process he wanted? E.g. something like in the attach. -- Mikolaj Golub --=-=-= Content-Type: application/octet-stream Content-Disposition: attachment; filename=mprotect.c Content-Transfer-Encoding: base64 I2luY2x1ZGUgPHN5cy9tbWFuLmg+CgojaW5jbHVkZSA8ZXJyLmg+CiNpbmNsdWRlIDxlcnJuby5o PgojaW5jbHVkZSA8c3RkaW8uaD4KI2luY2x1ZGUgPHN0ZGxpYi5oPgojaW5jbHVkZSA8dW5pc3Rk Lmg+Cgp2b2lkIHVzYWdlKHZvaWQpOwoKaW50Cm1haW4oaW50IGFyZ2MsIGNoYXIgKmFyZ3ZbXSkK ewoKCWFyZ2MtLTsKCWFyZ3YrKzsKCglpZiAoYXJnYyA9PSAwKQoJCXVzYWdlKCk7CgoJaWYgKG1h ZHZpc2UoMCwgMCwgTUFEVl9QUk9URUNUKSAhPSAwKQoJCXdhcm4oIm1hZHZpc2UgZmFpbGVkIik7 CgoJZXJybm8gPSAwOwoJZXhlY3ZwKCphcmd2LCBhcmd2KTsKCWVycihlcnJubyA9PSBFTk9FTlQg PyAxMjcgOiAxMjYsICIlcyIsICphcmd2KTsKfQoKdm9pZAp1c2FnZSh2b2lkKQp7CgoJKHZvaWQp ZnByaW50ZihzdGRlcnIsCgkgICAgInVzYWdlOiBtcHJvdGVjdCB1dGlsaXR5IFthcmd1bWVudCAu Li5dXG4iKTsKCWV4aXQoMSk7Cn0K --=-=-=-- From owner-svn-src-head@FreeBSD.ORG Sun Sep 26 14:20:09 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 904BE106566B; Sun, 26 Sep 2010 14:20:09 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7F4878FC13; Sun, 26 Sep 2010 14:20: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 o8QEK9Ax094979; Sun, 26 Sep 2010 14:20:09 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8QEK99f094977; Sun, 26 Sep 2010 14:20:09 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201009261420.o8QEK99f094977@svn.freebsd.org> From: Nathan Whitehorn Date: Sun, 26 Sep 2010 14:20:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213185 - head/contrib/gcc/config/rs6000 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Sep 2010 14:20:09 -0000 Author: nwhitehorn Date: Sun Sep 26 14:20:09 2010 New Revision: 213185 URL: http://svn.freebsd.org/changeset/base/213185 Log: Check for NULL link registers as found in initial stack frames when doing stack unwinding, instead of naively trying to check the instruction at that location. This fixes signal handling in threaded applications after recent changes regarding unwinding in libthr. While here, clean up our MD_FROB_UPDATE_CONTEXT() implementation a little. Modified: head/contrib/gcc/config/rs6000/freebsd.h Modified: head/contrib/gcc/config/rs6000/freebsd.h ============================================================================== --- head/contrib/gcc/config/rs6000/freebsd.h Sun Sep 26 12:52:23 2010 (r213184) +++ head/contrib/gcc/config/rs6000/freebsd.h Sun Sep 26 14:20:09 2010 (r213185) @@ -219,17 +219,16 @@ | (TARGET_64BIT ? DW_EH_PE_udata8 : DW_EH_PE_sdata4)) \ : DW_EH_PE_absptr) +#ifdef __powerpc64__ #define MD_FROB_UPDATE_CONTEXT(CTX, FS) \ - if (TARGET_64BIT) { \ if ((FS)->regs.reg[2].how == REG_UNSAVED) \ { \ - unsigned int *insn \ - = (unsigned int *) \ + unsigned int *insn = (unsigned int *) \ _Unwind_GetGR ((CTX), LINK_REGISTER_REGNUM); \ - if (*insn == 0xE8410028) \ + if (insn != NULL && *insn == 0xE8410028) \ _Unwind_SetGRPtr ((CTX), 2, (CTX)->cfa + 40); \ - } \ - } + } +#endif /* FreeBSD doesn't support saving and restoring 64-bit regs with a 32-bit kernel. This is supported when running on a 64-bit kernel with From owner-svn-src-head@FreeBSD.ORG Sun Sep 26 21:48:33 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0B5E7106564A; Sun, 26 Sep 2010 21:48:33 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EE85E8FC0A; Sun, 26 Sep 2010 21:48:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8QLmWOp003867; Sun, 26 Sep 2010 21:48:32 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8QLmWjl003865; Sun, 26 Sep 2010 21:48:32 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201009262148.o8QLmWjl003865@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Sun, 26 Sep 2010 21:48:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213187 - head/sbin/geom/class/part X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Sep 2010 21:48:33 -0000 Author: ae Date: Sun Sep 26 21:48:32 2010 New Revision: 213187 URL: http://svn.freebsd.org/changeset/base/213187 Log: Remove superfluous word from "gpart bootcode" usage message. Approved by: kib (mentor) Modified: head/sbin/geom/class/part/geom_part.c Modified: head/sbin/geom/class/part/geom_part.c ============================================================================== --- head/sbin/geom/class/part/geom_part.c Sun Sep 26 16:52:05 2010 (r213186) +++ head/sbin/geom/class/part/geom_part.c Sun Sep 26 21:48:32 2010 (r213187) @@ -105,7 +105,7 @@ struct g_command PUBSYM(class_commands)[ { 'i', GPART_PARAM_INDEX, G_VAL_OPTIONAL, G_TYPE_NUMBER }, { 'f', "flags", GPART_FLAGS, G_TYPE_STRING }, G_OPT_SENTINEL }, - "bootcode [-b bootcode] [-p partcode] [-i index] [-f flags] geom" + "[-b bootcode] [-p partcode] [-i index] [-f flags] geom" }, { "commit", 0, gpart_issue, G_NULL_OPTS, "geom" From owner-svn-src-head@FreeBSD.ORG Sun Sep 26 22:11:41 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A9E97106567A; Sun, 26 Sep 2010 22:11:41 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9732D8FC1A; Sun, 26 Sep 2010 22:11: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 o8QMBfOh004409; Sun, 26 Sep 2010 22:11:41 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8QMBfGQ004395; Sun, 26 Sep 2010 22:11:41 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201009262211.o8QMBfGQ004395@svn.freebsd.org> From: Marius Strobl Date: Sun, 26 Sep 2010 22:11:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213188 - head/sys/dev/mii X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Sep 2010 22:11:41 -0000 Author: marius Date: Sun Sep 26 22:11:41 2010 New Revision: 213188 URL: http://svn.freebsd.org/changeset/base/213188 Log: - Remove clause 3 and 4 from TNF licenses. - Remove closes 3 & 4 from Manuel Bouyer's license. Obtained from: NetBSD Modified: head/sys/dev/mii/acphy.c head/sys/dev/mii/bmtphy.c head/sys/dev/mii/exphy.c head/sys/dev/mii/gentbi.c head/sys/dev/mii/icsphy.c head/sys/dev/mii/lxtphy.c head/sys/dev/mii/mii.h head/sys/dev/mii/nsphy.c head/sys/dev/mii/nsphyter.c head/sys/dev/mii/qsphy.c head/sys/dev/mii/tlphy.c head/sys/dev/mii/tlphyreg.h head/sys/dev/mii/ukphy.c Modified: head/sys/dev/mii/acphy.c ============================================================================== --- head/sys/dev/mii/acphy.c Sun Sep 26 21:48:32 2010 (r213187) +++ head/sys/dev/mii/acphy.c Sun Sep 26 22:11:41 2010 (r213188) @@ -14,13 +14,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 @@ -46,11 +39,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 Manuel Bouyer. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES Modified: head/sys/dev/mii/bmtphy.c ============================================================================== --- head/sys/dev/mii/bmtphy.c Sun Sep 26 21:48:32 2010 (r213187) +++ head/sys/dev/mii/bmtphy.c Sun Sep 26 22:11:41 2010 (r213188) @@ -14,13 +14,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 @@ -46,11 +39,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 Manuel Bouyer. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES Modified: head/sys/dev/mii/exphy.c ============================================================================== --- head/sys/dev/mii/exphy.c Sun Sep 26 21:48:32 2010 (r213187) +++ head/sys/dev/mii/exphy.c Sun Sep 26 22:11:41 2010 (r213188) @@ -16,13 +16,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 @@ -48,11 +41,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 Manuel Bouyer. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES Modified: head/sys/dev/mii/gentbi.c ============================================================================== --- head/sys/dev/mii/gentbi.c Sun Sep 26 21:48:32 2010 (r213187) +++ head/sys/dev/mii/gentbi.c Sun Sep 26 22:11:41 2010 (r213188) @@ -16,13 +16,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 @@ -48,11 +41,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 Manuel Bouyer. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES Modified: head/sys/dev/mii/icsphy.c ============================================================================== --- head/sys/dev/mii/icsphy.c Sun Sep 26 21:48:32 2010 (r213187) +++ head/sys/dev/mii/icsphy.c Sun Sep 26 22:11:41 2010 (r213188) @@ -16,13 +16,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 @@ -48,11 +41,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 Manuel Bouyer. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES Modified: head/sys/dev/mii/lxtphy.c ============================================================================== --- head/sys/dev/mii/lxtphy.c Sun Sep 26 21:48:32 2010 (r213187) +++ head/sys/dev/mii/lxtphy.c Sun Sep 26 22:11:41 2010 (r213188) @@ -17,13 +17,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 @@ -49,11 +42,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 Manuel Bouyer. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES Modified: head/sys/dev/mii/mii.h ============================================================================== --- head/sys/dev/mii/mii.h Sun Sep 26 21:48:32 2010 (r213187) +++ head/sys/dev/mii/mii.h Sun Sep 26 22:11:41 2010 (r213188) @@ -14,11 +14,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 Manuel Bouyer. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES Modified: head/sys/dev/mii/nsphy.c ============================================================================== --- head/sys/dev/mii/nsphy.c Sun Sep 26 21:48:32 2010 (r213187) +++ head/sys/dev/mii/nsphy.c Sun Sep 26 22:11:41 2010 (r213188) @@ -16,13 +16,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 @@ -48,11 +41,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 Manuel Bouyer. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES Modified: head/sys/dev/mii/nsphyter.c ============================================================================== --- head/sys/dev/mii/nsphyter.c Sun Sep 26 21:48:32 2010 (r213187) +++ head/sys/dev/mii/nsphyter.c Sun Sep 26 22:11:41 2010 (r213188) @@ -16,13 +16,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 @@ -48,11 +41,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 Manuel Bouyer. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES Modified: head/sys/dev/mii/qsphy.c ============================================================================== --- head/sys/dev/mii/qsphy.c Sun Sep 26 21:48:32 2010 (r213187) +++ head/sys/dev/mii/qsphy.c Sun Sep 26 22:11:41 2010 (r213188) @@ -17,13 +17,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 @@ -49,11 +42,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 Manuel Bouyer. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES Modified: head/sys/dev/mii/tlphy.c ============================================================================== --- head/sys/dev/mii/tlphy.c Sun Sep 26 21:48:32 2010 (r213187) +++ head/sys/dev/mii/tlphy.c Sun Sep 26 22:11:41 2010 (r213188) @@ -16,13 +16,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 @@ -48,11 +41,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 Manuel Bouyer. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES Modified: head/sys/dev/mii/tlphyreg.h ============================================================================== --- head/sys/dev/mii/tlphyreg.h Sun Sep 26 21:48:32 2010 (r213187) +++ head/sys/dev/mii/tlphyreg.h Sun Sep 26 22:11:41 2010 (r213188) @@ -11,11 +11,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 Manuel Bouyer. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES Modified: head/sys/dev/mii/ukphy.c ============================================================================== --- head/sys/dev/mii/ukphy.c Sun Sep 26 21:48:32 2010 (r213187) +++ head/sys/dev/mii/ukphy.c Sun Sep 26 22:11:41 2010 (r213188) @@ -16,13 +16,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 @@ -48,11 +41,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 Manuel Bouyer. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES From owner-svn-src-head@FreeBSD.ORG Mon Sep 27 09:05:51 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A516D106566B; Mon, 27 Sep 2010 09:05:51 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 90F918FC1C; Mon, 27 Sep 2010 09:05:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8R95prE023170; Mon, 27 Sep 2010 09:05:51 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8R95pBH023159; Mon, 27 Sep 2010 09:05:51 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201009270905.o8R95pBH023159@svn.freebsd.org> From: Martin Matuska Date: Mon, 27 Sep 2010 09:05:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213197 - in head: cddl/contrib/opensolaris/cmd/zpool cddl/contrib/opensolaris/lib/libzfs/common sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/uts/common/f... X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Sep 2010 09:05:51 -0000 Author: mm Date: Mon Sep 27 09:05:51 2010 New Revision: 213197 URL: http://svn.freebsd.org/changeset/base/213197 Log: Enable offlining of log devices. OpenSolaris revision and Bug IDs: 9701:cc5b64682e64 6803605 should be able to offline log devices 6726045 vdev_deflate_ratio is not set when offlining a log device 6599442 zpool import has faults in the display Approved by: delphij (mentor) Obtained from: OpenSolaris (Bug ID 6803605, 6726045, 6599442) MFC after: 3 weeks Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_util.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scrub.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Mon Sep 27 06:04:17 2010 (r213196) +++ head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Mon Sep 27 09:05:51 2010 (r213197) @@ -980,14 +980,189 @@ max_width(zpool_handle_t *zhp, nvlist_t return (max); } +typedef struct spare_cbdata { + uint64_t cb_guid; + zpool_handle_t *cb_zhp; +} spare_cbdata_t; + +static boolean_t +find_vdev(nvlist_t *nv, uint64_t search) +{ + uint64_t guid; + nvlist_t **child; + uint_t c, children; + + if (nvlist_lookup_uint64(nv, ZPOOL_CONFIG_GUID, &guid) == 0 && + search == guid) + return (B_TRUE); + + if (nvlist_lookup_nvlist_array(nv, ZPOOL_CONFIG_CHILDREN, + &child, &children) == 0) { + for (c = 0; c < children; c++) + if (find_vdev(child[c], search)) + return (B_TRUE); + } + + return (B_FALSE); +} + +static int +find_spare(zpool_handle_t *zhp, void *data) +{ + spare_cbdata_t *cbp = data; + nvlist_t *config, *nvroot; + + config = zpool_get_config(zhp, NULL); + verify(nvlist_lookup_nvlist(config, ZPOOL_CONFIG_VDEV_TREE, + &nvroot) == 0); + + if (find_vdev(nvroot, cbp->cb_guid)) { + cbp->cb_zhp = zhp; + return (1); + } + + zpool_close(zhp); + return (0); +} + +/* + * Print out configuration state as requested by status_callback. + */ +void +print_status_config(zpool_handle_t *zhp, const char *name, nvlist_t *nv, + int namewidth, int depth, boolean_t isspare) +{ + nvlist_t **child; + uint_t c, children; + vdev_stat_t *vs; + char rbuf[6], wbuf[6], cbuf[6], repaired[7]; + char *vname; + uint64_t notpresent; + spare_cbdata_t cb; + char *state; + + verify(nvlist_lookup_uint64_array(nv, ZPOOL_CONFIG_STATS, + (uint64_t **)&vs, &c) == 0); + + if (nvlist_lookup_nvlist_array(nv, ZPOOL_CONFIG_CHILDREN, + &child, &children) != 0) + children = 0; + + state = zpool_state_to_name(vs->vs_state, vs->vs_aux); + if (isspare) { + /* + * For hot spares, we use the terms 'INUSE' and 'AVAILABLE' for + * online drives. + */ + if (vs->vs_aux == VDEV_AUX_SPARED) + state = "INUSE"; + else if (vs->vs_state == VDEV_STATE_HEALTHY) + state = "AVAIL"; + } + + (void) printf("\t%*s%-*s %-8s", depth, "", namewidth - depth, + name, state); + + if (!isspare) { + zfs_nicenum(vs->vs_read_errors, rbuf, sizeof (rbuf)); + zfs_nicenum(vs->vs_write_errors, wbuf, sizeof (wbuf)); + zfs_nicenum(vs->vs_checksum_errors, cbuf, sizeof (cbuf)); + (void) printf(" %5s %5s %5s", rbuf, wbuf, cbuf); + } + + if (nvlist_lookup_uint64(nv, ZPOOL_CONFIG_NOT_PRESENT, + ¬present) == 0) { + char *path; + verify(nvlist_lookup_string(nv, ZPOOL_CONFIG_PATH, &path) == 0); + (void) printf(" was %s", path); + } else if (vs->vs_aux != 0) { + (void) printf(" "); + + switch (vs->vs_aux) { + case VDEV_AUX_OPEN_FAILED: + (void) printf(gettext("cannot open")); + break; + + case VDEV_AUX_BAD_GUID_SUM: + (void) printf(gettext("missing device")); + break; + + case VDEV_AUX_NO_REPLICAS: + (void) printf(gettext("insufficient replicas")); + break; + + case VDEV_AUX_VERSION_NEWER: + (void) printf(gettext("newer version")); + break; + + case VDEV_AUX_SPARED: + verify(nvlist_lookup_uint64(nv, ZPOOL_CONFIG_GUID, + &cb.cb_guid) == 0); + if (zpool_iter(g_zfs, find_spare, &cb) == 1) { + if (strcmp(zpool_get_name(cb.cb_zhp), + zpool_get_name(zhp)) == 0) + (void) printf(gettext("currently in " + "use")); + else + (void) printf(gettext("in use by " + "pool '%s'"), + zpool_get_name(cb.cb_zhp)); + zpool_close(cb.cb_zhp); + } else { + (void) printf(gettext("currently in use")); + } + break; + + case VDEV_AUX_ERR_EXCEEDED: + (void) printf(gettext("too many errors")); + break; + + case VDEV_AUX_IO_FAILURE: + (void) printf(gettext("experienced I/O failures")); + break; + + case VDEV_AUX_BAD_LOG: + (void) printf(gettext("bad intent log")); + break; + + default: + (void) printf(gettext("corrupted data")); + break; + } + } else if (vs->vs_scrub_repaired != 0 && children == 0) { + /* + * Report bytes resilvered/repaired on leaf devices. + */ + zfs_nicenum(vs->vs_scrub_repaired, repaired, sizeof (repaired)); + (void) printf(gettext(" %s %s"), repaired, + (vs->vs_scrub_type == POOL_SCRUB_RESILVER) ? + "resilvered" : "repaired"); + } + + (void) printf("\n"); + + for (c = 0; c < children; c++) { + uint64_t is_log = B_FALSE; + + /* Don't print logs here */ + (void) nvlist_lookup_uint64(child[c], ZPOOL_CONFIG_IS_LOG, + &is_log); + if (is_log) + continue; + vname = zpool_vdev_name(g_zfs, zhp, child[c]); + print_status_config(zhp, vname, child[c], + namewidth, depth + 2, isspare); + free(vname); + } +} + /* * Print the configuration of an exported pool. Iterate over all vdevs in the * pool, printing out the name and status for each one. */ void -print_import_config(const char *name, nvlist_t *nv, int namewidth, int depth, - boolean_t print_logs) +print_import_config(const char *name, nvlist_t *nv, int namewidth, int depth) { nvlist_t **child; uint_t c, children; @@ -1044,12 +1219,11 @@ print_import_config(const char *name, nv (void) nvlist_lookup_uint64(child[c], ZPOOL_CONFIG_IS_LOG, &is_log); - if ((is_log && !print_logs) || (!is_log && print_logs)) + if (is_log) continue; vname = zpool_vdev_name(g_zfs, NULL, child[c]); - print_import_config(vname, child[c], - namewidth, depth + 2, B_FALSE); + print_import_config(vname, child[c], namewidth, depth + 2); free(vname); } @@ -1075,6 +1249,43 @@ print_import_config(const char *name, nv } /* + * Print log vdevs. + * Logs are recorded as top level vdevs in the main pool child array + * but with "is_log" set to 1. We use either print_status_config() or + * print_import_config() to print the top level logs then any log + * children (eg mirrored slogs) are printed recursively - which + * works because only the top level vdev is marked "is_log" + */ +static void +print_logs(zpool_handle_t *zhp, nvlist_t *nv, int namewidth, boolean_t verbose) +{ + uint_t c, children; + nvlist_t **child; + + if (nvlist_lookup_nvlist_array(nv, ZPOOL_CONFIG_CHILDREN, &child, + &children) != 0) + return; + + (void) printf(gettext("\tlogs\n")); + + for (c = 0; c < children; c++) { + uint64_t is_log = B_FALSE; + char *name; + + (void) nvlist_lookup_uint64(child[c], ZPOOL_CONFIG_IS_LOG, + &is_log); + if (!is_log) + continue; + name = zpool_vdev_name(g_zfs, zhp, child[c]); + if (verbose) + print_status_config(zhp, name, child[c], namewidth, + 2, B_FALSE); + else + print_import_config(name, child[c], namewidth, 2); + free(name); + } +} +/* * Display the status for the given pool. */ static void @@ -1242,11 +1453,9 @@ show_import(nvlist_t *config) if (namewidth < 10) namewidth = 10; - print_import_config(name, nvroot, namewidth, 0, B_FALSE); - if (num_logs(nvroot) > 0) { - (void) printf(gettext("\tlogs\n")); - print_import_config(name, nvroot, namewidth, 0, B_TRUE); - } + print_import_config(name, nvroot, namewidth, 0); + if (num_logs(nvroot) > 0) + print_logs(NULL, nvroot, namewidth, B_FALSE); if (reason == ZPOOL_STATUS_BAD_GUID_SUM) { (void) printf(gettext("\n\tAdditional devices are known to " @@ -2717,182 +2926,6 @@ print_scrub_status(nvlist_t *nvroot) (u_longlong_t)(minutes_left / 60), (uint_t)(minutes_left % 60)); } -typedef struct spare_cbdata { - uint64_t cb_guid; - zpool_handle_t *cb_zhp; -} spare_cbdata_t; - -static boolean_t -find_vdev(nvlist_t *nv, uint64_t search) -{ - uint64_t guid; - nvlist_t **child; - uint_t c, children; - - if (nvlist_lookup_uint64(nv, ZPOOL_CONFIG_GUID, &guid) == 0 && - search == guid) - return (B_TRUE); - - if (nvlist_lookup_nvlist_array(nv, ZPOOL_CONFIG_CHILDREN, - &child, &children) == 0) { - for (c = 0; c < children; c++) - if (find_vdev(child[c], search)) - return (B_TRUE); - } - - return (B_FALSE); -} - -static int -find_spare(zpool_handle_t *zhp, void *data) -{ - spare_cbdata_t *cbp = data; - nvlist_t *config, *nvroot; - - config = zpool_get_config(zhp, NULL); - verify(nvlist_lookup_nvlist(config, ZPOOL_CONFIG_VDEV_TREE, - &nvroot) == 0); - - if (find_vdev(nvroot, cbp->cb_guid)) { - cbp->cb_zhp = zhp; - return (1); - } - - zpool_close(zhp); - return (0); -} - -/* - * Print out configuration state as requested by status_callback. - */ -void -print_status_config(zpool_handle_t *zhp, const char *name, nvlist_t *nv, - int namewidth, int depth, boolean_t isspare) -{ - nvlist_t **child; - uint_t c, children; - vdev_stat_t *vs; - char rbuf[6], wbuf[6], cbuf[6], repaired[7]; - char *vname; - uint64_t notpresent; - spare_cbdata_t cb; - char *state; - - verify(nvlist_lookup_uint64_array(nv, ZPOOL_CONFIG_STATS, - (uint64_t **)&vs, &c) == 0); - - if (nvlist_lookup_nvlist_array(nv, ZPOOL_CONFIG_CHILDREN, - &child, &children) != 0) - children = 0; - - state = zpool_state_to_name(vs->vs_state, vs->vs_aux); - if (isspare) { - /* - * For hot spares, we use the terms 'INUSE' and 'AVAILABLE' for - * online drives. - */ - if (vs->vs_aux == VDEV_AUX_SPARED) - state = "INUSE"; - else if (vs->vs_state == VDEV_STATE_HEALTHY) - state = "AVAIL"; - } - - (void) printf("\t%*s%-*s %-8s", depth, "", namewidth - depth, - name, state); - - if (!isspare) { - zfs_nicenum(vs->vs_read_errors, rbuf, sizeof (rbuf)); - zfs_nicenum(vs->vs_write_errors, wbuf, sizeof (wbuf)); - zfs_nicenum(vs->vs_checksum_errors, cbuf, sizeof (cbuf)); - (void) printf(" %5s %5s %5s", rbuf, wbuf, cbuf); - } - - if (nvlist_lookup_uint64(nv, ZPOOL_CONFIG_NOT_PRESENT, - ¬present) == 0) { - char *path; - verify(nvlist_lookup_string(nv, ZPOOL_CONFIG_PATH, &path) == 0); - (void) printf(" was %s", path); - } else if (vs->vs_aux != 0) { - (void) printf(" "); - - switch (vs->vs_aux) { - case VDEV_AUX_OPEN_FAILED: - (void) printf(gettext("cannot open")); - break; - - case VDEV_AUX_BAD_GUID_SUM: - (void) printf(gettext("missing device")); - break; - - case VDEV_AUX_NO_REPLICAS: - (void) printf(gettext("insufficient replicas")); - break; - - case VDEV_AUX_VERSION_NEWER: - (void) printf(gettext("newer version")); - break; - - case VDEV_AUX_SPARED: - verify(nvlist_lookup_uint64(nv, ZPOOL_CONFIG_GUID, - &cb.cb_guid) == 0); - if (zpool_iter(g_zfs, find_spare, &cb) == 1) { - if (strcmp(zpool_get_name(cb.cb_zhp), - zpool_get_name(zhp)) == 0) - (void) printf(gettext("currently in " - "use")); - else - (void) printf(gettext("in use by " - "pool '%s'"), - zpool_get_name(cb.cb_zhp)); - zpool_close(cb.cb_zhp); - } else { - (void) printf(gettext("currently in use")); - } - break; - - case VDEV_AUX_ERR_EXCEEDED: - (void) printf(gettext("too many errors")); - break; - - case VDEV_AUX_IO_FAILURE: - (void) printf(gettext("experienced I/O failures")); - break; - - case VDEV_AUX_BAD_LOG: - (void) printf(gettext("bad intent log")); - break; - - default: - (void) printf(gettext("corrupted data")); - break; - } - } else if (vs->vs_scrub_repaired != 0 && children == 0) { - /* - * Report bytes resilvered/repaired on leaf devices. - */ - zfs_nicenum(vs->vs_scrub_repaired, repaired, sizeof (repaired)); - (void) printf(gettext(" %s %s"), repaired, - (vs->vs_scrub_type == POOL_SCRUB_RESILVER) ? - "resilvered" : "repaired"); - } - - (void) printf("\n"); - - for (c = 0; c < children; c++) { - uint64_t is_log = B_FALSE; - - /* Don't print logs here */ - (void) nvlist_lookup_uint64(child[c], ZPOOL_CONFIG_IS_LOG, - &is_log); - if (is_log) - continue; - vname = zpool_vdev_name(g_zfs, zhp, child[c]); - print_status_config(zhp, vname, child[c], - namewidth, depth + 2, isspare); - free(vname); - } -} - static void print_error_log(zpool_handle_t *zhp) { @@ -2969,39 +3002,6 @@ print_l2cache(zpool_handle_t *zhp, nvlis } /* - * Print log vdevs. - * Logs are recorded as top level vdevs in the main pool child array but with - * "is_log" set to 1. We use print_status_config() to print the top level logs - * then any log children (eg mirrored slogs) are printed recursively - which - * works because only the top level vdev is marked "is_log" - */ -static void -print_logs(zpool_handle_t *zhp, nvlist_t *nv, int namewidth) -{ - uint_t c, children; - nvlist_t **child; - - if (nvlist_lookup_nvlist_array(nv, ZPOOL_CONFIG_CHILDREN, &child, - &children) != 0) - return; - - (void) printf(gettext("\tlogs\n")); - - for (c = 0; c < children; c++) { - uint64_t is_log = B_FALSE; - char *name; - - (void) nvlist_lookup_uint64(child[c], ZPOOL_CONFIG_IS_LOG, - &is_log); - if (!is_log) - continue; - name = zpool_vdev_name(g_zfs, zhp, child[c]); - print_status_config(zhp, name, child[c], namewidth, 2, B_FALSE); - free(name); - } -} - -/* * Display a summary of pool status. Displays a summary such as: * * pool: tank @@ -3229,7 +3229,7 @@ status_callback(zpool_handle_t *zhp, voi namewidth, 0, B_FALSE); if (num_logs(nvroot) > 0) - print_logs(zhp, nvroot, namewidth); + print_logs(zhp, nvroot, namewidth, B_TRUE); if (nvlist_lookup_nvlist_array(nvroot, ZPOOL_CONFIG_L2CACHE, &l2cache, &nl2cache) == 0) print_l2cache(zhp, l2cache, nl2cache, namewidth); Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Mon Sep 27 06:04:17 2010 (r213196) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Mon Sep 27 09:05:51 2010 (r213197) @@ -116,6 +116,7 @@ enum { EZFS_VDEVNOTSUP, /* unsupported vdev type */ EZFS_NOTSUP, /* ops not supported on this dataset */ EZFS_ACTIVE_SPARE, /* pool has active shared spare devices */ + EZFS_UNPLAYED_LOGS, /* log device has unplayed logs */ EZFS_UNKNOWN }; Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c Mon Sep 27 06:04:17 2010 (r213196) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c Mon Sep 27 09:05:51 2010 (r213197) @@ -1720,6 +1720,12 @@ zpool_vdev_fault(zpool_handle_t *zhp, ui */ return (zfs_error(hdl, EZFS_NOREPLICAS, msg)); + case EEXIST: + /* + * The log device has unplayed logs + */ + return (zfs_error(hdl, EZFS_UNPLAYED_LOGS, msg)); + default: return (zpool_standard_error(hdl, errno, msg)); } Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_util.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_util.c Mon Sep 27 06:04:17 2010 (r213196) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_util.c Mon Sep 27 09:05:51 2010 (r213197) @@ -210,6 +210,9 @@ libzfs_error_description(libzfs_handle_t case EZFS_ACTIVE_SPARE: return (dgettext(TEXT_DOMAIN, "pool has active shared spare " "device")); + case EZFS_UNPLAYED_LOGS: + return (dgettext(TEXT_DOMAIN, "log device has unplayed intent " + "logs")); case EZFS_UNKNOWN: return (dgettext(TEXT_DOMAIN, "unknown error")); default: Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scrub.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scrub.c Mon Sep 27 06:04:17 2010 (r213196) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scrub.c Mon Sep 27 09:05:51 2010 (r213197) @@ -351,7 +351,7 @@ traverse_zil_block(zilog_t *zilog, blkpt return; /* - * One block ("stumpy") can be allocated a long time ago; we + * One block ("stubby") can be allocated a long time ago; we * want to visit that one because it has been allocated * (on-disk) even if it hasn't been claimed (even though for * plain scrub there's nothing to do to it). Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Mon Sep 27 06:04:17 2010 (r213196) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Mon Sep 27 09:05:51 2010 (r213197) @@ -1110,6 +1110,33 @@ spa_check_removed(vdev_t *vd) } /* + * Load the slog device state from the config object since it's possible + * that the label does not contain the most up-to-date information. + */ +void +spa_load_log_state(spa_t *spa) +{ + nvlist_t *nv, *nvroot, **child; + uint64_t is_log; + uint_t children, c; + vdev_t *rvd = spa->spa_root_vdev; + + VERIFY(load_nvlist(spa, spa->spa_config_object, &nv) == 0); + VERIFY(nvlist_lookup_nvlist(nv, ZPOOL_CONFIG_VDEV_TREE, &nvroot) == 0); + VERIFY(nvlist_lookup_nvlist_array(nvroot, ZPOOL_CONFIG_CHILDREN, + &child, &children) == 0); + + for (c = 0; c < children; c++) { + vdev_t *tvd = rvd->vdev_child[c]; + + if (nvlist_lookup_uint64(child[c], ZPOOL_CONFIG_IS_LOG, + &is_log) == 0 && is_log) + vdev_load_log_state(tvd, child[c]); + } + nvlist_free(nv); +} + +/* * Check for missing log devices */ int @@ -1125,13 +1152,7 @@ spa_check_logs(spa_t *spa) return (1); } break; - - case SPA_LOG_CLEAR: - (void) dmu_objset_find(spa->spa_name, zil_clear_log_chain, NULL, - DS_FIND_CHILDREN); - break; } - spa->spa_log_state = SPA_LOG_GOOD; return (0); } @@ -1455,6 +1476,8 @@ spa_load(spa_t *spa, nvlist_t *config, s spa_config_exit(spa, SCL_ALL, FTAG); } + spa_load_log_state(spa); + if (spa_check_logs(spa)) { vdev_set_state(rvd, B_TRUE, VDEV_STATE_CANT_OPEN, VDEV_AUX_BAD_LOG); @@ -1542,6 +1565,7 @@ spa_load(spa_t *spa, nvlist_t *config, s zil_claim, tx, DS_FIND_CHILDREN); dmu_tx_commit(tx); + spa->spa_log_state = SPA_LOG_GOOD; spa->spa_sync_on = B_TRUE; txg_sync_start(spa->spa_dsl_pool); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h Mon Sep 27 06:04:17 2010 (r213196) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h Mon Sep 27 09:05:51 2010 (r213197) @@ -259,6 +259,7 @@ extern void vdev_remove_parent(vdev_t *c /* * vdev sync load and sync */ +extern void vdev_load_log_state(vdev_t *vd, nvlist_t *nv); extern void vdev_load(vdev_t *vd); extern void vdev_sync(vdev_t *vd, uint64_t txg); extern void vdev_sync_done(vdev_t *vd, uint64_t txg); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h Mon Sep 27 06:04:17 2010 (r213196) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h Mon Sep 27 09:05:51 2010 (r213197) @@ -366,9 +366,9 @@ extern uint64_t zil_itx_assign(zilog_t * extern void zil_commit(zilog_t *zilog, uint64_t seq, uint64_t oid); +extern int zil_vdev_offline(char *osname, void *txarg); extern int zil_claim(char *osname, void *txarg); extern int zil_check_log_chain(char *osname, void *txarg); -extern int zil_clear_log_chain(char *osname, void *txarg); extern void zil_sync(zilog_t *zilog, dmu_tx_t *tx); extern void zil_clean(zilog_t *zilog); extern int zil_is_committed(zilog_t *zilog); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Mon Sep 27 06:04:17 2010 (r213196) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Mon Sep 27 09:05:51 2010 (r213197) @@ -39,6 +39,7 @@ #include #include #include +#include SYSCTL_DECL(_vfs_zfs); SYSCTL_NODE(_vfs_zfs, OID_AUTO, vdev, CTLFLAG_RW, 0, "ZFS VDEV"); @@ -765,6 +766,15 @@ vdev_metaslab_init(vdev_t *vd, uint64_t if (vd->vdev_ms_shift == 0) /* not being allocated from yet */ return (0); + /* + * Compute the raidz-deflation ratio. Note, we hard-code + * in 128k (1 << 17) because it is the current "typical" blocksize. + * Even if SPA_MAXBLOCKSIZE changes, this algorithm must never change, + * or we will inconsistently account for existing bp's. + */ + vd->vdev_deflate_ratio = (1 << 17) / + (vdev_psize_to_asize(vd, 1 << 17) >> SPA_MINBLOCKSHIFT); + ASSERT(oldc <= newc); if (vd->vdev_islog) @@ -998,6 +1008,8 @@ vdev_open(vdev_t *vd) vd->vdev_state == VDEV_STATE_OFFLINE); vd->vdev_stat.vs_aux = VDEV_AUX_NONE; + vd->vdev_cant_read = B_FALSE; + vd->vdev_cant_write = B_FALSE; if (!vd->vdev_removed && vd->vdev_faulted) { ASSERT(vd->vdev_children == 0); @@ -1113,18 +1125,6 @@ vdev_open(vdev_t *vd) } /* - * If this is a top-level vdev, compute the raidz-deflation - * ratio. Note, we hard-code in 128k (1<<17) because it is the - * current "typical" blocksize. Even if SPA_MAXBLOCKSIZE - * changes, this algorithm must never change, or we will - * inconsistently account for existing bp's. - */ - if (vd->vdev_top == vd) { - vd->vdev_deflate_ratio = (1<<17) / - (vdev_psize_to_asize(vd, 1<<17) >> SPA_MINBLOCKSHIFT); - } - - /* * If a leaf vdev has a DTL, and seems healthy, then kick off a * resilver. But don't do this if we are doing a reopen for a scrub, * since this would just restart the scrub we are already doing. @@ -1937,7 +1937,8 @@ vdev_online(spa_t *spa, uint64_t guid, u int vdev_offline(spa_t *spa, uint64_t guid, uint64_t flags) { - vdev_t *vd; + vdev_t *vd, *tvd; + int error; spa_vdev_state_enter(spa); @@ -1947,34 +1948,58 @@ vdev_offline(spa_t *spa, uint64_t guid, if (!vd->vdev_ops->vdev_op_leaf) return (spa_vdev_state_exit(spa, NULL, ENOTSUP)); + tvd = vd->vdev_top; + /* * If the device isn't already offline, try to offline it. */ if (!vd->vdev_offline) { /* * If this device has the only valid copy of some data, - * don't allow it to be offlined. + * don't allow it to be offlined. Log devices are always + * expendable. */ - if (vd->vdev_aux == NULL && vdev_dtl_required(vd)) + if (!tvd->vdev_islog && vd->vdev_aux == NULL && + vdev_dtl_required(vd)) return (spa_vdev_state_exit(spa, NULL, EBUSY)); /* * Offline this device and reopen its top-level vdev. - * If this action results in the top-level vdev becoming - * unusable, undo it and fail the request. + * If the top-level vdev is a log device then just offline + * it. Otherwise, if this action results in the top-level + * vdev becoming unusable, undo it and fail the request. */ vd->vdev_offline = B_TRUE; - vdev_reopen(vd->vdev_top); - if (vd->vdev_aux == NULL && vdev_is_dead(vd->vdev_top)) { + vdev_reopen(tvd); + + if (!tvd->vdev_islog && vd->vdev_aux == NULL && + vdev_is_dead(tvd)) { vd->vdev_offline = B_FALSE; - vdev_reopen(vd->vdev_top); + vdev_reopen(tvd); return (spa_vdev_state_exit(spa, NULL, EBUSY)); } } vd->vdev_tmpoffline = !!(flags & ZFS_OFFLINE_TEMPORARY); - return (spa_vdev_state_exit(spa, vd, 0)); + if (!tvd->vdev_islog || !vdev_is_dead(tvd)) + return (spa_vdev_state_exit(spa, vd, 0)); + + (void) spa_vdev_state_exit(spa, vd, 0); + + error = dmu_objset_find(spa_name(spa), zil_vdev_offline, + NULL, DS_FIND_CHILDREN); + if (error) { + (void) vdev_online(spa, guid, 0, NULL); + return (error); + } + /* + * If we successfully offlined the log device then we need to + * sync out the current txg so that the "stubby" block can be + * removed by zil_sync(). + */ + txg_wait_synced(spa->spa_dsl_pool, 0); + return (0); } /* @@ -2279,6 +2304,7 @@ vdev_space_update(vdev_t *vd, int64_t sp * childrens', thus not accurate enough for us. */ ASSERT((dspace_delta & (SPA_MINBLOCKSIZE-1)) == 0); + ASSERT(vd->vdev_deflate_ratio != 0 || vd->vdev_isl2cache); dspace_delta = (dspace_delta >> SPA_MINBLOCKSHIFT) * vd->vdev_deflate_ratio; @@ -2631,11 +2657,7 @@ vdev_set_state(vdev_t *vd, boolean_t iso boolean_t vdev_is_bootable(vdev_t *vd) { -#ifdef __FreeBSD_version - return (B_TRUE); -#else - int c; - +#ifdef sun if (!vd->vdev_ops->vdev_op_leaf) { char *vdev_type = vd->vdev_ops->vdev_op_type; @@ -2654,6 +2676,35 @@ vdev_is_bootable(vdev_t *vd) if (!vdev_is_bootable(vd->vdev_child[c])) return (B_FALSE); } +#endif /* sun */ return (B_TRUE); -#endif +} + +void +vdev_load_log_state(vdev_t *vd, nvlist_t *nv) +{ + uint_t c, children; + nvlist_t **child; + uint64_t val; + spa_t *spa = vd->vdev_spa; + + if (nvlist_lookup_nvlist_array(nv, ZPOOL_CONFIG_CHILDREN, + &child, &children) == 0) { + for (c = 0; c < children; c++) + vdev_load_log_state(vd->vdev_child[c], child[c]); + } + + if (vd->vdev_ops->vdev_op_leaf && nvlist_lookup_uint64(nv, + ZPOOL_CONFIG_OFFLINE, &val) == 0 && val) { + + /* + * It would be nice to call vdev_offline() + * directly but the pool isn't fully loaded and + * the txg threads have not been started yet. + */ + spa_config_enter(spa, SCL_STATE_ALL, FTAG, RW_WRITER); + vd->vdev_offline = val; + vdev_reopen(vd->vdev_top); + spa_config_exit(spa, SCL_STATE_ALL, FTAG); + } } Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Mon Sep 27 06:04:17 2010 (r213196) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Mon Sep 27 09:05:51 2010 (r213197) @@ -25,6 +25,7 @@ #include #include +#include #include #include #include @@ -515,6 +516,13 @@ zil_claim(char *osname, void *txarg) zilog = dmu_objset_zil(os); zh = zil_header_in_syncing_context(zilog); + if (zilog->zl_spa->spa_log_state == SPA_LOG_CLEAR) { + if (!BP_IS_HOLE(&zh->zh_log)) + zio_free_blk(zilog->zl_spa, &zh->zh_log, first_txg); + BP_ZERO(&zh->zh_log); + dsl_dataset_dirty(dmu_objset_ds(os), tx); + } + /* * Record here whether the zil has any records to replay. * If the header block pointer is null or the block points @@ -527,8 +535,10 @@ zil_claim(char *osname, void *txarg) * Note, the intent log can be empty but still need the * stubby to be claimed. */ - if (!zil_empty(zilog)) + if (!zil_empty(zilog)) { zh->zh_flags |= ZIL_REPLAY_NEEDED; + dsl_dataset_dirty(dmu_objset_ds(os), tx); + } /* * Claim all log blocks if we haven't already done so, and remember @@ -597,36 +607,6 @@ zil_check_log_chain(char *osname, void * return (error); } -/* - * Clear a log chain - */ -/* ARGSUSED */ -int -zil_clear_log_chain(char *osname, void *txarg) -{ - zilog_t *zilog; - zil_header_t *zh; - objset_t *os; - dmu_tx_t *tx; - int error; - - error = dmu_objset_open(osname, DMU_OST_ANY, DS_MODE_USER, &os); - if (error) { - cmn_err(CE_WARN, "can't open objset for %s", osname); - return (0); - } - - zilog = dmu_objset_zil(os); - tx = dmu_tx_create(zilog->zl_os); - (void) dmu_tx_assign(tx, TXG_WAIT); - zh = zil_header_in_syncing_context(zilog); - BP_ZERO(&zh->zh_log); - dsl_dataset_dirty(dmu_objset_ds(os), tx); - dmu_tx_commit(tx); - dmu_objset_close(os); - return (0); -} - static int zil_vdev_compare(const void *x1, const void *x2) { @@ -771,9 +751,9 @@ zil_lwb_write_init(zilog_t *zilog, lwb_t } if (lwb->lwb_zio == NULL) { lwb->lwb_zio = zio_rewrite(zilog->zl_root_zio, zilog->zl_spa, - 0, &lwb->lwb_blk, lwb->lwb_buf, - lwb->lwb_sz, zil_lwb_write_done, lwb, - ZIO_PRIORITY_LOG_WRITE, ZIO_FLAG_CANFAIL, &zb); + 0, &lwb->lwb_blk, lwb->lwb_buf, lwb->lwb_sz, + zil_lwb_write_done, lwb, ZIO_PRIORITY_LOG_WRITE, + ZIO_FLAG_CANFAIL | ZIO_FLAG_SPECULATIVE, &zb); } } @@ -1270,12 +1250,7 @@ zil_sync(zilog_t *zilog, dmu_tx_t *tx) } } - for (;;) { - lwb = list_head(&zilog->zl_lwb_list); - if (lwb == NULL) { - mutex_exit(&zilog->zl_lock); - return; - } + while ((lwb = list_head(&zilog->zl_lwb_list)) != NULL) { zh->zh_log = lwb->lwb_blk; if (lwb->lwb_buf != NULL || lwb->lwb_max_txg > txg) break; @@ -1692,3 +1667,24 @@ out: mutex_exit(&zilog->zl_lock); return (ret); } + +/* ARGSUSED */ +int +zil_vdev_offline(char *osname, void *arg) +{ + objset_t *os; + zilog_t *zilog; + int error; + + error = dmu_objset_open(osname, DMU_OST_ANY, DS_MODE_USER, &os); + if (error) + return (error); + + zilog = dmu_objset_zil(os); + if (zil_suspend(zilog) != 0) + error = EEXIST; + else + zil_resume(zilog); + dmu_objset_close(os); + return (error); +} From owner-svn-src-head@FreeBSD.ORG Mon Sep 27 09:40:57 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C8DBC106566C; Mon, 27 Sep 2010 09:40:57 +0000 (UTC) (envelope-from pluknet@gmail.com) Received: from mail-qw0-f54.google.com (mail-qw0-f54.google.com [209.85.216.54]) by mx1.freebsd.org (Postfix) with ESMTP id 345D78FC19; Mon, 27 Sep 2010 09:40:56 +0000 (UTC) Received: by qwd6 with SMTP id 6so3219610qwd.13 for ; Mon, 27 Sep 2010 02:40:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=GPQObodUL3TLiqA4JekLmwig+cVVOWRqvkAPVwo7n7g=; b=lliC5DL3vjs45dvB0uk4NR3Y677xYzlfUOV+SSDVOPTi5VNlMxJ7/593ji75lUmuzM qr3yI9tSFp4nLm++IiA2C0VmFNXVQOovXBr/YFVrcOAJEJQ0hD7Xzz/xcLhmJ6WQKMmk DTh5O1KuCQLCu3pYs043NGKxwBXsn/EYAkIIE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=DHQABEbDARljFlPbHq4c0xXDBmlg3G1tBTIxTdcrdiFI7kYzeolzYpyWXA5iAwTKLB O982U4kx46Lk3pW/dkQqE98j38Sl0Z85VABadQ/gET8IJ6TGbHc4X8yUTS6vPIz6I5Sr 2P04c492BOXfo1qELLSjHoJEv/qB+TjZVGDjo= MIME-Version: 1.0 Received: by 10.229.215.208 with SMTP id hf16mr5483960qcb.79.1285580456059; Mon, 27 Sep 2010 02:40:56 -0700 (PDT) Received: by 10.229.50.8 with HTTP; Mon, 27 Sep 2010 02:40:56 -0700 (PDT) In-Reply-To: <86mxr4eq6k.fsf@kopusha.home.net> References: <201009260145.o8Q1jXUk078511@svn.freebsd.org> <86mxr4eq6k.fsf@kopusha.home.net> Date: Mon, 27 Sep 2010 13:40:56 +0400 Message-ID: From: pluknet To: Mikolaj Golub Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Ed Maste Subject: Re: svn commit: r213181 - head/usr.sbin/watchdogd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Sep 2010 09:40:57 -0000 On 26 September 2010 14:48, Mikolaj Golub wrote: > > On Sun, 26 Sep 2010 01:45:33 +0000 (UTC) Ed Maste wrote: > > =A0EM> Log: > =A0EM> =A0 Protect the watchdog daemon against swap OOM killer. =A0This i= s similar to > =A0EM> =A0 SVN r199804 which added protection to sshd, cron, syslogd, and= inetd. > > May be there is a sense to have some utility in the system so that an adm= in > could protect any process he wanted? E.g. something like in the attach. > Hi. You might want to look at is sysutils/scprotect in ports. Not sure that's what you want though. --=20 wbr, pluknet From owner-svn-src-head@FreeBSD.ORG Mon Sep 27 09:42:31 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C95F1106566B; Mon, 27 Sep 2010 09:42:31 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B63498FC17; Mon, 27 Sep 2010 09:42:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8R9gV0E026091; Mon, 27 Sep 2010 09:42:31 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8R9gVVo026079; Mon, 27 Sep 2010 09:42:31 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201009270942.o8R9gVVo026079@svn.freebsd.org> From: Martin Matuska Date: Mon, 27 Sep 2010 09:42:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213198 - in head: cddl/contrib/opensolaris/cmd/zinject sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Sep 2010 09:42:32 -0000 Author: mm Date: Mon Sep 27 09:42:31 2010 New Revision: 213198 URL: http://svn.freebsd.org/changeset/base/213198 Log: Properly handle IO with B_FAILFAST Retry IO once with ZIO_FLAG_TRYHARD before declaring a pool faulted OpenSolaris revision and Bug IDs: 9725:0bf7402e8022 6843014 ZFS B_FAILFAST handling is broken Approved by: delphij (mentor) Obtained from: OpenSolaris (Bug ID 6843014) MFC after: 3 weeks Modified: head/cddl/contrib/opensolaris/cmd/zinject/zinject.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ioctl.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_disk.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_fm.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio_inject.c Modified: head/cddl/contrib/opensolaris/cmd/zinject/zinject.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zinject/zinject.c Mon Sep 27 09:05:51 2010 (r213197) +++ head/cddl/contrib/opensolaris/cmd/zinject/zinject.c Mon Sep 27 09:42:31 2010 (r213198) @@ -19,12 +19,10 @@ * CDDL HEADER END */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * ZFS Fault Injector * @@ -227,7 +225,7 @@ usage(void) "\t\tClear the particular record (if given a numeric ID), or\n" "\t\tall records if 'all' is specificed.\n" "\n" - "\tzinject -d device [-e errno] [-L ] pool\n" + "\tzinject -d device [-e errno] [-L ] [-F] pool\n" "\t\tInject a fault into a particular device or the device's\n" "\t\tlabel. Label injection can either be 'nvlist' or 'uber'.\n" "\t\t'errno' can either be 'nxio' (the default) or 'io'.\n" @@ -519,7 +517,7 @@ main(int argc, char **argv) return (0); } - while ((c = getopt(argc, argv, ":ab:d:f:qhc:t:l:mr:e:uL:")) != -1) { + while ((c = getopt(argc, argv, ":ab:d:f:Fqhc:t:l:mr:e:uL:")) != -1) { switch (c) { case 'a': flags |= ZINJECT_FLUSH_ARC; @@ -556,6 +554,9 @@ main(int argc, char **argv) return (1); } break; + case 'F': + record.zi_failfast = B_TRUE; + break; case 'h': usage(); return (0); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Mon Sep 27 09:05:51 2010 (r213197) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Mon Sep 27 09:42:31 2010 (r213198) @@ -4252,10 +4252,16 @@ spa_sync(spa_t *spa, uint64_t txg) if (svdcount == SPA_DVAS_PER_BP) break; } - error = vdev_config_sync(svd, svdcount, txg); + error = vdev_config_sync(svd, svdcount, txg, B_FALSE); + if (error != 0) + error = vdev_config_sync(svd, svdcount, txg, + B_TRUE); } else { error = vdev_config_sync(rvd->vdev_child, - rvd->vdev_children, txg); + rvd->vdev_children, txg, B_FALSE); + if (error != 0) + error = vdev_config_sync(rvd->vdev_child, + rvd->vdev_children, txg, B_TRUE); } spa_config_exit(spa, SCL_STATE, FTAG); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev.h Mon Sep 27 09:05:51 2010 (r213197) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev.h Mon Sep 27 09:42:31 2010 (r213198) @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -113,7 +113,8 @@ extern void vdev_queue_io_done(zio_t *zi extern void vdev_config_dirty(vdev_t *vd); extern void vdev_config_clean(vdev_t *vd); -extern int vdev_config_sync(vdev_t **svd, int svdcount, uint64_t txg); +extern int vdev_config_sync(vdev_t **svd, int svdcount, uint64_t txg, + boolean_t); extern void vdev_state_dirty(vdev_t *vd); extern void vdev_state_clean(vdev_t *vd); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ioctl.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ioctl.h Mon Sep 27 09:05:51 2010 (r213197) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ioctl.h Mon Sep 27 09:42:31 2010 (r213198) @@ -118,7 +118,7 @@ typedef struct zinject_record { uint32_t zi_error; uint64_t zi_type; uint32_t zi_freq; - uint32_t zi_pad; /* pad out to 64 bit alignment */ + uint32_t zi_failfast; } zinject_record_t; #define ZINJECT_NULL 0x1 Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h Mon Sep 27 09:05:51 2010 (r213197) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h Mon Sep 27 09:42:31 2010 (r213198) @@ -117,31 +117,33 @@ enum zio_compress { #define ZIO_PRIORITY_SCRUB (zio_priority_table[10]) #define ZIO_PRIORITY_TABLE_SIZE 11 -#define ZIO_FLAG_MUSTSUCCEED 0x00000 -#define ZIO_FLAG_CANFAIL 0x00001 -#define ZIO_FLAG_SPECULATIVE 0x00002 -#define ZIO_FLAG_CONFIG_WRITER 0x00004 -#define ZIO_FLAG_DONT_RETRY 0x00008 - -#define ZIO_FLAG_DONT_CACHE 0x00010 -#define ZIO_FLAG_DONT_QUEUE 0x00020 -#define ZIO_FLAG_DONT_AGGREGATE 0x00040 -#define ZIO_FLAG_DONT_PROPAGATE 0x00080 - -#define ZIO_FLAG_IO_BYPASS 0x00100 -#define ZIO_FLAG_IO_REPAIR 0x00200 -#define ZIO_FLAG_IO_RETRY 0x00400 -#define ZIO_FLAG_IO_REWRITE 0x00800 - -#define ZIO_FLAG_SELF_HEAL 0x01000 -#define ZIO_FLAG_RESILVER 0x02000 -#define ZIO_FLAG_SCRUB 0x04000 -#define ZIO_FLAG_SCRUB_THREAD 0x08000 - -#define ZIO_FLAG_PROBE 0x10000 -#define ZIO_FLAG_GANG_CHILD 0x20000 -#define ZIO_FLAG_RAW 0x40000 -#define ZIO_FLAG_GODFATHER 0x80000 +#define ZIO_FLAG_MUSTSUCCEED 0x000000 +#define ZIO_FLAG_CANFAIL 0x000001 +#define ZIO_FLAG_SPECULATIVE 0x000002 +#define ZIO_FLAG_CONFIG_WRITER 0x000004 +#define ZIO_FLAG_DONT_RETRY 0x000008 + +#define ZIO_FLAG_DONT_CACHE 0x000010 +#define ZIO_FLAG_DONT_QUEUE 0x000020 +#define ZIO_FLAG_DONT_AGGREGATE 0x000040 +#define ZIO_FLAG_DONT_PROPAGATE 0x000080 + +#define ZIO_FLAG_IO_BYPASS 0x000100 +#define ZIO_FLAG_IO_REPAIR 0x000200 +#define ZIO_FLAG_IO_RETRY 0x000400 +#define ZIO_FLAG_IO_REWRITE 0x000800 + +#define ZIO_FLAG_SELF_HEAL 0x001000 +#define ZIO_FLAG_RESILVER 0x002000 +#define ZIO_FLAG_SCRUB 0x004000 +#define ZIO_FLAG_SCRUB_THREAD 0x008000 + +#define ZIO_FLAG_PROBE 0x010000 +#define ZIO_FLAG_GANG_CHILD 0x020000 +#define ZIO_FLAG_RAW 0x040000 +#define ZIO_FLAG_GODFATHER 0x080000 + +#define ZIO_FLAG_TRYHARD 0x100000 #define ZIO_FLAG_GANG_INHERIT \ (ZIO_FLAG_CANFAIL | \ @@ -159,7 +161,8 @@ enum zio_compress { (ZIO_FLAG_GANG_INHERIT | \ ZIO_FLAG_IO_REPAIR | \ ZIO_FLAG_IO_RETRY | \ - ZIO_FLAG_PROBE) + ZIO_FLAG_PROBE | \ + ZIO_FLAG_TRYHARD) #define ZIO_FLAG_AGG_INHERIT \ (ZIO_FLAG_DONT_AGGREGATE | \ @@ -440,7 +443,7 @@ extern int zio_inject_list_next(int *id, struct zinject_record *record); extern int zio_clear_fault(int id); extern int zio_handle_fault_injection(zio_t *zio, int error); -extern int zio_handle_device_injection(vdev_t *vd, int error); +extern int zio_handle_device_injection(vdev_t *vd, zio_t *zio, int error); extern int zio_handle_label_injection(zio_t *zio, int error); #ifdef __cplusplus Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Mon Sep 27 09:05:51 2010 (r213197) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Mon Sep 27 09:42:31 2010 (r213198) @@ -928,7 +928,7 @@ vdev_probe(vdev_t *vd, zio_t *zio) vps->vps_flags = ZIO_FLAG_CANFAIL | ZIO_FLAG_PROBE | ZIO_FLAG_DONT_CACHE | ZIO_FLAG_DONT_AGGREGATE | - ZIO_FLAG_DONT_RETRY; + ZIO_FLAG_TRYHARD; if (spa_config_held(spa, SCL_ZIO, RW_WRITER)) { /* @@ -1025,7 +1025,7 @@ vdev_open(vdev_t *vd) error = vd->vdev_ops->vdev_op_open(vd, &osize, &ashift); if (zio_injection_enabled && error == 0) - error = zio_handle_device_injection(vd, ENXIO); + error = zio_handle_device_injection(vd, NULL, ENXIO); if (error) { if (vd->vdev_removed && @@ -2207,6 +2207,16 @@ vdev_stat_update(zio_t *zio, uint64_t ps if (flags & ZIO_FLAG_SPECULATIVE) return; + /* + * If this is an I/O error that is going to be retried, then ignore the + * error. Otherwise, the user may interpret B_FAILFAST I/O errors as + * hard errors, when in reality they can happen for any number of + * innocuous reasons (bus resets, MPxIO link failure, etc). + */ + if (zio->io_error == EIO && + !(zio->io_flags & ZIO_FLAG_IO_RETRY)) + return; + mutex_enter(&vd->vdev_stat_lock); if (type == ZIO_TYPE_READ && !vdev_is_dead(vd)) { if (zio->io_error == ECKSUM) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_disk.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_disk.c Mon Sep 27 09:05:51 2010 (r213197) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_disk.c Mon Sep 27 09:42:31 2010 (r213198) @@ -401,8 +401,9 @@ vdev_disk_io_start(zio_t *zio) bioinit(bp); bp->b_flags = B_BUSY | B_NOCACHE | - (zio->io_type == ZIO_TYPE_READ ? B_READ : B_WRITE) | - ((zio->io_flags & ZIO_FLAG_IO_RETRY) ? 0 : B_FAILFAST); + (zio->io_type == ZIO_TYPE_READ ? B_READ : B_WRITE); + if (!(zio->io_flags & (ZIO_FLAG_IO_RETRY | ZIO_FLAG_TRYHARD))) + bp->b_flags |= B_FAILFAST; bp->b_bcount = zio->io_size; bp->b_un.b_addr = zio->io_data; bp->b_lblkno = lbtodb(zio->io_offset); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c Mon Sep 27 09:05:51 2010 (r213197) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c Mon Sep 27 09:42:31 2010 (r213198) @@ -339,8 +339,8 @@ vdev_label_read_config(vdev_t *vd) nvlist_t *config = NULL; vdev_phys_t *vp; zio_t *zio; - int flags = - ZIO_FLAG_CONFIG_WRITER | ZIO_FLAG_CANFAIL | ZIO_FLAG_SPECULATIVE; + int flags = ZIO_FLAG_CONFIG_WRITER | ZIO_FLAG_CANFAIL | + ZIO_FLAG_SPECULATIVE; ASSERT(spa_config_held(spa, SCL_STATE_ALL, RW_WRITER) == SCL_STATE_ALL); @@ -349,6 +349,7 @@ vdev_label_read_config(vdev_t *vd) vp = zio_buf_alloc(sizeof (vdev_phys_t)); +retry: for (int l = 0; l < VDEV_LABELS; l++) { zio = zio_root(spa, NULL, NULL, flags); @@ -368,6 +369,11 @@ vdev_label_read_config(vdev_t *vd) } } + if (config == NULL && !(flags & ZIO_FLAG_TRYHARD)) { + flags |= ZIO_FLAG_TRYHARD; + goto retry; + } + zio_buf_free(vp, sizeof (vdev_phys_t)); return (config); @@ -648,6 +654,7 @@ vdev_label_init(vdev_t *vd, uint64_t crt /* * Write everything in parallel. */ +retry: zio = zio_root(spa, NULL, NULL, flags); for (int l = 0; l < VDEV_LABELS; l++) { @@ -674,6 +681,11 @@ vdev_label_init(vdev_t *vd, uint64_t crt error = zio_wait(zio); + if (error != 0 && !(flags & ZIO_FLAG_TRYHARD)) { + flags |= ZIO_FLAG_TRYHARD; + goto retry; + } + nvlist_free(label); zio_buf_free(pad2, VDEV_PAD_SIZE); zio_buf_free(ub, VDEV_UBERBLOCK_SIZE(vd)); @@ -760,8 +772,8 @@ vdev_uberblock_load(zio_t *zio, vdev_t * { spa_t *spa = vd->vdev_spa; vdev_t *rvd = spa->spa_root_vdev; - int flags = - ZIO_FLAG_CONFIG_WRITER | ZIO_FLAG_CANFAIL | ZIO_FLAG_SPECULATIVE; + int flags = ZIO_FLAG_CONFIG_WRITER | ZIO_FLAG_CANFAIL | + ZIO_FLAG_SPECULATIVE | ZIO_FLAG_TRYHARD; if (vd == rvd) { ASSERT(zio == NULL); @@ -999,7 +1011,7 @@ vdev_label_sync_list(spa_t *spa, int l, * at any time, you can just call it again, and it will resume its work. */ int -vdev_config_sync(vdev_t **svd, int svdcount, uint64_t txg) +vdev_config_sync(vdev_t **svd, int svdcount, uint64_t txg, boolean_t tryhard) { spa_t *spa = svd[0]->vdev_spa; uberblock_t *ub = &spa->spa_uberblock; @@ -1008,6 +1020,16 @@ vdev_config_sync(vdev_t **svd, int svdco int error; int flags = ZIO_FLAG_CONFIG_WRITER | ZIO_FLAG_CANFAIL; + /* + * Normally, we don't want to try too hard to write every label and + * uberblock. If there is a flaky disk, we don't want the rest of the + * sync process to block while we retry. But if we can't write a + * single label out, we should retry with ZIO_FLAG_TRYHARD before + * bailing out and declaring the pool faulted. + */ + if (tryhard) + flags |= ZIO_FLAG_TRYHARD; + ASSERT(ub->ub_txg <= txg); /* Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_fm.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_fm.c Mon Sep 27 09:05:51 2010 (r213197) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_fm.c Mon Sep 27 09:42:31 2010 (r213198) @@ -134,6 +134,15 @@ zfs_ereport_post(const char *subclass, s if (zio->io_flags & ZIO_FLAG_SPECULATIVE) return; + /* + * If this I/O is not a retry I/O, don't post an ereport. + * Otherwise, we risk making bad diagnoses based on B_FAILFAST + * I/Os. + */ + if (zio->io_error == EIO && + !(zio->io_flags & ZIO_FLAG_IO_RETRY)) + return; + if (vd != NULL) { /* * If the vdev has already been marked as failing due Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Mon Sep 27 09:05:51 2010 (r213197) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Mon Sep 27 09:42:31 2010 (r213198) @@ -1870,7 +1870,8 @@ zio_vdev_io_done(zio_t *zio) vdev_cache_write(zio); if (zio_injection_enabled && zio->io_error == 0) - zio->io_error = zio_handle_device_injection(vd, EIO); + zio->io_error = zio_handle_device_injection(vd, + zio, EIO); if (zio_injection_enabled && zio->io_error == 0) zio->io_error = zio_handle_label_injection(zio, EIO); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio_inject.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio_inject.c Mon Sep 27 09:05:51 2010 (r213197) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio_inject.c Mon Sep 27 09:42:31 2010 (r213198) @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -195,7 +195,7 @@ zio_handle_label_injection(zio_t *zio, i int -zio_handle_device_injection(vdev_t *vd, int error) +zio_handle_device_injection(vdev_t *vd, zio_t *zio, int error) { inject_handler_t *handler; int ret = 0; @@ -210,6 +210,12 @@ zio_handle_device_injection(vdev_t *vd, continue; if (vd->vdev_guid == handler->zi_record.zi_guid) { + if (handler->zi_record.zi_failfast && + (zio == NULL || (zio->io_flags & + (ZIO_FLAG_IO_RETRY | ZIO_FLAG_TRYHARD)))) { + continue; + } + if (handler->zi_record.zi_error == error) { /* * For a failed open, pretend like the device From owner-svn-src-head@FreeBSD.ORG Mon Sep 27 10:06:14 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7D3E61065695; Mon, 27 Sep 2010 10:06:14 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from mail.vx.sk (mail.vx.sk [IPv6:2a01:4f8:100:1043::3]) by mx1.freebsd.org (Postfix) with ESMTP id 110298FC1B; Mon, 27 Sep 2010 10:06:14 +0000 (UTC) Received: from core.vx.sk (localhost [127.0.0.1]) by mail.vx.sk (Postfix) with ESMTP id 3D58F1233C6; Mon, 27 Sep 2010 12:06:13 +0200 (CEST) X-Virus-Scanned: amavisd-new at mail.vx.sk Received: from mail.vx.sk ([127.0.0.1]) by core.vx.sk (mail.vx.sk [127.0.0.1]) (amavisd-new, port 10024) with LMTP id xbUUMHkZXGn1; Mon, 27 Sep 2010 12:06:11 +0200 (CEST) Received: from [10.0.3.3] (188-167-67-67.dynamic.chello.sk [188.167.67.67]) by mail.vx.sk (Postfix) with ESMTPSA id 3E02C1233BD; Mon, 27 Sep 2010 12:06:11 +0200 (CEST) Message-ID: <4CA06C92.3080302@FreeBSD.org> Date: Mon, 27 Sep 2010 12:06:10 +0200 From: Martin Matuska User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; sk; rv:1.8.1.23) Gecko/20090812 Lightning/0.9 Thunderbird/2.0.0.23 Mnenhy/0.7.5.0 MIME-Version: 1.0 To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201009270942.o8R9gVVo026079@svn.freebsd.org> In-Reply-To: <201009270942.o8R9gVVo026079@svn.freebsd.org> X-Enigmail-Version: 1.1.1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: Subject: Re: svn commit: r213198 - in head: cddl/contrib/opensolaris/cmd/zinject sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Sep 2010 10:06:14 -0000 As FreeBSD does not support B_FAILFAST handling and we don't use vdev_disk.c, please treat this commit as a no-op with the purpose of diff reduction against latest ZFS code to make future updates easier. From owner-svn-src-head@FreeBSD.ORG Mon Sep 27 11:31:44 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EB8A5106566B; Mon, 27 Sep 2010 11:31:44 +0000 (UTC) (envelope-from to.my.trociny@gmail.com) Received: from mail-fx0-f54.google.com (mail-fx0-f54.google.com [209.85.161.54]) by mx1.freebsd.org (Postfix) with ESMTP id F2F1E8FC12; Mon, 27 Sep 2010 11:31:43 +0000 (UTC) Received: by fxm9 with SMTP id 9so3443866fxm.13 for ; Mon, 27 Sep 2010 04:31:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject :organization:references:date:in-reply-to:message-id:user-agent :mime-version:content-type:content-transfer-encoding; bh=tWIrtyRnbP+KWpmOPHFH0xux6DQK/NNfWo0edwo/Nrc=; b=rvNtMB9yxih/Ry1rYALDfNlSKq8eVR7+tiIuSgp2/yBLBRG78RaZYIffgsPNkpPDlO CX6p3Iu+BZyhfPqDADr9Dmh1FYYmAAsYUJ8Drx9QJEGJaeg1xuD5RJan5gUck1S4BNMF x7jrjdDDN9+/Dk9JEWNIrtsQ8YBXfXHUDbm4U= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:organization:references:date:in-reply-to :message-id:user-agent:mime-version:content-type :content-transfer-encoding; b=K7M3aC20M4hEeq0l/U6Tw/gXA8AQR7yaNKQeqaRAPB5AjkCMRGlfK83aS0fk3aXS3Y QTDmSrVXxLftO+sYt8MsDJDKeBlusN7vlON3QqHT7FM88zP7LsyoqtFdcAKieHmdfyNO qjCHcUvhJOPImaf5jybg8BexawwICDDpMs594= Received: by 10.223.107.199 with SMTP id c7mr5043026fap.64.1285587102681; Mon, 27 Sep 2010 04:31:42 -0700 (PDT) Received: from localhost (ua1.etadirect.net [91.198.140.16]) by mx.google.com with ESMTPS id r8sm2326702faq.34.2010.09.27.04.31.40 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 27 Sep 2010 04:31:41 -0700 (PDT) From: Mikolaj Golub To: pluknet Organization: TOA Ukraine References: <201009260145.o8Q1jXUk078511@svn.freebsd.org> <86mxr4eq6k.fsf@kopusha.home.net> Date: Mon, 27 Sep 2010 14:31:39 +0300 In-Reply-To: (pluknet@gmail.com's message of "Mon, 27 Sep 2010 13:40:56 +0400") Message-ID: <86iq1rqv6s.fsf@zhuzha.ua1> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Transfer-Encoding: 8bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Ed Maste Subject: Re: svn commit: r213181 - head/usr.sbin/watchdogd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Sep 2010 11:31:45 -0000 On Mon, 27 Sep 2010 13:40:56 +0400 pluknet wrote: p> On 26 September 2010 14:48, Mikolaj Golub wrote: >> >> On Sun, 26 Sep 2010 01:45:33 +0000 (UTC) Ed Maste wrote: >> >> šEM> Log: >> šEM> š Protect the watchdog daemon against swap OOM killer. šThis is similar to >> šEM> š SVN r199804 which added protection to sshd, cron, syslogd, and inetd. >> >> May be there is a sense to have some utility in the system so that an admin >> could protect any process he wanted? E.g. something like in the attach. >> p> Hi. p> You might want to look at is sysutils/scprotect in ports. p> Not sure that's what you want though. Yes, it looks sysutils/scprotect allows to do this and even more :-) -- Mikolaj Golub From owner-svn-src-head@FreeBSD.ORG Mon Sep 27 14:50:52 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 522411065673; Mon, 27 Sep 2010 14:50:52 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 40A238FC13; Mon, 27 Sep 2010 14:50: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 o8REoqZk039223; Mon, 27 Sep 2010 14:50:52 GMT (envelope-from jchandra@svn.freebsd.org) Received: (from jchandra@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8REoqeP039219; Mon, 27 Sep 2010 14:50:52 GMT (envelope-from jchandra@svn.freebsd.org) Message-Id: <201009271450.o8REoqeP039219@svn.freebsd.org> From: "Jayachandran C." Date: Mon, 27 Sep 2010 14:50:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213199 - head/sys/mips/rmi X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Sep 2010 14:50:52 -0000 Author: jchandra Date: Mon Sep 27 14:50:51 2010 New Revision: 213199 URL: http://svn.freebsd.org/changeset/base/213199 Log: XLS B0 revision PCI support and related changes. - XLS B0 and later revision chips have PCIe link 2 & 3 mapped to different PIC interrupts. Update pic.h, board.h and xlr_pci.c to reflect this. - remove debug prints in xlr_pci.c - add more processor IDs to board.h, add function xlr_is_xls_b0() - some style(9) and whitespace fixes Modified: head/sys/mips/rmi/board.h head/sys/mips/rmi/pic.h head/sys/mips/rmi/xlr_pci.c Modified: head/sys/mips/rmi/board.h ============================================================================== --- head/sys/mips/rmi/board.h Mon Sep 27 09:42:31 2010 (r213198) +++ head/sys/mips/rmi/board.h Mon Sep 27 14:50:51 2010 (r213199) @@ -30,22 +30,22 @@ * $FreeBSD$ */ #ifndef _RMI_BOARD_H_ -#define _RMI_BOARD_H_ +#define _RMI_BOARD_H_ /* * Engineering boards have a major/minor number in their EEPROM to * identify their configuration */ -#define RMI_XLR_BOARD_ARIZONA_I 1 -#define RMI_XLR_BOARD_ARIZONA_II 2 -#define RMI_XLR_BOARD_ARIZONA_III 3 -#define RMI_XLR_BOARD_ARIZONA_IV 4 -#define RMI_XLR_BOARD_ARIZONA_V 5 -#define RMI_XLR_BOARD_ARIZONA_VI 6 -#define RMI_XLR_BOARD_ARIZONA_VII 7 -#define RMI_XLR_BOARD_ARIZONA_VIII 8 -#define RMI_XLR_BOARD_ARIZONA_XI 11 -#define RMI_XLR_BOARD_ARIZONA_XII 12 +#define RMI_XLR_BOARD_ARIZONA_I 1 +#define RMI_XLR_BOARD_ARIZONA_II 2 +#define RMI_XLR_BOARD_ARIZONA_III 3 +#define RMI_XLR_BOARD_ARIZONA_IV 4 +#define RMI_XLR_BOARD_ARIZONA_V 5 +#define RMI_XLR_BOARD_ARIZONA_VI 6 +#define RMI_XLR_BOARD_ARIZONA_VII 7 +#define RMI_XLR_BOARD_ARIZONA_VIII 8 +#define RMI_XLR_BOARD_ARIZONA_XI 11 +#define RMI_XLR_BOARD_ARIZONA_XII 12 /* * RMI Chips - Values in Processor ID field @@ -55,24 +55,39 @@ #define RMI_CHIP_XLR308 0x06 #define RMI_CHIP_XLR532 0x09 -#define RMI_CHIP_XLS616_B0 0x40 -#define RMI_CHIP_XLS608_B0 0x4a -#define RMI_CHIP_XLS608 0x80 /* Internal */ -#define RMI_CHIP_XLS416_B0 0x44 -#define RMI_CHIP_XLS412_B0 0x4c -#define RMI_CHIP_XLS408_B0 0x4e -#define RMI_CHIP_XLS408 0x88 /* Lite "Condor" */ -#define RMI_CHIP_XLS404_B0 0x4f -#define RMI_CHIP_XLS404 0x8c /* Lite "Condor" */ -#define RMI_CHIP_XLS208 0x8e -#define RMI_CHIP_XLS204 0x8f -#define RMI_CHIP_XLS108 0xce -#define RMI_CHIP_XLS104 0xcf +/* + * XLR C revisions + */ +#define RMI_CHIP_XLR308_C 0x0F +#define RMI_CHIP_XLR508_C 0x0b +#define RMI_CHIP_XLR516_C 0x0a +#define RMI_CHIP_XLR532_C 0x08 + +/* + * XLS processors + */ +#define RMI_CHIP_XLS408 0x88 /* Lite "Condor" */ +#define RMI_CHIP_XLS608 0x80 /* Internal */ +#define RMI_CHIP_XLS404 0x8c /* Lite "Condor" */ +#define RMI_CHIP_XLS208 0x8e +#define RMI_CHIP_XLS204 0x8f +#define RMI_CHIP_XLS108 0xce +#define RMI_CHIP_XLS104 0xcf + +/* + * XLS B revision chips + */ +#define RMI_CHIP_XLS616_B0 0x40 +#define RMI_CHIP_XLS608_B0 0x4a +#define RMI_CHIP_XLS416_B0 0x44 +#define RMI_CHIP_XLS412_B0 0x4c +#define RMI_CHIP_XLS408_B0 0x4e +#define RMI_CHIP_XLS404_B0 0x4f /* * The XLS product line has chip versions 0x4x and 0x8x */ -static __inline__ unsigned int +static __inline unsigned int xlr_is_xls(void) { uint32_t prid = mips_rd_prid(); @@ -84,18 +99,20 @@ xlr_is_xls(void) /* * The last byte of the processor id field is revision */ -static __inline__ unsigned int +static __inline unsigned int xlr_revision(void) { - return mips_rd_prid() & 0xff; + + return (mips_rd_prid() & 0xff); } /* * The 15:8 byte of the PR Id register is the Processor ID */ -static __inline__ unsigned int +static __inline unsigned int xlr_processor_id(void) { + return ((mips_rd_prid() & 0xff00) >> 8); } @@ -103,14 +120,15 @@ xlr_processor_id(void) * RMI Engineering boards which are PCI cards * These should come up in PCI device mode (not yet) */ -static __inline__ int +static __inline int xlr_board_pci(int board_major) { + return ((board_major == RMI_XLR_BOARD_ARIZONA_III) || (board_major == RMI_XLR_BOARD_ARIZONA_V)); } -static __inline__ int +static __inline int xlr_is_xls1xx(void) { uint32_t chipid = xlr_processor_id(); @@ -118,7 +136,7 @@ xlr_is_xls1xx(void) return (chipid == 0xce || chipid == 0xcf); } -static __inline__ int +static __inline int xlr_is_xls2xx(void) { uint32_t chipid = xlr_processor_id(); @@ -126,16 +144,24 @@ xlr_is_xls2xx(void) return (chipid == 0x8e || chipid == 0x8f); } -static __inline__ int +static __inline int xlr_is_xls4xx_lite(void) { uint32_t chipid = xlr_processor_id(); return (chipid == 0x88 || chipid == 0x8c); - } - +} + +static __inline unsigned int +xlr_is_xls_b0(void) +{ + uint32_t chipid = xlr_processor_id(); + + return (chipid >= 0x40 && chipid <= 0x4f); +} + /* SPI-4 --> 8 ports, 1G MAC --> 4 ports and 10G MAC --> 1 port */ -#define MAX_NA_PORTS 8 +#define MAX_NA_PORTS 8 /* all our knowledge of chip and board that cannot be detected run-time goes here */ enum gmac_block_types { XLR_GMAC, XLR_XGMAC, XLR_SPI4}; Modified: head/sys/mips/rmi/pic.h ============================================================================== --- head/sys/mips/rmi/pic.h Mon Sep 27 09:42:31 2010 (r213198) +++ head/sys/mips/rmi/pic.h Mon Sep 27 14:50:51 2010 (r213199) @@ -66,6 +66,8 @@ #define PIC_IRT_PCIE_LINK1_INDEX 27 #define PIC_IRT_PCIE_LINK2_INDEX 23 #define PIC_IRT_PCIE_LINK3_INDEX 24 +#define PIC_IRT_PCIE_B0_LINK2_INDEX 28 +#define PIC_IRT_PCIE_B0_LINK3_INDEX 29 #define PIC_IRT_PCIE_INT_INDEX 28 #define PIC_IRT_PCIE_FATAL_INDEX 29 #define PIC_IRT_GPIO_B_INDEX 30 @@ -140,7 +142,9 @@ #define PIC_PCIE_LINK1_IRQ (PIC_IRQ_BASE + PIC_IRT_PCIE_LINK1_INDEX) #define PIC_PCIE_LINK2_IRQ (PIC_IRQ_BASE + PIC_IRT_PCIE_LINK2_INDEX) #define PIC_PCIE_LINK3_IRQ (PIC_IRQ_BASE + PIC_IRT_PCIE_LINK3_INDEX) -#define PIC_PCIE_INT_IRQ (PIC_IRQ_BASE + PIC_IRT_PCIE_INT__INDEX) +#define PIC_PCIE_B0_LINK2_IRQ (PIC_IRQ_BASE + PIC_IRT_PCIE_B0_LINK2_INDEX) +#define PIC_PCIE_B0_LINK3_IRQ (PIC_IRQ_BASE + PIC_IRT_PCIE_B0_LINK3_INDEX) +#define PIC_PCIE_INT_IRQ (PIC_IRQ_BASE + PIC_IRT_PCIE_INT_INDEX) #define PIC_PCIE_FATAL_IRQ (PIC_IRQ_BASE + PIC_IRT_PCIE_FATAL_INDEX) #define PIC_GPIO_B_IRQ (PIC_IRQ_BASE + PIC_IRT_GPIO_B_INDEX) #define PIC_USB_IRQ (PIC_IRQ_BASE + PIC_IRT_USB_INDEX) Modified: head/sys/mips/rmi/xlr_pci.c ============================================================================== --- head/sys/mips/rmi/xlr_pci.c Mon Sep 27 09:42:31 2010 (r213198) +++ head/sys/mips/rmi/xlr_pci.c Mon Sep 27 14:50:51 2010 (r213199) @@ -310,19 +310,6 @@ static void xlr_pcib_identify(driver_t * driver, device_t parent) { - if (xlr_board_info.is_xls) { - xlr_reg_t *pcie_mmio_le = xlr_io_mmio(XLR_IO_PCIE_1_OFFSET); - xlr_reg_t reg_link0 = xlr_read_reg(pcie_mmio_le, (0x80 >> 2)); - xlr_reg_t reg_link1 = xlr_read_reg(pcie_mmio_le, (0x84 >> 2)); - - if ((uint16_t) reg_link0 & PCIE_LINK_STATE) { - device_printf(parent, "Link 0 up\n"); - } - if ((uint16_t) reg_link1 & PCIE_LINK_STATE) { - device_printf(parent, "Link 1 up\n"); - } - } - BUS_ADD_CHILD(parent, 0, "pcib", 0); } @@ -366,9 +353,15 @@ xls_pcie_link_irq(int link) case 1: return (PIC_PCIE_LINK1_IRQ); case 2: - return (PIC_PCIE_LINK2_IRQ); + if (xlr_is_xls_b0()) + return (PIC_PCIE_B0_LINK2_IRQ); + else + return (PIC_PCIE_LINK2_IRQ); case 3: - return (PIC_PCIE_LINK3_IRQ); + if (xlr_is_xls_b0()) + return (PIC_PCIE_B0_LINK3_IRQ); + else + return (PIC_PCIE_LINK3_IRQ); } return (-1); } @@ -395,8 +388,6 @@ xlr_alloc_msi(device_t pcib, device_t de for (i = 0; i < count; i++) irqs[i] = 64 + link * 32 + i; - device_printf(dev, "Alloc MSI count %d maxcount %d irq %d link %d\n", - count, maxcount, i, link); return (0); } @@ -414,7 +405,6 @@ xlr_map_msi(device_t pcib, device_t dev, { int msi; - device_printf(dev, "MAP MSI irq %d\n", irq); if (irq >= 64) { msi = irq - 64; *addr = MIPS_MSI_ADDR(0); @@ -448,9 +438,11 @@ bridge_pcie_ack(int irq) reg = PCIE_LINK1_MSI_STATUS; break; case PIC_PCIE_LINK2_IRQ: + case PIC_PCIE_B0_LINK2_IRQ: reg = PCIE_LINK2_MSI_STATUS; break; case PIC_PCIE_LINK3_IRQ: + case PIC_PCIE_B0_LINK3_IRQ: reg = PCIE_LINK3_MSI_STATUS; break; default: @@ -476,8 +468,6 @@ mips_platform_pci_setup_intr(device_t de return (EINVAL); } xlrirq = rman_get_start(irq); - device_printf(dev, "%s: setup intr %d\n", device_get_nameunit(child), - xlrirq); if (strcmp(device_get_name(dev), "pcib") != 0) return (0); @@ -528,9 +518,6 @@ xlr_pci_alloc_resource(device_t bus, dev vm_offset_t va; int needactivate = flags & RF_ACTIVE; - device_printf(child, "Alloc res type %d, rid %d, start %lx, end %lx, count %lx flags %u\n", - type, *rid, start, end, count, flags); - switch (type) { case SYS_RES_IRQ: rm = &irq_rman; @@ -603,8 +590,6 @@ mips_pci_route_interrupt(device_t bus, d /* * Validate requested pin number. */ - device_printf(dev, "route intr pin %d (bus %d, slot %d)\n", - pin, pci_get_bus(dev), pci_get_slot(dev)); if ((pin < 1) || (pin > 4)) return (255); From owner-svn-src-head@FreeBSD.ORG Mon Sep 27 15:49:37 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2F60E1065670; Mon, 27 Sep 2010 15:49:37 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id F17888FC16; Mon, 27 Sep 2010 15:49:36 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 8178746B81; Mon, 27 Sep 2010 11:49:36 -0400 (EDT) Received: from jhbbsd.localnet (smtp.hudson-trading.com [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id BB8E38A04E; Mon, 27 Sep 2010 11:49:34 -0400 (EDT) From: John Baldwin To: freebsd-arch@freebsd.org Date: Mon, 27 Sep 2010 09:28:47 -0400 User-Agent: KMail/1.13.5 (FreeBSD/7.3-CBSD-20100819; KDE/4.4.5; amd64; ; ) References: <201009211507.o8LF7iVv097676@svn.freebsd.org> <20100924225352.GD49476@server.vk2pj.dyndns.org> In-Reply-To: <20100924225352.GD49476@server.vk2pj.dyndns.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <201009270928.47232.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Mon, 27 Sep 2010 11:49:35 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.6 required=4.2 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Peter Jeremy Subject: Re: svn commit: r212964 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Sep 2010 15:49:37 -0000 On Friday, September 24, 2010 6:53:52 pm Peter Jeremy wrote: > [Pruning CC list and re-adding freebsd-arch on the (forlorn) hope that > this thread will move to where it belongs] > > On 2010-Sep-23 07:31:13 -0700, Matthew Jacob wrote: > >It turns out that the big issue here was more the savecore time coming > >back up rather than the time of dumping. > > In my experience, the problem isn't so much the savecore time as the > time to run /usr/bin/crashinfo. Whilst savecore needs to run early > (before anything tramples on the crashdump in swap), the latter could > run at any time. It would seem reasonable to either run crashinfo in > the background or as a batchjob triggered by /etc/rc.d/savecore. That is probably true and would be fine, yes. > On 2010-Sep-23 18:59:53 +0100, Gavin Atkinson wrote: > >I appreciate the issue about filling partitions is a valid one. Would a > >possible compromise be that on release media, crashinfo(8) or similar will > >default to only keeping the most recent coredump or similar? Given /var > >now defaults to 4GB, Defaulting to keeping a single core is probably > >acceptable. > > savecore already has support for a 'minfree' file to prevent > crashdumps filling the crashdir. Maybe the default install should > include a minfree set to (say) 512MB. The one problem this approach is it implements a FIFO instead of a LIFO. I want the N most recent crashdumps to be saved, not the first N. -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Mon Sep 27 15:55:31 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 117FA10656A6; Mon, 27 Sep 2010 15:55:31 +0000 (UTC) (envelope-from ticso@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 014898FC33; Mon, 27 Sep 2010 15:55:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8RFtUmH041095; Mon, 27 Sep 2010 15:55:30 GMT (envelope-from ticso@svn.freebsd.org) Received: (from ticso@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8RFtUTl041093; Mon, 27 Sep 2010 15:55:30 GMT (envelope-from ticso@svn.freebsd.org) Message-Id: <201009271555.o8RFtUTl041093@svn.freebsd.org> From: Bernd Walter Date: Mon, 27 Sep 2010 15:55:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213201 - head/sys/arm/at91 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Sep 2010 15:55:31 -0000 Author: ticso Date: Mon Sep 27 15:55:30 2010 New Revision: 213201 URL: http://svn.freebsd.org/changeset/base/213201 Log: fix off by one error for twi reads with len != 1. STOP must be requested before the last byte is received. Modified: head/sys/arm/at91/at91_twi.c Modified: head/sys/arm/at91/at91_twi.c ============================================================================== --- head/sys/arm/at91/at91_twi.c Mon Sep 27 15:24:16 2010 (r213200) +++ head/sys/arm/at91/at91_twi.c Mon Sep 27 15:55:30 2010 (r213201) @@ -348,7 +348,7 @@ at91_twi_transfer(device_t dev, struct i if ((sr = RD4(sc, TWI_SR)) & TWI_SR_RXRDY) { len--; *buf++ = RD4(sc, TWI_RHR) & 0xff; - if (len == 0 && msgs[i].len != 1) + if (len == 1) WR4(sc, TWI_CR, TWI_CR_STOP); } } From owner-svn-src-head@FreeBSD.ORG Mon Sep 27 15:55:39 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8192C1065697; Mon, 27 Sep 2010 15:55:39 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5712A8FC13; Mon, 27 Sep 2010 15:55: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 o8RFtdLo041133; Mon, 27 Sep 2010 15:55:39 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8RFtd1a041131; Mon, 27 Sep 2010 15:55:39 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201009271555.o8RFtd1a041131@svn.freebsd.org> From: Warner Losh Date: Mon, 27 Sep 2010 15:55:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213202 - head/etc/rc.d X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Sep 2010 15:55:39 -0000 Author: imp Date: Mon Sep 27 15:55:39 2010 New Revision: 213202 URL: http://svn.freebsd.org/changeset/base/213202 Log: Prefer echo over printf Modified: head/etc/rc.d/nsswitch Modified: head/etc/rc.d/nsswitch ============================================================================== --- head/etc/rc.d/nsswitch Mon Sep 27 15:55:30 2010 (r213201) +++ head/etc/rc.d/nsswitch Mon Sep 27 15:55:39 2010 (r213202) @@ -80,7 +80,7 @@ generate_host_conf() cache | *=*) ;; *) - printf "Warning: unrecognized source [%s]\n" $_s >&2 + echo "Warning: unrecognized source [$_s]" >&2 ;; esac done From owner-svn-src-head@FreeBSD.ORG Mon Sep 27 15:58:20 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 450221065672; Mon, 27 Sep 2010 15:58:20 +0000 (UTC) (envelope-from ticso@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 34CE08FC34; Mon, 27 Sep 2010 15:58:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8RFwKlu041220; Mon, 27 Sep 2010 15:58:20 GMT (envelope-from ticso@svn.freebsd.org) Received: (from ticso@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8RFwKwt041218; Mon, 27 Sep 2010 15:58:20 GMT (envelope-from ticso@svn.freebsd.org) Message-Id: <201009271558.o8RFwKwt041218@svn.freebsd.org> From: Bernd Walter Date: Mon, 27 Sep 2010 15:58:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213203 - head/sys/arm/at91 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Sep 2010 15:58:20 -0000 Author: ticso Date: Mon Sep 27 15:58:19 2010 New Revision: 213203 URL: http://svn.freebsd.org/changeset/base/213203 Log: The TWI controller automatically stops if we don't fill up with new data in time. Modified: head/sys/arm/at91/at91_twi.c Modified: head/sys/arm/at91/at91_twi.c ============================================================================== --- head/sys/arm/at91/at91_twi.c Mon Sep 27 15:55:39 2010 (r213202) +++ head/sys/arm/at91/at91_twi.c Mon Sep 27 15:58:19 2010 (r213203) @@ -338,7 +338,7 @@ at91_twi_transfer(device_t dev, struct i err = EINVAL; goto out; } - if (len == 1) + if (len == 1 && msgs[i].flags & IIC_M_RD) WR4(sc, TWI_CR, TWI_CR_START | TWI_CR_STOP); else WR4(sc, TWI_CR, TWI_CR_START); @@ -358,8 +358,6 @@ at91_twi_transfer(device_t dev, struct i } } else { while (len--) { - if (len == 0 && msgs[i].len != 1) - WR4(sc, TWI_CR, TWI_CR_STOP); if ((err = at91_twi_wait(sc, TWI_SR_TXRDY))) goto out; WR4(sc, TWI_THR, *buf++); From owner-svn-src-head@FreeBSD.ORG Mon Sep 27 17:47:11 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 043C91065672; Mon, 27 Sep 2010 17:47:11 +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 E5D578FC14; Mon, 27 Sep 2010 17:47:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8RHlAgr044375; Mon, 27 Sep 2010 17:47:10 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8RHlATi044368; Mon, 27 Sep 2010 17:47:10 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201009271747.o8RHlATi044368@svn.freebsd.org> From: Jaakko Heinonen Date: Mon, 27 Sep 2010 17:47:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213215 - in head/sys: conf fs/devfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Sep 2010 17:47:11 -0000 Author: jh Date: Mon Sep 27 17:47:09 2010 New Revision: 213215 URL: http://svn.freebsd.org/changeset/base/213215 Log: Add reference counting for devfs paths containing user created symbolic links. The reference counting is needed to be able to determine if a specific devfs path exists. For true device file paths we can traverse the cdevp_list but a separate directory list is needed for user created symbolic links. Add a new directory entry flag DE_USER to mark entries which should unreference their parent directory on deletion. A new function to traverse cdevp_list and the directory list will be introduced in a separate commit. Idea from: kib Reviewed by: kib Added: head/sys/fs/devfs/devfs_dir.c (contents, props changed) Modified: head/sys/conf/files head/sys/fs/devfs/devfs.h head/sys/fs/devfs/devfs_devs.c head/sys/fs/devfs/devfs_int.h head/sys/fs/devfs/devfs_vnops.c Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Mon Sep 27 17:46:11 2010 (r213214) +++ head/sys/conf/files Mon Sep 27 17:47:09 2010 (r213215) @@ -1890,6 +1890,7 @@ fs/coda/coda_vfsops.c optional vcoda fs/coda/coda_vnops.c optional vcoda fs/deadfs/dead_vnops.c standard fs/devfs/devfs_devs.c standard +fs/devfs/devfs_dir.c standard fs/devfs/devfs_rule.c standard fs/devfs/devfs_vfsops.c standard fs/devfs/devfs_vnops.c standard Modified: head/sys/fs/devfs/devfs.h ============================================================================== --- head/sys/fs/devfs/devfs.h Mon Sep 27 17:46:11 2010 (r213214) +++ head/sys/fs/devfs/devfs.h Mon Sep 27 17:47:09 2010 (r213215) @@ -124,6 +124,8 @@ MALLOC_DECLARE(M_DEVFS); struct componentname; +TAILQ_HEAD(devfs_dlist_head, devfs_dirent); + struct devfs_dirent { struct cdev_priv *de_cdp; int de_inode; @@ -133,10 +135,11 @@ struct devfs_dirent { #define DE_DOTDOT 0x04 #define DE_DOOMED 0x08 #define DE_COVERED 0x10 +#define DE_USER 0x20 int de_holdcnt; struct dirent *de_dirent; TAILQ_ENTRY(devfs_dirent) de_list; - TAILQ_HEAD(, devfs_dirent) de_dlist; + struct devfs_dlist_head de_dlist; struct devfs_dirent *de_dir; int de_links; mode_t de_mode; Modified: head/sys/fs/devfs/devfs_devs.c ============================================================================== --- head/sys/fs/devfs/devfs_devs.c Mon Sep 27 17:46:11 2010 (r213214) +++ head/sys/fs/devfs/devfs_devs.c Mon Sep 27 17:47:09 2010 (r213215) @@ -338,6 +338,10 @@ devfs_delete(struct devfs_mount *dm, str dd = devfs_parent_dirent(de); if (dd != NULL) DEVFS_DE_HOLD(dd); + if (de->de_flags & DE_USER) { + KASSERT(dd != NULL, ("devfs_delete: NULL dd")); + devfs_dir_unref_de(dm, dd); + } } else dd = NULL; @@ -396,10 +400,17 @@ devfs_purge(struct devfs_mount *dm, stru DEVFS_DE_HOLD(dd); for (;;) { - de = TAILQ_FIRST(&dd->de_dlist); + /* + * Use TAILQ_LAST() to remove "." and ".." last. + * We might need ".." to resolve a path in + * devfs_dir_unref_de(). + */ + de = TAILQ_LAST(&dd->de_dlist, devfs_dlist_head); if (de == NULL) break; TAILQ_REMOVE(&dd->de_dlist, de, de_list); + if (de->de_flags & DE_USER) + devfs_dir_unref_de(dm, dd); if (de->de_flags & (DE_DOT | DE_DOTDOT)) devfs_delete(dm, de, DEVFS_DEL_NORECURSE); else if (de->de_dirent->d_type == DT_DIR) Added: head/sys/fs/devfs/devfs_dir.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/fs/devfs/devfs_dir.c Mon Sep 27 17:47:09 2010 (r213215) @@ -0,0 +1,175 @@ +/*- + * Copyright (c) 2010 Jaakko Heinonen + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +struct dirlistent { + char *dir; + int refcnt; + LIST_ENTRY(dirlistent) link; +}; + +static LIST_HEAD(, dirlistent) devfs_dirlist = + LIST_HEAD_INITIALIZER(devfs_dirlist); + +static MALLOC_DEFINE(M_DEVFS4, "DEVFS4", "DEVFS directory list"); + +static struct mtx dirlist_mtx; +MTX_SYSINIT(dirlist_mtx, &dirlist_mtx, "devfs dirlist lock", MTX_DEF); + +/* Returns 1 if the path is in the directory list. */ +int +devfs_dir_find(const char *path) +{ + struct dirlistent *dle; + + mtx_lock(&dirlist_mtx); + LIST_FOREACH(dle, &devfs_dirlist, link) { + if (devfs_pathpath(dle->dir, path) != 0) { + mtx_unlock(&dirlist_mtx); + return (1); + } + } + mtx_unlock(&dirlist_mtx); + + return (0); +} + +static struct dirlistent * +devfs_dir_findent_locked(const char *dir) +{ + struct dirlistent *dle; + + mtx_assert(&dirlist_mtx, MA_OWNED); + + LIST_FOREACH(dle, &devfs_dirlist, link) { + if (strcmp(dir, dle->dir) == 0) + return (dle); + } + + return (NULL); +} + +static void +devfs_dir_ref(const char *dir) +{ + struct dirlistent *dle, *dle_new; + + if (*dir == '\0') + return; + + dle_new = malloc(sizeof(*dle), M_DEVFS4, M_WAITOK); + dle_new->dir = strdup(dir, M_DEVFS4); + dle_new->refcnt = 1; + + mtx_lock(&dirlist_mtx); + dle = devfs_dir_findent_locked(dir); + if (dle != NULL) { + dle->refcnt++; + mtx_unlock(&dirlist_mtx); + free(dle_new->dir, M_DEVFS4); + free(dle_new, M_DEVFS4); + return; + } + LIST_INSERT_HEAD(&devfs_dirlist, dle_new, link); + mtx_unlock(&dirlist_mtx); +} + +void +devfs_dir_ref_de(struct devfs_mount *dm, struct devfs_dirent *de) +{ + char dirname[SPECNAMELEN + 1], *namep; + + namep = devfs_fqpn(dirname, dm, de, NULL); + KASSERT(namep != NULL, ("devfs_ref_dir_de: NULL namep")); + + devfs_dir_ref(namep); +} + +static void +devfs_dir_unref(const char *dir) +{ + struct dirlistent *dle; + + if (*dir == '\0') + return; + + mtx_lock(&dirlist_mtx); + dle = devfs_dir_findent_locked(dir); + KASSERT(dle != NULL, ("devfs_dir_unref: dir %s not referenced", dir)); + dle->refcnt--; + KASSERT(dle->refcnt >= 0, ("devfs_dir_unref: negative refcnt")); + if (dle->refcnt == 0) { + LIST_REMOVE(dle, link); + mtx_unlock(&dirlist_mtx); + free(dle->dir, M_DEVFS4); + free(dle, M_DEVFS4); + } else + mtx_unlock(&dirlist_mtx); +} + +void +devfs_dir_unref_de(struct devfs_mount *dm, struct devfs_dirent *de) +{ + char dirname[SPECNAMELEN + 1], *namep; + + namep = devfs_fqpn(dirname, dm, de, NULL); + KASSERT(namep != NULL, ("devfs_unref_dir_de: NULL namep")); + + devfs_dir_unref(namep); +} + +/* Returns 1 if the path p1 contains the path p2. */ +int +devfs_pathpath(const char *p1, const char *p2) +{ + + for (;;p1++, p2++) { + if (*p1 != *p2) { + if (*p1 == '/' && *p2 == '\0') + return (1); + else + return (0); + } else if (*p1 == '\0') + return (1); + } + /* NOTREACHED */ +} Modified: head/sys/fs/devfs/devfs_int.h ============================================================================== --- head/sys/fs/devfs/devfs_int.h Mon Sep 27 17:46:11 2010 (r213214) +++ head/sys/fs/devfs/devfs_int.h Mon Sep 27 17:47:09 2010 (r213215) @@ -38,6 +38,7 @@ #ifdef _KERNEL struct devfs_dirent; +struct devfs_mount; struct cdev_privdata { struct file *cdpd_fp; @@ -76,6 +77,11 @@ void devfs_create(struct cdev *dev); void devfs_destroy(struct cdev *dev); void devfs_destroy_cdevpriv(struct cdev_privdata *p); +int devfs_dir_find(const char *); +void devfs_dir_ref_de(struct devfs_mount *, struct devfs_dirent *); +void devfs_dir_unref_de(struct devfs_mount *, struct devfs_dirent *); +int devfs_pathpath(const char *, const char *); + extern struct unrhdr *devfs_inos; extern struct mtx devmtx; extern struct mtx devfs_de_interlock; Modified: head/sys/fs/devfs/devfs_vnops.c ============================================================================== --- head/sys/fs/devfs/devfs_vnops.c Mon Sep 27 17:46:11 2010 (r213214) +++ head/sys/fs/devfs/devfs_vnops.c Mon Sep 27 17:47:09 2010 (r213215) @@ -1564,6 +1564,7 @@ devfs_symlink(struct vop_symlink_args *a dd = ap->a_dvp->v_data; de = devfs_newdirent(ap->a_cnp->cn_nameptr, ap->a_cnp->cn_namelen); + de->de_flags = DE_USER; de->de_uid = 0; de->de_gid = 0; de->de_mode = 0755; @@ -1587,6 +1588,7 @@ devfs_symlink(struct vop_symlink_args *a de_dotdot = TAILQ_FIRST(&dd->de_dlist); /* "." */ de_dotdot = TAILQ_NEXT(de_dotdot, de_list); /* ".." */ TAILQ_INSERT_AFTER(&dd->de_dlist, de_dotdot, de, de_list); + devfs_dir_ref_de(dmp, dd); return (devfs_allocv(de, ap->a_dvp->v_mount, LK_EXCLUSIVE, ap->a_vpp)); } From owner-svn-src-head@FreeBSD.ORG Mon Sep 27 18:20:56 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7A40C1065672; Mon, 27 Sep 2010 18:20:56 +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 69B8E8FC19; Mon, 27 Sep 2010 18:20: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 o8RIKuOf045814; Mon, 27 Sep 2010 18:20:56 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8RIKuXX045811; Mon, 27 Sep 2010 18:20:56 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201009271820.o8RIKuXX045811@svn.freebsd.org> From: Jaakko Heinonen Date: Mon, 27 Sep 2010 18:20:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213221 - head/sys/fs/devfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Sep 2010 18:20:56 -0000 Author: jh Date: Mon Sep 27 18:20:56 2010 New Revision: 213221 URL: http://svn.freebsd.org/changeset/base/213221 Log: Add a new function devfs_dev_exists() to be able to find out if a specific devfs path already exists. The function will be used from kern_conf.c to detect duplicate device registrations. Callers must hold the devmtx mutex. Reviewed by: kib Modified: head/sys/fs/devfs/devfs_devs.c head/sys/fs/devfs/devfs_int.h Modified: head/sys/fs/devfs/devfs_devs.c ============================================================================== --- head/sys/fs/devfs/devfs_devs.c Mon Sep 27 18:20:04 2010 (r213220) +++ head/sys/fs/devfs/devfs_devs.c Mon Sep 27 18:20:56 2010 (r213221) @@ -142,6 +142,27 @@ devfs_alloc(int flags) return (cdev); } +int +devfs_dev_exists(const char *name) +{ + struct cdev_priv *cdp; + + mtx_assert(&devmtx, MA_OWNED); + + TAILQ_FOREACH(cdp, &cdevp_list, cdp_list) { + if ((cdp->cdp_flags & CDP_ACTIVE) == 0) + continue; + if (devfs_pathpath(cdp->cdp_c.si_name, name) != 0) + return (1); + if (devfs_pathpath(name, cdp->cdp_c.si_name) != 0) + return (1); + } + if (devfs_dir_find(name) != 0) + return (1); + + return (0); +} + void devfs_free(struct cdev *cdev) { Modified: head/sys/fs/devfs/devfs_int.h ============================================================================== --- head/sys/fs/devfs/devfs_int.h Mon Sep 27 18:20:04 2010 (r213220) +++ head/sys/fs/devfs/devfs_int.h Mon Sep 27 18:20:56 2010 (r213221) @@ -72,6 +72,7 @@ struct cdev_priv { #define cdev2priv(c) member2struct(cdev_priv, cdp_c, c) struct cdev *devfs_alloc(int); +int devfs_dev_exists(const char *); void devfs_free(struct cdev *); void devfs_create(struct cdev *dev); void devfs_destroy(struct cdev *dev); From owner-svn-src-head@FreeBSD.ORG Mon Sep 27 19:03:18 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C462F106566B; Mon, 27 Sep 2010 19:03:18 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B12DC8FC12; Mon, 27 Sep 2010 19:03: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 o8RJ3IZ5046883; Mon, 27 Sep 2010 19:03:18 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8RJ3Io6046878; Mon, 27 Sep 2010 19:03:18 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201009271903.o8RJ3Io6046878@svn.freebsd.org> From: Dimitry Andric Date: Mon, 27 Sep 2010 19:03:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213224 - in head/usr.bin/clang: clang tblgen X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Sep 2010 19:03:18 -0000 Author: dim Date: Mon Sep 27 19:03:18 2010 New Revision: 213224 URL: http://svn.freebsd.org/changeset/base/213224 Log: Add manpages for clang and tblgen. These were generated from upstream's tools/clang/docs/tools/clang.pod and docs/CommandGuide/tblgen.pod, respectively. Approved-by: rpaulo (mentor) Added: head/usr.bin/clang/clang/clang.1 (contents, props changed) head/usr.bin/clang/tblgen/tblgen.1 (contents, props changed) Modified: head/usr.bin/clang/clang/Makefile head/usr.bin/clang/tblgen/Makefile Modified: head/usr.bin/clang/clang/Makefile ============================================================================== --- head/usr.bin/clang/clang/Makefile Mon Sep 27 18:34:04 2010 (r213223) +++ head/usr.bin/clang/clang/Makefile Mon Sep 27 19:03:18 2010 (r213224) @@ -8,7 +8,6 @@ SRCDIR= tools/clang/tools/driver SRCS= cc1_main.cpp \ cc1as_main.cpp \ driver.cpp -MAN= LINKS= ${BINDIR}/clang ${BINDIR}/clang++ Added: head/usr.bin/clang/clang/clang.1 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/clang/clang/clang.1 Mon Sep 27 19:03:18 2010 (r213224) @@ -0,0 +1,500 @@ +.\" $FreeBSD$ +.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07) +.\" +.\" Standard preamble: +.\" ======================================================================== +.de Sp \" Vertical space (when we can't use .PP) +.if t .sp .5v +.if n .sp +.. +.de Vb \" Begin verbatim text +.ft CW +.nf +.ne \\$1 +.. +.de Ve \" End verbatim text +.ft R +.fi +.. +.\" Set up some character translations and predefined strings. \*(-- will +.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left +.\" double quote, and \*(R" will give a right double quote. \*(C+ will +.\" give a nicer C++. Capital omega is used to do unbreakable dashes and +.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, +.\" nothing in troff, for use with C<>. +.tr \(*W- +.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' +.ie n \{\ +. ds -- \(*W- +. ds PI pi +. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch +. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch +. ds L" "" +. ds R" "" +. ds C` "" +. ds C' "" +'br\} +.el\{\ +. ds -- \|\(em\| +. ds PI \(*p +. ds L" `` +. ds R" '' +'br\} +.\" +.\" Escape single quotes in literal strings from groff's Unicode transform. +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" +.\" If the F register is turned on, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.ie \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. nr % 0 +. rr F +.\} +.el \{\ +. de IX +.. +.\} +.\" +.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). +.\" Fear. Run. Save yourself. No user-serviceable parts. +. \" fudge factors for nroff and troff +.if n \{\ +. ds #H 0 +. ds #V .8m +. ds #F .3m +. ds #[ \f1 +. ds #] \fP +.\} +.if t \{\ +. ds #H ((1u-(\\\\n(.fu%2u))*.13m) +. ds #V .6m +. ds #F 0 +. ds #[ \& +. ds #] \& +.\} +. \" simple accents for nroff and troff +.if n \{\ +. ds ' \& +. ds ` \& +. ds ^ \& +. ds , \& +. ds ~ ~ +. ds / +.\} +.if t \{\ +. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" +. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' +. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' +. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' +. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' +. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' +.\} +. \" troff and (daisy-wheel) nroff accents +.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' +.ds 8 \h'\*(#H'\(*b\h'-\*(#H' +.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] +.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' +.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' +.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] +.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] +.ds ae a\h'-(\w'a'u*4/10)'e +.ds Ae A\h'-(\w'A'u*4/10)'E +. \" corrections for vroff +.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' +.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' +. \" for low resolution devices (crt and lpr) +.if \n(.H>23 .if \n(.V>19 \ +\{\ +. ds : e +. ds 8 ss +. ds o a +. ds d- d\h'-1'\(ga +. ds D- D\h'-1'\(hy +. ds th \o'bp' +. ds Th \o'LP' +. ds ae ae +. ds Ae AE +.\} +.rm #[ #] #H #V #F C +.\" ======================================================================== +.\" +.IX Title "CLANG 1" +.TH CLANG 1 "2010-09-27" "Clang 2.8" "Clang Tools Documentation" +.\" For nroff, turn off justification. Always turn off hyphenation; it makes +.\" way too many mistakes in technical documents. +.if n .ad l +.nh +.SH "NAME" +clang \- the Clang C, C++, and Objective\-C compiler +.SH "SYNOPSIS" +.IX Header "SYNOPSIS" +\&\fBclang\fR [\fB\-c\fR|\fB\-S\fR|\fB\-E\fR] \fB\-std=\fR\fIstandard\fR \fB\-g\fR + [\fB\-O0\fR|\fB\-O1\fR|\fB\-O2\fR|\fB\-Os\fR|\fB\-O3\fR|\fB\-O4\fR] + \fB\-W\fR\fIwarnings...\fR \fB\-pedantic\fR + \fB\-I\fR\fIdir...\fR \fB\-L\fR\fIdir...\fR + \fB\-D\fR\fImacro[=defn]\fR + \fB\-f\fR\fIfeature-option...\fR + \fB\-m\fR\fImachine-option...\fR + \fB\-o\fR \fIoutput-file\fR + \fB\-stdlib=\fR\fIlibrary\fR + \fIinput-filenames\fR +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +\&\fBclang\fR is a C, \*(C+, and Objective-C compiler which encompasses preprocessing, +parsing, optimization, code generation, assembly, and linking. Depending on +which high-level mode setting is passed, Clang will stop before doing a full +link. While Clang is highly integrated, it is important to understand the +stages of compilation, to understand how to invoke it. These stages are: +.IP "\fBDriver\fR" 4 +.IX Item "Driver" +The \fBclang\fR executable is actually a small driver which controls the overall +execution of other tools such as the compiler, assembler and linker. Typically +you do not need to interact with the driver, but you transparently use it to run +the other tools. +.IP "\fBPreprocessing\fR" 4 +.IX Item "Preprocessing" +This stage handles tokenization of the input source file, macro expansion, +#include expansion and handling of other preprocessor directives. The output of +this stage is typically called a \*(L".i\*(R" (for C), \*(L".ii\*(R" (for \*(C+), \*(L".mi\*(R" (for +Objective-C) , or \*(L".mii\*(R" (for Objective\-\*(C+) file. +.IP "\fBParsing and Semantic Analysis\fR" 4 +.IX Item "Parsing and Semantic Analysis" +This stage parses the input file, translating preprocessor tokens into a parse +tree. Once in the form of a parser tree, it applies semantic analysis to compute +types for expressions as well and determine whether the code is well formed. This +stage is responsible for generating most of the compiler warnings as well as +parse errors. The output of this stage is an \*(L"Abstract Syntax Tree\*(R" (\s-1AST\s0). +.IP "\fBCode Generation and Optimization\fR" 4 +.IX Item "Code Generation and Optimization" +This stage translates an \s-1AST\s0 into low-level intermediate code (known as \*(L"\s-1LLVM\s0 +\&\s-1IR\s0\*(R") and ultimately to machine code. This phase is responsible for optimizing +the generated code and handling target-specfic code generation. The output of +this stage is typically called a \*(L".s\*(R" file or \*(L"assembly\*(R" file. +.Sp +Clang also supports the use of an integrated assembler, in which the code +generator produces object files directly. This avoids the overhead of generating +the \*(L".s\*(R" file and of calling the target assembler. +.IP "\fBAssembler\fR" 4 +.IX Item "Assembler" +This stage runs the target assembler to translate the output of the compiler +into a target object file. The output of this stage is typically called a \*(L".o\*(R" +file or \*(L"object\*(R" file. +.IP "\fBLinker\fR" 4 +.IX Item "Linker" +This stage runs the target linker to merge multiple object files into an +executable or dynamic library. The output of this stage is typically called an +\&\*(L"a.out\*(R", \*(L".dylib\*(R" or \*(L".so\*(R" file. +.PP +The Clang compiler supports a large number of options to control each of these +stages. In addition to compilation of code, Clang also supports other tools: +.PP +\&\fBClang Static Analyzer\fR +.PP +The Clang Static Analyzer is a tool that scans source code to try to find bugs +though code analysis. This tool uses many parts of Clang and is built into the +same driver. +.SH "OPTIONS" +.IX Header "OPTIONS" +.SS "Stage Selection Options" +.IX Subsection "Stage Selection Options" +.IP "\fB\-E\fR" 4 +.IX Item "-E" +Run the preprocessor stage. +.IP "\fB\-fsyntax\-only\fR" 4 +.IX Item "-fsyntax-only" +Run the preprocessor, parser and type checking stages. +.IP "\fB\-S\fR" 4 +.IX Item "-S" +Run the previous stages as well as \s-1LLVM\s0 generation and optimization stages and +target-specific code generation, producing an assembly file. +.IP "\fB\-c\fR" 4 +.IX Item "-c" +Run all of the above, plus the assembler, generating a target \*(L".o\*(R" object file. +.IP "\fBno stage selection option\fR" 4 +.IX Item "no stage selection option" +If no stage selection option is specified, all stages above are run, and the +linker is run to combine the results into an executable or shared library. +.IP "\fB\-\-analyze\fR" 4 +.IX Item "--analyze" +Run the Clang Static Analyzer. +.SS "Language Selection and Mode Options" +.IX Subsection "Language Selection and Mode Options" +.IP "\fB\-x\fR \fIlanguage\fR" 4 +.IX Item "-x language" +Treat subsequent input files as having type \fIlanguage\fR. +.IP "\fB\-std\fR=\fIlanguage\fR" 4 +.IX Item "-std=language" +Specify the language standard to compile for. +.IP "\fB\-stdlib\fR=\fIlanguage\fR" 4 +.IX Item "-stdlib=language" +Specify the \*(C+ standard library to use; supported options are libstdc++ and +libc++. +.IP "\fB\-ansi\fR" 4 +.IX Item "-ansi" +Same as \fB\-std=c89\fR. +.IP "\fB\-ObjC++\fR" 4 +.IX Item "-ObjC++" +Treat source input files as Objective\-\*(C+ inputs. +.IP "\fB\-ObjC\fR" 4 +.IX Item "-ObjC" +Treat source input files as Objective-C inputs. +.IP "\fB\-trigraphs\fR" 4 +.IX Item "-trigraphs" +Enable trigraphs. +.IP "\fB\-ffreestanding\fR" 4 +.IX Item "-ffreestanding" +Indicate that the file should be compiled for a freestanding, not a hosted, +environment. +.IP "\fB\-fno\-builtin\fR" 4 +.IX Item "-fno-builtin" +Disable special handling and optimizations of builtin functions like strlen and +malloc. +.IP "\fB\-fmath\-errno\fR" 4 +.IX Item "-fmath-errno" +Indicate that math functions should be treated as updating errno. +.IP "\fB\-fpascal\-strings\fR" 4 +.IX Item "-fpascal-strings" +Enable support for Pascal-style strings with \*(L"\epfoo\*(R". +.IP "\fB\-fms\-extensions\fR" 4 +.IX Item "-fms-extensions" +Enable support for Microsoft extensions. +.IP "\fB\-fborland\-extensions\fR" 4 +.IX Item "-fborland-extensions" +Enable support for Borland extensions. +.IP "\fB\-fwritable\-strings\fR" 4 +.IX Item "-fwritable-strings" +Make all string literals default to writable. This disables uniquing of +strings and other optimizations. +.IP "\fB\-flax\-vector\-conversions\fR" 4 +.IX Item "-flax-vector-conversions" +Allow loose type checking rules for implicit vector conversions. +.IP "\fB\-fblocks\fR" 4 +.IX Item "-fblocks" +Enable the \*(L"Blocks\*(R" language feature. +.IP "\fB\-fobjc\-gc\-only\fR" 4 +.IX Item "-fobjc-gc-only" +Indicate that Objective-C code should be compiled in GC-only mode, which only +works when Objective-C Garbage Collection is enabled. +.IP "\fB\-fobjc\-gc\fR" 4 +.IX Item "-fobjc-gc" +Indicate that Objective-C code should be compiled in hybrid-GC mode, which works +with both \s-1GC\s0 and non-GC mode. +.IP "\fB\-fobjc\-abi\-version\fR=\fIversion\fR" 4 +.IX Item "-fobjc-abi-version=version" +Select the Objective-C \s-1ABI\s0 version to use. Available versions are 1 (legacy +\&\*(L"fragile\*(R" \s-1ABI\s0), 2 (non-fragile \s-1ABI\s0 1), and 3 (non-fragile \s-1ABI\s0 2). +.IP "\fB\-fobjc\-nonfragile\-abi\-version\fR=\fIversion\fR" 4 +.IX Item "-fobjc-nonfragile-abi-version=version" +Select the Objective-C non-fragile \s-1ABI\s0 version to use by default. This will only +be used as the Objective-C \s-1ABI\s0 when the non-fragile \s-1ABI\s0 is enabled (either via +\&\-fobjc\-nonfragile\-abi, or because it is the platform default). +.IP "\fB\-fobjc\-nonfragile\-abi\fR" 4 +.IX Item "-fobjc-nonfragile-abi" +Enable use of the Objective-C non-fragile \s-1ABI\s0. On platforms for which this is +the default \s-1ABI\s0, it can be disabled with \fB\-fno\-objc\-nonfragile\-abi\fR. +.SS "Target Selection Options" +.IX Subsection "Target Selection Options" +Clang fully supports cross compilation as an inherent part of its design. +Depending on how your version of Clang is configured, it may have support for +a number of cross compilers, or may only support a native target. +.IP "\fB\-arch\fR \fIarchitecture\fR" 4 +.IX Item "-arch architecture" +Specify the architecture to build for. +.IP "\fB\-mmacosx\-version\-min\fR=\fIversion\fR" 4 +.IX Item "-mmacosx-version-min=version" +When building for Mac \s-1OS/X\s0, specify the minimum version supported by your +application. +.IP "\fB\-miphoneos\-version\-min\fR" 4 +.IX Item "-miphoneos-version-min" +When building for iPhone \s-1OS\s0, specify the minimum version supported by your +application. +.IP "\fB\-march\fR=\fIcpu\fR" 4 +.IX Item "-march=cpu" +Specify that Clang should generate code for a specific processor family member +and later. For example, if you specify \-march=i486, the compiler is allowed to +generate instructions that are valid on i486 and later processors, but which +may not exist on earlier ones. +.SS "Code Generation Options" +.IX Subsection "Code Generation Options" +.IP "\fB\-O0\fR \fB\-O1\fR \fB\-O2\fR \fB\-Os\fR \fB\-O3\fR \fB\-O4\fR" 4 +.IX Item "-O0 -O1 -O2 -Os -O3 -O4" +Specify which optimization level to use. \fB\-O0\fR means \*(L"no optimization\*(R": this +level compiles the fastest and generates the most debuggable code. \fB\-O2\fR is a +moderate level of optimization which enables most optimizations. \fB\-Os\fR is like +\&\fB\-O2\fR with extra optimizations to reduce code size. \fB\-O3\fR is like \fB\-O2\fR, +except that it enables optimizations that take longer to perform or that may +generate larger code (in an attempt to make the program run faster). On +supported platforms, \fB\-O4\fR enables link-time optimization; object files are +stored in the \s-1LLVM\s0 bitcode file format and whole program optimization is done at +link time. \fB\-O1\fR is somewhere between \fB\-O0\fR and \fB\-O2\fR. +.IP "\fB\-g\fR" 4 +.IX Item "-g" +Generate debug information. Note that Clang debug information works best at +\&\fB\-O0\fR. At higher optimization levels, only line number information is +currently available. +.IP "\fB\-fexceptions\fR" 4 +.IX Item "-fexceptions" +Enable generation of unwind information, this allows exceptions to be thrown +through Clang compiled stack frames. This is on by default in x86\-64. +.IP "\fB\-ftrapv\fR" 4 +.IX Item "-ftrapv" +Generate code to catch integer overflow errors. Signed integer overflow is +undefined in C, with this flag, extra code is generated to detect this and abort +when it happens. +.IP "\fB\-fvisibility\fR" 4 +.IX Item "-fvisibility" +This flag sets the default visibility level. +.IP "\fB\-fcommon\fR" 4 +.IX Item "-fcommon" +This flag specifies that variables without initializers get common linkage. It +can be disabled with \fB\-fno\-common\fR. +.IP "\fB\-flto\fR \fB\-emit\-llvm\fR" 4 +.IX Item "-flto -emit-llvm" +Generate output files in \s-1LLVM\s0 formats, suitable for link time optimization. When +used with \fB\-S\fR this generates \s-1LLVM\s0 intermediate language assembly files, +otherwise this generates \s-1LLVM\s0 bitcode format object files (which may be passed +to the linker depending on the stage selection options). +.SS "Driver Options" +.IX Subsection "Driver Options" +.IP "\fB\-###\fR" 4 +.IX Item "-###" +Print the commands to run for this compilation. +.IP "\fB\-\-help\fR" 4 +.IX Item "--help" +Display available options. +.IP "\fB\-Qunused\-arguments\fR" 4 +.IX Item "-Qunused-arguments" +Don't emit warning for unused driver arguments. +.IP "\fB\-Wa,\fR\fIargs\fR" 4 +.IX Item "-Wa,args" +Pass the comma separated arguments in \fIargs\fR to the assembler. +.IP "\fB\-Wl,\fR\fIargs\fR" 4 +.IX Item "-Wl,args" +Pass the comma separated arguments in \fIargs\fR to the linker. +.IP "\fB\-Wp,\fR\fIargs\fR" 4 +.IX Item "-Wp,args" +Pass the comma separated arguments in \fIargs\fR to the preprocessor. +.IP "\fB\-Xanalyzer\fR \fIarg\fR" 4 +.IX Item "-Xanalyzer arg" +Pass \fIarg\fR to the static analyzer. +.IP "\fB\-Xassembler\fR \fIarg\fR" 4 +.IX Item "-Xassembler arg" +Pass \fIarg\fR to the assembler. +.IP "\fB\-Xclang\fR \fIarg\fR" 4 +.IX Item "-Xclang arg" +Pass \fIarg\fR to the clang compiler frontend. +.IP "\fB\-Xlinker\fR \fIarg\fR" 4 +.IX Item "-Xlinker arg" +Pass \fIarg\fR to the linker. +.IP "\fB\-mllvm\fR \fIarg\fR" 4 +.IX Item "-mllvm arg" +Pass \fIarg\fR to the \s-1LLVM\s0 backend. +.IP "\fB\-Xpreprocessor\fR \fIarg\fR" 4 +.IX Item "-Xpreprocessor arg" +Pass \fIarg\fR to the preprocessor. +.IP "\fB\-o\fR \fIfile\fR" 4 +.IX Item "-o file" +Write output to \fIfile\fR. +.IP "\fB\-print\-file\-name\fR=\fIfile\fR" 4 +.IX Item "-print-file-name=file" +Print the full library path of \fIfile\fR. +.IP "\fB\-print\-libgcc\-file\-name\fR" 4 +.IX Item "-print-libgcc-file-name" +Print the library path for \*(L"libgcc.a\*(R". +.IP "\fB\-print\-prog\-name\fR=\fIname\fR" 4 +.IX Item "-print-prog-name=name" +Print the full program path of \fIname\fR. +.IP "\fB\-print\-search\-dirs\fR" 4 +.IX Item "-print-search-dirs" +Print the paths used for finding libraries and programs. +.IP "\fB\-save\-temps\fR" 4 +.IX Item "-save-temps" +Save intermediate compilation results. +.IP "\fB\-integrated\-as\fR \fB\-no\-integrated\-as\fR" 4 +.IX Item "-integrated-as -no-integrated-as" +Used to enable and disable, respectively, the use of the integrated +assembler. Whether the integrated assembler is on by default is target +dependent. +.IP "\fB\-time\fR" 4 +.IX Item "-time" +Time individual commands. +.IP "\fB\-ftime\-report\fR" 4 +.IX Item "-ftime-report" +Print timing summary of each stage of compilation. +.IP "\fB\-v\fR" 4 +.IX Item "-v" +Show commands to run and use verbose output. +.SS "Diagnostics Options" +.IX Subsection "Diagnostics Options" +.IP "\fB\-fshow\-column\fR \fB\-fshow\-source\-location\fR \fB\-fcaret\-diagnostics\fR \fB\-fdiagnostics\-fixit\-info\fR \fB\-fdiagnostics\-parseable\-fixits\fR \fB\-fdiagnostics\-print\-source\-range\-info\fR \fB\-fprint\-source\-range\-info\fR \fB\-fdiagnostics\-show\-option\fR \fB\-fmessage\-length\fR" 4 +.IX Item "-fshow-column -fshow-source-location -fcaret-diagnostics -fdiagnostics-fixit-info -fdiagnostics-parseable-fixits -fdiagnostics-print-source-range-info -fprint-source-range-info -fdiagnostics-show-option -fmessage-length" +These options control how Clang prints out information about diagnostics (errors +and warnings). Please see the Clang User's Manual for more information. +.SS "Preprocessor Options" +.IX Subsection "Preprocessor Options" +.IP "\fB\-D\fR\fImacroname=value\fR" 4 +.IX Item "-Dmacroname=value" +Adds an implicit #define into the predefines buffer which is read before the +source file is preprocessed. +.IP "\fB\-U\fR\fImacroname\fR" 4 +.IX Item "-Umacroname" +Adds an implicit #undef into the predefines buffer which is read before the +source file is preprocessed. +.IP "\fB\-include\fR \fIfilename\fR" 4 +.IX Item "-include filename" +Adds an implicit #include into the predefines buffer which is read before the +source file is preprocessed. +.IP "\fB\-I\fR\fIdirectory\fR" 4 +.IX Item "-Idirectory" +Add the specified directory to the search path for include files. +.IP "\fB\-F\fR\fIdirectory\fR" 4 +.IX Item "-Fdirectory" +Add the specified directory to the search path for framework include files. +.IP "\fB\-nostdinc\fR" 4 +.IX Item "-nostdinc" +Do not search the standard system directories for include files. +.IP "\fB\-nobuiltininc\fR" 4 +.IX Item "-nobuiltininc" +Do not search clang's builtin directory for include files. +.SH "ENVIRONMENT" +.IX Header "ENVIRONMENT" +.IP "\fB\s-1TMPDIR\s0\fR, \fB\s-1TEMP\s0\fR, \fB\s-1TMP\s0\fR" 4 +.IX Item "TMPDIR, TEMP, TMP" +These environment variables are checked, in order, for the location to +write temporary files used during the compilation process. +.IP "\fB\s-1CPATH\s0\fR" 4 +.IX Item "CPATH" +If this environment variable is present, it is treated as a delimited +list of paths to be added to the default system include path list. The +delimiter is the platform dependent delimitor, as used in the \fI\s-1PATH\s0\fR +environment variable. +.Sp +Empty components in the environment variable are ignored. +.IP "\fBC_INCLUDE_PATH\fR, \fB\s-1OBJC_INCLUDE_PATH\s0\fR, \fB\s-1CPLUS_INCLUDE_PATH\s0\fR, \fB\s-1OBJCPLUS_INCLUDE_PATH\s0\fR" 4 +.IX Item "C_INCLUDE_PATH, OBJC_INCLUDE_PATH, CPLUS_INCLUDE_PATH, OBJCPLUS_INCLUDE_PATH" +These environment variables specify additional paths, as for \s-1CPATH\s0, +which are only used when processing the appropriate language. +.IP "\fB\s-1MACOSX_DEPLOYMENT_TARGET\s0\fR" 4 +.IX Item "MACOSX_DEPLOYMENT_TARGET" +If \-mmacosx\-version\-min is unspecified, the default deployment target +is read from this environment variable. This option only affects darwin +targets. +.SH "BUGS" +.IX Header "BUGS" +To report bugs, please visit . Most bug reports should +include preprocessed source files (use the \fB\-E\fR option) and the full output of +the compiler, along with information to reproduce. +.SH "SEE ALSO" +.IX Header "SEE ALSO" +.Vb 1 +\& as(1), ld(1) +.Ve +.SH "AUTHOR" +.IX Header "AUTHOR" +Maintained by the Clang / \s-1LLVM\s0 Team (). Modified: head/usr.bin/clang/tblgen/Makefile ============================================================================== --- head/usr.bin/clang/tblgen/Makefile Mon Sep 27 18:34:04 2010 (r213223) +++ head/usr.bin/clang/tblgen/Makefile Mon Sep 27 19:03:18 2010 (r213224) @@ -39,7 +39,6 @@ SRCS= ARMDecoderEmitter.cpp \ TableGenBackend.cpp \ X86DisassemblerTables.cpp \ X86RecognizableInstr.cpp -MAN= LLVM_REQUIRES_EH= LIBDEPS=llvmsupport llvmsystem Added: head/usr.bin/clang/tblgen/tblgen.1 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/clang/tblgen/tblgen.1 Mon Sep 27 19:03:18 2010 (r213224) @@ -0,0 +1,215 @@ +.\" $FreeBSD$ +.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07) +.\" +.\" Standard preamble: +.\" ======================================================================== +.de Sp \" Vertical space (when we can't use .PP) +.if t .sp .5v +.if n .sp +.. +.de Vb \" Begin verbatim text +.ft CW +.nf +.ne \\$1 +.. +.de Ve \" End verbatim text +.ft R +.fi +.. +.\" Set up some character translations and predefined strings. \*(-- will +.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left +.\" double quote, and \*(R" will give a right double quote. \*(C+ will +.\" give a nicer C++. Capital omega is used to do unbreakable dashes and +.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, +.\" nothing in troff, for use with C<>. +.tr \(*W- +.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' +.ie n \{\ +. ds -- \(*W- +. ds PI pi +. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch +. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch +. ds L" "" +. ds R" "" +. ds C` "" +. ds C' "" +'br\} +.el\{\ +. ds -- \|\(em\| +. ds PI \(*p +. ds L" `` +. ds R" '' +'br\} +.\" +.\" Escape single quotes in literal strings from groff's Unicode transform. +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" +.\" If the F register is turned on, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.ie \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. nr % 0 +. rr F +.\} +.el \{\ +. de IX +.. +.\} +.\" +.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). +.\" Fear. Run. Save yourself. No user-serviceable parts. +. \" fudge factors for nroff and troff +.if n \{\ +. ds #H 0 +. ds #V .8m +. ds #F .3m +. ds #[ \f1 +. ds #] \fP +.\} +.if t \{\ +. ds #H ((1u-(\\\\n(.fu%2u))*.13m) +. ds #V .6m +. ds #F 0 +. ds #[ \& +. ds #] \& +.\} +. \" simple accents for nroff and troff +.if n \{\ +. ds ' \& +. ds ` \& +. ds ^ \& +. ds , \& +. ds ~ ~ +. ds / +.\} +.if t \{\ +. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" +. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' +. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' +. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' +. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' +. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' +.\} +. \" troff and (daisy-wheel) nroff accents +.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' +.ds 8 \h'\*(#H'\(*b\h'-\*(#H' +.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] +.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' +.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' +.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] +.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] +.ds ae a\h'-(\w'a'u*4/10)'e +.ds Ae A\h'-(\w'A'u*4/10)'E +. \" corrections for vroff +.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' +.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' +. \" for low resolution devices (crt and lpr) +.if \n(.H>23 .if \n(.V>19 \ +\{\ +. ds : e +. ds 8 ss +. ds o a +. ds d- d\h'-1'\(ga +. ds D- D\h'-1'\(hy +. ds th \o'bp' +. ds Th \o'LP' +. ds ae ae +. ds Ae AE +.\} +.rm #[ #] #H #V #F C +.\" ======================================================================== +.\" +.IX Title "TBLGEN 1" +.TH TBLGEN 1 "2010-06-19" "LLVM 2.8" "LLVM Command Guide" +.\" For nroff, turn off justification. Always turn off hyphenation; it makes +.\" way too many mistakes in technical documents. +.if n .ad l +.nh +.SH "NAME" +tblgen \- Target Description To C++ Code Generator +.SH "SYNOPSIS" +.IX Header "SYNOPSIS" +\&\fBtblgen\fR [\fIoptions\fR] [\fIfilename\fR] +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +\&\fBtblgen\fR translates from target description (.td) files into \*(C+ code that can +be included in the definition of an \s-1LLVM\s0 target library. Most users of \s-1LLVM\s0 will +not need to use this program. It is only for assisting with writing an \s-1LLVM\s0 +target backend. +.PP +The input and output of \fBtblgen\fR is beyond the scope of this short +introduction. Please see the \fICodeGeneration\fR page in the \s-1LLVM\s0 documentation. +.PP +The \fIfilename\fR argument specifies the name of a Target Description (.td) file +to read as input. +.SH "OPTIONS" +.IX Header "OPTIONS" +.IP "\fB\-help\fR" 4 +.IX Item "-help" +Print a summary of command line options. +.IP "\fB\-o\fR \fIfilename\fR" 4 +.IX Item "-o filename" +Specify the output file name. If \fIfilename\fR is \f(CW\*(C`\-\*(C'\fR, then \fBtblgen\fR +sends its output to standard output. +.IP "\fB\-I\fR \fIdirectory\fR" 4 +.IX Item "-I directory" +Specify where to find other target description files for inclusion. The +\&\fIdirectory\fR value should be a full or partial path to a directory that contains +target description files. +.IP "\fB\-asmwriternum\fR \fIN\fR" 4 +.IX Item "-asmwriternum N" +Make \-gen\-asm\-writer emit assembly writer number \fIN\fR. +.IP "\fB\-class\fR \fIclass Name\fR" 4 +.IX Item "-class class Name" +Print the enumeration list for this class. +.IP "\fB\-print\-records\fR" 4 +.IX Item "-print-records" +Print all records to standard output (default). +.IP "\fB\-print\-enums\fR" 4 +.IX Item "-print-enums" +Print enumeration values for a class +.IP "\fB\-gen\-emitter\fR" 4 +.IX Item "-gen-emitter" +Generate machine code emitter. +.IP "\fB\-gen\-register\-enums\fR" 4 +.IX Item "-gen-register-enums" +Generate the enumeration values for all registers. +.IP "\fB\-gen\-register\-desc\fR" 4 +.IX Item "-gen-register-desc" +Generate a register info description for each register. +.IP "\fB\-gen\-register\-desc\-header\fR" 4 +.IX Item "-gen-register-desc-header" +Generate a register info description header for each register. +.IP "\fB\-gen\-instr\-enums\fR" 4 +.IX Item "-gen-instr-enums" +Generate enumeration values for instructions. +.IP "\fB\-gen\-instr\-desc\fR" 4 +.IX Item "-gen-instr-desc" +Generate instruction descriptions. +.IP "\fB\-gen\-asm\-writer\fR" 4 +.IX Item "-gen-asm-writer" +Generate the assembly writer. +.IP "\fB\-gen\-dag\-isel\fR" 4 +.IX Item "-gen-dag-isel" +Generate a \s-1DAG\s0 (Directed Acycle Graph) instruction selector. +.IP "\fB\-gen\-subtarget\fR" 4 +.IX Item "-gen-subtarget" +Generate subtarget enumerations. +.IP "\fB\-gen\-intrinsic\fR" 4 +.IX Item "-gen-intrinsic" +Generate intrinsic information. +.IP "\fB\-version\fR" 4 +.IX Item "-version" +Show the version number of this program. +.SH "EXIT STATUS" +.IX Header "EXIT STATUS" +If \fBtblgen\fR succeeds, it will exit with 0. Otherwise, if an error +occurs, it will exit with a non-zero value. +.SH "AUTHORS" +.IX Header "AUTHORS" +Maintained by The \s-1LLVM\s0 Team (). From owner-svn-src-head@FreeBSD.ORG Mon Sep 27 19:26:57 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0AC4E106566B; Mon, 27 Sep 2010 19:26:57 +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 D39E48FC08; Mon, 27 Sep 2010 19:26: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 o8RJQu2O047374; Mon, 27 Sep 2010 19:26:56 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8RJQuHE047371; Mon, 27 Sep 2010 19:26:56 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201009271926.o8RJQuHE047371@svn.freebsd.org> From: Xin LI Date: Mon, 27 Sep 2010 19:26:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213225 - in head/sys: netinet netinet6 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Sep 2010 19:26:57 -0000 Author: delphij Date: Mon Sep 27 19:26:56 2010 New Revision: 213225 URL: http://svn.freebsd.org/changeset/base/213225 Log: Add a bandaid for a long-standing race condition during route entry un-expiring. The previous version of code have no locking when testing rt_refcnt. The result of the lack of locking may result in a condition where a routing entry have a reference count but at the same time have RTPRF_OURS bit set and an expiration timer. These would eventually lead to a panic: panic: rtqkill route really not free When the system have ICMP redirects accepted from local gateway in a moderate frequency, for instance. Commit this workaround for now until we have some better solution. PR: kern/149804 Reviewed by: bz Tested by: Zhao Xin, Pete French MFC after: 2 weeks Modified: head/sys/netinet/in_rmx.c head/sys/netinet6/in6_rmx.c Modified: head/sys/netinet/in_rmx.c ============================================================================== --- head/sys/netinet/in_rmx.c Mon Sep 27 19:03:18 2010 (r213224) +++ head/sys/netinet/in_rmx.c Mon Sep 27 19:26:56 2010 (r213225) @@ -121,12 +121,13 @@ in_matroute(void *v_arg, struct radix_no struct radix_node *rn = rn_match(v_arg, head); struct rtentry *rt = (struct rtentry *)rn; - /*XXX locking? */ - if (rt && rt->rt_refcnt == 0) { /* this is first reference */ + if (rt) { + RT_LOCK(rt); if (rt->rt_flags & RTPRF_OURS) { rt->rt_flags &= ~RTPRF_OURS; rt->rt_rmx.rmx_expire = 0; } + RT_UNLOCK(rt); } return rn; } Modified: head/sys/netinet6/in6_rmx.c ============================================================================== --- head/sys/netinet6/in6_rmx.c Mon Sep 27 19:03:18 2010 (r213224) +++ head/sys/netinet6/in6_rmx.c Mon Sep 27 19:26:56 2010 (r213225) @@ -193,11 +193,13 @@ in6_matroute(void *v_arg, struct radix_n struct radix_node *rn = rn_match(v_arg, head); struct rtentry *rt = (struct rtentry *)rn; - if (rt && rt->rt_refcnt == 0) { /* this is first reference */ + if (rt) { + RT_LOCK(rt); if (rt->rt_flags & RTPRF_OURS) { rt->rt_flags &= ~RTPRF_OURS; rt->rt_rmx.rmx_expire = 0; } + RT_UNLOCK(rt); } return rn; } From owner-svn-src-head@FreeBSD.ORG Mon Sep 27 19:36:16 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3B093106566B; Mon, 27 Sep 2010 19:36:16 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 290448FC13; Mon, 27 Sep 2010 19:36: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 o8RJaGTA047626; Mon, 27 Sep 2010 19:36:16 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8RJaG6J047624; Mon, 27 Sep 2010 19:36:16 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201009271936.o8RJaG6J047624@svn.freebsd.org> From: John Baldwin Date: Mon, 27 Sep 2010 19:36:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213226 - head/sys/i386/i386 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Sep 2010 19:36:16 -0000 Author: jhb Date: Mon Sep 27 19:36:15 2010 New Revision: 213226 URL: http://svn.freebsd.org/changeset/base/213226 Log: Rewrite the i386 memory probe: - Check for SMAP data from the loader first. If it exists, don't bother doing any VM86 calls at all. This will be more friendly for non-BIOS boot environments such as EFI, etc. - Move the base memory setup into a new basemem_setup() routine instead of duplicating it. - Simplify the XEN case by removing all of the VM86/SMAP parsing code rather than just jumping over it. - Adjust some comments to better explain the code flow. MFC after: 2 weeks Modified: head/sys/i386/i386/machdep.c Modified: head/sys/i386/i386/machdep.c ============================================================================== --- head/sys/i386/i386/machdep.c Mon Sep 27 19:26:56 2010 (r213225) +++ head/sys/i386/i386/machdep.c Mon Sep 27 19:36:15 2010 (r213226) @@ -1950,6 +1950,7 @@ sdtossd(sd, ssd) ssd->ssd_gran = sd->sd_gran; } +#ifndef XEN static int add_smap_entry(struct bios_smap *smap, vm_paddr_t *physmap, int *physmap_idxp) { @@ -2029,78 +2030,13 @@ add_smap_entry(struct bios_smap *smap, v return (1); } -/* - * Populate the (physmap) array with base/bound pairs describing the - * available physical memory in the system, then test this memory and - * build the phys_avail array describing the actually-available memory. - * - * If we cannot accurately determine the physical memory map, then use - * value from the 0xE801 call, and failing that, the RTC. - * - * Total memory size may be set by the kernel environment variable - * hw.physmem or the compile-time define MAXMEM. - * - * XXX first should be vm_paddr_t. - */ static void -getmemsize(int first) +basemem_setup(void) { - int i, off, physmap_idx, pa_indx, da_indx; - int hasbrokenint12, has_smap; - u_long physmem_tunable; - u_int extmem; - struct vm86frame vmf; - struct vm86context vmc; - vm_paddr_t pa, physmap[PHYSMAP_SIZE]; + vm_paddr_t pa; pt_entry_t *pte; - struct bios_smap *smap, *smapbase, *smapend; - u_int32_t smapsize; - quad_t dcons_addr, dcons_size; - caddr_t kmdp; - - has_smap = 0; -#ifdef XBOX - if (arch_i386_is_xbox) { - /* - * We queried the memory size before, so chop off 4MB for - * the framebuffer and inform the OS of this. - */ - physmap[0] = 0; - physmap[1] = (arch_i386_xbox_memsize * 1024 * 1024) - XBOX_FB_SIZE; - physmap_idx = 0; - goto physmap_done; - } -#endif -#if defined(XEN) - has_smap = 0; - Maxmem = xen_start_info->nr_pages - init_first; - physmem = Maxmem; - basemem = 0; - physmap[0] = init_first << PAGE_SHIFT; - physmap[1] = ptoa(Maxmem) - round_page(MSGBUF_SIZE); - physmap_idx = 0; - goto physmap_done; -#endif - hasbrokenint12 = 0; - TUNABLE_INT_FETCH("hw.hasbrokenint12", &hasbrokenint12); - bzero(&vmf, sizeof(vmf)); - bzero(physmap, sizeof(physmap)); - basemem = 0; - - /* - * Some newer BIOSes has broken INT 12H implementation which cause - * kernel panic immediately. In this case, we need to scan SMAP - * with INT 15:E820 first, then determine base memory size. - */ - if (hasbrokenint12) { - goto int15e820; - } + int i; - /* - * Perform "base memory" related probes & setup - */ - vm86_intcall(0x12, &vmf); - basemem = vmf.vmf_ax; if (basemem > 640) { printf("Preposterous BIOS basemem of %uK, truncating to 640K\n", basemem); @@ -2140,12 +2076,69 @@ getmemsize(int first) pte = (pt_entry_t *)vm86paddr; for (i = basemem / 4; i < 160; i++) pte[i] = (i << PAGE_SHIFT) | PG_V | PG_RW | PG_U; +} +#endif + +/* + * Populate the (physmap) array with base/bound pairs describing the + * available physical memory in the system, then test this memory and + * build the phys_avail array describing the actually-available memory. + * + * If we cannot accurately determine the physical memory map, then use + * value from the 0xE801 call, and failing that, the RTC. + * + * Total memory size may be set by the kernel environment variable + * hw.physmem or the compile-time define MAXMEM. + * + * XXX first should be vm_paddr_t. + */ +static void +getmemsize(int first) +{ + int has_smap, off, physmap_idx, pa_indx, da_indx; + u_long physmem_tunable; + vm_paddr_t physmap[PHYSMAP_SIZE]; + pt_entry_t *pte; + quad_t dcons_addr, dcons_size; +#ifndef XEN + int hasbrokenint12, i; + u_int extmem; + struct vm86frame vmf; + struct vm86context vmc; + vm_paddr_t pa; + struct bios_smap *smap, *smapbase, *smapend; + u_int32_t smapsize; + caddr_t kmdp; +#endif + + has_smap = 0; +#if defined(XEN) + Maxmem = xen_start_info->nr_pages - init_first; + physmem = Maxmem; + basemem = 0; + physmap[0] = init_first << PAGE_SHIFT; + physmap[1] = ptoa(Maxmem) - round_page(MSGBUF_SIZE); + physmap_idx = 0; +#else +#ifdef XBOX + if (arch_i386_is_xbox) { + /* + * We queried the memory size before, so chop off 4MB for + * the framebuffer and inform the OS of this. + */ + physmap[0] = 0; + physmap[1] = (arch_i386_xbox_memsize * 1024 * 1024) - XBOX_FB_SIZE; + physmap_idx = 0; + goto physmap_done; + } +#endif + bzero(&vmf, sizeof(vmf)); + bzero(physmap, sizeof(physmap)); + basemem = 0; -int15e820: /* - * Fetch the memory map with INT 15:E820. First, check to see - * if the loader supplied it and use that if so. Otherwise, - * use vm86 to invoke the BIOS call directly. + * Check if the loader supplied an SMAP memory map. If so, + * use that and do not make any VM86 calls. */ physmap_idx = 0; smapbase = NULL; @@ -2156,9 +2149,10 @@ int15e820: smapbase = (struct bios_smap *)preload_search_info(kmdp, MODINFO_METADATA | MODINFOMD_SMAP); if (smapbase != NULL) { - /* subr_module.c says: + /* + * subr_module.c says: * "Consumer may safely assume that size value precedes data." - * ie: an int32_t immediately precedes smap. + * ie: an int32_t immediately precedes SMAP. */ smapsize = *((u_int32_t *)smapbase - 1); smapend = (struct bios_smap *)((uintptr_t)smapbase + smapsize); @@ -2167,33 +2161,50 @@ int15e820: for (smap = smapbase; smap < smapend; smap++) if (!add_smap_entry(smap, physmap, &physmap_idx)) break; - } else { - /* - * map page 1 R/W into the kernel page table so we can use it - * as a buffer. The kernel will unmap this page later. - */ - pmap_kenter(KERNBASE + (1 << PAGE_SHIFT), 1 << PAGE_SHIFT); - vmc.npages = 0; - smap = (void *)vm86_addpage(&vmc, 1, KERNBASE + - (1 << PAGE_SHIFT)); - vm86_getptr(&vmc, (vm_offset_t)smap, &vmf.vmf_es, &vmf.vmf_di); - - vmf.vmf_ebx = 0; - do { - vmf.vmf_eax = 0xE820; - vmf.vmf_edx = SMAP_SIG; - vmf.vmf_ecx = sizeof(struct bios_smap); - i = vm86_datacall(0x15, &vmf, &vmc); - if (i || vmf.vmf_eax != SMAP_SIG) - break; - has_smap = 1; - if (!add_smap_entry(smap, physmap, &physmap_idx)) - break; - } while (vmf.vmf_ebx != 0); + goto have_smap; } /* - * Perform "base memory" related probes & setup based on SMAP + * Some newer BIOSes have a broken INT 12H implementation + * which causes a kernel panic immediately. In this case, we + * need use the SMAP to determine the base memory size. + */ + hasbrokenint12 = 0; + TUNABLE_INT_FETCH("hw.hasbrokenint12", &hasbrokenint12); + if (hasbrokenint12 == 0) { + /* Use INT12 to determine base memory size. */ + vm86_intcall(0x12, &vmf); + basemem = vmf.vmf_ax; + basemem_setup(); + } + + /* + * Fetch the memory map with INT 15:E820. Map page 1 R/W into + * the kernel page table so we can use it as a buffer. The + * kernel will unmap this page later. + */ + pmap_kenter(KERNBASE + (1 << PAGE_SHIFT), 1 << PAGE_SHIFT); + vmc.npages = 0; + smap = (void *)vm86_addpage(&vmc, 1, KERNBASE + (1 << PAGE_SHIFT)); + vm86_getptr(&vmc, (vm_offset_t)smap, &vmf.vmf_es, &vmf.vmf_di); + + vmf.vmf_ebx = 0; + do { + vmf.vmf_eax = 0xE820; + vmf.vmf_edx = SMAP_SIG; + vmf.vmf_ecx = sizeof(struct bios_smap); + i = vm86_datacall(0x15, &vmf, &vmc); + if (i || vmf.vmf_eax != SMAP_SIG) + break; + has_smap = 1; + if (!add_smap_entry(smap, physmap, &physmap_idx)) + break; + } while (vmf.vmf_ebx != 0); + +have_smap: + /* + * If we didn't fetch the "base memory" size from INT12, + * figure it out from the SMAP (or just guess). */ if (basemem == 0) { for (i = 0; i <= physmap_idx; i += 2) { @@ -2203,49 +2214,39 @@ int15e820: } } - /* - * XXX this function is horribly organized and has to the same - * things that it does above here. - */ + /* XXX: If we couldn't find basemem from SMAP, just guess. */ if (basemem == 0) basemem = 640; - if (basemem > 640) { - printf( - "Preposterous BIOS basemem of %uK, truncating to 640K\n", - basemem); - basemem = 640; - } - - /* - * Let vm86 scribble on pages between basemem and - * ISA_HOLE_START, as above. - */ - for (pa = trunc_page(basemem * 1024); - pa < ISA_HOLE_START; pa += PAGE_SIZE) - pmap_kenter(KERNBASE + pa, pa); - pte = (pt_entry_t *)vm86paddr; - for (i = basemem / 4; i < 160; i++) - pte[i] = (i << PAGE_SHIFT) | PG_V | PG_RW | PG_U; + basemem_setup(); } if (physmap[1] != 0) goto physmap_done; /* - * If we failed above, try memory map with INT 15:E801 + * If we failed to find an SMAP, figure out the extended + * memory size. We will then build a simple memory map with + * two segments, one for "base memory" and the second for + * "extended memory". Note that "extended memory" starts at a + * physical address of 1MB and that both basemem and extmem + * are in units of 1KB. + * + * First, try to fetch the extended memory size via INT 15:E801. */ vmf.vmf_ax = 0xE801; if (vm86_intcall(0x15, &vmf) == 0) { extmem = vmf.vmf_cx + vmf.vmf_dx * 64; } else { + /* + * If INT15:E801 fails, this is our last ditch effort + * to determine the extended memory size. Currently + * we prefer the RTC value over INT15:88. + */ #if 0 vmf.vmf_ah = 0x88; vm86_intcall(0x15, &vmf); extmem = vmf.vmf_ax; -#elif !defined(XEN) - /* - * Prefer the RTC value for extended memory. - */ +#else extmem = rtcin(RTC_EXTLO) + (rtcin(RTC_EXTHI) << 8); #endif } @@ -2270,6 +2271,7 @@ int15e820: physmap[physmap_idx + 1] = physmap[physmap_idx] + extmem * 1024; physmap_done: +#endif /* * Now, physmap contains a map of physical memory. */ From owner-svn-src-head@FreeBSD.ORG Mon Sep 27 19:42:04 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F04D31065679; Mon, 27 Sep 2010 19:42:04 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id C3AB28FC1C; Mon, 27 Sep 2010 19:42:04 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 6A8F646B09; Mon, 27 Sep 2010 15:42:04 -0400 (EDT) Received: from jhbbsd.localnet (smtp.hudson-trading.com [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 615B08A03C; Mon, 27 Sep 2010 15:42:03 -0400 (EDT) From: John Baldwin To: src-committers@freebsd.org Date: Mon, 27 Sep 2010 15:41:48 -0400 User-Agent: KMail/1.13.5 (FreeBSD/7.3-CBSD-20100819; KDE/4.4.5; amd64; ; ) References: <201009271936.o8RJaG6J047624@svn.freebsd.org> In-Reply-To: <201009271936.o8RJaG6J047624@svn.freebsd.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201009271541.48624.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Mon, 27 Sep 2010 15:42:03 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.6 required=4.2 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org Subject: Re: svn commit: r213226 - head/sys/i386/i386 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Sep 2010 19:42:05 -0000 On Monday, September 27, 2010 3:36:16 pm John Baldwin wrote: > Author: jhb > Date: Mon Sep 27 19:36:15 2010 > New Revision: 213226 > URL: http://svn.freebsd.org/changeset/base/213226 > > Log: > Rewrite the i386 memory probe: > - Check for SMAP data from the loader first. If it exists, don't bother > doing any VM86 calls at all. This will be more friendly for non-BIOS > boot environments such as EFI, etc. > - Move the base memory setup into a new basemem_setup() routine instead > of duplicating it. > - Simplify the XEN case by removing all of the VM86/SMAP parsing code rather > than just jumping over it. > - Adjust some comments to better explain the code flow. This could maybe be cleaned up a bit further by splitting getmemsize() up into two routines: one to populate physmap[], and one to do the rest. Then XEN could just have a separate routine for the first function for example. -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Mon Sep 27 19:45:34 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 72AD01065673; Mon, 27 Sep 2010 19:45:34 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 61F888FC0C; Mon, 27 Sep 2010 19:45: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 o8RJjYDc047861; Mon, 27 Sep 2010 19:45:34 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8RJjY5t047859; Mon, 27 Sep 2010 19:45:34 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201009271945.o8RJjY5t047859@svn.freebsd.org> From: Juli Mallett Date: Mon, 27 Sep 2010 19:45:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213227 - head/sys/conf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Sep 2010 19:45:34 -0000 Author: jmallett Date: Mon Sep 27 19:45:34 2010 New Revision: 213227 URL: http://svn.freebsd.org/changeset/base/213227 Log: Use a single program header to fix loading 64-bit kernels on old versions of U-Boot. Modified: head/sys/conf/ldscript.mips.octeon1.64 Modified: head/sys/conf/ldscript.mips.octeon1.64 ============================================================================== --- head/sys/conf/ldscript.mips.octeon1.64 Mon Sep 27 19:36:15 2010 (r213226) +++ head/sys/conf/ldscript.mips.octeon1.64 Mon Sep 27 19:45:34 2010 (r213227) @@ -7,24 +7,29 @@ ENTRY(_start) __DYNAMIC = 0; PROVIDE (_DYNAMIC = 0); +PHDRS { + text PT_LOAD FLAGS(0x7); +} + SECTIONS { . = KERNLOADADDR + SIZEOF_HEADERS; - .text . : { + .text : { *(.text) *(.dynamic) etext = .; _etext = .; . = ALIGN(0x2000); - } + } : text - .rodata ALIGN(0x2000) : { + . = ALIGN(0x2000); + .rodata : { _fdata = .; *(.rodata) . = ALIGN(32); } - .data . : { + .data : { _rwdata = .; *(.data) . = ALIGN(32); @@ -33,15 +38,15 @@ SECTIONS { _gp = (. + 0x8000); - .sdata . : { + .sdata : { _small_start = .; *(.sdata) . = ALIGN(32); edata = .; _edata = .; - } + } : text - .sbss . : { + .sbss : { __bss_start = .; _fbss = .; *(.sbss) *(.scommon) @@ -49,7 +54,7 @@ SECTIONS { . = ALIGN(32); } - .bss . : { + .bss : { *(.bss) *(COMMON) . = ALIGN(32); From owner-svn-src-head@FreeBSD.ORG Mon Sep 27 20:12:57 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B10EC1065672; Mon, 27 Sep 2010 20:12:57 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9F20F8FC0C; Mon, 27 Sep 2010 20:12: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 o8RKCvfR048634; Mon, 27 Sep 2010 20:12:57 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8RKCvvF048632; Mon, 27 Sep 2010 20:12:57 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201009272012.o8RKCvvF048632@svn.freebsd.org> From: Juli Mallett Date: Mon, 27 Sep 2010 20:12:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213228 - head/sys/mips/cavium X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Sep 2010 20:12:57 -0000 Author: jmallett Date: Mon Sep 27 20:12:57 2010 New Revision: 213228 URL: http://svn.freebsd.org/changeset/base/213228 Log: o) Program the Lanner MR-320 for 32-bit mode, too. o) Give a virtual address for I/O ports on n64. o) On the Portwell CAM-0100, return the right IRQ for the on-board SATA. o) Except on bridges, only set PORTEN and MEMEN on devices that have I/O or memory BARs respectively. o) Disable PORTEN and MEMEN while reprogramming BARs. o) On the Lanner MR-955, set the Tx DMA power register for the on-board Promise SATA controller. Modified: head/sys/mips/cavium/octopci.c Modified: head/sys/mips/cavium/octopci.c ============================================================================== --- head/sys/mips/cavium/octopci.c Mon Sep 27 19:45:34 2010 (r213227) +++ head/sys/mips/cavium/octopci.c Mon Sep 27 20:12:57 2010 (r213228) @@ -92,7 +92,7 @@ static void octopci_write_config(device_ uint32_t, int); static int octopci_route_interrupt(device_t, device_t, int); -static void octopci_init_bar(device_t, unsigned, unsigned, unsigned, unsigned); +static void octopci_init_bar(device_t, unsigned, unsigned, unsigned, unsigned, uint8_t *); static unsigned octopci_init_device(device_t, unsigned, unsigned, unsigned, unsigned); static unsigned octopci_init_bus(device_t, unsigned); static uint64_t octopci_cs_addr(unsigned, unsigned, unsigned, unsigned); @@ -148,6 +148,7 @@ octopci_attach(device_t dev) */ switch (cvmx_sysinfo_get()->board_type) { #if defined(OCTEON_VENDOR_LANNER) + case CVMX_BOARD_TYPE_CUST_LANNER_MR320: case CVMX_BOARD_TYPE_CUST_LANNER_MR955: /* 32-bit PCI-X */ cvmx_write_csr(CVMX_CIU_SOFT_PRST, 0x0); @@ -422,14 +423,14 @@ octopci_alloc_resource(device_t bus, dev break; case SYS_RES_IOPORT: rman_set_bushandle(res, CVMX_ADDR_DID(CVMX_FULL_DID(CVMX_OCT_DID_PCI, CVMX_OCT_SUBDID_PCI_IO)) + rman_get_start(res)); +#if __mips_n64 + rman_set_virtual(res, (void *)rman_get_bushandle(res)); +#else /* * XXX - * We should just disallow use of io ports on !n64 since without - * 64-bit PTEs we can't even do a 32-bit virtual address - * mapped to them. + * We can't access ports via a 32-bit pointer. */ -#if 0 - rman_set_virtual(res, (void *)rman_get_bushandle(res)); + rman_set_virtual(res, NULL); #endif break; } @@ -549,8 +550,19 @@ octopci_route_interrupt(device_t dev, de slot = pci_get_slot(child); func = pci_get_function(child); -#if defined(OCTEON_VENDOR_LANNER) + /* + * Board types we have to know at compile-time. + */ +#if defined(OCTEON_BOARD_CAPK_0100ND) + if (bus == 0 && slot == 12 && func == 0) + return (CVMX_IRQ_PCI_INT2); +#endif + + /* + * For board types we can determine at runtime. + */ switch (cvmx_sysinfo_get()->board_type) { +#if defined(OCTEON_VENDOR_LANNER) case CVMX_BOARD_TYPE_CUST_LANNER_MR955: return (CVMX_IRQ_PCI_INT0 + pin - 1); case CVMX_BOARD_TYPE_CUST_LANNER_MR320: @@ -562,10 +574,10 @@ octopci_route_interrupt(device_t dev, de return (CVMX_IRQ_PCI_INT0 + (irq & 3)); } break; +#endif default: break; } -#endif irq = slot + pin - 3; @@ -573,7 +585,7 @@ octopci_route_interrupt(device_t dev, de } static void -octopci_init_bar(device_t dev, unsigned b, unsigned s, unsigned f, unsigned barnum) +octopci_init_bar(device_t dev, unsigned b, unsigned s, unsigned f, unsigned barnum, uint8_t *commandp) { struct octopci_softc *sc; uint32_t bar; @@ -603,6 +615,11 @@ octopci_init_bar(device_t dev, unsigned octopci_write_config(dev, b, s, f, PCIR_BAR(barnum), CVMX_OCT_PCI_IO_BASE + sc->sc_io_next, 4); sc->sc_io_next += size; + + /* + * Enable I/O ports. + */ + *commandp |= PCIM_CMD_PORTEN; } else { size = ~(bar & (uint32_t)PCIM_BAR_MEM_BASE) + 1; @@ -615,6 +632,11 @@ octopci_init_bar(device_t dev, unsigned octopci_write_config(dev, b, s, f, PCIR_BAR(barnum), CVMX_OCT_PCI_MEM1_BASE + sc->sc_mem1_next, 4); sc->sc_mem1_next += size; + + /* + * Enable memory access. + */ + *commandp |= PCIM_CMD_MEMEN; } } @@ -630,6 +652,13 @@ octopci_init_device(device_t dev, unsign /* Read header type (again.) */ hdrtype = octopci_read_config(dev, b, s, f, PCIR_HDRTYPE, 1); + /* + * Disable memory and I/O while programming BARs. + */ + command = octopci_read_config(dev, b, s, f, PCIR_COMMAND, 1); + command &= ~(PCIM_CMD_MEMEN | PCIM_CMD_PORTEN); + octopci_write_config(dev, b, s, f, PCIR_COMMAND, command, 1); + /* Program BARs. */ switch (hdrtype & PCIM_HDRTYPE) { case PCIM_HDRTYPE_NORMAL: @@ -648,14 +677,12 @@ octopci_init_device(device_t dev, unsign } for (barnum = 0; barnum < bars; barnum++) - octopci_init_bar(dev, b, s, f, barnum); - - /* Enable memory and I/O. */ - command = octopci_read_config(dev, b, s, f, PCIR_COMMAND, 1); - command |= PCIM_CMD_MEMEN | PCIM_CMD_PORTEN; + octopci_init_bar(dev, b, s, f, barnum, &command); /* Enable bus mastering. */ command |= PCIM_CMD_BUSMASTEREN; + + /* Enable whatever facilities the BARs require. */ octopci_write_config(dev, b, s, f, PCIR_COMMAND, command, 1); /* @@ -668,6 +695,38 @@ octopci_init_device(device_t dev, unsign /* Set latency timer. */ octopci_write_config(dev, b, s, f, PCIR_LATTIMER, 48, 1); + /* Board-specific or device-specific fixups and workarounds. */ + switch (cvmx_sysinfo_get()->board_type) { +#if defined(OCTEON_VENDOR_LANNER) + case CVMX_BOARD_TYPE_CUST_LANNER_MR955: + if (b == 1 && s == 7 && f == 0) { + bus_addr_t busaddr, unitbusaddr; + uint32_t bar; + uint32_t tmp; + unsigned unit; + + /* + * Set Tx DMA power. + */ + bar = octopci_read_config(dev, b, s, f, + PCIR_BAR(3), 4); + busaddr = CVMX_ADDR_DID(CVMX_FULL_DID(CVMX_OCT_DID_PCI, + CVMX_OCT_SUBDID_PCI_MEM1)); + busaddr += (bar & (uint32_t)PCIM_BAR_MEM_BASE); + for (unit = 0; unit < 4; unit++) { + unitbusaddr = busaddr + 0x430 + (unit << 8); + tmp = le32toh(cvmx_read64_uint32(unitbusaddr)); + tmp &= ~0x700; + tmp |= 0x300; + cvmx_write64_uint32(unitbusaddr, htole32(tmp)); + } + } + break; +#endif + default: + break; + } + /* Configure PCI-PCI bridges. */ class = octopci_read_config(dev, b, s, f, PCIR_CLASS, 1); if (class != PCIC_BRIDGE) @@ -677,6 +736,10 @@ octopci_init_device(device_t dev, unsign if (subclass != PCIS_BRIDGE_PCI) return (secbus); + /* Enable memory and I/O access. */ + command |= PCIM_CMD_MEMEN | PCIM_CMD_PORTEN; + octopci_write_config(dev, b, s, f, PCIR_COMMAND, command, 1); + /* Enable errors and parity checking. Do a bus reset. */ brctl = octopci_read_config(dev, b, s, f, PCIR_BRIDGECTL_1, 1); brctl |= PCIB_BCR_PERR_ENABLE | PCIB_BCR_SERR_ENABLE; From owner-svn-src-head@FreeBSD.ORG Mon Sep 27 20:31:04 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3AD37106566C; Mon, 27 Sep 2010 20:31:04 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 28C3E8FC0A; Mon, 27 Sep 2010 20:31:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8RKV41u049050; Mon, 27 Sep 2010 20:31:04 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8RKV3AT049016; Mon, 27 Sep 2010 20:31:03 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201009272031.o8RKV3AT049016@svn.freebsd.org> From: Marius Strobl Date: Mon, 27 Sep 2010 20:31:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213229 - in head/sys/dev: dc mii X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Sep 2010 20:31:04 -0000 Author: marius Date: Mon Sep 27 20:31:03 2010 New Revision: 213229 URL: http://svn.freebsd.org/changeset/base/213229 Log: Use the mii_data provided via mii_attach_args and mii_pdata respectively instead of reaching out for the softc of the parent. Modified: head/sys/dev/dc/dcphy.c head/sys/dev/dc/pnphy.c head/sys/dev/mii/acphy.c head/sys/dev/mii/amphy.c head/sys/dev/mii/atphy.c head/sys/dev/mii/axphy.c head/sys/dev/mii/bmtphy.c head/sys/dev/mii/brgphy.c head/sys/dev/mii/ciphy.c head/sys/dev/mii/e1000phy.c head/sys/dev/mii/exphy.c head/sys/dev/mii/gentbi.c head/sys/dev/mii/icsphy.c head/sys/dev/mii/inphy.c head/sys/dev/mii/ip1000phy.c head/sys/dev/mii/jmphy.c head/sys/dev/mii/lxtphy.c head/sys/dev/mii/mii_physubr.c head/sys/dev/mii/mlphy.c head/sys/dev/mii/nsgphy.c head/sys/dev/mii/nsphy.c head/sys/dev/mii/nsphyter.c head/sys/dev/mii/pnaphy.c head/sys/dev/mii/qsphy.c head/sys/dev/mii/rgephy.c head/sys/dev/mii/rlphy.c head/sys/dev/mii/rlswitch.c head/sys/dev/mii/ruephy.c head/sys/dev/mii/smcphy.c head/sys/dev/mii/tdkphy.c head/sys/dev/mii/truephy.c head/sys/dev/mii/ukphy.c head/sys/dev/mii/xmphy.c Modified: head/sys/dev/dc/dcphy.c ============================================================================== --- head/sys/dev/dc/dcphy.c Mon Sep 27 20:12:57 2010 (r213228) +++ head/sys/dev/dc/dcphy.c Mon Sep 27 20:31:03 2010 (r213229) @@ -146,7 +146,7 @@ dcphy_attach(device_t dev) sc = device_get_softc(dev); ma = device_get_ivars(dev); sc->mii_dev = device_get_parent(dev); - mii = device_get_softc(sc->mii_dev); + mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); sc->mii_inst = mii->mii_instance; Modified: head/sys/dev/dc/pnphy.c ============================================================================== --- head/sys/dev/dc/pnphy.c Mon Sep 27 20:12:57 2010 (r213228) +++ head/sys/dev/dc/pnphy.c Mon Sep 27 20:31:03 2010 (r213229) @@ -129,7 +129,7 @@ pnphy_attach(device_t dev) sc = device_get_softc(dev); ma = device_get_ivars(dev); sc->mii_dev = device_get_parent(dev); - mii = device_get_softc(sc->mii_dev); + mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); sc->mii_inst = mii->mii_instance; Modified: head/sys/dev/mii/acphy.c ============================================================================== --- head/sys/dev/mii/acphy.c Mon Sep 27 20:12:57 2010 (r213228) +++ head/sys/dev/mii/acphy.c Mon Sep 27 20:31:03 2010 (r213229) @@ -129,7 +129,7 @@ acphy_attach(device_t dev) sc = device_get_softc(dev); ma = device_get_ivars(dev); sc->mii_dev = device_get_parent(dev); - mii = device_get_softc(sc->mii_dev); + mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); sc->mii_inst = mii->mii_instance; Modified: head/sys/dev/mii/amphy.c ============================================================================== --- head/sys/dev/mii/amphy.c Mon Sep 27 20:12:57 2010 (r213228) +++ head/sys/dev/mii/amphy.c Mon Sep 27 20:31:03 2010 (r213229) @@ -106,7 +106,7 @@ amphy_attach(device_t dev) sc = device_get_softc(dev); ma = device_get_ivars(dev); sc->mii_dev = device_get_parent(dev); - mii = device_get_softc(sc->mii_dev); + mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); sc->mii_inst = mii->mii_instance; Modified: head/sys/dev/mii/atphy.c ============================================================================== --- head/sys/dev/mii/atphy.c Mon Sep 27 20:12:57 2010 (r213228) +++ head/sys/dev/mii/atphy.c Mon Sep 27 20:31:03 2010 (r213229) @@ -110,7 +110,7 @@ atphy_attach(device_t dev) sc = &asc->mii_sc; ma = device_get_ivars(dev); sc->mii_dev = device_get_parent(dev); - mii = device_get_softc(sc->mii_dev); + mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); sc->mii_inst = mii->mii_instance; Modified: head/sys/dev/mii/axphy.c ============================================================================== --- head/sys/dev/mii/axphy.c Mon Sep 27 20:12:57 2010 (r213228) +++ head/sys/dev/mii/axphy.c Mon Sep 27 20:31:03 2010 (r213229) @@ -96,7 +96,7 @@ axphy_attach(device_t dev) sc = device_get_softc(dev); ma = device_get_ivars(dev); sc->mii_dev = device_get_parent(dev); - mii = device_get_softc(sc->mii_dev); + mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); sc->mii_inst = mii->mii_instance; Modified: head/sys/dev/mii/bmtphy.c ============================================================================== --- head/sys/dev/mii/bmtphy.c Mon Sep 27 20:12:57 2010 (r213228) +++ head/sys/dev/mii/bmtphy.c Mon Sep 27 20:31:03 2010 (r213229) @@ -144,7 +144,7 @@ bmtphy_attach(device_t dev) sc = device_get_softc(dev); ma = device_get_ivars(dev); sc->mii_dev = device_get_parent(dev); - mii = device_get_softc(sc->mii_dev); + mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); sc->mii_inst = mii->mii_instance; Modified: head/sys/dev/mii/brgphy.c ============================================================================== --- head/sys/dev/mii/brgphy.c Mon Sep 27 20:12:57 2010 (r213228) +++ head/sys/dev/mii/brgphy.c Mon Sep 27 20:31:03 2010 (r213229) @@ -187,7 +187,7 @@ brgphy_attach(device_t dev) sc = &bsc->mii_sc; ma = device_get_ivars(dev); sc->mii_dev = device_get_parent(dev); - mii = device_get_softc(sc->mii_dev); + mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); /* Initialize mii_softc structure */ Modified: head/sys/dev/mii/ciphy.c ============================================================================== --- head/sys/dev/mii/ciphy.c Mon Sep 27 20:12:57 2010 (r213228) +++ head/sys/dev/mii/ciphy.c Mon Sep 27 20:31:03 2010 (r213229) @@ -115,7 +115,7 @@ ciphy_attach(device_t dev) sc = device_get_softc(dev); ma = device_get_ivars(dev); sc->mii_dev = device_get_parent(dev); - mii = device_get_softc(sc->mii_dev); + mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); sc->mii_inst = mii->mii_instance; Modified: head/sys/dev/mii/e1000phy.c ============================================================================== --- head/sys/dev/mii/e1000phy.c Mon Sep 27 20:12:57 2010 (r213228) +++ head/sys/dev/mii/e1000phy.c Mon Sep 27 20:31:03 2010 (r213229) @@ -141,7 +141,7 @@ e1000phy_attach(device_t dev) sc = &esc->mii_sc; ma = device_get_ivars(dev); sc->mii_dev = device_get_parent(dev); - mii = device_get_softc(sc->mii_dev); + mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); sc->mii_inst = mii->mii_instance; Modified: head/sys/dev/mii/exphy.c ============================================================================== --- head/sys/dev/mii/exphy.c Mon Sep 27 20:12:57 2010 (r213228) +++ head/sys/dev/mii/exphy.c Mon Sep 27 20:31:03 2010 (r213229) @@ -135,7 +135,7 @@ exphy_attach(device_t dev) sc = device_get_softc(dev); ma = device_get_ivars(dev); sc->mii_dev = device_get_parent(dev); - mii = device_get_softc(sc->mii_dev); + mii = ma->mii_data; /* * The 3Com PHY can never be isolated, so never allow non-zero Modified: head/sys/dev/mii/gentbi.c ============================================================================== --- head/sys/dev/mii/gentbi.c Mon Sep 27 20:12:57 2010 (r213228) +++ head/sys/dev/mii/gentbi.c Mon Sep 27 20:31:03 2010 (r213229) @@ -158,7 +158,7 @@ gentbi_attach(device_t dev) sc = device_get_softc(dev); ma = device_get_ivars(dev); sc->mii_dev = device_get_parent(dev); - mii = device_get_softc(sc->mii_dev); + mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); if (bootverbose) Modified: head/sys/dev/mii/icsphy.c ============================================================================== --- head/sys/dev/mii/icsphy.c Mon Sep 27 20:12:57 2010 (r213228) +++ head/sys/dev/mii/icsphy.c Mon Sep 27 20:31:03 2010 (r213229) @@ -138,7 +138,7 @@ icsphy_attach(device_t dev) sc = &isc->mii_sc; ma = device_get_ivars(dev); sc->mii_dev = device_get_parent(dev); - mii = device_get_softc(sc->mii_dev); + mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); sc->mii_inst = mii->mii_instance; Modified: head/sys/dev/mii/inphy.c ============================================================================== --- head/sys/dev/mii/inphy.c Mon Sep 27 20:12:57 2010 (r213228) +++ head/sys/dev/mii/inphy.c Mon Sep 27 20:31:03 2010 (r213229) @@ -104,7 +104,7 @@ inphy_attach(device_t dev) sc = device_get_softc(dev); ma = device_get_ivars(dev); sc->mii_dev = device_get_parent(dev); - mii = device_get_softc(sc->mii_dev); + mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); sc->mii_inst = mii->mii_instance; Modified: head/sys/dev/mii/ip1000phy.c ============================================================================== --- head/sys/dev/mii/ip1000phy.c Mon Sep 27 20:12:57 2010 (r213228) +++ head/sys/dev/mii/ip1000phy.c Mon Sep 27 20:31:03 2010 (r213229) @@ -111,7 +111,7 @@ ip1000phy_attach(device_t dev) sc = &isc->mii_sc; ma = device_get_ivars(dev); sc->mii_dev = device_get_parent(dev); - mii = device_get_softc(sc->mii_dev); + mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); sc->mii_inst = mii->mii_instance; Modified: head/sys/dev/mii/jmphy.c ============================================================================== --- head/sys/dev/mii/jmphy.c Mon Sep 27 20:12:57 2010 (r213228) +++ head/sys/dev/mii/jmphy.c Mon Sep 27 20:31:03 2010 (r213229) @@ -109,7 +109,7 @@ jmphy_attach(device_t dev) sc = &jsc->mii_sc; ma = device_get_ivars(dev); sc->mii_dev = device_get_parent(dev); - mii = device_get_softc(sc->mii_dev); + mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); sc->mii_inst = mii->mii_instance; Modified: head/sys/dev/mii/lxtphy.c ============================================================================== --- head/sys/dev/mii/lxtphy.c Mon Sep 27 20:12:57 2010 (r213228) +++ head/sys/dev/mii/lxtphy.c Mon Sep 27 20:31:03 2010 (r213229) @@ -132,7 +132,7 @@ lxtphy_attach(device_t dev) sc = device_get_softc(dev); ma = device_get_ivars(dev); sc->mii_dev = device_get_parent(dev); - mii = device_get_softc(sc->mii_dev); + mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); sc->mii_inst = mii->mii_instance; Modified: head/sys/dev/mii/mii_physubr.c ============================================================================== --- head/sys/dev/mii/mii_physubr.c Mon Sep 27 20:12:57 2010 (r213228) +++ head/sys/dev/mii/mii_physubr.c Mon Sep 27 20:31:03 2010 (r213229) @@ -326,10 +326,9 @@ mii_anar(int media) void mii_add_media(struct mii_softc *sc) { + struct mii_data *mii = sc->mii_pdata; const char *sep = ""; - struct mii_data *mii; - mii = device_get_softc(sc->mii_dev); if ((sc->mii_capabilities & BMSR_MEDIAMASK) == 0) { printf("no media present"); return; Modified: head/sys/dev/mii/mlphy.c ============================================================================== --- head/sys/dev/mii/mlphy.c Mon Sep 27 20:12:57 2010 (r213228) +++ head/sys/dev/mii/mlphy.c Mon Sep 27 20:31:03 2010 (r213229) @@ -143,7 +143,7 @@ mlphy_attach(dev) sc = &msc->ml_mii; ma = device_get_ivars(dev); sc->mii_dev = device_get_parent(dev); - mii = device_get_softc(sc->mii_dev); + mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); sc->mii_inst = mii->mii_instance; Modified: head/sys/dev/mii/nsgphy.c ============================================================================== --- head/sys/dev/mii/nsgphy.c Mon Sep 27 20:12:57 2010 (r213228) +++ head/sys/dev/mii/nsgphy.c Mon Sep 27 20:31:03 2010 (r213229) @@ -126,7 +126,7 @@ nsgphy_attach(device_t dev) device_printf(dev, "\n", MII_REV(ma->mii_id2)); device_printf(dev, " "); sc->mii_dev = device_get_parent(dev); - mii = device_get_softc(sc->mii_dev); + mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); sc->mii_inst = mii->mii_instance; Modified: head/sys/dev/mii/nsphy.c ============================================================================== --- head/sys/dev/mii/nsphy.c Mon Sep 27 20:12:57 2010 (r213228) +++ head/sys/dev/mii/nsphy.c Mon Sep 27 20:31:03 2010 (r213229) @@ -130,7 +130,7 @@ nsphy_attach(device_t dev) sc = device_get_softc(dev); ma = device_get_ivars(dev); sc->mii_dev = device_get_parent(dev); - mii = device_get_softc(sc->mii_dev); + mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); sc->mii_inst = mii->mii_instance; Modified: head/sys/dev/mii/nsphyter.c ============================================================================== --- head/sys/dev/mii/nsphyter.c Mon Sep 27 20:12:57 2010 (r213228) +++ head/sys/dev/mii/nsphyter.c Mon Sep 27 20:31:03 2010 (r213229) @@ -135,7 +135,7 @@ nsphyter_attach(device_t dev) sc = device_get_softc(dev); ma = device_get_ivars(dev); sc->mii_dev = device_get_parent(dev); - mii = device_get_softc(sc->mii_dev); + mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); sc->mii_inst = mii->mii_instance; Modified: head/sys/dev/mii/pnaphy.c ============================================================================== --- head/sys/dev/mii/pnaphy.c Mon Sep 27 20:12:57 2010 (r213228) +++ head/sys/dev/mii/pnaphy.c Mon Sep 27 20:31:03 2010 (r213229) @@ -107,7 +107,7 @@ pnaphy_attach(device_t dev) sc = device_get_softc(dev); ma = device_get_ivars(dev); sc->mii_dev = device_get_parent(dev); - mii = device_get_softc(sc->mii_dev); + mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); sc->mii_inst = mii->mii_instance; Modified: head/sys/dev/mii/qsphy.c ============================================================================== --- head/sys/dev/mii/qsphy.c Mon Sep 27 20:12:57 2010 (r213228) +++ head/sys/dev/mii/qsphy.c Mon Sep 27 20:31:03 2010 (r213229) @@ -130,7 +130,7 @@ qsphy_attach(device_t dev) sc = device_get_softc(dev); ma = device_get_ivars(dev); sc->mii_dev = device_get_parent(dev); - mii = device_get_softc(sc->mii_dev); + mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); sc->mii_inst = mii->mii_instance; Modified: head/sys/dev/mii/rgephy.c ============================================================================== --- head/sys/dev/mii/rgephy.c Mon Sep 27 20:12:57 2010 (r213228) +++ head/sys/dev/mii/rgephy.c Mon Sep 27 20:31:03 2010 (r213229) @@ -119,7 +119,7 @@ rgephy_attach(device_t dev) sc = &rsc->mii_sc; ma = device_get_ivars(dev); sc->mii_dev = device_get_parent(dev); - mii = device_get_softc(sc->mii_dev); + mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); sc->mii_inst = mii->mii_instance; Modified: head/sys/dev/mii/rlphy.c ============================================================================== --- head/sys/dev/mii/rlphy.c Mon Sep 27 20:12:57 2010 (r213228) +++ head/sys/dev/mii/rlphy.c Mon Sep 27 20:31:03 2010 (r213229) @@ -129,7 +129,7 @@ rlphy_attach(device_t dev) sc = device_get_softc(dev); ma = device_get_ivars(dev); sc->mii_dev = device_get_parent(dev); - mii = device_get_softc(sc->mii_dev); + mii = ma->mii_data; /* * Check whether we're the RTL8201L PHY and remember so the status Modified: head/sys/dev/mii/rlswitch.c ============================================================================== --- head/sys/dev/mii/rlswitch.c Mon Sep 27 20:12:57 2010 (r213228) +++ head/sys/dev/mii/rlswitch.c Mon Sep 27 20:31:03 2010 (r213229) @@ -117,7 +117,7 @@ rlswitch_attach(device_t dev) sc = device_get_softc(dev); ma = device_get_ivars(dev); sc->mii_dev = device_get_parent(dev); - mii = device_get_softc(sc->mii_dev); + mii = ma->mii_data; /* * We handle all pseudo PHY in a single instance, so never allow Modified: head/sys/dev/mii/ruephy.c ============================================================================== --- head/sys/dev/mii/ruephy.c Mon Sep 27 20:12:57 2010 (r213228) +++ head/sys/dev/mii/ruephy.c Mon Sep 27 20:31:03 2010 (r213229) @@ -108,7 +108,7 @@ ruephy_attach(device_t dev) sc = device_get_softc(dev); ma = device_get_ivars(dev); sc->mii_dev = device_get_parent(dev); - mii = device_get_softc(sc->mii_dev); + mii = ma->mii_data; /* * The RealTek PHY can never be isolated, so never allow non-zero Modified: head/sys/dev/mii/smcphy.c ============================================================================== --- head/sys/dev/mii/smcphy.c Mon Sep 27 20:12:57 2010 (r213228) +++ head/sys/dev/mii/smcphy.c Mon Sep 27 20:31:03 2010 (r213229) @@ -102,7 +102,7 @@ smcphy_attach(device_t dev) sc = device_get_softc(dev); ma = device_get_ivars(dev); sc->mii_dev = device_get_parent(dev); - mii = device_get_softc(sc->mii_dev); + mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); sc->mii_inst = mii->mii_instance; Modified: head/sys/dev/mii/tdkphy.c ============================================================================== --- head/sys/dev/mii/tdkphy.c Mon Sep 27 20:12:57 2010 (r213228) +++ head/sys/dev/mii/tdkphy.c Mon Sep 27 20:31:03 2010 (r213229) @@ -108,7 +108,7 @@ tdkphy_attach(device_t dev) sc = device_get_softc(dev); ma = device_get_ivars(dev); sc->mii_dev = device_get_parent(dev); - mii = device_get_softc(sc->mii_dev); + mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); if (bootverbose) Modified: head/sys/dev/mii/truephy.c ============================================================================== --- head/sys/dev/mii/truephy.c Mon Sep 27 20:12:57 2010 (r213228) +++ head/sys/dev/mii/truephy.c Mon Sep 27 20:31:03 2010 (r213229) @@ -150,7 +150,7 @@ truephy_attach(device_t dev) if (sc->mii_anegticks == 0) sc->mii_anegticks = MII_ANEGTICKS; sc->mii_dev = device_get_parent(dev); - mii = device_get_softc(sc->mii_dev); + mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); sc->mii_inst = mii->mii_instance; Modified: head/sys/dev/mii/ukphy.c ============================================================================== --- head/sys/dev/mii/ukphy.c Mon Sep 27 20:12:57 2010 (r213228) +++ head/sys/dev/mii/ukphy.c Mon Sep 27 20:31:03 2010 (r213229) @@ -122,7 +122,7 @@ ukphy_attach(device_t dev) sc = device_get_softc(dev); ma = device_get_ivars(dev); sc->mii_dev = device_get_parent(dev); - mii = device_get_softc(sc->mii_dev); + mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); if (bootverbose) Modified: head/sys/dev/mii/xmphy.c ============================================================================== --- head/sys/dev/mii/xmphy.c Mon Sep 27 20:12:57 2010 (r213228) +++ head/sys/dev/mii/xmphy.c Mon Sep 27 20:31:03 2010 (r213229) @@ -107,7 +107,7 @@ xmphy_attach(device_t dev) sc = device_get_softc(dev); ma = device_get_ivars(dev); sc->mii_dev = device_get_parent(dev); - mii = device_get_softc(sc->mii_dev); + mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); sc->mii_inst = mii->mii_instance; From owner-svn-src-head@FreeBSD.ORG Mon Sep 27 20:35:40 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AF4BD106564A; Mon, 27 Sep 2010 20:35:40 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9E8AF8FC0C; Mon, 27 Sep 2010 20:35:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8RKZejr049222; Mon, 27 Sep 2010 20:35:40 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8RKZeQi049220; Mon, 27 Sep 2010 20:35:40 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201009272035.o8RKZeQi049220@svn.freebsd.org> From: Juli Mallett Date: Mon, 27 Sep 2010 20:35:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213230 - head/sys/mips/cavium X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Sep 2010 20:35:40 -0000 Author: jmallett Date: Mon Sep 27 20:35:40 2010 New Revision: 213230 URL: http://svn.freebsd.org/changeset/base/213230 Log: Give devices lots of time to settle around programming BARs and command registers. Without this, the settings do not seem to stick for Atheros NICs in the PCI slot of the Lanner MR-320. Modified: head/sys/mips/cavium/octopci.c Modified: head/sys/mips/cavium/octopci.c ============================================================================== --- head/sys/mips/cavium/octopci.c Mon Sep 27 20:31:03 2010 (r213229) +++ head/sys/mips/cavium/octopci.c Mon Sep 27 20:35:40 2010 (r213230) @@ -659,6 +659,8 @@ octopci_init_device(device_t dev, unsign command &= ~(PCIM_CMD_MEMEN | PCIM_CMD_PORTEN); octopci_write_config(dev, b, s, f, PCIR_COMMAND, command, 1); + DELAY(10000); + /* Program BARs. */ switch (hdrtype & PCIM_HDRTYPE) { case PCIM_HDRTYPE_NORMAL: @@ -685,6 +687,8 @@ octopci_init_device(device_t dev, unsign /* Enable whatever facilities the BARs require. */ octopci_write_config(dev, b, s, f, PCIR_COMMAND, command, 1); + DELAY(10000); + /* * Set cache line size. On Octeon it should be 128 bytes, * but according to Linux some Intel bridges have trouble From owner-svn-src-head@FreeBSD.ORG Mon Sep 27 21:10:37 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8C1DB1065670; Mon, 27 Sep 2010 21:10:37 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7B98C8FC12; Mon, 27 Sep 2010 21:10:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8RLAbTN049919; Mon, 27 Sep 2010 21:10:37 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8RLAbjE049917; Mon, 27 Sep 2010 21:10:37 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201009272110.o8RLAbjE049917@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Mon, 27 Sep 2010 21:10:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213231 - head/tools/regression/geom_eli X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Sep 2010 21:10:37 -0000 Author: pjd Date: Mon Sep 27 21:10:37 2010 New Revision: 213231 URL: http://svn.freebsd.org/changeset/base/213231 Log: Correct message. Pointed out by: jhb MFC after: 2 weeks Modified: head/tools/regression/geom_eli/resize.t Modified: head/tools/regression/geom_eli/resize.t ============================================================================== --- head/tools/regression/geom_eli/resize.t Mon Sep 27 20:35:40 2010 (r213230) +++ head/tools/regression/geom_eli/resize.t Mon Sep 27 21:10:37 2010 (r213231) @@ -125,7 +125,7 @@ geli detach ${md}a.eli # to geli init. gpart create -s GPT $md || echo -n "not " -echo ok $i - "Installed an GPT on ${md}" +echo ok $i - "Installed a GPT on ${md}" i=$((i + 1)) gpart add -s 20m -t freebsd-ufs -i 1 $md || echo -n "not " echo ok $i - "Added a 20m partition in slot 1" From owner-svn-src-head@FreeBSD.ORG Tue Sep 28 00:13:16 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 01A0E106566B; Tue, 28 Sep 2010 00:13:16 +0000 (UTC) (envelope-from jfv@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E411E8FC14; Tue, 28 Sep 2010 00:13:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8S0DFoA053797; Tue, 28 Sep 2010 00:13:15 GMT (envelope-from jfv@svn.freebsd.org) Received: (from jfv@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8S0DFuX053787; Tue, 28 Sep 2010 00:13:15 GMT (envelope-from jfv@svn.freebsd.org) Message-Id: <201009280013.o8S0DFuX053787@svn.freebsd.org> From: Jack F Vogel Date: Tue, 28 Sep 2010 00:13:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213234 - head/sys/dev/e1000 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2010 00:13:16 -0000 Author: jfv Date: Tue Sep 28 00:13:15 2010 New Revision: 213234 URL: http://svn.freebsd.org/changeset/base/213234 Log: Update code from Intel: - Sync shared code with Intel internal - New client chipset support added - em driver - fixes to 82574, limit queues to 1 but use MSIX - em driver - large changes in TX checksum offload and tso code, thanks to yongari. - some small changes for watchdog issues. - igb driver - local timer watchdog code was missing locking this and a couple other watchdog related fixes. - bug in rx discard found by Andrew Boyer, check for null pointer MFC: a week Modified: head/sys/dev/e1000/e1000_82571.c head/sys/dev/e1000/e1000_82571.h head/sys/dev/e1000/e1000_82575.c head/sys/dev/e1000/e1000_82575.h head/sys/dev/e1000/e1000_api.c head/sys/dev/e1000/e1000_api.h head/sys/dev/e1000/e1000_defines.h head/sys/dev/e1000/e1000_hw.h head/sys/dev/e1000/e1000_ich8lan.c head/sys/dev/e1000/e1000_ich8lan.h head/sys/dev/e1000/e1000_mac.c head/sys/dev/e1000/e1000_nvm.c head/sys/dev/e1000/e1000_nvm.h head/sys/dev/e1000/e1000_phy.c head/sys/dev/e1000/e1000_phy.h head/sys/dev/e1000/e1000_regs.h head/sys/dev/e1000/if_em.c head/sys/dev/e1000/if_em.h head/sys/dev/e1000/if_igb.c head/sys/dev/e1000/if_igb.h head/sys/dev/e1000/if_lem.c Modified: head/sys/dev/e1000/e1000_82571.c ============================================================================== --- head/sys/dev/e1000/e1000_82571.c Mon Sep 27 23:00:02 2010 (r213233) +++ head/sys/dev/e1000/e1000_82571.c Tue Sep 28 00:13:15 2010 (r213234) @@ -78,6 +78,10 @@ static s32 e1000_get_hw_semaphore_82571 static s32 e1000_fix_nvm_checksum_82571(struct e1000_hw *hw); static s32 e1000_get_phy_id_82571(struct e1000_hw *hw); static void e1000_put_hw_semaphore_82571(struct e1000_hw *hw); +static s32 e1000_get_hw_semaphore_82573(struct e1000_hw *hw); +static void e1000_put_hw_semaphore_82573(struct e1000_hw *hw); +static s32 e1000_get_hw_semaphore_82574(struct e1000_hw *hw); +static void e1000_put_hw_semaphore_82574(struct e1000_hw *hw); static void e1000_initialize_hw_bits_82571(struct e1000_hw *hw); static s32 e1000_write_nvm_eewr_82571(struct e1000_hw *hw, u16 offset, u16 words, u16 *data); @@ -91,6 +95,7 @@ static void e1000_power_down_phy_copper_ static s32 e1000_init_phy_params_82571(struct e1000_hw *hw) { struct e1000_phy_info *phy = &hw->phy; + struct e1000_dev_spec_82571 *dev_spec = &hw->dev_spec._82571; s32 ret_val = E1000_SUCCESS; DEBUGFUNC("e1000_init_phy_params_82571"); @@ -104,9 +109,7 @@ static s32 e1000_init_phy_params_82571(s phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT; phy->reset_delay_us = 100; - phy->ops.acquire = e1000_get_hw_semaphore_82571; phy->ops.check_reset_block = e1000_check_reset_block_generic; - phy->ops.release = e1000_put_hw_semaphore_82571; phy->ops.reset = e1000_phy_hw_reset_generic; phy->ops.set_d0_lplu_state = e1000_set_d0_lplu_state_82571; phy->ops.set_d3_lplu_state = e1000_set_d3_lplu_state_generic; @@ -124,6 +127,8 @@ static s32 e1000_init_phy_params_82571(s phy->ops.get_cable_length = e1000_get_cable_length_igp_2; phy->ops.read_reg = e1000_read_phy_reg_igp; phy->ops.write_reg = e1000_write_phy_reg_igp; + phy->ops.acquire = e1000_get_hw_semaphore_82571; + phy->ops.release = e1000_put_hw_semaphore_82571; /* This uses above function pointers */ ret_val = e1000_get_phy_id_82571(hw); @@ -145,6 +150,8 @@ static s32 e1000_init_phy_params_82571(s phy->ops.get_cable_length = e1000_get_cable_length_m88; phy->ops.read_reg = e1000_read_phy_reg_m88; phy->ops.write_reg = e1000_write_phy_reg_m88; + phy->ops.acquire = e1000_get_hw_semaphore_82571; + phy->ops.release = e1000_put_hw_semaphore_82571; /* This uses above function pointers */ ret_val = e1000_get_phy_id_82571(hw); @@ -158,6 +165,8 @@ static s32 e1000_init_phy_params_82571(s break; case e1000_82574: case e1000_82583: + E1000_MUTEX_INIT(&dev_spec->swflag_mutex); + phy->type = e1000_phy_bm; phy->ops.get_cfg_done = e1000_get_cfg_done_generic; phy->ops.get_info = e1000_get_phy_info_m88; @@ -167,6 +176,8 @@ static s32 e1000_init_phy_params_82571(s phy->ops.get_cable_length = e1000_get_cable_length_m88; phy->ops.read_reg = e1000_read_phy_reg_bm2; phy->ops.write_reg = e1000_write_phy_reg_bm2; + phy->ops.acquire = e1000_get_hw_semaphore_82574; + phy->ops.release = e1000_put_hw_semaphore_82574; /* This uses above function pointers */ ret_val = e1000_get_phy_id_82571(hw); @@ -250,9 +261,18 @@ static s32 e1000_init_nvm_params_82571(s } /* Function Pointers */ - nvm->ops.acquire = e1000_acquire_nvm_82571; + switch (hw->mac.type) { + case e1000_82574: + case e1000_82583: + nvm->ops.acquire = e1000_get_hw_semaphore_82574; + nvm->ops.release = e1000_put_hw_semaphore_82574; + break; + default: + nvm->ops.acquire = e1000_acquire_nvm_82571; + nvm->ops.release = e1000_release_nvm_82571; + break; + } nvm->ops.read = e1000_read_nvm_eerd; - nvm->ops.release = e1000_release_nvm_82571; nvm->ops.update = e1000_update_nvm_checksum_82571; nvm->ops.validate = e1000_validate_nvm_checksum_82571; nvm->ops.valid_led_default = e1000_valid_led_default_82571; @@ -578,6 +598,96 @@ static void e1000_put_hw_semaphore_82571 } /** + * e1000_get_hw_semaphore_82573 - Acquire hardware semaphore + * @hw: pointer to the HW structure + * + * Acquire the HW semaphore during reset. + * + **/ +static s32 e1000_get_hw_semaphore_82573(struct e1000_hw *hw) +{ + u32 extcnf_ctrl; + s32 ret_val = E1000_SUCCESS; + s32 i = 0; + + DEBUGFUNC("e1000_get_hw_semaphore_82573"); + + extcnf_ctrl = E1000_READ_REG(hw, E1000_EXTCNF_CTRL); + extcnf_ctrl |= E1000_EXTCNF_CTRL_MDIO_SW_OWNERSHIP; + do { + E1000_WRITE_REG(hw, E1000_EXTCNF_CTRL, extcnf_ctrl); + extcnf_ctrl = E1000_READ_REG(hw, E1000_EXTCNF_CTRL); + + if (extcnf_ctrl & E1000_EXTCNF_CTRL_MDIO_SW_OWNERSHIP) + break; + + extcnf_ctrl |= E1000_EXTCNF_CTRL_MDIO_SW_OWNERSHIP; + + msec_delay(2); + i++; + } while (i < MDIO_OWNERSHIP_TIMEOUT); + + if (i == MDIO_OWNERSHIP_TIMEOUT) { + /* Release semaphores */ + e1000_put_hw_semaphore_82573(hw); + DEBUGOUT("Driver can't access the PHY\n"); + ret_val = -E1000_ERR_PHY; + goto out; + } + +out: + return ret_val; +} + +/** + * e1000_put_hw_semaphore_82573 - Release hardware semaphore + * @hw: pointer to the HW structure + * + * Release hardware semaphore used during reset. + * + **/ +static void e1000_put_hw_semaphore_82573(struct e1000_hw *hw) +{ + u32 extcnf_ctrl; + + DEBUGFUNC("e1000_put_hw_semaphore_82573"); + + extcnf_ctrl = E1000_READ_REG(hw, E1000_EXTCNF_CTRL); + extcnf_ctrl &= ~E1000_EXTCNF_CTRL_MDIO_SW_OWNERSHIP; + E1000_WRITE_REG(hw, E1000_EXTCNF_CTRL, extcnf_ctrl); +} + +/** + * e1000_get_hw_semaphore_82574 - Acquire hardware semaphore + * @hw: pointer to the HW structure + * + * Acquire the HW semaphore to access the PHY or NVM. + * + **/ +static s32 e1000_get_hw_semaphore_82574(struct e1000_hw *hw) +{ + DEBUGFUNC("e1000_get_hw_semaphore_82574"); + + E1000_MUTEX_LOCK(&hw->dev_spec._82571.swflag_mutex); + return e1000_get_hw_semaphore_82573(hw); +} + +/** + * e1000_put_hw_semaphore_82574 - Release hardware semaphore + * @hw: pointer to the HW structure + * + * Release hardware semaphore used to access the PHY or NVM + * + **/ +static void e1000_put_hw_semaphore_82574(struct e1000_hw *hw) +{ + DEBUGFUNC("e1000_put_hw_semaphore_82574"); + + e1000_put_hw_semaphore_82573(hw); + E1000_MUTEX_UNLOCK(&hw->dev_spec._82571.swflag_mutex); +} + +/** * e1000_acquire_nvm_82571 - Request for access to the EEPROM * @hw: pointer to the HW structure * @@ -598,8 +708,6 @@ static s32 e1000_acquire_nvm_82571(struc switch (hw->mac.type) { case e1000_82573: - case e1000_82574: - case e1000_82583: break; default: ret_val = e1000_acquire_nvm_generic(hw); @@ -926,9 +1034,8 @@ out: **/ static s32 e1000_reset_hw_82571(struct e1000_hw *hw) { - u32 ctrl, extcnf_ctrl, ctrl_ext, icr; + u32 ctrl, ctrl_ext, icr; s32 ret_val; - u16 i = 0; DEBUGFUNC("e1000_reset_hw_82571"); @@ -955,33 +1062,33 @@ static s32 e1000_reset_hw_82571(struct e */ switch (hw->mac.type) { case e1000_82573: + ret_val = e1000_get_hw_semaphore_82573(hw); + break; case e1000_82574: case e1000_82583: - extcnf_ctrl = E1000_READ_REG(hw, E1000_EXTCNF_CTRL); - extcnf_ctrl |= E1000_EXTCNF_CTRL_MDIO_SW_OWNERSHIP; - - do { - E1000_WRITE_REG(hw, E1000_EXTCNF_CTRL, extcnf_ctrl); - extcnf_ctrl = E1000_READ_REG(hw, E1000_EXTCNF_CTRL); - - if (extcnf_ctrl & E1000_EXTCNF_CTRL_MDIO_SW_OWNERSHIP) - break; - - extcnf_ctrl |= E1000_EXTCNF_CTRL_MDIO_SW_OWNERSHIP; - - msec_delay(2); - i++; - } while (i < MDIO_OWNERSHIP_TIMEOUT); + ret_val = e1000_get_hw_semaphore_82574(hw); break; default: break; } + if (ret_val) + DEBUGOUT("Cannot acquire MDIO ownership\n"); ctrl = E1000_READ_REG(hw, E1000_CTRL); DEBUGOUT("Issuing a global reset to MAC\n"); E1000_WRITE_REG(hw, E1000_CTRL, ctrl | E1000_CTRL_RST); + /* Must release MDIO ownership and mutex after MAC reset. */ + switch (hw->mac.type) { + case e1000_82574: + case e1000_82583: + e1000_put_hw_semaphore_82574(hw); + break; + default: + break; + } + if (hw->nvm.type == e1000_nvm_flash_hw) { usec_delay(10); ctrl_ext = E1000_READ_REG(hw, E1000_CTRL_EXT); @@ -1015,12 +1122,14 @@ static s32 e1000_reset_hw_82571(struct e E1000_WRITE_REG(hw, E1000_IMC, 0xffffffff); icr = E1000_READ_REG(hw, E1000_ICR); - /* Install any alternate MAC address into RAR0 */ - ret_val = e1000_check_alt_mac_addr_generic(hw); - if (ret_val) - goto out; + if (hw->mac.type == e1000_82571) { + /* Install any alternate MAC address into RAR0 */ + ret_val = e1000_check_alt_mac_addr_generic(hw); + if (ret_val) + goto out; - e1000_set_laa_state_82571(hw, TRUE); + e1000_set_laa_state_82571(hw, TRUE); + } /* Reinitialize the 82571 serdes link state machine */ if (hw->phy.media_type == e1000_media_type_internal_serdes) @@ -1330,6 +1439,42 @@ static s32 e1000_led_on_82574(struct e10 return E1000_SUCCESS; } +/** + * e1000_check_phy_82574 - check 82574 phy hung state + * @hw: pointer to the HW structure + * + * Returns whether phy is hung or not + **/ +bool e1000_check_phy_82574(struct e1000_hw *hw) +{ + u16 status_1kbt = 0; + u16 receive_errors = 0; + bool phy_hung = FALSE; + s32 ret_val = E1000_SUCCESS; + + DEBUGFUNC("e1000_check_phy_82574"); + + /* + * Read PHY Receive Error counter first, if its is max - all F's then + * read the Base1000T status register If both are max then PHY is hung. + */ + ret_val = hw->phy.ops.read_reg(hw, E1000_RECEIVE_ERROR_COUNTER, + &receive_errors); + if (ret_val) + goto out; + if (receive_errors == E1000_RECEIVE_ERROR_MAX) { + ret_val = hw->phy.ops.read_reg(hw, E1000_BASE1000T_STATUS, + &status_1kbt); + if (ret_val) + goto out; + if ((status_1kbt & E1000_IDLE_ERROR_COUNT_MASK) == + E1000_IDLE_ERROR_COUNT_MASK) + phy_hung = TRUE; + } +out: + return phy_hung; +} + /** * e1000_setup_link_82571 - Setup flow control and link settings @@ -1460,6 +1605,8 @@ static s32 e1000_check_for_serdes_link_8 u32 rxcw; u32 ctrl; u32 status; + u32 txcw; + u32 i; s32 ret_val = E1000_SUCCESS; DEBUGFUNC("e1000_check_for_serdes_link_82571"); @@ -1482,8 +1629,10 @@ static s32 e1000_check_for_serdes_link_8 e1000_serdes_link_autoneg_progress; mac->serdes_has_link = FALSE; DEBUGOUT("AN_UP -> AN_PROG\n"); + } else { + mac->serdes_has_link = TRUE; } - break; + break; case e1000_serdes_link_forced_up: /* @@ -1491,8 +1640,10 @@ static s32 e1000_check_for_serdes_link_8 * auto-negotiation in the TXCW register and disable * forced link in the Device Control register in an * attempt to auto-negotiate with our link partner. + * If the partner code word is null, stop forcing + * and restart auto negotiation. */ - if (rxcw & E1000_RXCW_C) { + if ((rxcw & E1000_RXCW_C) || !(rxcw & E1000_RXCW_CW)) { /* Enable autoneg, and unforce link up */ E1000_WRITE_REG(hw, E1000_TXCW, mac->txcw); E1000_WRITE_REG(hw, E1000_CTRL, @@ -1501,6 +1652,8 @@ static s32 e1000_check_for_serdes_link_8 e1000_serdes_link_autoneg_progress; mac->serdes_has_link = FALSE; DEBUGOUT("FORCED_UP -> AN_PROG\n"); + } else { + mac->serdes_has_link = TRUE; } break; @@ -1559,6 +1712,7 @@ static s32 e1000_check_for_serdes_link_8 (ctrl & ~E1000_CTRL_SLU)); mac->serdes_link_state = e1000_serdes_link_autoneg_progress; + mac->serdes_has_link = FALSE; DEBUGOUT("DOWN -> AN_PROG\n"); break; } @@ -1569,16 +1723,32 @@ static s32 e1000_check_for_serdes_link_8 DEBUGOUT("ANYSTATE -> DOWN\n"); } else { /* - * We have sync, and can tolerate one invalid (IV) - * codeword before declaring link down, so reread - * to look again. + * Check several times, if Sync and Config + * both are consistently 1 then simply ignore + * the Invalid bit and restart Autoneg */ - usec_delay(10); - rxcw = E1000_READ_REG(hw, E1000_RXCW); - if (rxcw & E1000_RXCW_IV) { - mac->serdes_link_state = e1000_serdes_link_down; + for (i = 0; i < AN_RETRY_COUNT; i++) { + usec_delay(10); + rxcw = E1000_READ_REG(hw, E1000_RXCW); + if ((rxcw & E1000_RXCW_IV) && + !((rxcw & E1000_RXCW_SYNCH) && + (rxcw & E1000_RXCW_C))) { + mac->serdes_has_link = FALSE; + mac->serdes_link_state = + e1000_serdes_link_down; + DEBUGOUT("ANYSTATE -> DOWN\n"); + break; + } + } + + if (i == AN_RETRY_COUNT) { + txcw = E1000_READ_REG(hw, E1000_TXCW); + txcw |= E1000_TXCW_ANE; + E1000_WRITE_REG(hw, E1000_TXCW, txcw); + mac->serdes_link_state = + e1000_serdes_link_autoneg_progress; mac->serdes_has_link = FALSE; - DEBUGOUT("ANYSTATE -> DOWN\n"); + DEBUGOUT("ANYSTATE -> AN_PROG\n"); } } } @@ -1736,14 +1906,16 @@ static s32 e1000_read_mac_addr_82571(str DEBUGFUNC("e1000_read_mac_addr_82571"); - /* - * If there's an alternate MAC address place it in RAR0 - * so that it will override the Si installed default perm - * address. - */ - ret_val = e1000_check_alt_mac_addr_generic(hw); - if (ret_val) - goto out; + if (hw->mac.type == e1000_82571) { + /* + * If there's an alternate MAC address place it in RAR0 + * so that it will override the Si installed default perm + * address. + */ + ret_val = e1000_check_alt_mac_addr_generic(hw); + if (ret_val) + goto out; + } ret_val = e1000_read_mac_addr_generic(hw); Modified: head/sys/dev/e1000/e1000_82571.h ============================================================================== --- head/sys/dev/e1000/e1000_82571.h Mon Sep 27 23:00:02 2010 (r213233) +++ head/sys/dev/e1000/e1000_82571.h Tue Sep 28 00:13:15 2010 (r213234) @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2008, Intel Corporation + Copyright (c) 2001-2010, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -42,6 +42,7 @@ (ID_LED_DEF1_DEF2)) #define E1000_GCR_L1_ACT_WITHOUT_L0S_RX 0x08000000 +#define AN_RETRY_COUNT 5 /* Autoneg Retry Count value */ /* Intr Throttling - RW */ #define E1000_EITR_82574(_n) (0x000E8 + (0x4 * (_n))) @@ -53,6 +54,11 @@ #define E1000_RXCFGL 0x0B634 /* TimeSync Rx EtherType & Msg Type Reg - RW */ +#define E1000_BASE1000T_STATUS 10 +#define E1000_IDLE_ERROR_COUNT_MASK 0xFF +#define E1000_RECEIVE_ERROR_COUNTER 21 +#define E1000_RECEIVE_ERROR_MAX 0xFFFF +bool e1000_check_phy_82574(struct e1000_hw *hw); bool e1000_get_laa_state_82571(struct e1000_hw *hw); void e1000_set_laa_state_82571(struct e1000_hw *hw, bool state); Modified: head/sys/dev/e1000/e1000_82575.c ============================================================================== --- head/sys/dev/e1000/e1000_82575.c Mon Sep 27 23:00:02 2010 (r213233) +++ head/sys/dev/e1000/e1000_82575.c Tue Sep 28 00:13:15 2010 (r213234) @@ -85,6 +85,7 @@ static void e1000_power_down_phy_copper_ static void e1000_shutdown_serdes_link_82575(struct e1000_hw *hw); static void e1000_power_up_serdes_link_82575(struct e1000_hw *hw); static s32 e1000_set_pcie_completion_timeout(struct e1000_hw *hw); +static s32 e1000_reset_mdicnfg_82580(struct e1000_hw *hw); static const u16 e1000_82580_rxpbs_table[] = { 36, 72, 144, 1, 2, 4, 8, 16, @@ -92,6 +93,37 @@ static const u16 e1000_82580_rxpbs_table #define E1000_82580_RXPBS_TABLE_SIZE \ (sizeof(e1000_82580_rxpbs_table)/sizeof(u16)) + +/** + * e1000_sgmii_uses_mdio_82575 - Determine if I2C pins are for external MDIO + * @hw: pointer to the HW structure + * + * Called to determine if the I2C pins are being used for I2C or as an + * external MDIO interface since the two options are mutually exclusive. + **/ +static bool e1000_sgmii_uses_mdio_82575(struct e1000_hw *hw) +{ + u32 reg = 0; + bool ext_mdio = FALSE; + + DEBUGFUNC("e1000_sgmii_uses_mdio_82575"); + + switch (hw->mac.type) { + case e1000_82575: + case e1000_82576: + reg = E1000_READ_REG(hw, E1000_MDIC); + ext_mdio = !!(reg & E1000_MDIC_DEST); + break; + case e1000_82580: + reg = E1000_READ_REG(hw, E1000_MDICNFG); + ext_mdio = !!(reg & E1000_MDICNFG_EXT_MDIO); + break; + default: + break; + } + return ext_mdio; +} + /** * e1000_init_phy_params_82575 - Init PHY func ptrs. * @hw: pointer to the HW structure @@ -100,6 +132,7 @@ static s32 e1000_init_phy_params_82575(s { struct e1000_phy_info *phy = &hw->phy; s32 ret_val = E1000_SUCCESS; + u32 ctrl_ext; DEBUGFUNC("e1000_init_phy_params_82575"); @@ -120,16 +153,26 @@ static s32 e1000_init_phy_params_82575(s phy->ops.get_cfg_done = e1000_get_cfg_done_82575; phy->ops.release = e1000_release_phy_82575; + ctrl_ext = E1000_READ_REG(hw, E1000_CTRL_EXT); + if (e1000_sgmii_active_82575(hw)) { phy->ops.reset = e1000_phy_hw_reset_sgmii_82575; + ctrl_ext |= E1000_CTRL_I2C_ENA; + } else { + phy->ops.reset = e1000_phy_hw_reset_generic; + ctrl_ext &= ~E1000_CTRL_I2C_ENA; + } + + E1000_WRITE_REG(hw, E1000_CTRL_EXT, ctrl_ext); + e1000_reset_mdicnfg_82580(hw); + + if (e1000_sgmii_active_82575(hw) && !e1000_sgmii_uses_mdio_82575(hw)) { phy->ops.read_reg = e1000_read_phy_reg_sgmii_82575; phy->ops.write_reg = e1000_write_phy_reg_sgmii_82575; } else if (hw->mac.type >= e1000_82580) { - phy->ops.reset = e1000_phy_hw_reset_generic; phy->ops.read_reg = e1000_read_phy_reg_82580; phy->ops.write_reg = e1000_write_phy_reg_82580; } else { - phy->ops.reset = e1000_phy_hw_reset_generic; phy->ops.read_reg = e1000_read_phy_reg_igp; phy->ops.write_reg = e1000_write_phy_reg_igp; } @@ -256,27 +299,15 @@ static s32 e1000_init_mac_params_82575(s switch (ctrl_ext & E1000_CTRL_EXT_LINK_MODE_MASK) { case E1000_CTRL_EXT_LINK_MODE_SGMII: dev_spec->sgmii_active = TRUE; - ctrl_ext |= E1000_CTRL_I2C_ENA; break; case E1000_CTRL_EXT_LINK_MODE_1000BASE_KX: case E1000_CTRL_EXT_LINK_MODE_PCIE_SERDES: hw->phy.media_type = e1000_media_type_internal_serdes; - ctrl_ext |= E1000_CTRL_I2C_ENA; break; default: - ctrl_ext &= ~E1000_CTRL_I2C_ENA; break; } - E1000_WRITE_REG(hw, E1000_CTRL_EXT, ctrl_ext); - - /* - * if using i2c make certain the MDICNFG register is cleared to prevent - * communications from being misrouted to the mdic registers - */ - if ((ctrl_ext & E1000_CTRL_I2C_ENA) && (hw->mac.type == e1000_82580)) - E1000_WRITE_REG(hw, E1000_MDICNFG, 0); - /* Set mta register count */ mac->mta_reg_count = 128; /* Set uta register count */ @@ -367,6 +398,7 @@ void e1000_init_function_pointers_82575( hw->mac.ops.init_params = e1000_init_mac_params_82575; hw->nvm.ops.init_params = e1000_init_nvm_params_82575; hw->phy.ops.init_params = e1000_init_phy_params_82575; + hw->mbx.ops.init_params = e1000_init_mbx_params_pf; } /** @@ -492,6 +524,7 @@ static s32 e1000_get_phy_id_82575(struct s32 ret_val = E1000_SUCCESS; u16 phy_id; u32 ctrl_ext; + u32 mdic; DEBUGFUNC("e1000_get_phy_id_82575"); @@ -508,6 +541,28 @@ static s32 e1000_get_phy_id_82575(struct goto out; } + if (e1000_sgmii_uses_mdio_82575(hw)) { + switch (hw->mac.type) { + case e1000_82575: + case e1000_82576: + mdic = E1000_READ_REG(hw, E1000_MDIC); + mdic &= E1000_MDIC_PHY_MASK; + phy->addr = mdic >> E1000_MDIC_PHY_SHIFT; + break; + case e1000_82580: + mdic = E1000_READ_REG(hw, E1000_MDICNFG); + mdic &= E1000_MDICNFG_PHY_MASK; + phy->addr = mdic >> E1000_MDICNFG_PHY_SHIFT; + break; + default: + ret_val = -E1000_ERR_PHY; + goto out; + break; + } + ret_val = e1000_get_phy_id(hw); + goto out; + } + /* Power on sgmii phy if it is disabled */ ctrl_ext = E1000_READ_REG(hw, E1000_CTRL_EXT); E1000_WRITE_REG(hw, E1000_CTRL_EXT, @@ -1243,6 +1298,7 @@ static s32 e1000_setup_serdes_link_82575 case E1000_CTRL_EXT_LINK_MODE_1000BASE_KX: /* disable PCS autoneg and support parallel detect only */ pcs_autoneg = FALSE; + /* fall through to default case */ default: /* * non-SGMII modes only supports a speed of 1000/Full for the @@ -1638,6 +1694,39 @@ out: return ret_val; } + +/** + * e1000_vmdq_set_anti_spoofing_pf - enable or disable anti-spoofing + * @hw: pointer to the hardware struct + * @enable: state to enter, either enabled or disabled + * @pf: Physical Function pool - do not set anti-spoofing for the PF + * + * enables/disables L2 switch anti-spoofing functionality. + **/ +void e1000_vmdq_set_anti_spoofing_pf(struct e1000_hw *hw, bool enable, int pf) +{ + u32 dtxswc; + + switch (hw->mac.type) { + case e1000_82576: + dtxswc = E1000_READ_REG(hw, E1000_DTXSWC); + if (enable) { + dtxswc |= (E1000_DTXSWC_MAC_SPOOF_MASK | + E1000_DTXSWC_VLAN_SPOOF_MASK); + /* The PF can spoof - it has to in order to + * support emulation mode NICs */ + dtxswc ^= (1 << pf | 1 << (pf + MAX_NUM_VFS)); + } else { + dtxswc &= ~(E1000_DTXSWC_MAC_SPOOF_MASK | + E1000_DTXSWC_VLAN_SPOOF_MASK); + } + E1000_WRITE_REG(hw, E1000_DTXSWC, dtxswc); + break; + default: + break; + } +} + /** * e1000_vmdq_set_loopback_pf - enable or disable vmdq loopback * @hw: pointer to the hardware struct @@ -1739,6 +1828,45 @@ out: } /** + * e1000_reset_mdicnfg_82580 - Reset MDICNFG destination and com_mdio bits + * @hw: pointer to the HW structure + * + * This resets the the MDICNFG.Destination and MDICNFG.Com_MDIO bits based on + * the values found in the EEPROM. This addresses an issue in which these + * bits are not restored from EEPROM after reset. + **/ +static s32 e1000_reset_mdicnfg_82580(struct e1000_hw *hw) +{ + s32 ret_val = E1000_SUCCESS; + u32 mdicnfg; + u16 nvm_data; + + DEBUGFUNC("e1000_reset_mdicnfg_82580"); + + if (hw->mac.type != e1000_82580) + goto out; + if (!e1000_sgmii_active_82575(hw)) + goto out; + + ret_val = hw->nvm.ops.read(hw, NVM_INIT_CONTROL3_PORT_A + + NVM_82580_LAN_FUNC_OFFSET(hw->bus.func), 1, + &nvm_data); + if (ret_val) { + DEBUGOUT("NVM Read Error\n"); + goto out; + } + + mdicnfg = E1000_READ_REG(hw, E1000_MDICNFG); + if (nvm_data & NVM_WORD24_EXT_MDIO) + mdicnfg |= E1000_MDICNFG_EXT_MDIO; + if (nvm_data & NVM_WORD24_COM_MDIO) + mdicnfg |= E1000_MDICNFG_COM_MDIO; + E1000_WRITE_REG(hw, E1000_MDICNFG, mdicnfg); +out: + return ret_val; +} + +/** * e1000_reset_hw_82580 - Reset hardware * @hw: pointer to the HW structure * @@ -1814,6 +1942,10 @@ static s32 e1000_reset_hw_82580(struct e E1000_WRITE_REG(hw, E1000_IMC, 0xffffffff); icr = E1000_READ_REG(hw, E1000_ICR); + ret_val = e1000_reset_mdicnfg_82580(hw); + if (ret_val) + DEBUGOUT("Could not reset MDICNFG based on EEPROM\n"); + /* Install any alternate MAC address into RAR0 */ ret_val = e1000_check_alt_mac_addr_generic(hw); Modified: head/sys/dev/e1000/e1000_82575.h ============================================================================== --- head/sys/dev/e1000/e1000_82575.h Mon Sep 27 23:00:02 2010 (r213233) +++ head/sys/dev/e1000/e1000_82575.h Tue Sep 28 00:13:15 2010 (r213234) @@ -458,6 +458,7 @@ struct e1000_adv_tx_context_desc { /* RX packet buffer size defines */ #define E1000_RXPBS_SIZE_MASK_82576 0x0000007F void e1000_vmdq_set_loopback_pf(struct e1000_hw *hw, bool enable); +void e1000_vmdq_set_anti_spoofing_pf(struct e1000_hw *hw, bool enable, int pf); void e1000_vmdq_set_replication_pf(struct e1000_hw *hw, bool enable); enum e1000_promisc_type { e1000_promisc_disabled = 0, /* all promisc modes disabled */ Modified: head/sys/dev/e1000/e1000_api.c ============================================================================== --- head/sys/dev/e1000/e1000_api.c Mon Sep 27 23:00:02 2010 (r213233) +++ head/sys/dev/e1000/e1000_api.c Tue Sep 28 00:13:15 2010 (r213234) @@ -276,6 +276,8 @@ s32 e1000_set_mac_type(struct e1000_hw * break; case E1000_DEV_ID_ICH10_D_BM_LM: case E1000_DEV_ID_ICH10_D_BM_LF: + case E1000_DEV_ID_ICH10_D_BM_V: + case E1000_DEV_ID_ICH10_HANKSVILLE: mac->type = e1000_ich10lan; break; case E1000_DEV_ID_PCH_D_HV_DM: @@ -284,6 +286,10 @@ s32 e1000_set_mac_type(struct e1000_hw * case E1000_DEV_ID_PCH_M_HV_LC: mac->type = e1000_pchlan; break; + case E1000_DEV_ID_PCH2_LV_LM: + case E1000_DEV_ID_PCH2_LV_V: + mac->type = e1000_pch2lan; + break; case E1000_DEV_ID_82575EB_COPPER: case E1000_DEV_ID_82575EB_FIBER_SERDES: case E1000_DEV_ID_82575GB_QUAD_COPPER: @@ -294,6 +300,7 @@ s32 e1000_set_mac_type(struct e1000_hw * case E1000_DEV_ID_82576_FIBER: case E1000_DEV_ID_82576_SERDES: case E1000_DEV_ID_82576_QUAD_COPPER: + case E1000_DEV_ID_82576_QUAD_COPPER_ET2: case E1000_DEV_ID_82576_NS: case E1000_DEV_ID_82576_NS_SERDES: case E1000_DEV_ID_82576_SERDES_QUAD: @@ -304,6 +311,7 @@ s32 e1000_set_mac_type(struct e1000_hw * case E1000_DEV_ID_82580_SERDES: case E1000_DEV_ID_82580_SGMII: case E1000_DEV_ID_82580_COPPER_DUAL: + case E1000_DEV_ID_82580_QUAD_FIBER: mac->type = e1000_82580; break; case E1000_DEV_ID_82576_VF: @@ -396,6 +404,7 @@ s32 e1000_setup_init_funcs(struct e1000_ case e1000_ich9lan: case e1000_ich10lan: case e1000_pchlan: + case e1000_pch2lan: e1000_init_function_pointers_ich8lan(hw); break; case e1000_82575: @@ -1131,6 +1140,37 @@ s32 e1000_read_mac_addr(struct e1000_hw } /** + * e1000_read_pba_string - Read device part number string + * @hw: pointer to the HW structure + * @pba_num: pointer to device part number + * @pba_num_size: size of part number buffer + * + * Reads the product board assembly (PBA) number from the EEPROM and stores + * the value in pba_num. + * Currently no func pointer exists and all implementations are handled in the + * generic version of this function. + **/ +s32 e1000_read_pba_string(struct e1000_hw *hw, u8 *pba_num, u32 pba_num_size) +{ + return e1000_read_pba_string_generic(hw, pba_num, pba_num_size); +} + +/** + * e1000_read_pba_length - Read device part number string length + * @hw: pointer to the HW structure + * @pba_num_size: size of part number buffer + * + * Reads the product board assembly (PBA) number length from the EEPROM and + * stores the value in pba_num. + * Currently no func pointer exists and all implementations are handled in the + * generic version of this function. + **/ +s32 e1000_read_pba_length(struct e1000_hw *hw, u32 *pba_num_size) +{ + return e1000_read_pba_length_generic(hw, pba_num_size); +} + +/** * e1000_read_pba_num - Read device part number * @hw: pointer to the HW structure * @pba_num: pointer to device part number Modified: head/sys/dev/e1000/e1000_api.h ============================================================================== --- head/sys/dev/e1000/e1000_api.h Mon Sep 27 23:00:02 2010 (r213233) +++ head/sys/dev/e1000/e1000_api.h Tue Sep 28 00:13:15 2010 (r213234) @@ -97,6 +97,9 @@ void e1000_power_up_phy(struct e1000_hw void e1000_power_down_phy(struct e1000_hw *hw); s32 e1000_read_mac_addr(struct e1000_hw *hw); s32 e1000_read_pba_num(struct e1000_hw *hw, u32 *part_num); +s32 e1000_read_pba_string(struct e1000_hw *hw, u8 *pba_num, + u32 pba_num_size); +s32 e1000_read_pba_length(struct e1000_hw *hw, u32 *pba_num_size); void e1000_reload_nvm(struct e1000_hw *hw); s32 e1000_update_nvm_checksum(struct e1000_hw *hw); s32 e1000_validate_nvm_checksum(struct e1000_hw *hw); Modified: head/sys/dev/e1000/e1000_defines.h ============================================================================== --- head/sys/dev/e1000/e1000_defines.h Mon Sep 27 23:00:02 2010 (r213233) +++ head/sys/dev/e1000/e1000_defines.h Tue Sep 28 00:13:15 2010 (r213234) @@ -49,6 +49,8 @@ #define E1000_WUC_LSCWO 0x00000020 /* Link Status wake up override */ #define E1000_WUC_SPM 0x80000000 /* Enable SPM */ #define E1000_WUC_PHY_WAKE 0x00000100 /* if PHY supports wakeup */ +#define E1000_WUC_FLX6_PHY 0x4000 /* Flexible Filter 6 Enable */ +#define E1000_WUC_FLX7_PHY 0x8000 /* Flexible Filter 7 Enable */ /* Wake Up Filter Control */ #define E1000_WUFC_LNKC 0x00000001 /* Link Status Change Wakeup Enable */ @@ -73,6 +75,8 @@ #define E1000_WUFC_FLX3 0x00080000 /* Flexible Filter 3 Enable */ #define E1000_WUFC_FLX4 0x00100000 /* Flexible Filter 4 Enable */ #define E1000_WUFC_FLX5 0x00200000 /* Flexible Filter 5 Enable */ +#define E1000_WUFC_FLX6 0x00400000 /* Flexible Filter 6 Enable */ +#define E1000_WUFC_FLX7 0x00800000 /* Flexible Filter 7 Enable */ #define E1000_WUFC_ALL_FILTERS_PHY_4 0x0000F0FF /*Mask for all wakeup filters*/ #define E1000_WUFC_FLX_OFFSET_PHY 12 /* Offset to the Flexible Filters bits */ #define E1000_WUFC_FLX_FILTERS_PHY_4 0x0000F000 /*Mask for 4 flexible filters*/ @@ -80,9 +84,11 @@ #define E1000_WUFC_FLX_FILTERS_PHY_6 0x0000F600 /*Mask for 6 flexible filters*/ #define E1000_WUFC_ALL_FILTERS 0x000F00FF /* Mask for all wakeup filters */ #define E1000_WUFC_ALL_FILTERS_6 0x003F00FF /* Mask for all 6 wakeup filters*/ +#define E1000_WUFC_ALL_FILTERS_8 0x00FF00FF /* Mask for all 8 wakeup filters*/ #define E1000_WUFC_FLX_OFFSET 16 /* Offset to the Flexible Filters bits */ #define E1000_WUFC_FLX_FILTERS 0x000F0000 /*Mask for the 4 flexible filters */ #define E1000_WUFC_FLX_FILTERS_6 0x003F0000 /* Mask for 6 flexible filters */ +#define E1000_WUFC_FLX_FILTERS_8 0x00FF0000 /* Mask for 8 flexible filters */ /* * For 82576 to utilize Extended filter masks in addition to * existing (filter) masks @@ -109,10 +115,15 @@ #define E1000_WUS_FLX3 E1000_WUFC_FLX3 #define E1000_WUS_FLX4 E1000_WUFC_FLX4 #define E1000_WUS_FLX5 E1000_WUFC_FLX5 +#define E1000_WUS_FLX6 E1000_WUFC_FLX6 +#define E1000_WUS_FLX7 E1000_WUFC_FLX7 #define E1000_WUS_FLX4_PHY E1000_WUFC_FLX4_PHY #define E1000_WUS_FLX5_PHY E1000_WUFC_FLX5_PHY +#define E1000_WUS_FLX6_PHY 0x0400 +#define E1000_WUS_FLX7_PHY 0x0800 #define E1000_WUS_FLX_FILTERS E1000_WUFC_FLX_FILTERS #define E1000_WUS_FLX_FILTERS_6 E1000_WUFC_FLX_FILTERS_6 +#define E1000_WUS_FLX_FILTERS_8 E1000_WUFC_FLX_FILTERS_8 #define E1000_WUS_FLX_FILTERS_PHY_6 E1000_WUFC_FLX_FILTERS_PHY_6 /* Wake Up Packet Length */ @@ -122,6 +133,8 @@ #define E1000_FLEXIBLE_FILTER_COUNT_MAX 4 /* Six Flexible Filters are supported */ #define E1000_FLEXIBLE_FILTER_COUNT_MAX_6 6 +/* Eight Flexible Filters are supported */ +#define E1000_FLEXIBLE_FILTER_COUNT_MAX_8 8 /* Two Extended Flexible Filters are supported (82576) */ #define E1000_EXT_FLEXIBLE_FILTER_COUNT_MAX 2 #define E1000_FHFT_LENGTH_OFFSET 0xFC /* Length byte in FHFT */ @@ -132,6 +145,7 @@ #define E1000_FFLT_SIZE E1000_FLEXIBLE_FILTER_COUNT_MAX #define E1000_FFLT_SIZE_6 E1000_FLEXIBLE_FILTER_COUNT_MAX_6 +#define E1000_FFLT_SIZE_8 E1000_FLEXIBLE_FILTER_COUNT_MAX_8 #define E1000_FFMT_SIZE E1000_FLEXIBLE_FILTER_SIZE_MAX #define E1000_FFVT_SIZE E1000_FLEXIBLE_FILTER_SIZE_MAX @@ -710,6 +724,7 @@ #define E1000_EXTCNF_CTRL_LCD_WRITE_ENABLE 0x00000001 #define E1000_EXTCNF_CTRL_OEM_WRITE_ENABLE 0x00000008 #define E1000_EXTCNF_CTRL_SWFLAG 0x00000020 +#define E1000_EXTCNF_CTRL_GATE_PHY_CFG 0x00000080 #define E1000_EXTCNF_SIZE_EXT_PCIE_LENGTH_MASK 0x00FF0000 #define E1000_EXTCNF_SIZE_EXT_PCIE_LENGTH_SHIFT 16 #define E1000_EXTCNF_CTRL_EXT_CNF_POINTER_MASK 0x0FFF0000 @@ -1013,6 +1028,9 @@ #define E1000_ERR_SWFW_SYNC 13 #define E1000_NOT_IMPLEMENTED 14 #define E1000_ERR_MBX 15 +#define E1000_ERR_INVALID_ARGUMENT 16 +#define E1000_ERR_NO_SPACE 17 +#define E1000_ERR_NVM_PBA_SECTION 18 /* Loop limit on how long we wait for auto-negotiation to complete */ #define FIBER_LINK_UP_LIMIT 50 @@ -1106,6 +1124,11 @@ #define E1000_IMIR_PRIORITY_SHIFT 29 /* IMIR Priority Shift */ #define E1000_IMIREXT_CLEAR_MASK 0x7FFFF /* IMIREXT Reg Clear Mask */ +#define E1000_MDICNFG_EXT_MDIO 0x80000000 /* MDI ext/int destination */ +#define E1000_MDICNFG_COM_MDIO 0x40000000 /* MDI shared w/ lan 0 */ +#define E1000_MDICNFG_PHY_MASK 0x03E00000 +#define E1000_MDICNFG_PHY_SHIFT 21 + /* PCI Express Control */ #define E1000_GCR_RXD_NO_SNOOP 0x00000001 #define E1000_GCR_RXDSCW_NO_SNOOP 0x00000002 @@ -1301,6 +1324,10 @@ #define NVM_82580_LAN_FUNC_OFFSET(a) (a ? (0x40 + (0x40 * a)) : 0) +/* Mask bits for fields in Word 0x24 of the NVM */ +#define NVM_WORD24_COM_MDIO 0x0008 /* MDIO interface shared */ +#define NVM_WORD24_EXT_MDIO 0x0004 /* MDIO accesses routed external */ + /* Mask bits for fields in Word 0x0f of the NVM */ #define NVM_WORD0F_PAUSE_MASK 0x3000 #define NVM_WORD0F_PAUSE 0x1000 @@ -1312,12 +1339,19 @@ /* Mask bits for fields in Word 0x1a of the NVM */ #define NVM_WORD1A_ASPM_MASK 0x000C +/* Mask bits for fields in Word 0x03 of the EEPROM */ +#define NVM_COMPAT_LOM 0x0800 + +/* length of string needed to store PBA number */ +#define E1000_PBANUM_LENGTH 11 + /* For checksumming, the sum of all words in the NVM should equal 0xBABA. */ #define NVM_SUM 0xBABA #define NVM_MAC_ADDR_OFFSET 0 #define NVM_PBA_OFFSET_0 8 #define NVM_PBA_OFFSET_1 9 +#define NVM_PBA_PTR_GUARD 0xFAFA #define NVM_RESERVED_WORD 0xFFFF #define NVM_PHY_CLASS_A 0x8000 #define NVM_SERDES_AMPLITUDE_MASK 0x000F @@ -1422,6 +1456,7 @@ #define BME1000_E_PHY_ID_R2 0x01410CB1 #define I82577_E_PHY_ID 0x01540050 #define I82578_E_PHY_ID 0x004DD040 +#define I82579_E_PHY_ID 0x01540090 #define I82580_I_PHY_ID 0x015403A0 #define IGP04E1000_E_PHY_ID 0x02A80391 #define M88_VENDOR 0x0141 @@ -1622,6 +1657,7 @@ #define E1000_MDIC_READY 0x10000000 #define E1000_MDIC_INT_EN 0x20000000 #define E1000_MDIC_ERROR 0x40000000 +#define E1000_MDIC_DEST 0x80000000 /* SerDes Control */ #define E1000_GEN_CTL_READY 0x80000000 @@ -1683,4 +1719,5 @@ #define E1000_PCIEMISC_LX_DECISION 0x00000080 /* Lx power decision based on DMA coal */ + #endif /* _E1000_DEFINES_H_ */ Modified: head/sys/dev/e1000/e1000_hw.h ============================================================================== --- head/sys/dev/e1000/e1000_hw.h Mon Sep 27 23:00:02 2010 (r213233) +++ head/sys/dev/e1000/e1000_hw.h Tue Sep 28 00:13:15 2010 (r213234) @@ -120,17 +120,22 @@ struct e1000_hw; #define E1000_DEV_ID_ICH10_R_BM_LM 0x10CC #define E1000_DEV_ID_ICH10_R_BM_LF 0x10CD #define E1000_DEV_ID_ICH10_R_BM_V 0x10CE +#define E1000_DEV_ID_ICH10_HANKSVILLE 0xF0FE #define E1000_DEV_ID_ICH10_D_BM_LM 0x10DE #define E1000_DEV_ID_ICH10_D_BM_LF 0x10DF +#define E1000_DEV_ID_ICH10_D_BM_V 0x1525 #define E1000_DEV_ID_PCH_M_HV_LM 0x10EA #define E1000_DEV_ID_PCH_M_HV_LC 0x10EB #define E1000_DEV_ID_PCH_D_HV_DM 0x10EF #define E1000_DEV_ID_PCH_D_HV_DC 0x10F0 +#define E1000_DEV_ID_PCH2_LV_LM 0x1502 +#define E1000_DEV_ID_PCH2_LV_V 0x1503 #define E1000_DEV_ID_82576 0x10C9 #define E1000_DEV_ID_82576_FIBER 0x10E6 #define E1000_DEV_ID_82576_SERDES 0x10E7 *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Tue Sep 28 01:30:49 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E27011065672; Tue, 28 Sep 2010 01:30:49 +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 D1F798FC19; Tue, 28 Sep 2010 01:30:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8S1Un2V055410; Tue, 28 Sep 2010 01:30:49 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8S1UnJC055408; Tue, 28 Sep 2010 01:30:49 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201009280130.o8S1UnJC055408@svn.freebsd.org> From: Ed Maste Date: Tue, 28 Sep 2010 01:30:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213235 - head/lib/libstand X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2010 01:30:50 -0000 Author: emaste Date: Tue Sep 28 01:30:49 2010 New Revision: 213235 URL: http://svn.freebsd.org/changeset/base/213235 Log: Increase maximum network timeout from 20s to 120s. Given that an ETIMEDOUT return from sendrecv probably means a failure to boot we might as well be generous in the timeout period. Modified: head/lib/libstand/net.h Modified: head/lib/libstand/net.h ============================================================================== --- head/lib/libstand/net.h Tue Sep 28 00:13:15 2010 (r213234) +++ head/lib/libstand/net.h Tue Sep 28 01:30:49 2010 (r213235) @@ -50,7 +50,7 @@ #define MACPY(s, d) bcopy((char *)s, (char *)d, 6) -#define MAXTMO 20 /* seconds */ +#define MAXTMO 120 /* seconds */ #define MINTMO 2 /* seconds */ #define FNAME_SIZE 128 From owner-svn-src-head@FreeBSD.ORG Tue Sep 28 01:36:01 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9BD56106566C; Tue, 28 Sep 2010 01:36:01 +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 8B6048FC16; Tue, 28 Sep 2010 01:36: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 o8S1a1p0055575; Tue, 28 Sep 2010 01:36:01 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8S1a1MI055573; Tue, 28 Sep 2010 01:36:01 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201009280136.o8S1a1MI055573@svn.freebsd.org> From: Ed Maste Date: Tue, 28 Sep 2010 01:36:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213236 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2010 01:36:01 -0000 Author: emaste Date: Tue Sep 28 01:36:01 2010 New Revision: 213236 URL: http://svn.freebsd.org/changeset/base/213236 Log: Remove extra braces for style(9) (found while cleaning up an old work tree). Modified: head/sys/kern/subr_trap.c Modified: head/sys/kern/subr_trap.c ============================================================================== --- head/sys/kern/subr_trap.c Tue Sep 28 01:30:49 2010 (r213235) +++ head/sys/kern/subr_trap.c Tue Sep 28 01:36:01 2010 (r213236) @@ -118,9 +118,8 @@ userret(struct thread *td, struct trapfr /* * Charge system time if profiling. */ - if (p->p_flag & P_PROFIL) { + if (p->p_flag & P_PROFIL) addupc_task(td, TRAPF_PC(frame), td->td_pticks * psratio); - } /* * Let the scheduler adjust our priority etc. */ From owner-svn-src-head@FreeBSD.ORG Tue Sep 28 03:24:53 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DD2991065674; Tue, 28 Sep 2010 03:24:53 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CA8F88FC14; Tue, 28 Sep 2010 03:24:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8S3OrVw058055; Tue, 28 Sep 2010 03:24:53 GMT (envelope-from gonzo@svn.freebsd.org) Received: (from gonzo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8S3OrV9058046; Tue, 28 Sep 2010 03:24:53 GMT (envelope-from gonzo@svn.freebsd.org) Message-Id: <201009280324.o8S3OrV9058046@svn.freebsd.org> From: Oleksandr Tymoshenko Date: Tue, 28 Sep 2010 03:24:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213237 - in head/sys: conf dev/gpio sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2010 03:24:54 -0000 Author: gonzo Date: Tue Sep 28 03:24:53 2010 New Revision: 213237 URL: http://svn.freebsd.org/changeset/base/213237 Log: Initial GPIO bus support. Includes: - GPIO bus controller interface - GPIO bus interface - Implementation of GPIO led(4) compatible device - Implementation of iic(4) bus over GPIO (author: Luiz Otavio O Souza) Tested by: Luiz Otavio O Souza, Alexandr Rybalko Added: head/sys/dev/gpio/ head/sys/dev/gpio/gpio_if.m (contents, props changed) head/sys/dev/gpio/gpiobus.c (contents, props changed) head/sys/dev/gpio/gpiobus_if.m (contents, props changed) head/sys/dev/gpio/gpiobusvar.h (contents, props changed) head/sys/dev/gpio/gpioc.c (contents, props changed) head/sys/dev/gpio/gpioiic.c (contents, props changed) head/sys/dev/gpio/gpioled.c (contents, props changed) head/sys/sys/gpio.h (contents, props changed) Modified: head/sys/conf/files Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Tue Sep 28 01:36:01 2010 (r213236) +++ head/sys/conf/files Tue Sep 28 03:24:53 2010 (r213237) @@ -1010,6 +1010,14 @@ dev/fxp/if_fxp.c optional fxp inet dev/gem/if_gem.c optional gem dev/gem/if_gem_pci.c optional gem pci dev/gem/if_gem_sbus.c optional gem sbus +dev/gpio/gpiobus.c optional gpio \ + dependency "gpiobus_if.h" +dev/gpio/gpioc.c optional gpio \ + dependency "gpio_if.h" +dev/gpio/gpioiic.c optional gpioiic +dev/gpio/gpioled.c optional gpioled +dev/gpio/gpio_if.m optional gpio +dev/gpio/gpiobus_if.m optional gpio dev/hatm/if_hatm.c optional hatm pci dev/hatm/if_hatm_intr.c optional hatm pci dev/hatm/if_hatm_ioctl.c optional hatm pci Added: head/sys/dev/gpio/gpio_if.m ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/gpio/gpio_if.m Tue Sep 28 03:24:53 2010 (r213237) @@ -0,0 +1,102 @@ +#- +# Copyright (c) 2009 Oleksandr Tymoshenko +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# $FreeBSD$ +# + +#include +#include + +INTERFACE gpio; + +# +# Get total number of pins +# +METHOD int pin_max { + device_t dev; + int *npins; +}; + +# +# Set value of pin specifed by pin_num +# +METHOD int pin_set { + device_t dev; + uint32_t pin_num; + uint32_t pin_value; +}; + +# +# Get value of pin specifed by pin_num +# +METHOD int pin_get { + device_t dev; + uint32_t pin_num; + uint32_t *pin_value; +}; + +# +# Toggle value of pin specifed by pin_num +# +METHOD int pin_toggle { + device_t dev; + uint32_t pin_num; +}; + +# +# Get pin capabilities +# +METHOD int pin_getcaps { + device_t dev; + uint32_t pin_num; + uint32_t *caps; +}; + +# +# Get pin flags +# +METHOD int pin_getflags { + device_t dev; + uint32_t pin_num; + uint32_t *flags; +}; + +# +# Get pin name +# +METHOD int pin_getname { + device_t dev; + uint32_t pin_num; + char *name; +}; + +# +# Set current configuration and capabilities +# +METHOD int pin_setflags { + device_t dev; + uint32_t pin_num; + uint32_t flags; +}; Added: head/sys/dev/gpio/gpiobus.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/gpio/gpiobus.c Tue Sep 28 03:24:53 2010 (r213237) @@ -0,0 +1,492 @@ +/*- + * Copyright (c) 2009 Oleksandr Tymoshenko + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include "gpio_if.h" +#include "gpiobus_if.h" + +static void gpiobus_print_pins(struct gpiobus_ivar *); +static int gpiobus_parse_pins(struct gpiobus_softc *, device_t, int); +static int gpiobus_probe(device_t); +static int gpiobus_attach(device_t); +static int gpiobus_detach(device_t); +static int gpiobus_suspend(device_t); +static int gpiobus_resume(device_t); +static int gpiobus_print_child(device_t, device_t); +static int gpiobus_child_location_str(device_t, device_t, char *, size_t); +static int gpiobus_child_pnpinfo_str(device_t, device_t, char *, size_t); +static device_t gpiobus_add_child(device_t, u_int, const char *, int); +static void gpiobus_hinted_child(device_t, const char *, int); + +/* + * GPIOBUS interface + */ +static void gpiobus_lock_bus(device_t); +static void gpiobus_unlock_bus(device_t); +static void gpiobus_acquire_bus(device_t, device_t); +static void gpiobus_release_bus(device_t, device_t); +static int gpiobus_pin_setflags(device_t, device_t, uint32_t, uint32_t); +static int gpiobus_pin_getflags(device_t, device_t, uint32_t, uint32_t*); +static int gpiobus_pin_getcaps(device_t, device_t, uint32_t, uint32_t*); +static int gpiobus_pin_set(device_t, device_t, uint32_t, unsigned int); +static int gpiobus_pin_get(device_t, device_t, uint32_t, unsigned int*); +static int gpiobus_pin_toggle(device_t, device_t, uint32_t); + +#define GPIOBUS_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx) +#define GPIOBUS_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_mtx) +#define GPIOBUS_LOCK_INIT(_sc) \ + mtx_init(&_sc->sc_mtx, device_get_nameunit(_sc->sc_dev), \ + "gpiobus", MTX_DEF) +#define GPIOBUS_LOCK_DESTROY(_sc) mtx_destroy(&_sc->sc_mtx); +#define GPIOBUS_ASSERT_LOCKED(_sc) mtx_assert(&_sc->sc_mtx, MA_OWNED); +#define GPIOBUS_ASSERT_UNLOCKED(_sc) mtx_assert(&_sc->sc_mtx, MA_NOTOWNED); + + +static void +gpiobus_print_pins(struct gpiobus_ivar *devi) +{ + int range_start, range_stop, need_coma; + int i; + + if (devi->npins == 0) + return; + + need_coma = 0; + range_start = range_stop = devi->pins[0]; + for (i = 1; i < devi->npins; i++) { + if (devi->pins[i] != (range_stop + 1)) { + if (need_coma) + printf(","); + if (range_start != range_stop) + printf("%d-%d", range_start, range_stop); + else + printf("%d", range_start); + + range_start = range_stop = devi->pins[i]; + need_coma = 1; + } + else + range_stop++; + } + + if (need_coma) + printf(","); + if (range_start != range_stop) + printf("%d-%d", range_start, range_stop); + else + printf("%d", range_start); +} + +static int +gpiobus_parse_pins(struct gpiobus_softc *sc, device_t child, int mask) +{ + struct gpiobus_ivar *devi = GPIOBUS_IVAR(child); + int i, npins; + + npins = 0; + for (i = 0; i < 32; i++) { + if (mask & (1 << i)) + npins++; + } + + if (npins == 0) { + device_printf(child, "empty pin mask"); + return (EINVAL); + } + + devi->npins = npins; + devi->pins = malloc(sizeof(uint32_t) * devi->npins, M_DEVBUF, + M_NOWAIT | M_ZERO); + + if (!devi->pins) + return (ENOMEM); + + npins = 0; + for (i = 0; i < 32; i++) { + + if ((mask & (1 << i)) == 0) + continue; + + if (i >= sc->sc_npins) { + device_printf(child, + "invalid pin %d, max: %d\n", i, sc->sc_npins - 1); + return (EINVAL); + } + + devi->pins[npins++] = i; + /* + * Mark pin as mapped and give warning if it's already mapped + */ + if (sc->sc_pins_mapped[i]) { + device_printf(child, + "warning: pin %d is already mapped\n", i); + return (EINVAL); + } + sc->sc_pins_mapped[i] = 1; + } + + return (0); +} + +static int +gpiobus_probe(device_t dev) +{ + device_set_desc(dev, "GPIO bus"); + return (0); +} + +static int +gpiobus_attach(device_t dev) +{ + struct gpiobus_softc *sc = GPIOBUS_SOFTC(dev); + int res; + + sc->sc_busdev = dev; + sc->sc_dev = device_get_parent(dev); + res = GPIO_PIN_MAX(sc->sc_dev, &sc->sc_npins); + if (res) + return (ENXIO); + + /* + * Increase to get number of pins + */ + sc->sc_npins++; + + KASSERT(sc->sc_npins != 0, ("GPIO device with no pins")); + + sc->sc_pins_mapped = malloc(sizeof(int) * sc->sc_npins, M_DEVBUF, + M_NOWAIT | M_ZERO); + + if (!sc->sc_pins_mapped) + return (ENOMEM); + + /* init bus lock */ + GPIOBUS_LOCK_INIT(sc); + + /* + * Get parent's pins and mark them as unmapped + */ + bus_enumerate_hinted_children(dev); + return (bus_generic_attach(dev)); +} + +/* + * Since this is not a self-enumerating bus, and since we always add + * children in attach, we have to always delete children here. + */ +static int +gpiobus_detach(device_t dev) +{ + struct gpiobus_softc *sc = GPIOBUS_SOFTC(dev); + int err, ndevs, i; + device_t *devlist; + + KASSERT(mtx_initialized(&sc->sc_mtx), + ("gpiobus mutex not initialized")); + GPIOBUS_LOCK_DESTROY(sc); + + if ((err = bus_generic_detach(dev)) != 0) + return (err); + if ((err = device_get_children(dev, &devlist, &ndevs)) != 0) + return (err); + for (i = 0; i < ndevs; i++) + device_delete_child(dev, devlist[i]); + + if (sc->sc_pins_mapped) { + free(sc->sc_pins_mapped, M_DEVBUF); + sc->sc_pins_mapped = NULL; + } + free(devlist, M_TEMP); + + return (0); +} + +static int +gpiobus_suspend(device_t dev) +{ + + return (bus_generic_suspend(dev)); +} + +static int +gpiobus_resume(device_t dev) +{ + + return (bus_generic_resume(dev)); +} + +static int +gpiobus_print_child(device_t dev, device_t child) +{ + struct gpiobus_ivar *devi = GPIOBUS_IVAR(child); + int retval = 0; + + retval += bus_print_child_header(dev, child); + retval += printf(" at pin(s) "); + gpiobus_print_pins(devi); + retval += bus_print_child_footer(dev, child); + + return (retval); +} + +static int +gpiobus_child_location_str(device_t bus, device_t child, char *buf, + size_t buflen) +{ + // struct gpiobus_ivar *devi = GPIOBUS_IVAR(child); + + snprintf(buf, buflen, "pins=?"); + return (0); +} + +static int +gpiobus_child_pnpinfo_str(device_t bus, device_t child, char *buf, + size_t buflen) +{ + + *buf = '\0'; + return (0); +} + +static device_t +gpiobus_add_child(device_t dev, u_int order, const char *name, int unit) +{ + device_t child; + struct gpiobus_ivar *devi; + + child = device_add_child_ordered(dev, order, name, unit); + if (child == NULL) + return (child); + devi = malloc(sizeof(struct gpiobus_ivar), M_DEVBUF, M_NOWAIT | M_ZERO); + if (devi == NULL) { + device_delete_child(dev, child); + return (0); + } + device_set_ivars(child, devi); + return (child); +} + +static void +gpiobus_hinted_child(device_t bus, const char *dname, int dunit) +{ + struct gpiobus_softc *sc = GPIOBUS_SOFTC(bus); + struct gpiobus_ivar *devi; + device_t child; + int pins; + + + child = BUS_ADD_CHILD(bus, 0, dname, dunit); + devi = GPIOBUS_IVAR(child); + resource_int_value(dname, dunit, "pins", &pins); + if (gpiobus_parse_pins(sc, child, pins)) + device_delete_child(bus, child); +} + +static void +gpiobus_lock_bus(device_t busdev) +{ + struct gpiobus_softc *sc; + + sc = device_get_softc(busdev); + GPIOBUS_ASSERT_UNLOCKED(sc); + GPIOBUS_LOCK(sc); +} + +static void +gpiobus_unlock_bus(device_t busdev) +{ + struct gpiobus_softc *sc; + + sc = device_get_softc(busdev); + GPIOBUS_ASSERT_LOCKED(sc); + GPIOBUS_UNLOCK(sc); +} + +static void +gpiobus_acquire_bus(device_t busdev, device_t child) +{ + struct gpiobus_softc *sc; + + sc = device_get_softc(busdev); + GPIOBUS_ASSERT_LOCKED(sc); + + if (sc->sc_owner) + panic("rb_cpldbus: cannot serialize the access to device."); + sc->sc_owner = child; +} + +static void +gpiobus_release_bus(device_t busdev, device_t child) +{ + struct gpiobus_softc *sc; + + sc = device_get_softc(busdev); + GPIOBUS_ASSERT_LOCKED(sc); + + if (!sc->sc_owner) + panic("rb_cpldbus: releasing unowned bus."); + if (sc->sc_owner != child) + panic("rb_cpldbus: you don't own the bus. game over."); + + sc->sc_owner = NULL; +} + +static int +gpiobus_pin_setflags(device_t dev, device_t child, uint32_t pin, + uint32_t flags) +{ + struct gpiobus_softc *sc = GPIOBUS_SOFTC(dev); + struct gpiobus_ivar *devi = GPIOBUS_IVAR(child); + + if (pin >= devi->npins) + return (EINVAL); + + return GPIO_PIN_SETFLAGS(sc->sc_dev, devi->pins[pin], flags); +} + +static int +gpiobus_pin_getflags(device_t dev, device_t child, uint32_t pin, + uint32_t *flags) +{ + struct gpiobus_softc *sc = GPIOBUS_SOFTC(dev); + struct gpiobus_ivar *devi = GPIOBUS_IVAR(child); + + if (pin >= devi->npins) + return (EINVAL); + + return GPIO_PIN_GETFLAGS(sc->sc_dev, devi->pins[pin], flags); +} + +static int +gpiobus_pin_getcaps(device_t dev, device_t child, uint32_t pin, + uint32_t *caps) +{ + struct gpiobus_softc *sc = GPIOBUS_SOFTC(dev); + struct gpiobus_ivar *devi = GPIOBUS_IVAR(child); + + if (pin >= devi->npins) + return (EINVAL); + + return GPIO_PIN_GETCAPS(sc->sc_dev, devi->pins[pin], caps); +} + +static int +gpiobus_pin_set(device_t dev, device_t child, uint32_t pin, + unsigned int value) +{ + struct gpiobus_softc *sc = GPIOBUS_SOFTC(dev); + struct gpiobus_ivar *devi = GPIOBUS_IVAR(child); + + if (pin >= devi->npins) + return (EINVAL); + + return GPIO_PIN_SET(sc->sc_dev, devi->pins[pin], value); +} + +static int +gpiobus_pin_get(device_t dev, device_t child, uint32_t pin, + unsigned int *value) +{ + struct gpiobus_softc *sc = GPIOBUS_SOFTC(dev); + struct gpiobus_ivar *devi = GPIOBUS_IVAR(child); + + if (pin >= devi->npins) + return (EINVAL); + + return GPIO_PIN_GET(sc->sc_dev, devi->pins[pin], value); +} + +static int +gpiobus_pin_toggle(device_t dev, device_t child, uint32_t pin) +{ + struct gpiobus_softc *sc = GPIOBUS_SOFTC(dev); + struct gpiobus_ivar *devi = GPIOBUS_IVAR(child); + + if (pin >= devi->npins) + return (EINVAL); + + return GPIO_PIN_TOGGLE(sc->sc_dev, devi->pins[pin]); +} + +static device_method_t gpiobus_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, gpiobus_probe), + DEVMETHOD(device_attach, gpiobus_attach), + DEVMETHOD(device_detach, gpiobus_detach), + DEVMETHOD(device_shutdown, bus_generic_shutdown), + DEVMETHOD(device_suspend, gpiobus_suspend), + DEVMETHOD(device_resume, gpiobus_resume), + + /* Bus interface */ + DEVMETHOD(bus_add_child, gpiobus_add_child), + DEVMETHOD(bus_print_child, gpiobus_print_child), + DEVMETHOD(bus_driver_added, bus_generic_driver_added), + DEVMETHOD(bus_child_pnpinfo_str, gpiobus_child_pnpinfo_str), + DEVMETHOD(bus_child_location_str, gpiobus_child_location_str), + DEVMETHOD(bus_hinted_child, gpiobus_hinted_child), + + /* GPIO protocol */ + DEVMETHOD(gpiobus_lock_bus, gpiobus_lock_bus), + DEVMETHOD(gpiobus_unlock_bus, gpiobus_unlock_bus), + DEVMETHOD(gpiobus_acquire_bus, gpiobus_acquire_bus), + DEVMETHOD(gpiobus_release_bus, gpiobus_release_bus), + DEVMETHOD(gpiobus_pin_getflags, gpiobus_pin_getflags), + DEVMETHOD(gpiobus_pin_getcaps, gpiobus_pin_getcaps), + DEVMETHOD(gpiobus_pin_setflags, gpiobus_pin_setflags), + DEVMETHOD(gpiobus_pin_get, gpiobus_pin_get), + DEVMETHOD(gpiobus_pin_set, gpiobus_pin_set), + DEVMETHOD(gpiobus_pin_toggle, gpiobus_pin_toggle), + + { 0, 0 } +}; + +static driver_t gpiobus_driver = { + "gpiobus", + gpiobus_methods, + sizeof(struct gpiobus_softc) +}; + +devclass_t gpiobus_devclass; + +DRIVER_MODULE(gpiobus, gpio, gpiobus_driver, gpiobus_devclass, 0, 0); +MODULE_VERSION(gpiobus, 1); Added: head/sys/dev/gpio/gpiobus_if.m ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/gpio/gpiobus_if.m Tue Sep 28 03:24:53 2010 (r213237) @@ -0,0 +1,121 @@ +#- +# Copyright (c) 2009 Oleksandr Tymoshenko +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# $FreeBSD$ +# + +#include +#include + +INTERFACE gpiobus; + +# +# Lock the gpio bus +# +METHOD void lock_bus { + device_t busdev; +}; + +# +# Unlock the gpio bus +# +METHOD void unlock_bus { + device_t busdev; +}; + +# +# Dedicate the gpio bus control for a child +# +METHOD void acquire_bus { + device_t busdev; + device_t dev; +}; + +# +# Release the bus +# +METHOD void release_bus { + device_t busdev; + device_t dev; +}; + +# +# Set value of pin specifed by pin_num +# +METHOD int pin_set { + device_t dev; + device_t child; + uint32_t pin_num; + uint32_t pin_value; +}; + +# +# Get value of pin specifed by pin_num +# +METHOD int pin_get { + device_t dev; + device_t child; + uint32_t pin_num; + uint32_t *pin_value; +}; + +# +# Toggle value of pin specifed by pin_num +# +METHOD int pin_toggle { + device_t dev; + device_t child; + uint32_t pin_num; +}; + +# +# Get pin capabilities +# +METHOD int pin_getcaps { + device_t dev; + device_t child; + uint32_t pin_num; + uint32_t *caps; +}; + +# +# Get pin flags +# +METHOD int pin_getflags { + device_t dev; + device_t child; + uint32_t pin_num; + uint32_t *flags; +}; + +# +# Set current configuration and capabilities +# +METHOD int pin_setflags { + device_t dev; + device_t child; + uint32_t pin_num; + uint32_t flags; +}; Added: head/sys/dev/gpio/gpiobusvar.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/gpio/gpiobusvar.h Tue Sep 28 03:24:53 2010 (r213237) @@ -0,0 +1,56 @@ +/*- + * Copyright (c) 2009 Oleksandr Tymoshenko + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + * + */ + +#ifndef __GPIOBUS_H__ +#define __GPIOBUS_H__ + +#include +#include +#include + +#define GPIOBUS_IVAR(d) (struct gpiobus_ivar *) device_get_ivars(d) +#define GPIOBUS_SOFTC(d) (struct gpiobus_softc *) device_get_softc(d) + +struct gpiobus_softc +{ + struct mtx sc_mtx; /* bus mutex */ + device_t sc_busdev; /* bus device */ + device_t sc_owner; /* bus owner */ + device_t sc_dev; /* driver device */ + int sc_npins; /* total pins on bus */ + int *sc_pins_mapped; /* mark mapped pins */ +}; + + +struct gpiobus_ivar +{ + uint32_t npins; /* pins total */ + uint32_t *pins; /* pins map */ +}; + +#endif /* __GPIOBUS_H__ */ Added: head/sys/dev/gpio/gpioc.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/gpio/gpioc.c Tue Sep 28 03:24:53 2010 (r213237) @@ -0,0 +1,174 @@ +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include "gpio_if.h" + +#undef GPIOC_DEBUG +#ifdef GPIOC_DEBUG +#define dprintf printf +#else +#define dprintf(x, arg...) +#endif + +static int gpioc_probe(device_t dev); +static int gpioc_attach(device_t dev); +static int gpioc_detach(device_t dev); + +static d_ioctl_t gpioc_ioctl; + +static struct cdevsw gpioc_cdevsw = { + .d_version = D_VERSION, + .d_ioctl = gpioc_ioctl, + .d_name = "gpioc", +#if __FreeBSD_version >= 800039 + .d_flags = D_PSEUDO | D_NEEDMINOR +#endif +}; + +struct gpioc_softc { + device_t sc_dev; /* gpiocX dev */ + device_t sc_pdev; /* gpioX dev */ + struct cdev *sc_ctl_dev; /* controller device */ + int sc_unit; +}; + +static int +gpioc_probe(device_t dev) +{ + device_set_desc(dev, "GPIO controller"); + return (0); +} + +static int +gpioc_attach(device_t dev) +{ + struct gpioc_softc *sc = device_get_softc(dev); + + sc->sc_dev = dev; + sc->sc_pdev = device_get_parent(dev); + sc->sc_unit = device_get_unit(dev); + sc->sc_ctl_dev = make_dev(&gpioc_cdevsw, sc->sc_unit, + UID_ROOT, GID_WHEEL, 0600, "gpioc%d", sc->sc_unit); + if (!sc->sc_ctl_dev) { + printf("Failed to create gpioc%d", sc->sc_unit); + return (ENXIO); + } + sc->sc_ctl_dev->si_drv1 = sc; + + return (0); +} + +static int +gpioc_detach(device_t dev) +{ + struct gpioc_softc *sc = device_get_softc(dev); + int err; + + if (sc->sc_ctl_dev); + destroy_dev(sc->sc_ctl_dev); + + if ((err = bus_generic_detach(dev)) != 0) + return (err); + + return (0); +} + +static int +gpioc_ioctl(struct cdev *cdev, u_long cmd, caddr_t arg, int fflag, + struct thread *td) +{ + int max_pin, res; + struct gpioc_softc *sc = cdev->si_drv1; + struct gpio_pin pin; + struct gpio_req req; + + switch (cmd) { + case GPIOMAXPIN: + max_pin = -1; + res = GPIO_PIN_MAX(sc->sc_pdev, &max_pin); + bcopy(&max_pin, arg, sizeof(max_pin)); + break; + case GPIOGETCONFIG: + bcopy(arg, &pin, sizeof(pin)); + dprintf("get config pin %d\n", pin.gp_pin); + res = GPIO_PIN_GETFLAGS(sc->sc_pdev, pin.gp_pin, + &pin.gp_flags); + /* Fail early */ + if (res) + break; + GPIO_PIN_GETCAPS(sc->sc_pdev, pin.gp_pin, &pin.gp_caps); + GPIO_PIN_GETNAME(sc->sc_pdev, pin.gp_pin, pin.gp_name); + bcopy(&pin, arg, sizeof(pin)); + break; + case GPIOSETCONFIG: + bcopy(arg, &pin, sizeof(pin)); + dprintf("set config pin %d\n", pin.gp_pin); + res = GPIO_PIN_SETFLAGS(sc->sc_pdev, pin.gp_pin, + pin.gp_flags); + break; + case GPIOGET: + bcopy(arg, &req, sizeof(req)); + res = GPIO_PIN_GET(sc->sc_pdev, req.gp_pin, + &req.gp_value); + dprintf("read pin %d -> %d\n", + req.gp_pin, req.gp_value); + bcopy(&req, arg, sizeof(req)); + break; + case GPIOSET: + bcopy(arg, &req, sizeof(req)); + res = GPIO_PIN_SET(sc->sc_pdev, req.gp_pin, + req.gp_value); + dprintf("write pin %d -> %d\n", + req.gp_pin, req.gp_value); + break; + case GPIOTOGGLE: + bcopy(arg, &req, sizeof(req)); + dprintf("toggle pin %d\n", + req.gp_pin); + res = GPIO_PIN_TOGGLE(sc->sc_pdev, req.gp_pin); + break; + default: + return (ENOTTY); + break; + } + + return (res); +} + +static device_method_t gpioc_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, gpioc_probe), + DEVMETHOD(device_attach, gpioc_attach), + DEVMETHOD(device_detach, gpioc_detach), + DEVMETHOD(device_shutdown, bus_generic_shutdown), + DEVMETHOD(device_suspend, bus_generic_suspend), + DEVMETHOD(device_resume, bus_generic_resume), + + { 0, 0 } +}; + +static driver_t gpioc_driver = { + "gpioc", + gpioc_methods, + sizeof(struct gpioc_softc) +}; + +devclass_t gpioc_devclass; + +DRIVER_MODULE(gpioc, gpio, gpioc_driver, gpioc_devclass, 0, 0); +MODULE_VERSION(gpioc, 1); Added: head/sys/dev/gpio/gpioiic.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/gpio/gpioiic.c Tue Sep 28 03:24:53 2010 (r213237) @@ -0,0 +1,245 @@ +/*- + * Copyright (c) 2009 Oleksandr Tymoshenko + * Copyright (c) 2010 Luiz Otavio O Souza + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Tue Sep 28 03:28:21 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1F950106564A; Tue, 28 Sep 2010 03:28:21 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0CDC98FC18; Tue, 28 Sep 2010 03:28:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8S3SKIO058175; Tue, 28 Sep 2010 03:28:20 GMT (envelope-from gonzo@svn.freebsd.org) Received: (from gonzo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8S3SKLY058170; Tue, 28 Sep 2010 03:28:20 GMT (envelope-from gonzo@svn.freebsd.org) Message-Id: <201009280328.o8S3SKLY058170@svn.freebsd.org> From: Oleksandr Tymoshenko Date: Tue, 28 Sep 2010 03:28:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213238 - in head/usr.sbin: . gpioctl X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2010 03:28:21 -0000 Author: gonzo Date: Tue Sep 28 03:28:20 2010 New Revision: 213238 URL: http://svn.freebsd.org/changeset/base/213238 Log: Add gpioctl(8). Utility for configuring/accessing GPIO pins Added: head/usr.sbin/gpioctl/ head/usr.sbin/gpioctl/Makefile (contents, props changed) head/usr.sbin/gpioctl/gpioctl.8 (contents, props changed) head/usr.sbin/gpioctl/gpioctl.c (contents, props changed) Modified: head/usr.sbin/Makefile Modified: head/usr.sbin/Makefile ============================================================================== --- head/usr.sbin/Makefile Tue Sep 28 03:24:53 2010 (r213237) +++ head/usr.sbin/Makefile Tue Sep 28 03:28:20 2010 (r213238) @@ -27,6 +27,7 @@ SUBDIR= adduser \ fwcontrol \ getfmac \ getpmac \ + gpioctl \ gstat \ i2c \ ifmcstat \ Added: head/usr.sbin/gpioctl/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/gpioctl/Makefile Tue Sep 28 03:28:20 2010 (r213238) @@ -0,0 +1,6 @@ +# $FreeBSD$ + +PROG= gpioctl +MAN= gpioctl.8 + +.include Added: head/usr.sbin/gpioctl/gpioctl.8 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/gpioctl/gpioctl.8 Tue Sep 28 03:28:20 2010 (r213238) @@ -0,0 +1,124 @@ +.\" Copyright (c) 1980, 1991, 1993 +.\" The Regents of the University of California. 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. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 4. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd September 27, 2010 +.Dt GPIOCTL 1 +.Os +.Sh NAME +.Nm gpioctl +.Nd GPIO control utility +.Sh SYNOPSIS +.Nm +.Cm -l +.Fl f Ar ctldev +.Op Fl v +.Nm +.Cm -t +.Fl f Ar ctldev +.Ar pin +.Nm +.Cm -c +.Fl f Ar ctldev +.Ar pin +.Ar flag +.Op flag ... +.Nm +.Cm -f Ar ctldev +.Ar pin +.Ar [0|1] +.Sh DESCRIPTION +The +.Nm +utility could be used to manage GPIO pins from userland and list available pins. +.Pp +The options are as follows: +.Bl -tag -width ".Fl f Ar ctldev" +.It Fl c Ar pin Ar flag Op flag ... +Configure pin by setting provided flags. The following flags are currently defined: +.Bl -tag -offset indent -width ".Cm PULSE" +.It Cm IN +Input pin +.It Cm OUT +Output pin +.It Cm OD +Open drain pin +.It Cm PP +Push pull pin +.It Cm TS +Tristate pin +.It Cm PU +Pull-up pin +.It Cm PD +Pull-down pin +.It Cm II +Inverted input pin +.It Cm IO +Inverted output pin +.El +.It Fl f Ar ctldev +GPIO controller device to use +.It Fl l +list available pins +.It Fl t Ar pin +toggle value of provided pin number +.It Fl v +be verbose: for each listed pin print current configuration +.El +.Sh EXAMPLES +.Pp +.Bl -bullet +.It +List pins available on GPIO controller defined by device /dev/gpioctl0 +.Pp +gpioctl -f /dev/gpioctl0 -l +.It +Set the value of pin 12 to 1 +.Pp +gpioctl -f /dev/gpioctl0 12 1 +.It +Configure pin 12 to be input pin +.Pp +gpioctl -f /dev/gpioctl0 -c 12 IN +.El +.Sh HISTORY +The +.Nm +utility appeared in +.Fx 9.0 . +.Sh AUTHORS +.An -nosplit +The +.Nm +utility and this manual page were written by +.An Oleksandr Tymoshenko +.Aq gonzo@freebsd.org Added: head/usr.sbin/gpioctl/gpioctl.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/gpioctl/gpioctl.c Tue Sep 28 03:28:20 2010 (r213238) @@ -0,0 +1,323 @@ +/*- + * Copyright (c) 2009, Oleksandr Tymoshenko + * 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 unmodified, this list of conditions, and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include + +#include + +struct flag_desc { + const char *name; + uint32_t flag; +}; + +struct flag_desc gpio_flags[] = { + { "IN", GPIO_PIN_INPUT }, + { "OUT", GPIO_PIN_OUTPUT }, + { "OD", GPIO_PIN_OPENDRAIN }, + { "PP", GPIO_PIN_PUSHPULL }, + { "TS", GPIO_PIN_TRISTATE }, + { "PU", GPIO_PIN_PULLUP }, + { "PD", GPIO_PIN_PULLDOWN }, + { "II", GPIO_PIN_INVIN }, + { "IO", GPIO_PIN_INVOUT }, + { "PULSE", GPIO_PIN_PULSATE }, + { NULL, 0 }, +}; + +int str2cap(const char *str); + +static void +usage(void) +{ + fprintf(stderr, "Usage:\n"); + fprintf(stderr, "\tgpioctl -f ctldev -l [-v]\n"); + fprintf(stderr, "\tgpioctl -f ctldev -t pin\n"); + fprintf(stderr, "\tgpioctl -f ctldev -c pin flag ...\n"); + fprintf(stderr, "\tgpioctl -f ctldev pin [0|1]\n"); + exit(1); +} + +static const char * +cap2str(uint32_t cap) +{ + struct flag_desc * pdesc = gpio_flags; + while (pdesc->name) { + if (pdesc->flag == cap) + return pdesc->name; + pdesc++; + } + + return "UNKNOWN"; +} + +int +str2cap(const char *str) +{ + struct flag_desc * pdesc = gpio_flags; + while (pdesc->name) { + if (strcasecmp(str, pdesc->name) == 0) + return pdesc->flag; + pdesc++; + } + + return (-1); +} + +/* + * Our handmade function for converting string to number + */ +static int +str2int(const char *s, int *ok) +{ + char *endptr; + int res = strtod(s, &endptr); + if (endptr != s + strlen(s) ) + *ok = 0; + else + *ok = 1; + + return res; +} + +static void +print_caps(int caps) +{ + int i, need_coma; + + need_coma = 0; + printf("<"); + for (i = 0; i < 32; i++) { + if (caps & (1 << i)) { + if (need_coma) + printf(","); + printf("%s", cap2str(1 << i)); + need_coma = 1; + } + } + printf(">"); +} + +static void +dump_pins(int fd, int verbose) +{ + int i, maxpin; + struct gpio_pin pin; + struct gpio_req req; + + if (ioctl(fd, GPIOMAXPIN, &maxpin) < 0) { + perror("ioctl(GPIOMAXPIN)"); + exit(1); + } + + for (i = 0; i <= maxpin; i++) { + pin.gp_pin = i; + if (ioctl(fd, GPIOGETCONFIG, &pin) < 0) + /* For some reason this pin is inaccessible */ + continue; + + req.gp_pin = i; + if (ioctl(fd, GPIOGET, &req) < 0) { + /* Now, that's wrong */ + perror("ioctl(GPIOGET)"); + exit(1); + } + + printf("pin %02d:\t%d\t%s", pin.gp_pin, req.gp_value, + pin.gp_name); + + print_caps(pin.gp_flags); + + if (verbose) { + printf(", caps:"); + print_caps(pin.gp_caps); + } + printf("\n"); + } +} + +static void +fail(const char *fmt, ...) +{ + va_list ap; + + va_start(ap, fmt); + vfprintf(stderr, fmt, ap); + va_end(ap); + exit(1); +} + +int +main(int argc, char **argv) +{ + int i; + struct gpio_pin pin; + struct gpio_req req; + char *ctlfile = NULL; + int pinn, pinv, fd, ch; + int flags, flag, ok; + int config, toggle, verbose, list; + + config = toggle = verbose = list = pinn = 0; + + while ((ch = getopt(argc, argv, "c:f:lt:v")) != -1) { + switch (ch) { + case 'c': + config = 1; + pinn = str2int(optarg, &ok); + if (!ok) + fail("Invalid pin number: %s\n", optarg); + break; + case 'f': + ctlfile = optarg; + break; + case 'l': + list = 1; + break; + case 't': + toggle = 1; + pinn = str2int(optarg, &ok); + if (!ok) + fail("Invalid pin number: %s\n", optarg); + break; + case 'v': + verbose = 1; + break; + default: + usage(); + break; + } + } + argv += optind; + argc -= optind; + for (i = 0; i < argc; i++) + printf("%d/%s\n", i, argv[i]); + + if (ctlfile == NULL) + fail("No gpioctl device provided\n"); + + fd = open(ctlfile, O_RDONLY); + if (fd < 0) { + perror("open"); + exit(1); + } + + if (list) { + dump_pins(fd, verbose); + close(fd); + exit(0); + } + + if (toggle) { + /* + * -t pin assumes no additional arguments + */ + if(argc > 0) { + usage(); + exit(1); + } + + req.gp_pin = pinn; + if (ioctl(fd, GPIOTOGGLE, &req) < 0) { + perror("ioctl(GPIOTOGGLE)"); + exit(1); + } + + close(fd); + exit (0); + } + + if (config) { + flags = 0; + for (i = 0; i < argc; i++) { + flag = str2cap(argv[i]); + if (flag < 0) + fail("Invalid flag: %s\n", argv[i]); + flags |= flag; + } + + pin.gp_pin = pinn; + pin.gp_flags = flags; + if (ioctl(fd, GPIOSETCONFIG, &pin) < 0) { + perror("ioctl(GPIOSETCONFIG)"); + exit(1); + } + + exit(0); + } + + /* + * Last two cases - set value or print value + */ + if ((argc == 0) || (argc > 2)) { + usage(); + exit(1); + } + + pinn = str2int(argv[0], &ok); + if (!ok) + fail("Invalid pin number: %s\n", argv[0]); + + /* + * Read pin value + */ + if (argc == 1) { + req.gp_pin = pinn; + if (ioctl(fd, GPIOGET, &req) < 0) { + perror("ioctl(GPIOGET)"); + exit(1); + } + printf("%d\n", req.gp_value); + exit (0); + } + + /* Is it valid number (0 or 1) ? */ + pinv = str2int(argv[1], &ok); + if (!ok || ((pinv != 0) && (pinv != 1))) + fail("Invalid pin value: %s\n", argv[1]); + + /* + * Set pin value + */ + req.gp_pin = pinn; + req.gp_value = pinv; + if (ioctl(fd, GPIOSET, &req) < 0) { + perror("ioctl(GPIOSET)"); + exit(1); + } + + close(fd); + exit(0); +} From owner-svn-src-head@FreeBSD.ORG Tue Sep 28 03:31:34 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CBEEE106566C; Tue, 28 Sep 2010 03:31:34 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B9CB38FC1C; Tue, 28 Sep 2010 03:31: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 o8S3VYUR058286; Tue, 28 Sep 2010 03:31:34 GMT (envelope-from gonzo@svn.freebsd.org) Received: (from gonzo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8S3VYAb058281; Tue, 28 Sep 2010 03:31:34 GMT (envelope-from gonzo@svn.freebsd.org) Message-Id: <201009280331.o8S3VYAb058281@svn.freebsd.org> From: Oleksandr Tymoshenko Date: Tue, 28 Sep 2010 03:31:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213239 - head/sys/mips/atheros X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2010 03:31:34 -0000 Author: gonzo Date: Tue Sep 28 03:31:34 2010 New Revision: 213239 URL: http://svn.freebsd.org/changeset/base/213239 Log: Add AR71XX GPIO bus driver. Added: head/sys/mips/atheros/ar71xx_gpio.c (contents, props changed) head/sys/mips/atheros/ar71xx_gpiovar.h (contents, props changed) Modified: head/sys/mips/atheros/ar71xxreg.h head/sys/mips/atheros/files.ar71xx Added: head/sys/mips/atheros/ar71xx_gpio.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/mips/atheros/ar71xx_gpio.c Tue Sep 28 03:31:34 2010 (r213239) @@ -0,0 +1,446 @@ +/*- + * Copyright (c) 2009, Oleksandr Tymoshenko + * Copyright (c) 2009, Luiz Otavio O Souza. + * 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 unmodified, 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. + */ + +/* + * GPIO driver for AR71xx + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include "gpio_if.h" + +#define DEFAULT_CAPS (GPIO_PIN_INPUT | GPIO_PIN_OUTPUT) + +struct ar71xx_gpio_pin { + const char *name; + int pin; + int flags; +}; + +static struct ar71xx_gpio_pin ar71xx_gpio_pins[] = { + { "RFled", 2, GPIO_PIN_OUTPUT}, + { "SW4", 8, GPIO_PIN_INPUT}, + { NULL, 0, 0}, +}; + +/* + * Helpers + */ +static void ar71xx_gpio_function_enable(struct ar71xx_gpio_softc *sc, + uint32_t mask); +static void ar71xx_gpio_function_disable(struct ar71xx_gpio_softc *sc, + uint32_t mask); +static void ar71xx_gpio_pin_configure(struct ar71xx_gpio_softc *sc, + struct gpio_pin *pin, uint32_t flags); + +/* + * Driver stuff + */ +static int ar71xx_gpio_probe(device_t dev); +static int ar71xx_gpio_attach(device_t dev); +static int ar71xx_gpio_detach(device_t dev); +static int ar71xx_gpio_filter(void *arg); +static void ar71xx_gpio_intr(void *arg); + +/* + * GPIO interface + */ +static int ar71xx_gpio_pin_max(device_t dev, int *maxpin); +static int ar71xx_gpio_pin_getcaps(device_t dev, uint32_t pin, uint32_t *caps); +static int ar71xx_gpio_pin_getflags(device_t dev, uint32_t pin, uint32_t + *flags); +static int ar71xx_gpio_pin_getname(device_t dev, uint32_t pin, char *name); +static int ar71xx_gpio_pin_setflags(device_t dev, uint32_t pin, uint32_t flags); +static int ar71xx_gpio_pin_set(device_t dev, uint32_t pin, unsigned int value); +static int ar71xx_gpio_pin_get(device_t dev, uint32_t pin, unsigned int *val); +static int ar71xx_gpio_pin_toggle(device_t dev, uint32_t pin); + +static void +ar71xx_gpio_function_enable(struct ar71xx_gpio_softc *sc, uint32_t mask) +{ + GPIO_LOCK(sc); + GPIO_SET_BITS(sc, AR71XX_GPIO_FUNCTION, mask); + GPIO_UNLOCK(sc); +} + +static void +ar71xx_gpio_function_disable(struct ar71xx_gpio_softc *sc, uint32_t mask) +{ + GPIO_LOCK(sc); + GPIO_CLEAR_BITS(sc, AR71XX_GPIO_FUNCTION, mask); + GPIO_UNLOCK(sc); +} + +static void +ar71xx_gpio_pin_configure(struct ar71xx_gpio_softc *sc, struct gpio_pin *pin, + unsigned int flags) +{ + uint32_t mask; + + mask = 1 << pin->gp_pin; + GPIO_LOCK(sc); + + /* + * Manage input/output + */ + if (flags & (GPIO_PIN_INPUT|GPIO_PIN_OUTPUT)) { + pin->gp_flags &= ~(GPIO_PIN_INPUT|GPIO_PIN_OUTPUT); + if (flags & GPIO_PIN_OUTPUT) { + pin->gp_flags |= GPIO_PIN_OUTPUT; + GPIO_SET_BITS(sc, AR71XX_GPIO_OE, mask); + } + else { + pin->gp_flags |= GPIO_PIN_INPUT; + GPIO_CLEAR_BITS(sc, AR71XX_GPIO_OE, mask); + } + } + + GPIO_UNLOCK(sc); +} + +static int +ar71xx_gpio_pin_max(device_t dev, int *maxpin) +{ + + *maxpin = AR71XX_GPIO_PINS - 1; + return (0); +} + +static int +ar71xx_gpio_pin_getcaps(device_t dev, uint32_t pin, uint32_t *caps) +{ + struct ar71xx_gpio_softc *sc = device_get_softc(dev); + int i; + + for (i = 0; i < sc->gpio_npins; i++) { + if (sc->gpio_pins[i].gp_pin == pin) + break; + } + + if (i >= sc->gpio_npins) + return (EINVAL); + + GPIO_LOCK(sc); + *caps = sc->gpio_pins[i].gp_caps; + GPIO_UNLOCK(sc); + + return (0); +} + +static int +ar71xx_gpio_pin_getflags(device_t dev, uint32_t pin, uint32_t *flags) +{ + struct ar71xx_gpio_softc *sc = device_get_softc(dev); + int i; + + for (i = 0; i < sc->gpio_npins; i++) { + if (sc->gpio_pins[i].gp_pin == pin) + break; + } + + if (i >= sc->gpio_npins) + return (EINVAL); + + GPIO_LOCK(sc); + *flags = sc->gpio_pins[i].gp_flags; + GPIO_UNLOCK(sc); + + return (0); +} + +static int +ar71xx_gpio_pin_getname(device_t dev, uint32_t pin, char *name) +{ + struct ar71xx_gpio_softc *sc = device_get_softc(dev); + int i; + + for (i = 0; i < sc->gpio_npins; i++) { + if (sc->gpio_pins[i].gp_pin == pin) + break; + } + + if (i >= sc->gpio_npins) + return (EINVAL); + + GPIO_LOCK(sc); + memcpy(name, sc->gpio_pins[i].gp_name, GPIOMAXNAME); + GPIO_UNLOCK(sc); + + return (0); +} + +static int +ar71xx_gpio_pin_setflags(device_t dev, uint32_t pin, uint32_t flags) +{ + int i; + struct ar71xx_gpio_softc *sc = device_get_softc(dev); + + for (i = 0; i < sc->gpio_npins; i++) { + if (sc->gpio_pins[i].gp_pin == pin) + break; + } + + if (i >= sc->gpio_npins) + return (EINVAL); + + /* Filter out unwanted flags */ + if ((flags &= sc->gpio_pins[i].gp_caps) != flags) + return (EINVAL); + + /* Can't mix input/output together */ + if ((flags & (GPIO_PIN_INPUT|GPIO_PIN_OUTPUT)) == + (GPIO_PIN_INPUT|GPIO_PIN_OUTPUT)) + return (EINVAL); + + ar71xx_gpio_pin_configure(sc, &sc->gpio_pins[i], flags); + return (0); +} + +static int +ar71xx_gpio_pin_set(device_t dev, uint32_t pin, unsigned int value) +{ + struct ar71xx_gpio_softc *sc = device_get_softc(dev); + int i; + + for (i = 0; i < sc->gpio_npins; i++) { + if (sc->gpio_pins[i].gp_pin == pin) + break; + } + + if (i >= sc->gpio_npins) + return (EINVAL); + + GPIO_LOCK(sc); + if (value) + GPIO_WRITE(sc, AR71XX_GPIO_SET, (1 << pin)); + else + GPIO_WRITE(sc, AR71XX_GPIO_CLEAR, (1 << pin)); + GPIO_UNLOCK(sc); + + return (0); +} + +static int +ar71xx_gpio_pin_get(device_t dev, uint32_t pin, unsigned int *val) +{ + struct ar71xx_gpio_softc *sc = device_get_softc(dev); + int i; + + for (i = 0; i < sc->gpio_npins; i++) { + if (sc->gpio_pins[i].gp_pin == pin) + break; + } + + if (i >= sc->gpio_npins) + return (EINVAL); + + GPIO_LOCK(sc); + *val = (GPIO_READ(sc, AR71XX_GPIO_IN) & (1 << pin)) ? 1 : 0; + GPIO_UNLOCK(sc); + + return (0); +} + +static int +ar71xx_gpio_pin_toggle(device_t dev, uint32_t pin) +{ + int res, i; + struct ar71xx_gpio_softc *sc = device_get_softc(dev); + + for (i = 0; i < sc->gpio_npins; i++) { + if (sc->gpio_pins[i].gp_pin == pin) + break; + } + + if (i >= sc->gpio_npins) + return (EINVAL); + + GPIO_LOCK(sc); + res = (GPIO_READ(sc, AR71XX_GPIO_IN) & (1 << pin)) ? 1 : 0; + if (res) + GPIO_WRITE(sc, AR71XX_GPIO_CLEAR, (1 << pin)); + else + GPIO_WRITE(sc, AR71XX_GPIO_SET, (1 << pin)); + GPIO_UNLOCK(sc); + + return (0); +} + +static int +ar71xx_gpio_filter(void *arg) +{ + + /* TODO: something useful */ + return (FILTER_STRAY); +} + + + +static void +ar71xx_gpio_intr(void *arg) +{ + struct ar71xx_gpio_softc *sc = arg; + GPIO_LOCK(sc); + /* TODO: something useful */ + GPIO_UNLOCK(sc); +} + +static int +ar71xx_gpio_probe(device_t dev) +{ + + device_set_desc(dev, "Atheros AR71XX GPIO driver"); + return (0); +} + +static int +ar71xx_gpio_attach(device_t dev) +{ + struct ar71xx_gpio_softc *sc = device_get_softc(dev); + int error = 0; + struct ar71xx_gpio_pin *pinp; + int i; + + KASSERT((device_get_unit(dev) == 0), + ("ar71xx_gpio: Only one gpio module supported")); + + mtx_init(&sc->gpio_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK, + MTX_DEF); + + /* Map control/status registers. */ + sc->gpio_mem_rid = 0; + sc->gpio_mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, + &sc->gpio_mem_rid, RF_ACTIVE); + + if (sc->gpio_mem_res == NULL) { + device_printf(dev, "couldn't map memory\n"); + error = ENXIO; + ar71xx_gpio_detach(dev); + return(error); + } + + if ((sc->gpio_irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, + &sc->gpio_irq_rid, RF_SHAREABLE | RF_ACTIVE)) == NULL) { + device_printf(dev, "unable to allocate IRQ resource\n"); + return (ENXIO); + } + + if ((bus_setup_intr(dev, sc->gpio_irq_res, INTR_TYPE_MISC, + ar71xx_gpio_filter, ar71xx_gpio_intr, sc, &sc->gpio_ih))) { + device_printf(dev, + "WARNING: unable to register interrupt handler\n"); + return (ENXIO); + } + + sc->dev = dev; + ar71xx_gpio_function_enable(sc, GPIO_SPI_CS1_EN); + ar71xx_gpio_function_enable(sc, GPIO_SPI_CS2_EN); + /* Configure all pins as input */ + /* disable interrupts for all pins */ + GPIO_WRITE(sc, AR71XX_GPIO_INT_MASK, 0); + pinp = ar71xx_gpio_pins; + i = 0; + while (pinp->name) { + strncpy(sc->gpio_pins[i].gp_name, pinp->name, GPIOMAXNAME); + sc->gpio_pins[i].gp_pin = pinp->pin; + sc->gpio_pins[i].gp_caps = DEFAULT_CAPS; + sc->gpio_pins[i].gp_flags = 0; + ar71xx_gpio_pin_configure(sc, &sc->gpio_pins[i], pinp->flags); + pinp++; + i++; + } + + sc->gpio_npins = i; + + device_add_child(dev, "gpioc", device_get_unit(dev)); + device_add_child(dev, "gpiobus", device_get_unit(dev)); + return (bus_generic_attach(dev)); +} + +static int +ar71xx_gpio_detach(device_t dev) +{ + struct ar71xx_gpio_softc *sc = device_get_softc(dev); + + KASSERT(mtx_initialized(&sc->gpio_mtx), ("gpio mutex not initialized")); + + ar71xx_gpio_function_disable(sc, GPIO_SPI_CS1_EN); + ar71xx_gpio_function_disable(sc, GPIO_SPI_CS2_EN); + bus_generic_detach(dev); + + if (sc->gpio_mem_res) + bus_release_resource(dev, SYS_RES_MEMORY, sc->gpio_mem_rid, + sc->gpio_mem_res); + + mtx_destroy(&sc->gpio_mtx); + + return(0); +} + +static device_method_t ar71xx_gpio_methods[] = { + DEVMETHOD(device_probe, ar71xx_gpio_probe), + DEVMETHOD(device_attach, ar71xx_gpio_attach), + DEVMETHOD(device_detach, ar71xx_gpio_detach), + + /* GPIO protocol */ + DEVMETHOD(gpio_pin_max, ar71xx_gpio_pin_max), + DEVMETHOD(gpio_pin_getname, ar71xx_gpio_pin_getname), + DEVMETHOD(gpio_pin_getflags, ar71xx_gpio_pin_getflags), + DEVMETHOD(gpio_pin_getcaps, ar71xx_gpio_pin_getcaps), + DEVMETHOD(gpio_pin_setflags, ar71xx_gpio_pin_setflags), + DEVMETHOD(gpio_pin_get, ar71xx_gpio_pin_get), + DEVMETHOD(gpio_pin_set, ar71xx_gpio_pin_set), + DEVMETHOD(gpio_pin_toggle, ar71xx_gpio_pin_toggle), + {0, 0}, +}; + +static driver_t ar71xx_gpio_driver = { + "gpio", + ar71xx_gpio_methods, + sizeof(struct ar71xx_gpio_softc), +}; +static devclass_t ar71xx_gpio_devclass; + +DRIVER_MODULE(ar71xx_gpio, apb, ar71xx_gpio_driver, ar71xx_gpio_devclass, 0, 0); Added: head/sys/mips/atheros/ar71xx_gpiovar.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/mips/atheros/ar71xx_gpiovar.h Tue Sep 28 03:31:34 2010 (r213239) @@ -0,0 +1,68 @@ +/*- + * Copyright (c) 2009, Oleksandr Tymoshenko + * Copyright (c) 2009, Luiz Otavio O Souza. + * 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 unmodified, this list of conditions, and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + * + */ + +#ifndef __AR71XX_GPIOVAR_H__ +#define __AR71XX_GPIOVAR_H__ + +#define GPIO_LOCK(_sc) mtx_lock(&(_sc)->gpio_mtx) +#define GPIO_UNLOCK(_sc) mtx_unlock(&(_sc)->gpio_mtx) +#define GPIO_LOCK_ASSERT(_sc) mtx_assert(&(_sc)->gpio_mtx, MA_OWNED) + +/* + * register space access macros + */ +#define GPIO_WRITE(sc, reg, val) do { \ + bus_write_4(sc->gpio_mem_res, (reg), (val)); \ + } while (0) + +#define GPIO_READ(sc, reg) bus_read_4(sc->gpio_mem_res, (reg)) + +#define GPIO_SET_BITS(sc, reg, bits) \ + GPIO_WRITE(sc, reg, GPIO_READ(sc, (reg)) | (bits)) + +#define GPIO_CLEAR_BITS(sc, reg, bits) \ + GPIO_WRITE(sc, reg, GPIO_READ(sc, (reg)) & ~(bits)) + +#define AR71XX_GPIO_PINS 12 + +struct ar71xx_gpio_softc { + device_t dev; + struct mtx gpio_mtx; + struct resource *gpio_mem_res; + int gpio_mem_rid; + struct resource *gpio_irq_res; + int gpio_irq_rid; + void *gpio_ih; + int gpio_npins; + struct gpio_pin gpio_pins[AR71XX_GPIO_PINS]; +}; + +#endif /* __AR71XX_GPIOVAR_H__ */ Modified: head/sys/mips/atheros/ar71xxreg.h ============================================================================== --- head/sys/mips/atheros/ar71xxreg.h Tue Sep 28 03:28:20 2010 (r213238) +++ head/sys/mips/atheros/ar71xxreg.h Tue Sep 28 03:31:34 2010 (r213239) @@ -160,6 +160,21 @@ #define GPIO_FUNC_USB_OC_EN (1 << 4) #define GPIO_FUNC_USB_CLK_EN (0) +#define AR71XX_GPIO_BASE 0x18040000 +#define AR71XX_GPIO_OE 0x00 +#define AR71XX_GPIO_IN 0x04 +#define AR71XX_GPIO_OUT 0x08 +#define AR71XX_GPIO_SET 0x0c +#define AR71XX_GPIO_CLEAR 0x10 +#define AR71XX_GPIO_INT 0x14 +#define AR71XX_GPIO_INT_TYPE 0x18 +#define AR71XX_GPIO_INT_POLARITY 0x1c +#define AR71XX_GPIO_INT_PENDING 0x20 +#define AR71XX_GPIO_INT_MASK 0x24 +#define AR71XX_GPIO_FUNCTION 0x28 +#define GPIO_SPI_CS2_EN (1 << 13) +#define GPIO_SPI_CS1_EN (1 << 12) + #define AR71XX_BASE_FREQ 40000000 #define AR71XX_PLL_CPU_BASE 0x18050000 #define AR71XX_PLL_CPU_CONFIG 0x18050000 Modified: head/sys/mips/atheros/files.ar71xx ============================================================================== --- head/sys/mips/atheros/files.ar71xx Tue Sep 28 03:28:20 2010 (r213238) +++ head/sys/mips/atheros/files.ar71xx Tue Sep 28 03:31:34 2010 (r213239) @@ -1,6 +1,7 @@ # $FreeBSD$ mips/atheros/apb.c standard +mips/atheros/ar71xx_gpio.c optional gpio mips/atheros/ar71xx_machdep.c standard mips/atheros/ar71xx_ehci.c optional ehci mips/atheros/ar71xx_ohci.c optional ohci From owner-svn-src-head@FreeBSD.ORG Tue Sep 28 03:34:51 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C7BB91065670; Tue, 28 Sep 2010 03:34:51 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B70C28FC13; Tue, 28 Sep 2010 03:34:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8S3Yp8f058388; Tue, 28 Sep 2010 03:34:51 GMT (envelope-from gonzo@svn.freebsd.org) Received: (from gonzo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8S3YpPd058385; Tue, 28 Sep 2010 03:34:51 GMT (envelope-from gonzo@svn.freebsd.org) Message-Id: <201009280334.o8S3YpPd058385@svn.freebsd.org> From: Oleksandr Tymoshenko Date: Tue, 28 Sep 2010 03:34:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213240 - head/sys/mips/conf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2010 03:34:51 -0000 Author: gonzo Date: Tue Sep 28 03:34:51 2010 New Revision: 213240 URL: http://svn.freebsd.org/changeset/base/213240 Log: Add GPIO bus to config and hints. Also add sample gpioled device. Modified: head/sys/mips/conf/AR71XX head/sys/mips/conf/AR71XX.hints Modified: head/sys/mips/conf/AR71XX ============================================================================== --- head/sys/mips/conf/AR71XX Tue Sep 28 03:31:34 2010 (r213239) +++ head/sys/mips/conf/AR71XX Tue Sep 28 03:34:51 2010 (r213240) @@ -74,6 +74,9 @@ options USB_EHCI_BIG_ENDIAN_DESC device ohci device ehci +device gpio +device gpioled + device spibus device ar71xx_spi device mx25l Modified: head/sys/mips/conf/AR71XX.hints ============================================================================== --- head/sys/mips/conf/AR71XX.hints Tue Sep 28 03:31:34 2010 (r213239) +++ head/sys/mips/conf/AR71XX.hints Tue Sep 28 03:34:51 2010 (r213240) @@ -47,6 +47,18 @@ hint.arge.1.fduplex=1 # Uncomment this hint for RS (not PRO) # hint.arge.0.phymask=70000 +# GPIO +hint.gpio.0.at="apb0" +hint.gpio.0.maddr=0x18040000 +hint.gpio.0.msize=0x1000 +hint.gpio.0.irq=2 + +# RF led +hint.gpioled.0.at="gpiobus0" +hint.gpioled.0.name="rf" +# pin 2 +hint.gpioled.0.pins=0x0004 + # SPI flash hint.spi.0.at="nexus0" hint.spi.0.maddr=0x1f000000 From owner-svn-src-head@FreeBSD.ORG Tue Sep 28 04:57:56 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8DE58106564A; Tue, 28 Sep 2010 04:57:56 +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 7B76F8FC14; Tue, 28 Sep 2010 04:57: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 o8S4vuYj060044; Tue, 28 Sep 2010 04:57:56 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8S4vuS9060037; Tue, 28 Sep 2010 04:57:56 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201009280457.o8S4vuS9060037@svn.freebsd.org> From: David Xu Date: Tue, 28 Sep 2010 04:57:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213241 - in head: include lib/libthr/thread X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2010 04:57:56 -0000 Author: davidxu Date: Tue Sep 28 04:57:56 2010 New Revision: 213241 URL: http://svn.freebsd.org/changeset/base/213241 Log: In current code, statically initialized and destroyed object have same null value, the code can not distinguish between them, to fix the problem, now a destroyed object is assigned to a non-null value, and it will be rejected by some pthread functions. PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP is changed to number 1, so that adaptive mutex can be statically initialized correctly. Modified: head/include/pthread.h head/lib/libthr/thread/thr_cond.c head/lib/libthr/thread/thr_init.c head/lib/libthr/thread/thr_mutex.c head/lib/libthr/thread/thr_private.h head/lib/libthr/thread/thr_rwlock.c Modified: head/include/pthread.h ============================================================================== --- head/include/pthread.h Tue Sep 28 03:34:51 2010 (r213240) +++ head/include/pthread.h Tue Sep 28 04:57:56 2010 (r213241) @@ -98,7 +98,7 @@ * Static initialization values. */ #define PTHREAD_MUTEX_INITIALIZER NULL -#define PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP NULL +#define PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP ((pthread_mutex_t)1) #define PTHREAD_COND_INITIALIZER NULL #define PTHREAD_RWLOCK_INITIALIZER NULL Modified: head/lib/libthr/thread/thr_cond.c ============================================================================== --- head/lib/libthr/thread/thr_cond.c Tue Sep 28 03:34:51 2010 (r213240) +++ head/lib/libthr/thread/thr_cond.c Tue Sep 28 04:57:56 2010 (r213241) @@ -104,6 +104,19 @@ init_static(struct pthread *thread, pthr return (ret); } +#define CHECK_AND_INIT_COND \ + if (__predict_false((cv = (*cond)) <= THR_COND_DESTROYED)) { \ + if (cv == THR_COND_INITIALIZER) { \ + int ret; \ + ret = init_static(_get_curthread(), cond); \ + if (ret) \ + return (ret); \ + } else if (cv == THR_COND_DESTROYED) { \ + return (EINVAL); \ + } \ + cv = *cond; \ + } + int _pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *cond_attr) { @@ -119,16 +132,14 @@ _pthread_cond_destroy(pthread_cond_t *co struct pthread_cond *cv; int rval = 0; - if (*cond == NULL) + if ((cv = *cond) == THR_COND_INITIALIZER) + rval = 0; + else if (cv == THR_COND_DESTROYED) rval = EINVAL; else { cv = *cond; THR_UMUTEX_LOCK(curthread, &cv->c_lock); - /* - * NULL the caller's pointer now that the condition - * variable has been destroyed: - */ - *cond = NULL; + *cond = THR_COND_DESTROYED; THR_UMUTEX_UNLOCK(curthread, &cv->c_lock); /* @@ -137,7 +148,6 @@ _pthread_cond_destroy(pthread_cond_t *co */ free(cv); } - /* Return the completion status: */ return (rval); } @@ -178,22 +188,18 @@ cond_wait_common(pthread_cond_t *cond, p struct timespec ts, ts2, *tsp; struct cond_cancel_info info; pthread_cond_t cv; - int ret = 0; + int ret; /* * If the condition variable is statically initialized, * perform the dynamic initialization: */ - if (__predict_false(*cond == NULL && - (ret = init_static(curthread, cond)) != 0)) - return (ret); - - _thr_testcancel(curthread); + CHECK_AND_INIT_COND cv = *cond; THR_UMUTEX_LOCK(curthread, &cv->c_lock); ret = _mutex_cv_unlock(mutex, &info.count); - if (ret) { + if (__predict_false(ret != 0)) { THR_UMUTEX_UNLOCK(curthread, &cv->c_lock); return (ret); } @@ -273,11 +279,8 @@ cond_signal_common(pthread_cond_t *cond, * If the condition variable is statically initialized, perform dynamic * initialization. */ - if (__predict_false(*cond == NULL && - (ret = init_static(curthread, cond)) != 0)) - return (ret); + CHECK_AND_INIT_COND - cv = *cond; THR_UMUTEX_LOCK(curthread, &cv->c_lock); if (!broadcast) ret = _thr_ucond_signal(&cv->c_kerncv); Modified: head/lib/libthr/thread/thr_init.c ============================================================================== --- head/lib/libthr/thread/thr_init.c Tue Sep 28 03:34:51 2010 (r213240) +++ head/lib/libthr/thread/thr_init.c Tue Sep 28 04:57:56 2010 (r213241) @@ -92,6 +92,12 @@ struct pthread_mutex_attr _pthread_mutex .m_ceiling = 0 }; +struct pthread_mutex_attr _pthread_mutexattr_adaptive_default = { + .m_type = PTHREAD_MUTEX_ADAPTIVE_NP, + .m_protocol = PTHREAD_PRIO_NONE, + .m_ceiling = 0 +}; + /* Default condition variable attributes: */ struct pthread_cond_attr _pthread_condattr_default = { .c_pshared = PTHREAD_PROCESS_PRIVATE, Modified: head/lib/libthr/thread/thr_mutex.c ============================================================================== --- head/lib/libthr/thread/thr_mutex.c Tue Sep 28 03:34:51 2010 (r213240) +++ head/lib/libthr/thread/thr_mutex.c Tue Sep 28 04:57:56 2010 (r213241) @@ -124,7 +124,7 @@ __weak_reference(_pthread_mutex_isowned_ static int mutex_init(pthread_mutex_t *mutex, - const pthread_mutexattr_t *mutex_attr, + const struct pthread_mutex_attr *mutex_attr, void *(calloc_cb)(size_t, size_t)) { const struct pthread_mutex_attr *attr; @@ -133,7 +133,7 @@ mutex_init(pthread_mutex_t *mutex, if (mutex_attr == NULL) { attr = &_pthread_mutexattr_default; } else { - attr = *mutex_attr; + attr = mutex_attr; if (attr->m_type < PTHREAD_MUTEX_ERRORCHECK || attr->m_type >= PTHREAD_MUTEX_TYPE_MAX) return (EINVAL); @@ -153,6 +153,10 @@ mutex_init(pthread_mutex_t *mutex, pmutex->m_yieldloops = 0; MUTEX_INIT_LINK(pmutex); switch(attr->m_protocol) { + case PTHREAD_PRIO_NONE: + pmutex->m_lock.m_owner = UMUTEX_UNOWNED; + pmutex->m_lock.m_flags = 0; + break; case PTHREAD_PRIO_INHERIT: pmutex->m_lock.m_owner = UMUTEX_UNOWNED; pmutex->m_lock.m_flags = UMUTEX_PRIO_INHERIT; @@ -162,9 +166,6 @@ mutex_init(pthread_mutex_t *mutex, pmutex->m_lock.m_flags = UMUTEX_PRIO_PROTECT; pmutex->m_lock.m_ceilings[0] = attr->m_ceiling; break; - case PTHREAD_PRIO_NONE: - pmutex->m_lock.m_owner = UMUTEX_UNOWNED; - pmutex->m_lock.m_flags = 0; } if (pmutex->m_type == PTHREAD_MUTEX_ADAPTIVE_NP) { @@ -184,11 +185,12 @@ init_static(struct pthread *thread, pthr THR_LOCK_ACQUIRE(thread, &_mutex_static_lock); - if (*mutex == NULL) - ret = mutex_init(mutex, NULL, calloc); + if (*mutex == THR_MUTEX_INITIALIZER) + ret = mutex_init(mutex, &_pthread_mutexattr_default, calloc); + else if (*mutex == THR_ADAPTIVE_MUTEX_INITIALIZER) + ret = mutex_init(mutex, &_pthread_mutexattr_adaptive_default, calloc); else ret = 0; - THR_LOCK_RELEASE(thread, &_mutex_static_lock); return (ret); @@ -210,7 +212,7 @@ int __pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *mutex_attr) { - return mutex_init(mutex, mutex_attr, calloc); + return mutex_init(mutex, mutex_attr ? *mutex_attr : NULL, calloc); } /* This function is used internally by malloc. */ @@ -223,10 +225,9 @@ _pthread_mutex_init_calloc_cb(pthread_mu .m_protocol = PTHREAD_PRIO_NONE, .m_ceiling = 0 }; - static const struct pthread_mutex_attr *pattr = &attr; int ret; - ret = mutex_init(mutex, (pthread_mutexattr_t *)&pattr, calloc_cb); + ret = mutex_init(mutex, &attr, calloc_cb); if (ret == 0) (*mutex)->m_private = 1; return (ret); @@ -261,19 +262,21 @@ _pthread_mutex_destroy(pthread_mutex_t * uint32_t id; int ret = 0; - if (__predict_false(*mutex == NULL)) + m = *mutex; + if (m < THR_MUTEX_DESTROYED) { + ret = 0; + } else if (m == THR_MUTEX_DESTROYED) { ret = EINVAL; - else { + } else { id = TID(curthread); /* * Try to lock the mutex structure, we only need to * try once, if failed, the mutex is in used. */ - ret = _thr_umutex_trylock(&(*mutex)->m_lock, id); + ret = _thr_umutex_trylock(&m->m_lock, id); if (ret) return (ret); - m = *mutex; /* * Check mutex other fields to see if this mutex is * in use. Mostly for prority mutex types, or there @@ -285,11 +288,7 @@ _pthread_mutex_destroy(pthread_mutex_t * _thr_umutex_unlock(&m->m_lock, id); ret = EBUSY; } else { - /* - * Save a pointer to the mutex so it can be free'd - * and set the caller's pointer to NULL. - */ - *mutex = NULL; + *mutex = THR_MUTEX_DESTROYED; if (m->m_lock.m_flags & UMUTEX_PRIO_PROTECT) set_inherited_priority(curthread, m); @@ -314,19 +313,30 @@ _pthread_mutex_destroy(pthread_mutex_t * TAILQ_INSERT_TAIL(&curthread->pp_mutexq, (m), m_qe);\ } while (0) +#define CHECK_AND_INIT_MUTEX \ + if (__predict_false((m = *mutex) <= THR_MUTEX_DESTROYED)) { \ + if (m == THR_MUTEX_DESTROYED) \ + return (EINVAL); \ + int ret; \ + ret = init_static(_get_curthread(), mutex); \ + if (ret) \ + return (ret); \ + m = *mutex; \ + } + static int -mutex_trylock_common(struct pthread *curthread, pthread_mutex_t *mutex) +mutex_trylock_common(pthread_mutex_t *mutex) { - struct pthread_mutex *m; + struct pthread *curthread = _get_curthread(); + struct pthread_mutex *m = *mutex; uint32_t id; int ret; id = TID(curthread); - m = *mutex; if (m->m_private) THR_CRITICAL_ENTER(curthread); ret = _thr_umutex_trylock(&m->m_lock, id); - if (ret == 0) { + if (__predict_true(ret == 0)) { ENQUEUE_MUTEX(curthread, m); } else if (m->m_owner == curthread) { ret = mutex_self_trylock(m); @@ -339,19 +349,11 @@ mutex_trylock_common(struct pthread *cur int __pthread_mutex_trylock(pthread_mutex_t *mutex) { - struct pthread *curthread = _get_curthread(); - int ret; + struct pthread_mutex *m; - /* - * If the mutex is statically initialized, perform the dynamic - * initialization: - */ - if (__predict_false(*mutex == NULL)) { - ret = init_static(curthread, mutex); - if (__predict_false(ret)) - return (ret); - } - return (mutex_trylock_common(curthread, mutex)); + CHECK_AND_INIT_MUTEX + + return (mutex_trylock_common(mutex)); } static int @@ -372,8 +374,10 @@ mutex_lock_sleep(struct pthread *curthre * the lock is likely to be released quickly and it is * faster than entering the kernel */ - if (m->m_lock.m_flags & (UMUTEX_PRIO_PROTECT | UMUTEX_PRIO_INHERIT)) - goto sleep_in_kernel; + if (__predict_false( + (m->m_lock.m_flags & + (UMUTEX_PRIO_PROTECT | UMUTEX_PRIO_INHERIT)) != 0)) + goto sleep_in_kernel; if (!_thr_is_smp) goto yield_loop; @@ -421,9 +425,10 @@ done: } static inline int -mutex_lock_common(struct pthread *curthread, struct pthread_mutex *m, +mutex_lock_common(struct pthread_mutex *m, const struct timespec *abstime) { + struct pthread *curthread = _get_curthread(); int ret; if (m->m_private) @@ -442,50 +447,25 @@ mutex_lock_common(struct pthread *curthr int __pthread_mutex_lock(pthread_mutex_t *mutex) { - struct pthread *curthread; - struct pthread_mutex *m; - int ret; + struct pthread_mutex *m; _thr_check_init(); - curthread = _get_curthread(); + CHECK_AND_INIT_MUTEX - /* - * If the mutex is statically initialized, perform the dynamic - * initialization: - */ - if (__predict_false((m = *mutex) == NULL)) { - ret = init_static(curthread, mutex); - if (__predict_false(ret)) - return (ret); - m = *mutex; - } - - return (mutex_lock_common(curthread, m, NULL)); + return (mutex_lock_common(m, NULL)); } int __pthread_mutex_timedlock(pthread_mutex_t *mutex, const struct timespec *abstime) { - struct pthread *curthread; - struct pthread_mutex *m; - int ret; + struct pthread_mutex *m; _thr_check_init(); - curthread = _get_curthread(); + CHECK_AND_INIT_MUTEX - /* - * If the mutex is statically initialized, perform the dynamic - * initialization: - */ - if (__predict_false((m = *mutex) == NULL)) { - ret = init_static(curthread, mutex); - if (__predict_false(ret)) - return (ret); - m = *mutex; - } - return (mutex_lock_common(curthread, m, abstime)); + return (mutex_lock_common(m, abstime)); } int @@ -495,20 +475,22 @@ _pthread_mutex_unlock(pthread_mutex_t *m } int -_mutex_cv_lock(pthread_mutex_t *m, int count) +_mutex_cv_lock(pthread_mutex_t *mutex, int count) { + struct pthread_mutex *m; int ret; - ret = mutex_lock_common(_get_curthread(), *m, NULL); + m = *mutex; + ret = mutex_lock_common(m, NULL); if (ret == 0) { - (*m)->m_refcount--; - (*m)->m_count += count; + m->m_refcount--; + m->m_count += count; } return (ret); } static int -mutex_self_trylock(pthread_mutex_t m) +mutex_self_trylock(struct pthread_mutex *m) { int ret; @@ -536,7 +518,7 @@ mutex_self_trylock(pthread_mutex_t m) } static int -mutex_self_lock(pthread_mutex_t m, const struct timespec *abstime) +mutex_self_lock(struct pthread_mutex *m, const struct timespec *abstime) { struct timespec ts1, ts2; int ret; @@ -611,8 +593,12 @@ mutex_unlock_common(pthread_mutex_t *mut struct pthread_mutex *m; uint32_t id; - if (__predict_false((m = *mutex) == NULL)) - return (EINVAL); + m = *mutex; + if (__predict_false(m <= THR_MUTEX_DESTROYED)) { + if (m == THR_MUTEX_DESTROYED) + return (EINVAL); + return (EPERM); + } /* * Check if the running thread is not the owner of the mutex. @@ -629,7 +615,7 @@ mutex_unlock_common(pthread_mutex_t *mut m->m_owner = NULL; /* Remove the mutex from the threads queue. */ MUTEX_ASSERT_IS_OWNED(m); - if ((m->m_lock.m_flags & UMUTEX_PRIO_PROTECT) == 0) + if (__predict_true((m->m_lock.m_flags & UMUTEX_PRIO_PROTECT) == 0)) TAILQ_REMOVE(&curthread->mutexq, m, m_qe); else { TAILQ_REMOVE(&curthread->pp_mutexq, m, m_qe); @@ -649,9 +635,7 @@ _mutex_cv_unlock(pthread_mutex_t *mutex, struct pthread *curthread = _get_curthread(); struct pthread_mutex *m; - if (__predict_false((m = *mutex) == NULL)) - return (EINVAL); - + m = *mutex; /* * Check if the running thread is not the owner of the mutex. */ @@ -667,7 +651,7 @@ _mutex_cv_unlock(pthread_mutex_t *mutex, m->m_owner = NULL; /* Remove the mutex from the threads queue. */ MUTEX_ASSERT_IS_OWNED(m); - if ((m->m_lock.m_flags & UMUTEX_PRIO_PROTECT) == 0) + if (__predict_true((m->m_lock.m_flags & UMUTEX_PRIO_PROTECT) == 0)) TAILQ_REMOVE(&curthread->mutexq, m, m_qe); else { TAILQ_REMOVE(&curthread->pp_mutexq, m, m_qe); @@ -685,18 +669,19 @@ int _pthread_mutex_getprioceiling(pthread_mutex_t *mutex, int *prioceiling) { + struct pthread_mutex *m; int ret; - if (*mutex == NULL) - ret = EINVAL; - else if (((*mutex)->m_lock.m_flags & UMUTEX_PRIO_PROTECT) == 0) + m = *mutex; + if ((m <= THR_MUTEX_DESTROYED) || + (m->m_lock.m_flags & UMUTEX_PRIO_PROTECT) == 0) ret = EINVAL; else { - *prioceiling = (*mutex)->m_lock.m_ceilings[0]; + *prioceiling = m->m_lock.m_ceilings[0]; ret = 0; } - return(ret); + return (ret); } int @@ -708,7 +693,8 @@ _pthread_mutex_setprioceiling(pthread_mu int ret; m = *mutex; - if (m == NULL || (m->m_lock.m_flags & UMUTEX_PRIO_PROTECT) == 0) + if ((m <= THR_MUTEX_DESTROYED) || + (m->m_lock.m_flags & UMUTEX_PRIO_PROTECT) == 0) return (EINVAL); ret = __thr_umutex_set_ceiling(&m->m_lock, ceiling, old_ceiling); @@ -737,61 +723,54 @@ _pthread_mutex_setprioceiling(pthread_mu int _pthread_mutex_getspinloops_np(pthread_mutex_t *mutex, int *count) { - if (*mutex == NULL) - return (EINVAL); - *count = (*mutex)->m_spinloops; + struct pthread_mutex *m; + + CHECK_AND_INIT_MUTEX + + *count = m->m_spinloops; return (0); } int __pthread_mutex_setspinloops_np(pthread_mutex_t *mutex, int count) { - struct pthread *curthread = _get_curthread(); - int ret; + struct pthread_mutex *m; - if (__predict_false(*mutex == NULL)) { - ret = init_static(curthread, mutex); - if (__predict_false(ret)) - return (ret); - } - (*mutex)->m_spinloops = count; + CHECK_AND_INIT_MUTEX + + m->m_spinloops = count; return (0); } int _pthread_mutex_getyieldloops_np(pthread_mutex_t *mutex, int *count) { - if (*mutex == NULL) - return (EINVAL); - *count = (*mutex)->m_yieldloops; + struct pthread_mutex *m; + + CHECK_AND_INIT_MUTEX + + *count = m->m_yieldloops; return (0); } int __pthread_mutex_setyieldloops_np(pthread_mutex_t *mutex, int count) { - struct pthread *curthread = _get_curthread(); - int ret; + struct pthread_mutex *m; - if (__predict_false(*mutex == NULL)) { - ret = init_static(curthread, mutex); - if (__predict_false(ret)) - return (ret); - } - (*mutex)->m_yieldloops = count; + CHECK_AND_INIT_MUTEX + + m->m_yieldloops = count; return (0); } int _pthread_mutex_isowned_np(pthread_mutex_t *mutex) { - struct pthread *curthread = _get_curthread(); - int ret; + struct pthread_mutex *m; - if (__predict_false(*mutex == NULL)) { - ret = init_static(curthread, mutex); - if (__predict_false(ret)) - return (ret); - } - return ((*mutex)->m_owner == curthread); + m = *mutex; + if (m <= THR_MUTEX_DESTROYED) + return (0); + return (m->m_owner == _get_curthread()); } Modified: head/lib/libthr/thread/thr_private.h ============================================================================== --- head/lib/libthr/thread/thr_private.h Tue Sep 28 03:34:51 2010 (r213240) +++ head/lib/libthr/thread/thr_private.h Tue Sep 28 04:57:56 2010 (r213241) @@ -125,6 +125,15 @@ TAILQ_HEAD(mutex_queue, pthread_mutex); } \ } while (0) +/* XXX These values should be same as those defined in pthread.h */ +#define THR_MUTEX_INITIALIZER ((struct pthread_mutex *)NULL) +#define THR_ADAPTIVE_MUTEX_INITIALIZER ((struct pthread_mutex *)1) +#define THR_MUTEX_DESTROYED ((struct pthread_mutex *)2) +#define THR_COND_INITIALIZER ((struct pthread_cond *)NULL) +#define THR_COND_DESTROYED ((struct pthread_cond *)1) +#define THR_RWLOCK_INITIALIZER ((struct pthread_rwlock *)NULL) +#define THR_RWLOCK_DESTROYED ((struct pthread_rwlock *)1) + struct pthread_mutex { /* * Lock for accesses to this structure. @@ -627,6 +636,7 @@ extern struct pthread_attr _pthread_attr /* Default mutex attributes: */ extern struct pthread_mutex_attr _pthread_mutexattr_default __hidden; +extern struct pthread_mutex_attr _pthread_mutexattr_adaptive_default __hidden; /* Default condition variable attributes: */ extern struct pthread_cond_attr _pthread_condattr_default __hidden; Modified: head/lib/libthr/thread/thr_rwlock.c ============================================================================== --- head/lib/libthr/thread/thr_rwlock.c Tue Sep 28 03:34:51 2010 (r213240) +++ head/lib/libthr/thread/thr_rwlock.c Tue Sep 28 04:57:56 2010 (r213241) @@ -45,6 +45,19 @@ __weak_reference(_pthread_rwlock_unlock, __weak_reference(_pthread_rwlock_wrlock, pthread_rwlock_wrlock); __weak_reference(_pthread_rwlock_timedwrlock, pthread_rwlock_timedwrlock); +#define CHECK_AND_INIT_RWLOCK \ + if (__predict_false((prwlock = (*rwlock)) <= THR_RWLOCK_DESTROYED)) { \ + if (prwlock == THR_RWLOCK_INITIALIZER) { \ + int ret; \ + ret = init_static(_get_curthread(), rwlock); \ + if (ret) \ + return (ret); \ + } else if (prwlock == THR_RWLOCK_DESTROYED) { \ + return (EINVAL); \ + } \ + prwlock = *rwlock; \ + } + /* * Prototypes */ @@ -64,15 +77,16 @@ rwlock_init(pthread_rwlock_t *rwlock, co int _pthread_rwlock_destroy (pthread_rwlock_t *rwlock) { + pthread_rwlock_t prwlock; int ret; - if (rwlock == NULL) + prwlock = *rwlock; + if (prwlock == THR_RWLOCK_INITIALIZER) + ret = 0; + else if (prwlock == THR_RWLOCK_DESTROYED) ret = EINVAL; else { - pthread_rwlock_t prwlock; - - prwlock = *rwlock; - *rwlock = NULL; + *rwlock = THR_RWLOCK_DESTROYED; free(prwlock); ret = 0; @@ -87,7 +101,7 @@ init_static(struct pthread *thread, pthr THR_LOCK_ACQUIRE(thread, &_rwlock_static_lock); - if (*rwlock == NULL) + if (*rwlock == THR_RWLOCK_INITIALIZER) ret = rwlock_init(rwlock, NULL); else ret = 0; @@ -113,18 +127,7 @@ rwlock_rdlock_common(pthread_rwlock_t *r int flags; int ret; - if (__predict_false(rwlock == NULL)) - return (EINVAL); - - prwlock = *rwlock; - - /* check for static initialization */ - if (__predict_false(prwlock == NULL)) { - if ((ret = init_static(curthread, rwlock)) != 0) - return (ret); - - prwlock = *rwlock; - } + CHECK_AND_INIT_RWLOCK if (curthread->rdlock_count) { /* @@ -206,18 +209,7 @@ _pthread_rwlock_tryrdlock (pthread_rwloc int flags; int ret; - if (__predict_false(rwlock == NULL)) - return (EINVAL); - - prwlock = *rwlock; - - /* check for static initialization */ - if (__predict_false(prwlock == NULL)) { - if ((ret = init_static(curthread, rwlock)) != 0) - return (ret); - - prwlock = *rwlock; - } + CHECK_AND_INIT_RWLOCK if (curthread->rdlock_count) { /* @@ -250,18 +242,7 @@ _pthread_rwlock_trywrlock (pthread_rwloc pthread_rwlock_t prwlock; int ret; - if (__predict_false(rwlock == NULL)) - return (EINVAL); - - prwlock = *rwlock; - - /* check for static initialization */ - if (__predict_false(prwlock == NULL)) { - if ((ret = init_static(curthread, rwlock)) != 0) - return (ret); - - prwlock = *rwlock; - } + CHECK_AND_INIT_RWLOCK ret = _thr_rwlock_trywrlock(&prwlock->lock); if (ret == 0) @@ -277,18 +258,7 @@ rwlock_wrlock_common (pthread_rwlock_t * struct timespec ts, ts2, *tsp; int ret; - if (__predict_false(rwlock == NULL)) - return (EINVAL); - - prwlock = *rwlock; - - /* check for static initialization */ - if (__predict_false(prwlock == NULL)) { - if ((ret = init_static(curthread, rwlock)) != 0) - return (ret); - - prwlock = *rwlock; - } + CHECK_AND_INIT_RWLOCK /* * POSIX said the validity of the abstimeout parameter need @@ -356,12 +326,9 @@ _pthread_rwlock_unlock (pthread_rwlock_t int ret; int32_t state; - if (__predict_false(rwlock == NULL)) - return (EINVAL); - prwlock = *rwlock; - if (__predict_false(prwlock == NULL)) + if (__predict_false(prwlock <= THR_RWLOCK_DESTROYED)) return (EINVAL); state = prwlock->lock.rw_state; From owner-svn-src-head@FreeBSD.ORG Tue Sep 28 07:28:12 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A68BC10656C3; Tue, 28 Sep 2010 07:28:12 +0000 (UTC) (envelope-from niclas.zeising@gmail.com) Received: from mxf1.bahnhof.se (mxf1.bahnhof.se [213.80.101.25]) by mx1.freebsd.org (Postfix) with ESMTP id 5C76D8FC23; Tue, 28 Sep 2010 07:28:12 +0000 (UTC) Received: from localhost (mxf1.local [127.0.0.1]) by mxf1-reinject (Postfix) with ESMTP id 2D78B1E3274; Tue, 28 Sep 2010 09:28:11 +0200 (CEST) X-Virus-Scanned: by amavisd-new using ClamAV at bahnhof.se (MXF1) X-Spam-Score: 2.819 X-Spam-Level: ** X-Spam-Status: No, score=2.819 tagged_above=-99 required=5 tests=[DNS_FROM_RFC_POST=1.44, SPF_NEUTRAL=1.379] Received: from mxf1.bahnhof.se ([127.0.0.1]) by localhost (mxf1.bahnhof.se [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id XMDWryKl3up5; Tue, 28 Sep 2010 09:28:07 +0200 (CEST) Received: from [10.32.0.4] (h-90-99.A163.priv.bahnhof.se [79.136.90.99]) by mxf1.bahnhof.se (Postfix) with ESMTP id 1744C1E3277; Tue, 28 Sep 2010 09:28:07 +0200 (CEST) Message-ID: <4CA19904.1020702@gmail.com> Date: Tue, 28 Sep 2010 09:28:04 +0200 From: Niclas Zeising User-Agent: Mutt/1.5.21 MIME-Version: 1.0 To: Oleksandr Tymoshenko References: <201009280328.o8S3SKLY058170@svn.freebsd.org> In-Reply-To: <201009280328.o8S3SKLY058170@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r213238 - in head/usr.sbin: . gpioctl X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2010 07:28:12 -0000 On 2010-09-28 05:28, Oleksandr Tymoshenko wrote: > Author: gonzo > Date: Tue Sep 28 03:28:20 2010 > New Revision: 213238 > URL: http://svn.freebsd.org/changeset/base/213238 > > Log: > Add gpioctl(8). Utility for configuring/accessing GPIO pins > > Added: > head/usr.sbin/gpioctl/ > head/usr.sbin/gpioctl/Makefile (contents, props changed) > head/usr.sbin/gpioctl/gpioctl.8 (contents, props changed) > head/usr.sbin/gpioctl/gpioctl.c (contents, props changed) > Modified: > head/usr.sbin/Makefile > > Modified: head/usr.sbin/Makefile > ============================================================================== > --- head/usr.sbin/Makefile Tue Sep 28 03:24:53 2010 (r213237) > +++ head/usr.sbin/Makefile Tue Sep 28 03:28:20 2010 (r213238) > @@ -27,6 +27,7 @@ SUBDIR= adduser \ > fwcontrol \ > getfmac \ > getpmac \ > + gpioctl \ > gstat \ > i2c \ > ifmcstat \ > This should probably be made conditional on MK_GPIO. Thank you for your work! Regards! Niclas From owner-svn-src-head@FreeBSD.ORG Tue Sep 28 09:07:01 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1E80B106566C; Tue, 28 Sep 2010 09:07:01 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0D45F8FC15; Tue, 28 Sep 2010 09:07: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 o8S970bO065737; Tue, 28 Sep 2010 09:07:00 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8S970BR065735; Tue, 28 Sep 2010 09:07:00 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201009280907.o8S970BR065735@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Tue, 28 Sep 2010 09:07:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213245 - head/sbin/geom/class/part X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2010 09:07:01 -0000 Author: pjd Date: Tue Sep 28 09:07:00 2010 New Revision: 213245 URL: http://svn.freebsd.org/changeset/base/213245 Log: Document recently added GPT attributes (bootme, bootonce, bootfailed) and list other schemes attributes. Reviewed by: simon, rpaulo MFC after: 2 weeks Modified: head/sbin/geom/class/part/gpart.8 Modified: head/sbin/geom/class/part/gpart.8 ============================================================================== --- head/sbin/geom/class/part/gpart.8 Tue Sep 28 06:08:43 2010 (r213244) +++ head/sbin/geom/class/part/gpart.8 Tue Sep 28 09:07:00 2010 (r213245) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd Sep 24, 2010 +.Dd September 28, 2010 .Dt GPART 8 .Os .Sh NAME @@ -382,6 +382,9 @@ about its use. .\" ==== SET ==== .It Cm set Set the named attribute on the partition entry. +See the section entitled +.Sx "ATTRIBUTES" +below for a list of available attributes. .Pp Additional options include: .Bl -tag -width 10n @@ -406,6 +409,9 @@ action and can be used to undo any chang .\" ==== UNSET ==== .It Cm unset Clear the named attribute on the partition entry. +See the section entitled +.Sx "ATTRIBUTES" +below for a list of available attributes. .Pp Additional options include: .Bl -tag -width 10n @@ -502,6 +508,103 @@ This type is known as .Qq Li "!024dee41-33e7-11d3-9d69-0008c781f39f" by GPT. .El +.Sh ATTRIBUTES +The scheme-specific attributes for EBR: +.Bl -tag -width ".Ar active" +.It Ar active +.El +.Pp +The scheme-specific attributes for GPT: +.Bl -tag -width ".Ar bootfailed" +.It Ar bootme +When set, the +.Nm gptboot +stage 1 boot loader will try to boot the system from this partition. +Multiple partitions might be marked with the +.Ar bootme +attribute. +In such scenario the +.Nm gptboot +will try all +.Ar bootme +partitions one by one, until the next boot stage is successfully entered. +.It Ar bootonce +Setting this attribute automatically sets the +.Ar bootme +attribute. +When set, the +.Nm gptboot +stage 1 boot loader will try to boot the system from this partition only once. +Partitions with both +.Ar bootonce +and +.Ar bootme +attributes are tried before partitions with only the +.Ar bootme +attribute. +Before +.Ar bootonce +partition is tried, the +.Nm gptboot +removes the +.Ar bootme +attribute and tries to execute the next boot stage. +If it fails, the +.Ar bootonce +attribute that is now alone is replaced with the +.Ar bootfailed +attribute. +If the execution of the next boot stage succeeds, but the system is not fully +booted, the +.Nm gptboot +will look for +.Ar bootonce +attributes alone (without the +.Ar bootme +attribute) on the next system boot and will replace those with the +.Ar bootfailed +attribute. +If the system is fully booted, the +.Pa /etc/rc.d/gptboot +start-up script will look for partition with the +.Ar bootonce +attribute alone, will remove the attribute and log that the system was +successfully booted from this partition. +There should be at most one +.Ar bootonce +partition when system is successfully booted. +Multiple partitions might be marked with the +.Ar bootonce +and +.Ar bootme +attribute pairs. +.It Ar bootfailed +This attribute should not be manually managed. +It is managed by the +.Nm gptboot +stage 1 boot loader and the +.Pa /etc/rc.d/gptboot +start-up script. +This attribute is used to mark partitions that had the +.Ar bootonce +attribute set, but we failed to boot from them. +Once we successfully boot, the +.Pa /etc/rc.d/gptboot +script will log all the partitions we failed to boot from and will remove the +.Ar bootfailed +attributes. +.El +.Pp +The scheme-specific attributes for MBR: +.Bl -tag -width ".Ar active" +.It Ar active +.El +.Pp +The scheme-specific attributes for PC98: +.Bl -tag -width ".Ar bootable" +.It Ar active +.It Ar bootable +.El .Sh OPERATIONAL FLAGS Actions other than the .Cm commit From owner-svn-src-head@FreeBSD.ORG Tue Sep 28 10:08:46 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C986C1065694; Tue, 28 Sep 2010 10:08:46 +0000 (UTC) (envelope-from alexander@leidinger.net) Received: from mail.ebusiness-leidinger.de (mail.ebusiness-leidinger.de [217.11.53.44]) by mx1.freebsd.org (Postfix) with ESMTP id 774308FC24; Tue, 28 Sep 2010 10:08:46 +0000 (UTC) Received: from outgoing.leidinger.net (p57B3B90B.dip.t-dialin.net [87.179.185.11]) by mail.ebusiness-leidinger.de (Postfix) with ESMTPSA id 8143984400A; Tue, 28 Sep 2010 11:49:18 +0200 (CEST) Received: from webmail.leidinger.net (unknown [IPv6:fd73:10c7:2053:1::2:102]) by outgoing.leidinger.net (Postfix) with ESMTP id 6BDAC193D; Tue, 28 Sep 2010 11:49:15 +0200 (CEST) Received: (from www@localhost) by webmail.leidinger.net (8.14.4/8.13.8/Submit) id o8S9nCgW066608; Tue, 28 Sep 2010 11:49:12 +0200 (CEST) (envelope-from Alexander@Leidinger.net) Received: from pslux.ec.europa.eu (pslux.ec.europa.eu [158.169.9.14]) by webmail.leidinger.net (Horde Framework) with HTTP; Tue, 28 Sep 2010 11:49:12 +0200 Message-ID: <20100928114912.17443a2o7j71kpaw@webmail.leidinger.net> Date: Tue, 28 Sep 2010 11:49:12 +0200 From: Alexander Leidinger To: John Baldwin References: <201009211507.o8LF7iVv097676@svn.freebsd.org> <20100924225352.GD49476@server.vk2pj.dyndns.org> <201009270928.47232.jhb@freebsd.org> In-Reply-To: <201009270928.47232.jhb@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; DelSp="Yes"; format="flowed" Content-Disposition: inline Content-Transfer-Encoding: 7bit User-Agent: Dynamic Internet Messaging Program (DIMP) H3 (1.1.4) X-EBL-MailScanner-Information: Please contact the ISP for more information X-EBL-MailScanner-ID: 8143984400A.A6EFC X-EBL-MailScanner: Found to be clean X-EBL-MailScanner-SpamCheck: not spam, spamhaus-ZEN, SpamAssassin (not cached, score=1.351, required 6, autolearn=disabled, RDNS_NONE 1.27, TW_SV 0.08) X-EBL-MailScanner-SpamScore: s X-EBL-MailScanner-From: alexander@leidinger.net X-EBL-MailScanner-Watermark: 1286272160.18906@ARPINEuCoVZS+Y+Z0zA5pA X-EBL-Spam-Status: No X-Mailman-Approved-At: Tue, 28 Sep 2010 11:20:51 +0000 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Peter Jeremy , freebsd-arch@freebsd.org Subject: Re: svn commit: r212964 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2010 10:08:46 -0000 Quoting John Baldwin (from Mon, 27 Sep 2010 09:28:47 -0400): >> savecore already has support for a 'minfree' file to prevent >> crashdumps filling the crashdir. Maybe the default install should >> include a minfree set to (say) 512MB. > > The one problem this approach is it implements a FIFO instead of a LIFO. I > want the N most recent crashdumps to be saved, not the first N. Check the size in the shell script before, remove older ones ("ls -1t | grep pattern | tail +" gives you possible candidates). Bye, Alexander. -- Applause, n.: The echo of a platitude from the mouth of a fool. -- Ambrose Bierce, "The Devil's Dictionary" http://www.Leidinger.net Alexander @ Leidinger.net: PGP ID = B0063FE7 http://www.FreeBSD.org netchild @ FreeBSD.org : PGP ID = 72077137 From owner-svn-src-head@FreeBSD.ORG Tue Sep 28 11:32:17 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AAC86106566B; Tue, 28 Sep 2010 11:32:17 +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 9927C8FC16; Tue, 28 Sep 2010 11:32: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 o8SBWHaV073215; Tue, 28 Sep 2010 11:32:17 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8SBWHMA073213; Tue, 28 Sep 2010 11:32:17 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201009281132.o8SBWHMA073213@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 28 Sep 2010 11:32:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213246 - head/sys/compat/linprocfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2010 11:32:17 -0000 Author: kib Date: Tue Sep 28 11:32:17 2010 New Revision: 213246 URL: http://svn.freebsd.org/changeset/base/213246 Log: In linprocfs_doargv(): - handle compat32 processes; - remove the checks for copied in addresses to belong into valid usermode range, proc_rwmem() does this; - simplify loop reading single string, limit the total amount of strings collected by ARG_MAX bytes; - correctly add '\0' at the end of each copied string; - fix style. In linprocfs_doprocenviron(): - unlock the process before calling copyin code [1]. The process is held by pseudofs. In linprocfs_doproccmdline: - use linprocfs_doargv() to handle !curproc case for which p_args is not cached. Reported by: plulnet [1] Tested by: pluknet Approved by: des (linprocfs maintainer, previous version of the patch) MFC after: 3 weeks Modified: head/sys/compat/linprocfs/linprocfs.c Modified: head/sys/compat/linprocfs/linprocfs.c ============================================================================== --- head/sys/compat/linprocfs/linprocfs.c Tue Sep 28 09:07:00 2010 (r213245) +++ head/sys/compat/linprocfs/linprocfs.c Tue Sep 28 11:32:17 2010 (r213246) @@ -61,6 +61,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -96,6 +97,10 @@ __FBSDID("$FreeBSD$"); #include #endif /* __i386__ || __amd64__ */ +#ifdef COMPAT_FREEBSD32 +#include +#endif + #ifdef COMPAT_LINUX32 /* XXX */ #include #else @@ -886,78 +891,24 @@ linprocfs_doprocroot(PFS_FILL_ARGS) return (0); } -/* - * Filler function for proc/pid/cmdline - */ -static int -linprocfs_doproccmdline(PFS_FILL_ARGS) -{ - struct ps_strings pstr; - char **ps_argvstr; - int error, i; - - /* - * If we are using the ps/cmdline caching, use that. Otherwise - * revert back to the old way which only implements full cmdline - * for the currept process and just p->p_comm for all other - * processes. - * Note that if the argv is no longer available, we deliberately - * don't fall back on p->p_comm or return an error: the authentic - * Linux behaviour is to return zero-length in this case. - */ - - PROC_LOCK(p); - if (p->p_args && p_cansee(td, p) == 0) { - sbuf_bcpy(sb, p->p_args->ar_args, p->p_args->ar_length); - PROC_UNLOCK(p); - } else if (p != td->td_proc) { - PROC_UNLOCK(p); - sbuf_printf(sb, "%.*s", MAXCOMLEN, p->p_comm); - } else { - PROC_UNLOCK(p); - error = copyin((void *)p->p_sysent->sv_psstrings, &pstr, - sizeof(pstr)); - if (error) - return (error); - if (pstr.ps_nargvstr > ARG_MAX) - return (E2BIG); - ps_argvstr = malloc(pstr.ps_nargvstr * sizeof(char *), - M_TEMP, M_WAITOK); - error = copyin((void *)pstr.ps_argvstr, ps_argvstr, - pstr.ps_nargvstr * sizeof(char *)); - if (error) { - free(ps_argvstr, M_TEMP); - return (error); - } - for (i = 0; i < pstr.ps_nargvstr; i++) { - sbuf_copyin(sb, ps_argvstr[i], 0); - sbuf_printf(sb, "%c", '\0'); - } - free(ps_argvstr, M_TEMP); - } - - return (0); -} - -extern int proc_rwmem(struct proc *p, struct uio *uio); - #define MAX_ARGV_STR 512 /* Max number of argv-like strings */ #define UIO_CHUNK_SZ 256 /* Max chunk size (bytes) for uiomove */ static int linprocfs_doargv(struct thread *td, struct proc *p, struct sbuf *sb, - void (*resolver)(const struct ps_strings, u_long *, int *)) + void (*resolver)(const struct ps_strings, u_long *, int *)) { struct iovec iov; struct uio tmp_uio; struct ps_strings pss; - int ret, i, n_elements, found_end; - u_long addr; - char* env_vector[MAX_ARGV_STR]; + int ret, i, n_elements, elm_len; + u_long addr, pbegin; + char **env_vector, *envp; char env_string[UIO_CHUNK_SZ]; - char *pbegin; - - +#ifdef COMPAT_FREEBSD32 + struct freebsd32_ps_strings pss32; + uint32_t *env_vector32; +#endif #define UIO_HELPER(uio, iov, base, len, cnt, offset, sz, flg, rw, td) \ do { \ @@ -972,62 +923,108 @@ do { \ uio.uio_td = (td); \ } while (0) - UIO_HELPER(tmp_uio, iov, &pss, sizeof(struct ps_strings), 1, - (off_t)(p->p_sysent->sv_psstrings), sizeof(struct ps_strings), - UIO_SYSSPACE, UIO_READ, td); + env_vector = malloc(sizeof(char *) * MAX_ARGV_STR, M_TEMP, M_WAITOK); - ret = proc_rwmem(p, &tmp_uio); - if (ret != 0) - return ret; +#ifdef COMPAT_FREEBSD32 + env_vector32 = NULL; + if ((p->p_sysent->sv_flags & SV_ILP32) != 0) { + env_vector32 = malloc(sizeof(*env_vector32) * MAX_ARGV_STR, + M_TEMP, M_WAITOK); + elm_len = sizeof(int32_t); + envp = (char *)env_vector32; + + UIO_HELPER(tmp_uio, iov, &pss32, sizeof(pss32), 1, + (off_t)(p->p_sysent->sv_psstrings), + sizeof(pss32), UIO_SYSSPACE, UIO_READ, td); + ret = proc_rwmem(p, &tmp_uio); + if (ret != 0) + goto done; + pss.ps_argvstr = PTRIN(pss32.ps_argvstr); + pss.ps_nargvstr = pss32.ps_nargvstr; + pss.ps_envstr = PTRIN(pss32.ps_envstr); + pss.ps_nenvstr = pss32.ps_nenvstr; + } else { +#endif + elm_len = sizeof(char *); + envp = (char *)env_vector; + + UIO_HELPER(tmp_uio, iov, &pss, sizeof(pss), 1, + (off_t)(p->p_sysent->sv_psstrings), + sizeof(pss), UIO_SYSSPACE, UIO_READ, td); + ret = proc_rwmem(p, &tmp_uio); + if (ret != 0) + goto done; +#ifdef COMPAT_FREEBSD32 + } +#endif /* Get the array address and the number of elements */ resolver(pss, &addr, &n_elements); /* Consistent with lib/libkvm/kvm_proc.c */ - if (n_elements > MAX_ARGV_STR || (u_long)addr < VM_MIN_ADDRESS || - (u_long)addr >= VM_MAXUSER_ADDRESS) { - /* What error code should we return? */ - return 0; + if (n_elements > MAX_ARGV_STR) { + ret = E2BIG; + goto done; } - UIO_HELPER(tmp_uio, iov, env_vector, MAX_ARGV_STR, 1, + UIO_HELPER(tmp_uio, iov, envp, n_elements * elm_len, 1, (vm_offset_t)(addr), iov.iov_len, UIO_SYSSPACE, UIO_READ, td); - ret = proc_rwmem(p, &tmp_uio); if (ret != 0) - return ret; + goto done; +#ifdef COMPAT_FREEBSD32 + if (env_vector32 != NULL) { + for (i = 0; i < n_elements; i++) + env_vector[i] = PTRIN(env_vector32[i]); + } +#endif /* Now we can iterate through the list of strings */ for (i = 0; i < n_elements; i++) { - found_end = 0; - pbegin = env_vector[i]; - while(!found_end) { - UIO_HELPER(tmp_uio, iov, env_string, sizeof(env_string), 1, - (vm_offset_t) pbegin, iov.iov_len, UIO_SYSSPACE, - UIO_READ, td); - + pbegin = (vm_offset_t)env_vector[i]; + for (;;) { + UIO_HELPER(tmp_uio, iov, env_string, sizeof(env_string), + 1, pbegin, iov.iov_len, UIO_SYSSPACE, UIO_READ, td); ret = proc_rwmem(p, &tmp_uio); if (ret != 0) - return ret; + goto done; if (!strvalid(env_string, UIO_CHUNK_SZ)) { - /* - * We didn't find the end of the string - * Add the string to the buffer and move - * the pointer - */ - sbuf_bcat(sb, env_string, UIO_CHUNK_SZ); - pbegin = &(*pbegin) + UIO_CHUNK_SZ; + /* + * We didn't find the end of the string. + * Add the string to the buffer and move + * the pointer. But do not allow strings + * of unlimited length. + */ + sbuf_bcat(sb, env_string, UIO_CHUNK_SZ); + if (sbuf_len(sb) >= ARG_MAX) { + ret = E2BIG; + goto done; + } + pbegin += UIO_CHUNK_SZ; } else { - found_end = 1; + sbuf_cat(sb, env_string); + break; } } - sbuf_printf(sb, "%s", env_string); + sbuf_bcat(sb, "", 1); } - #undef UIO_HELPER - return (0); +done: + free(env_vector, M_TEMP); +#ifdef COMPAT_FREEBSD32 + free(env_vector32, M_TEMP); +#endif + return (ret); +} + +static void +ps_string_argv(const struct ps_strings ps, u_long *addr, int *n) +{ + + *addr = (u_long) ps.ps_argvstr; + *n = ps.ps_nargvstr; } static void @@ -1039,6 +1036,30 @@ ps_string_env(const struct ps_strings ps } /* + * Filler function for proc/pid/cmdline + */ +static int +linprocfs_doproccmdline(PFS_FILL_ARGS) +{ + int ret; + + PROC_LOCK(p); + if ((ret = p_cansee(td, p)) != 0) { + PROC_UNLOCK(p); + return (ret); + } + if (p->p_args != NULL) { + sbuf_bcpy(sb, p->p_args->ar_args, p->p_args->ar_length); + PROC_UNLOCK(p); + return (0); + } + PROC_UNLOCK(p); + + ret = linprocfs_doargv(td, p, sb, ps_string_argv); + return (ret); +} + +/* * Filler function for proc/pid/environ */ static int @@ -1047,14 +1068,13 @@ linprocfs_doprocenviron(PFS_FILL_ARGS) int ret; PROC_LOCK(p); - if ((ret = p_cansee(td, p)) != 0) { PROC_UNLOCK(p); - return ret; + return (ret); } + PROC_UNLOCK(p); ret = linprocfs_doargv(td, p, sb, ps_string_env); - PROC_UNLOCK(p); return (ret); } From owner-svn-src-head@FreeBSD.ORG Tue Sep 28 15:25:57 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0C7E6106566C; Tue, 28 Sep 2010 15:25:57 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id D206B8FC08; Tue, 28 Sep 2010 15:25:56 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 815EE46B8A; Tue, 28 Sep 2010 11:25:56 -0400 (EDT) Received: from jhbbsd.localnet (smtp.hudson-trading.com [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 0812A8A04E; Tue, 28 Sep 2010 11:25:55 -0400 (EDT) From: John Baldwin To: David Xu Date: Tue, 28 Sep 2010 09:31:59 -0400 User-Agent: KMail/1.13.5 (FreeBSD/7.3-CBSD-20100819; KDE/4.4.5; amd64; ; ) References: <201009280457.o8S4vuS9060037@svn.freebsd.org> In-Reply-To: <201009280457.o8S4vuS9060037@svn.freebsd.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201009280931.59163.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Tue, 28 Sep 2010 11:25:55 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.6 required=4.2 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r213241 - in head: include lib/libthr/thread X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2010 15:25:57 -0000 On Tuesday, September 28, 2010 12:57:56 am David Xu wrote: > Author: davidxu > Date: Tue Sep 28 04:57:56 2010 > New Revision: 213241 > URL: http://svn.freebsd.org/changeset/base/213241 > > Log: > In current code, statically initialized and destroyed object have > same null value, the code can not distinguish between them, to > fix the problem, now a destroyed object is assigned to a non-null > value, and it will be rejected by some pthread functions. > PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP is changed to number 1, so that > adaptive mutex can be statically initialized correctly. Does this fix PR threads/150889 then? -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Tue Sep 28 15:26:05 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0B05A10656D8; Tue, 28 Sep 2010 15:25:59 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 52B778FC1D; Tue, 28 Sep 2010 15:25:59 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 0431446B9B; Tue, 28 Sep 2010 11:25:59 -0400 (EDT) Received: from jhbbsd.localnet (smtp.hudson-trading.com [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 2916F8A050; Tue, 28 Sep 2010 11:25:58 -0400 (EDT) From: John Baldwin To: Alexander Leidinger Date: Tue, 28 Sep 2010 09:37:25 -0400 User-Agent: KMail/1.13.5 (FreeBSD/7.3-CBSD-20100819; KDE/4.4.5; amd64; ; ) References: <201009211507.o8LF7iVv097676@svn.freebsd.org> <201009270928.47232.jhb@freebsd.org> <20100928114912.17443a2o7j71kpaw@webmail.leidinger.net> In-Reply-To: <20100928114912.17443a2o7j71kpaw@webmail.leidinger.net> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201009280937.25619.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Tue, 28 Sep 2010 11:25:58 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.6 required=4.2 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Peter Jeremy , freebsd-arch@freebsd.org Subject: Re: svn commit: r212964 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2010 15:26:05 -0000 On Tuesday, September 28, 2010 5:49:12 am Alexander Leidinger wrote: > Quoting John Baldwin (from Mon, 27 Sep 2010 09:28:47 -0400): > > >> savecore already has support for a 'minfree' file to prevent > >> crashdumps filling the crashdir. Maybe the default install should > >> include a minfree set to (say) 512MB. > > > > The one problem this approach is it implements a FIFO instead of a LIFO. I > > want the N most recent crashdumps to be saved, not the first N. > > Check the size in the shell script before, remove older ones ("ls -1t > | grep pattern | tail +" gives you possible candidates). Yes, but the point is that you want that logic in savecore as an alternate to the current minfree logic. -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Tue Sep 28 15:33:30 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BF583106564A; Tue, 28 Sep 2010 15:33:30 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 94A958FC18; Tue, 28 Sep 2010 15:33:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8SFXUIV078410; Tue, 28 Sep 2010 15:33:30 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8SFXULh078409; Tue, 28 Sep 2010 15:33:30 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201009281533.o8SFXULh078409@svn.freebsd.org> From: Warner Losh Date: Tue, 28 Sep 2010 15:33:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213248 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2010 15:33:30 -0000 Author: imp Date: Tue Sep 28 15:33:30 2010 New Revision: 213248 URL: http://svn.freebsd.org/changeset/base/213248 Log: This file has been unused for ages. Retire it. Submitted by: pluknet Deleted: head/sys/kern/Makefile From owner-svn-src-head@FreeBSD.ORG Tue Sep 28 16:02:34 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from [127.0.0.1] (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by hub.freebsd.org (Postfix) with ESMTP id B34E5106566B; Tue, 28 Sep 2010 16:02:33 +0000 (UTC) (envelope-from jkim@FreeBSD.org) From: Jung-uk Kim To: John Baldwin Date: Tue, 28 Sep 2010 12:02:12 -0400 User-Agent: KMail/1.6.2 References: <201009280457.o8S4vuS9060037@svn.freebsd.org> <201009280931.59163.jhb@freebsd.org> In-Reply-To: <201009280931.59163.jhb@freebsd.org> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201009281202.22555.jkim@FreeBSD.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, David Xu Subject: Re: svn commit: r213241 - in head: include lib/libthr/thread X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2010 16:02:34 -0000 On Tuesday 28 September 2010 09:31 am, John Baldwin wrote: > On Tuesday, September 28, 2010 12:57:56 am David Xu wrote: > > Author: davidxu > > Date: Tue Sep 28 04:57:56 2010 > > New Revision: 213241 > > URL: http://svn.freebsd.org/changeset/base/213241 > > > > Log: > > In current code, statically initialized and destroyed object > > have same null value, the code can not distinguish between them, > > to fix the problem, now a destroyed object is assigned to a > > non-null value, and it will be rejected by some pthread > > functions. PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP is changed to > > number 1, so that adaptive mutex can be statically initialized > > correctly. > > Does this fix PR threads/150889 then? It seems it does. Thanks, David! Jung-uk Kim From owner-svn-src-head@FreeBSD.ORG Tue Sep 28 16:20:19 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from [127.0.0.1] (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by hub.freebsd.org (Postfix) with ESMTP id 859CC106564A; Tue, 28 Sep 2010 16:20:19 +0000 (UTC) (envelope-from jkim@FreeBSD.org) From: Jung-uk Kim To: John Baldwin Date: Tue, 28 Sep 2010 12:20:09 -0400 User-Agent: KMail/1.6.2 References: <201009280457.o8S4vuS9060037@svn.freebsd.org> <201009280931.59163.jhb@freebsd.org> <201009281202.22555.jkim@FreeBSD.org> In-Reply-To: <201009281202.22555.jkim@FreeBSD.org> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201009281220.12278.jkim@FreeBSD.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, David Xu Subject: Re: svn commit: r213241 - in head: include lib/libthr/thread X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2010 16:20:19 -0000 On Tuesday 28 September 2010 12:02 pm, Jung-uk Kim wrote: > On Tuesday 28 September 2010 09:31 am, John Baldwin wrote: > > On Tuesday, September 28, 2010 12:57:56 am David Xu wrote: > > > Author: davidxu > > > Date: Tue Sep 28 04:57:56 2010 > > > New Revision: 213241 > > > URL: http://svn.freebsd.org/changeset/base/213241 > > > > > > Log: > > > In current code, statically initialized and destroyed object > > > have same null value, the code can not distinguish between > > > them, to fix the problem, now a destroyed object is assigned to > > > a non-null value, and it will be rejected by some pthread > > > functions. PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP is changed to > > > number 1, so that adaptive mutex can be statically initialized > > > correctly. > > > > Does this fix PR threads/150889 then? > > It seems it does. Unfortunately, it seems to have a regression: %cat test.c #include #include static pthread_cond_t static_cond = PTHREAD_COND_INITIALIZER; static pthread_mutex_t static_mutex = PTHREAD_MUTEX_INITIALIZER; int main(void) { // pthread_mutex_lock(&static_mutex); printf("%d\n", pthread_cond_wait(&static_cond, &static_mutex)); pthread_mutex_unlock(&static_mutex); return (0); } %cc -o test test.c -pthread %./test Segmentation fault (core dumped) pthread_cond_wait(3) had to return EPERM here. :-( Jung-uk Kim From owner-svn-src-head@FreeBSD.ORG Tue Sep 28 18:34:19 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 336F7106564A; Tue, 28 Sep 2010 18:34:19 +0000 (UTC) (envelope-from pjd@garage.freebsd.pl) Received: from mail.garage.freebsd.pl (60.wheelsystems.com [83.12.187.60]) by mx1.freebsd.org (Postfix) with ESMTP id 7876B8FC1F; Tue, 28 Sep 2010 18:34:18 +0000 (UTC) Received: by mail.garage.freebsd.pl (Postfix, from userid 65534) id 9AD7645C99; Tue, 28 Sep 2010 20:34:16 +0200 (CEST) Received: from localhost (chello089077043238.chello.pl [89.77.43.238]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.garage.freebsd.pl (Postfix) with ESMTP id 90A46456B1; Tue, 28 Sep 2010 20:34:10 +0200 (CEST) Date: Tue, 28 Sep 2010 20:33:50 +0200 From: Pawel Jakub Dawidek To: John Baldwin Message-ID: <20100928183350.GB2224@garage.freebsd.pl> References: <20100922222441.00002f27@unknown> <20100923.203143.19192035494300157.imp@bsdimp.com> <1285297884.17619.17.camel@neo.cse.buffalo.edu> <201009240923.04406.jhb@freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="cmJC7u66zC7hs+87" Content-Disposition: inline In-Reply-To: <201009240923.04406.jhb@freebsd.org> User-Agent: Mutt/1.4.2.3i X-PGP-Key-URL: http://people.freebsd.org/~pjd/pjd.asc X-OS: FreeBSD 9.0-CURRENT amd64 X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on mail.garage.freebsd.pl X-Spam-Level: X-Spam-Status: No, score=-0.6 required=4.5 tests=BAYES_00,RCVD_IN_SORBS_DUL autolearn=no version=3.0.4 Cc: bruce@cran.org.uk, src-committers@freebsd.org, Ken Smith , svn-src-all@freebsd.org, avg@freebsd.org, gavin@freebsd.org, svn-src-head@freebsd.org, "M. Warner Losh" Subject: Re: svn commit: r212964 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2010 18:34:19 -0000 --cmJC7u66zC7hs+87 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Sep 24, 2010 at 09:23:04AM -0400, John Baldwin wrote: > > Because disks are big and (again, just trying to explain my > > understanding of what I inherited) we want all the support > > to be in place, just not turned on. There is a difference > > between "You can give us much better information by doing > > > .symbols goo> and then making a one-line change to rc.conf" > > versus "You can give us much better information by making > > a one-line change to rc.conf". >=20 > The biggest argument against this (and the reason I always enable crashdu= mps > on all machines I am involved with) is that many panics are not easily > reproducible, esp. ones that trigger under load. If dumpdev is not on by > default, then the info from a rare or hard-to-trigger bug may simply be l= ost. > Also, "just send-pr or mail the 'foo' file" is even simpler than "enable = this > knob in rc.conf and reproduce your issue, then come back". I am bigger fan of textdumps than minidumps, because in my opinion textdumps provide quite a lot of useful info. I'm working with FreeBSD kernel for years now and almost entirely avoided gdb for kernel debugging. DDB and printf(9) are in 99% enough for me (maybe I'm too traditional, but that's the fact). I'm not saying that textdumps are enough in 99%, though. > Well, if we turn it on we should document it clearly. Folks are already > interested in asking for help once a machine panics, and if the reply to a > query on questions@ can say "please go look for a file named 'foo' and e-= mail > it somewhere or send-pr it", that is far simpler than having to enable du= mps > and reproduce the panic. Another important thing in my opinion is privacy of user's data. Once the data hit the disk it can stay there forever. This is why I use encrypted swap everywhere. I'd never send kernel minidump from my laptop or from any of my servers to anyone, but I'd be happy to send textdump. I find textdumps a great solution that's in the middle between protecting user's privacy and providing a lot of useful info and I'd much prefer to turn on textdumps by default and eventually extend what we dump, than to make minidumps the default. You can always ask user to add this one-line to rc.conf to turn minidump on and provide you the info that was missing in textdump. --=20 Pawel Jakub Dawidek http://www.wheelsystems.com pjd@FreeBSD.org http://www.FreeBSD.org FreeBSD committer Am I Evil? Yes, I Am! --cmJC7u66zC7hs+87 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iEYEARECAAYFAkyiNQ4ACgkQForvXbEpPzSy8wCaAwcKyVSd72hS+HPLwrj+JM9X h4YAnilkHL9SU+H/tTCwKgEJZETGhab0 =vZn7 -----END PGP SIGNATURE----- --cmJC7u66zC7hs+87-- From owner-svn-src-head@FreeBSD.ORG Tue Sep 28 19:07:52 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 60939106564A; Tue, 28 Sep 2010 19:07:52 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 1D2198FC19; Tue, 28 Sep 2010 19:07:52 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 9DB1B46B90; Tue, 28 Sep 2010 15:07:51 -0400 (EDT) Received: from jhbbsd.localnet (smtp.hudson-trading.com [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 4C5218A04E; Tue, 28 Sep 2010 15:07:50 -0400 (EDT) From: John Baldwin To: Pawel Jakub Dawidek Date: Tue, 28 Sep 2010 15:04:11 -0400 User-Agent: KMail/1.13.5 (FreeBSD/7.3-CBSD-20100819; KDE/4.4.5; amd64; ; ) References: <20100922222441.00002f27@unknown> <201009240923.04406.jhb@freebsd.org> <20100928183350.GB2224@garage.freebsd.pl> In-Reply-To: <20100928183350.GB2224@garage.freebsd.pl> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <201009281504.12236.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Tue, 28 Sep 2010 15:07:50 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.6 required=4.2 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: bruce@cran.org.uk, src-committers@freebsd.org, Ken Smith , svn-src-all@freebsd.org, avg@freebsd.org, gavin@freebsd.org, svn-src-head@freebsd.org, "M. Warner Losh" Subject: Re: svn commit: r212964 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2010 19:07:52 -0000 On Tuesday, September 28, 2010 2:33:50 pm Pawel Jakub Dawidek wrote: > On Fri, Sep 24, 2010 at 09:23:04AM -0400, John Baldwin wrote: > > > Because disks are big and (again, just trying to explain my > > > understanding of what I inherited) we want all the support > > > to be in place, just not turned on. There is a difference > > > between "You can give us much better information by doing > > > > > .symbols goo> and then making a one-line change to rc.conf" > > > versus "You can give us much better information by making > > > a one-line change to rc.conf". > > > > The biggest argument against this (and the reason I always enable crashdumps > > on all machines I am involved with) is that many panics are not easily > > reproducible, esp. ones that trigger under load. If dumpdev is not on by > > default, then the info from a rare or hard-to-trigger bug may simply be lost. > > Also, "just send-pr or mail the 'foo' file" is even simpler than "enable this > > knob in rc.conf and reproduce your issue, then come back". > > I am bigger fan of textdumps than minidumps, because in my opinion > textdumps provide quite a lot of useful info. I'm working with FreeBSD > kernel for years now and almost entirely avoided gdb for kernel > debugging. DDB and printf(9) are in 99% enough for me (maybe I'm too > traditional, but that's the fact). I'm not saying that textdumps are > enough in 99%, though. Have you looked at a /var/crash/core.txt.X file yet? If not, you should, as it is very similar to a text dump. In fact, it will contain the contents of any ddb trace buffer in addition to a stack trace from kgdb, process listing from ps, etc. > > Well, if we turn it on we should document it clearly. Folks are already > > interested in asking for help once a machine panics, and if the reply to a > > query on questions@ can say "please go look for a file named 'foo' and e-mail > > it somewhere or send-pr it", that is far simpler than having to enable dumps > > and reproduce the panic. > > Another important thing in my opinion is privacy of user's data. Once > the data hit the disk it can stay there forever. This is why I use > encrypted swap everywhere. I'd never send kernel minidump from my > laptop or from any of my servers to anyone, but I'd be happy to send > textdump. > > I find textdumps a great solution that's in the middle between > protecting user's privacy and providing a lot of useful info and I'd > much prefer to turn on textdumps by default and eventually extend what > we dump, than to make minidumps the default. I'm suggesting they provide us the core.txt.X file, not the full minidump. A developer could then ask them to run specific commands from a subsequent kgdb session to obtain more details. > You can always ask user to add this one-line to rc.conf to turn > minidump on and provide you the info that was missing in textdump. This only works for easily reproducible bugs, and in that case they can turn on dumps later without a need for it to be automatic at all. -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Tue Sep 28 19:36:49 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4DB1E1065693; Tue, 28 Sep 2010 19:36:49 +0000 (UTC) (envelope-from pjd@garage.freebsd.pl) Received: from mail.garage.freebsd.pl (60.wheelsystems.com [83.12.187.60]) by mx1.freebsd.org (Postfix) with ESMTP id A96BA8FC17; Tue, 28 Sep 2010 19:36:39 +0000 (UTC) Received: by mail.garage.freebsd.pl (Postfix, from userid 65534) id 8DDBF45C98; Tue, 28 Sep 2010 21:36:37 +0200 (CEST) Received: from localhost (chello089077043238.chello.pl [89.77.43.238]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.garage.freebsd.pl (Postfix) with ESMTP id D61A6456B1; Tue, 28 Sep 2010 21:36:31 +0200 (CEST) Date: Tue, 28 Sep 2010 21:36:11 +0200 From: Pawel Jakub Dawidek To: John Baldwin Message-ID: <20100928193611.GD2224@garage.freebsd.pl> References: <20100922222441.00002f27@unknown> <201009240923.04406.jhb@freebsd.org> <20100928183350.GB2224@garage.freebsd.pl> <201009281504.12236.jhb@freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="0IvGJv3f9h+YhkrH" Content-Disposition: inline In-Reply-To: <201009281504.12236.jhb@freebsd.org> User-Agent: Mutt/1.4.2.3i X-PGP-Key-URL: http://people.freebsd.org/~pjd/pjd.asc X-OS: FreeBSD 9.0-CURRENT amd64 X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on mail.garage.freebsd.pl X-Spam-Level: X-Spam-Status: No, score=-0.6 required=4.5 tests=BAYES_00,RCVD_IN_SORBS_DUL autolearn=no version=3.0.4 Cc: bruce@cran.org.uk, src-committers@freebsd.org, Ken Smith , svn-src-all@freebsd.org, avg@freebsd.org, gavin@freebsd.org, svn-src-head@freebsd.org, "M. Warner Losh" Subject: Re: svn commit: r212964 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2010 19:36:49 -0000 --0IvGJv3f9h+YhkrH Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Sep 28, 2010 at 03:04:11PM -0400, John Baldwin wrote: > > I am bigger fan of textdumps than minidumps, because in my opinion > > textdumps provide quite a lot of useful info. I'm working with FreeBSD > > kernel for years now and almost entirely avoided gdb for kernel > > debugging. DDB and printf(9) are in 99% enough for me (maybe I'm too > > traditional, but that's the fact). I'm not saying that textdumps are > > enough in 99%, though. >=20 > Have you looked at a /var/crash/core.txt.X file yet? If not, you should,= as > it is very similar to a text dump. In fact, it will contain the contents= of > any ddb trace buffer in addition to a stack trace from kgdb, process list= ing > from ps, etc. [...] > > Another important thing in my opinion is privacy of user's data. Once > > the data hit the disk it can stay there forever. This is why I use > > encrypted swap everywhere. I'd never send kernel minidump from my > > laptop or from any of my servers to anyone, but I'd be happy to send > > textdump. > >=20 > > I find textdumps a great solution that's in the middle between > > protecting user's privacy and providing a lot of useful info and I'd > > much prefer to turn on textdumps by default and eventually extend what > > we dump, than to make minidumps the default. >=20 > I'm suggesting they provide us the core.txt.X file, not the full minidump. > A developer could then ask them to run specific commands from a subsequent > kgdb session to obtain more details. But you still will have your kernel memory dumped to disk. This is probably not a problem for most of the users, though. > > You can always ask user to add this one-line to rc.conf to turn > > minidump on and provide you the info that was missing in textdump. >=20 > This only works for easily reproducible bugs, and in that case they can t= urn > on dumps later without a need for it to be automatic at all. And I'm arguing that those are very rare situations where there is a bug, which is hard to reproduce and where textdump won't be of any help. I'm aware that those are not strong arguments, but just worth taking into account, IMHO. --=20 Pawel Jakub Dawidek http://www.wheelsystems.com pjd@FreeBSD.org http://www.FreeBSD.org FreeBSD committer Am I Evil? Yes, I Am! --0IvGJv3f9h+YhkrH Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iEYEARECAAYFAkyiQ6sACgkQForvXbEpPzQghwCg1ez5WwJTA3HUe6ZVQ3nHWAfc qlkAn0dbFfmlVMg3e4qPTYkFi5pPn+6a =jCIE -----END PGP SIGNATURE----- --0IvGJv3f9h+YhkrH-- From owner-svn-src-head@FreeBSD.ORG Tue Sep 28 19:51:26 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1EBA5106566B; Tue, 28 Sep 2010 19:51:26 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id DF3678FC1B; Tue, 28 Sep 2010 19:51:25 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 81FB446B66; Tue, 28 Sep 2010 15:51:25 -0400 (EDT) Received: from jhbbsd.localnet (smtp.hudson-trading.com [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 7AC908A04E; Tue, 28 Sep 2010 15:51:24 -0400 (EDT) From: John Baldwin To: Pawel Jakub Dawidek Date: Tue, 28 Sep 2010 15:50:29 -0400 User-Agent: KMail/1.13.5 (FreeBSD/7.3-CBSD-20100819; KDE/4.4.5; amd64; ; ) References: <20100922222441.00002f27@unknown> <201009281504.12236.jhb@freebsd.org> <20100928193611.GD2224@garage.freebsd.pl> In-Reply-To: <20100928193611.GD2224@garage.freebsd.pl> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <201009281550.29825.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Tue, 28 Sep 2010 15:51:24 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.6 required=4.2 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: bruce@cran.org.uk, src-committers@freebsd.org, Ken Smith , svn-src-all@freebsd.org, avg@freebsd.org, gavin@freebsd.org, svn-src-head@freebsd.org, "M. Warner Losh" Subject: Re: svn commit: r212964 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2010 19:51:26 -0000 On Tuesday, September 28, 2010 3:36:11 pm Pawel Jakub Dawidek wrote: > On Tue, Sep 28, 2010 at 03:04:11PM -0400, John Baldwin wrote: > > I'm suggesting they provide us the core.txt.X file, not the full minidump. > > A developer could then ask them to run specific commands from a subsequent > > kgdb session to obtain more details. > > But you still will have your kernel memory dumped to disk. This is > probably not a problem for most of the users, though. I think that set of users is sufficiently small that they could choose a non-default setting. > > > You can always ask user to add this one-line to rc.conf to turn > > > minidump on and provide you the info that was missing in textdump. > > > > This only works for easily reproducible bugs, and in that case they can turn > > on dumps later without a need for it to be automatic at all. > > And I'm arguing that those are very rare situations where there is a > bug, which is hard to reproduce and where textdump won't be of any help. Actually, this can be quite common. A stack trace alone can get you started, but the ability to check the value and state of local variables at various frames on the stack can be key to figuring out many panics. I also tended to prefer DDB several years ago, but while working at a large FreeBSD consumer with lots of machines, I found that many panics are not, in fact, very reproducible. Even for ones that are, the machine that caused the issue may not be available for testing (it's a production machine after all), so one has to make the most of post-mortem analysis and not rely on repeatedly panic'ing a machine to debug issues. In this case, kgdb is far, far more useful than ddb. None of us are smart enough to figure out all the things that ddb should possibly dump in a textdump to handle every possible panic, but with kgdb you can query new data after initial investigation of the problem. -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Tue Sep 28 20:57:14 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BDFFB10656C0; Tue, 28 Sep 2010 20:57:14 +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 91EA68FC18; Tue, 28 Sep 2010 20:57: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 o8SKvEbJ085333; Tue, 28 Sep 2010 20:57:14 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8SKvEVt085330; Tue, 28 Sep 2010 20:57:14 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201009282057.o8SKvEVt085330@svn.freebsd.org> From: Ed Maste Date: Tue, 28 Sep 2010 20:57:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213250 - in head: crypto/openssh usr.bin/login X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2010 20:57:14 -0000 Author: emaste Date: Tue Sep 28 20:57:14 2010 New Revision: 213250 URL: http://svn.freebsd.org/changeset/base/213250 Log: Remove copyright strings printed at login time via login(1) or sshd(8). It is not clear to what this copyright should apply, and this is in line with what other operating systems do. For ssh specifically, printing of the copyright string is not in the upstream version so this reduces our FreeBSD-local diffs. Approved by: core, des (ssh) Modified: head/crypto/openssh/session.c head/usr.bin/login/login.c Modified: head/crypto/openssh/session.c ============================================================================== --- head/crypto/openssh/session.c Tue Sep 28 19:17:39 2010 (r213249) +++ head/crypto/openssh/session.c Tue Sep 28 20:57:14 2010 (r213250) @@ -893,24 +893,6 @@ do_motd(void) { FILE *f; char buf[256]; -#ifdef HAVE_LOGIN_CAP - const char *fname; -#endif - -#ifdef HAVE_LOGIN_CAP - fname = login_getcapstr(lc, "copyright", NULL, NULL); - if (fname != NULL && (f = fopen(fname, "r")) != NULL) { - while (fgets(buf, sizeof(buf), f) != NULL) - fputs(buf, stdout); - fclose(f); - } else -#endif /* HAVE_LOGIN_CAP */ - (void)printf("%s\n\t%s %s\n", - "Copyright (c) 1980, 1983, 1986, 1988, 1990, 1991, 1993, 1994", - "The Regents of the University of California. ", - "All rights reserved."); - - (void)printf("\n"); if (options.print_motd) { #ifdef HAVE_LOGIN_CAP Modified: head/usr.bin/login/login.c ============================================================================== --- head/usr.bin/login/login.c Tue Sep 28 19:17:39 2010 (r213249) +++ head/usr.bin/login/login.c Tue Sep 28 20:57:14 2010 (r213250) @@ -53,7 +53,6 @@ __FBSDID("$FreeBSD$"); * login -f name (for pre-authenticated login: datakit, xterm, etc.) */ -#include #include #include #include @@ -590,12 +589,6 @@ main(int argc, char *argv[]) if (!quietlog) { const char *cw; - cw = login_getcapstr(lc, "copyright", NULL, NULL); - if (cw == NULL || motd(cw) == -1) - (void)printf("%s", copyright); - - (void)printf("\n"); - cw = login_getcapstr(lc, "welcome", NULL, NULL); if (cw != NULL && access(cw, F_OK) == 0) motd(cw); From owner-svn-src-head@FreeBSD.ORG Tue Sep 28 21:13:55 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 215ED1065674; Tue, 28 Sep 2010 21:13:55 +0000 (UTC) (envelope-from ticso@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 10BD78FC13; Tue, 28 Sep 2010 21:13:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8SLDsdS085747; Tue, 28 Sep 2010 21:13:54 GMT (envelope-from ticso@svn.freebsd.org) Received: (from ticso@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8SLDssq085745; Tue, 28 Sep 2010 21:13:54 GMT (envelope-from ticso@svn.freebsd.org) Message-Id: <201009282113.o8SLDssq085745@svn.freebsd.org> From: Bernd Walter Date: Tue, 28 Sep 2010 21:13:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213251 - head/sys/arm/at91 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2010 21:13:55 -0000 Author: ticso Date: Tue Sep 28 21:13:54 2010 New Revision: 213251 URL: http://svn.freebsd.org/changeset/base/213251 Log: fix outdated comment Modified: head/sys/arm/at91/if_ate.c Modified: head/sys/arm/at91/if_ate.c ============================================================================== --- head/sys/arm/at91/if_ate.c Tue Sep 28 20:57:14 2010 (r213250) +++ head/sys/arm/at91/if_ate.c Tue Sep 28 21:13:54 2010 (r213251) @@ -391,10 +391,7 @@ ate_mac_hash(const uint8_t *buf) } /* - * Compute the multicast filter for this device using the standard - * algorithm. I wonder why this isn't in ether somewhere as a lot - * of different MAC chips use this method (or the reverse the bits) - * method. + * Compute the multicast filter for this device. */ static int ate_setmcast(struct ate_softc *sc) From owner-svn-src-head@FreeBSD.ORG Tue Sep 28 22:29:34 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from [127.0.0.1] (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by hub.freebsd.org (Postfix) with ESMTP id 8627E106564A; Tue, 28 Sep 2010 22:29:22 +0000 (UTC) (envelope-from jkim@FreeBSD.org) From: Jung-uk Kim To: John Baldwin Date: Tue, 28 Sep 2010 18:29:06 -0400 User-Agent: KMail/1.6.2 References: <201009280457.o8S4vuS9060037@svn.freebsd.org> <201009281202.22555.jkim@FreeBSD.org> <201009281220.12278.jkim@FreeBSD.org> In-Reply-To: <201009281220.12278.jkim@FreeBSD.org> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201009281829.13253.jkim@FreeBSD.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, David Xu Subject: Re: svn commit: r213241 - in head: include lib/libthr/thread X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2010 22:29:34 -0000 On Tuesday 28 September 2010 12:20 pm, Jung-uk Kim wrote: > On Tuesday 28 September 2010 12:02 pm, Jung-uk Kim wrote: > > On Tuesday 28 September 2010 09:31 am, John Baldwin wrote: > > > On Tuesday, September 28, 2010 12:57:56 am David Xu wrote: > > > > Author: davidxu > > > > Date: Tue Sep 28 04:57:56 2010 > > > > New Revision: 213241 > > > > URL: http://svn.freebsd.org/changeset/base/213241 > > > > > > > > Log: > > > > In current code, statically initialized and destroyed > > > > object have same null value, the code can not distinguish > > > > between them, to fix the problem, now a destroyed object is > > > > assigned to a non-null value, and it will be rejected by some > > > > pthread functions. PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP is > > > > changed to number 1, so that adaptive mutex can be statically > > > > initialized correctly. > > > > > > Does this fix PR threads/150889 then? > > > > It seems it does. > > Unfortunately, it seems to have a regression: > > %cat test.c > #include > #include > > static pthread_cond_t static_cond = PTHREAD_COND_INITIALIZER; > static pthread_mutex_t static_mutex = PTHREAD_MUTEX_INITIALIZER; > > int > main(void) > { > > // pthread_mutex_lock(&static_mutex); > printf("%d\n", pthread_cond_wait(&static_cond, &static_mutex)); > pthread_mutex_unlock(&static_mutex); > > return (0); > } > %cc -o test test.c -pthread > %./test > Segmentation fault (core dumped) > > pthread_cond_wait(3) had to return EPERM here. :-( I realized it is a libthr "feature" to catch real application bugs and to increase performance by not checking rare conditions, I guess. :-/ Sorry for the noise, Jung-uk Kim From owner-svn-src-head@FreeBSD.ORG Tue Sep 28 22:30:11 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 71A3A1065674; Tue, 28 Sep 2010 22:30:11 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 609A48FC17; Tue, 28 Sep 2010 22:30:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8SMUBcs087226; Tue, 28 Sep 2010 22:30:11 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8SMUBDU087224; Tue, 28 Sep 2010 22:30:11 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201009282230.o8SMUBDU087224@svn.freebsd.org> From: Luigi Rizzo Date: Tue, 28 Sep 2010 22:30:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213252 - head/release/picobsd/build X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2010 22:30:11 -0000 Author: luigi Date: Tue Sep 28 22:30:11 2010 New Revision: 213252 URL: http://svn.freebsd.org/changeset/base/213252 Log: use make from the toolchain, as the source tree may depend on specific features (e.g. on recent HEAD, rtld fails with older 'make') MFC after: 3 days Modified: head/release/picobsd/build/picobsd Modified: head/release/picobsd/build/picobsd ============================================================================== --- head/release/picobsd/build/picobsd Tue Sep 28 21:13:54 2010 (r213251) +++ head/release/picobsd/build/picobsd Tue Sep 28 22:30:11 2010 (r213252) @@ -176,9 +176,9 @@ create_includes_and_libraries2() { # opt ( cd ${SRC}; # make -DNOCLEAN -DNOPROFILE -DNOGAMES -DNOLIBC_R -DPICOBSD buildworld if [ -d "$1" ] ; then - cd $1 ; make $2 # specific target, e.g. ld-elf.so + cd $1 ; ${BINMAKE} $2 # specific target, e.g. ld-elf.so else - make _+_= $no toolchain _includes _libraries + ${BINMAKE} _+_= $no toolchain _includes _libraries fi ) } From owner-svn-src-head@FreeBSD.ORG Tue Sep 28 22:46:14 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B36C9106564A; Tue, 28 Sep 2010 22:46:13 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 970678FC16; Tue, 28 Sep 2010 22:46: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 o8SMkD6T088203; Tue, 28 Sep 2010 22:46:13 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8SMkDpg088199; Tue, 28 Sep 2010 22:46:13 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201009282246.o8SMkDpg088199@svn.freebsd.org> From: Luigi Rizzo Date: Tue, 28 Sep 2010 22:46:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213253 - head/sys/netinet/ipfw X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2010 22:46:14 -0000 Author: luigi Date: Tue Sep 28 22:46:13 2010 New Revision: 213253 URL: http://svn.freebsd.org/changeset/base/213253 Log: Whitespace changes to reduce diffs wrt the most recent ipfw/dummynet code: + remove an unused macro, + adjust the constants in an enum + small whitespace changes MFC after: 3 days Modified: head/sys/netinet/ipfw/dn_sched_qfq.c head/sys/netinet/ipfw/ip_dn_private.h head/sys/netinet/ipfw/ip_dummynet.c Modified: head/sys/netinet/ipfw/dn_sched_qfq.c ============================================================================== --- head/sys/netinet/ipfw/dn_sched_qfq.c Tue Sep 28 22:30:11 2010 (r213252) +++ head/sys/netinet/ipfw/dn_sched_qfq.c Tue Sep 28 22:46:13 2010 (r213253) @@ -61,7 +61,7 @@ typedef unsigned long bitmap; * bitmaps ops are critical. Some linux versions have __fls * and the bitmap ops. Some machines have ffs */ -#if defined(_WIN32) +#if defined(_WIN32) || (defined(__MIPSEL__) && defined(LINUX_24)) int fls(unsigned int n) { int i = 0; @@ -71,7 +71,7 @@ int fls(unsigned int n) } #endif -#if !defined(_KERNEL) || defined( __FreeBSD__ ) || defined(_WIN32) +#if !defined(_KERNEL) || defined( __FreeBSD__ ) || defined(_WIN32) || (defined(__MIPSEL__) && defined(LINUX_24)) static inline unsigned long __fls(unsigned long word) { return fls(word) - 1; @@ -107,7 +107,7 @@ void __clear_bit(int ix, bitmap *p) #endif /* !__linux__ */ #ifdef __MIPSEL__ -#define __clear_bit(ix, pData) (*pData) &= ~(1<<(ix)) +#define __clear_bit(ix, pData) (*pData) &= ~(1<<(ix)) #endif /*-------------------------------------------*/ Modified: head/sys/netinet/ipfw/ip_dn_private.h ============================================================================== --- head/sys/netinet/ipfw/ip_dn_private.h Tue Sep 28 22:30:11 2010 (r213252) +++ head/sys/netinet/ipfw/ip_dn_private.h Tue Sep 28 22:46:13 2010 (r213253) @@ -49,10 +49,6 @@ MALLOC_DECLARE(M_DUMMYNET); -#ifndef FREE_PKT -#define FREE_PKT(m) m_freem(m) -#endif - #ifndef __linux__ #define div64(a, b) ((int64_t)(a) / (int64_t)(b)) #endif @@ -351,13 +347,14 @@ enum { DN_DETACH = 0x0010, DN_ACTIVE = 0x0020, /* object is in evheap */ DN_F_DLINE = 0x0040, /* object is a delay line */ - DN_F_SCHI = 0x00C0, /* object is a sched.instance */ + DN_DEL_SAFE = 0x0080, /* delete a queue only if no longer needed + * by scheduler */ DN_QHT_IS_Q = 0x0100, /* in flowset, qht is a single queue */ }; extern struct dn_parms dn_cfg; //VNET_DECLARE(struct dn_parms, _base_dn_cfg); -//#define dn_cfg VNET(_base_dn_cfg) +//#define dn_cfg VNET(_base_dn_cfg) int dummynet_io(struct mbuf **, int , struct ip_fw_args *); void dummynet_task(void *context, int pending); Modified: head/sys/netinet/ipfw/ip_dummynet.c ============================================================================== --- head/sys/netinet/ipfw/ip_dummynet.c Tue Sep 28 22:30:11 2010 (r213252) +++ head/sys/netinet/ipfw/ip_dummynet.c Tue Sep 28 22:46:13 2010 (r213253) @@ -2300,7 +2300,7 @@ MODULE_VERSION(dummynet, 1); * VNET_SYSINIT is also called for each existing vnet and each new vnet. */ //VNET_SYSINIT(vnet_dn_init, DN_SI_SUB, DN_MODEV_ORD+2, ip_dn_init, NULL); - + /* * Shutdown handlers up shop. These are done in REVERSE ORDER, but still * after dummynet_modevent() has been called. Not called on reboot. From owner-svn-src-head@FreeBSD.ORG Tue Sep 28 23:16:57 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 42426106566C for ; Tue, 28 Sep 2010 23:16:57 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from mail2.fluidhosting.com (mx21.fluidhosting.com [204.14.89.4]) by mx1.freebsd.org (Postfix) with ESMTP id C44728FC0A for ; Tue, 28 Sep 2010 23:16:56 +0000 (UTC) Received: (qmail 24998 invoked by uid 399); 28 Sep 2010 23:16:55 -0000 Received: from localhost (HELO ?192.168.0.142?) (dougb@dougbarton.us@127.0.0.1) by localhost with ESMTPAM; 28 Sep 2010 23:16:55 -0000 X-Originating-IP: 127.0.0.1 X-Sender: dougb@dougbarton.us Message-ID: <4CA2776B.5080905@FreeBSD.org> Date: Tue, 28 Sep 2010 16:16:59 -0700 From: Doug Barton Organization: http://SupersetSolutions.com/ User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.9) Gecko/20100915 Thunderbird/3.1.4 MIME-Version: 1.0 To: Luigi Rizzo References: <201009282246.o8SMkDpg088199@svn.freebsd.org> In-Reply-To: <201009282246.o8SMkDpg088199@svn.freebsd.org> X-Enigmail-Version: 1.2a1pre OpenPGP: id=1A1ABC84 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r213253 - head/sys/netinet/ipfw X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2010 23:16:57 -0000 On 9/28/2010 3:46 PM, Luigi Rizzo wrote: > Author: luigi > Date: Tue Sep 28 22:46:13 2010 > New Revision: 213253 > URL: http://svn.freebsd.org/changeset/base/213253 > > Log: > Whitespace changes to reduce diffs wrt the most recent ipfw/dummynet code: > + remove an unused macro, > + adjust the constants in an enum > + small whitespace changes It's generally a bad idea to mix pure ws changes with functional ones. -- ... and that's just a little bit of history repeating. -- Propellerheads Improve the effectiveness of your Internet presence with a domain name makeover! http://SupersetSolutions.com/ From owner-svn-src-head@FreeBSD.ORG Tue Sep 28 23:23:23 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 58073106564A; Tue, 28 Sep 2010 23:23:23 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 46E528FC12; Tue, 28 Sep 2010 23:23:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8SNNNr7088923; Tue, 28 Sep 2010 23:23:23 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8SNNNtH088921; Tue, 28 Sep 2010 23:23:23 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201009282323.o8SNNNtH088921@svn.freebsd.org> From: Luigi Rizzo Date: Tue, 28 Sep 2010 23:23:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213254 - head/sys/netinet/ipfw X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2010 23:23:23 -0000 Author: luigi Date: Tue Sep 28 23:23:23 2010 New Revision: 213254 URL: http://svn.freebsd.org/changeset/base/213254 Log: fix breakage in in-kernel NAT: the code did not honor net.inet.ip.fw.one_pass and always moved to the next rule in case of a successful nat. This should fix several related PR (waiting for feedback before closing them) PR: 145167 149572 150141 MFC after: 3 days Modified: head/sys/netinet/ipfw/ip_fw_pfil.c Modified: head/sys/netinet/ipfw/ip_fw_pfil.c ============================================================================== --- head/sys/netinet/ipfw/ip_fw_pfil.c Tue Sep 28 22:46:13 2010 (r213253) +++ head/sys/netinet/ipfw/ip_fw_pfil.c Tue Sep 28 23:23:23 2010 (r213254) @@ -231,6 +231,11 @@ again: break; case IP_FW_NAT: + /* honor one-pass in case of successful nat */ + if (V_fw_one_pass) + break; /* ret is already 0 */ + goto again; + case IP_FW_REASS: goto again; /* continue with packet */ From owner-svn-src-head@FreeBSD.ORG Tue Sep 28 23:47:22 2010 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E98B1106566B; Tue, 28 Sep 2010 23:47:22 +0000 (UTC) (envelope-from luigi@onelab2.iet.unipi.it) Received: from onelab2.iet.unipi.it (onelab2.iet.unipi.it [131.114.59.238]) by mx1.freebsd.org (Postfix) with ESMTP id ABE548FC13; Tue, 28 Sep 2010 23:47:22 +0000 (UTC) Received: by onelab2.iet.unipi.it (Postfix, from userid 275) id 7FC8973098; Wed, 29 Sep 2010 01:40:13 +0200 (CEST) Date: Wed, 29 Sep 2010 01:40:13 +0200 From: Luigi Rizzo To: Doug Barton Message-ID: <20100928234013.GA21162@onelab2.iet.unipi.it> References: <201009282246.o8SMkDpg088199@svn.freebsd.org> <4CA2776B.5080905@FreeBSD.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4CA2776B.5080905@FreeBSD.org> User-Agent: Mutt/1.4.2.3i Cc: svn-src-head@FreeBSD.org, Luigi Rizzo , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org Subject: Re: svn commit: r213253 - head/sys/netinet/ipfw X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2010 23:47:23 -0000 On Tue, Sep 28, 2010 at 04:16:59PM -0700, Doug Barton wrote: > On 9/28/2010 3:46 PM, Luigi Rizzo wrote: > >Author: luigi > >Date: Tue Sep 28 22:46:13 2010 > >New Revision: 213253 > >URL: http://svn.freebsd.org/changeset/base/213253 > > > >Log: > > Whitespace changes to reduce diffs wrt the most recent ipfw/dummynet > > code: > > + remove an unused macro, > > + adjust the constants in an enum > > + small whitespace changes > > It's generally a bad idea to mix pure ws changes with functional ones. does unused code count as 'functional' change ? All the changes in this commit are a no-op in FreeBSD-world. From owner-svn-src-head@FreeBSD.ORG Wed Sep 29 00:00:45 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DB36B106564A; Wed, 29 Sep 2010 00:00: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 CA0DB8FC15; Wed, 29 Sep 2010 00:00: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 o8T00j2v089681; Wed, 29 Sep 2010 00:00:45 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8T00j63089678; Wed, 29 Sep 2010 00:00:45 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201009290000.o8T00j63089678@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 29 Sep 2010 00:00:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213255 - head/sys/dev/bge X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2010 00:00:45 -0000 Author: yongari Date: Wed Sep 29 00:00:45 2010 New Revision: 213255 URL: http://svn.freebsd.org/changeset/base/213255 Log: Set the number of RX frames to receive after RX MBUF low watermark has reached. This reduced number of dropped frames when flow-control is enabled. Previously it dropped incoming frames once RX MBUF low watermark has reached. The value used in MAC RX MBUF low watermark is greater than or equal to 4 so receiving two more RX frames should not be a problem. Obtained from: OpenBSD Modified: head/sys/dev/bge/if_bge.c head/sys/dev/bge/if_bgereg.h Modified: head/sys/dev/bge/if_bge.c ============================================================================== --- head/sys/dev/bge/if_bge.c Tue Sep 28 23:23:23 2010 (r213254) +++ head/sys/dev/bge/if_bge.c Wed Sep 29 00:00:45 2010 (r213255) @@ -4220,6 +4220,14 @@ bge_init_locked(struct bge_softc *sc) /* Turn on receiver. */ BGE_SETBIT(sc, BGE_RX_MODE, BGE_RXMODE_ENABLE); + /* + * Set the number of good frames to receive after RX MBUF + * Low Watermark has been reached. After the RX MAC receives + * this number of frames, it will drop subsequent incoming + * frames until the MBUF High Watermark is reached. + */ + CSR_WRITE_4(sc, BGE_MAX_RX_FRAME_LOWAT, 2); + /* Tell firmware we're alive. */ BGE_SETBIT(sc, BGE_MODE_CTL, BGE_MODECTL_STACKUP); Modified: head/sys/dev/bge/if_bgereg.h ============================================================================== --- head/sys/dev/bge/if_bgereg.h Tue Sep 28 23:23:23 2010 (r213254) +++ head/sys/dev/bge/if_bgereg.h Wed Sep 29 00:00:45 2010 (r213255) @@ -632,6 +632,7 @@ #define BGE_RX_BD_RULES_CTL15 0x04F8 #define BGE_RX_BD_RULES_MASKVAL15 0x04FC #define BGE_RX_RULES_CFG 0x0500 +#define BGE_MAX_RX_FRAME_LOWAT 0x0504 #define BGE_SERDES_CFG 0x0590 #define BGE_SERDES_STS 0x0594 #define BGE_SGDIG_CFG 0x05B0 From owner-svn-src-head@FreeBSD.ORG Wed Sep 29 02:36:58 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BE3EF106564A; Wed, 29 Sep 2010 02:36: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 9294F8FC19; Wed, 29 Sep 2010 02:36: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 o8T2awlu093152; Wed, 29 Sep 2010 02:36:58 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8T2aw9M093150; Wed, 29 Sep 2010 02:36:58 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201009290236.o8T2aw9M093150@svn.freebsd.org> From: David Xu Date: Wed, 29 Sep 2010 02:36:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213256 - head/sys/i386/i386 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2010 02:36:58 -0000 Author: davidxu Date: Wed Sep 29 02:36:58 2010 New Revision: 213256 URL: http://svn.freebsd.org/changeset/base/213256 Log: Remove a redundant instruction for casuword. Modified: head/sys/i386/i386/support.s Modified: head/sys/i386/i386/support.s ============================================================================== --- head/sys/i386/i386/support.s Wed Sep 29 00:00:45 2010 (r213255) +++ head/sys/i386/i386/support.s Wed Sep 29 02:36:58 2010 (r213256) @@ -423,7 +423,6 @@ ENTRY(casuword) */ movl PCPU(CURPCB),%ecx - movl $fusufault,PCB_ONFAULT(%ecx) movl $0,PCB_ONFAULT(%ecx) ret END(casuword32) From owner-svn-src-head@FreeBSD.ORG Wed Sep 29 02:42:40 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1A1B0106564A; Wed, 29 Sep 2010 02:42:40 +0000 (UTC) (envelope-from davidxu@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id DFC1F8FC27; Wed, 29 Sep 2010 02:42:39 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id o8T2gbd7027871; Wed, 29 Sep 2010 02:42:38 GMT (envelope-from davidxu@freebsd.org) Message-ID: <4CA3181E.6030000@freebsd.org> Date: Wed, 29 Sep 2010 10:42:38 +0000 From: David Xu User-Agent: Thunderbird 2.0.0.24 (X11/20100630) MIME-Version: 1.0 To: Jung-uk Kim References: <201009280457.o8S4vuS9060037@svn.freebsd.org> <201009281202.22555.jkim@FreeBSD.org> <201009281220.12278.jkim@FreeBSD.org> <201009281829.13253.jkim@FreeBSD.org> In-Reply-To: <201009281829.13253.jkim@FreeBSD.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, John Baldwin Subject: Re: svn commit: r213241 - in head: include lib/libthr/thread X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2010 02:42:40 -0000 Jung-uk Kim wrote: > On Tuesday 28 September 2010 12:20 pm, Jung-uk Kim wrote: >> On Tuesday 28 September 2010 12:02 pm, Jung-uk Kim wrote: >>> On Tuesday 28 September 2010 09:31 am, John Baldwin wrote: >>>> On Tuesday, September 28, 2010 12:57:56 am David Xu wrote: >>>>> Author: davidxu >>>>> Date: Tue Sep 28 04:57:56 2010 >>>>> New Revision: 213241 >>>>> URL: http://svn.freebsd.org/changeset/base/213241 >>>>> >>>>> Log: >>>>> In current code, statically initialized and destroyed >>>>> object have same null value, the code can not distinguish >>>>> between them, to fix the problem, now a destroyed object is >>>>> assigned to a non-null value, and it will be rejected by some >>>>> pthread functions. PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP is >>>>> changed to number 1, so that adaptive mutex can be statically >>>>> initialized correctly. >>>> Does this fix PR threads/150889 then? >>> It seems it does. >> Unfortunately, it seems to have a regression: >> >> %cat test.c >> #include >> #include >> >> static pthread_cond_t static_cond = PTHREAD_COND_INITIALIZER; >> static pthread_mutex_t static_mutex = PTHREAD_MUTEX_INITIALIZER; >> >> int >> main(void) >> { >> >> // pthread_mutex_lock(&static_mutex); >> printf("%d\n", pthread_cond_wait(&static_cond, &static_mutex)); >> pthread_mutex_unlock(&static_mutex); >> >> return (0); >> } >> %cc -o test test.c -pthread >> %./test >> Segmentation fault (core dumped) >> >> pthread_cond_wait(3) had to return EPERM here. :-( > > I realized it is a libthr "feature" to catch real application bugs and > to increase performance by not checking rare conditions, I guess. :-/ > > Sorry for the noise, > > Jung-uk Kim > I think your example is legal, I might add checking back, however, it would return two codes, EINVAL and EPERM. From owner-svn-src-head@FreeBSD.ORG Wed Sep 29 03:28:03 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 21A08106566B; Wed, 29 Sep 2010 03:28:03 +0000 (UTC) (envelope-from deischen@freebsd.org) Received: from mail.netplex.net (mail.netplex.net [204.213.176.10]) by mx1.freebsd.org (Postfix) with ESMTP id C72618FC12; Wed, 29 Sep 2010 03:28:02 +0000 (UTC) Received: from sea.ntplx.net (sea.ntplx.net [204.213.176.11]) by mail.netplex.net (8.14.4/8.14.4/NETPLEX) with ESMTP id o8T3DVFF013361; Tue, 28 Sep 2010 23:13:31 -0400 (EDT) X-Virus-Scanned: by AMaViS and Clam AntiVirus (mail.netplex.net) X-Greylist: Message whitelisted by DRAC access database, not delayed by milter-greylist-4.2.2 (mail.netplex.net [204.213.176.10]); Tue, 28 Sep 2010 23:13:31 -0400 (EDT) Date: Tue, 28 Sep 2010 23:13:30 -0400 (EDT) From: Daniel Eischen X-X-Sender: eischen@sea.ntplx.net To: David Xu In-Reply-To: <4CA3181E.6030000@freebsd.org> Message-ID: References: <201009280457.o8S4vuS9060037@svn.freebsd.org> <201009281202.22555.jkim@FreeBSD.org> <201009281220.12278.jkim@FreeBSD.org> <201009281829.13253.jkim@FreeBSD.org> <4CA3181E.6030000@freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, John Baldwin , Jung-uk Kim Subject: Re: svn commit: r213241 - in head: include lib/libthr/thread X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Daniel Eischen List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2010 03:28:03 -0000 On Wed, 29 Sep 2010, David Xu wrote: > Jung-uk Kim wrote: >> On Tuesday 28 September 2010 12:20 pm, Jung-uk Kim wrote: [ snip ] >>> Unfortunately, it seems to have a regression: >>> >>> %cat test.c >>> #include >>> #include >>> >>> static pthread_cond_t static_cond = PTHREAD_COND_INITIALIZER; >>> static pthread_mutex_t static_mutex = PTHREAD_MUTEX_INITIALIZER; >>> >>> int >>> main(void) >>> { >>> >>> // pthread_mutex_lock(&static_mutex); >>> printf("%d\n", pthread_cond_wait(&static_cond, &static_mutex)); >>> pthread_mutex_unlock(&static_mutex); >>> >>> return (0); >>> } >>> %cc -o test test.c -pthread >>> %./test >>> Segmentation fault (core dumped) >>> >>> pthread_cond_wait(3) had to return EPERM here. :-( >> >> I realized it is a libthr "feature" to catch real application bugs and to >> increase performance by not checking rare conditions, I guess. :-/ >> >> Sorry for the noise, >> >> Jung-uk Kim >> > I think your example is legal, I might add checking back, however, it > would return two codes, EINVAL and EPERM. By default, I think we should check. I think PTHREAD_MUTEX_DEFAULT should be equal to PTHREAD_MUTEX_ERRORCHECK. So PTHREAD_MUTEX_INITIALIZER would default to error checking. I also agree -- if the mutex isn't valid, then return EINVAL, and if not locked, return EPERM. -- DE From owner-svn-src-head@FreeBSD.ORG Wed Sep 29 06:06:59 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 37175106566B; Wed, 29 Sep 2010 06:06:59 +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 261988FC15; Wed, 29 Sep 2010 06:06: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 o8T66x3C098069; Wed, 29 Sep 2010 06:06:59 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8T66xja098067; Wed, 29 Sep 2010 06:06:59 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201009290606.o8T66xja098067@svn.freebsd.org> From: David Xu Date: Wed, 29 Sep 2010 06:06:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213257 - head/lib/libthr/thread X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2010 06:06:59 -0000 Author: davidxu Date: Wed Sep 29 06:06:58 2010 New Revision: 213257 URL: http://svn.freebsd.org/changeset/base/213257 Log: Check invalid mutex in _mutex_cv_unlock. Modified: head/lib/libthr/thread/thr_mutex.c Modified: head/lib/libthr/thread/thr_mutex.c ============================================================================== --- head/lib/libthr/thread/thr_mutex.c Wed Sep 29 02:36:58 2010 (r213256) +++ head/lib/libthr/thread/thr_mutex.c Wed Sep 29 06:06:58 2010 (r213257) @@ -636,6 +636,12 @@ _mutex_cv_unlock(pthread_mutex_t *mutex, struct pthread_mutex *m; m = *mutex; + if (__predict_false(m <= THR_MUTEX_DESTROYED)) { + if (m == THR_MUTEX_DESTROYED) + return (EINVAL); + return (EPERM); + } + /* * Check if the running thread is not the owner of the mutex. */ From owner-svn-src-head@FreeBSD.ORG Wed Sep 29 07:01:33 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E3D0A1065698; Wed, 29 Sep 2010 07:01:33 +0000 (UTC) (envelope-from andrew@fubar.geek.nz) Received: from out5.smtp.messagingengine.com (out5.smtp.messagingengine.com [66.111.4.29]) by mx1.freebsd.org (Postfix) with ESMTP id B23368FC1C; Wed, 29 Sep 2010 07:01:33 +0000 (UTC) Received: from compute2.internal (compute2.nyi.mail.srv.osa [10.202.2.42]) by gateway1.messagingengine.com (Postfix) with ESMTP id C7339BC6; Wed, 29 Sep 2010 02:43:00 -0400 (EDT) Received: from frontend2.messagingengine.com ([10.202.2.161]) by compute2.internal (MEProxy); Wed, 29 Sep 2010 02:43:00 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=messagingengine.com; h=date:from:to:cc:subject:message-id:in-reply-to:references:mime-version:content-type:content-transfer-encoding; s=smtpout; bh=R4SWDq8vZHCUMU9yCpsFFss0xRQ=; b=TLdDx2a2L67K5gwkMiDma02FMIs8QoAmBxr7dK+zKhZbZFIzmGFTpKToHQgjMirXKrBWaeL4xy7fqAb118UBLEGGV380HJV+tmBCEVscgFG0n0A130V2N9Ftov+tLORo9w/KrmeGBwnIeNBAjRpftKtNhcJzXvteWetwifHwdMw= X-Sasl-enc: kyNVmYotujlFPxPKRCJ2RII305UG18Y+TU0zxq2OvRyJ 1285742579 Received: from localhost (70.244.69.111.dynamic.snap.net.nz [111.69.244.70]) by mail.messagingengine.com (Postfix) with ESMTPA id C410A5E4FE5; Wed, 29 Sep 2010 02:42:58 -0400 (EDT) Date: Wed, 29 Sep 2010 19:43:25 +1300 From: Andrew Turner To: Oleksandr Tymoshenko Message-ID: <20100929194325.7e2a3843@fubar.geek.nz> In-Reply-To: <201009280324.o8S3OrV9058046@svn.freebsd.org> References: <201009280324.o8S3OrV9058046@svn.freebsd.org> X-Mailer: Claws Mail 3.7.6 (GTK+ 2.20.1; i386-portbld-freebsd8.0) X-Pirate: Arrrr Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r213237 - in head/sys: conf dev/gpio sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2010 07:01:34 -0000 On Tue, 28 Sep 2010 03:24:53 +0000 (UTC) Oleksandr Tymoshenko wrote: > Author: gonzo > Date: Tue Sep 28 03:24:53 2010 > New Revision: 213237 > URL: http://svn.freebsd.org/changeset/base/213237 > > Log: > Initial GPIO bus support. Includes: > - GPIO bus controller interface > - GPIO bus interface > - Implementation of GPIO led(4) compatible device > - Implementation of iic(4) bus over GPIO (author: Luiz Otavio O > Souza) > Tested by: Luiz Otavio O Souza, Alexandr Rybalko It looks like you forgot a license in sys/dev/gpio/gpioc.c Andrew From owner-svn-src-head@FreeBSD.ORG Wed Sep 29 07:31:06 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3DDA01065694; Wed, 29 Sep 2010 07:31:06 +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 2D1A08FC15; Wed, 29 Sep 2010 07:31: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 o8T7V6tf099891; Wed, 29 Sep 2010 07:31:06 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8T7V6xc099889; Wed, 29 Sep 2010 07:31:06 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201009290731.o8T7V6xc099889@svn.freebsd.org> From: David Xu Date: Wed, 29 Sep 2010 07:31:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213258 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2010 07:31:06 -0000 Author: davidxu Date: Wed Sep 29 07:31:05 2010 New Revision: 213258 URL: http://svn.freebsd.org/changeset/base/213258 Log: - kern_sched_rr_get_interval should return interval for thread 1 in target process. - eliminate a goto. MFC after: 1 week Modified: head/sys/kern/p1003_1b.c Modified: head/sys/kern/p1003_1b.c ============================================================================== --- head/sys/kern/p1003_1b.c Wed Sep 29 06:06:58 2010 (r213257) +++ head/sys/kern/p1003_1b.c Wed Sep 29 07:31:05 2010 (r213258) @@ -219,10 +219,8 @@ sched_getscheduler(struct thread *td, st PROC_LOCK(targetp); } else { targetp = pfind(uap->pid); - if (targetp == NULL) { - e = ESRCH; - goto done2; - } + if (targetp == NULL) + return (ESRCH); targettd = FIRST_THREAD_IN_PROC(targetp); } @@ -233,7 +231,6 @@ sched_getscheduler(struct thread *td, st } PROC_UNLOCK(targetp); -done2: return (e); } @@ -293,13 +290,10 @@ kern_sched_rr_get_interval(struct thread targetp = td->td_proc; PROC_LOCK(targetp); } else { - targetp = td->td_proc; - PROC_LOCK(targetp); - targettd = thread_find(targetp, pid); - if (targettd == NULL) { - PROC_UNLOCK(targetp); + targetp = pfind(pid); + if (targetp == NULL) return (ESRCH); - } + targettd = FIRST_THREAD_IN_PROC(targetp); } e = p_cansee(td, targetp); From owner-svn-src-head@FreeBSD.ORG Wed Sep 29 07:40:12 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 26CD31065675; Wed, 29 Sep 2010 07:40:12 +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 166988FC0C; Wed, 29 Sep 2010 07:40: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 o8T7eB9a000214; Wed, 29 Sep 2010 07:40:11 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8T7eBD0000212; Wed, 29 Sep 2010 07:40:11 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201009290740.o8T7eBD0000212@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 29 Sep 2010 07:40:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213259 - head/sys/ufs/ffs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2010 07:40:12 -0000 Author: kib Date: Wed Sep 29 07:40:11 2010 New Revision: 213259 URL: http://svn.freebsd.org/changeset/base/213259 Log: Fix typo in comment. Modified: head/sys/ufs/ffs/ffs_softdep.c Modified: head/sys/ufs/ffs/ffs_softdep.c ============================================================================== --- head/sys/ufs/ffs/ffs_softdep.c Wed Sep 29 07:31:05 2010 (r213258) +++ head/sys/ufs/ffs/ffs_softdep.c Wed Sep 29 07:40:11 2010 (r213259) @@ -9464,7 +9464,7 @@ handle_written_indirdep(indirdep, bp, bp indirdep->ir_state |= ATTACHED; /* * Move allocindirs with written pointers to the completehd if - * the the indirdep's pointer is not yet written. Otherwise + * the indirdep's pointer is not yet written. Otherwise * free them here. */ while ((aip = LIST_FIRST(&indirdep->ir_writehd)) != 0) { From owner-svn-src-head@FreeBSD.ORG Wed Sep 29 09:22:12 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F25DD106566C; Wed, 29 Sep 2010 09:22:12 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E1CC98FC14; Wed, 29 Sep 2010 09:22: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 o8T9MC4J002873; Wed, 29 Sep 2010 09:22:12 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8T9MCuJ002871; Wed, 29 Sep 2010 09:22:12 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201009290922.o8T9MCuJ002871@svn.freebsd.org> From: Luigi Rizzo Date: Wed, 29 Sep 2010 09:22:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213265 - head/sys/netinet/ipfw X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2010 09:22:13 -0000 Author: luigi Date: Wed Sep 29 09:22:12 2010 New Revision: 213265 URL: http://svn.freebsd.org/changeset/base/213265 Log: fix handling of initial credit for an idle pipe. This fixes the bug where setting bw > 1 MTU/tick resulted in infinite bandwidth if io_fast=1 PR: 147245 148429 Obtained from: Riccardo Panicucci MFC after: 3 days Modified: head/sys/netinet/ipfw/ip_dn_io.c Modified: head/sys/netinet/ipfw/ip_dn_io.c ============================================================================== --- head/sys/netinet/ipfw/ip_dn_io.c Wed Sep 29 09:20:18 2010 (r213264) +++ head/sys/netinet/ipfw/ip_dn_io.c Wed Sep 29 09:22:12 2010 (r213265) @@ -752,8 +752,11 @@ dummynet_io(struct mbuf **m0, int dir, s } /* compute the initial allowance */ - { + if (si->idle_time < dn_cfg.curr_time) { + /* Do this only on the first packet on an idle pipe */ struct dn_link *p = &fs->sched->link; + + si->sched_time = dn_cfg.curr_time; si->credit = dn_cfg.io_fast ? p->bandwidth : 0; if (p->burst) { uint64_t burst = (dn_cfg.curr_time - si->idle_time) * p->bandwidth; From owner-svn-src-head@FreeBSD.ORG Wed Sep 29 09:40:21 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1A4EB106564A; Wed, 29 Sep 2010 09:40:21 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 08F1A8FC1A; Wed, 29 Sep 2010 09:40:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8T9eKOg003335; Wed, 29 Sep 2010 09:40:20 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8T9eKvb003329; Wed, 29 Sep 2010 09:40:20 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201009290940.o8T9eKvb003329@svn.freebsd.org> From: Luigi Rizzo Date: Wed, 29 Sep 2010 09:40:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213267 - head/sys/netinet/ipfw X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2010 09:40:21 -0000 Author: luigi Date: Wed Sep 29 09:40:20 2010 New Revision: 213267 URL: http://svn.freebsd.org/changeset/base/213267 Log: whitespace changes in preparation for future commits Modified: head/sys/netinet/ipfw/dn_sched.h head/sys/netinet/ipfw/dn_sched_wf2q.c head/sys/netinet/ipfw/ip_dn_glue.c head/sys/netinet/ipfw/ip_dn_io.c head/sys/netinet/ipfw/ip_dummynet.c Modified: head/sys/netinet/ipfw/dn_sched.h ============================================================================== --- head/sys/netinet/ipfw/dn_sched.h Wed Sep 29 09:25:22 2010 (r213266) +++ head/sys/netinet/ipfw/dn_sched.h Wed Sep 29 09:40:20 2010 (r213267) @@ -166,6 +166,8 @@ dn_dequeue(struct dn_queue *q) if (m == NULL) return NULL; q->mq.head = m->m_nextpkt; + + /* Update stats for the queue */ q->ni.length--; q->ni.len_bytes -= m->m_pkthdr.len; if (q->_si) { Modified: head/sys/netinet/ipfw/dn_sched_wf2q.c ============================================================================== --- head/sys/netinet/ipfw/dn_sched_wf2q.c Wed Sep 29 09:25:22 2010 (r213266) +++ head/sys/netinet/ipfw/dn_sched_wf2q.c Wed Sep 29 09:40:20 2010 (r213267) @@ -318,7 +318,7 @@ wf2qp_free_queue(struct dn_queue *q) { struct wf2qp_queue *alg_fq = (struct wf2qp_queue *)q; struct wf2qp_si *si = (struct wf2qp_si *)(q->_si + 1); - + if (alg_fq->S >= alg_fq->F + 1) return 0; /* nothing to do, not in any heap */ si->wsum -= q->fs->fs.par[0]; Modified: head/sys/netinet/ipfw/ip_dn_glue.c ============================================================================== --- head/sys/netinet/ipfw/ip_dn_glue.c Wed Sep 29 09:25:22 2010 (r213266) +++ head/sys/netinet/ipfw/ip_dn_glue.c Wed Sep 29 09:40:20 2010 (r213267) @@ -1,4 +1,4 @@ -/*- +/*- * Copyright (c) 2010 Riccardo Panicucci, Universita` di Pisa * All rights reserved * Modified: head/sys/netinet/ipfw/ip_dn_io.c ============================================================================== --- head/sys/netinet/ipfw/ip_dn_io.c Wed Sep 29 09:25:22 2010 (r213266) +++ head/sys/netinet/ipfw/ip_dn_io.c Wed Sep 29 09:40:20 2010 (r213267) @@ -120,10 +120,6 @@ SYSCTL_INT(_net_inet_ip_dummynet, OID_AU CTLFLAG_RW, DC(io_fast), 0, "Enable fast dummynet io."); SYSCTL_INT(_net_inet_ip_dummynet, OID_AUTO, debug, CTLFLAG_RW, DC(debug), 0, "Dummynet debug level"); -SYSCTL_INT(_net_inet_ip_dummynet, OID_AUTO, expire, - CTLFLAG_RW, DC(expire), 0, "Expire empty queues/pipes"); -SYSCTL_INT(_net_inet_ip_dummynet, OID_AUTO, expire_cycle, - CTLFLAG_RD, DC(expire_cycle), 0, "Expire cycle for queues/pipes"); /* RED parameters */ SYSCTL_INT(_net_inet_ip_dummynet, OID_AUTO, red_lookup_depth, @@ -147,6 +143,12 @@ SYSCTL_LONG(_net_inet_ip_dummynet, OID_A CTLFLAG_RD, &tick_lost, 0, "Number of ticks coalesced by dummynet taskqueue."); +/* Drain parameters */ +SYSCTL_INT(_net_inet_ip_dummynet, OID_AUTO, expire, + CTLFLAG_RW, DC(expire), 0, "Expire empty queues/pipes"); +SYSCTL_INT(_net_inet_ip_dummynet, OID_AUTO, expire_cycle, + CTLFLAG_RD, DC(expire_cycle), 0, "Expire cycle for queues/pipes"); + /* statistics */ SYSCTL_INT(_net_inet_ip_dummynet, OID_AUTO, schk_count, CTLFLAG_RD, DC(schk_count), 0, "Number of schedulers"); @@ -463,14 +465,16 @@ serve_sched(struct mq *q, struct dn_sch_ done = 0; while (si->credit >= 0 && (m = s->fp->dequeue(si)) != NULL) { uint64_t len_scaled; + done++; len_scaled = (bw == 0) ? 0 : hz * - (m->m_pkthdr.len * 8 + extra_bits(m, s)); + (m->m_pkthdr.len * 8 + extra_bits(m, s)); si->credit -= len_scaled; /* Move packet in the delay line */ dn_tag_get(m)->output_time += s->link.delay ; mq_append(&si->dline.mq, m); } + /* * If credit >= 0 the instance is idle, mark time. * Otherwise put back in the heap, and adjust the output Modified: head/sys/netinet/ipfw/ip_dummynet.c ============================================================================== --- head/sys/netinet/ipfw/ip_dummynet.c Wed Sep 29 09:25:22 2010 (r213266) +++ head/sys/netinet/ipfw/ip_dummynet.c Wed Sep 29 09:40:20 2010 (r213267) @@ -445,6 +445,7 @@ si_new(uintptr_t key, int flags, void *a si = malloc(l, M_DUMMYNET, M_NOWAIT | M_ZERO); if (si == NULL) goto error; + /* Set length only for the part passed up to userland. */ set_oid(&si->ni.oid, DN_SCH_I, sizeof(struct dn_flow)); set_oid(&(si->dline.oid), DN_DELAY_LINE, @@ -1571,7 +1572,7 @@ config_profile(struct dn_profile *pf, st */ if (s->profile == NULL) s->profile = malloc(pf->oid.len, - M_DUMMYNET, M_NOWAIT | M_ZERO); + M_DUMMYNET, M_NOWAIT | M_ZERO); if (s->profile == NULL) { D("no memory for profile %d", i); err = ENOMEM; From owner-svn-src-head@FreeBSD.ORG Wed Sep 29 11:52:44 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 61644106566C; Wed, 29 Sep 2010 11:52:44 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 511988FC0C; Wed, 29 Sep 2010 11: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 o8TBqisJ008133; Wed, 29 Sep 2010 11:52:44 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8TBqioi008131; Wed, 29 Sep 2010 11:52:44 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201009291152.o8TBqioi008131@svn.freebsd.org> From: John Baldwin Date: Wed, 29 Sep 2010 11:52:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213268 - head/sys/dev/ral X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2010 11:52:44 -0000 Author: jhb Date: Wed Sep 29 11:52:44 2010 New Revision: 213268 URL: http://svn.freebsd.org/changeset/base/213268 Log: If rt2560_bbp_init() fails, don't drop the lock as the callers of rt2560_init_locked() expect the lock to be held on return. Reported by: Anton Shterenlikht mexas of bristol ac uk MFC after: 1 week Modified: head/sys/dev/ral/rt2560.c Modified: head/sys/dev/ral/rt2560.c ============================================================================== --- head/sys/dev/ral/rt2560.c Wed Sep 29 09:40:20 2010 (r213267) +++ head/sys/dev/ral/rt2560.c Wed Sep 29 11:52:44 2010 (r213268) @@ -2667,8 +2667,7 @@ rt2560_init_locked(struct rt2560_softc * RAL_WRITE(sc, RT2560_CSR1, RT2560_HOST_READY); if (rt2560_bbp_init(sc) != 0) { - rt2560_stop(sc); - RAL_UNLOCK(sc); + rt2560_stop_locked(sc); return; } From owner-svn-src-head@FreeBSD.ORG Wed Sep 29 13:08:23 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 87F11106566B; Wed, 29 Sep 2010 13:08:23 +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 6D3318FC18; Wed, 29 Sep 2010 13:08:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8TD8NBG009977; Wed, 29 Sep 2010 13:08:23 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8TD8NHo009975; Wed, 29 Sep 2010 13:08:23 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201009291308.o8TD8NHo009975@svn.freebsd.org> From: Ed Maste Date: Wed, 29 Sep 2010 13:08:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213270 - head/etc/rc.d X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2010 13:08:23 -0000 Author: emaste Date: Wed Sep 29 13:08:23 2010 New Revision: 213270 URL: http://svn.freebsd.org/changeset/base/213270 Log: /etc/rc.d/defaultroute currently bails immediately if all interfaces set to use DHCP have no carrier. This can cause grief as it may take some time for link to be established, and defaultroute may terminate before this happens. Introduce a defaultroute_carrier_delay variable and then wait that long in defaultroute before bailing if no interfaces have carrier. With the default settings defaultroute will wait for five seconds for this, and the original 30 second wait for a default route to appear is unchanged. Note that there is in discussion an alternative approach to the broader problem of waiting for DHCP-configured routes. However, this change addresses a real problem in the current defaultroute script. Discussed on: freebsd-rc@ Modified: head/etc/rc.d/defaultroute Modified: head/etc/rc.d/defaultroute ============================================================================== --- head/etc/rc.d/defaultroute Wed Sep 29 12:53:02 2010 (r213269) +++ head/etc/rc.d/defaultroute Wed Sep 29 13:08:23 2010 (r213270) @@ -1,6 +1,6 @@ #!/bin/sh # -# Wait for the default route to be up +# Wait for the default route to be up if DHCP is in use # # $FreeBSD$ # @@ -16,9 +16,23 @@ name="defaultroute" start_cmd="defaultroute_start" stop_cmd=":" +# Does any interface have a carrier? +defaultroute_carrier() +{ + local carrier nocarrier + + carrier=1 + for _if in ${dhcp_interfaces}; do + output=`/sbin/ifconfig ${_if}` + nocarrier=`expr "${output}" : '.*[[:blank:]]status: \(no carrier\)'` + [ -z "${nocarrier}" ] && carrier=0 + done + return ${carrier} +} + defaultroute_start() { - local output carrier nocarrier nl + local nl waited afexists inet || return 0 @@ -26,35 +40,30 @@ defaultroute_start() # if none of the dhcp interfaces is plugged in. dhcp_interfaces=`list_net_interfaces dhcp` [ -z "${dhcp_interfaces}" ] && return - carrier=false - for _if in ${dhcp_interfaces}; do - output=`/sbin/ifconfig ${_if}` - nocarrier=`expr "${output}" : '.*[[:blank:]]status: \(no carrier\)'` - [ -z "${nocarrier}" ] && carrier=true - done - if ! ${carrier}; then - return - fi # Wait for a default route - delay=${defaultroute_delay} - while [ ${delay} -gt 0 ]; do + waited=0 + while [ ${waited} -lt ${defaultroute_delay} ]; do defif=`get_default_if -inet` if [ -n "${defif}" ]; then - if [ ${delay} -ne ${defaultroute_delay} ]; then + if [ ${waited} -ne 0 ]; then echo -n "($defif)" nl=1 fi break fi - if [ ${delay} -eq ${defaultroute_delay} ]; then - echo -n "Waiting ${delay}s for the default route interface: " + if [ ${waited} -eq 0 ]; then + echo -n "Waiting ${defaultroute_delay}s for the default route interface: " else echo -n . fi + if [ ${waited} -eq ${defaultroute_carrier_delay} ] && ! defaultroute_carrier; then + echo -n "(no carrier)" + break + fi nl=1 sleep 1 - delay=$(($delay - 1)) + waited=$(($waited + 1)) done [ -n "$nl" ] && echo From owner-svn-src-head@FreeBSD.ORG Wed Sep 29 13:24:57 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4EC3D106566B; Wed, 29 Sep 2010 13:24:57 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3EA038FC14; Wed, 29 Sep 2010 13:24: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 o8TDOvtm010376; Wed, 29 Sep 2010 13:24:57 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8TDOvwZ010374; Wed, 29 Sep 2010 13:24:57 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201009291324.o8TDOvwZ010374@svn.freebsd.org> From: John Baldwin Date: Wed, 29 Sep 2010 13:24:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213271 - head/sys/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2010 13:24:57 -0000 Author: jhb Date: Wed Sep 29 13:24:56 2010 New Revision: 213271 URL: http://svn.freebsd.org/changeset/base/213271 Log: Account for unlocking a spin mutex in the lock profiling code in the !SMP case. Submitted by: truckman MFC after: 3 days Modified: head/sys/sys/mutex.h Modified: head/sys/sys/mutex.h ============================================================================== --- head/sys/sys/mutex.h Wed Sep 29 13:08:23 2010 (r213270) +++ head/sys/sys/mutex.h Wed Sep 29 13:24:56 2010 (r213271) @@ -251,8 +251,11 @@ void _thread_lock_flags(struct thread *, #define _rel_spin_lock(mp) do { \ if (mtx_recursed((mp))) \ (mp)->mtx_recurse--; \ - else \ + else { \ + LOCKSTAT_PROFILE_RELEASE_LOCK(LS_MTX_SPIN_UNLOCK_RELEASE, \ + mp); \ (mp)->mtx_lock = MTX_UNOWNED; \ + } \ spinlock_exit(); \ } while (0) #endif /* SMP */ From owner-svn-src-head@FreeBSD.ORG Wed Sep 29 14:22:00 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CF19B106564A; Wed, 29 Sep 2010 14:22:00 +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 BDB4E8FC08; Wed, 29 Sep 2010 14:22:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8TEM01J011781; Wed, 29 Sep 2010 14:22:00 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8TEM0e3011776; Wed, 29 Sep 2010 14:22:00 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201009291422.o8TEM0e3011776@svn.freebsd.org> From: Ed Maste Date: Wed, 29 Sep 2010 14:22:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213272 - head/sys/dev/aac X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2010 14:22:00 -0000 Author: emaste Date: Wed Sep 29 14:22:00 2010 New Revision: 213272 URL: http://svn.freebsd.org/changeset/base/213272 Log: Previously, the aac driver did not handle enclosure management AIFs, which were raised during hot-swap events. Now such events trigger cam rescans, as is done in the mps driver. Submitted by: Mark Johnston Modified: head/sys/dev/aac/aac.c head/sys/dev/aac/aac_cam.c head/sys/dev/aac/aacreg.h head/sys/dev/aac/aacvar.h Modified: head/sys/dev/aac/aac.c ============================================================================== --- head/sys/dev/aac/aac.c Wed Sep 29 13:24:56 2010 (r213271) +++ head/sys/dev/aac/aac.c Wed Sep 29 14:22:00 2010 (r213272) @@ -3216,6 +3216,7 @@ aac_handle_aif(struct aac_softc *sc, str struct aac_mntinforesp *mir; int next, current, found; int count = 0, added = 0, i = 0; + uint32_t channel; fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); @@ -3324,6 +3325,27 @@ aac_handle_aif(struct aac_softc *sc, str break; + case AifEnEnclosureManagement: + switch (aif->data.EN.data.EEE.eventType) { + case AIF_EM_DRIVE_INSERTION: + case AIF_EM_DRIVE_REMOVAL: + channel = aif->data.EN.data.EEE.unitID; + if (sc->cam_rescan_cb != NULL) + sc->cam_rescan_cb(sc, + (channel >> 24) & 0xF, + (channel & 0xFFFF)); + break; + } + break; + + case AifEnAddJBOD: + case AifEnDeleteJBOD: + channel = aif->data.EN.data.ECE.container; + if (sc->cam_rescan_cb != NULL) + sc->cam_rescan_cb(sc, (channel >> 24) & 0xF, + AAC_CAM_TARGET_WILDCARD); + break; + default: break; } Modified: head/sys/dev/aac/aac_cam.c ============================================================================== --- head/sys/dev/aac/aac_cam.c Wed Sep 29 13:24:56 2010 (r213271) +++ head/sys/dev/aac/aac_cam.c Wed Sep 29 14:22:00 2010 (r213272) @@ -37,12 +37,15 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include +#include #include #include #include +#include #include #include #include @@ -76,6 +79,9 @@ static int aac_cam_detach(device_t dev); static void aac_cam_action(struct cam_sim *, union ccb *); static void aac_cam_poll(struct cam_sim *); static void aac_cam_complete(struct aac_command *); +static void aac_cam_rescan(struct aac_softc *sc, uint32_t channel, + uint32_t target_id); + static u_int32_t aac_cam_reset_bus(struct cam_sim *, union ccb *); static u_int32_t aac_cam_abort_ccb(struct cam_sim *, union ccb *); static u_int32_t aac_cam_term_io(struct cam_sim *, union ccb *); @@ -101,6 +107,43 @@ MODULE_DEPEND(aacp, cam, 1, 1, 1); MALLOC_DEFINE(M_AACCAM, "aaccam", "AAC CAM info"); static void +aac_cam_rescan(struct aac_softc *sc, uint32_t channel, uint32_t target_id) +{ + union ccb *ccb; + struct aac_sim *sim; + struct aac_cam *camsc; + + if (target_id == AAC_CAM_TARGET_WILDCARD) + target_id = CAM_TARGET_WILDCARD; + + TAILQ_FOREACH(sim, &sc->aac_sim_tqh, sim_link) { + camsc = sim->aac_cam; + if (camsc == NULL || camsc->inf == NULL || + camsc->inf->BusNumber != channel) + continue; + + ccb = xpt_alloc_ccb_nowait(); + if (ccb == NULL) { + device_printf(sc->aac_dev, + "Cannot allocate ccb for bus rescan.\n"); + return; + } + + if (xpt_create_path(&ccb->ccb_h.path, xpt_periph, + cam_sim_path(camsc->sim), + target_id, CAM_LUN_WILDCARD) != CAM_REQ_CMP) { + xpt_free_ccb(ccb); + device_printf(sc->aac_dev, + "Cannot create path for bus rescan.\n"); + return; + } + xpt_rescan(ccb); + break; + } +} + + +static void aac_cam_event(struct aac_softc *sc, struct aac_event *event, void *arg) { union ccb *ccb; @@ -141,6 +184,7 @@ aac_cam_detach(device_t dev) camsc = (struct aac_cam *)device_get_softc(dev); sc = camsc->inf->aac_sc; + camsc->inf->aac_cam = NULL; mtx_lock(&sc->aac_io_lock); @@ -149,6 +193,8 @@ aac_cam_detach(device_t dev) xpt_bus_deregister(cam_sim_path(camsc->sim)); cam_sim_free(camsc->sim, /*free_devq*/TRUE); + sc->cam_rescan_cb = NULL; + mtx_unlock(&sc->aac_io_lock); return (0); @@ -171,6 +217,7 @@ aac_cam_attach(device_t dev) camsc = (struct aac_cam *)device_get_softc(dev); inf = (struct aac_sim *)device_get_ivars(dev); camsc->inf = inf; + camsc->inf->aac_cam = camsc; devq = cam_simq_alloc(inf->TargetsPerBus); if (devq == NULL) @@ -198,6 +245,7 @@ aac_cam_attach(device_t dev) mtx_unlock(&inf->aac_sc->aac_io_lock); return (EIO); } + inf->aac_sc->cam_rescan_cb = aac_cam_rescan; mtx_unlock(&inf->aac_sc->aac_io_lock); camsc->sim = sim; Modified: head/sys/dev/aac/aacreg.h ============================================================================== --- head/sys/dev/aac/aacreg.h Wed Sep 29 13:24:56 2010 (r213271) +++ head/sys/dev/aac/aacreg.h Wed Sep 29 14:22:00 2010 (r213272) @@ -935,6 +935,11 @@ struct aac_AifEnsEnclosureEvent { u_int32_t eventType; /* event type */ } __packed; +typedef enum { + AIF_EM_DRIVE_INSERTION=31, + AIF_EM_DRIVE_REMOVAL +} aac_AifEMEventType; + struct aac_AifEnsBatteryEvent { AAC_NVBATT_TRANSITION transition_type; /* eg from low to ok */ AAC_NVBATTSTATUS current_state; /* current batt state */ Modified: head/sys/dev/aac/aacvar.h ============================================================================== --- head/sys/dev/aac/aacvar.h Wed Sep 29 13:24:56 2010 (r213271) +++ head/sys/dev/aac/aacvar.h Wed Sep 29 14:22:00 2010 (r213272) @@ -113,6 +113,7 @@ struct aac_container /* * Per-SIM data structure */ +struct aac_cam; struct aac_sim { device_t sim_dev; @@ -120,6 +121,7 @@ struct aac_sim int BusNumber; int InitiatorBusId; struct aac_softc *aac_sc; + struct aac_cam *aac_cam; TAILQ_ENTRY(aac_sim) sim_link; }; @@ -420,6 +422,9 @@ struct aac_softc u_int32_t aac_max_fib_size; /* max. FIB size */ u_int32_t aac_sg_tablesize; /* max. sg count from host */ u_int32_t aac_max_sectors; /* max. I/O size from host (blocks) */ +#define AAC_CAM_TARGET_WILDCARD ~0 + void (*cam_rescan_cb)(struct aac_softc *, uint32_t, + uint32_t); }; /* From owner-svn-src-head@FreeBSD.ORG Wed Sep 29 14:41:04 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0D4221065670; Wed, 29 Sep 2010 14:41:04 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EE4528FC18; Wed, 29 Sep 2010 14:41: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 o8TEf3WJ012815; Wed, 29 Sep 2010 14:41:03 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8TEf3Gf012809; Wed, 29 Sep 2010 14:41:03 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <201009291441.o8TEf3Gf012809@svn.freebsd.org> From: Rui Paulo Date: Wed, 29 Sep 2010 14:41:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213274 - in head: contrib/binutils/bfd contrib/binutils/include/coff gnu/usr.bin/binutils/libbfd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2010 14:41:04 -0000 Author: rpaulo Date: Wed Sep 29 14:41:03 2010 New Revision: 213274 URL: http://svn.freebsd.org/changeset/base/213274 Log: Add support for the BFD target efi-app-x86_64. This uses only GPL2 source code and is a requirement for a 64 bit EFI boot loader. Added: head/contrib/binutils/bfd/coff-x86_64.c (contents, props changed) head/contrib/binutils/bfd/efi-app-x86_64.c (contents, props changed) head/contrib/binutils/include/coff/x86_64.h (contents, props changed) Modified: head/contrib/binutils/bfd/targets.c head/contrib/binutils/include/coff/internal.h head/gnu/usr.bin/binutils/libbfd/Makefile.amd64 Added: head/contrib/binutils/bfd/coff-x86_64.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/binutils/bfd/coff-x86_64.c Wed Sep 29 14:41:03 2010 (r213274) @@ -0,0 +1,785 @@ +/* BFD back-end for AMD 64 COFF files. + Copyright 2006, 2007 Free Software Foundation, Inc. + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. + + Written by Kai Tietz, OneVision Software GmbH&CoKg. */ + +#ifndef COFF_WITH_pex64 +#define COFF_WITH_pex64 +#endif + +#include "sysdep.h" +#include "bfd.h" +#include "libbfd.h" +#include "coff/x86_64.h" +#include "coff/internal.h" +#include "coff/pe.h" +#include "libcoff.h" +#include "libiberty.h" + +#define BADMAG(x) AMD64BADMAG(x) + +#ifdef COFF_WITH_pex64 +# undef AOUTSZ +# define AOUTSZ PEPAOUTSZ +# define PEAOUTHDR PEPAOUTHDR +#endif + +#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (2) + +/* The page size is a guess based on ELF. */ + +#define COFF_PAGE_SIZE 0x1000 + +/* For some reason when using AMD COFF the value stored in the .text + section for a reference to a common symbol is the value itself plus + any desired offset. Ian Taylor, Cygnus Support. */ + +/* If we are producing relocatable output, we need to do some + adjustments to the object file that are not done by the + bfd_perform_relocation function. This function is called by every + reloc type to make any required adjustments. */ + +static bfd_reloc_status_type +coff_amd64_reloc (bfd *abfd, + arelent *reloc_entry, + asymbol *symbol, + void * data, + asection *input_section ATTRIBUTE_UNUSED, + bfd *output_bfd, + char **error_message ATTRIBUTE_UNUSED) +{ + symvalue diff; + +#if !defined(COFF_WITH_PE) + if (output_bfd == NULL) + return bfd_reloc_continue; +#endif + + if (bfd_is_com_section (symbol->section)) + { +#if !defined(COFF_WITH_PE) + /* We are relocating a common symbol. The current value in the + object file is ORIG + OFFSET, where ORIG is the value of the + common symbol as seen by the object file when it was compiled + (this may be zero if the symbol was undefined) and OFFSET is + the offset into the common symbol (normally zero, but may be + non-zero when referring to a field in a common structure). + ORIG is the negative of reloc_entry->addend, which is set by + the CALC_ADDEND macro below. We want to replace the value in + the object file with NEW + OFFSET, where NEW is the value of + the common symbol which we are going to put in the final + object file. NEW is symbol->value. */ + diff = symbol->value + reloc_entry->addend; +#else + /* In PE mode, we do not offset the common symbol. */ + diff = reloc_entry->addend; +#endif + } + else + { + /* For some reason bfd_perform_relocation always effectively + ignores the addend for a COFF target when producing + relocatable output. This seems to be always wrong for 386 + COFF, so we handle the addend here instead. */ +#if defined(COFF_WITH_PE) + if (output_bfd == NULL) + { + reloc_howto_type *howto = reloc_entry->howto; + + /* Although PC relative relocations are very similar between + PE and non-PE formats, but they are off by 1 << howto->size + bytes. For the external relocation, PE is very different + from others. See md_apply_fix3 () in gas/config/tc-amd64.c. + When we link PE and non-PE object files together to + generate a non-PE executable, we have to compensate it + here. */ + if(howto->pc_relative && howto->pcrel_offset) + diff = -(1 << howto->size); + else if(symbol->flags & BSF_WEAK) + diff = reloc_entry->addend - symbol->value; + else + diff = -reloc_entry->addend; + } + else +#endif + diff = reloc_entry->addend; + } + +#if defined(COFF_WITH_PE) + /* FIXME: How should this case be handled? */ + if (reloc_entry->howto->type == R_AMD64_IMAGEBASE + && output_bfd != NULL + && bfd_get_flavour (output_bfd) == bfd_target_coff_flavour) + diff -= pe_data (output_bfd)->pe_opthdr.ImageBase; +#endif + +#define DOIT(x) \ + x = ((x & ~howto->dst_mask) | (((x & howto->src_mask) + diff) & howto->dst_mask)) + + if (diff != 0) + { + reloc_howto_type *howto = reloc_entry->howto; + unsigned char *addr = (unsigned char *) data + reloc_entry->address; + + switch (howto->size) + { + case 0: + { + char x = bfd_get_8 (abfd, addr); + DOIT (x); + bfd_put_8 (abfd, x, addr); + } + break; + + case 1: + { + short x = bfd_get_16 (abfd, addr); + DOIT (x); + bfd_put_16 (abfd, (bfd_vma) x, addr); + } + break; + + case 2: + { + long x = bfd_get_32 (abfd, addr); + DOIT (x); + bfd_put_32 (abfd, (bfd_vma) x, addr); + } + break; + case 4: + { + long long x = bfd_get_64 (abfd, addr); + DOIT (x); + bfd_put_64 (abfd, (bfd_vma) x, addr); + } + break; + + default: + abort (); + } + } + + /* Now let bfd_perform_relocation finish everything up. */ + return bfd_reloc_continue; +} + +#if defined(COFF_WITH_PE) +/* Return TRUE if this relocation should appear in the output .reloc + section. */ + +static bfd_boolean +in_reloc_p (bfd *abfd ATTRIBUTE_UNUSED, reloc_howto_type *howto) +{ + return ! howto->pc_relative && howto->type != R_AMD64_IMAGEBASE; +} +#endif /* COFF_WITH_PE */ + +#ifndef PCRELOFFSET +#define PCRELOFFSET TRUE +#endif + +static reloc_howto_type howto_table[] = +{ + EMPTY_HOWTO (0), + HOWTO (R_AMD64_DIR64, /* type 1*/ + 0, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long, 4 = long long) */ + 64, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + coff_amd64_reloc, /* special_function */ + "R_X86_64_64", /* name */ + TRUE, /* partial_inplace */ + 0xffffffffffffffffll, /* src_mask */ + 0xffffffffffffffffll, /* dst_mask */ + TRUE), /* pcrel_offset */ + HOWTO (R_AMD64_DIR32, /* type 2 */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + coff_amd64_reloc, /* special_function */ + "R_X86_64_32", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + /* PE IMAGE_REL_AMD64_ADDR32NB relocation (3). */ + HOWTO (R_AMD64_IMAGEBASE, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + coff_amd64_reloc, /* special_function */ + "rva32", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + /* 32-bit longword PC relative relocation (4). */ + HOWTO (R_AMD64_PCRLONG, /* type 4 */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + coff_amd64_reloc, /* special_function */ + "R_X86_64_PC32", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + PCRELOFFSET), /* pcrel_offset */ + + HOWTO (R_AMD64_PCRLONG_1, /* type 5 */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + coff_amd64_reloc, /* special_function */ + "DISP32+1", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + PCRELOFFSET), /* pcrel_offset */ + HOWTO (R_AMD64_PCRLONG_2, /* type 6 */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + coff_amd64_reloc, /* special_function */ + "DISP32+2", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + PCRELOFFSET), /* pcrel_offset */ + HOWTO (R_AMD64_PCRLONG_3, /* type 7 */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + coff_amd64_reloc, /* special_function */ + "DISP32+3", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + PCRELOFFSET), /* pcrel_offset */ + HOWTO (R_AMD64_PCRLONG_4, /* type 8 */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + coff_amd64_reloc, /* special_function */ + "DISP32+4", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + PCRELOFFSET), /* pcrel_offset */ + HOWTO (R_AMD64_PCRLONG_5, /* type 9 */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + coff_amd64_reloc, /* special_function */ + "DISP32+5", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + PCRELOFFSET), /* pcrel_offset */ + EMPTY_HOWTO (10), /* R_AMD64_SECTION 10 */ +#if defined(COFF_WITH_PE) + /* 32-bit longword section relative relocation (11). */ + HOWTO (R_AMD64_SECREL, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + coff_amd64_reloc, /* special_function */ + "secrel32", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + TRUE), /* pcrel_offset */ +#else + EMPTY_HOWTO (11), +#endif + EMPTY_HOWTO (12), + EMPTY_HOWTO (13), +#ifndef DONT_EXTEND_AMD64 + HOWTO (R_AMD64_PCRQUAD, + 0, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + coff_amd64_reloc, /* special_function */ + "R_X86_64_PC64", /* name */ + TRUE, /* partial_inplace */ + 0xffffffffffffffffll, /* src_mask */ + 0xffffffffffffffffll, /* dst_mask */ + PCRELOFFSET), /* pcrel_offset */ +#else + EMPTY_HOWTO (14), +#endif + /* Byte relocation (15). */ + HOWTO (R_RELBYTE, /* type */ + 0, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + coff_amd64_reloc, /* special_function */ + "R_X86_64_8", /* name */ + TRUE, /* partial_inplace */ + 0x000000ff, /* src_mask */ + 0x000000ff, /* dst_mask */ + PCRELOFFSET), /* pcrel_offset */ + /* 16-bit word relocation (16). */ + HOWTO (R_RELWORD, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + coff_amd64_reloc, /* special_function */ + "R_X86_64_16", /* name */ + TRUE, /* partial_inplace */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + PCRELOFFSET), /* pcrel_offset */ + /* 32-bit longword relocation (17). */ + HOWTO (R_RELLONG, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + coff_amd64_reloc, /* special_function */ + "R_X86_64_32S", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + PCRELOFFSET), /* pcrel_offset */ + /* Byte PC relative relocation (18). */ + HOWTO (R_PCRBYTE, /* type */ + 0, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + coff_amd64_reloc, /* special_function */ + "R_X86_64_PC8", /* name */ + TRUE, /* partial_inplace */ + 0x000000ff, /* src_mask */ + 0x000000ff, /* dst_mask */ + PCRELOFFSET), /* pcrel_offset */ + /* 16-bit word PC relative relocation (19). */ + HOWTO (R_PCRWORD, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + coff_amd64_reloc, /* special_function */ + "R_X86_64_PC16", /* name */ + TRUE, /* partial_inplace */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + PCRELOFFSET), /* pcrel_offset */ + /* 32-bit longword PC relative relocation (20). */ + HOWTO (R_PCRLONG, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + coff_amd64_reloc, /* special_function */ + "R_X86_64_PC32", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + PCRELOFFSET) /* pcrel_offset */ +}; + +/* Turn a howto into a reloc nunmber */ + +#define SELECT_RELOC(x,howto) { x.r_type = howto->type; } +#define I386 1 /* Customize coffcode.h */ +#define AMD64 1 + +#define RTYPE2HOWTO(cache_ptr, dst) \ + ((cache_ptr)->howto = \ + ((dst)->r_type < ARRAY_SIZE (howto_table)) \ + ? howto_table + (dst)->r_type \ + : NULL) + +/* For 386 COFF a STYP_NOLOAD | STYP_BSS section is part of a shared + library. On some other COFF targets STYP_BSS is normally + STYP_NOLOAD. */ +#define BSS_NOLOAD_IS_SHARED_LIBRARY + +/* Compute the addend of a reloc. If the reloc is to a common symbol, + the object file contains the value of the common symbol. By the + time this is called, the linker may be using a different symbol + from a different object file with a different value. Therefore, we + hack wildly to locate the original symbol from this file so that we + can make the correct adjustment. This macro sets coffsym to the + symbol from the original file, and uses it to set the addend value + correctly. If this is not a common symbol, the usual addend + calculation is done, except that an additional tweak is needed for + PC relative relocs. + FIXME: This macro refers to symbols and asect; these are from the + calling function, not the macro arguments. */ + +#define CALC_ADDEND(abfd, ptr, reloc, cache_ptr) \ + { \ + coff_symbol_type *coffsym = NULL; \ + \ + if (ptr && bfd_asymbol_bfd (ptr) != abfd) \ + coffsym = (obj_symbols (abfd) \ + + (cache_ptr->sym_ptr_ptr - symbols)); \ + else if (ptr) \ + coffsym = coff_symbol_from (abfd, ptr); \ + \ + if (coffsym != NULL \ + && coffsym->native->u.syment.n_scnum == 0) \ + cache_ptr->addend = - coffsym->native->u.syment.n_value; \ + else if (ptr && bfd_asymbol_bfd (ptr) == abfd \ + && ptr->section != NULL) \ + cache_ptr->addend = - (ptr->section->vma + ptr->value); \ + else \ + cache_ptr->addend = 0; \ + if (ptr && howto_table[reloc.r_type].pc_relative) \ + cache_ptr->addend += asect->vma; \ + } + +/* We use the special COFF backend linker. For normal AMD64 COFF, we + can use the generic relocate_section routine. For PE, we need our + own routine. */ + +#if !defined(COFF_WITH_PE) + +#define coff_relocate_section _bfd_coff_generic_relocate_section + +#else /* COFF_WITH_PE */ + +/* The PE relocate section routine. The only difference between this + and the regular routine is that we don't want to do anything for a + relocatable link. */ + +static bfd_boolean +coff_pe_amd64_relocate_section (bfd *output_bfd, + struct bfd_link_info *info, + bfd *input_bfd, + asection *input_section, + bfd_byte *contents, + struct internal_reloc *relocs, + struct internal_syment *syms, + asection **sections) +{ + if (info->relocatable) + return TRUE; + + return _bfd_coff_generic_relocate_section (output_bfd, info, input_bfd,input_section, contents,relocs, syms, sections); +} + +#define coff_relocate_section coff_pe_amd64_relocate_section + +#endif /* COFF_WITH_PE */ + +/* Convert an rtype to howto for the COFF backend linker. */ + +static reloc_howto_type * +coff_amd64_rtype_to_howto (bfd *abfd ATTRIBUTE_UNUSED, + asection *sec, + struct internal_reloc *rel, + struct coff_link_hash_entry *h, + struct internal_syment *sym, + bfd_vma *addendp) +{ + reloc_howto_type *howto; + + if (rel->r_type > ARRAY_SIZE (howto_table)) + { + bfd_set_error (bfd_error_bad_value); + return NULL; + } + if (rel->r_type >= R_AMD64_PCRLONG_1 && rel->r_type <= R_AMD64_PCRLONG_5) + { + rel->r_vaddr += (bfd_vma)(rel->r_type-R_AMD64_PCRLONG); + rel->r_type = R_AMD64_PCRLONG; + } + howto = howto_table + rel->r_type; + +#if defined(COFF_WITH_PE) + /* Cancel out code in _bfd_coff_generic_relocate_section. */ + *addendp = 0; +#endif + + if (howto->pc_relative) + *addendp += sec->vma; + + if (sym != NULL && sym->n_scnum == 0 && sym->n_value != 0) + { + /* This is a common symbol. The section contents include the + size (sym->n_value) as an addend. The relocate_section + function will be adding in the final value of the symbol. We + need to subtract out the current size in order to get the + correct result. */ + BFD_ASSERT (h != NULL); + +#if !defined(COFF_WITH_PE) + /* I think we *do* want to bypass this. If we don't, I have + seen some data parameters get the wrong relocation address. + If I link two versions with and without this section bypassed + and then do a binary comparison, the addresses which are + different can be looked up in the map. The case in which + this section has been bypassed has addresses which correspond + to values I can find in the map. */ + *addendp -= sym->n_value; +#endif + } + +#if !defined(COFF_WITH_PE) + /* If the output symbol is common (in which case this must be a + relocatable link), we need to add in the final size of the + common symbol. */ + if (h != NULL && h->root.type == bfd_link_hash_common) + *addendp += h->root.u.c.size; +#endif + +#if defined(COFF_WITH_PE) + if (howto->pc_relative) + { + *addendp -= 4; + + /* If the symbol is defined, then the generic code is going to + add back the symbol value in order to cancel out an + adjustment it made to the addend. However, we set the addend + to 0 at the start of this function. We need to adjust here, + to avoid the adjustment the generic code will make. FIXME: + This is getting a bit hackish. */ + if (sym != NULL && sym->n_scnum != 0) + *addendp -= sym->n_value; + } + + if (rel->r_type == R_AMD64_IMAGEBASE + && (bfd_get_flavour (sec->output_section->owner) == bfd_target_coff_flavour)) + *addendp -= pe_data (sec->output_section->owner)->pe_opthdr.ImageBase; + + if (rel->r_type == R_AMD64_SECREL) + { + bfd_vma osect_vma; + + if (h && (h->type == bfd_link_hash_defined || h->type == bfd_link_hash_defweak)) + osect_vma = h->root.u.def.section->output_section->vma; + else + { + asection *sec; + int i; + + /* Sigh, the only way to get the section to offset against + is to find it the hard way. */ + for (sec = abfd->sections, i = 1; i < sym->n_scnum; i++) + sec = sec->next; + + osect_vma = sec->output_section->vma; + } + + *addendp -= osect_vma; + } +#endif + + return howto; +} + +#define coff_bfd_reloc_type_lookup coff_amd64_reloc_type_lookup +#define coff_bfd_reloc_name_lookup coff_amd64_reloc_name_lookup + +static reloc_howto_type * +coff_amd64_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, bfd_reloc_code_real_type code) +{ + switch (code) + { + case BFD_RELOC_RVA: + return howto_table + R_AMD64_IMAGEBASE; + case BFD_RELOC_32: + return howto_table + R_AMD64_DIR32; + case BFD_RELOC_64: + return howto_table + R_AMD64_DIR64; + case BFD_RELOC_64_PCREL: +#ifndef DONT_EXTEND_AMD64 + return howto_table + R_AMD64_PCRQUAD; +#else + /* Fall through. */ +#endif + case BFD_RELOC_32_PCREL: + return howto_table + R_AMD64_PCRLONG; + case BFD_RELOC_X86_64_32S: + return howto_table + R_RELLONG; + case BFD_RELOC_16: + return howto_table + R_RELWORD; + case BFD_RELOC_16_PCREL: + return howto_table + R_PCRWORD; + case BFD_RELOC_8: + return howto_table + R_RELBYTE; + case BFD_RELOC_8_PCREL: + return howto_table + R_PCRBYTE; +#ifdef notyet +#if defined(COFF_WITH_PE) + case BFD_RELOC_32_SECREL: + return howto_table + R_AMD64_SECREL; +#endif +#endif + default: + BFD_FAIL (); + return 0; + } +} + +static reloc_howto_type * +coff_amd64_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; i < sizeof (howto_table) / sizeof (howto_table[0]); i++) + if (howto_table[i].name != NULL + && strcasecmp (howto_table[i].name, r_name) == 0) + return &howto_table[i]; + + return NULL; +} + +#define coff_rtype_to_howto coff_amd64_rtype_to_howto + +#ifdef TARGET_UNDERSCORE + +/* If amd64 gcc uses underscores for symbol names, then it does not use + a leading dot for local labels, so if TARGET_UNDERSCORE is defined + we treat all symbols starting with L as local. */ + +static bfd_boolean +coff_amd64_is_local_label_name (bfd *abfd, const char *name) +{ + if (name[0] == 'L') + return TRUE; + + return _bfd_coff_is_local_label_name (abfd, name); +} + +#define coff_bfd_is_local_label_name coff_amd64_is_local_label_name + +#endif /* TARGET_UNDERSCORE */ + +#include "coffcode.h" + +#ifdef PE +#define amd64coff_object_p pe_bfd_object_p +#else +#define amd64coff_object_p coff_object_p +#endif + +const bfd_target +#ifdef TARGET_SYM + TARGET_SYM = +#else + x86_64coff_vec = +#endif +{ +#ifdef TARGET_NAME + TARGET_NAME, +#else + "coff-x86-64", /* Name. */ +#endif + bfd_target_coff_flavour, + BFD_ENDIAN_LITTLE, /* Data byte order is little. */ + BFD_ENDIAN_LITTLE, /* Header byte order is little. */ + + (HAS_RELOC | EXEC_P | /* Object flags. */ + HAS_LINENO | HAS_DEBUG | + HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED), + + (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC /* Section flags. */ +#if defined(COFF_WITH_PE) + | SEC_LINK_ONCE | SEC_LINK_DUPLICATES | SEC_READONLY +#endif + | SEC_CODE | SEC_DATA), + +#ifdef TARGET_UNDERSCORE + TARGET_UNDERSCORE, /* Leading underscore. */ +#else + 0, /* Leading underscore. */ +#endif + '/', /* Ar_pad_char. */ + 15, /* Ar_max_namelen. */ + + bfd_getl64, bfd_getl_signed_64, bfd_putl64, + bfd_getl32, bfd_getl_signed_32, bfd_putl32, + bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* Data. */ + bfd_getl64, bfd_getl_signed_64, bfd_putl64, + bfd_getl32, bfd_getl_signed_32, bfd_putl32, + bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* Hdrs. */ + + /* Note that we allow an object file to be treated as a core file as well. */ + { _bfd_dummy_target, amd64coff_object_p, /* BFD_check_format. */ + bfd_generic_archive_p, amd64coff_object_p }, + { bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format. */ + bfd_false }, + { bfd_false, coff_write_object_contents, /* bfd_write_contents. */ + _bfd_write_archive_contents, bfd_false }, + + BFD_JUMP_TABLE_GENERIC (coff), + BFD_JUMP_TABLE_COPY (coff), + BFD_JUMP_TABLE_CORE (_bfd_nocore), + BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff), + BFD_JUMP_TABLE_SYMBOLS (coff), + BFD_JUMP_TABLE_RELOCS (coff), + BFD_JUMP_TABLE_WRITE (coff), + BFD_JUMP_TABLE_LINK (coff), + BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), + + NULL, + + COFF_SWAP_TABLE +}; Added: head/contrib/binutils/bfd/efi-app-x86_64.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/binutils/bfd/efi-app-x86_64.c Wed Sep 29 14:41:03 2010 (r213274) @@ -0,0 +1,34 @@ +/* BFD back-end for Intel64 UEFI application files. + Copyright 2007 Free Software Foundation, Inc. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ + +#include "sysdep.h" +#include "bfd.h" + +#define TARGET_SYM bfd_efi_app_x86_64_vec +#define TARGET_NAME "efi-app-x86_64" +#define COFF_IMAGE_WITH_PE +#define COFF_WITH_PE +#define COFF_WITH_pep +#define PCRELOFFSET TRUE +#define TARGET_UNDERSCORE '_' +#define COFF_LONG_SECTION_NAMES +#define PEI_TARGET_SUBSYSTEM IMAGE_SUBSYSTEM_EFI_APPLICATION +#define PEI_FORCE_MINIMUM_ALIGNMENT + +#include "coff-x86_64.c" Modified: head/contrib/binutils/bfd/targets.c ============================================================================== --- head/contrib/binutils/bfd/targets.c Wed Sep 29 14:36:25 2010 (r213273) +++ head/contrib/binutils/bfd/targets.c Wed Sep 29 14:41:03 2010 (r213274) @@ -510,6 +510,7 @@ extern const bfd_target armpei_little_ve extern const bfd_target b_out_vec_big_host; extern const bfd_target b_out_vec_little_host; extern const bfd_target bfd_efi_app_ia32_vec; +extern const bfd_target bfd_efi_app_x86_64_vec; extern const bfd_target bfd_efi_app_ia64_vec; extern const bfd_target bfd_elf32_avr_vec; extern const bfd_target bfd_elf32_big_generic_vec; @@ -794,6 +795,7 @@ static const bfd_target * const _bfd_tar &b_out_vec_big_host, &b_out_vec_little_host, &bfd_efi_app_ia32_vec, + &bfd_efi_app_x86_64_vec, #ifdef BFD64 &bfd_efi_app_ia64_vec, #endif Modified: head/contrib/binutils/include/coff/internal.h ============================================================================== --- head/contrib/binutils/include/coff/internal.h Wed Sep 29 14:36:25 2010 (r213273) +++ head/contrib/binutils/include/coff/internal.h Wed Sep 29 14:41:03 2010 (r213274) @@ -1,7 +1,8 @@ /* Internal format of COFF object file data structures, for GNU BFD. This file is part of BFD, the Binary File Descriptor library. - Copyright 2001 Free Software Foundation, Inc. + Copyright 1999, 2000, 2001, 2002, 2003, 2004. 2005, 2006, 2007, 2009 + Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -15,7 +16,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef GNU_COFF_INTERNAL_H #define GNU_COFF_INTERNAL_H 1 @@ -57,10 +58,19 @@ struct internal_extra_pe_filehdr bfd_vma nt_signature; /* required NT signature, 0x4550 */ }; +#define GO32_STUBSIZE 2048 + struct internal_filehdr { struct internal_extra_pe_filehdr pe; + /* coff-stgo32 EXE stub header before BFD tdata has been allocated. + Its data is kept in INTERNAL_FILEHDR.GO32STUB afterwards. + + F_GO32STUB is set iff go32stub contains a valid data. Artifical headers + created in BFD have no pre-set go32stub. */ + char go32stub[GO32_STUBSIZE]; + /* Standard coff internal info. */ unsigned short f_magic; /* magic number */ unsigned short f_nscns; /* number of sections */ @@ -83,7 +93,8 @@ struct internal_filehdr F_AR32W file is 32-bit big-endian F_DYNLOAD rs/6000 aix: dynamically loadable w/imports & exports F_SHROBJ rs/6000 aix: file is a shared object - F_DLL PE format DLL. */ + F_DLL PE format DLL + F_GO32STUB Field go32stub contains valid data. */ #define F_RELFLG (0x0001) #define F_EXEC (0x0002) @@ -95,6 +106,7 @@ struct internal_filehdr #define F_DYNLOAD (0x1000) #define F_SHROBJ (0x2000) #define F_DLL (0x2000) +#define F_GO32STUB (0x4000) /* Extra structure which is used in the optional header. */ typedef struct _IMAGE_DATA_DIRECTORY @@ -102,6 +114,22 @@ typedef struct _IMAGE_DATA_DIRECTORY bfd_vma VirtualAddress; long Size; } IMAGE_DATA_DIRECTORY; +#define PE_EXPORT_TABLE 0 +#define PE_IMPORT_TABLE 1 +#define PE_RESOURCE_TABLE 2 +#define PE_EXCEPTION_TABLE 3 +#define PE_CERTIFICATE_TABLE 4 +#define PE_BASE_RELOCATION_TABLE 5 +#define PE_DEBUG_DATA 6 +#define PE_ARCHITECTURE 7 +#define PE_GLOBAL_PTR 8 +#define PE_TLS_TABLE 9 +#define PE_LOAD_CONFIG_TABLE 10 +#define PE_BOUND_IMPORT_TABLE 11 +#define PE_IMPORT_ADDRESS_TABLE 12 +#define PE_DELAY_IMPORT_DESCRIPTOR 13 +#define PE_CLR_RUNTIME_HEADER 14 +/* DataDirectory[15] is currently reserved, so no define. */ #define IMAGE_NUMBEROF_DIRECTORY_ENTRIES 16 /* Default image base for NT. */ @@ -121,6 +149,28 @@ typedef struct _IMAGE_DATA_DIRECTORY struct internal_extra_pe_aouthdr { + /* FIXME: The following entries are in AOUTHDR. But they aren't + available internally in bfd. We add them here so that objdump + can dump them. */ + /* The state of the image file */ + short Magic; + /* Linker major version number */ + char MajorLinkerVersion; + /* Linker minor version number */ + char MinorLinkerVersion; + /* Total size of all code sections */ + long SizeOfCode; + /* Total size of all initialized data sections */ + long SizeOfInitializedData; + /* Total size of all uninitialized data sections */ + long SizeOfUninitializedData; + /* Address of entry point relative to image base. */ + bfd_vma AddressOfEntryPoint; + /* Address of the first code section relative to image base. */ + bfd_vma BaseOfCode; + /* Address of the first data section relative to image base. */ + bfd_vma BaseOfData; + /* PE stuff */ bfd_vma ImageBase; /* address of specific location in memory that file is located, NT default 0x10000 */ @@ -146,7 +196,7 @@ struct internal_extra_pe_aouthdr 3 - WINDOWS_CUI runs in Windows char sub. (console app) 5 - OS2_CUI runs in OS/2 character subsystem 7 - POSIX_CUI runs in Posix character subsystem */ - short DllCharacteristics; /* flags for DLL init, use 0 */ + unsigned short DllCharacteristics; /* flags for DLL init */ bfd_vma SizeOfStackReserve; /* amount of memory to reserve */ bfd_vma SizeOfStackCommit; /* amount of memory initially committed for initial thread's stack, default is 0x1000 */ @@ -234,12 +284,7 @@ struct internal_aouthdr #define C_LINE 104 /* line # reformatted as symbol table entry */ #define C_ALIAS 105 /* duplicate tag */ #define C_HIDDEN 106 /* ext symbol in dmert public lib */ - -#if defined _AIX52 || defined AIX_WEAK_SUPPORT -#define C_WEAKEXT 111 /* weak symbol -- AIX standard. */ -#else #define C_WEAKEXT 127 /* weak symbol -- GNU extension. */ -#endif /* New storage classes for TI COFF */ #define C_UEXT 19 /* Tentative external definition */ @@ -272,6 +317,12 @@ struct internal_aouthdr #define C_HIDEXT 107 /* Un-named external symbol */ #define C_BINCL 108 /* Marks beginning of include file */ #define C_EINCL 109 /* Marks ending of include file */ +#define C_AIX_WEAKEXT 111 /* AIX definition of C_WEAKEXT. */ + +#if defined _AIX52 || defined AIX_WEAK_SUPPORT +#undef C_WEAKEXT +#define C_WEAKEXT C_AIX_WEAKEXT +#endif /* storage classes for stab symbols for RS/6000 */ #define C_GSYM (0x80) @@ -297,6 +348,10 @@ struct internal_aouthdr #define C_THUMBEXTFUNC (C_THUMBEXT + 20) /* 150 */ #define C_THUMBSTATFUNC (C_THUMBSTAT + 20) /* 151 */ +/* True if XCOFF symbols of class CLASS have auxillary csect information. */ +#define CSECT_SYM_P(CLASS) \ + ((CLASS) == C_EXT || (CLASS) == C_AIX_WEAKEXT || (CLASS) == C_HIDEXT) + /********************** SECTION HEADER **********************/ #define SCNNMLEN (8) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Wed Sep 29 14:46:58 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0B3761065697; Wed, 29 Sep 2010 14:46:58 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EE9A18FC13; Wed, 29 Sep 2010 14:46: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 o8TEkvVU012979; Wed, 29 Sep 2010 14:46:57 GMT (envelope-from mckusick@svn.freebsd.org) Received: (from mckusick@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8TEkvBV012977; Wed, 29 Sep 2010 14:46:57 GMT (envelope-from mckusick@svn.freebsd.org) Message-Id: <201009291446.o8TEkvBV012977@svn.freebsd.org> From: Kirk McKusick Date: Wed, 29 Sep 2010 14:46:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213275 - head/sys/ufs/ffs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2010 14:46:58 -0000 Author: mckusick Date: Wed Sep 29 14:46:57 2010 New Revision: 213275 URL: http://svn.freebsd.org/changeset/base/213275 Log: Since local variable 'i' is used only in a KASSERT, declare and initialize it only if INVARIANTS is defined to avoid a declared but unused warning. Suggested by: Brian Somers Modified: head/sys/ufs/ffs/ffs_softdep.c Modified: head/sys/ufs/ffs/ffs_softdep.c ============================================================================== --- head/sys/ufs/ffs/ffs_softdep.c Wed Sep 29 14:41:03 2010 (r213274) +++ head/sys/ufs/ffs/ffs_softdep.c Wed Sep 29 14:46:57 2010 (r213275) @@ -2899,9 +2899,10 @@ complete_jseg(jseg) struct worklist *wk; struct jmvref *jmvref; int waiting; - int i; +#ifdef INVARIANTS + int i = 0; +#endif - i = 0; while ((wk = LIST_FIRST(&jseg->js_entries)) != NULL) { WORKLIST_REMOVE(wk); waiting = wk->wk_state & IOWAITING; From owner-svn-src-head@FreeBSD.ORG Wed Sep 29 19:58:38 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E8E781065695; Wed, 29 Sep 2010 19:58:38 +0000 (UTC) (envelope-from amdmi3@amdmi3.ru) Received: from smtp.timeweb.ru (smtp.timeweb.ru [92.53.116.15]) by mx1.freebsd.org (Postfix) with ESMTP id A2FC28FC22; Wed, 29 Sep 2010 19:58:38 +0000 (UTC) Received: from [213.148.20.85] (helo=hive.panopticon) by smtp.timeweb.ru with esmtpsa (TLSv1:CAMELLIA256-SHA:256) (Exim 4.71) (envelope-from ) id 1P12Gy-00031l-R9; Wed, 29 Sep 2010 23:25:00 +0400 Received: from hades.panopticon (hades.panopticon [192.168.0.32]) by hive.panopticon (Postfix) with ESMTP id 3DEC7B84D; Wed, 29 Sep 2010 23:25:00 +0400 (MSD) Received: by hades.panopticon (Postfix, from userid 1000) id 38414B829; Wed, 29 Sep 2010 23:25:00 +0400 (MSD) Date: Wed, 29 Sep 2010 23:25:00 +0400 From: Dmitry Marakasov To: Ed Maste Message-ID: <20100929192500.GC96399@hades.panopticon> References: <201009291308.o8TD8NHo009975@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <201009291308.o8TD8NHo009975@svn.freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r213270 - head/etc/rc.d X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2010 19:58:39 -0000 * Ed Maste (emaste@FreeBSD.org) wrote: > /etc/rc.d/defaultroute currently bails immediately if all interfaces > set to use DHCP have no carrier. This can cause grief as it may take > some time for link to be established, and defaultroute may terminate > before this happens. > > Introduce a defaultroute_carrier_delay variable and then wait that long > in defaultroute before bailing if no interfaces have carrier. With the > default settings defaultroute will wait for five seconds for this, and > the original 30 second wait for a default route to appear is unchanged. > Note that there is in discussion an alternative approach to the broader > problem of waiting for DHCP-configured routes. However, this change > addresses a real problem in the current defaultroute script. Thanks! Is MFC not planned? -- Dmitry Marakasov . 55B5 0596 FF1E 8D84 5F56 9510 D35A 80DD F9D2 F77D amdmi3@amdmi3.ru ..: jabber: amdmi3@jabber.ru http://www.amdmi3.ru From owner-svn-src-head@FreeBSD.ORG Wed Sep 29 20:53:33 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B4743106564A; Wed, 29 Sep 2010 20:53:33 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 97D818FC15; Wed, 29 Sep 2010 20:53:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8TKrX8o021348; Wed, 29 Sep 2010 20:53:33 GMT (envelope-from gonzo@svn.freebsd.org) Received: (from gonzo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8TKrXWM021342; Wed, 29 Sep 2010 20:53:33 GMT (envelope-from gonzo@svn.freebsd.org) Message-Id: <201009292053.o8TKrXWM021342@svn.freebsd.org> From: Oleksandr Tymoshenko Date: Wed, 29 Sep 2010 20:53:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213277 - head/sys/dev/gpio X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2010 20:53:33 -0000 Author: gonzo Date: Wed Sep 29 20:53:33 2010 New Revision: 213277 URL: http://svn.freebsd.org/changeset/base/213277 Log: Fix legal staff in GPIO sources: - license clause now contains "AUTHOR AND CONTRIBUTORS" instead of just "AUTHOR" - Add license/copyright to gpioc.c Spotted by: Edward Tomasz Napierala, Andrew Turner Modified: head/sys/dev/gpio/gpiobus.c head/sys/dev/gpio/gpiobusvar.h head/sys/dev/gpio/gpioc.c head/sys/dev/gpio/gpioiic.c head/sys/dev/gpio/gpioled.c Modified: head/sys/dev/gpio/gpiobus.c ============================================================================== --- head/sys/dev/gpio/gpiobus.c Wed Sep 29 18:41:47 2010 (r213276) +++ head/sys/dev/gpio/gpiobus.c Wed Sep 29 20:53:33 2010 (r213277) @@ -11,16 +11,17 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * 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 Modified: head/sys/dev/gpio/gpiobusvar.h ============================================================================== --- head/sys/dev/gpio/gpiobusvar.h Wed Sep 29 18:41:47 2010 (r213276) +++ head/sys/dev/gpio/gpiobusvar.h Wed Sep 29 20:53:33 2010 (r213277) @@ -11,16 +11,17 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. * * $FreeBSD$ * Modified: head/sys/dev/gpio/gpioc.c ============================================================================== --- head/sys/dev/gpio/gpioc.c Wed Sep 29 18:41:47 2010 (r213276) +++ head/sys/dev/gpio/gpioc.c Wed Sep 29 20:53:33 2010 (r213277) @@ -1,3 +1,29 @@ +/*- + * Copyright (c) 2009 Oleksandr Tymoshenko + * 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$"); Modified: head/sys/dev/gpio/gpioiic.c ============================================================================== --- head/sys/dev/gpio/gpioiic.c Wed Sep 29 18:41:47 2010 (r213276) +++ head/sys/dev/gpio/gpioiic.c Wed Sep 29 20:53:33 2010 (r213277) @@ -12,16 +12,17 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * 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 Modified: head/sys/dev/gpio/gpioled.c ============================================================================== --- head/sys/dev/gpio/gpioled.c Wed Sep 29 18:41:47 2010 (r213276) +++ head/sys/dev/gpio/gpioled.c Wed Sep 29 20:53:33 2010 (r213277) @@ -11,16 +11,17 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * 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 From owner-svn-src-head@FreeBSD.ORG Wed Sep 29 21:01:17 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 38FE3106564A; Wed, 29 Sep 2010 21:01:17 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 28CDC8FC12; Wed, 29 Sep 2010 21:01: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 o8TL1H8n021592; Wed, 29 Sep 2010 21:01:17 GMT (envelope-from gonzo@svn.freebsd.org) Received: (from gonzo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8TL1Hel021590; Wed, 29 Sep 2010 21:01:17 GMT (envelope-from gonzo@svn.freebsd.org) Message-Id: <201009292101.o8TL1Hel021590@svn.freebsd.org> From: Oleksandr Tymoshenko Date: Wed, 29 Sep 2010 21:01:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213278 - head/sys/mips/atheros X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2010 21:01:17 -0000 Author: gonzo Date: Wed Sep 29 21:01:16 2010 New Revision: 213278 URL: http://svn.freebsd.org/changeset/base/213278 Log: AR71XX_GPIO_* defines were introduced by adrian@ a while ago, remove duplicated. Modified: head/sys/mips/atheros/ar71xxreg.h Modified: head/sys/mips/atheros/ar71xxreg.h ============================================================================== --- head/sys/mips/atheros/ar71xxreg.h Wed Sep 29 20:53:33 2010 (r213277) +++ head/sys/mips/atheros/ar71xxreg.h Wed Sep 29 21:01:16 2010 (r213278) @@ -160,21 +160,6 @@ #define GPIO_FUNC_USB_OC_EN (1 << 4) #define GPIO_FUNC_USB_CLK_EN (0) -#define AR71XX_GPIO_BASE 0x18040000 -#define AR71XX_GPIO_OE 0x00 -#define AR71XX_GPIO_IN 0x04 -#define AR71XX_GPIO_OUT 0x08 -#define AR71XX_GPIO_SET 0x0c -#define AR71XX_GPIO_CLEAR 0x10 -#define AR71XX_GPIO_INT 0x14 -#define AR71XX_GPIO_INT_TYPE 0x18 -#define AR71XX_GPIO_INT_POLARITY 0x1c -#define AR71XX_GPIO_INT_PENDING 0x20 -#define AR71XX_GPIO_INT_MASK 0x24 -#define AR71XX_GPIO_FUNCTION 0x28 -#define GPIO_SPI_CS2_EN (1 << 13) -#define GPIO_SPI_CS1_EN (1 << 12) - #define AR71XX_BASE_FREQ 40000000 #define AR71XX_PLL_CPU_BASE 0x18050000 #define AR71XX_PLL_CPU_CONFIG 0x18050000 From owner-svn-src-head@FreeBSD.ORG Wed Sep 29 21:02:31 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7FFF3106566C; Wed, 29 Sep 2010 21:02:31 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6FCF28FC08; Wed, 29 Sep 2010 21:02:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8TL2Vmv021651; Wed, 29 Sep 2010 21:02:31 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8TL2VO4021649; Wed, 29 Sep 2010 21:02:31 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201009292102.o8TL2VO4021649@svn.freebsd.org> From: Luigi Rizzo Date: Wed, 29 Sep 2010 21:02:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213279 - head/sys/netinet/ipfw X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2010 21:02:31 -0000 Author: luigi Date: Wed Sep 29 21:02:31 2010 New Revision: 213279 URL: http://svn.freebsd.org/changeset/base/213279 Log: remove an unnecessary (and wrong) assignment. It was meant to reset idle_time (and it was not needed), but i even used the wrong field. Obtained from: Oleg MFC after: 3 days Modified: head/sys/netinet/ipfw/ip_dn_io.c Modified: head/sys/netinet/ipfw/ip_dn_io.c ============================================================================== --- head/sys/netinet/ipfw/ip_dn_io.c Wed Sep 29 21:01:16 2010 (r213278) +++ head/sys/netinet/ipfw/ip_dn_io.c Wed Sep 29 21:02:31 2010 (r213279) @@ -760,7 +760,6 @@ dummynet_io(struct mbuf **m0, int dir, s /* Do this only on the first packet on an idle pipe */ struct dn_link *p = &fs->sched->link; - si->sched_time = dn_cfg.curr_time; si->credit = dn_cfg.io_fast ? p->bandwidth : 0; if (p->burst) { uint64_t burst = (dn_cfg.curr_time - si->idle_time) * p->bandwidth; From owner-svn-src-head@FreeBSD.ORG Wed Sep 29 21:19:25 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7E490106566B; Wed, 29 Sep 2010 21:19:25 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6DC498FC08; Wed, 29 Sep 2010 21:19:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8TLJPli022096; Wed, 29 Sep 2010 21:19:25 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8TLJP5q022094; Wed, 29 Sep 2010 21:19:25 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201009292119.o8TLJP5q022094@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 29 Sep 2010 21:19:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213280 - head/sys/dev/bge X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2010 21:19:25 -0000 Author: yongari Date: Wed Sep 29 21:19:25 2010 New Revision: 213280 URL: http://svn.freebsd.org/changeset/base/213280 Log: After r207391, brgphy(4) passes resolved flow-control settings to parent driver. Use that information to configure flow-control. One drawback is there is no way to disable flow-control as we still don't have proper way to not advertise RX/TX pause capability to link partner. But I don't think it would cause severe problems and users can selectively disable flow-control in switch port. Modified: head/sys/dev/bge/if_bge.c Modified: head/sys/dev/bge/if_bge.c ============================================================================== --- head/sys/dev/bge/if_bge.c Wed Sep 29 21:02:31 2010 (r213279) +++ head/sys/dev/bge/if_bge.c Wed Sep 29 21:19:25 2010 (r213280) @@ -882,10 +882,21 @@ bge_miibus_statchg(device_t dev) else BGE_SETBIT(sc, BGE_MAC_MODE, BGE_PORTMODE_MII); - if ((mii->mii_media_active & IFM_GMASK) == IFM_FDX) + if (IFM_OPTIONS(mii->mii_media_active & IFM_FDX) != 0) { BGE_CLRBIT(sc, BGE_MAC_MODE, BGE_MACMODE_HALF_DUPLEX); - else + if (IFM_OPTIONS(mii->mii_media_active) & IFM_FLAG1) + BGE_SETBIT(sc, BGE_TX_MODE, BGE_TXMODE_FLOWCTL_ENABLE); + else + BGE_CLRBIT(sc, BGE_TX_MODE, BGE_TXMODE_FLOWCTL_ENABLE); + if (IFM_OPTIONS(mii->mii_media_active) & IFM_FLAG0) + BGE_SETBIT(sc, BGE_RX_MODE, BGE_RXMODE_FLOWCTL_ENABLE); + else + BGE_CLRBIT(sc, BGE_RX_MODE, BGE_RXMODE_FLOWCTL_ENABLE); + } else { BGE_SETBIT(sc, BGE_MAC_MODE, BGE_MACMODE_HALF_DUPLEX); + BGE_CLRBIT(sc, BGE_TX_MODE, BGE_TXMODE_FLOWCTL_ENABLE); + BGE_CLRBIT(sc, BGE_RX_MODE, BGE_RXMODE_FLOWCTL_ENABLE); + } } /* From owner-svn-src-head@FreeBSD.ORG Wed Sep 29 21:20:30 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2A93510656A6; Wed, 29 Sep 2010 21:20:30 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1A4B68FC1D; Wed, 29 Sep 2010 21:20:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8TLKTFI022161; Wed, 29 Sep 2010 21:20:29 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8TLKTSf022159; Wed, 29 Sep 2010 21:20:29 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201009292120.o8TLKTSf022159@svn.freebsd.org> From: Dimitry Andric Date: Wed, 29 Sep 2010 21:20:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213281 - head/lib/libc/amd64/gen X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2010 21:20:30 -0000 Author: dim Date: Wed Sep 29 21:20:29 2010 New Revision: 213281 URL: http://svn.freebsd.org/changeset/base/213281 Log: Apply the same workaround for clang to amd64's version of ldexp.c (as in r212976): order the incoming arguments to fscale as st(0), st(1), and mark temp2 volatile (only in case of compilation with clang) to force clang to pop it correctly. No binary change when compiled with gcc. This fixes ldexp() when compiled with clang on amd64, which makes drand48() and friends work correctly again, and this in turn fixes perl's tempfile(). Reported by: Renato Botelho, Derek Tattersall Approved by: rpaulo (mentor) Modified: head/lib/libc/amd64/gen/ldexp.c Modified: head/lib/libc/amd64/gen/ldexp.c ============================================================================== --- head/lib/libc/amd64/gen/ldexp.c Wed Sep 29 21:19:25 2010 (r213280) +++ head/lib/libc/amd64/gen/ldexp.c Wed Sep 29 21:20:29 2010 (r213281) @@ -36,6 +36,8 @@ static char sccsid[] = "@(#)ldexp.c 8.1 #include __FBSDID("$FreeBSD$"); +#include + /* * ldexp(value, exp): return value * (2 ** exp). * @@ -49,12 +51,16 @@ __FBSDID("$FreeBSD$"); double ldexp (double value, int exp) { - double temp, texp, temp2; + double temp, texp; +#ifdef __clang__ + volatile +#endif + double temp2; texp = exp; #ifdef __GNUC__ __asm ("fscale " - : "=u" (temp2), "=t" (temp) - : "0" (texp), "1" (value)); + : "=t" (temp), "=u" (temp2) + : "0" (value), "1" (texp)); #else #error unknown asm #endif From owner-svn-src-head@FreeBSD.ORG Wed Sep 29 21:53:11 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AEE531065673; Wed, 29 Sep 2010 21:53:11 +0000 (UTC) (envelope-from neel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9D6268FC1C; Wed, 29 Sep 2010 21:53:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8TLrBRu023048; Wed, 29 Sep 2010 21:53:11 GMT (envelope-from neel@svn.freebsd.org) Received: (from neel@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8TLrBn9023042; Wed, 29 Sep 2010 21:53:11 GMT (envelope-from neel@svn.freebsd.org) Message-Id: <201009292153.o8TLrBn9023042@svn.freebsd.org> From: Neel Natu Date: Wed, 29 Sep 2010 21:53:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213282 - in head/sys: amd64/amd64 i386/i386 ia64/ia64 powerpc/powerpc sparc64/sparc64 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2010 21:53:11 -0000 Author: neel Date: Wed Sep 29 21:53:11 2010 New Revision: 213282 URL: http://svn.freebsd.org/changeset/base/213282 Log: Fix bogus error message from bus_dmamem_alloc() about incorrect alignment. The check for alignment should be made against the physical address and not the virtual address that maps it. Sponsored by: NetApp Submitted by: Will McGovern (will at netapp dot com) Reviewed by: mjacob, jhb Modified: head/sys/amd64/amd64/busdma_machdep.c head/sys/i386/i386/busdma_machdep.c head/sys/ia64/ia64/busdma_machdep.c head/sys/powerpc/powerpc/busdma_machdep.c head/sys/sparc64/sparc64/bus_machdep.c Modified: head/sys/amd64/amd64/busdma_machdep.c ============================================================================== --- head/sys/amd64/amd64/busdma_machdep.c Wed Sep 29 21:20:29 2010 (r213281) +++ head/sys/amd64/amd64/busdma_machdep.c Wed Sep 29 21:53:11 2010 (r213282) @@ -526,7 +526,7 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, voi CTR4(KTR_BUSDMA, "%s: tag %p tag flags 0x%x error %d", __func__, dmat, dmat->flags, ENOMEM); return (ENOMEM); - } else if ((uintptr_t)*vaddr & (dmat->alignment - 1)) { + } else if (vtophys(*vaddr) & (dmat->alignment - 1)) { printf("bus_dmamem_alloc failed to align memory properly.\n"); } if (flags & BUS_DMA_NOCACHE) Modified: head/sys/i386/i386/busdma_machdep.c ============================================================================== --- head/sys/i386/i386/busdma_machdep.c Wed Sep 29 21:20:29 2010 (r213281) +++ head/sys/i386/i386/busdma_machdep.c Wed Sep 29 21:53:11 2010 (r213282) @@ -540,7 +540,7 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, voi CTR4(KTR_BUSDMA, "%s: tag %p tag flags 0x%x error %d", __func__, dmat, dmat->flags, ENOMEM); return (ENOMEM); - } else if ((uintptr_t)*vaddr & (dmat->alignment - 1)) { + } else if (vtophys(*vaddr) & (dmat->alignment - 1)) { printf("bus_dmamem_alloc failed to align memory properly.\n"); } if (flags & BUS_DMA_NOCACHE) Modified: head/sys/ia64/ia64/busdma_machdep.c ============================================================================== --- head/sys/ia64/ia64/busdma_machdep.c Wed Sep 29 21:20:29 2010 (r213281) +++ head/sys/ia64/ia64/busdma_machdep.c Wed Sep 29 21:53:11 2010 (r213282) @@ -455,7 +455,7 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, voi } if (*vaddr == NULL) return (ENOMEM); - else if ((uintptr_t)*vaddr & (dmat->alignment - 1)) + else if (vtophys(*vaddr) & (dmat->alignment - 1)) printf("bus_dmamem_alloc failed to align memory properly.\n"); return (0); } Modified: head/sys/powerpc/powerpc/busdma_machdep.c ============================================================================== --- head/sys/powerpc/powerpc/busdma_machdep.c Wed Sep 29 21:20:29 2010 (r213281) +++ head/sys/powerpc/powerpc/busdma_machdep.c Wed Sep 29 21:53:11 2010 (r213282) @@ -529,7 +529,7 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, voi CTR4(KTR_BUSDMA, "%s: tag %p tag flags 0x%x error %d", __func__, dmat, dmat->flags, ENOMEM); return (ENOMEM); - } else if ((uintptr_t)*vaddr & (dmat->alignment - 1)) { + } else if (vtophys(*vaddr) & (dmat->alignment - 1)) { printf("bus_dmamem_alloc failed to align memory properly.\n"); } #ifdef NOTYET Modified: head/sys/sparc64/sparc64/bus_machdep.c ============================================================================== --- head/sys/sparc64/sparc64/bus_machdep.c Wed Sep 29 21:20:29 2010 (r213281) +++ head/sys/sparc64/sparc64/bus_machdep.c Wed Sep 29 21:53:11 2010 (r213282) @@ -652,7 +652,7 @@ nexus_dmamem_alloc(bus_dma_tag_t dmat, v } if (*vaddr == NULL) return (ENOMEM); - if ((uintptr_t)*vaddr % dmat->dt_alignment) + if (vtophys(*vaddr) % dmat->dt_alignment) printf("%s: failed to align memory properly.\n", __func__); return (0); } From owner-svn-src-head@FreeBSD.ORG Wed Sep 29 21:56:32 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0C4301065740; Wed, 29 Sep 2010 21:56:32 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EE7E98FC1E; Wed, 29 Sep 2010 21:56:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8TLuVaX023165; Wed, 29 Sep 2010 21:56:31 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8TLuVGm023162; Wed, 29 Sep 2010 21:56:31 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201009292156.o8TLuVGm023162@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 29 Sep 2010 21:56:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213283 - head/sys/dev/bge X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2010 21:56:32 -0000 Author: yongari Date: Wed Sep 29 21:56:31 2010 New Revision: 213283 URL: http://svn.freebsd.org/changeset/base/213283 Log: Implement hardware MAC statistics for BCM5705 or newer Broadcom controllers. bge(4) exported MAC statistics on controllers that maintain the statistics in the NIC's internal memory. Newer controllers require register access to fetch these values. These counters provide useful information to diagnose driver issues. Modified: head/sys/dev/bge/if_bge.c head/sys/dev/bge/if_bgereg.h Modified: head/sys/dev/bge/if_bge.c ============================================================================== --- head/sys/dev/bge/if_bge.c Wed Sep 29 21:53:11 2010 (r213282) +++ head/sys/dev/bge/if_bge.c Wed Sep 29 21:56:31 2010 (r213283) @@ -371,6 +371,7 @@ static int bge_rxeof(struct bge_softc *, static void bge_asf_driver_up (struct bge_softc *); static void bge_tick(void *); +static void bge_stats_clear_regs(struct bge_softc *); static void bge_stats_update(struct bge_softc *); static void bge_stats_update_regs(struct bge_softc *); static struct mbuf *bge_setup_tso(struct bge_softc *, struct mbuf *, @@ -453,6 +454,10 @@ static int bge_sysctl_reg_read(SYSCTL_HA static int bge_sysctl_mem_read(SYSCTL_HANDLER_ARGS); #endif static void bge_add_sysctls(struct bge_softc *); +static void bge_add_sysctl_stats_regs(struct bge_softc *, + struct sysctl_ctx_list *, struct sysctl_oid_list *); +static void bge_add_sysctl_stats(struct bge_softc *, struct sysctl_ctx_list *, + struct sysctl_oid_list *); static int bge_sysctl_stats(SYSCTL_HANDLER_ARGS); static device_method_t bge_methods[] = { @@ -3730,15 +3735,127 @@ static void bge_stats_update_regs(struct bge_softc *sc) { struct ifnet *ifp; + struct bge_mac_stats *stats; ifp = sc->bge_ifp; + stats = &sc->bge_mac_stats; - ifp->if_collisions += CSR_READ_4(sc, BGE_MAC_STATS + - offsetof(struct bge_mac_stats_regs, etherStatsCollisions)); + stats->ifHCOutOctets += + CSR_READ_4(sc, BGE_TX_MAC_STATS_OCTETS); + stats->etherStatsCollisions += + CSR_READ_4(sc, BGE_TX_MAC_STATS_COLLS); + stats->outXonSent += + CSR_READ_4(sc, BGE_TX_MAC_STATS_XON_SENT); + stats->outXoffSent += + CSR_READ_4(sc, BGE_TX_MAC_STATS_XOFF_SENT); + stats->dot3StatsInternalMacTransmitErrors += + CSR_READ_4(sc, BGE_TX_MAC_STATS_ERRORS); + stats->dot3StatsSingleCollisionFrames += + CSR_READ_4(sc, BGE_TX_MAC_STATS_SINGLE_COLL); + stats->dot3StatsMultipleCollisionFrames += + CSR_READ_4(sc, BGE_TX_MAC_STATS_MULTI_COLL); + stats->dot3StatsDeferredTransmissions += + CSR_READ_4(sc, BGE_TX_MAC_STATS_DEFERRED); + stats->dot3StatsExcessiveCollisions += + CSR_READ_4(sc, BGE_TX_MAC_STATS_EXCESS_COLL); + stats->dot3StatsLateCollisions += + CSR_READ_4(sc, BGE_TX_MAC_STATS_LATE_COLL); + stats->ifHCOutUcastPkts += + CSR_READ_4(sc, BGE_TX_MAC_STATS_UCAST); + stats->ifHCOutMulticastPkts += + CSR_READ_4(sc, BGE_TX_MAC_STATS_MCAST); + stats->ifHCOutBroadcastPkts += + CSR_READ_4(sc, BGE_TX_MAC_STATS_BCAST); + + stats->ifHCInOctets += + CSR_READ_4(sc, BGE_RX_MAC_STATS_OCTESTS); + stats->etherStatsFragments += + CSR_READ_4(sc, BGE_RX_MAC_STATS_FRAGMENTS); + stats->ifHCInUcastPkts += + CSR_READ_4(sc, BGE_RX_MAC_STATS_UCAST); + stats->ifHCInMulticastPkts += + CSR_READ_4(sc, BGE_RX_MAC_STATS_MCAST); + stats->ifHCInBroadcastPkts += + CSR_READ_4(sc, BGE_RX_MAC_STATS_BCAST); + stats->dot3StatsFCSErrors += + CSR_READ_4(sc, BGE_RX_MAC_STATS_FCS_ERRORS); + stats->dot3StatsAlignmentErrors += + CSR_READ_4(sc, BGE_RX_MAC_STATS_ALGIN_ERRORS); + stats->xonPauseFramesReceived += + CSR_READ_4(sc, BGE_RX_MAC_STATS_XON_RCVD); + stats->xoffPauseFramesReceived += + CSR_READ_4(sc, BGE_RX_MAC_STATS_XOFF_RCVD); + stats->macControlFramesReceived += + CSR_READ_4(sc, BGE_RX_MAC_STATS_CTRL_RCVD); + stats->xoffStateEntered += + CSR_READ_4(sc, BGE_RX_MAC_STATS_XOFF_ENTERED); + stats->dot3StatsFramesTooLong += + CSR_READ_4(sc, BGE_RX_MAC_STATS_FRAME_TOO_LONG); + stats->etherStatsJabbers += + CSR_READ_4(sc, BGE_RX_MAC_STATS_JABBERS); + stats->etherStatsUndersizePkts += + CSR_READ_4(sc, BGE_RX_MAC_STATS_UNDERSIZE); + + stats->FramesDroppedDueToFilters += + CSR_READ_4(sc, BGE_RXLP_LOCSTAT_FILTDROP); + stats->DmaWriteQueueFull += + CSR_READ_4(sc, BGE_RXLP_LOCSTAT_DMA_WRQ_FULL); + stats->DmaWriteHighPriQueueFull += + CSR_READ_4(sc, BGE_RXLP_LOCSTAT_DMA_HPWRQ_FULL); + stats->NoMoreRxBDs += + CSR_READ_4(sc, BGE_RXLP_LOCSTAT_OUT_OF_BDS); + stats->InputDiscards += + CSR_READ_4(sc, BGE_RXLP_LOCSTAT_IFIN_DROPS); + stats->InputErrors += + CSR_READ_4(sc, BGE_RXLP_LOCSTAT_IFIN_ERRORS); + stats->RecvThresholdHit += + CSR_READ_4(sc, BGE_RXLP_LOCSTAT_RXTHRESH_HIT); + + ifp->if_collisions = (u_long)stats->etherStatsCollisions; + ifp->if_ierrors = (u_long)(stats->NoMoreRxBDs + stats->InputDiscards + + stats->InputErrors); +} + +static void +bge_stats_clear_regs(struct bge_softc *sc) +{ - ifp->if_ierrors += CSR_READ_4(sc, BGE_RXLP_LOCSTAT_OUT_OF_BDS); - ifp->if_ierrors += CSR_READ_4(sc, BGE_RXLP_LOCSTAT_IFIN_DROPS); - ifp->if_ierrors += CSR_READ_4(sc, BGE_RXLP_LOCSTAT_IFIN_ERRORS); + CSR_READ_4(sc, BGE_TX_MAC_STATS_OCTETS); + CSR_READ_4(sc, BGE_TX_MAC_STATS_COLLS); + CSR_READ_4(sc, BGE_TX_MAC_STATS_XON_SENT); + CSR_READ_4(sc, BGE_TX_MAC_STATS_XOFF_SENT); + CSR_READ_4(sc, BGE_TX_MAC_STATS_ERRORS); + CSR_READ_4(sc, BGE_TX_MAC_STATS_SINGLE_COLL); + CSR_READ_4(sc, BGE_TX_MAC_STATS_MULTI_COLL); + CSR_READ_4(sc, BGE_TX_MAC_STATS_DEFERRED); + CSR_READ_4(sc, BGE_TX_MAC_STATS_EXCESS_COLL); + CSR_READ_4(sc, BGE_TX_MAC_STATS_LATE_COLL); + CSR_READ_4(sc, BGE_TX_MAC_STATS_UCAST); + CSR_READ_4(sc, BGE_TX_MAC_STATS_MCAST); + CSR_READ_4(sc, BGE_TX_MAC_STATS_BCAST); + + CSR_READ_4(sc, BGE_RX_MAC_STATS_OCTESTS); + CSR_READ_4(sc, BGE_RX_MAC_STATS_FRAGMENTS); + CSR_READ_4(sc, BGE_RX_MAC_STATS_UCAST); + CSR_READ_4(sc, BGE_RX_MAC_STATS_MCAST); + CSR_READ_4(sc, BGE_RX_MAC_STATS_BCAST); + CSR_READ_4(sc, BGE_RX_MAC_STATS_FCS_ERRORS); + CSR_READ_4(sc, BGE_RX_MAC_STATS_ALGIN_ERRORS); + CSR_READ_4(sc, BGE_RX_MAC_STATS_XON_RCVD); + CSR_READ_4(sc, BGE_RX_MAC_STATS_XOFF_RCVD); + CSR_READ_4(sc, BGE_RX_MAC_STATS_CTRL_RCVD); + CSR_READ_4(sc, BGE_RX_MAC_STATS_XOFF_ENTERED); + CSR_READ_4(sc, BGE_RX_MAC_STATS_FRAME_TOO_LONG); + CSR_READ_4(sc, BGE_RX_MAC_STATS_JABBERS); + CSR_READ_4(sc, BGE_RX_MAC_STATS_UNDERSIZE); + + CSR_READ_4(sc, BGE_RXLP_LOCSTAT_FILTDROP); + CSR_READ_4(sc, BGE_RXLP_LOCSTAT_DMA_WRQ_FULL); + CSR_READ_4(sc, BGE_RXLP_LOCSTAT_DMA_HPWRQ_FULL); + CSR_READ_4(sc, BGE_RXLP_LOCSTAT_OUT_OF_BDS); + CSR_READ_4(sc, BGE_RXLP_LOCSTAT_IFIN_DROPS); + CSR_READ_4(sc, BGE_RXLP_LOCSTAT_IFIN_ERRORS); + CSR_READ_4(sc, BGE_RXLP_LOCSTAT_RXTHRESH_HIT); } static void @@ -4239,6 +4356,10 @@ bge_init_locked(struct bge_softc *sc) */ CSR_WRITE_4(sc, BGE_MAX_RX_FRAME_LOWAT, 2); + /* Clear MAC statistics. */ + if (BGE_IS_5705_PLUS(sc)) + bge_stats_clear_regs(sc); + /* Tell firmware we're alive. */ BGE_SETBIT(sc, BGE_MODE_CTL, BGE_MODECTL_STACKUP); @@ -4640,6 +4761,9 @@ bge_stop(struct bge_softc *sc) BGE_CLRBIT(sc, BGE_BMAN_MODE, BGE_BMANMODE_ENABLE); BGE_CLRBIT(sc, BGE_MARB_MODE, BGE_MARBMODE_ENABLE); } + /* Update MAC statistics. */ + if (BGE_IS_5705_PLUS(sc)) + bge_stats_update_regs(sc); bge_reset(sc); bge_sig_legacy(sc, BGE_RESET_STOP); @@ -4838,17 +4962,11 @@ bge_link_upd(struct bge_softc *sc) BGE_MACSTAT_LINK_CHANGED); } -#define BGE_SYSCTL_STAT(sc, ctx, desc, parent, node, oid) \ - SYSCTL_ADD_PROC(ctx, parent, OID_AUTO, oid, CTLTYPE_UINT|CTLFLAG_RD, \ - sc, offsetof(struct bge_stats, node), bge_sysctl_stats, "IU", \ - desc) - static void bge_add_sysctls(struct bge_softc *sc) { struct sysctl_ctx_list *ctx; - struct sysctl_oid_list *children, *schildren; - struct sysctl_oid *tree; + struct sysctl_oid_list *children; char tn[32]; int unit; @@ -4910,9 +5028,24 @@ bge_add_sysctls(struct bge_softc *sc) "generate UDP checksum value 0"); if (BGE_IS_5705_PLUS(sc)) - return; + bge_add_sysctl_stats_regs(sc, ctx, children); + else + bge_add_sysctl_stats(sc, ctx, children); +} + +#define BGE_SYSCTL_STAT(sc, ctx, desc, parent, node, oid) \ + SYSCTL_ADD_PROC(ctx, parent, OID_AUTO, oid, CTLTYPE_UINT|CTLFLAG_RD, \ + sc, offsetof(struct bge_stats, node), bge_sysctl_stats, "IU", \ + desc) - tree = SYSCTL_ADD_NODE(ctx, children, OID_AUTO, "stats", CTLFLAG_RD, +static void +bge_add_sysctl_stats(struct bge_softc *sc, struct sysctl_ctx_list *ctx, + struct sysctl_oid_list *parent) +{ + struct sysctl_oid *tree; + struct sysctl_oid_list *children, *schildren; + + tree = SYSCTL_ADD_NODE(ctx, parent, OID_AUTO, "stats", CTLFLAG_RD, NULL, "BGE Statistics"); schildren = children = SYSCTL_CHILDREN(tree); BGE_SYSCTL_STAT(sc, ctx, "Frames Dropped Due To Filters", @@ -5029,6 +5162,106 @@ bge_add_sysctls(struct bge_softc *sc) children, txstats.ifOutErrors, "Errors"); } +#undef BGE_SYSCTL_STAT + +#define BGE_SYSCTL_STAT_ADD64(c, h, n, p, d) \ + SYSCTL_ADD_QUAD(c, h, OID_AUTO, n, CTLFLAG_RD, p, d) + +static void +bge_add_sysctl_stats_regs(struct bge_softc *sc, struct sysctl_ctx_list *ctx, + struct sysctl_oid_list *parent) +{ + struct sysctl_oid *tree; + struct sysctl_oid_list *child, *schild; + struct bge_mac_stats *stats; + + stats = &sc->bge_mac_stats; + tree = SYSCTL_ADD_NODE(ctx, parent, OID_AUTO, "stats", CTLFLAG_RD, + NULL, "BGE Statistics"); + schild = child = SYSCTL_CHILDREN(tree); + BGE_SYSCTL_STAT_ADD64(ctx, child, "FramesDroppedDueToFilters", + &stats->FramesDroppedDueToFilters, "Frames Dropped Due to Filters"); + BGE_SYSCTL_STAT_ADD64(ctx, child, "DmaWriteQueueFull", + &stats->DmaWriteQueueFull, "NIC DMA Write Queue Full"); + BGE_SYSCTL_STAT_ADD64(ctx, child, "DmaWriteHighPriQueueFull", + &stats->DmaWriteHighPriQueueFull, + "NIC DMA Write High Priority Queue Full"); + BGE_SYSCTL_STAT_ADD64(ctx, child, "NoMoreRxBDs", + &stats->NoMoreRxBDs, "NIC No More RX Buffer Descriptors"); + BGE_SYSCTL_STAT_ADD64(ctx, child, "InputDiscards", + &stats->InputDiscards, "Discarded Input Frames"); + BGE_SYSCTL_STAT_ADD64(ctx, child, "InputErrors", + &stats->InputErrors, "Input Errors"); + BGE_SYSCTL_STAT_ADD64(ctx, child, "RecvThresholdHit", + &stats->RecvThresholdHit, "NIC Recv Threshold Hit"); + + tree = SYSCTL_ADD_NODE(ctx, schild, OID_AUTO, "rx", CTLFLAG_RD, + NULL, "BGE RX Statistics"); + child = SYSCTL_CHILDREN(tree); + BGE_SYSCTL_STAT_ADD64(ctx, child, "ifHCInOctets", + &stats->ifHCInOctets, "Inbound Octets"); + BGE_SYSCTL_STAT_ADD64(ctx, child, "Fragments", + &stats->etherStatsFragments, "Fragments"); + BGE_SYSCTL_STAT_ADD64(ctx, child, "UcastPkts", + &stats->ifHCInUcastPkts, "Inbound Unicast Packets"); + BGE_SYSCTL_STAT_ADD64(ctx, child, "MulticastPkts", + &stats->ifHCInMulticastPkts, "Inbound Multicast Packets"); + BGE_SYSCTL_STAT_ADD64(ctx, child, "BroadcastPkts", + &stats->ifHCInBroadcastPkts, "Inbound Broadcast Packets"); + BGE_SYSCTL_STAT_ADD64(ctx, child, "FCSErrors", + &stats->dot3StatsFCSErrors, "FCS Errors"); + BGE_SYSCTL_STAT_ADD64(ctx, child, "AlignmentErrors", + &stats->dot3StatsAlignmentErrors, "Alignment Errors"); + BGE_SYSCTL_STAT_ADD64(ctx, child, "xonPauseFramesReceived", + &stats->xonPauseFramesReceived, "XON Pause Frames Received"); + BGE_SYSCTL_STAT_ADD64(ctx, child, "xoffPauseFramesReceived", + &stats->xoffPauseFramesReceived, "XOFF Pause Frames Received"); + BGE_SYSCTL_STAT_ADD64(ctx, child, "ControlFramesReceived", + &stats->macControlFramesReceived, "MAC Control Frames Received"); + BGE_SYSCTL_STAT_ADD64(ctx, child, "xoffStateEntered", + &stats->xoffStateEntered, "XOFF State Entered"); + BGE_SYSCTL_STAT_ADD64(ctx, child, "FramesTooLong", + &stats->dot3StatsFramesTooLong, "Frames Too Long"); + BGE_SYSCTL_STAT_ADD64(ctx, child, "Jabbers", + &stats->etherStatsJabbers, "Jabbers"); + BGE_SYSCTL_STAT_ADD64(ctx, child, "UndersizePkts", + &stats->etherStatsUndersizePkts, "Undersized Packets"); + + tree = SYSCTL_ADD_NODE(ctx, schild, OID_AUTO, "tx", CTLFLAG_RD, + NULL, "BGE TX Statistics"); + child = SYSCTL_CHILDREN(tree); + BGE_SYSCTL_STAT_ADD64(ctx, child, "Octets", + &stats->ifHCOutOctets, "Outbound Octets"); + BGE_SYSCTL_STAT_ADD64(ctx, child, "Collisions", + &stats->etherStatsCollisions, "TX Collisions"); + BGE_SYSCTL_STAT_ADD64(ctx, child, "XonSent", + &stats->outXonSent, "XON Sent"); + BGE_SYSCTL_STAT_ADD64(ctx, child, "XoffSent", + &stats->outXoffSent, "XOFF Sent"); + BGE_SYSCTL_STAT_ADD64(ctx, child, "InternalMacTransmitErrors", + &stats->dot3StatsInternalMacTransmitErrors, + "Internal MAC TX Errors"); + BGE_SYSCTL_STAT_ADD64(ctx, child, "SingleCollisionFrames", + &stats->dot3StatsSingleCollisionFrames, "Single Collision Frames"); + BGE_SYSCTL_STAT_ADD64(ctx, child, "MultipleCollisionFrames", + &stats->dot3StatsMultipleCollisionFrames, + "Multiple Collision Frames"); + BGE_SYSCTL_STAT_ADD64(ctx, child, "DeferredTransmissions", + &stats->dot3StatsDeferredTransmissions, "Deferred Transmissions"); + BGE_SYSCTL_STAT_ADD64(ctx, child, "ExcessiveCollisions", + &stats->dot3StatsExcessiveCollisions, "Excessive Collisions"); + BGE_SYSCTL_STAT_ADD64(ctx, child, "LateCollisions", + &stats->dot3StatsLateCollisions, "Late Collisions"); + BGE_SYSCTL_STAT_ADD64(ctx, child, "UcastPkts", + &stats->ifHCOutUcastPkts, "Outbound Unicast Packets"); + BGE_SYSCTL_STAT_ADD64(ctx, child, "McastPkts", + &stats->ifHCOutMulticastPkts, "Outbound Multicast Packets"); + BGE_SYSCTL_STAT_ADD64(ctx, child, "BcastPkts", + &stats->ifHCOutBroadcastPkts, "Outbound Broadcast Packets"); +} + +#undef BGE_SYSCTL_STAT_ADD64 + static int bge_sysctl_stats(SYSCTL_HANDLER_ARGS) { Modified: head/sys/dev/bge/if_bgereg.h ============================================================================== --- head/sys/dev/bge/if_bgereg.h Wed Sep 29 21:53:11 2010 (r213282) +++ head/sys/dev/bge/if_bgereg.h Wed Sep 29 21:56:31 2010 (r213283) @@ -637,7 +637,53 @@ #define BGE_SERDES_STS 0x0594 #define BGE_SGDIG_CFG 0x05B0 #define BGE_SGDIG_STS 0x05B4 -#define BGE_MAC_STATS 0x0800 +#define BGE_TX_MAC_STATS_OCTETS 0x0800 +#define BGE_TX_MAC_STATS_RESERVE_0 0x0804 +#define BGE_TX_MAC_STATS_COLLS 0x0808 +#define BGE_TX_MAC_STATS_XON_SENT 0x080C +#define BGE_TX_MAC_STATS_XOFF_SENT 0x0810 +#define BGE_TX_MAC_STATS_RESERVE_1 0x0814 +#define BGE_TX_MAC_STATS_ERRORS 0x0818 +#define BGE_TX_MAC_STATS_SINGLE_COLL 0x081C +#define BGE_TX_MAC_STATS_MULTI_COLL 0x0820 +#define BGE_TX_MAC_STATS_DEFERRED 0x0824 +#define BGE_TX_MAC_STATS_RESERVE_2 0x0828 +#define BGE_TX_MAC_STATS_EXCESS_COLL 0x082C +#define BGE_TX_MAC_STATS_LATE_COLL 0x0830 +#define BGE_TX_MAC_STATS_RESERVE_3 0x0834 +#define BGE_TX_MAC_STATS_RESERVE_4 0x0838 +#define BGE_TX_MAC_STATS_RESERVE_5 0x083C +#define BGE_TX_MAC_STATS_RESERVE_6 0x0840 +#define BGE_TX_MAC_STATS_RESERVE_7 0x0844 +#define BGE_TX_MAC_STATS_RESERVE_8 0x0848 +#define BGE_TX_MAC_STATS_RESERVE_9 0x084C +#define BGE_TX_MAC_STATS_RESERVE_10 0x0850 +#define BGE_TX_MAC_STATS_RESERVE_11 0x0854 +#define BGE_TX_MAC_STATS_RESERVE_12 0x0858 +#define BGE_TX_MAC_STATS_RESERVE_13 0x085C +#define BGE_TX_MAC_STATS_RESERVE_14 0x0860 +#define BGE_TX_MAC_STATS_RESERVE_15 0x0864 +#define BGE_TX_MAC_STATS_RESERVE_16 0x0868 +#define BGE_TX_MAC_STATS_UCAST 0x086C +#define BGE_TX_MAC_STATS_MCAST 0x0870 +#define BGE_TX_MAC_STATS_BCAST 0x0874 +#define BGE_TX_MAC_STATS_RESERVE_17 0x0878 +#define BGE_TX_MAC_STATS_RESERVE_18 0x087C +#define BGE_RX_MAC_STATS_OCTESTS 0x0880 +#define BGE_RX_MAC_STATS_RESERVE_0 0x0884 +#define BGE_RX_MAC_STATS_FRAGMENTS 0x0888 +#define BGE_RX_MAC_STATS_UCAST 0x088C +#define BGE_RX_MAC_STATS_MCAST 0x0890 +#define BGE_RX_MAC_STATS_BCAST 0x0894 +#define BGE_RX_MAC_STATS_FCS_ERRORS 0x0898 +#define BGE_RX_MAC_STATS_ALGIN_ERRORS 0x089C +#define BGE_RX_MAC_STATS_XON_RCVD 0x08A0 +#define BGE_RX_MAC_STATS_XOFF_RCVD 0x08A4 +#define BGE_RX_MAC_STATS_CTRL_RCVD 0x08A8 +#define BGE_RX_MAC_STATS_XOFF_ENTERED 0x08AC +#define BGE_RX_MAC_STATS_FRAME_TOO_LONG 0x08B0 +#define BGE_RX_MAC_STATS_JABBERS 0x08B4 +#define BGE_RX_MAC_STATS_UNDERSIZE 0x08B8 /* Ethernet MAC Mode register */ #define BGE_MACMODE_RESET 0x00000001 @@ -2349,40 +2395,50 @@ struct bge_tx_mac_stats { }; /* Stats counters access through registers */ -struct bge_mac_stats_regs { - uint32_t ifHCOutOctets; - uint32_t Reserved0; - uint32_t etherStatsCollisions; - uint32_t outXonSent; - uint32_t outXoffSent; - uint32_t Reserved1; - uint32_t dot3StatsInternalMacTransmitErrors; - uint32_t dot3StatsSingleCollisionFrames; - uint32_t dot3StatsMultipleCollisionFrames; - uint32_t dot3StatsDeferredTransmissions; - uint32_t Reserved2; - uint32_t dot3StatsExcessiveCollisions; - uint32_t dot3StatsLateCollisions; - uint32_t Reserved3[14]; - uint32_t ifHCOutUcastPkts; - uint32_t ifHCOutMulticastPkts; - uint32_t ifHCOutBroadcastPkts; - uint32_t Reserved4[2]; - uint32_t ifHCInOctets; - uint32_t Reserved5; - uint32_t etherStatsFragments; - uint32_t ifHCInUcastPkts; - uint32_t ifHCInMulticastPkts; - uint32_t ifHCInBroadcastPkts; - uint32_t dot3StatsFCSErrors; - uint32_t dot3StatsAlignmentErrors; - uint32_t xonPauseFramesReceived; - uint32_t xoffPauseFramesReceived; - uint32_t macControlFramesReceived; - uint32_t xoffStateEntered; - uint32_t dot3StatsFramesTooLong; - uint32_t etherStatsJabbers; - uint32_t etherStatsUndersizePkts; +struct bge_mac_stats { + /* TX MAC statistics */ + uint64_t ifHCOutOctets; + uint64_t Reserved0; + uint64_t etherStatsCollisions; + uint64_t outXonSent; + uint64_t outXoffSent; + uint64_t Reserved1; + uint64_t dot3StatsInternalMacTransmitErrors; + uint64_t dot3StatsSingleCollisionFrames; + uint64_t dot3StatsMultipleCollisionFrames; + uint64_t dot3StatsDeferredTransmissions; + uint64_t Reserved2; + uint64_t dot3StatsExcessiveCollisions; + uint64_t dot3StatsLateCollisions; + uint64_t Reserved3[14]; + uint64_t ifHCOutUcastPkts; + uint64_t ifHCOutMulticastPkts; + uint64_t ifHCOutBroadcastPkts; + uint64_t Reserved4[2]; + /* RX MAC statistics */ + uint64_t ifHCInOctets; + uint64_t Reserved5; + uint64_t etherStatsFragments; + uint64_t ifHCInUcastPkts; + uint64_t ifHCInMulticastPkts; + uint64_t ifHCInBroadcastPkts; + uint64_t dot3StatsFCSErrors; + uint64_t dot3StatsAlignmentErrors; + uint64_t xonPauseFramesReceived; + uint64_t xoffPauseFramesReceived; + uint64_t macControlFramesReceived; + uint64_t xoffStateEntered; + uint64_t dot3StatsFramesTooLong; + uint64_t etherStatsJabbers; + uint64_t etherStatsUndersizePkts; + /* Receive List Placement control */ + uint64_t FramesDroppedDueToFilters; + uint64_t DmaWriteQueueFull; + uint64_t DmaWriteHighPriQueueFull; + uint64_t NoMoreRxBDs; + uint64_t InputDiscards; + uint64_t InputErrors; + uint64_t RecvThresholdHit; }; struct bge_stats { @@ -2660,6 +2716,7 @@ struct bge_softc { #ifdef DEVICE_POLLING int rxcycles; #endif /* DEVICE_POLLING */ + struct bge_mac_stats bge_mac_stats; struct task bge_intr_task; struct taskqueue *bge_tq; }; From owner-svn-src-head@FreeBSD.ORG Wed Sep 29 22:12:35 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from [127.0.0.1] (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by hub.freebsd.org (Postfix) with ESMTP id 6134D1065672; Wed, 29 Sep 2010 22:12:35 +0000 (UTC) (envelope-from jkim@FreeBSD.org) From: Jung-uk Kim To: src-committers@FreeBSD.org Date: Wed, 29 Sep 2010 18:12:24 -0400 User-Agent: KMail/1.6.2 References: <201009292120.o8TLKTSf022159@svn.freebsd.org> In-Reply-To: <201009292120.o8TLKTSf022159@svn.freebsd.org> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201009291812.26796.jkim@FreeBSD.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, Dimitry Andric Subject: Re: svn commit: r213281 - head/lib/libc/amd64/gen X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2010 22:12:35 -0000 On Wednesday 29 September 2010 05:20 pm, Dimitry Andric wrote: > Author: dim > Date: Wed Sep 29 21:20:29 2010 > New Revision: 213281 > URL: http://svn.freebsd.org/changeset/base/213281 > > Log: > Apply the same workaround for clang to amd64's version of ldexp.c > (as in r212976): order the incoming arguments to fscale as st(0), > st(1), and mark temp2 volatile (only in case of compilation with > clang) to force clang to pop it correctly. No binary change when > compiled with gcc. Actually the binary slightly changes when compiled with gcc: %diff -u ldexp-r1.14.c ldexp-r1.15.c --- ldexp-r1.14.c 2010-09-29 17:44:45.000000000 -0400 +++ ldexp-r1.15.c 2010-09-29 17:45:10.000000000 -0400 @@ -34,7 +34,9 @@ static char sccsid[] = "@(#)ldexp.c 8.1 (Berkeley) 6/4/93"; #endif /* LIBC_SCCS and not lint */ #include -__FBSDID("$FreeBSD: src/lib/libc/amd64/gen/ldexp.c,v 1.14 2007/01/09 00:38:24 imp Exp $"); +__FBSDID("$FreeBSD: src/lib/libc/amd64/gen/ldexp.c,v 1.15 2010/09/29 21:20:29 dim Exp $"); + +#include /* * ldexp(value, exp): return value * (2 ** exp). @@ -49,12 +51,16 @@ double ldexp (double value, int exp) { - double temp, texp, temp2; + double temp, texp; +#ifdef __clang__ + volatile +#endif + double temp2; texp = exp; #ifdef __GNUC__ __asm ("fscale " - : "=u" (temp2), "=t" (temp) - : "0" (texp), "1" (value)); + : "=t" (temp), "=u" (temp2) + : "0" (value), "1" (texp)); #else #error unknown asm #endif %objdump -d ldexp-r1.14.o ldexp-r1.15.o ldexp-r1.14.o: file format elf64-x86-64 Disassembly of section .text: 0000000000000000 : 0: 55 push %rbp 1: 48 89 e5 mov %rsp,%rbp 4: f2 0f 11 45 d8 movsd %xmm0,0xffffffffffffffd8(%rbp) 9: 89 7d d4 mov %edi,0xffffffffffffffd4(%rbp) c: f2 0f 2a 45 d4 cvtsi2sd 0xffffffffffffffd4(%rbp),%xmm0 11: f2 0f 11 45 f0 movsd %xmm0,0xfffffffffffffff0(%rbp) 16: dd 45 f0 fldl 0xfffffffffffffff0(%rbp) 19: dd 45 d8 fldl 0xffffffffffffffd8(%rbp) 1c: d9 fd fscale 1e: d9 c9 fxch %st(1) 20: dd 5d f8 fstpl 0xfffffffffffffff8(%rbp) 23: dd 5d e8 fstpl 0xffffffffffffffe8(%rbp) 26: 48 8b 45 e8 mov 0xffffffffffffffe8(%rbp),%rax 2a: 48 89 45 c8 mov %rax,0xffffffffffffffc8(%rbp) 2e: f2 0f 10 45 c8 movsd 0xffffffffffffffc8(%rbp),%xmm0 33: c9 leaveq 34: c3 retq ldexp-r1.15.o: file format elf64-x86-64 Disassembly of section .text: 0000000000000000 : 0: 55 push %rbp 1: 48 89 e5 mov %rsp,%rbp 4: f2 0f 11 45 d8 movsd %xmm0,0xffffffffffffffd8(%rbp) 9: 89 7d d4 mov %edi,0xffffffffffffffd4(%rbp) c: f2 0f 2a 45 d4 cvtsi2sd 0xffffffffffffffd4(%rbp),%xmm0 11: f2 0f 11 45 f0 movsd %xmm0,0xfffffffffffffff0(%rbp) 16: dd 45 d8 fldl 0xffffffffffffffd8(%rbp) 19: dd 45 f0 fldl 0xfffffffffffffff0(%rbp) 1c: d9 c9 fxch %st(1) 1e: d9 fd fscale 20: dd 5d e8 fstpl 0xffffffffffffffe8(%rbp) 23: dd 5d f8 fstpl 0xfffffffffffffff8(%rbp) 26: 48 8b 45 e8 mov 0xffffffffffffffe8(%rbp),%rax 2a: 48 89 45 c8 mov %rax,0xffffffffffffffc8(%rbp) 2e: f2 0f 10 45 c8 movsd 0xffffffffffffffc8(%rbp),%xmm0 33: c9 leaveq 34: c3 retq Note the new version place FXCH before FSCALE. When it is compiled with -O2: %objdump -d ldexp-r1.14.o ldexp-r1.15.o ldexp-r1.14.o: file format elf64-x86-64 Disassembly of section .text: 0000000000000000 : 0: f2 0f 2a cf cvtsi2sd %edi,%xmm1 4: f2 0f 11 44 24 f0 movsd %xmm0,0xfffffffffffffff0(%rsp) a: f2 0f 11 4c 24 f8 movsd %xmm1,0xfffffffffffffff8(%rsp) 10: dd 44 24 f8 fldl 0xfffffffffffffff8(%rsp) 14: dd 44 24 f0 fldl 0xfffffffffffffff0(%rsp) 18: d9 fd fscale 1a: dd d9 fstp %st(1) 1c: dd 5c 24 f0 fstpl 0xfffffffffffffff0(%rsp) 20: f2 0f 10 44 24 f0 movsd 0xfffffffffffffff0(%rsp),%xmm0 26: c3 retq ldexp-r1.15.o: file format elf64-x86-64 Disassembly of section .text: 0000000000000000 : 0: f2 0f 2a cf cvtsi2sd %edi,%xmm1 4: f2 0f 11 44 24 f0 movsd %xmm0,0xfffffffffffffff0(%rsp) a: dd 44 24 f0 fldl 0xfffffffffffffff0(%rsp) e: f2 0f 11 4c 24 f8 movsd %xmm1,0xfffffffffffffff8(%rsp) 14: dd 44 24 f8 fldl 0xfffffffffffffff8(%rsp) 18: d9 c9 fxch %st(1) 1a: d9 fd fscale 1c: dd d9 fstp %st(1) 1e: dd 5c 24 f0 fstpl 0xfffffffffffffff0(%rsp) 22: f2 0f 10 44 24 f0 movsd 0xfffffffffffffff0(%rsp),%xmm0 28: c3 retq With -O1 and above, the FXCH completely disappears from the old version by rearranging stack operations, which is even more interesting. Don't get me wrong, both work fine. FYI, verified with this: http://cvsweb.netbsd.org/bsdweb.cgi/src/regress/lib/libc/ldexp/ Old ldexp() with gcc: PASSED Old ldexp() with clang: FAILED New ldexp() with gcc: PASSED New ldexp() with clang: PASSED Jung-uk Kim From owner-svn-src-head@FreeBSD.ORG Wed Sep 29 22:16:18 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 61C76106564A; Wed, 29 Sep 2010 22:16:18 +0000 (UTC) (envelope-from swell.k@gmail.com) Received: from mail-qw0-f54.google.com (mail-qw0-f54.google.com [209.85.216.54]) by mx1.freebsd.org (Postfix) with ESMTP id E4E3D8FC0A; Wed, 29 Sep 2010 22:16:17 +0000 (UTC) Received: by qwd6 with SMTP id 6so923004qwd.13 for ; Wed, 29 Sep 2010 15:16:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:references :date:message-id:user-agent:mime-version:content-type; bh=2htYxaUBXhz50RDOp9OpVZndVIumPNBFpMJmf1WuXGU=; b=al0uPoU+MEkXGMFBQWJ8GJM90AMxRzf1AZCvwgleNbpCqqvlg/5o0/aBrFHOJYfX5E 4IL+VuQpVgHDgth9D0P66Ex7Jlaq3z6cWIax1+z7yMQw6S9Kq2+6PJyhVL2ypf5sfQcR pdmLBJr7DhEcFJ4m9hclJ38xu/3e4sA4eHcGg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:references:date:message-id:user-agent :mime-version:content-type; b=NqcLtNX26xD0U63h5nh7rHl6L0Opmycac8040DjBUSP7s1sJVCIRzoUhozfF9S66Xl UzPNj0izBWZTMvGmSsF0IMqLx7agIdia/rfMp9RUWIHBF9cMg0TxiLZu+xrn5k2s8553 fIilaWNdZEJKJ2rlSrofOpLcq7A9vw1Suq8eg= Received: by 10.229.101.195 with SMTP id d3mr1750466qco.67.1285798577102; Wed, 29 Sep 2010 15:16:17 -0700 (PDT) Received: from localhost (tor-exit-proxy2-readme.formlessnetworking.net [208.53.142.38]) by mx.google.com with ESMTPS id f15sm9979288qcr.37.2010.09.29.15.16.14 (version=SSLv3 cipher=RC4-MD5); Wed, 29 Sep 2010 15:16:16 -0700 (PDT) From: Anonymous To: Ed Maste References: <201009291308.o8TD8NHo009975__13177.80579343$1285765721$gmane$org@svn.freebsd.org> Date: Thu, 30 Sep 2010 02:08:58 +0400 Message-ID: <86tyl842yt.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r213270 - head/etc/rc.d X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2010 22:16:18 -0000 Ed Maste writes: > Author: emaste > Date: Wed Sep 29 13:08:23 2010 > New Revision: 213270 > URL: http://svn.freebsd.org/changeset/base/213270 > [...] > + if [ ${waited} -eq ${defaultroute_carrier_delay} ] && ! defaultroute_carrier; then > + echo -n "(no carrier)" > + break > + fi This produces [: -eq: argument expected by default. The patch on freebsd-rc@ had etc/defaults/rc.conf diff, too. From owner-svn-src-head@FreeBSD.ORG Wed Sep 29 22:24:19 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 71910106566B; Wed, 29 Sep 2010 22:24:19 +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 4609B8FC13; Wed, 29 Sep 2010 22:24: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 o8TMOJn7023830; Wed, 29 Sep 2010 22:24:19 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8TMOJts023825; Wed, 29 Sep 2010 22:24:19 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201009292224.o8TMOJts023825@svn.freebsd.org> From: Jilles Tjoelker Date: Wed, 29 Sep 2010 22:24:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213284 - in head: tools/regression/usr.bin/tr usr.bin/tr X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2010 22:24:19 -0000 Author: jilles Date: Wed Sep 29 22:24:18 2010 New Revision: 213284 URL: http://svn.freebsd.org/changeset/base/213284 Log: tr: Fix '[=]=]' equivalence class. A closing bracket immediately after '[=' should not be treated as special. Different from the submitted patch, a string ending with '[=' does not cause access beyond the terminating '\0'. PR: bin/150384 Submitted by: Richard Lowe MFC after: 2 weeks Added: head/tools/regression/usr.bin/tr/regress.0c.out (contents, props changed) head/tools/regression/usr.bin/tr/regress.0d.out (contents, props changed) Modified: head/tools/regression/usr.bin/tr/regress.sh head/usr.bin/tr/str.c Added: head/tools/regression/usr.bin/tr/regress.0c.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/usr.bin/tr/regress.0c.out Wed Sep 29 22:24:18 2010 (r213284) @@ -0,0 +1 @@ +[[[[ Added: head/tools/regression/usr.bin/tr/regress.0d.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/usr.bin/tr/regress.0d.out Wed Sep 29 22:24:18 2010 (r213284) @@ -0,0 +1 @@ + Modified: head/tools/regression/usr.bin/tr/regress.sh ============================================================================== --- head/tools/regression/usr.bin/tr/regress.sh Wed Sep 29 21:56:31 2010 (r213283) +++ head/tools/regression/usr.bin/tr/regress.sh Wed Sep 29 22:24:18 2010 (r213284) @@ -1,6 +1,6 @@ # $FreeBSD$ -echo 1..12 +echo 1..14 REGRESSION_START($1) @@ -16,5 +16,7 @@ REGRESSION_TEST(`08', `tr "[[:upper:]]" REGRESSION_TEST(`09', `printf "\\f\\r\\n" | tr "\\014\\r" "?#"') REGRESSION_TEST(`0a', `printf "0xdeadbeef\\n" | tr "x[[:xdigit:]]" "?\$"') REGRESSION_TEST(`0b', `(tr -cd "[[:xdigit:]]" < regress2.in ; echo)') +REGRESSION_TEST(`0c', `echo "[[[[]]]]" | tr -d "[=]=]"') +REGRESSION_TEST(`0d', `echo "]=[" | tr -d "[=]"') REGRESSION_END() Modified: head/usr.bin/tr/str.c ============================================================================== --- head/usr.bin/tr/str.c Wed Sep 29 21:56:31 2010 (r213283) +++ head/usr.bin/tr/str.c Wed Sep 29 22:24:18 2010 (r213284) @@ -156,7 +156,7 @@ bracket(s) s->str = p + 1; return (1); case '=': /* "[=equiv=]" */ - if ((p = strchr(s->str + 2, ']')) == NULL) + if (s->str[2] == '\0' || (p = strchr(s->str + 3, ']')) == NULL) return (0); if (*(p - 1) != '=' || p - s->str < 4) goto repeat; From owner-svn-src-head@FreeBSD.ORG Wed Sep 29 22:59:49 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9A1651065675; Wed, 29 Sep 2010 22:59:49 +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 89C758FC18; Wed, 29 Sep 2010 22:59:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8TMxn8p028157; Wed, 29 Sep 2010 22:59:49 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8TMxnYL028155; Wed, 29 Sep 2010 22:59:49 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201009292259.o8TMxnYL028155@svn.freebsd.org> From: Ed Maste Date: Wed, 29 Sep 2010 22:59:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213285 - head/etc/defaults X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2010 22:59:49 -0000 Author: emaste Date: Wed Sep 29 22:59:49 2010 New Revision: 213285 URL: http://svn.freebsd.org/changeset/base/213285 Log: Commit the rest of r213270. Thanks to Anonymous for spotting this. Modified: head/etc/defaults/rc.conf Modified: head/etc/defaults/rc.conf ============================================================================== --- head/etc/defaults/rc.conf Wed Sep 29 22:24:18 2010 (r213284) +++ head/etc/defaults/rc.conf Wed Sep 29 22:59:49 2010 (r213285) @@ -108,6 +108,7 @@ background_dhclient="NO" # Start dhcp cl synchronous_dhclient="NO" # Start dhclient directly on configured # interfaces during startup. defaultroute_delay="30" # Time to wait for a default route on a DHCP interface. +defaultroute_carrier_delay="5" # Time to wait for carrier while waiting for a default route. wpa_supplicant_program="/usr/sbin/wpa_supplicant" wpa_supplicant_flags="-s" # Extra flags to pass to wpa_supplicant wpa_supplicant_conf_file="/etc/wpa_supplicant.conf" From owner-svn-src-head@FreeBSD.ORG Wed Sep 29 23:01:07 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 50EE31065672; Wed, 29 Sep 2010 23:01:07 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mail1.sandvine.com (Mail1.sandvine.com [64.7.137.134]) by mx1.freebsd.org (Postfix) with ESMTP id 097B28FC18; Wed, 29 Sep 2010 23:01:06 +0000 (UTC) Received: from labgw2.phaedrus.sandvine.com (192.168.222.22) by WTL-EXCH-1.sandvine.com (192.168.196.31) with Microsoft SMTP Server id 14.0.694.0; Wed, 29 Sep 2010 19:00:56 -0400 Received: by labgw2.phaedrus.sandvine.com (Postfix, from userid 10332) id A746B33C00; Wed, 29 Sep 2010 19:01:05 -0400 (EDT) Date: Wed, 29 Sep 2010 19:01:05 -0400 From: Ed Maste To: Anonymous Message-ID: <20100929230105.GA94730@sandvine.com> References: <201009291308.o8TD8NHo009975__13177.80579343$1285765721$gmane$org@svn.freebsd.org> <86tyl842yt.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <86tyl842yt.fsf@gmail.com> User-Agent: Mutt/1.4.2.1i Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r213270 - head/etc/rc.d X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2010 23:01:07 -0000 On Thu, Sep 30, 2010 at 02:08:58AM +0400, Anonymous wrote: > Ed Maste writes: > > > Author: emaste > > Date: Wed Sep 29 13:08:23 2010 > > New Revision: 213270 > > URL: http://svn.freebsd.org/changeset/base/213270 > > > [...] > > + if [ ${waited} -eq ${defaultroute_carrier_delay} ] && ! defaultroute_carrier; then > > + echo -n "(no carrier)" > > + break > > + fi > > This produces > > [: -eq: argument expected > > by default. The patch on freebsd-rc@ had etc/defaults/rc.conf diff, too. Thanks, commited as r213285. -Ed From owner-svn-src-head@FreeBSD.ORG Wed Sep 29 23:06:41 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BDE75106564A; Wed, 29 Sep 2010 23:06:41 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 931E28FC12; Wed, 29 Sep 2010 23:06: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 o8TN6fPN029222; Wed, 29 Sep 2010 23:06:41 GMT (envelope-from gonzo@svn.freebsd.org) Received: (from gonzo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8TN6fSt029219; Wed, 29 Sep 2010 23:06:41 GMT (envelope-from gonzo@svn.freebsd.org) Message-Id: <201009292306.o8TN6fSt029219@svn.freebsd.org> From: Oleksandr Tymoshenko Date: Wed, 29 Sep 2010 23:06:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213286 - head/sys/mips/atheros X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2010 23:06:41 -0000 Author: gonzo Date: Wed Sep 29 23:06:41 2010 New Revision: 213286 URL: http://svn.freebsd.org/changeset/base/213286 Log: - Fix values of CS1_EN and CS2_EN flags - Unbreak kernel build by fixing naming convention of GPIO_FUNC flags Spotted by: Luiz Otavio O Souza, Andrew Thompson Modified: head/sys/mips/atheros/ar71xx_gpio.c head/sys/mips/atheros/ar71xxreg.h Modified: head/sys/mips/atheros/ar71xx_gpio.c ============================================================================== --- head/sys/mips/atheros/ar71xx_gpio.c Wed Sep 29 22:59:49 2010 (r213285) +++ head/sys/mips/atheros/ar71xx_gpio.c Wed Sep 29 23:06:41 2010 (r213286) @@ -375,8 +375,8 @@ ar71xx_gpio_attach(device_t dev) } sc->dev = dev; - ar71xx_gpio_function_enable(sc, GPIO_SPI_CS1_EN); - ar71xx_gpio_function_enable(sc, GPIO_SPI_CS2_EN); + ar71xx_gpio_function_enable(sc, GPIO_FUNC_SPI_CS1_EN); + ar71xx_gpio_function_enable(sc, GPIO_FUNC_SPI_CS2_EN); /* Configure all pins as input */ /* disable interrupts for all pins */ GPIO_WRITE(sc, AR71XX_GPIO_INT_MASK, 0); @@ -406,8 +406,8 @@ ar71xx_gpio_detach(device_t dev) KASSERT(mtx_initialized(&sc->gpio_mtx), ("gpio mutex not initialized")); - ar71xx_gpio_function_disable(sc, GPIO_SPI_CS1_EN); - ar71xx_gpio_function_disable(sc, GPIO_SPI_CS2_EN); + ar71xx_gpio_function_disable(sc, GPIO_FUNC_SPI_CS1_EN); + ar71xx_gpio_function_disable(sc, GPIO_FUNC_SPI_CS2_EN); bus_generic_detach(dev); if (sc->gpio_mem_res) Modified: head/sys/mips/atheros/ar71xxreg.h ============================================================================== --- head/sys/mips/atheros/ar71xxreg.h Wed Sep 29 22:59:49 2010 (r213285) +++ head/sys/mips/atheros/ar71xxreg.h Wed Sep 29 23:06:41 2010 (r213286) @@ -151,11 +151,10 @@ #define AR71XX_GPIO_FUNCTION 0x28 #define GPIO_FUNC_STEREO_EN (1 << 17) #define GPIO_FUNC_SLIC_EN (1 << 16) -#define GPIO_FUNC_SPI_CS2_EN (1 << 15) +#define GPIO_FUNC_SPI_CS2_EN (1 << 13) /* CS2 is shared with GPIO_1 */ -#define GPIO_FUNC_SPI_CS1_EN (1 << 14) +#define GPIO_FUNC_SPI_CS1_EN (1 << 12) /* CS1 is shared with GPIO_0 */ -#define GPIO_FUNC_SPI_EN (1 << 13) #define GPIO_FUNC_UART_EN (1 << 8) #define GPIO_FUNC_USB_OC_EN (1 << 4) #define GPIO_FUNC_USB_CLK_EN (0) From owner-svn-src-head@FreeBSD.ORG Wed Sep 29 23:47:08 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4F2CC1065674; Wed, 29 Sep 2010 23:47:08 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3E6C18FC15; Wed, 29 Sep 2010 23:47: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 o8TNl8qJ035264; Wed, 29 Sep 2010 23:47:08 GMT (envelope-from cperciva@svn.freebsd.org) Received: (from cperciva@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8TNl6sn035259; Wed, 29 Sep 2010 23:47:06 GMT (envelope-from cperciva@svn.freebsd.org) Message-Id: <201009292347.o8TNl6sn035259@svn.freebsd.org> From: Colin Percival Date: Wed, 29 Sep 2010 23:47:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213287 - head/games/fortune/datfiles X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2010 23:47:08 -0000 Author: cperciva Date: Wed Sep 29 23:47:06 2010 New Revision: 213287 URL: http://svn.freebsd.org/changeset/base/213287 Log: Add advice to new fathers from Thomas Ptacek. Suggested by: wilko Approved by: Thomas Ptacek Security: New parents often feel very insecure. Modified: head/games/fortune/datfiles/fortunes Modified: head/games/fortune/datfiles/fortunes ============================================================================== --- head/games/fortune/datfiles/fortunes Wed Sep 29 23:06:41 2010 (r213286) +++ head/games/fortune/datfiles/fortunes Wed Sep 29 23:47:06 2010 (r213287) @@ -50602,6 +50602,12 @@ of its twelfth story apartment, and crus for freedom. -- Stig's Inferno % +They're basically very smelly houseplants until they get to the crawling +age. You're constantly terrified that they're going to randomly die on +you, but the rules for preventing that outcome are straightforward and +hard to forget. + -- Thomas Ptacek, giving advice to a new father +% They're giving bank robbing a bad name. -- John Dillinger, on Bonnie and Clyde % From owner-svn-src-head@FreeBSD.ORG Thu Sep 30 01:25:55 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 01BD4106566B; Thu, 30 Sep 2010 01:25:55 +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 E48878FC21; Thu, 30 Sep 2010 01:25: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 o8U1Ps4W048326; Thu, 30 Sep 2010 01:25:54 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8U1PsPC048324; Thu, 30 Sep 2010 01:25:54 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201009300125.o8U1PsPC048324@svn.freebsd.org> From: David Xu Date: Thu, 30 Sep 2010 01:25:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213288 - head/include X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Sep 2010 01:25:55 -0000 Author: davidxu Date: Thu Sep 30 01:25:54 2010 New Revision: 213288 URL: http://svn.freebsd.org/changeset/base/213288 Log: Import unwind.h from libunwind-0.99. Approved by: core (kib, rwatson, imp, brooks) Added: head/include/unwind.h (contents, props changed) Added: head/include/unwind.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/include/unwind.h Thu Sep 30 01:25:54 2010 (r213288) @@ -0,0 +1,154 @@ +/* $FreeBSD$ */ + +/* libunwind - a platform-independent unwind library + Copyright (C) 2003 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#ifndef _UNWIND_H +#define _UNWIND_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* Minimal interface as per C++ ABI draft standard: + + http://www.codesourcery.com/cxx-abi/abi-eh.html */ + +typedef enum + { + _URC_NO_REASON = 0, + _URC_FOREIGN_EXCEPTION_CAUGHT = 1, + _URC_FATAL_PHASE2_ERROR = 2, + _URC_FATAL_PHASE1_ERROR = 3, + _URC_NORMAL_STOP = 4, + _URC_END_OF_STACK = 5, + _URC_HANDLER_FOUND = 6, + _URC_INSTALL_CONTEXT = 7, + _URC_CONTINUE_UNWIND = 8 + } +_Unwind_Reason_Code; + +typedef int _Unwind_Action; + +#define _UA_SEARCH_PHASE 1 +#define _UA_CLEANUP_PHASE 2 +#define _UA_HANDLER_FRAME 4 +#define _UA_FORCE_UNWIND 8 + +struct _Unwind_Context; /* opaque data-structure */ +struct _Unwind_Exception; /* forward-declaration */ + +typedef void (*_Unwind_Exception_Cleanup_Fn) (_Unwind_Reason_Code, + struct _Unwind_Exception *); + +typedef _Unwind_Reason_Code (*_Unwind_Stop_Fn) (int, _Unwind_Action, + unsigned long, + struct _Unwind_Exception *, + struct _Unwind_Context *, + void *); + +/* The C++ ABI requires exception_class, private_1, and private_2 to + be of type uint64 and the entire structure to be + double-word-aligned, but that seems a bit overly IA-64-specific. + Using "unsigned long" instead should give us the desired effect on + IA-64, while being more general. */ +struct _Unwind_Exception + { + unsigned long exception_class; + _Unwind_Exception_Cleanup_Fn exception_cleanup; + unsigned long private_1; + unsigned long private_2; + }; + +extern _Unwind_Reason_Code _Unwind_RaiseException (struct _Unwind_Exception *); +extern _Unwind_Reason_Code _Unwind_ForcedUnwind (struct _Unwind_Exception *, + _Unwind_Stop_Fn, void *); +extern void _Unwind_Resume (struct _Unwind_Exception *); +extern void _Unwind_DeleteException (struct _Unwind_Exception *); +extern unsigned long _Unwind_GetGR (struct _Unwind_Context *, int); +extern void _Unwind_SetGR (struct _Unwind_Context *, int, unsigned long); +extern unsigned long _Unwind_GetIP (struct _Unwind_Context *); +extern unsigned long _Unwind_GetIPInfo (struct _Unwind_Context *, int *); +extern void _Unwind_SetIP (struct _Unwind_Context *, unsigned long); +extern unsigned long _Unwind_GetLanguageSpecificData (struct _Unwind_Context*); +extern unsigned long _Unwind_GetRegionStart (struct _Unwind_Context *); + +#ifdef _GNU_SOURCE + +/* Callback for _Unwind_Backtrace(). The backtrace stops immediately + if the callback returns any value other than _URC_NO_REASON. */ +typedef _Unwind_Reason_Code (*_Unwind_Trace_Fn) (struct _Unwind_Context *, + void *); + +/* See http://gcc.gnu.org/ml/gcc-patches/2001-09/msg00082.html for why + _UA_END_OF_STACK exists. */ +# define _UA_END_OF_STACK 16 + +/* If the unwind was initiated due to a forced unwind, resume that + operation, else re-raise the exception. This is used by + __cxa_rethrow(). */ +extern _Unwind_Reason_Code + _Unwind_Resume_or_Rethrow (struct _Unwind_Exception *); + +/* See http://gcc.gnu.org/ml/gcc-patches/2003-09/msg00154.html for why + _Unwind_GetBSP() exists. */ +extern unsigned long _Unwind_GetBSP (struct _Unwind_Context *); + +/* Return the "canonical frame address" for the given context. + This is used by NPTL... */ +extern unsigned long _Unwind_GetCFA (struct _Unwind_Context *); + +/* Return the base-address for data references. */ +extern unsigned long _Unwind_GetDataRelBase (struct _Unwind_Context *); + +/* Return the base-address for text references. */ +extern unsigned long _Unwind_GetTextRelBase (struct _Unwind_Context *); + +/* Call _Unwind_Trace_Fn once for each stack-frame, without doing any + cleanup. The first frame for which the callback is invoked is the + one for the caller of _Unwind_Backtrace(). _Unwind_Backtrace() + returns _URC_END_OF_STACK when the backtrace stopped due to + reaching the end of the call-chain or _URC_FATAL_PHASE1_ERROR if it + stops for any other reason. */ +extern _Unwind_Reason_Code _Unwind_Backtrace (_Unwind_Trace_Fn, void *); + +/* Find the start-address of the procedure containing the specified IP + or NULL if it cannot be found (e.g., because the function has no + unwind info). Note: there is not necessarily a one-to-one + correspondence between source-level functions and procedures: some + functions don't have unwind-info and others are split into multiple + procedures. */ +extern void *_Unwind_FindEnclosingFunction (void *); + +/* See also Linux Standard Base Spec: + http://www.linuxbase.org/spec/refspecs/LSB_1.3.0/gLSB/gLSB/libgcc-s.html */ + +#endif /* _GNU_SOURCE */ + +#ifdef __cplusplus +}; +#endif + +#endif /* _UNWIND_H */ From owner-svn-src-head@FreeBSD.ORG Thu Sep 30 03:09:35 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E3AE2106566C; Thu, 30 Sep 2010 03:09:35 +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 D32038FC08; Thu, 30 Sep 2010 03:09: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 o8U39Zma050857; Thu, 30 Sep 2010 03:09:35 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8U39ZsW050855; Thu, 30 Sep 2010 03:09:35 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201009300309.o8U39ZsW050855@svn.freebsd.org> From: David Xu Date: Thu, 30 Sep 2010 03:09:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213289 - head/include X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Sep 2010 03:09:36 -0000 Author: davidxu Date: Thu Sep 30 03:09:35 2010 New Revision: 213289 URL: http://svn.freebsd.org/changeset/base/213289 Log: - Sizeof exception class type should always be 64-bit. - Make some functions be visible to BSD source code. Modified: head/include/unwind.h Modified: head/include/unwind.h ============================================================================== --- head/include/unwind.h Thu Sep 30 01:25:54 2010 (r213288) +++ head/include/unwind.h Thu Sep 30 03:09:35 2010 (r213289) @@ -28,6 +28,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DE #ifndef _UNWIND_H #define _UNWIND_H +#include + #ifdef __cplusplus extern "C" { #endif @@ -76,7 +78,7 @@ typedef _Unwind_Reason_Code (*_Unwind_St IA-64, while being more general. */ struct _Unwind_Exception { - unsigned long exception_class; + __int64_t exception_class; _Unwind_Exception_Cleanup_Fn exception_cleanup; unsigned long private_1; unsigned long private_2; @@ -95,7 +97,7 @@ extern void _Unwind_SetIP (struct _Unwin extern unsigned long _Unwind_GetLanguageSpecificData (struct _Unwind_Context*); extern unsigned long _Unwind_GetRegionStart (struct _Unwind_Context *); -#ifdef _GNU_SOURCE +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) /* Callback for _Unwind_Backtrace(). The backtrace stops immediately if the callback returns any value other than _URC_NO_REASON. */ @@ -145,7 +147,7 @@ extern void *_Unwind_FindEnclosingFuncti /* See also Linux Standard Base Spec: http://www.linuxbase.org/spec/refspecs/LSB_1.3.0/gLSB/gLSB/libgcc-s.html */ -#endif /* _GNU_SOURCE */ +#endif /* _GNU_SOURCE || _BSD_SOURCE */ #ifdef __cplusplus }; From owner-svn-src-head@FreeBSD.ORG Thu Sep 30 03:16:35 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 74543106564A; Thu, 30 Sep 2010 03:16:35 +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 63ED98FC08; Thu, 30 Sep 2010 03:16: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 o8U3GZrC051027; Thu, 30 Sep 2010 03:16:35 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8U3GZkm051025; Thu, 30 Sep 2010 03:16:35 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201009300316.o8U3GZkm051025@svn.freebsd.org> From: David Xu Date: Thu, 30 Sep 2010 03:16:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213290 - head/include X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Sep 2010 03:16:35 -0000 Author: davidxu Date: Thu Sep 30 03:16:35 2010 New Revision: 213290 URL: http://svn.freebsd.org/changeset/base/213290 Log: Also the stop function should accept 64-bit exception class. Modified: head/include/unwind.h Modified: head/include/unwind.h ============================================================================== --- head/include/unwind.h Thu Sep 30 03:09:35 2010 (r213289) +++ head/include/unwind.h Thu Sep 30 03:16:35 2010 (r213290) @@ -66,7 +66,7 @@ typedef void (*_Unwind_Exception_Cleanup struct _Unwind_Exception *); typedef _Unwind_Reason_Code (*_Unwind_Stop_Fn) (int, _Unwind_Action, - unsigned long, + __int64_t, struct _Unwind_Exception *, struct _Unwind_Context *, void *); From owner-svn-src-head@FreeBSD.ORG Thu Sep 30 03:46:22 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 30855106564A; Thu, 30 Sep 2010 03:46:22 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail03.syd.optusnet.com.au (mail03.syd.optusnet.com.au [211.29.132.184]) by mx1.freebsd.org (Postfix) with ESMTP id BBEA98FC0A; Thu, 30 Sep 2010 03:46:21 +0000 (UTC) Received: from c122-107-116-249.carlnfd1.nsw.optusnet.com.au (c122-107-116-249.carlnfd1.nsw.optusnet.com.au [122.107.116.249]) by mail03.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id o8U3kHDN023257 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 30 Sep 2010 13:46:18 +1000 Date: Thu, 30 Sep 2010 13:46:17 +1000 (EST) From: Bruce Evans X-X-Sender: bde@delplex.bde.org To: Jung-uk Kim In-Reply-To: <201009291812.26796.jkim@FreeBSD.org> Message-ID: <20100930125731.B2324@delplex.bde.org> References: <201009292120.o8TLKTSf022159@svn.freebsd.org> <201009291812.26796.jkim@FreeBSD.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Dimitry Andric Subject: Re: svn commit: r213281 - head/lib/libc/amd64/gen X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Sep 2010 03:46:22 -0000 On Wed, 29 Sep 2010, Jung-uk Kim wrote: > On Wednesday 29 September 2010 05:20 pm, Dimitry Andric wrote: >> Log: >> Apply the same workaround for clang to amd64's version of ldexp.c >> (as in r212976): order the incoming arguments to fscale as st(0), >> st(1), and mark temp2 volatile (only in case of compilation with >> clang) to force clang to pop it correctly. No binary change when >> compiled with gcc. > > Actually the binary slightly changes when compiled with gcc: > > %diff -u ldexp-r1.14.c ldexp-r1.15.c > --- ldexp-r1.14.c 2010-09-29 17:44:45.000000000 -0400 > +++ ldexp-r1.15.c 2010-09-29 17:45:10.000000000 -0400 > @@ -34,7 +34,9 @@ > static char sccsid[] = "@(#)ldexp.c 8.1 (Berkeley) 6/4/93"; > #endif /* LIBC_SCCS and not lint */ > #include > -__FBSDID("$FreeBSD: src/lib/libc/amd64/gen/ldexp.c,v 1.14 2007/01/09 00:38:24 imp Exp $"); > +__FBSDID("$FreeBSD: src/lib/libc/amd64/gen/ldexp.c,v 1.15 2010/09/29 21:20:29 dim Exp $"); > ... > With -O1 and above, the FXCH completely disappears from the old > version by rearranging stack operations, which is even more > interesting. > > Don't get me wrong, both work fine. FYI, verified with this: This file probably shouldn't exist, especially on amd64. There are 4 or 5 versions of ldexp(), and this file implements what seems to be the worst one, even without the bug. First, it shouldn't exist since it is a libm function. It exists for the historical reason that its object file has always been in libc. This causes organizational problems. The second version is in fdlibm. This wasn't imported into FreeBSD. It calls scalbn() after checking some cases. I think it shouldn't check anything. In FreeBSD it could be a weak alias to scalbn(). The third version is in fdlibm. This one is named scalbn(). FreeBSD has it. FreeBSD aliases ldexpl() to scalbn() iff long doubles are the same as doubles. FreeBSD also has scalbnf(). This came from NetBSD/Cygnus's extension of fdlibm. FreeBSD aliases ldexpf() to scalbnf() (or is it the other way?). The fourth version is in the FreeBSD arch-dependent directories of lib/msun for at least amd64 and i386. These are also named scalbn(). These aren't in fdlibm, but came from NetBSD. These are written in non-inline asm and are similar to the ones in libc. They are a couple of instructions shorter, due to never using a frame pointer (unless profiling) and avoiding an fxch or two. They aren't aliased to aything, and don't have float versions. The fifth version, which might not exist, is gcc's builtin. I think it doesn't really exist, but gcc says it has a builtin ldexp() and I had to fight with this to test this. gcc normally made the dubious optimization of moving ldexp() out of a test loop. But ldexp() has side effects. Testing indicates that the fdlibm C version is 2.5 times faster than the asm versions on amd64 on a core2 (ref9), while on i386 the C version is only 1.5 times faster. The C code is a bit larger so benefits more from being called from a loop. The asm code uses a slow i387 instruction, and on i387 it hhs to do expensive moves from xmm registers to i387 ones and back. Times for 100 million calls: amd64 libc ldexp: 3.18 seconds amd64 libm asm scalbn: 2.96 amd64 libm C scalbn: 1.30 i386 libc ldexp: 3.13 i386 libm asm scalbn: 2.86 i386 libm C scalbn: 2.11 All compiled with -O -static -fno-unit-at-a-time. The test loop was % double d, rv; % % rv = 0; % for (d = 0; d < 100000000; d++) % rv += X(d, 3); where X = ldexp or scalbn. gcc now optimizes away loops like this too much. I checked that it was called 100 million times in most cases. Bruce From owner-svn-src-head@FreeBSD.ORG Thu Sep 30 06:33:56 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3833F106564A for ; Thu, 30 Sep 2010 06:33:56 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from mail2.fluidhosting.com (mx21.fluidhosting.com [204.14.89.4]) by mx1.freebsd.org (Postfix) with ESMTP id D6D0D8FC0A for ; Thu, 30 Sep 2010 06:33:55 +0000 (UTC) Received: (qmail 21903 invoked by uid 399); 30 Sep 2010 06:33:54 -0000 Received: from localhost (HELO ?192.168.0.142?) (dougb@dougbarton.us@127.0.0.1) by localhost with ESMTPAM; 30 Sep 2010 06:33:54 -0000 X-Originating-IP: 127.0.0.1 X-Sender: dougb@dougbarton.us Message-ID: <4CA42F56.4070604@FreeBSD.org> Date: Wed, 29 Sep 2010 23:33:58 -0700 From: Doug Barton Organization: http://SupersetSolutions.com/ User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.9) Gecko/20100915 Thunderbird/3.1.4 MIME-Version: 1.0 To: Ed Maste References: <201009291308.o8TD8NHo009975@svn.freebsd.org> In-Reply-To: <201009291308.o8TD8NHo009975@svn.freebsd.org> X-Enigmail-Version: 1.2a1pre OpenPGP: id=1A1ABC84 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r213270 - head/etc/rc.d X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Sep 2010 06:33:56 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 On 9/29/2010 6:08 AM, Ed Maste wrote: | Author: emaste | Date: Wed Sep 29 13:08:23 2010 | New Revision: 213270 | URL: http://svn.freebsd.org/changeset/base/213270 | | Log: | /etc/rc.d/defaultroute currently bails immediately if all interfaces | set to use DHCP have no carrier. This can cause grief as it may take | some time for link to be established, and defaultroute may terminate | before this happens. | | Introduce a defaultroute_carrier_delay variable and then wait that long | in defaultroute before bailing if no interfaces have carrier. With the | default settings defaultroute will wait for five seconds for this, and | the original 30 second wait for a default route to appear is unchanged. | Note that there is in discussion an alternative approach to the broader | problem of waiting for DHCP-configured routes. However, this change | addresses a real problem in the current defaultroute script. | | Discussed on: freebsd-rc@ Ed, I'm always excited to see people take an interest in rc.d, especially when they post stuff for review. When I posted this message: http://docs.freebsd.org/cgi/getmsg.cgi?fetch=17533+0+current/freebsd-rc it was intended to be a request for you to review Jeremy's more generic solution to see if it was suitable for your needs, and correspondingly a request to hold off committing your solution until that question was answered. I apologize if I wasn't clear about that. While I think your approach here is creative, I'd rather see a more generic solution to the "system needs network connectivity before proceeding past point X" problem. Could you please back this (and your related changes) out, and evaluate Jeremy's script? I, and other users have evaluated it for some time now and found it effective; and I'd like to see it committed, especially now that Jeremy has updated it. Thanks, Doug - -- ... and that's just a little bit of history repeating. -- Propellerheads Improve the effectiveness of your Internet presence with a domain name makeover! http://SupersetSolutions.com/ -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (MingW32) iQEcBAEBCAAGBQJMpC9WAAoJEFzGhvEaGryEZi4H/3eojCGkfCvrWv79gr8H/cBH MwSVzDJvKiNakXk8/+BW2qoT0B+TWELSZ3VYt5s0pvJIUV6/0IjchEn8V8keCJUv 6gIYUgfeiLi6Ie9CtsF2igRAT8ZTVifJfCCUf4UI6wE7n7r6dAUmotloBhqREhn+ BU4C35653wNAsbs1QVw9GQWbPCbBNpikxXLExj/Xo5o0rh2VsKxF6BfVuUUwFrjp QB5eQsEVk+68QFAzSwNEcXfW9882BnioTg7+vAZaUf5tzjseSiLB8EwuLf8dM3Ic EG23/QZInRiT4Atx8UKRPqhiMeLvdnDQjue0bKRIibCh9Zt83OT03Mkhzx9JRwQ= =2XcL -----END PGP SIGNATURE----- From owner-svn-src-head@FreeBSD.ORG Thu Sep 30 07:12:09 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E3137106564A; Thu, 30 Sep 2010 07:12:09 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D28C08FC13; Thu, 30 Sep 2010 07:12: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 o8U7C96O056181; Thu, 30 Sep 2010 07:12:09 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8U7C9em056179; Thu, 30 Sep 2010 07:12:09 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <201009300712.o8U7C9em056179@svn.freebsd.org> From: Rui Paulo Date: Thu, 30 Sep 2010 07:12:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213294 - head/gnu/usr.bin/binutils/libbfd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Sep 2010 07:12:10 -0000 Author: rpaulo Date: Thu Sep 30 07:12:09 2010 New Revision: 213294 URL: http://svn.freebsd.org/changeset/base/213294 Log: Remove target peigen.c so that make doesn't warn us about it. Modified: head/gnu/usr.bin/binutils/libbfd/Makefile.amd64 Modified: head/gnu/usr.bin/binutils/libbfd/Makefile.amd64 ============================================================================== --- head/gnu/usr.bin/binutils/libbfd/Makefile.amd64 Thu Sep 30 04:23:03 2010 (r213293) +++ head/gnu/usr.bin/binutils/libbfd/Makefile.amd64 Thu Sep 30 07:12:09 2010 (r213294) @@ -31,5 +31,3 @@ elf64-amd64-fbsd.c: ${.CURDIR}/elf-fbsd- pepigen.c: peXXigen.c sed -e s/XX/pep/g ${.ALLSRC} > ${.TARGET} -peigen.c: peXXigen.c - sed -e s/XX/pe/g ${.ALLSRC} > ${.TARGET} From owner-svn-src-head@FreeBSD.ORG Thu Sep 30 12:59:57 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 009181065670; Thu, 30 Sep 2010 12:59:57 +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 CA1688FC16; Thu, 30 Sep 2010 12:59: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 o8UCxuHK069899; Thu, 30 Sep 2010 12:59:56 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8UCxuWv069896; Thu, 30 Sep 2010 12:59:56 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201009301259.o8UCxuWv069896@svn.freebsd.org> From: David Xu Date: Thu, 30 Sep 2010 12:59:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213297 - head/lib/libthr/thread X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Sep 2010 12:59:57 -0000 Author: davidxu Date: Thu Sep 30 12:59:56 2010 New Revision: 213297 URL: http://svn.freebsd.org/changeset/base/213297 Log: change code to use unwind.h. Modified: head/lib/libthr/thread/thr_exit.c head/lib/libthr/thread/thr_private.h Modified: head/lib/libthr/thread/thr_exit.c ============================================================================== --- head/lib/libthr/thread/thr_exit.c Thu Sep 30 11:43:54 2010 (r213296) +++ head/lib/libthr/thread/thr_exit.c Thu Sep 30 12:59:56 2010 (r213297) @@ -58,13 +58,13 @@ static void thread_unwind(void) __dead2; static void thread_uw_init(void); static _Unwind_Reason_Code thread_unwind_stop(int version, _Unwind_Action actions, - _Unwind_Exception_Class exc_class, + int64_t exc_class, struct _Unwind_Exception *exc_obj, struct _Unwind_Context *context, void *stop_parameter); /* unwind library pointers */ static _Unwind_Reason_Code (*uwl_forcedunwind)(struct _Unwind_Exception *, _Unwind_Stop_Fn, void *); -static _Unwind_Word (*uwl_getcfa)(struct _Unwind_Context *); +static unsigned long (*uwl_getcfa)(struct _Unwind_Context *); static void thread_uw_init(void) @@ -106,7 +106,7 @@ _Unwind_ForcedUnwind(struct _Unwind_Exce return (*uwl_forcedunwind)(ex, stop_func, stop_arg); } -_Unwind_Word +unsigned long _Unwind_GetCFA(struct _Unwind_Context *context) { return (*uwl_getcfa)(context); @@ -129,7 +129,7 @@ thread_unwind_cleanup(_Unwind_Reason_Cod static _Unwind_Reason_Code thread_unwind_stop(int version, _Unwind_Action actions, - _Unwind_Exception_Class exc_class, + int64_t exc_class, struct _Unwind_Exception *exc_obj, struct _Unwind_Context *context, void *stop_parameter) { Modified: head/lib/libthr/thread/thr_private.h ============================================================================== --- head/lib/libthr/thread/thr_private.h Thu Sep 30 11:43:54 2010 (r213296) +++ head/lib/libthr/thread/thr_private.h Thu Sep 30 12:59:56 2010 (r213297) @@ -71,7 +71,8 @@ #include "thread_db.h" #ifdef _PTHREAD_FORCED_UNWIND -#include +#define _BSD_SOURCE +#include #endif typedef TAILQ_HEAD(pthreadlist, pthread) pthreadlist; From owner-svn-src-head@FreeBSD.ORG Thu Sep 30 13:08:13 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A6A441065679; Thu, 30 Sep 2010 13:08:13 +0000 (UTC) (envelope-from emaste@freebsd.org) Received: from mail1.sandvine.com (Mail1.sandvine.com [64.7.137.134]) by mx1.freebsd.org (Postfix) with ESMTP id 62A7B8FC0C; Thu, 30 Sep 2010 13:08:13 +0000 (UTC) Received: from labgw2.phaedrus.sandvine.com (192.168.222.22) by WTL-EXCH-1.sandvine.com (192.168.196.31) with Microsoft SMTP Server id 14.0.694.0; Thu, 30 Sep 2010 09:08:02 -0400 Received: by labgw2.phaedrus.sandvine.com (Postfix, from userid 10332) id 9C93733C00; Thu, 30 Sep 2010 09:08:12 -0400 (EDT) Date: Thu, 30 Sep 2010 09:08:12 -0400 From: Ed Maste To: Doug Barton Message-ID: <20100930130812.GA79354@sandvine.com> References: <201009291308.o8TD8NHo009975@svn.freebsd.org> <4CA42F56.4070604@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <4CA42F56.4070604@FreeBSD.org> User-Agent: Mutt/1.4.2.1i Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r213270 - head/etc/rc.d X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Sep 2010 13:08:13 -0000 On Wed, Sep 29, 2010 at 11:33:58PM -0700, Doug Barton wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA256 > > On 9/29/2010 6:08 AM, Ed Maste wrote: > | Author: emaste > | Date: Wed Sep 29 13:08:23 2010 > | New Revision: 213270 > | URL: http://svn.freebsd.org/changeset/base/213270 ... > Could you please back this (and your related changes) out, and evaluate > Jeremy's script? I, and other users have evaluated it for some time now > and found it effective; and I'd like to see it committed, especially now > that Jeremy has updated it. Backing this out doesn't improve anything, so I'm not going to do that. This change is an improvement to what's in the tree today, and the original author of this script agreed with the approach. I will review Jeremy's script as time permits; if it is a viable replacement for defaultroute then we can just replace defaultroute with it, and my change can then end up in /dev/null. -Ed From owner-svn-src-head@FreeBSD.ORG Thu Sep 30 13:31:36 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 24C44106566B; Thu, 30 Sep 2010 13:31:36 +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 14D218FC17; Thu, 30 Sep 2010 13:31: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 o8UDVZ7d070806; Thu, 30 Sep 2010 13:31:35 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8UDVZC0070804; Thu, 30 Sep 2010 13:31:35 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201009301331.o8UDVZC0070804@svn.freebsd.org> From: Jaakko Heinonen Date: Thu, 30 Sep 2010 13:31:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213298 - head/sbin/mount X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Sep 2010 13:31:36 -0000 Author: jh Date: Thu Sep 30 13:31:35 2010 New Revision: 213298 URL: http://svn.freebsd.org/changeset/base/213298 Log: Fix printing of the "rw" mount option in fstab(5) format (-p option). fstab(5) format requires that one of "rw", "rq" or "ro" is always specified. PR: bin/123021 Reviewed by: keramida, rodrigc MFC after: 2 weeks Modified: head/sbin/mount/mount.c Modified: head/sbin/mount/mount.c ============================================================================== --- head/sbin/mount/mount.c Thu Sep 30 12:59:56 2010 (r213297) +++ head/sbin/mount/mount.c Thu Sep 30 13:31:35 2010 (r213298) @@ -850,10 +850,18 @@ void putfsent(struct statfs *ent) { struct fstab *fst; - char *opts; + char *opts, *rw; int l; + opts = NULL; + /* flags2opts() doesn't return the "rw" option. */ + if ((ent->f_flags & MNT_RDONLY) != 0) + rw = NULL; + else + rw = catopt(NULL, "rw"); + opts = flags2opts(ent->f_flags); + opts = catopt(rw, opts); if (strncmp(ent->f_mntfromname, "", 7) == 0 || strncmp(ent->f_mntfromname, "", 7) == 0) { @@ -861,10 +869,6 @@ putfsent(struct statfs *ent) +1)); } - /* - * "rw" is not a real mount option; this is why we print NULL as "rw" - * if opts is still NULL here. - */ l = strlen(ent->f_mntfromname); printf("%s%s%s%s", ent->f_mntfromname, l < 8 ? "\t" : "", @@ -876,13 +880,9 @@ putfsent(struct statfs *ent) l < 16 ? "\t" : "", l < 24 ? "\t" : " "); printf("%s\t", ent->f_fstypename); - if (opts == NULL) { - printf("%s\t", "rw"); - } else { - l = strlen(opts); - printf("%s%s", opts, - l < 8 ? "\t" : " "); - } + l = strlen(opts); + printf("%s%s", opts, + l < 8 ? "\t" : " "); free(opts); if ((fst = getfsspec(ent->f_mntfromname))) From owner-svn-src-head@FreeBSD.ORG Thu Sep 30 14:17:14 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 72008106564A; Thu, 30 Sep 2010 14:17:14 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (cl-327.ede-01.nl.sixxs.net [IPv6:2001:7b8:2ff:146::2]) by mx1.freebsd.org (Postfix) with ESMTP id 018D18FC13; Thu, 30 Sep 2010 14:17:14 +0000 (UTC) Received: from [IPv6:2001:7b8:3a7:0:f59a:54a5:56c:5c84] (unknown [IPv6:2001:7b8:3a7:0:f59a:54a5:56c:5c84]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id 22C095C43; Thu, 30 Sep 2010 16:17:12 +0200 (CEST) Message-ID: <4CA49BE9.8040602@FreeBSD.org> Date: Thu, 30 Sep 2010 16:17:13 +0200 From: Dimitry Andric Organization: The FreeBSD Project User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9.2.11pre) Gecko/20100929 Lanikai/3.1.5pre MIME-Version: 1.0 To: Bruce Evans References: <201009292120.o8TLKTSf022159@svn.freebsd.org> <201009291812.26796.jkim@FreeBSD.org> <20100930125731.B2324@delplex.bde.org> In-Reply-To: <20100930125731.B2324@delplex.bde.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Jung-uk Kim Subject: Re: svn commit: r213281 - head/lib/libc/amd64/gen X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Sep 2010 14:17:14 -0000 On 2010-09-30 05:46, Bruce Evans wrote: ... > This file probably shouldn't exist, especially on amd64. There are 4 or 5 > versions of ldexp(), and this file implements what seems to be the worst > one, even without the bug. > > First, it shouldn't exist since it is a libm function. It exists for the > historical reason that its object file has always been in libc. This > causes organizational problems. It also makes it impossible to throw it out of libc, as there are many applications that expect it in there. Luckily, it seems to be only ldexp for which this is the case, not ldexpl or ldexpf. :) > The second version is in fdlibm. This wasn't imported into FreeBSD. It > calls scalbn() after checking some cases. I think it shouldn't check > anything. In FreeBSD it could be a weak alias to scalbn(). > > The third version is in fdlibm. This one is named scalbn(). FreeBSD has > it. FreeBSD aliases ldexpl() to scalbn() iff long doubles are the same as > doubles. FreeBSD also has scalbnf(). This came from NetBSD/Cygnus's > extension of fdlibm. FreeBSD aliases ldexpf() to scalbnf() (or is it > the other way?). We alias scalbnf() to ldexpf(), apparently. > The fourth version is in the FreeBSD arch-dependent directories of > lib/msun for at least amd64 and i386. These are also named scalbn(). > These aren't in fdlibm, but came from NetBSD. These are written in > non-inline asm and are similar to the ones in libc. They are a couple > of instructions shorter, due to never using a frame pointer (unless > profiling) and avoiding an fxch or two. They aren't aliased to aything, > and don't have float versions. > > The fifth version, which might not exist, is gcc's builtin. I think it > doesn't really exist, but gcc says it has a builtin ldexp() and I had to > fight with this to test this. gcc normally made the dubious optimization > of moving ldexp() out of a test loop. But ldexp() has side effects. The version in libc/gen/ldexp.c is just a copy of msun/src/s_scalbn.c, with some things like copysign() directly pasted in. It even has: /* @(#)fdlibm.h 5.1 93/09/24 */ at the top. > Testing indicates that the fdlibm C version is 2.5 times faster than the > asm versions on amd64 on a core2 (ref9), while on i386 the C version is > only 1.5 times faster. The C code is a bit larger so benefits more from > being called from a loop. The asm code uses a slow i387 instruction, and > on i387 it hhs to do expensive moves from xmm registers to i387 ones and > back. > > Times for 100 million calls: > > amd64 libc ldexp: 3.18 seconds > amd64 libm asm scalbn: 2.96 > amd64 libm C scalbn: 1.30 > i386 libc ldexp: 3.13 > i386 libm asm scalbn: 2.86 > i386 libm C scalbn: 2.11 Seeing these results, I propose to just delete lib/libc/amd64/gen/ldexp.c and lib/libc/i386/gen/ldexp.c, which will cause the amd64 and i386 builds to automatically pick up lib/libc/gen/ldexp.c instead, which effectively is the fdlibm implementation. (And no more clang workarounds needed. :) From owner-svn-src-head@FreeBSD.ORG Thu Sep 30 14:28:49 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F41FB1065673; Thu, 30 Sep 2010 14:28:48 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E45218FC08; Thu, 30 Sep 2010 14:28:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8UESmId072159; Thu, 30 Sep 2010 14:28:48 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8UESmXK072157; Thu, 30 Sep 2010 14:28:48 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201009301428.o8UESmXK072157@svn.freebsd.org> From: John Baldwin Date: Thu, 30 Sep 2010 14:28:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213300 - head/usr.bin/csup X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Sep 2010 14:28:49 -0000 Author: jhb Date: Thu Sep 30 14:28:48 2010 New Revision: 213300 URL: http://svn.freebsd.org/changeset/base/213300 Log: If an RCS file is truncated, rcsfile_getdelta() will return NULL. Instead of faulting, check for NULL. However, returning an error would cause csup to just abort the entire update. Instead, break out of the loop and return ok. The attempts to update the file will trigger a MD5 failure which will cause csup to download the entire file as a fixup. Reviewed by: lulf MFC after: 1 week Modified: head/usr.bin/csup/rcsparse.c Modified: head/usr.bin/csup/rcsparse.c ============================================================================== --- head/usr.bin/csup/rcsparse.c Thu Sep 30 13:44:55 2010 (r213299) +++ head/usr.bin/csup/rcsparse.c Thu Sep 30 14:28:48 2010 (r213300) @@ -318,6 +318,14 @@ parse_deltatexts(struct rcsfile *rf, yys d = rcsfile_getdelta(rf, revnum); free(revnum); + /* + * XXX: The RCS file is corrupt, but lie and say it is ok. + * If it is actually broken, then the MD5 mismatch will + * trigger a fixup. + */ + if (d == NULL) + return (0); + /* log string */ asserttoken(sp, KEYWORD); asserttoken(sp, STRING); From owner-svn-src-head@FreeBSD.ORG Thu Sep 30 16:09:52 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A0F281065694; Thu, 30 Sep 2010 16:09:52 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 913CB8FC16; Thu, 30 Sep 2010 16:09: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 o8UG9qCi074291; Thu, 30 Sep 2010 16:09:52 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8UG9qfr074289; Thu, 30 Sep 2010 16:09:52 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201009301609.o8UG9qfr074289@svn.freebsd.org> From: Alexander Motin Date: Thu, 30 Sep 2010 16:09:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213301 - head/sys/dev/ata/chipsets X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Sep 2010 16:09:52 -0000 Author: mav Date: Thu Sep 30 16:09:52 2010 New Revision: 213301 URL: http://svn.freebsd.org/changeset/base/213301 Log: Revert r132291. Restore setting PIO/WDMA timings for VIA UDMA133 controllers. Linux disables only AST register writing there, but no all timings. Modified: head/sys/dev/ata/chipsets/ata-via.c Modified: head/sys/dev/ata/chipsets/ata-via.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-via.c Thu Sep 30 14:28:48 2010 (r213300) +++ head/sys/dev/ata/chipsets/ata-via.c Thu Sep 30 16:09:52 2010 (r213301) @@ -352,8 +352,7 @@ ata_via_old_setmode(device_t dev, int ta piomode = mode; } /* Set WDMA/PIO timings */ - if (ctlr->chip->cfg1 != VIA133) - pci_write_config(parent, reg - 0x08,timings[ata_mode2idx(piomode)], 1); + pci_write_config(parent, reg - 0x08,timings[ata_mode2idx(piomode)], 1); return (mode); } From owner-svn-src-head@FreeBSD.ORG Thu Sep 30 16:23:01 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B3827106566B; Thu, 30 Sep 2010 16:23:01 +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 A40C08FC12; Thu, 30 Sep 2010 16:23: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 o8UGN1Eh074635; Thu, 30 Sep 2010 16:23:01 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8UGN1Zu074633; Thu, 30 Sep 2010 16:23:01 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201009301623.o8UGN1Zu074633@svn.freebsd.org> From: Alexander Motin Date: Thu, 30 Sep 2010 16:23:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213302 - head/sys/dev/acpica X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Sep 2010 16:23:01 -0000 Author: mav Date: Thu Sep 30 16:23:01 2010 New Revision: 213302 URL: http://svn.freebsd.org/changeset/base/213302 Log: Do not use regular interrupts on NVidia HPETs. NVidia MCP5x chipsets have number of unexplained interrupt problems. For some reason, using HPET interrupts there breaks HDA sound. Legacy route mode interrupts reported to work fine there. Modified: head/sys/dev/acpica/acpi_hpet.c Modified: head/sys/dev/acpica/acpi_hpet.c ============================================================================== --- head/sys/dev/acpica/acpi_hpet.c Thu Sep 30 16:09:52 2010 (r213301) +++ head/sys/dev/acpica/acpi_hpet.c Thu Sep 30 16:23:01 2010 (r213302) @@ -58,6 +58,7 @@ __FBSDID("$FreeBSD$"); #define HPET_VENDID_AMD 0x4353 #define HPET_VENDID_INTEL 0x8086 +#define HPET_VENDID_NVIDIA 0x10de ACPI_SERIAL_DECL(hpet, "ACPI HPET support"); @@ -492,6 +493,12 @@ hpet_attach(device_t dev) if (vendor == HPET_VENDID_AMD) sc->allowed_irqs = 0x00000000; /* + * NVidia MCP5x chipsets have number of unexplained interrupt + * problems. For some reason, using HPET interrupts breaks HDA sound. + */ + if (vendor == HPET_VENDID_NVIDIA && rev <= 0x01) + sc->allowed_irqs = 0x00000000; + /* * Neither QEMU nor VirtualBox report supported IRQs correctly. * The only way to use HPET there is to specify IRQs manually * and/or use legacy_route. Legacy_route mode work on both. From owner-svn-src-head@FreeBSD.ORG Thu Sep 30 16:45:27 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 67553106564A; Thu, 30 Sep 2010 16:45:27 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 580978FC14; Thu, 30 Sep 2010 16:45: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 o8UGjRa1075176; Thu, 30 Sep 2010 16:45:27 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8UGjRmo075174; Thu, 30 Sep 2010 16:45:27 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201009301645.o8UGjRmo075174@svn.freebsd.org> From: Andriy Gapon Date: Thu, 30 Sep 2010 16:45:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213303 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Sep 2010 16:45:27 -0000 Author: avg Date: Thu Sep 30 16:45:27 2010 New Revision: 213303 URL: http://svn.freebsd.org/changeset/base/213303 Log: kmem_size* sysctls: hint that these are also tunables MFC after: 1 week Modified: head/sys/kern/kern_malloc.c Modified: head/sys/kern/kern_malloc.c ============================================================================== --- head/sys/kern/kern_malloc.c Thu Sep 30 16:23:01 2010 (r213302) +++ head/sys/kern/kern_malloc.c Thu Sep 30 16:45:27 2010 (r213303) @@ -187,19 +187,19 @@ struct { static uma_zone_t mt_zone; u_long vm_kmem_size; -SYSCTL_ULONG(_vm, OID_AUTO, kmem_size, CTLFLAG_RD, &vm_kmem_size, 0, +SYSCTL_ULONG(_vm, OID_AUTO, kmem_size, CTLFLAG_RDTUN, &vm_kmem_size, 0, "Size of kernel memory"); static u_long vm_kmem_size_min; -SYSCTL_ULONG(_vm, OID_AUTO, kmem_size_min, CTLFLAG_RD, &vm_kmem_size_min, 0, +SYSCTL_ULONG(_vm, OID_AUTO, kmem_size_min, CTLFLAG_RDTUN, &vm_kmem_size_min, 0, "Minimum size of kernel memory"); static u_long vm_kmem_size_max; -SYSCTL_ULONG(_vm, OID_AUTO, kmem_size_max, CTLFLAG_RD, &vm_kmem_size_max, 0, +SYSCTL_ULONG(_vm, OID_AUTO, kmem_size_max, CTLFLAG_RDTUN, &vm_kmem_size_max, 0, "Maximum size of kernel memory"); static u_int vm_kmem_size_scale; -SYSCTL_UINT(_vm, OID_AUTO, kmem_size_scale, CTLFLAG_RD, &vm_kmem_size_scale, 0, +SYSCTL_UINT(_vm, OID_AUTO, kmem_size_scale, CTLFLAG_RDTUN, &vm_kmem_size_scale, 0, "Scale factor for kernel memory size"); /* From owner-svn-src-head@FreeBSD.ORG Thu Sep 30 16:47:02 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 12C1A1065679; Thu, 30 Sep 2010 16:47:02 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 03CE08FC1C; Thu, 30 Sep 2010 16:47: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 o8UGl185075248; Thu, 30 Sep 2010 16:47:01 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8UGl1rN075246; Thu, 30 Sep 2010 16:47:01 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201009301647.o8UGl1rN075246@svn.freebsd.org> From: Andriy Gapon Date: Thu, 30 Sep 2010 16:47:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213304 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Sep 2010 16:47:02 -0000 Author: avg Date: Thu Sep 30 16:47:01 2010 New Revision: 213304 URL: http://svn.freebsd.org/changeset/base/213304 Log: debug.kdb.stop_cpus sysctl: hint that this is also a tunable MFC after: 1 week Modified: head/sys/kern/subr_kdb.c Modified: head/sys/kern/subr_kdb.c ============================================================================== --- head/sys/kern/subr_kdb.c Thu Sep 30 16:45:27 2010 (r213303) +++ head/sys/kern/subr_kdb.c Thu Sep 30 16:47:01 2010 (r213304) @@ -95,7 +95,7 @@ SYSCTL_PROC(_debug_kdb, OID_AUTO, trap_c */ #ifdef SMP static int kdb_stop_cpus = 1; -SYSCTL_INT(_debug_kdb, OID_AUTO, stop_cpus, CTLTYPE_INT | CTLFLAG_RW, +SYSCTL_INT(_debug_kdb, OID_AUTO, stop_cpus, CTLFLAG_RW | CTLFLAG_TUN, &kdb_stop_cpus, 0, "stop other CPUs when entering the debugger"); TUNABLE_INT("debug.kdb.stop_cpus", &kdb_stop_cpus); #endif From owner-svn-src-head@FreeBSD.ORG Thu Sep 30 17:05:23 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C3B65106566C; Thu, 30 Sep 2010 17:05:23 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 625AE8FC0A; Thu, 30 Sep 2010 17:05:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8UH5N9P075718; Thu, 30 Sep 2010 17:05:23 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8UH5Nmm075714; Thu, 30 Sep 2010 17:05:23 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201009301705.o8UH5Nmm075714@svn.freebsd.org> From: Andriy Gapon Date: Thu, 30 Sep 2010 17:05:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213305 - in head/sys: gdb kern sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Sep 2010 17:05:23 -0000 Author: avg Date: Thu Sep 30 17:05:23 2010 New Revision: 213305 URL: http://svn.freebsd.org/changeset/base/213305 Log: there must be only one SYSINIT with SI_SUB_RUN_SCHEDULER+SI_ORDER_ANY order SI_SUB_RUN_SCHEDULER+SI_ORDER_ANY should only be used to call scheduler() function which turns the initial thread into swapper proper and thus there is no further SYSINIT processing. Other SYSINITs with SI_SUB_RUN_SCHEDULER+SI_ORDER_ANY may get ordered after scheduler() and thus never executed. That particular relative order is semi-arbitrary. Thus, change such places to use SI_ORDER_MIDDLE. Also, use SI_ORDER_MIDDLE instead of correct, but less appealing, SI_ORDER_ANY - 1. MFC after: 1 week Modified: head/sys/gdb/gdb_cons.c head/sys/kern/kern_ntptime.c head/sys/sys/sched.h Modified: head/sys/gdb/gdb_cons.c ============================================================================== --- head/sys/gdb/gdb_cons.c Thu Sep 30 16:47:01 2010 (r213304) +++ head/sys/gdb/gdb_cons.c Thu Sep 30 17:05:23 2010 (r213305) @@ -126,7 +126,7 @@ oktousecallout(void *data __unused) { calloutok = 1; } -SYSINIT(gdbhack, SI_SUB_RUN_SCHEDULER, SI_ORDER_ANY, oktousecallout, NULL); +SYSINIT(gdbhack, SI_SUB_RUN_SCHEDULER, SI_ORDER_MIDDLE, oktousecallout, NULL); static void gdb_cnputc(struct consdev *cp, int c) Modified: head/sys/kern/kern_ntptime.c ============================================================================== --- head/sys/kern/kern_ntptime.c Thu Sep 30 16:47:01 2010 (r213304) +++ head/sys/kern/kern_ntptime.c Thu Sep 30 17:05:23 2010 (r213305) @@ -1035,5 +1035,5 @@ start_periodic_resettodr(void *arg __unu periodic_resettodr, NULL); } -SYSINIT(periodic_resettodr, SI_SUB_RUN_SCHEDULER, SI_ORDER_ANY - 1, +SYSINIT(periodic_resettodr, SI_SUB_RUN_SCHEDULER, SI_ORDER_MIDDLE, start_periodic_resettodr, NULL); Modified: head/sys/sys/sched.h ============================================================================== --- head/sys/sys/sched.h Thu Sep 30 16:47:01 2010 (r213304) +++ head/sys/sys/sched.h Thu Sep 30 17:05:23 2010 (r213305) @@ -173,7 +173,7 @@ static void name ## _add_proc(void *dumm #name, CTLTYPE_LONG|CTLFLAG_RD|CTLFLAG_MPSAFE, \ ptr, 0, sysctl_dpcpu_long, "LU", descr); \ } \ -SYSINIT(name, SI_SUB_RUN_SCHEDULER, SI_ORDER_ANY, name ## _add_proc, NULL); +SYSINIT(name, SI_SUB_RUN_SCHEDULER, SI_ORDER_MIDDLE, name ## _add_proc, NULL); #define SCHED_STAT_DEFINE(name, descr) \ DPCPU_DEFINE(unsigned long, name); \ From owner-svn-src-head@FreeBSD.ORG Thu Sep 30 17:18:45 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 381A810656A9; Thu, 30 Sep 2010 17:18:45 +0000 (UTC) (envelope-from mdf356@gmail.com) Received: from mail-iw0-f182.google.com (mail-iw0-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id C8F1E8FC1A; Thu, 30 Sep 2010 17:18:39 +0000 (UTC) Received: by iwn34 with SMTP id 34so3306298iwn.13 for ; Thu, 30 Sep 2010 10:18:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=qZ9oLxZJIpWWm6SzKkPnt9l2M5VAiRWgY88MorlzW0M=; b=BGZ8Iek94xCxAlTv6E+yaaGcm/AZqCteqqh+xxJLC56PuH1A/Bq6Bpw1ZMSqVbCase Q0ehebUn9rrmMaPrJToeBTC0sk+C+NXh0DGW8H16nDNr0vnahGjRpdavjzF/IQj223l4 iQqiip3TB3qr2lYIpk+CX3STSFPo4tdold75k= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=pQykhtqhmzv3JN5rI1qbUrCbPk67FS0r6v+DRP39c1F5JMQDn0WGDX+Ye7D7bBhRQt Vmo9DMNlQL9QOKv7Y/pXlrrOpxv11uB4mwBfFK53oQYuWQCCxM6c/i4B9ZS1ckeauWTy c6hQDCZY5IuKwB5GXRUN4WiQw7prSrKxDM5W4= MIME-Version: 1.0 Received: by 10.231.170.208 with SMTP id e16mr4091295ibz.44.1285867113339; Thu, 30 Sep 2010 10:18:33 -0700 (PDT) Sender: mdf356@gmail.com Received: by 10.231.167.140 with HTTP; Thu, 30 Sep 2010 10:18:33 -0700 (PDT) In-Reply-To: <201009301705.o8UH5Nmm075714@svn.freebsd.org> References: <201009301705.o8UH5Nmm075714@svn.freebsd.org> Date: Thu, 30 Sep 2010 10:18:33 -0700 X-Google-Sender-Auth: U1UCLUz8PEW4KqUr9DkrKb5RQhQ Message-ID: From: mdf@FreeBSD.org To: Andriy Gapon Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r213305 - in head/sys: gdb kern sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Sep 2010 17:18:45 -0000 On Thu, Sep 30, 2010 at 10:05 AM, Andriy Gapon wrote: > Author: avg > Date: Thu Sep 30 17:05:23 2010 > New Revision: 213305 > URL: http://svn.freebsd.org/changeset/base/213305 > > Log: > =A0there must be only one SYSINIT with SI_SUB_RUN_SCHEDULER+SI_ORDER_ANY = order > > =A0SI_SUB_RUN_SCHEDULER+SI_ORDER_ANY should only be used to call > =A0scheduler() function which turns the initial thread into swapper prope= r > =A0and thus there is no further SYSINIT processing. Does this imply that scheduler() shouldn't be called from a sysinit at all, and instead a hand-call after processing all the boot-time sysinit's would make more sense? This prevents the bug from reoccuring, and also prevents bugs with adding a SYSINIT that runs at SI_SUB_RUN_SCHEDULER + 1 time. Thanks, matthew > =A0Other SYSINITs with SI_SUB_RUN_SCHEDULER+SI_ORDER_ANY may get ordered > =A0after scheduler() and thus never executed. =A0That particular relative > =A0order is semi-arbitrary. > > =A0Thus, change such places to use SI_ORDER_MIDDLE. > =A0Also, use SI_ORDER_MIDDLE instead of correct, but less appealing, > =A0SI_ORDER_ANY - 1. > > =A0MFC after: =A0 =A01 week > > Modified: > =A0head/sys/gdb/gdb_cons.c > =A0head/sys/kern/kern_ntptime.c > =A0head/sys/sys/sched.h > > Modified: head/sys/gdb/gdb_cons.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/gdb/gdb_cons.c =A0 =A0 Thu Sep 30 16:47:01 2010 =A0 =A0 =A0 = =A0(r213304) > +++ head/sys/gdb/gdb_cons.c =A0 =A0 Thu Sep 30 17:05:23 2010 =A0 =A0 =A0 = =A0(r213305) > @@ -126,7 +126,7 @@ oktousecallout(void *data __unused) > =A0{ > =A0 =A0 =A0 =A0calloutok =3D 1; > =A0} > -SYSINIT(gdbhack, SI_SUB_RUN_SCHEDULER, SI_ORDER_ANY, oktousecallout, NUL= L); > +SYSINIT(gdbhack, SI_SUB_RUN_SCHEDULER, SI_ORDER_MIDDLE, oktousecallout, = NULL); > > =A0static void > =A0gdb_cnputc(struct consdev *cp, int c) > > Modified: head/sys/kern/kern_ntptime.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/kern/kern_ntptime.c =A0 =A0 =A0 =A0Thu Sep 30 16:47:01 2010 = =A0 =A0 =A0 =A0(r213304) > +++ head/sys/kern/kern_ntptime.c =A0 =A0 =A0 =A0Thu Sep 30 17:05:23 2010 = =A0 =A0 =A0 =A0(r213305) > @@ -1035,5 +1035,5 @@ start_periodic_resettodr(void *arg __unu > =A0 =A0 =A0 =A0 =A0 =A0periodic_resettodr, NULL); > =A0} > > -SYSINIT(periodic_resettodr, SI_SUB_RUN_SCHEDULER, SI_ORDER_ANY - 1, > +SYSINIT(periodic_resettodr, SI_SUB_RUN_SCHEDULER, SI_ORDER_MIDDLE, > =A0 =A0 =A0 =A0start_periodic_resettodr, NULL); > > Modified: head/sys/sys/sched.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/sys/sched.h =A0 =A0 =A0 =A0Thu Sep 30 16:47:01 2010 =A0 =A0 = =A0 =A0(r213304) > +++ head/sys/sys/sched.h =A0 =A0 =A0 =A0Thu Sep 30 17:05:23 2010 =A0 =A0 = =A0 =A0(r213305) > @@ -173,7 +173,7 @@ static void name ## _add_proc(void *dumm > =A0 =A0 =A0 =A0 =A0 =A0#name, CTLTYPE_LONG|CTLFLAG_RD|CTLFLAG_MPSAFE, =A0= =A0 =A0 =A0 =A0 =A0 =A0\ > =A0 =A0 =A0 =A0 =A0 =A0ptr, 0, sysctl_dpcpu_long, "LU", descr); =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0\ > =A0} =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0\ > -SYSINIT(name, SI_SUB_RUN_SCHEDULER, SI_ORDER_ANY, name ## _add_proc, NUL= L); > +SYSINIT(name, SI_SUB_RUN_SCHEDULER, SI_ORDER_MIDDLE, name ## _add_proc, = NULL); > > =A0#define =A0 =A0 =A0 =A0SCHED_STAT_DEFINE(name, descr) =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0\ > =A0 =A0 DPCPU_DEFINE(unsigned long, name); =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 \ > From owner-svn-src-head@FreeBSD.ORG Thu Sep 30 17:28:48 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BDEAA1065673; Thu, 30 Sep 2010 17:28:48 +0000 (UTC) (envelope-from avg@freebsd.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 756768FC23; Thu, 30 Sep 2010 17:28:47 +0000 (UTC) Received: from odyssey.starpoint.kiev.ua (alpha-e.starpoint.kiev.ua [212.40.38.101]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id UAA26038; Thu, 30 Sep 2010 20:28:45 +0300 (EEST) (envelope-from avg@freebsd.org) Message-ID: <4CA4C8CD.3040209@freebsd.org> Date: Thu, 30 Sep 2010 20:28:45 +0300 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.2.9) Gecko/20100920 Lightning/1.0b2 Thunderbird/3.1.4 MIME-Version: 1.0 To: mdf@freebsd.org References: <201009301705.o8UH5Nmm075714@svn.freebsd.org> In-Reply-To: X-Enigmail-Version: 1.1.2 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r213305 - in head/sys: gdb kern sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Sep 2010 17:28:48 -0000 on 30/09/2010 20:18 mdf@FreeBSD.org said the following: > On Thu, Sep 30, 2010 at 10:05 AM, Andriy Gapon wrote: >> Author: avg >> Date: Thu Sep 30 17:05:23 2010 >> New Revision: 213305 >> URL: http://svn.freebsd.org/changeset/base/213305 >> >> Log: >> there must be only one SYSINIT with SI_SUB_RUN_SCHEDULER+SI_ORDER_ANY order >> >> SI_SUB_RUN_SCHEDULER+SI_ORDER_ANY should only be used to call >> scheduler() function which turns the initial thread into swapper proper >> and thus there is no further SYSINIT processing. > > Does this imply that scheduler() shouldn't be called from a sysinit at > all, and instead a hand-call after processing all the boot-time > sysinit's would make more sense? This prevents the bug from > reoccuring, and also prevents bugs with adding a SYSINIT that runs at > SI_SUB_RUN_SCHEDULER + 1 time. I have no firm opinion about this. What you suggest sounds good to me. OTOH, both SI_SUB_RUN_SCHEDULER and SI_ORDER_ANY are documented (in sys/kernel.h though) to be the last order/sub-order. -- Andriy Gapon From owner-svn-src-head@FreeBSD.ORG Thu Sep 30 17:33:29 2010 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9FC6C106564A; Thu, 30 Sep 2010 17:33:29 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail09.syd.optusnet.com.au (mail09.syd.optusnet.com.au [211.29.132.190]) by mx1.freebsd.org (Postfix) with ESMTP id 34A458FC1B; Thu, 30 Sep 2010 17:33:28 +0000 (UTC) Received: from c122-107-116-249.carlnfd1.nsw.optusnet.com.au (c122-107-116-249.carlnfd1.nsw.optusnet.com.au [122.107.116.249]) by mail09.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id o8UHXQN5004113 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 1 Oct 2010 03:33:27 +1000 Date: Fri, 1 Oct 2010 03:33:25 +1000 (EST) From: Bruce Evans X-X-Sender: bde@delplex.bde.org To: Dimitry Andric In-Reply-To: <4CA49BE9.8040602@FreeBSD.org> Message-ID: <20101001025557.W700@delplex.bde.org> References: <201009292120.o8TLKTSf022159@svn.freebsd.org> <201009291812.26796.jkim@FreeBSD.org> <20100930125731.B2324@delplex.bde.org> <4CA49BE9.8040602@FreeBSD.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Jung-uk Kim , Bruce Evans Subject: Re: svn commit: r213281 - head/lib/libc/amd64/gen X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Sep 2010 17:33:29 -0000 On Thu, 30 Sep 2010, Dimitry Andric wrote: > On 2010-09-30 05:46, Bruce Evans wrote: > ... >> This file probably shouldn't exist, especially on amd64. There are 4 or 5 >> versions of ldexp(), and this file implements what seems to be the worst >> one, even without the bug. >> ... > > The version in libc/gen/ldexp.c is just a copy of msun/src/s_scalbn.c, > with some things like copysign() directly pasted in. It even has: > > /* @(#)fdlibm.h 5.1 93/09/24 */ > > at the top. Bah, I missed this sixth version :-). >> Testing indicates that the fdlibm C version is 2.5 times faster than the >> asm versions on amd64 on a core2 (ref9), while on i386 the C version is >> only 1.5 times faster. The C code is a bit larger so benefits more from >> being called from a loop. The asm code uses a slow i387 instruction, and >> on i387 it hhs to do expensive moves from xmm registers to i387 ones and >> back. >> >> Times for 100 million calls: >> >> amd64 libc ldexp: 3.18 seconds >> amd64 libm asm scalbn: 2.96 >> amd64 libm C scalbn: 1.30 >> i386 libc ldexp: 3.13 >> i386 libm asm scalbn: 2.86 >> i386 libm C scalbn: 2.11 > > Seeing these results, I propose to just delete > lib/libc/amd64/gen/ldexp.c and lib/libc/i386/gen/ldexp.c, which will > cause the amd64 and i386 builds to automatically pick up > lib/libc/gen/ldexp.c instead, which effectively is the fdlibm > implementation. (And no more clang workarounds needed. :) I like this idea. Does anyone have ideas for better testing? The loop also benefits machines with multiple pipelines and/or out/of order execution. Especially with the latter I think it is possible for several iterations to be in progress at once (looks like an average of about 1.5 for AthlonXP and later in other similar loop benchmarks). In other benchmarks I use a volatile variable to be more sure of defeating unwanted compiler optimizations, but I don't want to enforce serialization since non-benchmarks don't do that. In libm functions, the largest optimizations are from avoiding as internal serialization as much as possible. Using the i387 functions tends to defeat this since there is only 1 ALU for them (unlike for i387 addition, etc.; there are 2 ALUs for that on AthlonXP and later). Perhaps the i387 functions will be relatively faster again someday when there are more ALUs for them and better microcode in them, but x86 architects apparently consider this a low priority and/or the microcode is too hard make better than ordinary instructions. I think big functions using ordinary instructions are OK if they are slightly faster than i387 functions, since if they aren't called much then it doesn't matter and if they are called much then they will stay cached. But in they latter case, they will push other code out of caches; I don't know how to quantify this. Bruce From owner-svn-src-head@FreeBSD.ORG Thu Sep 30 17:37:08 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8A18C106566B; Thu, 30 Sep 2010 17:37:08 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 661338FC17; Thu, 30 Sep 2010 17:37: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 o8UHb8io076468; Thu, 30 Sep 2010 17:37:08 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8UHb8OD076466; Thu, 30 Sep 2010 17:37:08 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201009301737.o8UHb8OD076466@svn.freebsd.org> From: Pyun YongHyeon Date: Thu, 30 Sep 2010 17:37:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213306 - head/sys/pci X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Sep 2010 17:37:08 -0000 Author: yongari Date: Thu Sep 30 17:37:08 2010 New Revision: 213306 URL: http://svn.freebsd.org/changeset/base/213306 Log: Rename rl_setmulti() to rl_rxfilter() as rl_rxfilter() will handle IFF_ALLMULTI/IFF_PROMISC as well as multicast filter configuration. Rewrite RX filter logic to reduce number of register accesses and make it handle promiscuous/allmulti toggling without controller reinitialization. Previously rl(4) counted on controller reinitialization to reprogram promiscuous configuration but r211767 resulted in avoiding controller reinitialization whenever promiscuous mode is toggled. To address this, keep track of driver's view of interface state and handle IFF_ALLMULTI/IFF_PROMISC changes without reinitializing controller. This should fix a regression introduced in r211267. While I'm here remove unnecessary variable reassignment in ioctl handler. PR: kern/151079 MFC after: 1 week Modified: head/sys/pci/if_rl.c Modified: head/sys/pci/if_rl.c ============================================================================== --- head/sys/pci/if_rl.c Thu Sep 30 17:05:23 2010 (r213305) +++ head/sys/pci/if_rl.c Thu Sep 30 17:37:08 2010 (r213306) @@ -203,7 +203,7 @@ static void rl_read_eeprom(struct rl_sof static void rl_reset(struct rl_softc *); static int rl_resume(device_t); static int rl_rxeof(struct rl_softc *); -static void rl_setmulti(struct rl_softc *); +static void rl_rxfilter(struct rl_softc *); static int rl_shutdown(device_t); static void rl_start(struct ifnet *); static void rl_start_locked(struct ifnet *); @@ -655,54 +655,51 @@ rl_miibus_statchg(device_t dev) * Program the 64-bit multicast hash filter. */ static void -rl_setmulti(struct rl_softc *sc) +rl_rxfilter(struct rl_softc *sc) { struct ifnet *ifp = sc->rl_ifp; int h = 0; uint32_t hashes[2] = { 0, 0 }; struct ifmultiaddr *ifma; uint32_t rxfilt; - int mcnt = 0; RL_LOCK_ASSERT(sc); rxfilt = CSR_READ_4(sc, RL_RXCFG); - + rxfilt &= ~(RL_RXCFG_RX_ALLPHYS | RL_RXCFG_RX_BROAD | + RL_RXCFG_RX_MULTI); + /* Always accept frames destined for this host. */ + rxfilt |= RL_RXCFG_RX_INDIV; + /* Set capture broadcast bit to capture broadcast frames. */ + if (ifp->if_flags & IFF_BROADCAST) + rxfilt |= RL_RXCFG_RX_BROAD; if (ifp->if_flags & IFF_ALLMULTI || ifp->if_flags & IFF_PROMISC) { rxfilt |= RL_RXCFG_RX_MULTI; - CSR_WRITE_4(sc, RL_RXCFG, rxfilt); - CSR_WRITE_4(sc, RL_MAR0, 0xFFFFFFFF); - CSR_WRITE_4(sc, RL_MAR4, 0xFFFFFFFF); - return; - } - - /* first, zot all the existing hash bits */ - CSR_WRITE_4(sc, RL_MAR0, 0); - CSR_WRITE_4(sc, RL_MAR4, 0); - - /* now program new ones */ - if_maddr_rlock(ifp); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - h = ether_crc32_be(LLADDR((struct sockaddr_dl *) - ifma->ifma_addr), ETHER_ADDR_LEN) >> 26; - if (h < 32) - hashes[0] |= (1 << h); - else - hashes[1] |= (1 << (h - 32)); - mcnt++; + if (ifp->if_flags & IFF_PROMISC) + rxfilt |= RL_RXCFG_RX_ALLPHYS; + hashes[0] = 0xFFFFFFFF; + hashes[1] = 0xFFFFFFFF; + } else { + /* Now program new ones. */ + if_maddr_rlock(ifp); + TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + if (ifma->ifma_addr->sa_family != AF_LINK) + continue; + h = ether_crc32_be(LLADDR((struct sockaddr_dl *) + ifma->ifma_addr), ETHER_ADDR_LEN) >> 26; + if (h < 32) + hashes[0] |= (1 << h); + else + hashes[1] |= (1 << (h - 32)); + } + if_maddr_runlock(ifp); + if (hashes[0] != 0 || hashes[1] != 0) + rxfilt |= RL_RXCFG_RX_MULTI; } - if_maddr_runlock(ifp); - - if (mcnt) - rxfilt |= RL_RXCFG_RX_MULTI; - else - rxfilt &= ~RL_RXCFG_RX_MULTI; - CSR_WRITE_4(sc, RL_RXCFG, rxfilt); CSR_WRITE_4(sc, RL_MAR0, hashes[0]); CSR_WRITE_4(sc, RL_MAR4, hashes[1]); + CSR_WRITE_4(sc, RL_RXCFG, rxfilt); } static void @@ -1807,7 +1804,6 @@ rl_init_locked(struct rl_softc *sc) { struct ifnet *ifp = sc->rl_ifp; struct mii_data *mii; - uint32_t rxcfg = 0; uint32_t eaddr[2]; RL_LOCK_ASSERT(sc); @@ -1864,30 +1860,8 @@ rl_init_locked(struct rl_softc *sc) CSR_WRITE_4(sc, RL_TXCFG, RL_TXCFG_CONFIG); CSR_WRITE_4(sc, RL_RXCFG, RL_RXCFG_CONFIG); - /* Set the individual bit to receive frames for this host only. */ - rxcfg = CSR_READ_4(sc, RL_RXCFG); - rxcfg |= RL_RXCFG_RX_INDIV; - - /* If we want promiscuous mode, set the allframes bit. */ - if (ifp->if_flags & IFF_PROMISC) { - rxcfg |= RL_RXCFG_RX_ALLPHYS; - CSR_WRITE_4(sc, RL_RXCFG, rxcfg); - } else { - rxcfg &= ~RL_RXCFG_RX_ALLPHYS; - CSR_WRITE_4(sc, RL_RXCFG, rxcfg); - } - - /* Set capture broadcast bit to capture broadcast frames. */ - if (ifp->if_flags & IFF_BROADCAST) { - rxcfg |= RL_RXCFG_RX_BROAD; - CSR_WRITE_4(sc, RL_RXCFG, rxcfg); - } else { - rxcfg &= ~RL_RXCFG_RX_BROAD; - CSR_WRITE_4(sc, RL_RXCFG, rxcfg); - } - - /* Program the multicast filter, if necessary. */ - rl_setmulti(sc); + /* Set RX filter. */ + rl_rxfilter(sc); #ifdef DEVICE_POLLING /* Disable interrupts if we are polling. */ @@ -1966,20 +1940,22 @@ rl_ioctl(struct ifnet *ifp, u_long comma case SIOCSIFFLAGS: RL_LOCK(sc); if (ifp->if_flags & IFF_UP) { - rl_init_locked(sc); - } else { - if (ifp->if_drv_flags & IFF_DRV_RUNNING) - rl_stop(sc); - } + if (ifp->if_drv_flags & IFF_DRV_RUNNING && + ((ifp->if_flags ^ sc->rl_if_flags) & + (IFF_PROMISC | IFF_ALLMULTI))) + rl_rxfilter(sc); + else + rl_init_locked(sc); + } else if (ifp->if_drv_flags & IFF_DRV_RUNNING) + rl_stop(sc); + sc->rl_if_flags = ifp->if_flags; RL_UNLOCK(sc); - error = 0; break; case SIOCADDMULTI: case SIOCDELMULTI: RL_LOCK(sc); - rl_setmulti(sc); + rl_rxfilter(sc); RL_UNLOCK(sc); - error = 0; break; case SIOCGIFMEDIA: case SIOCSIFMEDIA: From owner-svn-src-head@FreeBSD.ORG Thu Sep 30 18:14:12 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7C1901065672; Thu, 30 Sep 2010 18:14:12 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6A9D08FC15; Thu, 30 Sep 2010 18:14: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 o8UIECgs077351; Thu, 30 Sep 2010 18:14:12 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8UIECsK077343; Thu, 30 Sep 2010 18:14:12 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201009301814.o8UIECsK077343@svn.freebsd.org> From: Nathan Whitehorn Date: Thu, 30 Sep 2010 18:14:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213307 - in head/sys/powerpc: aim include powerpc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Sep 2010 18:14:12 -0000 Author: nwhitehorn Date: Thu Sep 30 18:14:12 2010 New Revision: 213307 URL: http://svn.freebsd.org/changeset/base/213307 Log: Add support for memory attributes (pmap_mapdev_attr() and friends) on PowerPC/AIM. This is currently stubbed out on Book-E, since I have no idea how to implement it there. Modified: head/sys/powerpc/aim/mmu_oea.c head/sys/powerpc/aim/mmu_oea64.c head/sys/powerpc/include/pmap.h head/sys/powerpc/include/vm.h head/sys/powerpc/powerpc/bus_machdep.c head/sys/powerpc/powerpc/mmu_if.m head/sys/powerpc/powerpc/pmap_dispatch.c Modified: head/sys/powerpc/aim/mmu_oea.c ============================================================================== --- head/sys/powerpc/aim/mmu_oea.c Thu Sep 30 17:37:08 2010 (r213306) +++ head/sys/powerpc/aim/mmu_oea.c Thu Sep 30 18:14:12 2010 (r213307) @@ -328,9 +328,12 @@ void moea_deactivate(mmu_t, struct threa void moea_cpu_bootstrap(mmu_t, int); void moea_bootstrap(mmu_t, vm_offset_t, vm_offset_t); void *moea_mapdev(mmu_t, vm_offset_t, vm_size_t); +void *moea_mapdev_attr(mmu_t, vm_offset_t, vm_size_t, vm_memattr_t); void moea_unmapdev(mmu_t, vm_offset_t, vm_size_t); vm_offset_t moea_kextract(mmu_t, vm_offset_t); +void moea_kenter_attr(mmu_t, vm_offset_t, vm_offset_t, vm_memattr_t); void moea_kenter(mmu_t, vm_offset_t, vm_offset_t); +void moea_page_set_memattr(mmu_t mmu, vm_page_t m, vm_memattr_t ma); boolean_t moea_dev_direct_mapped(mmu_t, vm_offset_t, vm_size_t); static void moea_sync_icache(mmu_t, pmap_t, vm_offset_t, vm_size_t); @@ -366,14 +369,17 @@ static mmu_method_t moea_methods[] = { MMUMETHOD(mmu_zero_page_idle, moea_zero_page_idle), MMUMETHOD(mmu_activate, moea_activate), MMUMETHOD(mmu_deactivate, moea_deactivate), + MMUMETHOD(mmu_page_set_memattr, moea_page_set_memattr), /* Internal interfaces */ MMUMETHOD(mmu_bootstrap, moea_bootstrap), MMUMETHOD(mmu_cpu_bootstrap, moea_cpu_bootstrap), + MMUMETHOD(mmu_mapdev_attr, moea_mapdev_attr), MMUMETHOD(mmu_mapdev, moea_mapdev), MMUMETHOD(mmu_unmapdev, moea_unmapdev), MMUMETHOD(mmu_kextract, moea_kextract), MMUMETHOD(mmu_kenter, moea_kenter), + MMUMETHOD(mmu_kenter_attr, moea_kenter_attr), MMUMETHOD(mmu_dev_direct_mapped,moea_dev_direct_mapped), { 0, 0 } @@ -381,6 +387,40 @@ static mmu_method_t moea_methods[] = { MMU_DEF(oea_mmu, MMU_TYPE_OEA, moea_methods, 0); +static __inline uint32_t +moea_calc_wimg(vm_offset_t pa, vm_memattr_t ma) +{ + uint32_t pte_lo; + int i; + + if (ma != VM_MEMATTR_DEFAULT) { + switch (ma) { + case VM_MEMATTR_UNCACHEABLE: + return (PTE_I | PTE_G); + case VM_MEMATTR_WRITE_COMBINING: + case VM_MEMATTR_WRITE_BACK: + case VM_MEMATTR_PREFETCHABLE: + return (PTE_I); + case VM_MEMATTR_WRITE_THROUGH: + return (PTE_W | PTE_M); + } + } + + /* + * Assume the page is cache inhibited and access is guarded unless + * it's in our available memory array. + */ + pte_lo = PTE_I | PTE_G; + for (i = 0; i < pregions_sz; i++) { + if ((pa >= pregions[i].mr_start) && + (pa < (pregions[i].mr_start + pregions[i].mr_size))) { + pte_lo = PTE_M; + break; + } + } + + return pte_lo; +} static void tlbie(vm_offset_t va) @@ -1086,7 +1126,7 @@ moea_enter_locked(pmap_t pmap, vm_offset struct pvo_head *pvo_head; uma_zone_t zone; vm_page_t pg; - u_int pte_lo, pvo_flags, was_exec, i; + u_int pte_lo, pvo_flags, was_exec; int error; if (!moea_initialized) { @@ -1128,19 +1168,7 @@ moea_enter_locked(pmap_t pmap, vm_offset } } - /* - * Assume the page is cache inhibited and access is guarded unless - * it's in our available memory array. - */ - pte_lo = PTE_I | PTE_G; - for (i = 0; i < pregions_sz; i++) { - if ((VM_PAGE_TO_PHYS(m) >= pregions[i].mr_start) && - (VM_PAGE_TO_PHYS(m) < - (pregions[i].mr_start + pregions[i].mr_size))) { - pte_lo = PTE_M; - break; - } - } + pte_lo = moea_calc_wimg(VM_PAGE_TO_PHYS(m), VM_MEMATTR_DEFAULT); if (prot & VM_PROT_WRITE) { pte_lo |= PTE_BW; @@ -1416,14 +1444,53 @@ moea_ts_referenced(mmu_t mmu, vm_page_t } /* + * Modify the WIMG settings of all mappings for a page. + */ +void +moea_page_set_memattr(mmu_t mmu, vm_page_t m, vm_memattr_t ma) +{ + struct pvo_entry *pvo; + struct pte *pt; + pmap_t pmap; + u_int lo; + + vm_page_lock_queues(); + lo = moea_calc_wimg(VM_PAGE_TO_PHYS(m), ma); + LIST_FOREACH(pvo, vm_page_to_pvoh(m), pvo_vlink) { + pmap = pvo->pvo_pmap; + PMAP_LOCK(pmap); + mtx_lock(&moea_table_mutex); + pt = moea_pvo_to_pte(pvo, -1); + pvo->pvo_pte.pte.pte_lo &= ~PTE_WIMG; + pvo->pvo_pte.pte.pte_lo |= lo; + if (pt != NULL) { + moea_pte_change(pt, &pvo->pvo_pte.pte, + pvo->pvo_vaddr); + if (pvo->pvo_pmap == kernel_pmap) + isync(); + } + mtx_unlock(&moea_table_mutex); + PMAP_UNLOCK(pmap); + } + m->md.mdpg_cache_attrs = ma; + vm_page_unlock_queues(); +} + +/* * Map a wired page into kernel virtual address space. */ void moea_kenter(mmu_t mmu, vm_offset_t va, vm_offset_t pa) { + + moea_kenter_attr(mmu, va, pa, VM_MEMATTR_DEFAULT); +} + +void +moea_kenter_attr(mmu_t mmu, vm_offset_t va, vm_offset_t pa, vm_memattr_t ma) +{ u_int pte_lo; int error; - int i; #if 0 if (va < VM_MIN_KERNEL_ADDRESS) @@ -1431,14 +1498,7 @@ moea_kenter(mmu_t mmu, vm_offset_t va, v va); #endif - pte_lo = PTE_I | PTE_G; - for (i = 0; i < pregions_sz; i++) { - if ((pa >= pregions[i].mr_start) && - (pa < (pregions[i].mr_start + pregions[i].mr_size))) { - pte_lo = PTE_M; - break; - } - } + pte_lo = moea_calc_wimg(pa, ma); PMAP_LOCK(kernel_pmap); error = moea_pvo_enter(kernel_pmap, moea_upvo_zone, @@ -2432,6 +2492,13 @@ moea_dev_direct_mapped(mmu_t mmu, vm_off void * moea_mapdev(mmu_t mmu, vm_offset_t pa, vm_size_t size) { + + return (moea_mapdev_attr(mmu, pa, size, VM_MEMATTR_DEFAULT)); +} + +void * +moea_mapdev_attr(mmu_t mmu, vm_offset_t pa, vm_size_t size, vm_memattr_t ma) +{ vm_offset_t va, tmpva, ppa, offset; int i; @@ -2454,7 +2521,7 @@ moea_mapdev(mmu_t mmu, vm_offset_t pa, v panic("moea_mapdev: Couldn't alloc kernel virtual memory"); for (tmpva = va; size > 0;) { - moea_kenter(mmu, tmpva, ppa); + moea_kenter_attr(mmu, tmpva, ppa, ma); tlbie(tmpva); size -= PAGE_SIZE; tmpva += PAGE_SIZE; Modified: head/sys/powerpc/aim/mmu_oea64.c ============================================================================== --- head/sys/powerpc/aim/mmu_oea64.c Thu Sep 30 17:37:08 2010 (r213306) +++ head/sys/powerpc/aim/mmu_oea64.c Thu Sep 30 18:14:12 2010 (r213307) @@ -423,8 +423,11 @@ void moea64_zero_page_idle(mmu_t, vm_pag void moea64_activate(mmu_t, struct thread *); void moea64_deactivate(mmu_t, struct thread *); void *moea64_mapdev(mmu_t, vm_offset_t, vm_size_t); +void *moea64_mapdev_attr(mmu_t, vm_offset_t, vm_size_t, vm_memattr_t); void moea64_unmapdev(mmu_t, vm_offset_t, vm_size_t); vm_offset_t moea64_kextract(mmu_t, vm_offset_t); +void moea64_page_set_memattr(mmu_t, vm_page_t m, vm_memattr_t ma); +void moea64_kenter_attr(mmu_t, vm_offset_t, vm_offset_t, vm_memattr_t ma); void moea64_kenter(mmu_t, vm_offset_t, vm_offset_t); boolean_t moea64_dev_direct_mapped(mmu_t, vm_offset_t, vm_size_t); static void moea64_sync_icache(mmu_t, pmap_t, vm_offset_t, vm_size_t); @@ -461,14 +464,17 @@ static mmu_method_t moea64_methods[] = { MMUMETHOD(mmu_zero_page_idle, moea64_zero_page_idle), MMUMETHOD(mmu_activate, moea64_activate), MMUMETHOD(mmu_deactivate, moea64_deactivate), + MMUMETHOD(mmu_page_set_memattr, moea64_page_set_memattr), /* Internal interfaces */ MMUMETHOD(mmu_bootstrap, moea64_bootstrap), MMUMETHOD(mmu_cpu_bootstrap, moea64_cpu_bootstrap), MMUMETHOD(mmu_mapdev, moea64_mapdev), + MMUMETHOD(mmu_mapdev_attr, moea64_mapdev_attr), MMUMETHOD(mmu_unmapdev, moea64_unmapdev), MMUMETHOD(mmu_kextract, moea64_kextract), MMUMETHOD(mmu_kenter, moea64_kenter), + MMUMETHOD(mmu_kenter_attr, moea64_kenter_attr), MMUMETHOD(mmu_dev_direct_mapped,moea64_dev_direct_mapped), { 0, 0 } @@ -632,11 +638,24 @@ moea64_pte_change(struct lpte *pt, struc } static __inline uint64_t -moea64_calc_wimg(vm_offset_t pa) +moea64_calc_wimg(vm_offset_t pa, vm_memattr_t ma) { uint64_t pte_lo; int i; + if (ma != VM_MEMATTR_DEFAULT) { + switch (ma) { + case VM_MEMATTR_UNCACHEABLE: + return (LPTE_I | LPTE_G); + case VM_MEMATTR_WRITE_COMBINING: + case VM_MEMATTR_WRITE_BACK: + case VM_MEMATTR_PREFETCHABLE: + return (LPTE_I); + case VM_MEMATTR_WRITE_THROUGH: + return (LPTE_W | LPTE_M); + } + } + /* * Assume the page is cache inhibited and access is guarded unless * it's in our available memory array. @@ -1376,7 +1395,7 @@ void moea64_set_scratchpage_pa(int which moea64_scratchpage_pte[which]->pte_lo &= ~(LPTE_WIMG | LPTE_RPGN); moea64_scratchpage_pte[which]->pte_lo |= - moea64_calc_wimg(pa) | (uint64_t)pa; + moea64_calc_wimg(pa, VM_MEMATTR_DEFAULT) | (uint64_t)pa; EIEIO(); moea64_scratchpage_pte[which]->pte_hi |= LPTE_VALID; @@ -1524,7 +1543,7 @@ moea64_enter_locked(pmap_t pmap, vm_offs zone = moea64_upvo_zone; } - pte_lo = moea64_calc_wimg(VM_PAGE_TO_PHYS(m)); + pte_lo = moea64_calc_wimg(VM_PAGE_TO_PHYS(m), pmap_page_get_memattr(m)); if (prot & VM_PROT_WRITE) { pte_lo |= LPTE_BW; @@ -1892,23 +1911,48 @@ moea64_ts_referenced(mmu_t mmu, vm_page_ } /* + * Modify the WIMG settings of all mappings for a page. + */ +void +moea64_page_set_memattr(mmu_t mmu, vm_page_t m, vm_memattr_t ma) +{ + struct pvo_entry *pvo; + struct lpte *pt; + pmap_t pmap; + uint64_t lo; + + vm_page_lock_queues(); + lo = moea64_calc_wimg(VM_PAGE_TO_PHYS(m), ma); + LIST_FOREACH(pvo, vm_page_to_pvoh(m), pvo_vlink) { + pmap = pvo->pvo_pmap; + PMAP_LOCK(pmap); + LOCK_TABLE(); + pt = moea64_pvo_to_pte(pvo); + pvo->pvo_pte.lpte.pte_lo &= ~LPTE_WIMG; + pvo->pvo_pte.lpte.pte_lo |= lo; + if (pt != NULL) { + moea64_pte_change(pt, &pvo->pvo_pte.lpte, + pvo->pvo_vpn); + if (pvo->pvo_pmap == kernel_pmap) + isync(); + } + UNLOCK_TABLE(); + PMAP_UNLOCK(pmap); + } + m->md.mdpg_cache_attrs = ma; + vm_page_unlock_queues(); +} + +/* * Map a wired page into kernel virtual address space. */ void -moea64_kenter(mmu_t mmu, vm_offset_t va, vm_offset_t pa) +moea64_kenter_attr(mmu_t mmu, vm_offset_t va, vm_offset_t pa, vm_memattr_t ma) { uint64_t pte_lo; int error; -#if 0 - if (!pmap_bootstrapped) { - if (va >= VM_MIN_KERNEL_ADDRESS && va < virtual_end) - panic("Trying to enter an address in KVA -- %#" - PRIxPTR "!\n",pa); - } -#endif - - pte_lo = moea64_calc_wimg(pa); + pte_lo = moea64_calc_wimg(pa, ma); PMAP_LOCK(kernel_pmap); error = moea64_pvo_enter(kernel_pmap, moea64_upvo_zone, @@ -1928,6 +1972,13 @@ moea64_kenter(mmu_t mmu, vm_offset_t va, PMAP_UNLOCK(kernel_pmap); } +void +moea64_kenter(mmu_t mmu, vm_offset_t va, vm_offset_t pa) +{ + + moea64_kenter_attr(mmu, va, pa, VM_MEMATTR_DEFAULT); +} + /* * Extract the physical page address associated with the given kernel virtual * address. @@ -2976,7 +3027,7 @@ moea64_dev_direct_mapped(mmu_t mmu, vm_o * NOT real memory. */ void * -moea64_mapdev(mmu_t mmu, vm_offset_t pa, vm_size_t size) +moea64_mapdev_attr(mmu_t mmu, vm_offset_t pa, vm_size_t size, vm_memattr_t ma) { vm_offset_t va, tmpva, ppa, offset; @@ -2990,7 +3041,7 @@ moea64_mapdev(mmu_t mmu, vm_offset_t pa, panic("moea64_mapdev: Couldn't alloc kernel virtual memory"); for (tmpva = va; size > 0;) { - moea64_kenter(mmu, tmpva, ppa); + moea64_kenter_attr(mmu, tmpva, ppa, ma); size -= PAGE_SIZE; tmpva += PAGE_SIZE; ppa += PAGE_SIZE; @@ -2999,6 +3050,13 @@ moea64_mapdev(mmu_t mmu, vm_offset_t pa, return ((void *)(va + offset)); } +void * +moea64_mapdev(mmu_t mmu, vm_offset_t pa, vm_size_t size) +{ + + return moea64_mapdev_attr(mmu, pa, size, VM_MEMATTR_DEFAULT); +} + void moea64_unmapdev(mmu_t mmu, vm_offset_t va, vm_size_t size) { Modified: head/sys/powerpc/include/pmap.h ============================================================================== --- head/sys/powerpc/include/pmap.h Thu Sep 30 17:37:08 2010 (r213306) +++ head/sys/powerpc/include/pmap.h Thu Sep 30 18:14:12 2010 (r213307) @@ -122,13 +122,13 @@ struct pvo_entry { LIST_HEAD(pvo_head, pvo_entry); struct md_page { - u_int64_t mdpg_attrs; + u_int64_t mdpg_attrs; + vm_memattr_t mdpg_cache_attrs; struct pvo_head mdpg_pvoh; }; -#define pmap_page_get_memattr(m) VM_MEMATTR_DEFAULT +#define pmap_page_get_memattr(m) ((m)->md.mdpg_cache_attrs) #define pmap_page_is_mapped(m) (!LIST_EMPTY(&(m)->md.mdpg_pvoh)) -#define pmap_page_set_memattr(m, ma) (void)0 /* * Return the VSID corresponding to a given virtual address. @@ -187,7 +187,6 @@ struct md_page { #define pmap_page_get_memattr(m) VM_MEMATTR_DEFAULT #define pmap_page_is_mapped(m) (!TAILQ_EMPTY(&(m)->md.pv_list)) -#define pmap_page_set_memattr(m, ma) (void)0 #endif /* AIM */ @@ -209,9 +208,12 @@ extern struct pmap kernel_pmap_store; void pmap_bootstrap(vm_offset_t, vm_offset_t); void pmap_kenter(vm_offset_t va, vm_offset_t pa); +void pmap_kenter_attr(vm_offset_t va, vm_offset_t pa, vm_memattr_t); void pmap_kremove(vm_offset_t); void *pmap_mapdev(vm_offset_t, vm_size_t); +void *pmap_mapdev_attr(vm_offset_t, vm_size_t, vm_memattr_t); void pmap_unmapdev(vm_offset_t, vm_size_t); +void pmap_page_set_memattr(vm_page_t, vm_memattr_t); void pmap_deactivate(struct thread *); vm_offset_t pmap_kextract(vm_offset_t); int pmap_dev_direct_mapped(vm_offset_t, vm_size_t); Modified: head/sys/powerpc/include/vm.h ============================================================================== --- head/sys/powerpc/include/vm.h Thu Sep 30 17:37:08 2010 (r213306) +++ head/sys/powerpc/include/vm.h Thu Sep 30 18:14:12 2010 (r213307) @@ -32,11 +32,13 @@ #include /* Memory attributes. */ -#define VM_MEMATTR_CACHING_INHIBIT ((vm_memattr_t)PTE_I) -#define VM_MEMATTR_GUARD ((vm_memattr_t)PTE_G) -#define VM_MEMATTR_MEMORY_COHERENCE ((vm_memattr_t)PTE_M) -#define VM_MEMATTR_WRITE_THROUGH ((vm_memattr_t)PTE_W) - #define VM_MEMATTR_DEFAULT 0 +#define VM_MEMATTR_UNCACHEABLE 0x01 +#define VM_MEMATTR_UNCACHED VM_MEMATTR_UNCACHEABLE +#define VM_MEMATTR_CACHEABLE 0x02 +#define VM_MEMATTR_WRITE_COMBINING 0x04 +#define VM_MEMATTR_WRITE_BACK 0x08 +#define VM_MEMATTR_WRITE_THROUGH 0x10 +#define VM_MEMATTR_PREFETCHABLE 0x20 #endif /* !_MACHINE_VM_H_ */ Modified: head/sys/powerpc/powerpc/bus_machdep.c ============================================================================== --- head/sys/powerpc/powerpc/bus_machdep.c Thu Sep 30 17:37:08 2010 (r213306) +++ head/sys/powerpc/powerpc/bus_machdep.c Thu Sep 30 18:14:12 2010 (r213307) @@ -60,6 +60,7 @@ __FBSDID("$FreeBSD$"); static struct { bus_addr_t addr; bus_size_t size; + int flags; } earlyboot_mappings[MAX_EARLYBOOT_MAPPINGS]; static int earlyboot_map_idx = 0; @@ -72,9 +73,11 @@ __ppc_ba(bus_space_handle_t bsh, bus_siz } static int -bs_gen_map(bus_addr_t addr, bus_size_t size __unused, int flags __unused, +bs_gen_map(bus_addr_t addr, bus_size_t size, int flags, bus_space_handle_t *bshp) { + vm_memattr_t ma; + /* * Record what we did if we haven't enabled the MMU yet. We * will need to remap it as soon as the MMU comes up. @@ -84,10 +87,20 @@ bs_gen_map(bus_addr_t addr, bus_size_t s ("%s: too many early boot mapping requests", __func__)); earlyboot_mappings[earlyboot_map_idx].addr = addr; earlyboot_mappings[earlyboot_map_idx].size = size; + earlyboot_mappings[earlyboot_map_idx].flags = flags; earlyboot_map_idx++; *bshp = addr; } else { - *bshp = (bus_space_handle_t)pmap_mapdev(addr,size); + ma = VM_MEMATTR_DEFAULT; + switch (flags) { + case BUS_SPACE_MAP_CACHEABLE: + ma = VM_MEMATTR_CACHEABLE; + break; + case BUS_SPACE_MAP_PREFETCHABLE: + ma = VM_MEMATTR_PREFETCHABLE; + break; + } + *bshp = (bus_space_handle_t)pmap_mapdev_attr(addr, size, ma); } return (0); @@ -98,6 +111,7 @@ bs_remap_earlyboot(void) { int i; vm_offset_t pa, spa; + vm_memattr_t ma; for (i = 0; i < earlyboot_map_idx; i++) { spa = earlyboot_mappings[i].addr; @@ -105,9 +119,19 @@ bs_remap_earlyboot(void) == 0) continue; + ma = VM_MEMATTR_DEFAULT; + switch (earlyboot_mappings[i].flags) { + case BUS_SPACE_MAP_CACHEABLE: + ma = VM_MEMATTR_CACHEABLE; + break; + case BUS_SPACE_MAP_PREFETCHABLE: + ma = VM_MEMATTR_PREFETCHABLE; + break; + } + pa = trunc_page(spa); while (pa < spa + earlyboot_mappings[i].size) { - pmap_kenter(pa,pa); + pmap_kenter_attr(pa, pa, ma); pa += PAGE_SIZE; } } Modified: head/sys/powerpc/powerpc/mmu_if.m ============================================================================== --- head/sys/powerpc/powerpc/mmu_if.m Thu Sep 30 17:37:08 2010 (r213306) +++ head/sys/powerpc/powerpc/mmu_if.m Thu Sep 30 18:14:12 2010 (r213307) @@ -111,6 +111,24 @@ CODE { { return (NULL); } + + static void *mmu_null_mapdev_attr(mmu_t mmu, vm_offset_t pa, + vm_size_t size, vm_memattr_t ma) + { + return MMU_MAPDEV(mmu, pa, size); + } + + static void mmu_null_kenter_attr(mmu_t mmu, vm_offset_t va, + vm_offset_t pa, vm_memattr_t ma) + { + MMU_KENTER(mmu, va, pa); + } + + static void mmu_null_page_set_memattr(mmu_t mmu, vm_page_t m, + vm_memattr_t ma) + { + return; + } }; @@ -747,6 +765,37 @@ METHOD void * mapdev { vm_size_t _size; }; +/** + * @brief Create a kernel mapping for a given physical address range. + * Called by bus code on behalf of device drivers. The mapping does not + * have to be a virtual address: it can be a direct-mapped physical address + * if that is supported by the MMU. + * + * @param _pa start physical address + * @param _size size in bytes of mapping + * @param _attr cache attributes + * + * @retval addr address of mapping. + */ +METHOD void * mapdev_attr { + mmu_t _mmu; + vm_offset_t _pa; + vm_size_t _size; + vm_memattr_t _attr; +} DEFAULT mmu_null_mapdev_attr; + +/** + * @brief Change cache control attributes for a page. Should modify all + * mappings for that page. + * + * @param _m page to modify + * @param _ma new cache control attributes + */ +METHOD void page_set_memattr { + mmu_t _mmu; + vm_page_t _pg; + vm_memattr_t _ma; +} DEFAULT mmu_null_page_set_memattr; /** * @brief Remove the mapping created by mapdev. Called when a driver @@ -787,6 +836,19 @@ METHOD void kenter { vm_offset_t _pa; }; +/** + * @brief Map a wired page into kernel virtual address space + * + * @param _va mapping virtual address + * @param _pa mapping physical address + * @param _ma mapping cache control attributes + */ +METHOD void kenter_attr { + mmu_t _mmu; + vm_offset_t _va; + vm_offset_t _pa; + vm_memattr_t _ma; +} DEFAULT mmu_null_kenter_attr; /** * @brief Determine if the given physical address range has been direct-mapped. Modified: head/sys/powerpc/powerpc/pmap_dispatch.c ============================================================================== --- head/sys/powerpc/powerpc/pmap_dispatch.c Thu Sep 30 17:37:08 2010 (r213306) +++ head/sys/powerpc/powerpc/pmap_dispatch.c Thu Sep 30 18:14:12 2010 (r213307) @@ -433,6 +433,22 @@ pmap_mapdev(vm_offset_t pa, vm_size_t si return (MMU_MAPDEV(mmu_obj, pa, size)); } +void * +pmap_mapdev_attr(vm_offset_t pa, vm_size_t size, vm_memattr_t attr) +{ + + CTR3(KTR_PMAP, "%s(%#x, %#x)", __func__, pa, size); + return (MMU_MAPDEV_ATTR(mmu_obj, pa, size, attr)); +} + +void +pmap_page_set_memattr(vm_page_t m, vm_memattr_t ma) +{ + + CTR3(KTR_PMAP, "%s(%#x, %#x)", __func__, pa, size); + return (MMU_PAGE_SET_MEMATTR(mmu_obj, m, ma)); +} + void pmap_unmapdev(vm_offset_t va, vm_size_t size) { @@ -457,6 +473,14 @@ pmap_kenter(vm_offset_t va, vm_offset_t MMU_KENTER(mmu_obj, va, pa); } +void +pmap_kenter_attr(vm_offset_t va, vm_offset_t pa, vm_memattr_t ma) +{ + + CTR3(KTR_PMAP, "%s(%#x, %#x)", __func__, va, pa); + MMU_KENTER_ATTR(mmu_obj, va, pa, ma); +} + boolean_t pmap_dev_direct_mapped(vm_offset_t pa, vm_size_t size) { From owner-svn-src-head@FreeBSD.ORG Thu Sep 30 18:32:45 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 1233) id A4E061065672; Thu, 30 Sep 2010 18:32:45 +0000 (UTC) Date: Thu, 30 Sep 2010 18:32:45 +0000 From: Alexander Best To: Jaakko Heinonen Message-ID: <20100930183245.GA10589@freebsd.org> References: <201009301331.o8UDVZC0070804@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201009301331.o8UDVZC0070804@svn.freebsd.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r213298 - head/sbin/mount X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Sep 2010 18:32:45 -0000 hooray! :) thanks a bunch. -- a13x From owner-svn-src-head@FreeBSD.ORG Thu Sep 30 19:20:22 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 39430106564A; Thu, 30 Sep 2010 19:20:22 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0EEFA8FC0C; Thu, 30 Sep 2010 19:20: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 o8UJKLh1078876; Thu, 30 Sep 2010 19:20:21 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8UJKLCx078875; Thu, 30 Sep 2010 19:20:21 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201009301920.o8UJKLCx078875@svn.freebsd.org> From: Dimitry Andric Date: Thu, 30 Sep 2010 19:20:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213308 - in head/lib/libc: amd64/gen i386/gen X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Sep 2010 19:20:22 -0000 Author: dim Date: Thu Sep 30 19:20:21 2010 New Revision: 213308 URL: http://svn.freebsd.org/changeset/base/213308 Log: Retire the amd64 and i386 specific inline assembly versions of ldexp.c, as they are slower than the generic version in C, at least on modern hardware. This leaves us with just five implementations. Suggested by: bde Approved by: rpaulo (mentor) Deleted: head/lib/libc/amd64/gen/ldexp.c head/lib/libc/i386/gen/ldexp.c From owner-svn-src-head@FreeBSD.ORG Thu Sep 30 20:37:47 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 10D3C1065670 for ; Thu, 30 Sep 2010 20:37:47 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from mail2.fluidhosting.com (mx21.fluidhosting.com [204.14.89.4]) by mx1.freebsd.org (Postfix) with ESMTP id A971C8FC16 for ; Thu, 30 Sep 2010 20:37:46 +0000 (UTC) Received: (qmail 27768 invoked by uid 399); 30 Sep 2010 20:37:45 -0000 Received: from localhost (HELO ?192.168.0.142?) (dougb@dougbarton.us@127.0.0.1) by localhost with ESMTPAM; 30 Sep 2010 20:37:45 -0000 X-Originating-IP: 127.0.0.1 X-Sender: dougb@dougbarton.us Message-ID: <4CA4F503.4020907@FreeBSD.org> Date: Thu, 30 Sep 2010 13:37:23 -0700 From: Doug Barton Organization: http://SupersetSolutions.com/ User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.9) Gecko/20100915 Thunderbird/3.1.4 MIME-Version: 1.0 To: Ed Maste References: <201009291308.o8TD8NHo009975@svn.freebsd.org> <4CA42F56.4070604@FreeBSD.org> <20100930130812.GA79354@sandvine.com> In-Reply-To: <20100930130812.GA79354@sandvine.com> X-Enigmail-Version: 1.2a1pre OpenPGP: id=1A1ABC84 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r213270 - head/etc/rc.d X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Sep 2010 20:37:47 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 On 9/30/2010 6:08 AM, Ed Maste wrote: | On Wed, Sep 29, 2010 at 11:33:58PM -0700, Doug Barton wrote: | |> -----BEGIN PGP SIGNED MESSAGE----- |> Hash: SHA256 |> |> On 9/29/2010 6:08 AM, Ed Maste wrote: |> | Author: emaste |> | Date: Wed Sep 29 13:08:23 2010 |> | New Revision: 213270 |> | URL: http://svn.freebsd.org/changeset/base/213270 | ... | |> Could you please back this (and your related changes) out, and evaluate |> Jeremy's script? I, and other users have evaluated it for some time now |> and found it effective; and I'd like to see it committed, especially now |> that Jeremy has updated it. | | Backing this out doesn't improve anything, so I'm not going to do that. | This change is an improvement to what's in the tree today, and the | original author of this script agreed with the approach. I will review | Jeremy's script as time permits; if it is a viable replacement for | defaultroute then we can just replace defaultroute with it, and my | change can then end up in /dev/null. Thanks for taking the time to chat with me about this on IRC. As a result of our discussion I am withdrawing my request for you to back this code out. Meanwhile, for future reference, when someone asks you to hold off on committing something and to explore other options first what we have done in the past is NOT to go ahead and commit the code anyway, then initiate a discussion about possible modifications. It's a matter of respect, and good committer relations. And yes, you can laugh all you want about me being the one to point this out, but that doesn't invalidate my point. Doug - -- ... and that's just a little bit of history repeating. -- Propellerheads Improve the effectiveness of your Internet presence with a domain name makeover! http://SupersetSolutions.com/ -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (MingW32) iQEcBAEBCAAGBQJMpPUDAAoJEFzGhvEaGryENWsH/A6CfJwSs+Snq8bdZkEuKWjT LLFYGWqI9mtaeC6NusjOKX7yyYZDHKm4r544tisxNShQiUU/HMBAzuTWdR7YV2rl SslHoTX1hifenF0e08eog3ZjbJVze3yUeREd/gN7DLlb+i6OtqzK+JCAUsY1bp1C augagpralfpHfBo6bXa/1Xy1E8w6dzZ1Lh1uaqUfwHN1G9vF/UHuuSD5+MI9nv1s R1uBydN+X3KROM5Iz7xqiaLzD+ny52uKikYOhvi6GckEJlC4qg9y6uRr01HWNKaq PCSC/xLa/mU6Yfze/srl4yvBi+TYffAhY5y5L3046cBFiK1n2Q+X+fC9GdcGxKA= =t93b -----END PGP SIGNATURE----- From owner-svn-src-head@FreeBSD.ORG Thu Sep 30 22:00:22 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 69E17106566C; Thu, 30 Sep 2010 22:00:22 +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 3F9028FC19; Thu, 30 Sep 2010 22: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 o8UM0ML0082397; Thu, 30 Sep 2010 22:00:22 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8UM0M8p082394; Thu, 30 Sep 2010 22:00:22 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <201009302200.o8UM0M8p082394@svn.freebsd.org> From: Edwin Groothuis Date: Thu, 30 Sep 2010 22:00:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213312 - head/contrib/tzdata X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Sep 2010 22:00:22 -0000 Author: edwin Date: Thu Sep 30 22:00:21 2010 New Revision: 213312 URL: http://svn.freebsd.org/changeset/base/213312 Log: MFV of 213310, tzdata2010m - Fix historical data for Hongkong - Fix location description for Antarctica/Vostok Modified: head/contrib/tzdata/asia head/contrib/tzdata/zone.tab Directory Properties: head/contrib/tzdata/ (props changed) Modified: head/contrib/tzdata/asia ============================================================================== --- head/contrib/tzdata/asia Thu Sep 30 21:57:09 2010 (r213311) +++ head/contrib/tzdata/asia Thu Sep 30 22:00:21 2010 (r213312) @@ -1,4 +1,4 @@ -# @(#)asia 8.61 +# @(#)asia 8.62 # This file is in the public domain, so clarified as of # 2009-05-17 by Arthur David Olson. @@ -547,8 +547,8 @@ Rule HK 1953 only - Nov 1 3:30 0 - Rule HK 1954 1964 - Mar Sun>=18 3:30 1:00 S Rule HK 1954 only - Oct 31 3:30 0 - Rule HK 1955 1964 - Nov Sun>=1 3:30 0 - -Rule HK 1965 1977 - Apr Sun>=16 3:30 1:00 S -Rule HK 1965 1977 - Oct Sun>=16 3:30 0 - +Rule HK 1965 1976 - Apr Sun>=16 3:30 1:00 S +Rule HK 1965 1976 - Oct Sun>=16 3:30 0 - Rule HK 1973 only - Dec 30 3:30 1:00 S Rule HK 1979 only - May Sun>=8 3:30 1:00 S Rule HK 1979 only - Oct Sun>=16 3:30 0 - Modified: head/contrib/tzdata/zone.tab ============================================================================== --- head/contrib/tzdata/zone.tab Thu Sep 30 21:57:09 2010 (r213311) +++ head/contrib/tzdata/zone.tab Thu Sep 30 22:00:21 2010 (r213312) @@ -1,5 +1,5 @@ #
-# @(#)zone.tab	8.37
+# @(#)zone.tab	8.38
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 #
@@ -41,7 +41,7 @@ AQ	-6448-06406	Antarctica/Palmer	Palmer 
 AQ	-6736+06253	Antarctica/Mawson	Mawson Station, Holme Bay
 AQ	-6835+07758	Antarctica/Davis	Davis Station, Vestfold Hills
 AQ	-6617+11031	Antarctica/Casey	Casey Station, Bailey Peninsula
-AQ	-7824+10654	Antarctica/Vostok	Vostok Station, S Magnetic Pole
+AQ	-7824+10654	Antarctica/Vostok	Vostok Station, Lake Vostok
 AQ	-6640+14001	Antarctica/DumontDUrville	Dumont-d'Urville Station, Terre Adelie
 AQ	-690022+0393524	Antarctica/Syowa	Syowa Station, E Ongul I
 AQ	-5430+15857	Antarctica/Macquarie	Macquarie Island Station, Macquarie Island

From owner-svn-src-head@FreeBSD.ORG  Thu Sep 30 22:17:12 2010
Return-Path: 
Delivered-To: svn-src-head@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B27E5106564A;
	Thu, 30 Sep 2010 22:17:12 +0000 (UTC)
	(envelope-from brde@optusnet.com.au)
Received: from mail09.syd.optusnet.com.au (mail09.syd.optusnet.com.au
	[211.29.132.190])
	by mx1.freebsd.org (Postfix) with ESMTP id 2E62E8FC21;
	Thu, 30 Sep 2010 22:17:11 +0000 (UTC)
Received: from c122-107-116-249.carlnfd1.nsw.optusnet.com.au
	(c122-107-116-249.carlnfd1.nsw.optusnet.com.au [122.107.116.249])
	by mail09.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id
	o8UMH8JC002282
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
	Fri, 1 Oct 2010 08:17:10 +1000
Date: Fri, 1 Oct 2010 08:17:08 +1000 (EST)
From: Bruce Evans 
X-X-Sender: bde@delplex.bde.org
To: Dimitry Andric 
In-Reply-To: <201009301920.o8UJKLCx078875@svn.freebsd.org>
Message-ID: <20101001075452.F1348@delplex.bde.org>
References: <201009301920.o8UJKLCx078875@svn.freebsd.org>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org,
	src-committers@FreeBSD.org
Subject: Re: svn commit: r213308 - in head/lib/libc: amd64/gen i386/gen
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 30 Sep 2010 22:17:12 -0000

On Thu, 30 Sep 2010, Dimitry Andric wrote:

> Log:
>  Retire the amd64 and i386 specific inline assembly versions of ldexp.c,
>  as they are slower than the generic version in C, at least on modern
>  hardware.  This leaves us with just five implementations.
>
>  Suggested by:	bde
>  Approved by:	rpaulo (mentor)

Thanks.

I suppose it has had enough testing.  I just tested it on a Celeron 366
(late 90's P2 arch).  The C version is faster there too:

libc asm ldexp:  1.98 seconds
libm asm scalbn: 1.91
libm C   scalbn: 1.84

While there, I noticed that the libm asm scalbn is still using RCSID(),
like many of the older libm asm functions.  This is not just a style
bug.  RCSID() and __RCSID() are compatibility cruft that should never
be used.  The RCSID() in i386/include/asm.h is especially bad.  It
bloats the text section with $FreeBSD$ strings using ".text; .asciz...".
__FBSDID() normally uses .ident which normally puts the strings in a
better place.

Are there only 5 implementations left? :-)  arm is the only arch that
still has one in libc.  amd64 are i386 the only arches that have asm
versions of scalbn in libm.  They are there for float and long double
precision too.  This is especially silly for float precision since the
integer versions are especially easy to make efficient for float
precision.  OTOH, long double precision is probably still faster in
asm.  There are also silly scalbln* interfaces (taking a long for the
exponent).  These are only implemented in C (as wrappers).

Bruce



Bruce

From owner-svn-src-head@FreeBSD.ORG  Thu Sep 30 22:34:15 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D058B106564A;
	Thu, 30 Sep 2010 22:34:15 +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 BFDC18FC0A;
	Thu, 30 Sep 2010 22:34:15 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8UMYFtv083266;
	Thu, 30 Sep 2010 22:34:15 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8UMYF2Q083264;
	Thu, 30 Sep 2010 22:34:15 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <201009302234.o8UMYF2Q083264@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Thu, 30 Sep 2010 22:34:15 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r213316 - head/sys/dev/bge
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 30 Sep 2010 22:34:15 -0000

Author: yongari
Date: Thu Sep 30 22:34:15 2010
New Revision: 213316
URL: http://svn.freebsd.org/changeset/base/213316

Log:
  Fix IFCAP_TXCSUM/IFCAP_RXCSUM handling. Previously bge(4) used
  IFCAP_HWCSUM to know which capability should be changed such that
  disabling RX checksun offloading resulted in disabling TX checksum
  offloading.

Modified:
  head/sys/dev/bge/if_bge.c

Modified: head/sys/dev/bge/if_bge.c
==============================================================================
--- head/sys/dev/bge/if_bge.c	Thu Sep 30 22:03:43 2010	(r213315)
+++ head/sys/dev/bge/if_bge.c	Thu Sep 30 22:34:15 2010	(r213316)
@@ -4630,15 +4630,19 @@ bge_ioctl(struct ifnet *ifp, u_long comm
 			}
 		}
 #endif
-		if (mask & IFCAP_HWCSUM) {
-			ifp->if_capenable ^= IFCAP_HWCSUM;
-			if (IFCAP_HWCSUM & ifp->if_capenable &&
-			    IFCAP_HWCSUM & ifp->if_capabilities)
+		if ((mask & IFCAP_TXCSUM) != 0 &&
+		    (ifp->if_capabilities & IFCAP_TXCSUM) != 0) {
+			ifp->if_capenable ^= IFCAP_TXCSUM;
+			if ((ifp->if_capenable & IFCAP_TXCSUM) != 0)
 				ifp->if_hwassist |= sc->bge_csum_features;
 			else
 				ifp->if_hwassist &= ~sc->bge_csum_features;
 		}
 
+		if ((mask & IFCAP_RXCSUM) != 0 &&
+		    (ifp->if_capabilities & IFCAP_RXCSUM) != 0)
+			ifp->if_capenable ^= IFCAP_RXCSUM;
+
 		if ((mask & IFCAP_TSO4) != 0 &&
 		    (ifp->if_capabilities & IFCAP_TSO4) != 0) {
 			ifp->if_capenable ^= IFCAP_TSO4;

From owner-svn-src-head@FreeBSD.ORG  Fri Oct  1 03:59:18 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C3DA0106564A;
	Fri,  1 Oct 2010 03:59:18 +0000 (UTC)
	(envelope-from gordon@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id B0CCD8FC13;
	Fri,  1 Oct 2010 03:59: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 o913xIiX089955;
	Fri, 1 Oct 2010 03:59:18 GMT (envelope-from gordon@svn.freebsd.org)
Received: (from gordon@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o913xIAQ089948;
	Fri, 1 Oct 2010 03:59:18 GMT (envelope-from gordon@svn.freebsd.org)
Message-Id: <201010010359.o913xIAQ089948@svn.freebsd.org>
From: Gordon Tetlow 
Date: Fri, 1 Oct 2010 03:59:18 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r213317 - head/usr.bin/man
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 01 Oct 2010 03:59:19 -0000

Author: gordon
Date: Fri Oct  1 03:59:18 2010
New Revision: 213317
URL: http://svn.freebsd.org/changeset/base/213317

Log:
  Implementaiton of man, manpath, whatis, and apropos written entirely in sh.
  
  Features of this new version in favor of the old one:
  BSD licensed -- old one is GPL.
  Imports configuration from /etc/man.conf and LOCALBASE/etc/man.d/*.conf
  allowing ports to extend the base functionality. The pluggable
  configuration can supplement the manual search path (retiring use.perl),
  add locales, and override language specific toolsets (attempt to merge
  the japanese/man port into the base system as much as possible).
  
  Much effort has been made to make this version mirror the functionality
  of the existing implementation. For 99% of users, it should be a drop in
  replacement.
  
  PR:		gnu/143271, gnu/4419
  Reviewed by:	dougb (previous versions)
  Approved by:	wes (mentor)

Added:
  head/usr.bin/man/
  head/usr.bin/man/Makefile   (contents, props changed)
  head/usr.bin/man/apropos.1   (contents, props changed)
  head/usr.bin/man/man.1   (contents, props changed)
  head/usr.bin/man/man.conf.5   (contents, props changed)
  head/usr.bin/man/man.sh   (contents, props changed)
  head/usr.bin/man/manpath.1   (contents, props changed)

Added: head/usr.bin/man/Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/usr.bin/man/Makefile	Fri Oct  1 03:59:18 2010	(r213317)
@@ -0,0 +1,11 @@
+# $FreeBSD$
+
+SCRIPTS= man.sh
+LINKS=	${BINDIR}/man ${BINDIR}/apropos \
+	${BINDIR}/man ${BINDIR}/manpath \
+	${BINDIR}/man ${BINDIR}/whatis
+
+MAN=	man.1 manpath.1 apropos.1 man.conf.5
+MLINKS=	apropos.1 whatis.1
+
+.include 

Added: head/usr.bin/man/apropos.1
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/usr.bin/man/apropos.1	Fri Oct  1 03:59:18 2010	(r213317)
@@ -0,0 +1,88 @@
+.\"-
+.\"  Copyright (c) 2010 Gordon Tetlow
+.\"  All rights reserved.
+.\"
+.\"  Redistribution and use in source and binary forms, with or without
+.\"  modification, are permitted provided that the following conditions
+.\"  are met:
+.\"  1. Redistributions of source code must retain the above copyright
+.\"     notice, this list of conditions and the following disclaimer.
+.\"  2. Redistributions in binary form must reproduce the above copyright
+.\"     notice, this list of conditions and the following disclaimer in the
+.\"     documentation and/or other materials provided with the distribution.
+.\"
+.\"  THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\"  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\"  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\"  ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\"  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\"  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\"  OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\"  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\"  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\"  OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\"  SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd September 1, 2010
+.Dt APROPOS 1
+.Os
+.Sh NAME
+.Nm apropos ,
+.Nm whatis
+.Nd keyword search whatis documentation databases
+.Sh SYNOPSIS
+.Nm
+.Op Fl d
+.Ar keyword ...
+.Nm whatis
+.Op Fl d
+.Ar keyword ...
+.Sh DESCRIPTION
+The
+.Nm
+utility searches a set of databases looking for documentation matching each
+.Ar keyword
+and displays the results.
+The
+.Nm whatis
+utility does the same search but only on complete words.
+.Bl -tag -width ".Fl d"
+.It Fl d
+Print extra debugging information.
+.El
+.Pp
+The
+.Ar keyword
+is simply passed to
+.Xr grep 1
+allowing for extended regular expression matches.
+.Sh ENVIRONMENT
+The following environment variables affect the execution of
+.Nm :
+.Bl -tag -width ".Ev PAGER"
+.It Ev MANLOCALES , MANPATH , PATH
+Used to find the location of the
+.Nm whatis
+database files. See
+.Xr manpath 1
+for additional information.
+.It Ev PAGER
+Program used to display files.
+If unset,
+.Ic "more -s"
+is used.
+.El
+.Sh DIAGNOSTICS
+The
+.Nm
+utility exits 0 if a keyword matched and 1 if no keywords are matched or no
+.Nm whatis
+databases are found.
+.Sh SEE ALSO
+.Xr grep 1 ,
+.Xr makewhatis 1 ,
+.Xr man 1 ,
+.Xr manpath 1 ,
+.Xr man.conf 5

Added: head/usr.bin/man/man.1
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/usr.bin/man/man.1	Fri Oct  1 03:59:18 2010	(r213317)
@@ -0,0 +1,299 @@
+.\"-
+.\"  Copyright (c) 2010 Gordon Tetlow
+.\"  All rights reserved.
+.\"
+.\"  Redistribution and use in source and binary forms, with or without
+.\"  modification, are permitted provided that the following conditions
+.\"  are met:
+.\"  1. Redistributions of source code must retain the above copyright
+.\"     notice, this list of conditions and the following disclaimer.
+.\"  2. Redistributions in binary form must reproduce the above copyright
+.\"     notice, this list of conditions and the following disclaimer in the
+.\"     documentation and/or other materials provided with the distribution.
+.\"
+.\"  THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\"  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\"  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\"  ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\"  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\"  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\"  OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\"  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\"  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\"  OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\"  SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd September 1, 2010
+.Dt MAN 1
+.Os
+.Sh NAME
+.Nm man
+.Nd display online manual documentation pages
+.Sh SYNOPSIS
+.Nm
+.Op Fl adho
+.Op Fl t | Fl w
+.Op Fl M Ar manpath
+.Op Fl P Ar pager
+.Op Fl S Ar mansect
+.Op Fl m Ar arch Ns Op : Ns Ar machine
+.Op Fl p Op Ar eprtv
+.Op Ar mansect
+.Ar page ...
+.Nm
+.Fl f
+.Ar keyword ...
+.Nm
+.Fl k
+.Ar keyword ...
+.Sh DESCRIPTION
+The
+.Nm
+utility finds and displays online manual documentation pages.
+If
+.Ar mansect
+is provided,
+.Nm
+restricts the search to the specific section of the manual.
+.Pp
+Options that
+.Nm
+understands:
+.Bl -tag -width indent
+.It Fl M Ar manpath
+Forces a specific colon separated manual path instead of the default
+search path.
+See
+.Xr manpath 1 .
+Overrides the
+.Ev MANPATH
+environment variable.
+.It Fl P Ar pager
+Use specified pager.
+Defaults to
+.Ic "more -s" .
+Overrides the
+.Ev PAGER
+environment variable.
+.It Fl S Ar mansect
+Restricts manual sections searched to the specified colon delimited list.
+Defaults to
+.Va 1:1aout:8:2:3:n:4:5:6:7:9:l .
+Overrides the
+.Ev MANSECT
+environment variable.
+.It Fl a
+Display all manual pages instead of just the first found for each
+.Ar page
+argument.
+.It Fl d
+Print extra debugging information.
+Repeat for increased verbosity.
+Does not display the manual page.
+.It Fl f
+Emulate
+.Xr whatis 1 .
+.It Fl h
+Display short help message and exit.
+.It Fl k
+Emulate
+.Xr apropos 1 .
+.It Fl m Ar arch Ns Op : Ns Ar machine
+Override the default architecture and machine settings allowing lookup of
+other platform specific manual pages.
+See
+.Sx IMPLEMENTATION NOTES
+for how this option changes the default behavior.
+Overrides the
+.Ev MACHINE_ARCH
+and
+.Ev MACHINE
+environment variables.
+.It Fl o
+Force use of non-localized manual pages.
+See
+.Sx IMPLEMENTATION NOTES
+for how locale specific searches work.
+Overrides the
+.Ev LC_ALL , LC_CTYPE ,
+and
+.Ev LANG
+environment variables.
+.It Fl p Op Ar eprtv
+Use the list of given preprocessors before running
+.Xr nroff 1
+or
+.Xr troff 1 .
+Valid preprocessors arguments:
+.Bl -tag -width indent -compact
+.It Cm e
+.Xr eqn 1
+.It Cm p
+.Xr pic 1
+.It Cm r
+.Xr refer 1
+.It Cm t
+.Xr tbl 1
+.It Cm v
+.Xr vgrind 1
+.El
+Overrides the
+.Ev MANROFFSEQ
+environment variable.
+.It Fl t
+Send manual page source through
+.Xr troff 1
+allowing transformation of the manual pages to other formats.
+.It Fl w
+Display the location of the manual page instead of the contents of
+the manual page.
+.El
+.Sh IMPLEMENTATION NOTES
+.Ss Locale Specific Searches
+The
+.Nm
+utility supports manual pages in different locales.
+The search behavior is dictated by the first of three
+environment variables with a nonempty string:
+.Ev LC_ALL ,
+.Ev LC_CTYPE ,
+or
+.Ev LANG .
+If set,
+.Nm
+will search for locale specific manual pages using the following logic:
+.Bl -item -compact -offset indent
+.Sm off
+.It
+.Va lang _
+.Va country .
+.Va charset
+.It
+.Va lang .
+.Va charset
+.It
+.Li en .
+.Va charset
+.Sm on
+.El
+For example, if
+.Ev LC_ALL
+is set to
+.Va ja_JP.eucJP ,
+.Nm
+will search the following paths when considering section 1 manual pages in
+.Pa /usr/share/man :
+.Bl -item -compact -offset indent
+.It
+.Pa /usr/share/man/ja_JP.eucJP/man1
+.It
+.Pa /usr/share/man/ja.eucJP/man1
+.It
+.Pa /usr/share/man/en.eucJP/man1
+.It
+.Pa /usr/share/man/man1
+.El
+.Ss Platform Specific Searches
+The
+.Nm
+utility supports platform specific manual pages.
+The search behavior is dictated by the
+.Fl m
+option or the
+.Ev MACHINE_ARCH
+and
+.Ev MACHINE
+environment variables.
+For example, if
+.Ev MACHINE_ARCH
+is set to
+.Va i386
+and
+.Ev MACHINE
+is set to
+.Va pc98 ,
+.Nm
+will search the following paths when considering section 4 manual pages in
+.Pa /usr/share/man :
+.Bl -item -compact -offset indent
+.It
+.Pa /usr/share/man/man4/pc98
+.It
+.Pa /usr/share/man/man4/i386
+.It
+.Pa /usr/share/man/man4
+.El
+.Sh ENVIRONMENT
+The following environment variables affect the execution of
+.Nm :
+.Bl -tag -width ".Ev MANPATH"
+.It Ev LC_ALL , LC_CTYPE , LANG
+Used to find locale specific manual pages.
+Valid values can be found by running the
+.Xr locale 1
+command.
+See
+.Sx IMPLEMENTATION NOTES
+for details.
+Influenced by the
+.Fl o
+option.
+.It Ev MACHINE_ARCH , MACHINE
+Used to find platform specific manual pages.
+If unset, the output of
+.Ic "sysctl hw.machine_arch"
+and
+.Ic "sysctl hw.machine"
+is used respectively.
+See
+.Sx IMPLEMENTATION NOTES
+for details.
+Corresponds to the
+.Fl m
+option.
+.It Ev MANPATH
+Used to find the location of the manual files.
+See
+.Xr manpath 1
+for additional information.
+Corresponds to the
+.Fl M
+option.
+.It Ev MANROFFSEQ
+Used to determine the preprocessors for the manual source before running
+.Xr nroff 1
+or
+.Xr troff 1 .
+If unset, defaults to
+.Xr tbl 1 .
+Corresponds to the
+.Fl p
+option.
+.It Ev MANSECT
+Restricts manual sections searched to the specified colon delimited list.
+Corresponds to the
+.Fl S
+option.
+.It Ev PAGER
+Program used to display files.
+If unset,
+.Ic "more -s"
+is used.
+.El
+.Sh FILES
+.Bl -tag -width indent -compact
+.It Pa /etc/man.conf
+System configuration file.
+.It Pa /usr/local/etc/man.d/*.conf
+Local configuration files.
+.El
+.Sh SEE ALSO
+.Xr apropos 1 ,
+.Xr locale 1 ,
+.Xr manpath 1 ,
+.Xr man.conf 5 ,
+.Xr nroff 1 ,
+.Xr troff 1 ,
+.Xr whatis 1

Added: head/usr.bin/man/man.conf.5
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/usr.bin/man/man.conf.5	Fri Oct  1 03:59:18 2010	(r213317)
@@ -0,0 +1,142 @@
+.\"-
+.\"  Copyright (c) 2010 Gordon Tetlow
+.\"  All rights reserved.
+.\"
+.\"  Redistribution and use in source and binary forms, with or without
+.\"  modification, are permitted provided that the following conditions
+.\"  are met:
+.\"  1. Redistributions of source code must retain the above copyright
+.\"     notice, this list of conditions and the following disclaimer.
+.\"  2. Redistributions in binary form must reproduce the above copyright
+.\"     notice, this list of conditions and the following disclaimer in the
+.\"     documentation and/or other materials provided with the distribution.
+.\"
+.\"  THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\"  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\"  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\"  ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\"  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\"  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\"  OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\"  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\"  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\"  OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\"  SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd September 1, 2010
+.Os
+.Dt MAN.CONF 5
+.Sh NAME
+.Nm man.conf
+.Nd
+.Xr man 1
+and
+.Xr manpath 1
+configuration files
+.Sh DESCRIPTION
+The
+.Nm
+file is used to configure the manual search path, locales, and utility set for
+.Xr man 1
+and its related utilities.
+During initialization,
+.Xr man 1
+reads the configuration files located at
+.Pa /usr/local/etc/man.d/*.conf
+and
+.Pa /etc/man.conf .
+.Pp
+The files contained in
+.Pa /usr/local/etc/man.d/*.conf
+are intended to be used by the
+.Xr ports 7
+system for extending the manual set to support additional paths and locales.
+.Pa /etc/man.conf
+is intended to be used by the local administrator to set additional policy.
+.Pp
+Currently supported configuration variables include:
+.Bl -tag -offset indent
+.It MANCONFIG
+Overrides the default location to import additional manual configuration files.
+Defaults to
+.Pa /usr/local/etc/man.d/*.conf .
+.It MANPATH
+Adds the specified directory to the manual search path.
+.It MANLOCALE
+Indicates support is available for the given locale.
+.El
+.Pp
+For pages in a given language, overriding the default toolset for
+display is supported via the following definitions:
+.Bl -tag -offset indent -compact
+.It EQN Ns _ Ns Va LANG
+.It COL Ns _ Ns Va LANG
+.It NROFF Ns _ Ns Va LANG
+.It PIC Ns _ Ns Va LANG
+.It TBL Ns _ Ns Va LANG
+.It TROFF Ns _ Ns Va LANG
+.It REFER Ns _ Ns Va LANG
+.It VGRIND Ns _ Ns Va LANG
+.El
+.Pp
+See the
+.Sx EXAMPLES
+section for how to use these variables.
+.Sh IMPLEMENTATION NOTES
+The parser used for this utility is very basic and only supports comment
+characters (#) at the beginning of a line.
+.Sh FILES
+.Bl -tag -compact
+.It Pa /etc/man.conf
+System configuration file.
+.It Pa /usr/local/etc/man.d/*.conf
+Local configuration files.
+.El
+.Sh EXAMPLES
+A perl port that needs to install additional manual pages outside of the
+default location could install a file in
+.Pa /usr/local/etc/man.d/perl.conf
+with the following contents:
+.Bd -literal -offset indent
+# Add perl man pages to search path
+MANPATH /usr/local/lib/perl5/5.8.9/man
+MANPATH /usr/local/lib/perl5/5.8.9/perl/man
+.Ed
+.Pp
+A Japanese localization port could install a custom toolset and include a
+file in
+.Pa /usr/local/etc/man.d/ja-man-doc.conf
+with the following contents:
+.Bd -literal -offset indent
+# Setup Japanese toolset
+MANLOCALE	ja_JP.eucJP
+EQN_JA		/usr/local/bin/gepn
+PIC_JA		/usr/local/bin/gpic
+TBL_JA		/usr/local/bin/gtbl
+NROFF_JA	/usr/local/bin/groff -man -dlang=ja_JP.eucJP
+TROFF_JA	/usr/local/bin/groff -man -dlang=ja_JP.euc.jp
+.Ed
+.Pp
+If the system administrator decides to override the
+.Va LOCALBASE
+.Xr make 1
+variable causing all
+.Xr ports 7
+to be installed into
+.Pa /opt
+instead of
+.Pa /usr/local ,
+specifying the following in
+.Pa /etc/man.conf
+will accommodate this change:
+.Bd -literal -offset indent
+# Look for additional configuration files
+MANCONFIG /opt/etc/man.d/*.conf
+.Ed
+.Sh SEE ALSO
+.Xr apropos 1 ,
+.Xr man 1 ,
+.Xr manpath 1 ,
+.Xr whatis 1

Added: head/usr.bin/man/man.sh
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/usr.bin/man/man.sh	Fri Oct  1 03:59:18 2010	(r213317)
@@ -0,0 +1,847 @@
+#! /bin/sh
+#
+#  Copyright (c) 2010 Gordon Tetlow
+#  All rights reserved.
+#
+#  Redistribution and use in source and binary forms, with or without
+#  modification, are permitted provided that the following conditions
+#  are met:
+#  1. Redistributions of source code must retain the above copyright
+#     notice, this list of conditions and the following disclaimer.
+#  2. Redistributions in binary form must reproduce the above copyright
+#     notice, this list of conditions and the following disclaimer in the
+#     documentation and/or other materials provided with the distribution.
+#
+#  THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+#  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+#  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+#  ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+#  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+#  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+#  OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+#  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+#  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+#  OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+#  SUCH DAMAGE.
+#
+# $FreeBSD$
+
+# Usage: add_to_manpath path
+# Adds a variable to manpath while ensuring we don't have duplicates.
+# Returns true if we were able to add something. False otherwise.
+add_to_manpath() {
+	case "$manpath" in
+	*:$1)	decho "  Skipping duplicate manpath entry $1" 2 ;;
+	$1:*)	decho "  Skipping duplicate manpath entry $1" 2 ;;
+	*:$1:*)	decho "  Skipping duplicate manpath entry $1" 2 ;;
+	*)	if [ -d "$1" ]; then
+			decho "  Adding $1 to manpath"
+			manpath="$manpath:$1"
+			return 0
+		fi
+		;;
+	esac
+
+	return 1
+}
+
+# Usage: build_manlocales
+# Builds a correct MANLOCALES variable.
+build_manlocales() {
+	# If the user has set manlocales, who are we to argue.
+	if [ -n "$MANLOCALES" ]; then
+		return
+	fi
+
+	parse_configs
+
+	# Trim leading colon
+	MANLOCALES=${manlocales#:}
+
+	decho "Available manual locales: $MANLOCALES"
+}
+
+# Usage: build_manpath
+# Builds a correct MANPATH variable.
+build_manpath() {
+	local IFS
+
+	# If the user has set a manpath, who are we to argue.
+	if [ -n "$MANPATH" ]; then
+		return
+	fi
+
+	search_path
+
+	decho "Adding default manpath entries"
+	IFS=:
+	for path in $man_default_path; do
+		add_to_manpath "$path"
+	done
+	unset IFS
+
+	parse_configs
+
+	# Trim leading colon
+	MANPATH=${manpath#:}
+
+	decho "Using manual path: $MANPATH"
+}
+
+# Usage: check_cat catglob
+# Checks to see if a cat glob is available.
+check_cat() {
+	if exists "$1"; then
+		use_cat=yes
+		catpage=$found
+		decho "    Found catpage $catpage"
+		return 0
+	else
+		return 1
+	fi
+}
+
+# Usage: check_man manglob catglob
+# Given 2 globs, figures out if the manglob is available, if so, check to
+# see if the catglob is also available and up to date.
+check_man() {
+	if exists "$1"; then
+		# We have a match, check for a cat page
+		manpage=$found
+		decho "    Found manpage $manpage"
+
+		if exists "$2" && is_newer $found $manpage; then
+			# cat page found and is newer, use that
+			use_cat=yes
+			catpage=$found
+			decho "    Using catpage $catpage"
+		else
+			# no cat page or is older
+			unset use_cat
+			decho "    Skipping catpage: not found or old"
+		fi
+		return 0
+	fi
+
+	return 1
+}
+
+# Usage: decho "string" [debuglevel]
+# Echoes to stderr string prefaced with -- if high enough debuglevel.
+decho() {
+	if [ $debug -ge ${2:-1} ]; then
+		echo "-- $1" >&2
+	fi
+}
+
+# Usage: exists glob
+# Returns true if glob resolves to a real file.
+exists() {
+	local IFS
+
+	# Don't accidentally inherit callers IFS (breaks perl manpages)
+	unset IFS
+
+	# Use some globbing tricks in the shell to determine if a file
+	# exists or not.
+	set +f
+	set -- "$1" $1
+	set -f
+
+	if [ "$1" != "$2" -a -r "$2" ]; then
+		found="$2"
+		return 0
+	fi
+
+	return 1
+}
+
+# Usage: find_file path section subdir pagename
+# Returns: true if something is matched and found.
+# Search the given path/section combo for a given page.
+find_file() {
+	local manroot catroot mann man0 catn cat0
+
+	manroot="$1/man$2"
+	catroot="$1/cat$2"
+	if [ -n "$3" ]; then
+		manroot="$manroot/$3"
+		catroot="$catroot/$3"
+	fi
+
+	if [ ! -d "$manroot" ]; then
+		return 1
+	fi
+	decho "  Searching directory $manroot" 2
+
+	mann="$manroot/$4.$2*"
+	man0="$manroot/$4.0*"
+	catn="$catroot/$4.$2*"
+	cat0="$catroot/$4.0*"
+
+	# This is the behavior as seen by the original man utility.
+	# Let's not change that which doesn't seem broken.
+	if check_man "$mann" "$catn"; then
+		return 0
+	elif check_man "$man0" "$cat0"; then
+		return 0
+	elif check_cat "$catn"; then
+		return 0
+	elif check_cat "$cat0"; then
+		return 0
+	fi
+
+	return 1
+}
+
+# Usage: is_newer file1 file2
+# Returns true if file1 is newer than file2 as calculated by mtime.
+is_newer() {
+	if [ $(stat -f %m $1) -gt $(stat -f %m $2) ]; then
+		decho "    mtime: $1 newer than $2" 3
+		return 0
+	else
+		decho "    mtime: $1 older than $2" 3
+		return 1
+	fi
+}
+
+# Usage: manpath_parse_args "$@"
+# Parses commandline options for manpath.
+manpath_parse_args() {
+	local cmd_arg
+
+	while getopts 'Ldq' cmd_arg; do
+		case "${cmd_arg}" in
+		L)	Lflag=Lflag ;;
+		d)	debug=$(( $debug + 1 )) ;;
+		q)	qflag=qflag ;;
+		*)	manpath_usage ;;
+		esac
+	done >&2
+}
+
+# Usage: manpath_usage
+# Display usage for the manpath(1) utility.
+manpath_usage() {
+	echo 'usage: manpath [-Ldq]' >&2
+	exit 1
+}
+
+# Usage: manpath_warnings
+# Display some warnings to stderr.
+manpath_warnings() {
+	if [ -z "$Lflag" -a -n "$MANPATH" ]; then
+		echo "(Warning: MANPATH environment variable set)" >&2
+	fi
+
+	if [ -n "$Lflag" -a -n "$MANLOCALES" ]; then
+		echo "(Warning: MANLOCALES environment variable set)" >&2
+	fi
+}
+
+# Usage: man_display_page
+# Display either the manpage or catpage depending on the use_cat variable
+man_display_page() {
+	local EQN COL NROFF PIC TBL TROFF REFER VGRIND
+	local IFS l nroff_dev pipeline preproc_arg tool
+
+	# We are called with IFS set to colon. This causes really weird
+	# things to happen for the variables that have spaces in them.
+	unset IFS
+
+	# If we are supposed to use a catpage and we aren't using troff(1)
+	# just zcat the catpage and we are done.
+	if [ -z "$tflag" -a -n "$use_cat" ]; then
+		if [ -n "$wflag" ]; then
+			echo "$catpage (source: $manpage)"
+			ret=0
+		else
+			if [ $debug -gt 0 ]; then
+				decho "Command: $ZCAT $catpage | $PAGER"
+				ret=0
+			else
+				eval "$ZCAT $catpage | $PAGER"
+				ret=$?
+			fi
+		fi
+		return
+	fi
+
+	# Okay, we are using the manpage, do we just need to output the
+	# name of the manpage?
+	if [ -n "$wflag" ]; then
+		echo "$manpage"
+		ret=0
+		return
+	fi
+
+	# So, we really do need to parse the manpage. First, figure out the
+	# device flag (-T) we have to pass to eqn(1) and groff(1). Then,
+	# setup the pipeline of commands based on the user's request.
+
+	# Apparently the locale flags are switched on where the manpage is
+	# found not just the locale env variables.
+	nroff_dev="ascii"
+	case "X${use_locale}X${manpage}" in
+	XyesX*/${man_lang}*${man_charset}/*)
+		# I don't pretend to know this; I'm just copying from the
+		# previous version of man(1).
+		case "$man_charset" in
+		KOI8-R)		nroff_dev="koi8-r" ;;
+		ISO8859-1)	nroff_dev="latin1" ;;
+		ISO8859-15)	nroff_dev="latin1" ;;
+		UTF-8)		nroff_dev="utf8" ;;
+		*)		nroff_dev="ascii" ;;
+		esac
+
+		NROFF="$NROFF -T$nroff_dev -dlocale=$man_lang.$man_charset"
+		EQN="$EQN -T$nroff_dev"
+
+		# Allow language specific calls to override the default
+		# set of utilities.
+		l=$(echo $man_lang | tr [:lower:] [:upper:])
+		for tool in EQN COL NROFF PIC TBL TROFF REFER VGRIND; do
+			eval "$tool=\${${tool}_$l:-\$$tool}"
+		done
+		;;
+	*)	NROFF="$NROFF -Tascii"
+		EQN="$EQN -Tascii"
+		;;
+	esac
+
+	if [ -n "$MANROFFSEQ" ]; then
+		set -- -$MANROFFSEQ
+		while getopts 'egprtv' preproc_arg; do
+			case "${preproc_arg}" in
+			e)	pipeline="$pipeline | $EQN" ;;
+			g)	;; # Ignore for compatability.
+			p)	pipeline="$pipeline | $PIC" ;;
+			r)	pipeline="$pipeline | $REFER" ;;
+			t)	pipeline="$pipeline | $TBL"; use_col=yes ;;
+			v)	pipeline="$pipeline | $VGRIND" ;;
+			*)	usage ;;
+			esac
+		done
+		# Strip the leading " | " from the resulting pipeline.
+		pipeline="${pipeline#" | "}"
+	else
+		pipeline="$TBL"
+		use_col=yes
+	fi
+
+	if [ -n "$tflag" ]; then
+		pipeline="$pipeline | $TROFF"
+	else
+		pipeline="$pipeline | $NROFF"
+
+		if [ -n "$use_col" ]; then
+			pipeline="$pipeline | $COL"
+		fi
+
+		pipeline="$pipeline | $PAGER"
+	fi
+
+	if [ $debug -gt 0 ]; then
+		decho "Command: $ZCAT $manpage | $pipeline"
+		ret=0
+	else
+		eval "$ZCAT $manpage | $pipeline"
+		ret=$?
+	fi
+}
+
+# Usage: man_find_and_display page
+# Search through the manpaths looking for the given page.
+man_find_and_display() {
+	local found_page locpath p path sect
+
+	IFS=:
+	for sect in $MANSECT; do
+		decho "Searching section $sect" 2
+		for path in $MANPATH; do
+			for locpath in $locpaths; do
+				p=$path/$locpath
+				p=${p%/.} # Rid ourselves of the trailing /.
+
+				# Check if there is a MACHINE specific manpath.
+				if find_file $p $sect $MACHINE "$1"; then
+					found_page=yes
+					man_display_page
+					if [ -z "$aflag" ]; then
+						return
+					fi
+				fi
+
+				# Check if there is a MACHINE_ARCH
+				# specific manpath.
+				if find_file $p $sect $MACHINE_ARCH "$1"; then
+					found_page=yes
+					man_display_page
+					if [ -z "$aflag" ]; then
+						return
+					fi
+				fi
+
+				# Check plain old manpath.
+				if find_file $p $sect '' "$1"; then
+					found_page=yes
+					man_display_page
+					if [ -z "$aflag" ]; then
+						return
+					fi
+				fi
+			done
+		done
+	done
+	unset IFS
+
+	# Nothing? Well, we are done then.
+	if [ -z "$found_page" ]; then
+		echo "No manual entry for $1" >&2
+		ret=1
+		return
+	fi
+}
+
+# Usage: man_parse_args "$@"
+# Parses commandline options for man.
+man_parse_args() {
+	local IFS cmd_arg
+
+	while getopts 'M:P:S:adfhkm:op:tw' cmd_arg; do
+		case "${cmd_arg}" in
+		M)	MANPATH=$OPTARG ;;
+		P)	PAGER=$OPTARG ;;
+		S)	MANSECT=$OPTARG ;;
+		a)	aflag=aflag ;;
+		d)	debug=$(( $debug + 1 )) ;;
+		f)	fflag=fflag ;;
+		h)	man_usage 0 ;;
+		k)	kflag=kflag ;;
+		m)	mflag=$OPTARG ;;
+		o)	oflag=oflag ;;
+		p)	MANROFFSEQ=$OPTARG ;;
+		t)	tflag=tflag ;;
+		w)	wflag=wflag ;;
+		*)	man_usage ;;
+		esac
+	done >&2
+
+	shift $(( $OPTIND - 1 ))
+
+	# Check the args for incompatible options.
+	case "${fflag}${kflag}${tflag}${wflag}" in
+	fflagkflag*)	echo "Incompatible options: -f and -k"; man_usage ;;
+	fflag*tflag*)	echo "Incompatible options: -f and -t"; man_usage ;;
+	fflag*wflag)	echo "Incompatible options: -f and -w"; man_usage ;;
+	*kflagtflag*)	echo "Incompatible options: -k and -t"; man_usage ;;
+	*kflag*wflag)	echo "Incompatible options: -k and -w"; man_usage ;;
+	*tflagwflag)	echo "Incompatible options: -t and -w"; man_usage ;;
+	esac
+
+	# Short circuit for whatis(1) and apropos(1)
+	if [ -n "$fflag" ]; then
+		do_whatis "$@"

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

From owner-svn-src-head@FreeBSD.ORG  Fri Oct  1 06:12:13 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C7528106566C;
	Fri,  1 Oct 2010 06:12:13 +0000 (UTC)
	(envelope-from lulf@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 9C8228FC0C;
	Fri,  1 Oct 2010 06:12: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 o916CDHY093077;
	Fri, 1 Oct 2010 06:12:13 GMT (envelope-from lulf@svn.freebsd.org)
Received: (from lulf@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o916CDcL093074;
	Fri, 1 Oct 2010 06:12:13 GMT (envelope-from lulf@svn.freebsd.org)
Message-Id: <201010010612.o916CDcL093074@svn.freebsd.org>
From: Ulf Lilleengen 
Date: Fri, 1 Oct 2010 06:12:13 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r213318 - head/sys/geom/vinum
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 01 Oct 2010 06:12:13 -0000

Author: lulf
Date: Fri Oct  1 06:12:13 2010
New Revision: 213318
URL: http://svn.freebsd.org/changeset/base/213318

Log:
  - Check flag with the bitwise operator, not the logical operator.
  
  Submitted by:	arundel
  MFC after:	1 week

Modified:
  head/sys/geom/vinum/geom_vinum_move.c
  head/sys/geom/vinum/geom_vinum_rename.c

Modified: head/sys/geom/vinum/geom_vinum_move.c
==============================================================================
--- head/sys/geom/vinum/geom_vinum_move.c	Fri Oct  1 03:59:18 2010	(r213317)
+++ head/sys/geom/vinum/geom_vinum_move.c	Fri Oct  1 06:12:13 2010	(r213318)
@@ -115,13 +115,13 @@ gv_move_sd(struct gv_softc *sc, struct g
 
 	if ((gv_consumer_is_open(d->consumer) ||
 	    gv_consumer_is_open(destination->consumer)) &&
-	    !(flags && GV_FLAG_F)) {
+	    !(flags & GV_FLAG_F)) {
 		G_VINUM_DEBUG(0, "consumers on current and destination drive "
 		    " still open");
 		return (GV_ERR_ISBUSY);
 	}
 
-	if (!(flags && GV_FLAG_F)) {
+	if (!(flags & GV_FLAG_F)) {
 		G_VINUM_DEBUG(1, "-f flag not passed; move would be "
 		    "destructive");
 		return (GV_ERR_INVFLAG);

Modified: head/sys/geom/vinum/geom_vinum_rename.c
==============================================================================
--- head/sys/geom/vinum/geom_vinum_rename.c	Fri Oct  1 03:59:18 2010	(r213317)
+++ head/sys/geom/vinum/geom_vinum_rename.c	Fri Oct  1 06:12:13 2010	(r213318)
@@ -173,7 +173,7 @@ gv_rename_plex(struct gv_softc *sc, stru
 	/* Fix up references and potentially rename subdisks. */
 	LIST_FOREACH(s, &p->subdisks, in_plex) {
 		strlcpy(s->plex, p->name, sizeof(s->plex));
-		if (flags && GV_FLAG_R) {
+		if (flags & GV_FLAG_R) {
 			/*
 			 * Look for the two last dots in the string, and assume
 			 * that the old value was ok.
@@ -243,7 +243,7 @@ gv_rename_vol(struct gv_softc *sc, struc
 	/* Fix up references and potentially rename plexes. */
 	LIST_FOREACH(p, &v->plexes, in_volume) {
 		strlcpy(p->volume, v->name, sizeof(p->volume));
-		if (flags && GV_FLAG_R) {
+		if (flags & GV_FLAG_R) {
 			/*
 			 * Look for the last dot in the string, and assume that
 			 * the old value was ok.

From owner-svn-src-head@FreeBSD.ORG  Fri Oct  1 09:18:31 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 142131065670;
	Fri,  1 Oct 2010 09:18:30 +0000 (UTC)
	(envelope-from adrian@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id B58728FC0A;
	Fri,  1 Oct 2010 09:18:30 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o919IU9o097003;
	Fri, 1 Oct 2010 09:18:30 GMT (envelope-from adrian@svn.freebsd.org)
Received: (from adrian@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o919IU3Q097001;
	Fri, 1 Oct 2010 09:18:30 GMT (envelope-from adrian@svn.freebsd.org)
Message-Id: <201010010918.o919IU3Q097001@svn.freebsd.org>
From: Adrian Chadd 
Date: Fri, 1 Oct 2010 09:18:30 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r213321 - head/sys/net80211
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 01 Oct 2010 09:18:31 -0000

Author: adrian
Date: Fri Oct  1 09:18:30 2010
New Revision: 213321
URL: http://svn.freebsd.org/changeset/base/213321

Log:
  Fix background roaming to actually work in AUTO roaming mode.
  
  IEEE80211_F_BGSCAN is a vap flag, not a channel flag. So although bgscan
  occured, sta_roam_check() would never be called.

Modified:
  head/sys/net80211/ieee80211_scan_sta.c

Modified: head/sys/net80211/ieee80211_scan_sta.c
==============================================================================
--- head/sys/net80211/ieee80211_scan_sta.c	Fri Oct  1 07:59:26 2010	(r213320)
+++ head/sys/net80211/ieee80211_scan_sta.c	Fri Oct  1 09:18:30 2010	(r213321)
@@ -1361,7 +1361,7 @@ sta_age(struct ieee80211_scan_state *ss)
 	KASSERT(vap->iv_opmode == IEEE80211_M_STA,
 		("wrong mode %u", vap->iv_opmode));
 	if (vap->iv_roaming == IEEE80211_ROAMING_AUTO &&
-	    (vap->iv_ic->ic_flags & IEEE80211_F_BGSCAN) &&
+	    (vap->iv_flags & IEEE80211_F_BGSCAN) &&
 	    vap->iv_state >= IEEE80211_S_RUN)
 		/* XXX vap is implicit */
 		sta_roam_check(ss, vap);

From owner-svn-src-head@FreeBSD.ORG  Fri Oct  1 09:34:41 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E713F1065693;
	Fri,  1 Oct 2010 09:34:41 +0000 (UTC) (envelope-from avg@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id D76338FC0A;
	Fri,  1 Oct 2010 09:34: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 o919Yf6f097351;
	Fri, 1 Oct 2010 09:34:41 GMT (envelope-from avg@svn.freebsd.org)
Received: (from avg@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o919YfCB097349;
	Fri, 1 Oct 2010 09:34:41 GMT (envelope-from avg@svn.freebsd.org)
Message-Id: <201010010934.o919YfCB097349@svn.freebsd.org>
From: Andriy Gapon 
Date: Fri, 1 Oct 2010 09:34:41 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r213322 - head/sys/kern
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 01 Oct 2010 09:34:42 -0000

Author: avg
Date: Fri Oct  1 09:34:41 2010
New Revision: 213322
URL: http://svn.freebsd.org/changeset/base/213322

Log:
  sysctls in kern_shutdown: add twin tunables
  
  also make couple of sysctl-controlled variables static
  
  Reviewed by:	rwatson
  MFC after:	1 week

Modified:
  head/sys/kern/kern_shutdown.c

Modified: head/sys/kern/kern_shutdown.c
==============================================================================
--- head/sys/kern/kern_shutdown.c	Fri Oct  1 09:18:30 2010	(r213321)
+++ head/sys/kern/kern_shutdown.c	Fri Oct  1 09:34:41 2010	(r213322)
@@ -98,21 +98,24 @@ int debugger_on_panic = 0;
 #else
 int debugger_on_panic = 1;
 #endif
-SYSCTL_INT(_debug, OID_AUTO, debugger_on_panic, CTLFLAG_RW,
+SYSCTL_INT(_debug, OID_AUTO, debugger_on_panic, CTLFLAG_RW | CTLFLAG_TUN,
 	&debugger_on_panic, 0, "Run debugger on kernel panic");
+TUNABLE_INT("debug.debugger_on_panic", &debugger_on_panic);
 
 #ifdef KDB_TRACE
-int trace_on_panic = 1;
+static int trace_on_panic = 1;
 #else
-int trace_on_panic = 0;
+static int trace_on_panic = 0;
 #endif
-SYSCTL_INT(_debug, OID_AUTO, trace_on_panic, CTLFLAG_RW,
+SYSCTL_INT(_debug, OID_AUTO, trace_on_panic, CTLFLAG_RW | CTLFLAG_TUN,
 	&trace_on_panic, 0, "Print stack trace on kernel panic");
+TUNABLE_INT("debug.trace_on_panic", &trace_on_panic);
 #endif /* KDB */
 
-int sync_on_panic = 0;
-SYSCTL_INT(_kern, OID_AUTO, sync_on_panic, CTLFLAG_RW,
+static int sync_on_panic = 0;
+SYSCTL_INT(_kern, OID_AUTO, sync_on_panic, CTLFLAG_RW | CTLFLAG_TUN,
 	&sync_on_panic, 0, "Do a sync before rebooting from a panic");
+TUNABLE_INT("kern.sync_on_panic", &sync_on_panic);
 
 SYSCTL_NODE(_kern, OID_AUTO, shutdown, CTLFLAG_RW, 0, "Shutdown environment");
 

From owner-svn-src-head@FreeBSD.ORG  Fri Oct  1 10:32:54 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B7C90106566C;
	Fri,  1 Oct 2010 10:32:54 +0000 (UTC) (envelope-from avg@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id A62328FC13;
	Fri,  1 Oct 2010 10:32: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 o91AWscm099655;
	Fri, 1 Oct 2010 10:32:54 GMT (envelope-from avg@svn.freebsd.org)
Received: (from avg@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o91AWswF099652;
	Fri, 1 Oct 2010 10:32:54 GMT (envelope-from avg@svn.freebsd.org)
Message-Id: <201010011032.o91AWswF099652@svn.freebsd.org>
From: Andriy Gapon 
Date: Fri, 1 Oct 2010 10:32:54 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r213323 - in head/sys: amd64/amd64 i386/i386
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 01 Oct 2010 10:32:54 -0000

Author: avg
Date: Fri Oct  1 10:32:54 2010
New Revision: 213323
URL: http://svn.freebsd.org/changeset/base/213323

Log:
  i386 and amd64 mp_machdep: improve topology detection for Intel CPUs
  
  This patch is significantly based on previous work by jkim.
  List of changes:
  - added comments that describe topology uniformity assumption
  - added reference to Intel Processor Topology Enumeration article
  - documented a few global variables that describe topology
  - retired weirdly set and used logical_cpus variable
  - changed fallback code for mp_ncpus > 0 case, so that CPUs are treated
    as being different packages rather than cores in a single package
  - moved AMD-specific code to topo_probe_amd [jkim]
  - in topo_probe_0x4() follow Intel-prescribed procedure of deriving SMT
    and core masks and match APIC IDs against those masks [started by
    jkim]
  - in topo_probe_0x4() drop code for double-checking topology parameters
    by looking at L1 cache properties [jkim]
  - in topo_probe_0xb() add fallback path to topo_probe_0x4() as
    prescribed by Intel [jkim]
  
  Still to do:
  - prepare for upcoming AMD CPUs by using new mechanism of uniform
    topology description [pointed by jkim]
  - probe cache topology in addition to CPU topology and probably use that
    for scheduler affinity topology; e.g. Core2 Duo and Athlon II X2 have
    the same CPU topology, but Athlon cores do not share L2 cache while
    Core2's do (no L3 cache in both cases)
  - think of supporting non-uniform topologies if they are ever
    implemented for platforms in question
  - think how to better described old HTT vs new HTT distinction, HTT vs
    SMT can be confusing as SMT is a generic term
  - more robust code for marking CPUs as "logical" and/or "hyperthreaded",
    use HTT mask instead of modulo operation
  - correct support for halting logical and/or hyperthreaded CPUs, let
    scheduler know that it shouldn't schedule any threads on those CPUs
  
  PR:			kern/145385 (related)
  In collaboration with:	jkim
  Tested by:		Sergey Kandaurov ,
  			Jeremy Chadwick ,
  			Chip Camden ,
  			Steve Wills ,
  			Olivier Smedts ,
  			Florian Smeets 
  MFC after:		1 month

Modified:
  head/sys/amd64/amd64/mp_machdep.c
  head/sys/i386/i386/mp_machdep.c

Modified: head/sys/amd64/amd64/mp_machdep.c
==============================================================================
--- head/sys/amd64/amd64/mp_machdep.c	Fri Oct  1 09:34:41 2010	(r213322)
+++ head/sys/amd64/amd64/mp_machdep.c	Fri Oct  1 10:32:54 2010	(r213323)
@@ -126,7 +126,6 @@ extern inthand_t IDTVEC(fast_syscall), I
  * Local data and functions.
  */
 
-static u_int logical_cpus;
 static volatile cpumask_t ipi_nmi_pending;
 
 /* used to hold the AP's until we are ready to release them */
@@ -152,8 +151,8 @@ int apic_cpuids[MAX_APIC_ID + 1];
 static volatile u_int cpu_ipi_pending[MAXCPU];
 
 static u_int boot_address;
-static int cpu_logical;
-static int cpu_cores;
+static int cpu_logical;			/* logical cpus per core */
+static int cpu_cores;			/* cores per package */
 
 static void	assign_cpu_ids(void);
 static void	set_interrupt_apic_ids(void);
@@ -162,7 +161,7 @@ static int	start_ap(int apic_id);
 static void	release_aps(void *dummy);
 
 static int	hlt_logical_cpus;
-static u_int	hyperthreading_cpus;
+static u_int	hyperthreading_cpus;	/* logical cpus sharing L1 cache */
 static cpumask_t	hyperthreading_cpus_mask;
 static int	hyperthreading_allowed = 1;
 static struct	sysctl_ctx_list logical_cpu_clist;
@@ -176,24 +175,105 @@ mem_range_AP_init(void)
 }
 
 static void
+topo_probe_amd(void)
+{
+
+	/* AMD processors do not support HTT. */
+	cpu_cores = (amd_feature2 & AMDID2_CMP) != 0 ?
+	    (cpu_procinfo2 & AMDID_CMP_CORES) + 1 : 1;
+	cpu_logical = 1;
+}
+
+/*
+ * Round up to the next power of two, if necessary, and then
+ * take log2.
+ * Returns -1 if argument is zero.
+ */
+static __inline int
+mask_width(u_int x)
+{
+
+	return (fls(x << (1 - powerof2(x))) - 1);
+}
+
+static void
+topo_probe_0x4(void)
+{
+	u_int p[4];
+	int pkg_id_bits;
+	int core_id_bits;
+	int max_cores;
+	int max_logical;
+	int id;
+
+	/* Both zero and one here mean one logical processor per package. */
+	max_logical = (cpu_feature & CPUID_HTT) != 0 ?
+	    (cpu_procinfo & CPUID_HTT_CORES) >> 16 : 1;
+	if (max_logical <= 1)
+		return;
+
+	/*
+	 * Because of uniformity assumption we examine only
+	 * those logical processors that belong to the same
+	 * package as BSP.  Further, we count number of
+	 * logical processors that belong to the same core
+	 * as BSP thus deducing number of threads per core.
+	 */
+	cpuid_count(0x04, 0, p);
+	max_cores = ((p[0] >> 26) & 0x3f) + 1;
+	core_id_bits = mask_width(max_logical/max_cores);
+	if (core_id_bits < 0)
+		return;
+	pkg_id_bits = core_id_bits + mask_width(max_cores);
+
+	for (id = 0; id <= MAX_APIC_ID; id++) {
+		/* Check logical CPU availability. */
+		if (!cpu_info[id].cpu_present || cpu_info[id].cpu_disabled)
+			continue;
+		/* Check if logical CPU has the same package ID. */
+		if ((id >> pkg_id_bits) != (boot_cpu_id >> pkg_id_bits))
+			continue;
+		cpu_cores++;
+		/* Check if logical CPU has the same package and core IDs. */
+		if ((id >> core_id_bits) == (boot_cpu_id >> core_id_bits))
+			cpu_logical++;
+	}
+
+	cpu_cores /= cpu_logical;
+	hyperthreading_cpus = cpu_logical;
+}
+
+static void
 topo_probe_0xb(void)
 {
-	int logical;
-	int p[4];
+	u_int p[4];
 	int bits;
-	int type;
 	int cnt;
 	int i;
+	int logical;
+	int type;
 	int x;
 
-	/* We only support two levels for now. */
+	/* We only support three levels for now. */
 	for (i = 0; i < 3; i++) {
-		cpuid_count(0x0B, i, p);
+		cpuid_count(0x0b, i, p);
+
+		/* Fall back if CPU leaf 11 doesn't really exist. */
+		if (i == 0 && p[1] == 0) {
+			topo_probe_0x4();
+			return;
+		}
+
 		bits = p[0] & 0x1f;
 		logical = p[1] &= 0xffff;
 		type = (p[2] >> 8) & 0xff;
 		if (type == 0 || logical == 0)
 			break;
+		/*
+		 * Because of uniformity assumption we examine only
+		 * those logical processors that belong to the same
+		 * package as BSP.
+		 */
 		for (cnt = 0, x = 0; x <= MAX_APIC_ID; x++) {
 			if (!cpu_info[x].cpu_present ||
 			    cpu_info[x].cpu_disabled)
@@ -211,76 +291,16 @@ topo_probe_0xb(void)
 	cpu_cores /= cpu_logical;
 }
 
-static void
-topo_probe_0x4(void)
-{
-	u_int threads_per_cache, p[4];
-	u_int htt, cmp;
-	int i;
-
-	htt = cmp = 1;
-	/*
-	 * If this CPU supports HTT or CMP then mention the
-	 * number of physical/logical cores it contains.
-	 */
-	if (cpu_feature & CPUID_HTT)
-		htt = (cpu_procinfo & CPUID_HTT_CORES) >> 16;
-	if (cpu_vendor_id == CPU_VENDOR_AMD && (amd_feature2 & AMDID2_CMP))
-		cmp = (cpu_procinfo2 & AMDID_CMP_CORES) + 1;
-	else if (cpu_vendor_id == CPU_VENDOR_INTEL && (cpu_high >= 4)) {
-		cpuid_count(4, 0, p);
-		if ((p[0] & 0x1f) != 0)
-			cmp = ((p[0] >> 26) & 0x3f) + 1;
-	}
-	cpu_cores = cmp;
-	cpu_logical = htt / cmp;
-
-	/* Setup the initial logical CPUs info. */
-	if (cpu_feature & CPUID_HTT)
-		logical_cpus = (cpu_procinfo & CPUID_HTT_CORES) >> 16;
-
-	/*
-	 * Work out if hyperthreading is *really* enabled.  This
-	 * is made really ugly by the fact that processors lie: Dual
-	 * core processors claim to be hyperthreaded even when they're
-	 * not, presumably because they want to be treated the same
-	 * way as HTT with respect to per-cpu software licensing.
-	 * At the time of writing (May 12, 2005) the only hyperthreaded
-	 * cpus are from Intel, and Intel's dual-core processors can be
-	 * identified via the "deterministic cache parameters" cpuid
-	 * calls.
-	 */
-	/*
-	 * First determine if this is an Intel processor which claims
-	 * to have hyperthreading support.
-	 */
-	if ((cpu_feature & CPUID_HTT) && cpu_vendor_id == CPU_VENDOR_INTEL) {
-		/*
-		 * If the "deterministic cache parameters" cpuid calls
-		 * are available, use them.
-		 */
-		if (cpu_high >= 4) {
-			/* Ask the processor about the L1 cache. */
-			for (i = 0; i < 1; i++) {
-				cpuid_count(4, i, p);
-				threads_per_cache = ((p[0] & 0x3ffc000) >> 14) + 1;
-				if (hyperthreading_cpus < threads_per_cache)
-					hyperthreading_cpus = threads_per_cache;
-				if ((p[0] & 0x1f) == 0)
-					break;
-			}
-		}
-
-		/*
-		 * If the deterministic cache parameters are not
-		 * available, or if no caches were reported to exist,
-		 * just accept what the HTT flag indicated.
-		 */
-		if (hyperthreading_cpus == 0)
-			hyperthreading_cpus = logical_cpus;
-	}
-}
-
+/*
+ * Both topology discovery code and code that consumes topology
+ * information assume top-down uniformity of the topology.
+ * That is, all physical packages must be identical and each
+ * core in a package must have the same number of threads.
+ * Topology information is queried only on BSP, on which this
+ * code runs and for which it can query CPUID information.
+ * Then topology is extrapolated on all packages using the
+ * uniformity assumption.
+ */
 static void
 topo_probe(void)
 {
@@ -289,13 +309,31 @@ topo_probe(void)
 	if (cpu_topo_probed)
 		return;
 
-	logical_cpus = logical_cpus_mask = 0;
-	if (cpu_high >= 0xb)
-		topo_probe_0xb();
-	else if (cpu_high)
-		topo_probe_0x4();
+	logical_cpus_mask = 0;
+	if (cpu_vendor_id == CPU_VENDOR_AMD)
+		topo_probe_amd();
+	else if (cpu_vendor_id == CPU_VENDOR_INTEL) {
+		/*
+		 * See Intel(R) 64 Architecture Processor
+		 * Topology Enumeration article for details.
+		 *
+		 * Note that 0x1 <= cpu_high < 4 case should be
+		 * compatible with topo_probe_0x4() logic when
+		 * CPUID.1:EBX[23:16] > 0 (cpu_cores will be 1)
+		 * or it should trigger the fallback otherwise.
+		 */
+		if (cpu_high >= 0xb)
+			topo_probe_0xb();
+		else if (cpu_high >= 0x1)
+			topo_probe_0x4();
+	}
+
+	/*
+	 * Fallback: assume each logical CPU is in separate
+	 * physical package.  That is, no multi-core, no SMT.
+	 */
 	if (cpu_cores == 0)
-		cpu_cores = mp_ncpus > 0 ? mp_ncpus : 1;
+		cpu_cores = 1;
 	if (cpu_logical == 0)
 		cpu_logical = 1;
 	cpu_topo_probed = 1;
@@ -675,7 +713,8 @@ init_secondary(void)
 	printf("SMP: AP CPU #%d Launched!\n", PCPU_GET(cpuid));
 
 	/* Determine if we are a logical CPU. */
-	if (logical_cpus > 1 && PCPU_GET(apic_id) % logical_cpus != 0)
+	/* XXX Calculation depends on cpu_logical being a power of 2, e.g. 2 */
+	if (cpu_logical > 1 && PCPU_GET(apic_id) % cpu_logical != 0)
 		logical_cpus_mask |= PCPU_GET(cpumask);
 	
 	/* Determine if we are a hyperthread. */

Modified: head/sys/i386/i386/mp_machdep.c
==============================================================================
--- head/sys/i386/i386/mp_machdep.c	Fri Oct  1 09:34:41 2010	(r213322)
+++ head/sys/i386/i386/mp_machdep.c	Fri Oct  1 10:32:54 2010	(r213323)
@@ -173,7 +173,6 @@ static u_long *ipi_hardclock_counts[MAXC
  * Local data and functions.
  */
 
-static u_int logical_cpus;
 static volatile cpumask_t ipi_nmi_pending;
 
 /* used to hold the AP's until we are ready to release them */
@@ -199,8 +198,8 @@ int apic_cpuids[MAX_APIC_ID + 1];
 static volatile u_int cpu_ipi_pending[MAXCPU];
 
 static u_int boot_address;
-static int cpu_logical;
-static int cpu_cores;
+static int cpu_logical;			/* logical cpus per core */
+static int cpu_cores;			/* cores per package */
 
 static void	assign_cpu_ids(void);
 static void	install_ap_tramp(void);
@@ -210,7 +209,7 @@ static int	start_ap(int apic_id);
 static void	release_aps(void *dummy);
 
 static int	hlt_logical_cpus;
-static u_int	hyperthreading_cpus;
+static u_int	hyperthreading_cpus;	/* logical cpus sharing L1 cache */
 static cpumask_t	hyperthreading_cpus_mask;
 static int	hyperthreading_allowed = 1;
 static struct	sysctl_ctx_list logical_cpu_clist;
@@ -223,24 +222,105 @@ mem_range_AP_init(void)
 }
 
 static void
+topo_probe_amd(void)
+{
+
+	/* AMD processors do not support HTT. */
+	cpu_cores = (amd_feature2 & AMDID2_CMP) != 0 ?
+	    (cpu_procinfo2 & AMDID_CMP_CORES) + 1 : 1;
+	cpu_logical = 1;
+}
+
+/*
+ * Round up to the next power of two, if necessary, and then
+ * take log2.
+ * Returns -1 if argument is zero.
+ */
+static __inline int
+mask_width(u_int x)
+{
+
+	return (fls(x << (1 - powerof2(x))) - 1);
+}
+
+static void
+topo_probe_0x4(void)
+{
+	u_int p[4];
+	int pkg_id_bits;
+	int core_id_bits;
+	int max_cores;
+	int max_logical;
+	int id;
+
+	/* Both zero and one here mean one logical processor per package. */
+	max_logical = (cpu_feature & CPUID_HTT) != 0 ?
+	    (cpu_procinfo & CPUID_HTT_CORES) >> 16 : 1;
+	if (max_logical <= 1)
+		return;
+
+	/*
+	 * Because of uniformity assumption we examine only
+	 * those logical processors that belong to the same
+	 * package as BSP.  Further, we count number of
+	 * logical processors that belong to the same core
+	 * as BSP thus deducing number of threads per core.
+	 */
+	cpuid_count(0x04, 0, p);
+	max_cores = ((p[0] >> 26) & 0x3f) + 1;
+	core_id_bits = mask_width(max_logical/max_cores);
+	if (core_id_bits < 0)
+		return;
+	pkg_id_bits = core_id_bits + mask_width(max_cores);
+
+	for (id = 0; id <= MAX_APIC_ID; id++) {
+		/* Check logical CPU availability. */
+		if (!cpu_info[id].cpu_present || cpu_info[id].cpu_disabled)
+			continue;
+		/* Check if logical CPU has the same package ID. */
+		if ((id >> pkg_id_bits) != (boot_cpu_id >> pkg_id_bits))
+			continue;
+		cpu_cores++;
+		/* Check if logical CPU has the same package and core IDs. */
+		if ((id >> core_id_bits) == (boot_cpu_id >> core_id_bits))
+			cpu_logical++;
+	}
+
+	cpu_cores /= cpu_logical;
+	hyperthreading_cpus = cpu_logical;
+}
+
+static void
 topo_probe_0xb(void)
 {
-	int logical;
-	int p[4];
+	u_int p[4];
 	int bits;
-	int type;
 	int cnt;
 	int i;
+	int logical;
+	int type;
 	int x;
 
-	/* We only support two levels for now. */
+	/* We only support three levels for now. */
 	for (i = 0; i < 3; i++) {
-		cpuid_count(0x0B, i, p);
+		cpuid_count(0x0b, i, p);
+
+		/* Fall back if CPU leaf 11 doesn't really exist. */
+		if (i == 0 && p[1] == 0) {
+			topo_probe_0x4();
+			return;
+		}
+
 		bits = p[0] & 0x1f;
 		logical = p[1] &= 0xffff;
 		type = (p[2] >> 8) & 0xff;
 		if (type == 0 || logical == 0)
 			break;
+		/*
+		 * Because of uniformity assumption we examine only
+		 * those logical processors that belong to the same
+		 * package as BSP.
+		 */
 		for (cnt = 0, x = 0; x <= MAX_APIC_ID; x++) {
 			if (!cpu_info[x].cpu_present ||
 			    cpu_info[x].cpu_disabled)
@@ -258,76 +338,16 @@ topo_probe_0xb(void)
 	cpu_cores /= cpu_logical;
 }
 
-static void
-topo_probe_0x4(void)
-{
-	u_int threads_per_cache, p[4];
-	u_int htt, cmp;
-	int i;
-
-	htt = cmp = 1;
-	/*
-	 * If this CPU supports HTT or CMP then mention the
-	 * number of physical/logical cores it contains.
-	 */
-	if (cpu_feature & CPUID_HTT)
-		htt = (cpu_procinfo & CPUID_HTT_CORES) >> 16;
-	if (cpu_vendor_id == CPU_VENDOR_AMD && (amd_feature2 & AMDID2_CMP))
-		cmp = (cpu_procinfo2 & AMDID_CMP_CORES) + 1;
-	else if (cpu_vendor_id == CPU_VENDOR_INTEL && (cpu_high >= 4)) {
-		cpuid_count(4, 0, p);
-		if ((p[0] & 0x1f) != 0)
-			cmp = ((p[0] >> 26) & 0x3f) + 1;
-	}
-	cpu_cores = cmp;
-	cpu_logical = htt / cmp;
-
-	/* Setup the initial logical CPUs info. */
-	if (cpu_feature & CPUID_HTT)
-		logical_cpus = (cpu_procinfo & CPUID_HTT_CORES) >> 16;
-
-	/*
-	 * Work out if hyperthreading is *really* enabled.  This
-	 * is made really ugly by the fact that processors lie: Dual
-	 * core processors claim to be hyperthreaded even when they're
-	 * not, presumably because they want to be treated the same
-	 * way as HTT with respect to per-cpu software licensing.
-	 * At the time of writing (May 12, 2005) the only hyperthreaded
-	 * cpus are from Intel, and Intel's dual-core processors can be
-	 * identified via the "deterministic cache parameters" cpuid
-	 * calls.
-	 */
-	/*
-	 * First determine if this is an Intel processor which claims
-	 * to have hyperthreading support.
-	 */
-	if ((cpu_feature & CPUID_HTT) && cpu_vendor_id == CPU_VENDOR_INTEL) {
-		/*
-		 * If the "deterministic cache parameters" cpuid calls
-		 * are available, use them.
-		 */
-		if (cpu_high >= 4) {
-			/* Ask the processor about the L1 cache. */
-			for (i = 0; i < 1; i++) {
-				cpuid_count(4, i, p);
-				threads_per_cache = ((p[0] & 0x3ffc000) >> 14) + 1;
-				if (hyperthreading_cpus < threads_per_cache)
-					hyperthreading_cpus = threads_per_cache;
-				if ((p[0] & 0x1f) == 0)
-					break;
-			}
-		}
-
-		/*
-		 * If the deterministic cache parameters are not
-		 * available, or if no caches were reported to exist,
-		 * just accept what the HTT flag indicated.
-		 */
-		if (hyperthreading_cpus == 0)
-			hyperthreading_cpus = logical_cpus;
-	}
-}
-
+/*
+ * Both topology discovery code and code that consumes topology
+ * information assume top-down uniformity of the topology.
+ * That is, all physical packages must be identical and each
+ * core in a package must have the same number of threads.
+ * Topology information is queried only on BSP, on which this
+ * code runs and for which it can query CPUID information.
+ * Then topology is extrapolated on all packages using the
+ * uniformity assumption.
+ */
 static void
 topo_probe(void)
 {
@@ -336,13 +356,31 @@ topo_probe(void)
 	if (cpu_topo_probed)
 		return;
 
-	logical_cpus = logical_cpus_mask = 0;
-	if (cpu_high >= 0xb)
-		topo_probe_0xb();
-	else if (cpu_high)
-		topo_probe_0x4();
+	logical_cpus_mask = 0;
+	if (cpu_vendor_id == CPU_VENDOR_AMD)
+		topo_probe_amd();
+	else if (cpu_vendor_id == CPU_VENDOR_INTEL) {
+		/*
+		 * See Intel(R) 64 Architecture Processor
+		 * Topology Enumeration article for details.
+		 *
+		 * Note that 0x1 <= cpu_high < 4 case should be
+		 * compatible with topo_probe_0x4() logic when
+		 * CPUID.1:EBX[23:16] > 0 (cpu_cores will be 1)
+		 * or it should trigger the fallback otherwise.
+		 */
+		if (cpu_high >= 0xb)
+			topo_probe_0xb();
+		else if (cpu_high >= 0x1)
+			topo_probe_0x4();
+	}
+
+	/*
+	 * Fallback: assume each logical CPU is in separate
+	 * physical package.  That is, no multi-core, no SMT.
+	 */
 	if (cpu_cores == 0)
-		cpu_cores = mp_ncpus > 0 ? mp_ncpus : 1;
+		cpu_cores = 1;
 	if (cpu_logical == 0)
 		cpu_logical = 1;
 	cpu_topo_probed = 1;
@@ -706,7 +744,8 @@ init_secondary(void)
 	printf("SMP: AP CPU #%d Launched!\n", PCPU_GET(cpuid));
 
 	/* Determine if we are a logical CPU. */
-	if (logical_cpus > 1 && PCPU_GET(apic_id) % logical_cpus != 0)
+	/* XXX Calculation depends on cpu_logical being a power of 2, e.g. 2 */
+	if (cpu_logical > 1 && PCPU_GET(apic_id) % cpu_logical != 0)
 		logical_cpus_mask |= PCPU_GET(cpumask);
 	
 	/* Determine if we are a hyperthread. */

From owner-svn-src-head@FreeBSD.ORG  Fri Oct  1 10:34:36 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 5A8F01065673;
	Fri,  1 Oct 2010 10:34:36 +0000 (UTC) (envelope-from mr@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 4A1D08FC15;
	Fri,  1 Oct 2010 10:34: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 o91AYaAX099740;
	Fri, 1 Oct 2010 10:34:36 GMT (envelope-from mr@svn.freebsd.org)
Received: (from mr@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o91AYamm099735;
	Fri, 1 Oct 2010 10:34:36 GMT (envelope-from mr@svn.freebsd.org)
Message-Id: <201010011034.o91AYamm099735@svn.freebsd.org>
From: Michael Reifenberger 
Date: Fri, 1 Oct 2010 10:34:36 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r213324 - in head/tools/tools/nanobsd/rescue: . Pkg
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 01 Oct 2010 10:34:36 -0000

Author: mr
Date: Fri Oct  1 10:34:35 2010
New Revision: 213324
URL: http://svn.freebsd.org/changeset/base/213324

Log:
  - simplify by using one build script
  - use label for mounting
  - use GENERIC kernel
  - create empty Pkg directory

Added:
  head/tools/tools/nanobsd/rescue/Pkg/
  head/tools/tools/nanobsd/rescue/build.sh   (contents, props changed)
Deleted:
  head/tools/tools/nanobsd/rescue/AMD64
  head/tools/tools/nanobsd/rescue/I386
  head/tools/tools/nanobsd/rescue/isoamd64.sh
  head/tools/tools/nanobsd/rescue/isoi386.sh
Modified:
  head/tools/tools/nanobsd/rescue/common
  head/tools/tools/nanobsd/rescue/isoamd64.conf
  head/tools/tools/nanobsd/rescue/isoi386.conf

Added: head/tools/tools/nanobsd/rescue/build.sh
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/tools/tools/nanobsd/rescue/build.sh	Fri Oct  1 10:34:35 2010	(r213324)
@@ -0,0 +1,18 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+if [ -z "${1}" -o \! -f "${1}" ]; then
+  echo "Usage: $0 cfg_file [-bhiknw]"
+  echo "-i : skip image build"
+  echo "-w : skip buildworld step"
+  echo "-k : skip buildkernel step"
+  echo "-b : skip buildworld and buildkernel step"
+  exit
+fi
+
+CFG="${1}"
+shift;
+
+sh ../nanobsd.sh $* -c ${CFG}

Modified: head/tools/tools/nanobsd/rescue/common
==============================================================================
--- head/tools/tools/nanobsd/rescue/common	Fri Oct  1 10:32:54 2010	(r213323)
+++ head/tools/tools/nanobsd/rescue/common	Fri Oct  1 10:34:35 2010	(r213324)
@@ -5,6 +5,7 @@ NANO_TOOLS=`pwd`
 NANO_PACKAGE_DIR=`pwd`/Pkg
 NANO_RAM_TMPVARSIZE=20480
 NANO_PMAKE="make -j 8"
+NANO_LABEL="rescue"
 
 # Options to put in make.conf during buildworld only
 CONF_BUILD='
@@ -52,7 +53,7 @@ cust_etc_cfg () (
 	echo "keymap=\"german.iso\"" >> etc/rc.conf
 	echo "#ifconfig_fxp0=\"AUTO\"" >> etc/rc.conf
 	echo "#sshd_enable=\"YES\"" >> etc/rc.conf
-	echo "/dev/acd0 / cd9660 ro 0 0" > etc/fstab
+	echo "/dev/iso9660/${NANO_LABEL} / cd9660 ro,noatime 0 0" > etc/fstab
 	echo "tmpfs /tmp tmpfs rw,size=268435456,mode=1777 0 0" >> etc/fstab
 	echo "ports:/usr/ports /usr/ports nfs rw,noauto,noatime,bg,soft,intr,nfsv3 0 0" >> etc/fstab
 #	echo "/dev/ad1s1a /scratch ufs rw,noauto,noatime 0 0" >> etc/fstab
@@ -81,7 +82,16 @@ last_orders () (
 	touch conf/default/etc/.keepme
 	touch conf/default/var/.keepme
 	cd ..
-	mkisofs -quiet -r -J -no-emul-boot -b boot/cdboot -o _.disk.iso _.w/
+	mkisofs -quiet -r -J -no-emul-boot \
+	-V ${NANO_LABEL} \
+	-b boot/cdboot -o _.disk.iso _.w/
 	)
 )
 
+create_i386_diskimage () {
+	#currently not used
+}
+
+create_amd64_diskimage () {
+	create_i386_diskimage
+}

Modified: head/tools/tools/nanobsd/rescue/isoamd64.conf
==============================================================================
--- head/tools/tools/nanobsd/rescue/isoamd64.conf	Fri Oct  1 10:32:54 2010	(r213323)
+++ head/tools/tools/nanobsd/rescue/isoamd64.conf	Fri Oct  1 10:34:35 2010	(r213324)
@@ -1,7 +1,7 @@
 #
 # $FreeBSD$
 #
-NANO_KERNEL=AMD64
+NANO_KERNEL=GENERIC
 NANO_ARCH=amd64
 TARGET_ARCH=amd64; export TARGET_ARCH
 #TARGET_CPUTYPE=amd64; export TARGET_CPUTYPE

Modified: head/tools/tools/nanobsd/rescue/isoi386.conf
==============================================================================
--- head/tools/tools/nanobsd/rescue/isoi386.conf	Fri Oct  1 10:32:54 2010	(r213323)
+++ head/tools/tools/nanobsd/rescue/isoi386.conf	Fri Oct  1 10:34:35 2010	(r213324)
@@ -1,7 +1,7 @@
 #
 # $FreeBSD$
 #
-NANO_KERNEL=I386
+NANO_KERNEL=GENERIC
 NANO_ARCH=i386
 TARGET_ARCH=i386; export TARGET_ARCH
 #TARGET_CPUTYPE=i386; export TARGET_CPUTYPE

From owner-svn-src-head@FreeBSD.ORG  Fri Oct  1 11:48:15 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 3C9A11065670;
	Fri,  1 Oct 2010 11:48:15 +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 2C9ED8FC16;
	Fri,  1 Oct 2010 11:48:15 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o91BmFkR005808;
	Fri, 1 Oct 2010 11:48:15 GMT (envelope-from bz@svn.freebsd.org)
Received: (from bz@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o91BmFdd005806;
	Fri, 1 Oct 2010 11:48:15 GMT (envelope-from bz@svn.freebsd.org)
Message-Id: <201010011148.o91BmFdd005806@svn.freebsd.org>
From: "Bjoern A. Zeeb" 
Date: Fri, 1 Oct 2010 11:48:15 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r213325 - head/sys/netinet
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 01 Oct 2010 11:48:15 -0000

Author: bz
Date: Fri Oct  1 11:48:14 2010
New Revision: 213325
URL: http://svn.freebsd.org/changeset/base/213325

Log:
  Proper bracketing.
  
  PR:		kern/151100
  Submitted by:	SunMinghao (sunminghao hotmail.com)
  MFC after:	3 days

Modified:
  head/sys/netinet/igmp.c

Modified: head/sys/netinet/igmp.c
==============================================================================
--- head/sys/netinet/igmp.c	Fri Oct  1 10:34:35 2010	(r213324)
+++ head/sys/netinet/igmp.c	Fri Oct  1 11:48:14 2010	(r213325)
@@ -1219,8 +1219,8 @@ igmp_input_v1_report(struct ifnet *ifp, 
 	if (ifp->if_flags & IFF_LOOPBACK)
 		return (0);
 
-	if (!IN_MULTICAST(ntohl(igmp->igmp_group.s_addr) ||
-	    !in_hosteq(igmp->igmp_group, ip->ip_dst))) {
+	if (!IN_MULTICAST(ntohl(igmp->igmp_group.s_addr)) ||
+	    !in_hosteq(igmp->igmp_group, ip->ip_dst)) {
 		IGMPSTAT_INC(igps_rcv_badreports);
 		return (EINVAL);
 	}

From owner-svn-src-head@FreeBSD.ORG  Fri Oct  1 13:10:11 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 8C108106566B;
	Fri,  1 Oct 2010 13:10:11 +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 7B7308FC15;
	Fri,  1 Oct 2010 13:10:11 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o91DABqv007536;
	Fri, 1 Oct 2010 13:10:11 GMT (envelope-from jilles@svn.freebsd.org)
Received: (from jilles@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o91DABUU007534;
	Fri, 1 Oct 2010 13:10:11 GMT (envelope-from jilles@svn.freebsd.org)
Message-Id: <201010011310.o91DABUU007534@svn.freebsd.org>
From: Jilles Tjoelker 
Date: Fri, 1 Oct 2010 13:10:11 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r213326 - head/lib/libc/i386/string
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 01 Oct 2010 13:10:11 -0000

Author: jilles
Date: Fri Oct  1 13:10:11 2010
New Revision: 213326
URL: http://svn.freebsd.org/changeset/base/213326

Log:
  libc: Remove the i386 assembler version of strlen(3).
  
  On anything modern, the C version, which processes a word at a time, is much
  faster. The Intel optimization manual explicitly warns against using REP
  prefixes with SCAS or CMPS, which is exactly what the assembler version
  does.
  
  A simple test on a Phenom II showed the C version, compiled with -O2, to be
  about twice as fast determining the length of 100000 strings between 0 and
  255 bytes long.
  
  MFC after:	2 weeks

Deleted:
  head/lib/libc/i386/string/strlen.S
Modified:
  head/lib/libc/i386/string/Makefile.inc

Modified: head/lib/libc/i386/string/Makefile.inc
==============================================================================
--- head/lib/libc/i386/string/Makefile.inc	Fri Oct  1 11:48:14 2010	(r213325)
+++ head/lib/libc/i386/string/Makefile.inc	Fri Oct  1 13:10:11 2010	(r213326)
@@ -3,5 +3,5 @@
 
 MDSRCS+=bcmp.S bcopy.S bzero.S ffs.S index.S memchr.S memcmp.S memcpy.S \
 	memmove.S memset.S rindex.S strcat.S strchr.S strcmp.S strcpy.S \
-	strlen.S strncmp.S strrchr.S swab.S wcschr.S wcscmp.S wcslen.S \
+	strncmp.S strrchr.S swab.S wcschr.S wcscmp.S wcslen.S \
 	wmemchr.S

From owner-svn-src-head@FreeBSD.ORG  Fri Oct  1 13:38:47 2010
Return-Path: 
Delivered-To: svn-src-head@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 2FD7C106566B;
	Fri,  1 Oct 2010 13:38:47 +0000 (UTC)
	(envelope-from rdivacky@vlk.vlakno.cz)
Received: from vlakno.cz (lev.vlakno.cz [77.93.215.190])
	by mx1.freebsd.org (Postfix) with ESMTP id DABA68FC19;
	Fri,  1 Oct 2010 13:38:46 +0000 (UTC)
Received: from lev.vlakno.cz (localhost [127.0.0.1])
	by vlakno.cz (Postfix) with ESMTP id 724359CB0D0;
	Fri,  1 Oct 2010 15:22:34 +0200 (CEST)
X-Virus-Scanned: amavisd-new at vlakno.cz
Received: from vlakno.cz ([127.0.0.1])
	by lev.vlakno.cz (lev.vlakno.cz [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id QqozK-nV+MkR; Fri,  1 Oct 2010 15:22:34 +0200 (CEST)
Received: from vlk.vlakno.cz (localhost [127.0.0.1])
	by vlakno.cz (Postfix) with ESMTP id E30A89CB12C;
	Fri,  1 Oct 2010 15:22:33 +0200 (CEST)
Received: (from rdivacky@localhost)
	by vlk.vlakno.cz (8.14.4/8.14.4/Submit) id o91DMXdL083572;
	Fri, 1 Oct 2010 15:22:33 +0200 (CEST) (envelope-from rdivacky)
Date: Fri, 1 Oct 2010 15:22:33 +0200
From: Roman Divacky 
To: Jilles Tjoelker 
Message-ID: <20101001132233.GA83116@freebsd.org>
References: <201010011310.o91DABUU007534@svn.freebsd.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <201010011310.o91DABUU007534@svn.freebsd.org>
User-Agent: Mutt/1.4.2.3i
Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org,
	src-committers@FreeBSD.org
Subject: Re: svn commit: r213326 - head/lib/libc/i386/string
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 01 Oct 2010 13:38:47 -0000

On Fri, Oct 01, 2010 at 01:10:11PM +0000, Jilles Tjoelker wrote:
> Author: jilles
> Date: Fri Oct  1 13:10:11 2010
> New Revision: 213326
> URL: http://svn.freebsd.org/changeset/base/213326
> 
> Log:
>   libc: Remove the i386 assembler version of strlen(3).
>   
>   On anything modern, the C version, which processes a word at a time, is much
>   faster. The Intel optimization manual explicitly warns against using REP
>   prefixes with SCAS or CMPS, which is exactly what the assembler version
>   does.

there's "rep cmps" in bcmp.S and memcmp.S in both amd64/i386

they both have C counterparts, no idea how fast those are (they
are going char by char).

does this wisdom apply to those too?

From owner-svn-src-head@FreeBSD.ORG  Fri Oct  1 14:03:37 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id CECA010656A8;
	Fri,  1 Oct 2010 14:03:37 +0000 (UTC)
	(envelope-from mdf356@gmail.com)
Received: from mail-iw0-f182.google.com (mail-iw0-f182.google.com
	[209.85.214.182])
	by mx1.freebsd.org (Postfix) with ESMTP id 6BB908FC14;
	Fri,  1 Oct 2010 14:03:37 +0000 (UTC)
Received: by iwn34 with SMTP id 34so4741133iwn.13
	for ; Fri, 01 Oct 2010 07:03:37 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=domainkey-signature:mime-version:received:sender:received
	:in-reply-to:references:date:x-google-sender-auth:message-id:subject
	:from:to:cc:content-type:content-transfer-encoding;
	bh=8qXsz9QwRX9PikCaJeopYP42HX28zlj3+9NMnvzozWI=;
	b=cRBZ/cdesY18lZWcj0ZysLSKkdU7PYmNwk0wcU2yo6DpS8RALFv/ECXDEyH1QF8rZ2
	7NufjmffC25fjLbVQbhYiur/XnQJSW+FKxmlsORLFu6z8Uhl5MQtEVRukHyWpR1yuOYR
	1VnmpVHu6ucTjcdS+3KznwakSpYN/HtonNePw=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
	h=mime-version:sender:in-reply-to:references:date
	:x-google-sender-auth:message-id:subject:from:to:cc:content-type
	:content-transfer-encoding;
	b=RzydgohaIjYy9223Xjj+ZRNmEzMACWNw62Zxw5V4yNdeA/OHCxuxvZikqBFwTspj1i
	7rMcaHyohredTx50QOthq6VFkiyR5FVPhagUCG/K5gvhn0Koi5s3KpFQp4/rLC/tyJNn
	bo4xuDnfZbvzpsQQYRzRDFN95JIEjAkE1/AGY=
MIME-Version: 1.0
Received: by 10.231.148.83 with SMTP id o19mr5704330ibv.112.1285941816769;
	Fri, 01 Oct 2010 07:03:36 -0700 (PDT)
Sender: mdf356@gmail.com
Received: by 10.231.167.140 with HTTP; Fri, 1 Oct 2010 07:03:36 -0700 (PDT)
In-Reply-To: <201010010934.o919YfCB097349@svn.freebsd.org>
References: <201010010934.o919YfCB097349@svn.freebsd.org>
Date: Fri, 1 Oct 2010 14:03:36 +0000
X-Google-Sender-Auth: 2_gWfo8_WZcaxVK9p4sUQCqruhM
Message-ID: 
From: mdf@FreeBSD.org
To: Andriy Gapon 
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r213322 - head/sys/kern
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 01 Oct 2010 14:03:38 -0000

On Fri, Oct 1, 2010 at 9:34 AM, Andriy Gapon  wrote:
> Author: avg
> Date: Fri Oct =A01 09:34:41 2010
> New Revision: 213322
> URL: http://svn.freebsd.org/changeset/base/213322
>
> Log:
> =A0sysctls in kern_shutdown: add twin tunables
>
> =A0also make couple of sysctl-controlled variables static
>
> =A0Reviewed by: =A0rwatson
> =A0MFC after: =A0 =A01 week
>
> Modified:
> =A0head/sys/kern/kern_shutdown.c
>
> Modified: head/sys/kern/kern_shutdown.c
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D
> --- head/sys/kern/kern_shutdown.c =A0 =A0 =A0 Fri Oct =A01 09:18:30 2010 =
=A0 =A0 =A0 =A0(r213321)
> +++ head/sys/kern/kern_shutdown.c =A0 =A0 =A0 Fri Oct =A01 09:34:41 2010 =
=A0 =A0 =A0 =A0(r213322)
> @@ -98,21 +98,24 @@ int debugger_on_panic =3D 0;
> =A0#else
> =A0int debugger_on_panic =3D 1;
> =A0#endif
> -SYSCTL_INT(_debug, OID_AUTO, debugger_on_panic, CTLFLAG_RW,
> +SYSCTL_INT(_debug, OID_AUTO, debugger_on_panic, CTLFLAG_RW | CTLFLAG_TUN=
,
> =A0 =A0 =A0 =A0&debugger_on_panic, 0, "Run debugger on kernel panic");

I thought CTLFLAG_TUN was only used to provide a more useful error
message when writing to a read-only sysctl?  I think the CTLFLAG_TUN
should not be here for a RW sysctl.

Thanks,
matthew

> +TUNABLE_INT("debug.debugger_on_panic", &debugger_on_panic);
>
> =A0#ifdef KDB_TRACE
> -int trace_on_panic =3D 1;
> +static int trace_on_panic =3D 1;
> =A0#else
> -int trace_on_panic =3D 0;
> +static int trace_on_panic =3D 0;
> =A0#endif
> -SYSCTL_INT(_debug, OID_AUTO, trace_on_panic, CTLFLAG_RW,
> +SYSCTL_INT(_debug, OID_AUTO, trace_on_panic, CTLFLAG_RW | CTLFLAG_TUN,
> =A0 =A0 =A0 =A0&trace_on_panic, 0, "Print stack trace on kernel panic");
> +TUNABLE_INT("debug.trace_on_panic", &trace_on_panic);
> =A0#endif /* KDB */
>
> -int sync_on_panic =3D 0;
> -SYSCTL_INT(_kern, OID_AUTO, sync_on_panic, CTLFLAG_RW,
> +static int sync_on_panic =3D 0;
> +SYSCTL_INT(_kern, OID_AUTO, sync_on_panic, CTLFLAG_RW | CTLFLAG_TUN,
> =A0 =A0 =A0 =A0&sync_on_panic, 0, "Do a sync before rebooting from a pani=
c");
> +TUNABLE_INT("kern.sync_on_panic", &sync_on_panic);
>
> =A0SYSCTL_NODE(_kern, OID_AUTO, shutdown, CTLFLAG_RW, 0, "Shutdown enviro=
nment");
>
>

From owner-svn-src-head@FreeBSD.ORG  Fri Oct  1 14:11:24 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 4810E10656C0;
	Fri,  1 Oct 2010 14:11:24 +0000 (UTC) (envelope-from avg@freebsd.org)
Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140])
	by mx1.freebsd.org (Postfix) with ESMTP id F36988FC18;
	Fri,  1 Oct 2010 14:11:22 +0000 (UTC)
Received: from odyssey.starpoint.kiev.ua (alpha-e.starpoint.kiev.ua
	[212.40.38.101])
	by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id RAA13070;
	Fri, 01 Oct 2010 17:11:20 +0300 (EEST)
	(envelope-from avg@freebsd.org)
Message-ID: <4CA5EC08.8070502@freebsd.org>
Date: Fri, 01 Oct 2010 17:11:20 +0300
From: Andriy Gapon 
User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US;
	rv:1.9.2.9) Gecko/20100920 Lightning/1.0b2 Thunderbird/3.1.4
MIME-Version: 1.0
To: mdf@freebsd.org
References: <201010010934.o919YfCB097349@svn.freebsd.org>
	
In-Reply-To: 
X-Enigmail-Version: 1.1.2
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r213322 - head/sys/kern
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 01 Oct 2010 14:11:24 -0000

mdf@FreeBSD.org wrote:
> I thought CTLFLAG_TUN was only used to provide a more useful error
> message when writing to a read-only sysctl?  I think the CTLFLAG_TUN
> should not be here for a RW sysctl.

Yes, that's the only use for CTLFLAG_TUN _now_.
Perhaps in the future there could be other uses, such as a flag to sysctl to list
names which are also tunables.  Or some other creative use.

sysctl(9) says:

CTLFLAG_TUN      Also declare a system tunable with the same name to iniâ€
                 tialize this variable.

While the above is not true or very ambiguous at the very least, I still don't see
any reason not to use the flag in this case.

-- 
Andriy Gapon

From owner-svn-src-head@FreeBSD.ORG  Fri Oct  1 14:36:37 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 4B30C106566B;
	Fri,  1 Oct 2010 14:36:37 +0000 (UTC) (envelope-from gnn@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 3A9E88FC27;
	Fri,  1 Oct 2010 14:36:37 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o91EabSX009424;
	Fri, 1 Oct 2010 14:36:37 GMT (envelope-from gnn@svn.freebsd.org)
Received: (from gnn@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o91EabvX009421;
	Fri, 1 Oct 2010 14:36:37 GMT (envelope-from gnn@svn.freebsd.org)
Message-Id: <201010011436.o91EabvX009421@svn.freebsd.org>
From: "George V. Neville-Neil" 
Date: Fri, 1 Oct 2010 14:36:37 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r213327 - head/tools/tools/mctest
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 01 Oct 2010 14:36:37 -0000

Author: gnn
Date: Fri Oct  1 14:36:36 2010
New Revision: 213327
URL: http://svn.freebsd.org/changeset/base/213327

Log:
  Change the output of mctest to give a summary of the results instead
  of printing a long list.
  
  Add a default base port, and default mulitcast address to the
  runner script.
  
  Add support for specifying a different local and remote interface
  in the runner script.
  
  MFC after:	1 week

Modified:
  head/tools/tools/mctest/mctest.cc
  head/tools/tools/mctest/mctest_run.sh

Modified: head/tools/tools/mctest/mctest.cc
==============================================================================
--- head/tools/tools/mctest/mctest.cc	Fri Oct  1 13:10:11 2010	(r213326)
+++ head/tools/tools/mctest/mctest.cc	Fri Oct  1 14:36:36 2010	(r213327)
@@ -38,6 +38,8 @@ __FBSDID("$FreeBSD$");
 // C++ STL and other related includes
 #include 
 #include 
+#include 
+#include 
 
 // Operating System and other C based includes
 #include 
@@ -400,15 +402,31 @@ int source(char *interface, struct in_ad
     }
 
     timeval result;
+    vector deltas;
+    double idx[] = { .0001, .001, .01, .1, .5, .9, .99, .999, .9999, 0.0 };
+
     for (int client = 0;client < clients; client++) {
+	deltas.clear();
 	cout << "Results from client #" << client << endl;
+	cout << "in usecs" << endl;
         for (int i = 0; i < number; i++) {
-	    if (i % clients != client) 
-		continue;
+// 	    if (i % clients != client) 
+// 		continue;
+            if (&args[client].packets[i].tv_sec == 0)
+			continue;
 	    timersub(&args[client].packets[i], &sent[i], &result);
-	    cout << "sec: " << result.tv_sec;
-	    cout << " usecs: " << result.tv_usec << endl;
+	    deltas.push_back(result.tv_usec);
+// 	    cout << "sec: " << result.tv_sec;
+// 	    cout << " usecs: " << result.tv_usec << endl;
             }
+	cout << "comparing %lu deltas" << long(deltas.size()) << endl;
+	cout << "number represents usecs of round-trip time" << endl;
+	sort(deltas.begin(), deltas.end());
+	for (int i = 0; idx[i] != 0; ++i) {
+		printf("%s% 5d", (i == 0) ? "" : " ", 
+		       deltas[(int) (idx[i] * deltas.size())]); 
+	}
+	printf("\n");		
     }
 
     return 0;

Modified: head/tools/tools/mctest/mctest_run.sh
==============================================================================
--- head/tools/tools/mctest/mctest_run.sh	Fri Oct  1 13:10:11 2010	(r213326)
+++ head/tools/tools/mctest/mctest_run.sh	Fri Oct  1 14:36:36 2010	(r213327)
@@ -7,19 +7,19 @@
 # Defaults
 size=1024
 number=100
-base=""
-group=""
+base=9999
+group="239.255.255.101"
 interface="cxgb0"
 remote="ssh"
-command="/sources/FreeBSD.CURRENT/src/tools/tools/mctest/mctest"
+command="/zoo/tank/users/gnn/svn/Projects/head-exar/src/tools/tools/mctest/mctest"
 gap=1000
 
 # Arguments are s (size), g (group), n (number), and c (command) followed
 # by a set of hostnames.
-args=`getopt s:g:n:c:i:b: $*`
+args=`getopt s:g:n:c:l:f:b: $*`
 if [ $? != 0 ]
 then
-    echo 'Usage: mctest_run -s size -g group -n number -c remote command host1 host2 hostN'
+    echo 'Usage: mctest_run -l local_interface -f foreign_interface -s size -g group -n number -c remote command host1 host2 hostN'
     exit 2
 fi
 set == $args
@@ -40,8 +40,11 @@ do
       -c)
 	  command=$3;
 	  shift 2;;
-      -i)
-	  interface=$3;
+      -l)
+	  local_interface=$3;
+	  shift 2;;
+      -f)
+	  foreign_interface=$3;
 	  shift 2;;
       -b) 
 	  base=$3;
@@ -60,7 +63,7 @@ now=`date "+%Y%m%d%H%M"`
 for host in $*
 do
   output=$host\_$interface\_$size\_$number\.$now
-  $remote $host $command -r -M $# -b $base -g $group -m $current -n $number -s $size -i $interface > $output &
+  $remote $host $command -r -M $# -b $base -g $group -m $current -n $number -s $size -i $foreign_interface > $output &
   sleep 1
   current=`expr $current + 1 `;
 done
@@ -68,4 +71,4 @@ done
 #
 # Start the source/collector on this machine
 #
-$command -M $# -b $base -g $group -n $number -s $size -i $interface -t $gap > `uname -n`\_$size\_$number\.$now
+$command -M $# -b $base -g $group -n $number -s $size -i $local_interface -t $gap > `uname -n`\_$size\_$number\.$now

From owner-svn-src-head@FreeBSD.ORG  Fri Oct  1 15:14:14 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id CD32B1065673;
	Fri,  1 Oct 2010 15:14:14 +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 BD8088FC12;
	Fri,  1 Oct 2010 15:14: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 o91FEEj3010239;
	Fri, 1 Oct 2010 15:14:14 GMT (envelope-from bz@svn.freebsd.org)
Received: (from bz@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o91FEEBG010237;
	Fri, 1 Oct 2010 15:14:14 GMT (envelope-from bz@svn.freebsd.org)
Message-Id: <201010011514.o91FEEBG010237@svn.freebsd.org>
From: "Bjoern A. Zeeb" 
Date: Fri, 1 Oct 2010 15:14:14 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r213328 - head/sys/net
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 01 Oct 2010 15:14:14 -0000

Author: bz
Date: Fri Oct  1 15:14:14 2010
New Revision: 213328
URL: http://svn.freebsd.org/changeset/base/213328

Log:
  Only hide the ifa and not the tp under #ifdef INET as the tp is needed
  for locking evenwhen there is no INET.
  
  MFC after:	3 days

Modified:
  head/sys/net/if_tun.c

Modified: head/sys/net/if_tun.c
==============================================================================
--- head/sys/net/if_tun.c	Fri Oct  1 14:36:36 2010	(r213327)
+++ head/sys/net/if_tun.c	Fri Oct  1 15:14:14 2010	(r213328)
@@ -497,8 +497,8 @@ tunclose(struct cdev *dev, int foo, int 
 static int
 tuninit(struct ifnet *ifp)
 {
-#ifdef INET
 	struct tun_softc *tp = ifp->if_softc;
+#ifdef INET
 	struct ifaddr *ifa;
 #endif
 	int error = 0;

From owner-svn-src-head@FreeBSD.ORG  Fri Oct  1 15:28:03 2010
Return-Path: 
Delivered-To: svn-src-head@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9FBCD106566C;
	Fri,  1 Oct 2010 15:28:03 +0000 (UTC) (envelope-from dim@FreeBSD.org)
Received: from tensor.andric.com (cl-327.ede-01.nl.sixxs.net
	[IPv6:2001:7b8:2ff:146::2])
	by mx1.freebsd.org (Postfix) with ESMTP id 5C2368FC1C;
	Fri,  1 Oct 2010 15:28:03 +0000 (UTC)
Received: from [IPv6:2001:7b8:3a7:0:75a8:594d:1806:1e34] (unknown
	[IPv6:2001:7b8:3a7:0:75a8:594d:1806:1e34])
	(using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits))
	(No client certificate requested)
	by tensor.andric.com (Postfix) with ESMTPSA id 675775C43;
	Fri,  1 Oct 2010 17:28:02 +0200 (CEST)
Message-ID: <4CA5FE07.5010104@FreeBSD.org>
Date: Fri, 01 Oct 2010 17:28:07 +0200
From: Dimitry Andric 
Organization: The FreeBSD Project
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US;
	rv:1.9.2.11pre) Gecko/20100929 Lanikai/3.1.5pre
MIME-Version: 1.0
To: Roman Divacky 
References: <201010011310.o91DABUU007534@svn.freebsd.org>
	<20101001132233.GA83116@freebsd.org>
In-Reply-To: <20101001132233.GA83116@freebsd.org>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Cc: Jilles Tjoelker , svn-src-head@FreeBSD.org,
	svn-src-all@FreeBSD.org, src-committers@FreeBSD.org
Subject: Re: svn commit: r213326 - head/lib/libc/i386/string
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 01 Oct 2010 15:28:03 -0000

On 2010-10-01 15:22, Roman Divacky wrote:
> there's "rep cmps" in bcmp.S and memcmp.S in both amd64/i386
>
> they both have C counterparts, no idea how fast those are (they
> are going char by char).
>
> does this wisdom apply to those too?

Well, these versions compare by words first, using "repe cmpsl" (for
i386) and "rep cmpsq" (for amd64).  Only if there any bytes remaining
after that, they are checked with "repe cmpsb".

It is probably possible to optimize these versions for the case the
source pointers are not aligned.  That will not occur too much,
probably, and complicate the implementation.

On the other hand, the C implementations of bcmp and memcmp are
basically simple "while (*src++ == *dst++);" implementations, so it is
entirely up to the compiler to do any optimization magic there.

In any case, without some statistically sane speed measurements, this is
all just talk... ;)

From owner-svn-src-head@FreeBSD.ORG  Fri Oct  1 15:38:35 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9C70610656A8;
	Fri,  1 Oct 2010 15:38:35 +0000 (UTC)
	(envelope-from luigi@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 8C87A8FC19;
	Fri,  1 Oct 2010 15:38: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 o91FcZrW010716;
	Fri, 1 Oct 2010 15:38:35 GMT (envelope-from luigi@svn.freebsd.org)
Received: (from luigi@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o91FcZni010714;
	Fri, 1 Oct 2010 15:38:35 GMT (envelope-from luigi@svn.freebsd.org)
Message-Id: <201010011538.o91FcZni010714@svn.freebsd.org>
From: Luigi Rizzo 
Date: Fri, 1 Oct 2010 15:38:35 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r213329 - head/sys/netinet/ipfw
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 01 Oct 2010 15:38:35 -0000

Author: luigi
Date: Fri Oct  1 15:38:35 2010
New Revision: 213329
URL: http://svn.freebsd.org/changeset/base/213329

Log:
  put back the assigment to sched_time. It was correct, and
  it was necessary.
  
  Submitted by:	Riccardo Panicucci

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

Modified: head/sys/netinet/ipfw/ip_dn_io.c
==============================================================================
--- head/sys/netinet/ipfw/ip_dn_io.c	Fri Oct  1 15:14:14 2010	(r213328)
+++ head/sys/netinet/ipfw/ip_dn_io.c	Fri Oct  1 15:38:35 2010	(r213329)
@@ -760,6 +760,7 @@ dummynet_io(struct mbuf **m0, int dir, s
 	    /* Do this only on the first packet on an idle pipe */
 	    struct dn_link *p = &fs->sched->link;
 
+	    si->sched_time = dn_cfg.curr_time;
 	    si->credit = dn_cfg.io_fast ? p->bandwidth : 0;
 	    if (p->burst) {
 		uint64_t burst = (dn_cfg.curr_time - si->idle_time) * p->bandwidth;

From owner-svn-src-head@FreeBSD.ORG  Fri Oct  1 16:10:12 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 5E950106566C;
	Fri,  1 Oct 2010 16:10:12 +0000 (UTC) (envelope-from alc@rice.edu)
Received: from mh7.mail.rice.edu (mh7.mail.rice.edu [128.42.199.46])
	by mx1.freebsd.org (Postfix) with ESMTP id 357098FC1A;
	Fri,  1 Oct 2010 16:10:11 +0000 (UTC)
Received: from mh7.mail.rice.edu (localhost.localdomain [127.0.0.1])
	by mh7.mail.rice.edu (Postfix) with ESMTP id 614B828F717;
	Fri,  1 Oct 2010 11:10:10 -0500 (CDT)
X-Virus-Scanned: by amavis-2.6.4 at mh7.mail.rice.edu, auth channel
Received: from mh7.mail.rice.edu ([127.0.0.1])
	by mh7.mail.rice.edu (mh7.mail.rice.edu [127.0.0.1]) (amavis,
	port 10026)
	with ESMTP id q5poTo+rUyPj; Fri,  1 Oct 2010 11:10:10 -0500 (CDT)
Received: from adsl-216-63-78-18.dsl.hstntx.swbell.net
	(adsl-216-63-78-18.dsl.hstntx.swbell.net [216.63.78.18])
	(using TLSv1 with cipher RC4-MD5 (128/128 bits))
	(No client certificate requested) (Authenticated sender: alc)
	by mh7.mail.rice.edu (Postfix) with ESMTPSA id 7913728F76E;
	Fri,  1 Oct 2010 11:10:09 -0500 (CDT)
Message-ID: <4CA607E0.7030608@rice.edu>
Date: Fri, 01 Oct 2010 11:10:08 -0500
From: Alan Cox 
User-Agent: Thunderbird 2.0.0.24 (X11/20100725)
MIME-Version: 1.0
To: Nathan Whitehorn 
References: <201009301814.o8UIECsK077343@svn.freebsd.org>
In-Reply-To: <201009301814.o8UIECsK077343@svn.freebsd.org>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r213307 - in head/sys/powerpc: aim include powerpc
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 01 Oct 2010 16:10:12 -0000

Nathan Whitehorn wrote:
> Author: nwhitehorn
> Date: Thu Sep 30 18:14:12 2010
> New Revision: 213307
> URL: http://svn.freebsd.org/changeset/base/213307
>
> Log:
>   Add support for memory attributes (pmap_mapdev_attr() and friends) on
>   PowerPC/AIM. This is currently stubbed out on Book-E, since I have no
>   idea how to implement it there.
>   

It's nice to see vm_memattr* being fully supported on a non-x86 
platform.  Kudos.

Alan


From owner-svn-src-head@FreeBSD.ORG  Fri Oct  1 17:46:15 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 6AB9E1065673;
	Fri,  1 Oct 2010 17:46:15 +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 5A7FB8FC08;
	Fri,  1 Oct 2010 17:46:15 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o91HkFZH013405;
	Fri, 1 Oct 2010 17:46:15 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o91HkFk9013402;
	Fri, 1 Oct 2010 17:46:15 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <201010011746.o91HkFk9013402@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Fri, 1 Oct 2010 17:46:15 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r213333 - head/sys/dev/bge
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 01 Oct 2010 17:46:15 -0000

Author: yongari
Date: Fri Oct  1 17:46:15 2010
New Revision: 213333
URL: http://svn.freebsd.org/changeset/base/213333

Log:
  Allow write DMA to request larger DMA burst size to get better
  performance on BCM5785.
  
  Obtained from:	OpenBSD

Modified:
  head/sys/dev/bge/if_bge.c
  head/sys/dev/bge/if_bgereg.h

Modified: head/sys/dev/bge/if_bge.c
==============================================================================
--- head/sys/dev/bge/if_bge.c	Fri Oct  1 17:20:48 2010	(r213332)
+++ head/sys/dev/bge/if_bge.c	Fri Oct  1 17:46:15 2010	(r213333)
@@ -1834,6 +1834,10 @@ bge_blockinit(struct bge_softc *sc)
 	if (BGE_IS_5755_PLUS(sc))
 		val |= BGE_WDMAMODE_STATUS_TAG_FIX;
 
+	/* Request larger DMA burst size to get better performance. */
+	if (sc->bge_asicrev == BGE_ASICREV_BCM5785)
+		val |= BGE_WDMAMODE_BURST_ALL_DATA;
+
 	/* Turn on write DMA state machine */
 	CSR_WRITE_4(sc, BGE_WDMA_MODE, val);
 	DELAY(40);

Modified: head/sys/dev/bge/if_bgereg.h
==============================================================================
--- head/sys/dev/bge/if_bgereg.h	Fri Oct  1 17:20:48 2010	(r213332)
+++ head/sys/dev/bge/if_bgereg.h	Fri Oct  1 17:46:15 2010	(r213333)
@@ -1481,6 +1481,7 @@
 #define	BGE_WDMAMODE_LOCREAD_TOOBIG	0x00000200
 #define	BGE_WDMAMODE_ALL_ATTNS		0x000003FC
 #define	BGE_WDMAMODE_STATUS_TAG_FIX	0x20000000
+#define	BGE_WDMAMODE_BURST_ALL_DATA	0xC0000000
 
 /* Write DMA status register */
 #define	BGE_WDMASTAT_PCI_TGT_ABRT_ATTN	0x00000004

From owner-svn-src-head@FreeBSD.ORG  Fri Oct  1 17:51:56 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 5012B106564A;
	Fri,  1 Oct 2010 17:51:56 +0000 (UTC)
	(envelope-from yongari@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 3FA248FC16;
	Fri,  1 Oct 2010 17:51: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 o91HpuLs013531;
	Fri, 1 Oct 2010 17:51:56 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o91Hpuwc013529;
	Fri, 1 Oct 2010 17:51:56 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <201010011751.o91Hpuwc013529@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Fri, 1 Oct 2010 17:51:56 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r213334 - head/sys/dev/bge
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 01 Oct 2010 17:51:56 -0000

Author: yongari
Date: Fri Oct  1 17:51:55 2010
New Revision: 213334
URL: http://svn.freebsd.org/changeset/base/213334

Log:
  Remove extra semicolon.

Modified:
  head/sys/dev/bge/if_bge.c

Modified: head/sys/dev/bge/if_bge.c
==============================================================================
--- head/sys/dev/bge/if_bge.c	Fri Oct  1 17:46:15 2010	(r213333)
+++ head/sys/dev/bge/if_bge.c	Fri Oct  1 17:51:55 2010	(r213334)
@@ -1052,7 +1052,7 @@ bge_init_rx_ring_std(struct bge_softc *s
 		if ((error = bge_newbuf_std(sc, i)) != 0)
 			return (error);
 		BGE_INC(sc->bge_std, BGE_STD_RX_RING_CNT);
-	};
+	}
 
 	bus_dmamap_sync(sc->bge_cdata.bge_rx_std_ring_tag,
 	    sc->bge_cdata.bge_rx_std_ring_map, BUS_DMASYNC_PREWRITE);
@@ -1095,7 +1095,7 @@ bge_init_rx_ring_jumbo(struct bge_softc 
 		if ((error = bge_newbuf_jumbo(sc, i)) != 0)
 			return (error);
 		BGE_INC(sc->bge_jumbo, BGE_JUMBO_RX_RING_CNT);
-	};
+	}
 
 	bus_dmamap_sync(sc->bge_cdata.bge_rx_jumbo_ring_tag,
 	    sc->bge_cdata.bge_rx_jumbo_ring_map, BUS_DMASYNC_PREWRITE);

From owner-svn-src-head@FreeBSD.ORG  Fri Oct  1 17:54:41 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E43CC106566B;
	Fri,  1 Oct 2010 17:54:41 +0000 (UTC)
	(envelope-from swell.k@gmail.com)
Received: from mail-fx0-f54.google.com (mail-fx0-f54.google.com
	[209.85.161.54])
	by mx1.freebsd.org (Postfix) with ESMTP id 24B4D8FC17;
	Fri,  1 Oct 2010 17:54:40 +0000 (UTC)
Received: by fxm9 with SMTP id 9so2850822fxm.13
	for ; Fri, 01 Oct 2010 10:54:39 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=domainkey-signature:received:received:from:to:cc:subject:references
	:date:message-id:user-agent:mime-version:content-type;
	bh=QZPeFMNC7wrYNpyAWaDYZYYdcu3YC/RJIFaaUB8FdHs=;
	b=M6ReAZjEtQ4kLXCdbFji7oxpigMHxEgMdv464gUn7Xhdg2/YwlSi2sqL4QbEUVN+4O
	mas7b850PGT39s3ofLpNivd9qf+M6KP2I9u9zPcPF39DClv8vqqHX18y/SGZPRUWs7I4
	Ai5EpMrpqj7VUDq+oKzDlt48Flehxflv2Ybl0=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
	h=from:to:cc:subject:references:date:message-id:user-agent
	:mime-version:content-type;
	b=tR3UYjgSEPYaP2nM/4AZ6MfzqrA0I1kns8N1stjjsEawaLRAgcLFqiWthtUmom9kiH
	BnQPsryqyjJKevHkB4FqicVKmGpgKr3P2lNOneIgtsnFrLCy83fXj61v4ZcE/zw6nSLb
	OZamBfrpiDv/mOK7vTzuFq0cUNUHyzJ/VVZQ0=
Received: by 10.223.113.71 with SMTP id z7mr5837025fap.3.1285955679586;
	Fri, 01 Oct 2010 10:54:39 -0700 (PDT)
Received: from localhost ([208.53.142.42])
	by mx.google.com with ESMTPS id r5sm770426faq.8.2010.10.01.10.54.33
	(version=SSLv3 cipher=RC4-MD5); Fri, 01 Oct 2010 10:54:38 -0700 (PDT)
From: Anonymous 
To: Dimitry Andric 
References: <201009212141.o8LLfjHX007646@svn.freebsd.org>
Date: Fri, 01 Oct 2010 21:54:11 +0400
Message-ID: <86mxqx7q9o.fsf@gmail.com>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (berkeley-unix)
MIME-Version: 1.0
Content-Type: text/plain
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r212979 - in head: gnu/lib/libobjc
	sys/boot/i386/boot2 sys/boot/pc98/boot2
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 01 Oct 2010 17:54:42 -0000

Dimitry Andric  writes:

> Author: dim
> Date: Tue Sep 21 21:41:45 2010
> New Revision: 212979
> URL: http://svn.freebsd.org/changeset/base/212979
[...]
> Modified: head/gnu/lib/libobjc/Makefile
> ==============================================================================
> --- head/gnu/lib/libobjc/Makefile	Tue Sep 21 21:07:46 2010	(r212978)
> +++ head/gnu/lib/libobjc/Makefile	Tue Sep 21 21:41:45 2010	(r212979)
> @@ -16,9 +16,7 @@ SRCS=	archive.c class.c encoding.c gc.c 
>  	selector.c sendmsg.c thr.c thr-objc.c exception.c
>  
>  # XXX: clang cannot compile libobjc yet
> -.if ${CC:T:Mclang} == "clang"
> -CC=gcc
> -.endif
> +CC:=${CC:C/^(.*\/)?clang$/gcc/1}

How about clearing some user-defined variable together with the substitution

  CLANG_FLAGS = # set to empty value
  CC := ${CC:C/^(.*\/)?clang$/gcc/1}

in which user can store clang-specific flags (via src.conf), e.g.

  CC = clang ${CLANG_FLAGS}
  CLANG_FLAGS = -Qunused-arguments # too much noise for `make -s' build

or

  CPUTYPE ?= native
  CLANG_FLAGS = -mno-sse4 # don't feed as(1) unknown opcodes

Otherwise, substitution occurs too late and gcc(1) chokes on unknown
options.

From owner-svn-src-head@FreeBSD.ORG  Fri Oct  1 18:59:31 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 22908106567A;
	Fri,  1 Oct 2010 18:59:31 +0000 (UTC)
	(envelope-from nwhitehorn@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 117F88FC16;
	Fri,  1 Oct 2010 18:59:31 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o91IxUjw014841;
	Fri, 1 Oct 2010 18:59:30 GMT
	(envelope-from nwhitehorn@svn.freebsd.org)
Received: (from nwhitehorn@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o91IxUxn014838;
	Fri, 1 Oct 2010 18:59:30 GMT
	(envelope-from nwhitehorn@svn.freebsd.org)
Message-Id: <201010011859.o91IxUxn014838@svn.freebsd.org>
From: Nathan Whitehorn 
Date: Fri, 1 Oct 2010 18:59:30 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r213335 - head/sys/powerpc/aim
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 01 Oct 2010 18:59:31 -0000

Author: nwhitehorn
Date: Fri Oct  1 18:59:30 2010
New Revision: 213335
URL: http://svn.freebsd.org/changeset/base/213335

Log:
  Fix pmap_page_set_memattr() behavior in the presence of fictitious pages
  by just caching the mode for later use by pmap_enter(), following amd64.
  While here, correct some mismerges from mmu_oea64 -> mmu_oea and clean
  up some dead code found while fixing the fictitious page behavior.

Modified:
  head/sys/powerpc/aim/mmu_oea.c
  head/sys/powerpc/aim/mmu_oea64.c

Modified: head/sys/powerpc/aim/mmu_oea.c
==============================================================================
--- head/sys/powerpc/aim/mmu_oea.c	Fri Oct  1 17:51:55 2010	(r213334)
+++ head/sys/powerpc/aim/mmu_oea.c	Fri Oct  1 18:59:30 2010	(r213335)
@@ -221,8 +221,6 @@ u_int		moea_pteg_mask;
 struct	pvo_head *moea_pvo_table;		/* pvo entries by pteg index */
 struct	pvo_head moea_pvo_kunmanaged =
     LIST_HEAD_INITIALIZER(moea_pvo_kunmanaged);	/* list of unmanaged pages */
-struct	pvo_head moea_pvo_unmanaged =
-    LIST_HEAD_INITIALIZER(moea_pvo_unmanaged);	/* list of unmanaged pages */
 
 uma_zone_t	moea_upvo_zone;	/* zone for pvo entries for unmanaged pages */
 uma_zone_t	moea_mpvo_zone;	/* zone for pvo entries for managed pages */
@@ -463,22 +461,6 @@ va_to_pteg(u_int sr, vm_offset_t addr)
 }
 
 static __inline struct pvo_head *
-pa_to_pvoh(vm_offset_t pa, vm_page_t *pg_p)
-{
-	struct	vm_page *pg;
-
-	pg = PHYS_TO_VM_PAGE(pa);
-
-	if (pg_p != NULL)
-		*pg_p = pg;
-
-	if (pg == NULL)
-		return (&moea_pvo_unmanaged);
-
-	return (&pg->md.mdpg_pvoh);
-}
-
-static __inline struct pvo_head *
 vm_page_to_pvoh(vm_page_t m)
 {
 
@@ -919,6 +901,7 @@ moea_bootstrap(mmu_t mmup, vm_offset_t k
 			struct	vm_page m;
 
 			m.phys_addr = translations[i].om_pa + off;
+			m.md.mdpg_cache_attrs = VM_MEMATTR_DEFAULT;
 			m.oflags = VPO_BUSY;
 			PMAP_LOCK(&ofw_pmap);
 			moea_enter_locked(&ofw_pmap,
@@ -1168,7 +1151,7 @@ moea_enter_locked(pmap_t pmap, vm_offset
 		}
 	}
 
-	pte_lo = moea_calc_wimg(VM_PAGE_TO_PHYS(m), VM_MEMATTR_DEFAULT);
+	pte_lo = moea_calc_wimg(VM_PAGE_TO_PHYS(m), pmap_page_get_memattr(m));
 
 	if (prot & VM_PROT_WRITE) {
 		pte_lo |= PTE_BW;
@@ -1450,16 +1433,23 @@ void
 moea_page_set_memattr(mmu_t mmu, vm_page_t m, vm_memattr_t ma)
 {
 	struct	pvo_entry *pvo;
+	struct	pvo_head *pvo_head;
 	struct	pte *pt;
 	pmap_t	pmap;
 	u_int	lo;
 
+	if (m->flags & PG_FICTITIOUS) {
+		m->md.mdpg_cache_attrs = ma;
+		return;
+	}
+
 	vm_page_lock_queues();
+	pvo_head = vm_page_to_pvoh(m);
 	lo = moea_calc_wimg(VM_PAGE_TO_PHYS(m), ma);
-	LIST_FOREACH(pvo, vm_page_to_pvoh(m), pvo_vlink) {
+
+	LIST_FOREACH(pvo, pvo_head, pvo_vlink) {
 		pmap = pvo->pvo_pmap;
 		PMAP_LOCK(pmap);
-		mtx_lock(&moea_table_mutex);
 		pt = moea_pvo_to_pte(pvo, -1);
 		pvo->pvo_pte.pte.pte_lo &= ~PTE_WIMG;
 		pvo->pvo_pte.pte.pte_lo |= lo;

Modified: head/sys/powerpc/aim/mmu_oea64.c
==============================================================================
--- head/sys/powerpc/aim/mmu_oea64.c	Fri Oct  1 17:51:55 2010	(r213334)
+++ head/sys/powerpc/aim/mmu_oea64.c	Fri Oct  1 18:59:30 2010	(r213335)
@@ -298,11 +298,8 @@ u_int		moea64_pteg_mask;
  * PVO data.
  */
 struct	pvo_head *moea64_pvo_table;		/* pvo entries by pteg index */
-/* lists of unmanaged pages */
-struct	pvo_head moea64_pvo_kunmanaged =
+struct	pvo_head moea64_pvo_kunmanaged =	/* list of unmanaged pages */
     LIST_HEAD_INITIALIZER(moea64_pvo_kunmanaged);
-struct	pvo_head moea64_pvo_unmanaged =
-    LIST_HEAD_INITIALIZER(moea64_pvo_unmanaged);
 
 uma_zone_t	moea64_upvo_zone; /* zone for pvo entries for unmanaged pages */
 uma_zone_t	moea64_mpvo_zone; /* zone for pvo entries for managed pages */
@@ -495,22 +492,6 @@ va_to_pteg(uint64_t vsid, vm_offset_t ad
 }
 
 static __inline struct pvo_head *
-pa_to_pvoh(vm_offset_t pa, vm_page_t *pg_p)
-{
-	struct	vm_page *pg;
-
-	pg = PHYS_TO_VM_PAGE(pa);
-
-	if (pg_p != NULL)
-		*pg_p = pg;
-
-	if (pg == NULL)
-		return (&moea64_pvo_unmanaged);
-
-	return (&pg->md.mdpg_pvoh);
-}
-
-static __inline struct pvo_head *
 vm_page_to_pvoh(vm_page_t m)
 {
 
@@ -1917,13 +1898,20 @@ void
 moea64_page_set_memattr(mmu_t mmu, vm_page_t m, vm_memattr_t ma)
 {
 	struct	pvo_entry *pvo;
+	struct  pvo_head *pvo_head;
 	struct	lpte *pt;
 	pmap_t	pmap;
 	uint64_t lo;
 
+	if (m->flags & PG_FICTITIOUS) {
+		m->md.mdpg_cache_attrs = ma;
+		return;
+	}
+
 	vm_page_lock_queues();
+	pvo_head = vm_page_to_pvoh(m);
 	lo = moea64_calc_wimg(VM_PAGE_TO_PHYS(m), ma);
-	LIST_FOREACH(pvo, vm_page_to_pvoh(m), pvo_vlink) {
+	LIST_FOREACH(pvo, pvo_head, pvo_vlink) {
 		pmap = pvo->pvo_pmap;
 		PMAP_LOCK(pmap);
 		LOCK_TABLE();

From owner-svn-src-head@FreeBSD.ORG  Fri Oct  1 19:02:32 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 1C450106566B;
	Fri,  1 Oct 2010 19:02:32 +0000 (UTC)
	(envelope-from nwhitehorn@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id E55CB8FC13;
	Fri,  1 Oct 2010 19:02:31 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o91J2VLI014957;
	Fri, 1 Oct 2010 19:02:31 GMT
	(envelope-from nwhitehorn@svn.freebsd.org)
Received: (from nwhitehorn@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o91J2VZk014955;
	Fri, 1 Oct 2010 19:02:31 GMT
	(envelope-from nwhitehorn@svn.freebsd.org)
Message-Id: <201010011902.o91J2VZk014955@svn.freebsd.org>
From: Nathan Whitehorn 
Date: Fri, 1 Oct 2010 19:02:31 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r213336 - head/sys/powerpc/ofw
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 01 Oct 2010 19:02:32 -0000

Author: nwhitehorn
Date: Fri Oct  1 19:02:31 2010
New Revision: 213336
URL: http://svn.freebsd.org/changeset/base/213336

Log:
  Map the Open Firmware framebuffer console with write combining turned on,
  and set memory attributes appropriately for mmap() calls on /dev/console.
  Xorg no longer uses /dev/console to mmap the framebuffer, so framebuffer
  write combining support in X will arrive in the next patch.

Modified:
  head/sys/powerpc/ofw/ofw_syscons.c

Modified: head/sys/powerpc/ofw/ofw_syscons.c
==============================================================================
--- head/sys/powerpc/ofw/ofw_syscons.c	Fri Oct  1 18:59:30 2010	(r213335)
+++ head/sys/powerpc/ofw/ofw_syscons.c	Fri Oct  1 19:02:31 2010	(r213336)
@@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -280,7 +281,7 @@ ofwfb_configure(int flags)
 	OF_getprop(node, "address", &fb_phys, sizeof(fb_phys));
 
 	bus_space_map(&bs_be_tag, fb_phys, sc->sc_height * sc->sc_stride,
-	    0, &sc->sc_addr);
+	    BUS_SPACE_MAP_PREFETCHABLE, &sc->sc_addr);
 
 	/*
 	 * Get the PCI addresses of the adapter. The node may be the
@@ -632,8 +633,25 @@ ofwfb_mmap(video_adapter_t *adp, vm_ooff
 
 	sc = (struct ofwfb_softc *)adp;
 
-	if (sc->sc_num_pciaddrs == 0)
-		return (ENOMEM);
+	/*
+	 * Make sure the requested address lies within the PCI device's
+	 * assigned addrs
+	 */
+	for (i = 0; i < sc->sc_num_pciaddrs; i++)
+	  if (offset >= sc->sc_pciaddrs[i].phys_lo &&
+	    offset < (sc->sc_pciaddrs[i].phys_lo + sc->sc_pciaddrs[i].size_lo))
+		{
+			/*
+			 * If this is a prefetchable BAR, we can (and should)
+			 * enable write-combining.
+			 */
+			if (sc->sc_pciaddrs[i].phys_hi &
+			    OFW_PCI_PHYS_HI_PREFETCHABLE)
+				*memattr = VM_MEMATTR_WRITE_COMBINING;
+
+			*paddr = offset;
+			return (0);
+		}
 
 	/*
 	 * Hack for Radeon...
@@ -644,16 +662,6 @@ ofwfb_mmap(video_adapter_t *adp, vm_ooff
 	}
 
 	/*
-	 * Make sure the requested address lies within the PCI device's assigned addrs
-	 */
-	for (i = 0; i < sc->sc_num_pciaddrs; i++)
-		if (offset >= sc->sc_pciaddrs[i].phys_lo &&
-		    offset < (sc->sc_pciaddrs[i].phys_lo + sc->sc_pciaddrs[i].size_lo)) {
-			*paddr = offset;
-			return (0);
-		}
-
-	/*
 	 * This might be a legacy VGA mem request: if so, just point it at the
 	 * framebuffer, since it shouldn't be touched
 	 */
@@ -662,6 +670,12 @@ ofwfb_mmap(video_adapter_t *adp, vm_ooff
 		return (0);
 	}
 
+	/*
+	 * Error if we didn't have a better idea.
+	 */
+	if (sc->sc_num_pciaddrs == 0)
+		return (ENOMEM);
+
 	return (EINVAL);
 }
 

From owner-svn-src-head@FreeBSD.ORG  Fri Oct  1 20:14:37 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 2709F106564A;
	Fri,  1 Oct 2010 20:14:37 +0000 (UTC) (envelope-from dim@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 0C1978FC16;
	Fri,  1 Oct 2010 20:14:37 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o91KEaIa016600;
	Fri, 1 Oct 2010 20:14:36 GMT (envelope-from dim@svn.freebsd.org)
Received: (from dim@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o91KEaYC016578;
	Fri, 1 Oct 2010 20:14:36 GMT (envelope-from dim@svn.freebsd.org)
Message-Id: <201010012014.o91KEaYC016578@svn.freebsd.org>
From: Dimitry Andric 
Date: Fri, 1 Oct 2010 20:14:36 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r213337 - in head/lib/msun: amd64 i387
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 01 Oct 2010 20:14:37 -0000

Author: dim
Date: Fri Oct  1 20:14:36 2010
New Revision: 213337
URL: http://svn.freebsd.org/changeset/base/213337

Log:
  Use __FBSDID() instead of RCSID() in most .S files under lib/msun/i386,
  and one under lib/msun/amd64.  This avoids adding the identifiers to the
  .text section, and moves them to the .comment section instead.
  
  Suggested by:	bde
  Approved by:	rpaulo (mentor)

Modified:
  head/lib/msun/amd64/s_logbl.S
  head/lib/msun/i387/e_exp.S
  head/lib/msun/i387/e_fmod.S
  head/lib/msun/i387/e_log.S
  head/lib/msun/i387/e_log10.S
  head/lib/msun/i387/e_remainder.S
  head/lib/msun/i387/e_sqrt.S
  head/lib/msun/i387/e_sqrtl.S
  head/lib/msun/i387/s_ceil.S
  head/lib/msun/i387/s_copysign.S
  head/lib/msun/i387/s_cos.S
  head/lib/msun/i387/s_finite.S
  head/lib/msun/i387/s_floor.S
  head/lib/msun/i387/s_logb.S
  head/lib/msun/i387/s_logbl.S
  head/lib/msun/i387/s_rint.S
  head/lib/msun/i387/s_rintl.S
  head/lib/msun/i387/s_scalbn.S
  head/lib/msun/i387/s_significand.S
  head/lib/msun/i387/s_sin.S
  head/lib/msun/i387/s_tan.S

Modified: head/lib/msun/amd64/s_logbl.S
==============================================================================
--- head/lib/msun/amd64/s_logbl.S	Fri Oct  1 19:02:31 2010	(r213336)
+++ head/lib/msun/amd64/s_logbl.S	Fri Oct  1 20:14:36 2010	(r213337)
@@ -34,8 +34,7 @@
  */
 
 #include 
-
-RCSID("$FreeBSD$")
+__FBSDID("$FreeBSD$")
 
 ENTRY(logbl)
 	fldt	8(%rsp)

Modified: head/lib/msun/i387/e_exp.S
==============================================================================
--- head/lib/msun/i387/e_exp.S	Fri Oct  1 19:02:31 2010	(r213336)
+++ head/lib/msun/i387/e_exp.S	Fri Oct  1 20:14:36 2010	(r213337)
@@ -34,8 +34,7 @@
  */
 
 #include 
-
-RCSID("$FreeBSD$")
+__FBSDID("$FreeBSD$")
 
 /* e^x = 2^(x * log2(e)) */
 ENTRY(exp)

Modified: head/lib/msun/i387/e_fmod.S
==============================================================================
--- head/lib/msun/i387/e_fmod.S	Fri Oct  1 19:02:31 2010	(r213336)
+++ head/lib/msun/i387/e_fmod.S	Fri Oct  1 20:14:36 2010	(r213337)
@@ -34,8 +34,7 @@
  */
 
 #include 
-
-RCSID("$FreeBSD$")
+__FBSDID("$FreeBSD$")
 
 ENTRY(fmod)
 	fldl	12(%esp)

Modified: head/lib/msun/i387/e_log.S
==============================================================================
--- head/lib/msun/i387/e_log.S	Fri Oct  1 19:02:31 2010	(r213336)
+++ head/lib/msun/i387/e_log.S	Fri Oct  1 20:14:36 2010	(r213337)
@@ -34,8 +34,7 @@
  */
 
 #include 
-
-RCSID("$FreeBSD$")
+__FBSDID("$FreeBSD$")
 
 ENTRY(log)
 	fldln2

Modified: head/lib/msun/i387/e_log10.S
==============================================================================
--- head/lib/msun/i387/e_log10.S	Fri Oct  1 19:02:31 2010	(r213336)
+++ head/lib/msun/i387/e_log10.S	Fri Oct  1 20:14:36 2010	(r213337)
@@ -34,8 +34,7 @@
  */
 
 #include 
-
-RCSID("$FreeBSD$")
+__FBSDID("$FreeBSD$")
 
 ENTRY(log10)
 	fldlg2

Modified: head/lib/msun/i387/e_remainder.S
==============================================================================
--- head/lib/msun/i387/e_remainder.S	Fri Oct  1 19:02:31 2010	(r213336)
+++ head/lib/msun/i387/e_remainder.S	Fri Oct  1 20:14:36 2010	(r213337)
@@ -34,8 +34,7 @@
  */
 
 #include 
-
-RCSID("$FreeBSD$")
+__FBSDID("$FreeBSD$")
 
 ENTRY(remainder)
 	fldl	12(%esp)

Modified: head/lib/msun/i387/e_sqrt.S
==============================================================================
--- head/lib/msun/i387/e_sqrt.S	Fri Oct  1 19:02:31 2010	(r213336)
+++ head/lib/msun/i387/e_sqrt.S	Fri Oct  1 20:14:36 2010	(r213337)
@@ -34,8 +34,7 @@
  */
 
 #include 
-
-RCSID("$FreeBSD$")
+__FBSDID("$FreeBSD$")
 
 ENTRY(sqrt)
 	fldl	4(%esp)

Modified: head/lib/msun/i387/e_sqrtl.S
==============================================================================
--- head/lib/msun/i387/e_sqrtl.S	Fri Oct  1 19:02:31 2010	(r213336)
+++ head/lib/msun/i387/e_sqrtl.S	Fri Oct  1 20:14:36 2010	(r213337)
@@ -34,8 +34,7 @@
  */
 
 #include 
-
-RCSID("$FreeBSD$")
+__FBSDID("$FreeBSD$")
 
 ENTRY(sqrtl)
 	fldt	4(%esp)

Modified: head/lib/msun/i387/s_ceil.S
==============================================================================
--- head/lib/msun/i387/s_ceil.S	Fri Oct  1 19:02:31 2010	(r213336)
+++ head/lib/msun/i387/s_ceil.S	Fri Oct  1 20:14:36 2010	(r213337)
@@ -34,8 +34,7 @@
  */
 
 #include 
-
-RCSID("$FreeBSD$")
+__FBSDID("$FreeBSD$")
 
 ENTRY(ceil)
 	pushl	%ebp

Modified: head/lib/msun/i387/s_copysign.S
==============================================================================
--- head/lib/msun/i387/s_copysign.S	Fri Oct  1 19:02:31 2010	(r213336)
+++ head/lib/msun/i387/s_copysign.S	Fri Oct  1 20:14:36 2010	(r213337)
@@ -34,8 +34,7 @@
  */
 
 #include 
-
-RCSID("$FreeBSD$")
+__FBSDID("$FreeBSD$")
 
 ENTRY(copysign)
 	movl	16(%esp),%edx

Modified: head/lib/msun/i387/s_cos.S
==============================================================================
--- head/lib/msun/i387/s_cos.S	Fri Oct  1 19:02:31 2010	(r213336)
+++ head/lib/msun/i387/s_cos.S	Fri Oct  1 20:14:36 2010	(r213337)
@@ -34,8 +34,7 @@
  */
 
 #include 
-
-RCSID("$FreeBSD$")
+__FBSDID("$FreeBSD$")
 
 ENTRY(cos)
 	fldl	4(%esp)

Modified: head/lib/msun/i387/s_finite.S
==============================================================================
--- head/lib/msun/i387/s_finite.S	Fri Oct  1 19:02:31 2010	(r213336)
+++ head/lib/msun/i387/s_finite.S	Fri Oct  1 20:14:36 2010	(r213337)
@@ -34,8 +34,7 @@
  */
 
 #include 
-
-RCSID("$FreeBSD$")
+__FBSDID("$FreeBSD$")
 
 ENTRY(finite)
 	movl	8(%esp),%eax

Modified: head/lib/msun/i387/s_floor.S
==============================================================================
--- head/lib/msun/i387/s_floor.S	Fri Oct  1 19:02:31 2010	(r213336)
+++ head/lib/msun/i387/s_floor.S	Fri Oct  1 20:14:36 2010	(r213337)
@@ -34,8 +34,7 @@
  */
 
 #include 
-
-RCSID("$FreeBSD$")
+__FBSDID("$FreeBSD$")
 
 ENTRY(floor)
 	pushl	%ebp

Modified: head/lib/msun/i387/s_logb.S
==============================================================================
--- head/lib/msun/i387/s_logb.S	Fri Oct  1 19:02:31 2010	(r213336)
+++ head/lib/msun/i387/s_logb.S	Fri Oct  1 20:14:36 2010	(r213337)
@@ -34,8 +34,7 @@
  */
 
 #include 
-
-RCSID("$FreeBSD$")
+__FBSDID("$FreeBSD$")
 
 ENTRY(logb)
 	fldl	4(%esp)

Modified: head/lib/msun/i387/s_logbl.S
==============================================================================
--- head/lib/msun/i387/s_logbl.S	Fri Oct  1 19:02:31 2010	(r213336)
+++ head/lib/msun/i387/s_logbl.S	Fri Oct  1 20:14:36 2010	(r213337)
@@ -34,8 +34,7 @@
  */
 
 #include 
-
-RCSID("$FreeBSD$")
+__FBSDID("$FreeBSD$")
 
 ENTRY(logbl)
 	fldt	4(%esp)

Modified: head/lib/msun/i387/s_rint.S
==============================================================================
--- head/lib/msun/i387/s_rint.S	Fri Oct  1 19:02:31 2010	(r213336)
+++ head/lib/msun/i387/s_rint.S	Fri Oct  1 20:14:36 2010	(r213337)
@@ -34,8 +34,7 @@
  */
 
 #include 
-
-RCSID("$FreeBSD$")
+__FBSDID("$FreeBSD$")
 
 ENTRY(rint)
 	fldl	4(%esp)

Modified: head/lib/msun/i387/s_rintl.S
==============================================================================
--- head/lib/msun/i387/s_rintl.S	Fri Oct  1 19:02:31 2010	(r213336)
+++ head/lib/msun/i387/s_rintl.S	Fri Oct  1 20:14:36 2010	(r213337)
@@ -34,8 +34,7 @@
  */
 
 #include 
-
-RCSID("$FreeBSD$")
+__FBSDID("$FreeBSD$")
 
 ENTRY(rintl)
 	fldt	4(%esp)

Modified: head/lib/msun/i387/s_scalbn.S
==============================================================================
--- head/lib/msun/i387/s_scalbn.S	Fri Oct  1 19:02:31 2010	(r213336)
+++ head/lib/msun/i387/s_scalbn.S	Fri Oct  1 20:14:36 2010	(r213337)
@@ -34,8 +34,7 @@
  */
 
 #include 
-
-RCSID("$FreeBSD$")
+__FBSDID("$FreeBSD$")
 
 ENTRY(scalbn)
 	fildl	12(%esp)

Modified: head/lib/msun/i387/s_significand.S
==============================================================================
--- head/lib/msun/i387/s_significand.S	Fri Oct  1 19:02:31 2010	(r213336)
+++ head/lib/msun/i387/s_significand.S	Fri Oct  1 20:14:36 2010	(r213337)
@@ -34,8 +34,7 @@
  */
 
 #include 
-
-RCSID("$FreeBSD$")
+__FBSDID("$FreeBSD$")
 
 ENTRY(significand)
 	fldl	4(%esp)

Modified: head/lib/msun/i387/s_sin.S
==============================================================================
--- head/lib/msun/i387/s_sin.S	Fri Oct  1 19:02:31 2010	(r213336)
+++ head/lib/msun/i387/s_sin.S	Fri Oct  1 20:14:36 2010	(r213337)
@@ -34,8 +34,7 @@
  */
 
 #include 
-
-RCSID("$FreeBSD$")
+__FBSDID("$FreeBSD$")
 
 ENTRY(sin)
 	fldl	4(%esp)

Modified: head/lib/msun/i387/s_tan.S
==============================================================================
--- head/lib/msun/i387/s_tan.S	Fri Oct  1 19:02:31 2010	(r213336)
+++ head/lib/msun/i387/s_tan.S	Fri Oct  1 20:14:36 2010	(r213337)
@@ -34,8 +34,7 @@
  */
 
 #include 
-
-RCSID("$FreeBSD$")
+__FBSDID("$FreeBSD$")
 
 ENTRY(tan)
 	fldl	4(%esp)

From owner-svn-src-head@FreeBSD.ORG  Fri Oct  1 21:00:27 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 981601065672;
	Fri,  1 Oct 2010 21:00:27 +0000 (UTC) (envelope-from dim@FreeBSD.org)
Received: from tensor.andric.com (cl-327.ede-01.nl.sixxs.net
	[IPv6:2001:7b8:2ff:146::2])
	by mx1.freebsd.org (Postfix) with ESMTP id 555348FC20;
	Fri,  1 Oct 2010 21:00:27 +0000 (UTC)
Received: from [IPv6:2001:7b8:3a7:0:75a8:594d:1806:1e34] (unknown
	[IPv6:2001:7b8:3a7:0:75a8:594d:1806:1e34])
	(using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits))
	(No client certificate requested)
	by tensor.andric.com (Postfix) with ESMTPSA id 895355C43;
	Fri,  1 Oct 2010 23:00:26 +0200 (CEST)
Message-ID: <4CA64BF1.9080401@FreeBSD.org>
Date: Fri, 01 Oct 2010 23:00:33 +0200
From: Dimitry Andric 
Organization: The FreeBSD Project
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US;
	rv:1.9.2.11pre) Gecko/20100929 Lanikai/3.1.5pre
MIME-Version: 1.0
To: Anonymous 
References: <201009212141.o8LLfjHX007646@svn.freebsd.org>
	<86mxqx7q9o.fsf@gmail.com>
In-Reply-To: <86mxqx7q9o.fsf@gmail.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r212979 - in head: gnu/lib/libobjc
 sys/boot/i386/boot2 sys/boot/pc98/boot2
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 01 Oct 2010 21:00:27 -0000

On 2010-10-01 19:54, Anonymous wrote:
>> -.if ${CC:T:Mclang} == "clang"
>> -CC=gcc
>> -.endif
>> +CC:=${CC:C/^(.*\/)?clang$/gcc/1}
>
> How about clearing some user-defined variable together with the substitution
>
>    CLANG_FLAGS = # set to empty value
>    CC := ${CC:C/^(.*\/)?clang$/gcc/1}
>
> in which user can store clang-specific flags (via src.conf), e.g.
>
>    CC = clang ${CLANG_FLAGS}
>    CLANG_FLAGS = -Qunused-arguments # too much noise for `make -s' build
>
> or
>
>    CPUTYPE ?= native
>    CLANG_FLAGS = -mno-sse4 # don't feed as(1) unknown opcodes
>
> Otherwise, substitution occurs too late and gcc(1) chokes on unknown
> options.

Adding your clang-specific flags to CC will not work, because the

CC:=${CC:C/^(.*\/)?clang$/gcc/1}

expression explicitly does not filter out any command line arguments.
This is needed for the build32 stage on amd64, for instance.

Note the -Qunused-arguments flags is really just a quick hack, to stop
Clang from warning about unused arguments.  It reduces warnings during
compilation, but the warnings should in fact be fixed, by not providing
redundant arguments anymore.  However, it will take a while to do this
properly.

The particular case of libobjc is special, because it is the only
Makefile that both modifies CC, and takes the default CFLAGS from
make.conf.  The only other cases where we *must* compile with gcc for
now, are boot2 for i386 and pc98, but these set their CFLAGS to a
hardcoded value.

A solution could be to always use hardcoded CFLAGS for libobjc.
Otherwise, we could check for a GCC_CFLAGS in libobjc's Makefile, and
substitute these for the regular CFLAGS, iff clang is used to build
world.  Does that sound acceptable?

From owner-svn-src-head@FreeBSD.ORG  Fri Oct  1 21:02:04 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 928CD106566B;
	Fri,  1 Oct 2010 21:02:04 +0000 (UTC)
	(envelope-from brde@optusnet.com.au)
Received: from mail05.syd.optusnet.com.au (mail05.syd.optusnet.com.au
	[211.29.132.186])
	by mx1.freebsd.org (Postfix) with ESMTP id 0E99E8FC1B;
	Fri,  1 Oct 2010 21:02:02 +0000 (UTC)
Received: from c122-107-116-249.carlnfd1.nsw.optusnet.com.au
	(c122-107-116-249.carlnfd1.nsw.optusnet.com.au [122.107.116.249])
	by mail05.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id
	o91L1wA7019432
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
	Sat, 2 Oct 2010 07:01:59 +1000
Date: Sat, 2 Oct 2010 07:01:58 +1000 (EST)
From: Bruce Evans 
X-X-Sender: bde@delplex.bde.org
To: Dimitry Andric 
In-Reply-To: <4CA5FE07.5010104@FreeBSD.org>
Message-ID: <20101002053412.C873@delplex.bde.org>
References: <201010011310.o91DABUU007534@svn.freebsd.org>
	<20101001132233.GA83116@freebsd.org> <4CA5FE07.5010104@FreeBSD.org>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
Cc: Jilles Tjoelker , svn-src-head@freebsd.org,
	Roman Divacky , src-committers@freebsd.org,
	svn-src-all@freebsd.org
Subject: Re: svn commit: r213326 - head/lib/libc/i386/string
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 01 Oct 2010 21:02:04 -0000

On Fri, 1 Oct 2010, Dimitry Andric wrote:

> On 2010-10-01 15:22, Roman Divacky wrote:
>> there's "rep cmps" in bcmp.S and memcmp.S in both amd64/i386
>> 
>> they both have C counterparts, no idea how fast those are (they
>> are going char by char).
>> 
>> does this wisdom apply to those too?
>
> Well, these versions compare by words first, using "repe cmpsl" (for
> i386) and "rep cmpsq" (for amd64).  Only if there any bytes remaining
> after that, they are checked with "repe cmpsb".

I think the speedup is not really because string instructions are very
slow, but because the C strlen() is sophisticated.  The asm versions compare
a byte at a time, while the C version mostly compares sizeof(long) words
at a time.  Only the "rep lodsb" is very slow, and "rep movs*" is quite
fast, at least if it asks to move 8 bytes at a time or the implementation
converts to that.

However, I double that the sophistication of the C version is an
optimization.  It has more overhead for short strings, and most strings are
short.

Many of the asm functions already don't use string instructions, but use
ordinary byte access instructions that would be generated for a C program
written using the same algorithm, except the compiler would add overhead
instructions.

> It is probably possible to optimize these versions for the case the
> source pointers are not aligned.  That will not occur too much,
> probably, and complicate the implementation.

And would be a negative optimization, or irrelevant, since the source
pointers must already be aligned if efficiency is important.

> On the other hand, the C implementations of bcmp and memcmp are
> basically simple "while (*src++ == *dst++);" implementations, so it is
> entirely up to the compiler to do any optimization magic there.

It is only when the asm versions are more sophisticated than that when
the asm versions are worth having.

The ones worth doing in asm for x86 are probably shown by ls -C of
src/libc/amd64/string:

CVS/		bcopy.S		memcpy.S	strcat.S
Makefile.inc	bzero.S		memmove.S	strcmp.S
bcmp.S		memcmp.S	memset.S	strcpy.S

Originally, amd64 didn't have any MD implementations of string functions
in libc, and no one really noticed since even bcopy is only about twice
as slow in C using a naive algorithm and a naive compiler, but eventually
the above were added.  Analysis:

bcmp.S: uses cmpsq.  Probably not called enough to matter.
bcopy.S: uses movsq.  Adequate, though it can be beaten by up to a factor
     of 2 using SSE2 for large copies on some CPUs
bzero.S: like bcopy.S
memcmp.S: like bcmp.S.  Should be called even less than bcmp(), or at least
     halve the number of uses of each, sinc bcmp() is the BSD spelling
memcpy.S: just wraps bcopy.S
memmove.S: just wraps bcopy.S
memset.S: uses stosq, and has too much alignment overhead
strcat.S: sophisticated, probably to a fault.  I think it uses the same
     algorithm as the C version to find the end of the source and target
     strings, with large code to manually inline this for each.  Probably
     not called enough to matter
strcmp.S: sophisticated again.  Uses the same method as the C strlen
     (0x8080 trick) to find the end(s).  The C version doesn't bother with
     this.
strcpy.S: like strcmp.S.  Again, the C version is unsophisticated.

Note that strlen.S is not present here.  This is because the compiler
normally inlines strlen() using "repnz scasb", so the sophisticated C
version and the i386 asm version are not normally used and the missing
amd64 asm version is not normally missed.  "Normally" involves compiling
with -O.  Howver, with -O2 gcc knows that it doesn't understand string
instructions, and it generates a call to strlen() instead of "optimizing"
it to "repnz scasb"!  The "optimization" seems to be independent of
the target -- it happens even on amd64 without -O2.  gcc understands
the string instruction memcpy() better than this -- it used generate
"rep movs*", but now either calls memcpy() or does load-store with
non-string instructions.

ls -C of src/libc/amd64/string shows too many string functions:

Makefile.inc	index.S		memset.S	strcpy.S	wcschr.S
bcmp.S		memchr.S	rindex.S	strlen.S	wcscmp.S
bcopy.S		memcmp.S	strcat.S	strncmp.S	wcslen.S
bzero.S		memcpy.S	strchr.S	strrchr.S	wmemchr.S
ffs.S		memmove.S	strcmp.S	swab.S

bcmp.S: like amd64
bcopy.S: like amd64
bzero.S like amd64
ffs.S: another mistake.  gcc normally inlines this, and cperciva has a
     faster version using a lookup table, and I have a faster version
     using floating point.  The last 2 methods may only be faster for
     32-bit ffs (they don't scale so well to 64 bits), but only the 32
     bit one has an "optimized" asm version
index.S: unsophisticated, but avoids string instructions
memchr.S: like index.S
memcmp.S: like bcmp.S
memcpy.S: just wraps bcopy.S
memmove.S: just wraps bcopy.S
memset.S: link 
rindex.S: like index.S
strcat.S: unsophisticated, but avoids string instructions
strchr.S: even more like index.s
strcmp.S: unsophisticated, but avoids string instructions
strcpy.S: unsophisticated, but avoids string instructions
strlen.S: when it existed: unsophisticated, but avoids string instructions
strncmp.S: like strcmp.S
strrchr.S: like index.S
swab.S: by far the best example of how to optimize using string instructions,
     but only for an 8088.  It uses "lodsw; rorw; stosw;".
wcschr.S: like strchr.S (?)
wcscmp.S: like strcmp.S (?)
wcslen.S: uses a simple loop with 8-fold unrolling and no strong instructions.
    The C version uses a simple loop with no unrolling.  Probably a silly
    optimization -- if the unrolling is good, then put it in the C version
    and let the compiler generate almost the same code as here, or better.
    The best unrolling factor may be MD, but I doubt 8 is best for all x86's.
    The 0x8080 trick doesn't really apply to wide characters, so this function
    (and wider anything) are inherently slower.
wmemchr.S: like memchr.S (?)

Bruce

From owner-svn-src-head@FreeBSD.ORG  Fri Oct  1 21:28:45 2010
Return-Path: 
Delivered-To: svn-src-head@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id DF640106564A;
	Fri,  1 Oct 2010 21:28:45 +0000 (UTC)
	(envelope-from brde@optusnet.com.au)
Received: from mail05.syd.optusnet.com.au (mail05.syd.optusnet.com.au
	[211.29.132.186])
	by mx1.freebsd.org (Postfix) with ESMTP id 75E478FC19;
	Fri,  1 Oct 2010 21:28:45 +0000 (UTC)
Received: from c122-107-116-249.carlnfd1.nsw.optusnet.com.au
	(c122-107-116-249.carlnfd1.nsw.optusnet.com.au [122.107.116.249])
	by mail05.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id
	o91LSfXr003213
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
	Sat, 2 Oct 2010 07:28:43 +1000
Date: Sat, 2 Oct 2010 07:28:41 +1000 (EST)
From: Bruce Evans 
X-X-Sender: bde@delplex.bde.org
To: Dimitry Andric 
In-Reply-To: <201010012014.o91KEaYC016578@svn.freebsd.org>
Message-ID: <20101002070552.B942@delplex.bde.org>
References: <201010012014.o91KEaYC016578@svn.freebsd.org>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org,
	src-committers@FreeBSD.org
Subject: Re: svn commit: r213337 - in head/lib/msun: amd64 i387
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 01 Oct 2010 21:28:46 -0000

On Fri, 1 Oct 2010, Dimitry Andric wrote:

> Log:
>  Use __FBSDID() instead of RCSID() in most .S files under lib/msun/i386,
>  and one under lib/msun/amd64.  This avoids adding the identifiers to the
>  .text section, and moves them to the .comment section instead.
>
>  Suggested by:	bde
>  Approved by:	rpaulo (mentor)

Thanks, but this adds some style bugs...

> Modified: head/lib/msun/amd64/s_logbl.S
> ==============================================================================
> --- head/lib/msun/amd64/s_logbl.S	Fri Oct  1 19:02:31 2010	(r213336)
> +++ head/lib/msun/amd64/s_logbl.S	Fri Oct  1 20:14:36 2010	(r213337)
> @@ -34,8 +34,7 @@
>  */
>
> #include 
> -
> -RCSID("$FreeBSD$")
> +__FBSDID("$FreeBSD$")
>
> ENTRY(logbl)
> 	fldt	8(%rsp)
>

Unlike for similar-at-first-glance includes of  before
__FBSDID() in C files, where these includes are unfortunately necessary
to get __FBSDID() defined before it is used (without misplacing the
latter) and this is indicated by not separating the include line from
the __FBSDID() line, the includes of  are necessary
for the whole file, and this should be indicated by separating the
include line from everything else by a blank line like it used to be.

Also, 2 files in msun/amd64 still have an uncommented-out RCSID() to
indicate where they came from.  These should have either a commented-out
RCSID() or a non-broken RCSID() using .ident.  We mostly use the former.

Also, all except 11 files in msun/i387 and 1 file in msun/amd64 are missing
a commented-out RCSID("$NetBSD...$") to indicated where they came from.  I
think most of the NetBSD ids were corrupted in the initial import when the
id string was spelled $Id$ so it was not unique, so that even id strings
in comments (and not surrounded by FOOID()) got corrupted.  Full fixes in
this area involve determining the original vendor ids and adding them to
most of the files as comments.  I think no one cares about who wrote the
old bits, but sometimes I would like to track the history of the file.
Don't forget to add "from:" lines for repo-copies and other times when
the file name or directory changed, or if version control history was lost,
so that the history can be found.

Bruce

From owner-svn-src-head@FreeBSD.ORG  Fri Oct  1 21:37:48 2010
Return-Path: 
Delivered-To: svn-src-head@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 936A4106564A;
	Fri,  1 Oct 2010 21:37:48 +0000 (UTC)
	(envelope-from brde@optusnet.com.au)
Received: from mail09.syd.optusnet.com.au (mail09.syd.optusnet.com.au
	[211.29.132.190])
	by mx1.freebsd.org (Postfix) with ESMTP id 0E1E78FC16;
	Fri,  1 Oct 2010 21:37:47 +0000 (UTC)
Received: from c122-107-116-249.carlnfd1.nsw.optusnet.com.au
	(c122-107-116-249.carlnfd1.nsw.optusnet.com.au [122.107.116.249])
	by mail09.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id
	o91LbjKw005812
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
	Sat, 2 Oct 2010 07:37:46 +1000
Date: Sat, 2 Oct 2010 07:37:40 +1000 (EST)
From: Bruce Evans 
X-X-Sender: bde@delplex.bde.org
To: Bruce Evans 
In-Reply-To: <20101002070552.B942@delplex.bde.org>
Message-ID: <20101002073000.R942@delplex.bde.org>
References: <201010012014.o91KEaYC016578@svn.freebsd.org>
	<20101002070552.B942@delplex.bde.org>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org,
	src-committers@FreeBSD.org, Dimitry Andric 
Subject: Re: svn commit: r213337 - in head/lib/msun: amd64 i387
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 01 Oct 2010 21:37:48 -0000

On Sat, 2 Oct 2010, Bruce Evans wrote:

> ...
> Also, all except 11 files in msun/i387 and 1 file in msun/amd64 are missing
> a commented-out RCSID("$NetBSD...$") to indicated where they came from.  I
> think most of the NetBSD ids were corrupted in the initial import when the
> id string was spelled $Id$ so it was not unique, so that even id strings
> in comments (and not surrounded by FOOID()) got corrupted.  Full fixes in
> this area involve determining the original vendor ids and adding them to
> most of the files as comments.  ...

PS: src/msun was initially imported from NetBSD in 1994.  In 1995, jtc
relaxed the copyright on most of the files in msun/i387.  This was mostly
never imported, so that NetBSD has files with no copyright ("Public
domain") where FreeBSD still has ones with a 4-clause BSD licence.  This
could be fixed as part of fixing the ids.  We really want the 1995 ones
with their copyright changes and ids so as not to merge non-administrivial
changes.

Bruce

From owner-svn-src-head@FreeBSD.ORG  Fri Oct  1 21:47:05 2010
Return-Path: 
Delivered-To: svn-src-head@FreeBSD.ORG
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 56AC01065675;
	Fri,  1 Oct 2010 21:47:05 +0000 (UTC)
	(envelope-from delphij@delphij.net)
Received: from tarsier.geekcn.org (tarsier.geekcn.org [IPv6:2001:470:a803::1])
	by mx1.freebsd.org (Postfix) with ESMTP id BC1868FC1A;
	Fri,  1 Oct 2010 21:47:04 +0000 (UTC)
Received: from mail.geekcn.org (tarsier.geekcn.org [211.166.10.233])
	by tarsier.geekcn.org (Postfix) with ESMTP id CE874A6B2EF;
	Sat,  2 Oct 2010 05:47:03 +0800 (CST)
X-Virus-Scanned: amavisd-new at geekcn.org
Received: from tarsier.geekcn.org ([211.166.10.233])
	by mail.geekcn.org (mail.geekcn.org [211.166.10.233]) (amavisd-new,
	port 10024)
	with LMTP id Gjhi5ddNlqlF; Sat,  2 Oct 2010 05:46:58 +0800 (CST)
Received: from delta.delphij.net (drawbridge.ixsystems.com [206.40.55.65])
	(using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits))
	(No client certificate requested)
	by tarsier.geekcn.org (Postfix) with ESMTPSA id B5C9BA6B322;
	Sat,  2 Oct 2010 05:46:56 +0800 (CST)
DomainKey-Signature: a=rsa-sha1; s=default; d=delphij.net; c=nofws; q=dns;
	h=message-id:date:from:reply-to:organization:user-agent:
	mime-version:to:cc:subject:references:in-reply-to:
	x-enigmail-version:openpgp:content-type:content-transfer-encoding;
	b=PCu8byz5/52vC6Jpne1Z7EJZfbWsSGhHmeUwb2hPDI0/mcRUXRvt/qvkedcIsD388
	JxU2w9cAmzGDzqggvrD9Q==
Message-ID: <4CA656CD.40908@delphij.net>
Date: Fri, 01 Oct 2010 14:46:53 -0700
From: Xin LI 
Organization: The FreeBSD Project
User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US;
	rv:1.9.1.12) Gecko/20100920 Thunderbird/3.0.8 ThunderBrowse/3.3.2
MIME-Version: 1.0
To: Roman Divacky 
References: <201010011310.o91DABUU007534@svn.freebsd.org>
	<20101001132233.GA83116@freebsd.org>
In-Reply-To: <20101001132233.GA83116@freebsd.org>
X-Enigmail-Version: 1.0.1
OpenPGP: id=3FCA37C1;
	url=http://www.delphij.net/delphij.asc
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Cc: Jilles Tjoelker , svn-src-head@FreeBSD.ORG,
	svn-src-all@FreeBSD.ORG, src-committers@FreeBSD.ORG
Subject: Re: svn commit: r213326 - head/lib/libc/i386/string
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: d@delphij.net
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 01 Oct 2010 21:47:05 -0000

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

On 2010/10/01 06:22, Roman Divacky wrote:
> On Fri, Oct 01, 2010 at 01:10:11PM +0000, Jilles Tjoelker wrote:
>> Author: jilles
>> Date: Fri Oct  1 13:10:11 2010
>> New Revision: 213326
>> URL: http://svn.freebsd.org/changeset/base/213326
>>
>> Log:
>>   libc: Remove the i386 assembler version of strlen(3).
>>   
>>   On anything modern, the C version, which processes a word at a time, is much
>>   faster. The Intel optimization manual explicitly warns against using REP
>>   prefixes with SCAS or CMPS, which is exactly what the assembler version
>>   does.
> 
> there's "rep cmps" in bcmp.S and memcmp.S in both amd64/i386
> 
> they both have C counterparts, no idea how fast those are (they
> are going char by char).

char by char will be slower than word-by-word in both aligned and
unaligned case.  There are some other factors like inline expanding,
etc. which also affects their speed and require careful tuning.

> does this wisdom apply to those too?

I'm not quite sure about bcmp() and memcmp() case, especially when the
two pointers are not aligned (say, (p1 & (sizeof(word)-1)) != (p2 &
(sizeof(word)-1))).  Branching for different aligning cases MAY give
better performance, BUT they can also hurt due to the added complexity,
so if we want to do it in a MI way we will need to benchmark.

===

By the way I have a memchr(3) implementation using the similar algorithm
strlen(3) uses, and microbenchmark shows a 2x to 3x improvement but it's
still in my queue and needs to do real-world testing.

Cheers,
- -- 
Xin LI 	http://www.delphij.net/
FreeBSD - The Power to Serve!	       Live free or die
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.16 (FreeBSD)

iQEcBAEBCAAGBQJMplbNAAoJEATO+BI/yjfBgWwH/2MSNvH0QNhEcyhKBU/Pzh8C
862myDjcxA4l1+ca2en9igPgWno+ZMUaiH4Td5qCBdX8tsFLlGCgC0o0a0HC51+7
mv8qTfWrYAFcU2NrmX8wsnprLijmS2NH3wBC0uJJXpJhmJUraTHbG9YcctIUe363
Yvy+d7HqraPvCShWEgj54V5q/vPPy5vT6gPFwhMpe0J9/gmSMwwxCF1RctE2K/Br
89TWb/g4vrFJCk3Ks3j8viJJN2Zd9sbBYeF/LBnMLPkVSJNCnw0j1gSs+uFbfgzw
Gv5WMNNpDu338dFMVJDddgxqWa+OW1oMgtHcLUmoxMQI87sir+NJQFBD6+EK22I=
=2+Hh
-----END PGP SIGNATURE-----

From owner-svn-src-head@FreeBSD.ORG  Sat Oct  2 01:24:21 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 27DA4106564A;
	Sat,  2 Oct 2010 01:24:21 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 16F268FC12;
	Sat,  2 Oct 2010 01:24:21 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o921OLO9022810;
	Sat, 2 Oct 2010 01:24:21 GMT (envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o921OLDH022808;
	Sat, 2 Oct 2010 01:24:21 GMT (envelope-from jmallett@svn.freebsd.org)
Message-Id: <201010020124.o921OLDH022808@svn.freebsd.org>
From: Juli Mallett 
Date: Sat, 2 Oct 2010 01:24:21 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r213340 - head/sys/mips/conf
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 02 Oct 2010 01:24:21 -0000

Author: jmallett
Date: Sat Oct  2 01:24:20 2010
New Revision: 213340
URL: http://svn.freebsd.org/changeset/base/213340

Log:
  Make the OCTEON1 configuration look like a normal GENERIC configuration.  In
  particular, add PCI and USB buses and most devices.  Also move to using ULE,
  adding INET6, turning on WITNESS by default, etc.

Modified:
  head/sys/mips/conf/OCTEON1

Modified: head/sys/mips/conf/OCTEON1
==============================================================================
--- head/sys/mips/conf/OCTEON1	Sat Oct  2 00:57:41 2010	(r213339)
+++ head/sys/mips/conf/OCTEON1	Sat Oct  2 01:24:20 2010	(r213340)
@@ -1,7 +1,8 @@
-# OCTEON1 -- Configuration kernel for all Octeon1 SoCs from Cavium Networks
 #
-# For more information on this file, please read the handbook section on
-# Kernel Configuration Files:
+# OCTEON1 -- Generic kernel configuration file for FreeBSD/MIPS on Cavium Octeon
+#
+# For more information on this file, please read the config(5) manual page,
+# and/or the handbook section on Kernel Configuration Files:
 #
 #    http://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html
 #
@@ -11,19 +12,12 @@
 # latest information.
 #
 # An exhaustive list of options and more detailed explanations of the
-# device lines is also present in the ../../conf/NOTES and NOTES files. 
-# If you are in doubt as to the purpose or necessity of a line, check first 
+# device lines is also present in the ../../conf/NOTES and NOTES files.
+# If you are in doubt as to the purpose or necessity of a line, check first
 # in NOTES.
 #
 # $FreeBSD$
 
-##############################################################################
-###                                                                        ###
-### PLEASE NOTE: This file is the experimental 64-bit kernel.  If you want ###
-### a stable kernel, please use the 32-bit OCTEON1-32 instead.             ###
-###                                                                        ###
-##############################################################################
-
 machine		mips
 cpu		CPU_CNMIPS
 ident		OCTEON1
@@ -42,61 +36,261 @@ hints		"OCTEON1.hints"		#Default places 
 
 makeoptions	DEBUG=-g		#Build kernel with gdb(1) debug symbols
 
-#XXXimp: Need to make work with 64-bit too
-options 	ISA_MIPS64
-
-options 	DDB
-options 	KDB
-
-options 	SCHED_4BSD		#4BSD scheduler
-options 	INET			#InterNETworking
-options 	NFSCLIENT		#Network Filesystem Client
-#options	NFS_ROOT		#NFS usable as /, requires NFSCLIENT
-options 	PSEUDOFS		#Pseudo-filesystem framework
-options 	_KPOSIX_PRIORITY_SCHEDULING #Posix P1003_1B real-time extensions
-#options	ROOTDEVNAME=\"ufs:ad0s1a\"	# Original
-options 	NO_SWAPPING
-
-
-options 	FFS			#Berkeley Fast Filesystem
-options 	SOFTUPDATES		#Enable FFS soft updates support
-options 	UFS_ACL			#Support for access control lists
-options 	UFS_DIRHASH		#Improve performance on big directories
-
-
-# Debugging for use in -current
-#options 	DEADLKRES	#Enable the deadlock resolver
-options 	INVARIANTS		#Enable calls of extra sanity checking
-options 	INVARIANT_SUPPORT	#Extra sanity checks of internal structures, required by INVARIANTS
-#options 	WITNESS			#Enable checks to detect deadlocks and cycles
-#options 	WITNESS_SKIPSPIN	#Don't run witness on spinlocks for speed
-
-options 	SMP
-
 # Board-specific support that cannot be auto-detected at runtime.
 #options 	OCTEON_VENDOR_LANNER		# Support for Lanner boards.
 #options 	OCTEON_BOARD_CAPK_0100ND	# Support for CAPK-0100nd.
 
-device		loop
-device		ether
-device		md
-device		uart
-nodevice	uart_ns8250
-device		miibus
-device	 	octe
-#options 	VERBOSE_SYSINIT
-
-device		bpf
-device		random
-
-#
-# Use the following for  Compact Flash file-system
-device 		cf
-options 	ROOTDEVNAME=\"ufs:cf0s2a\"	# Unmask if compact flash is needed as RFS
+# XXX This option is very nearly irrelevant.
+options 	ISA_MIPS64
 
-#
-# Use the following for RFS in mem-device
-#options 	MD_ROOT
-#options 	ROOTDEVNAME=\"ufs:md0\"
+options 	SCHED_ULE		# ULE scheduler
+options 	PREEMPTION		# Enable kernel thread preemption
+options 	INET			# InterNETworking
+options 	INET6			# IPv6 communications protocols
+options 	SCTP			# Stream Control Transmission Protocol
+options 	FFS			# Berkeley Fast Filesystem
+options 	SOFTUPDATES		# Enable FFS soft updates support
+options 	UFS_ACL			# Support for access control lists
+options 	UFS_DIRHASH		# Improve performance on big directories
+options 	UFS_GJOURNAL		# Enable gjournal-based UFS journaling
+options 	MD_ROOT			# MD is a potential root device
+options 	NFSCLIENT		# Network Filesystem Client
+options 	NFSSERVER		# Network Filesystem Server
+options 	NFSLOCKD		# Network Lock Manager
+options 	NFS_ROOT		# NFS usable as /, requires NFSCLIENT
+options 	MSDOSFS			# MSDOS Filesystem
+options 	CD9660			# ISO 9660 Filesystem
+options 	PROCFS			# Process filesystem (requires PSEUDOFS)
+options 	PSEUDOFS		# Pseudo-filesystem framework
+options 	GEOM_PART_GPT		# GUID Partition Tables.
+options 	GEOM_LABEL		# Provides labelization
+#options 	COMPAT_FREEBSD32	# Compatible with o32 binaries (not yet)
+options 	SCSI_DELAY=5000		# Delay (in ms) before probing SCSI
+options 	KTRACE			# ktrace(1) support
+options 	STACK			# stack(9) support
+options 	SYSVSHM			# SYSV-style shared memory
+options 	SYSVMSG			# SYSV-style message queues
+options 	SYSVSEM			# SYSV-style semaphores
+options 	_KPOSIX_PRIORITY_SCHEDULING # POSIX P1003_1B real-time extensions
+options 	PRINTF_BUFR_SIZE=128	# Prevent printf output being interspersed.
+options 	HWPMC_HOOKS		# Necessary kernel hooks for hwpmc(4)
+options 	AUDIT			# Security event auditing
+options 	MAC			# TrustedBSD MAC Framework
+options 	FLOWTABLE		# per-cpu routing cache
+#options 	KDTRACE_FRAME		# Ensure frames are compiled in
+#options 	KDTRACE_HOOKS		# Kernel DTrace hooks
+options 	INCLUDE_CONFIG_FILE     # Include this file in kernel
+options 	NO_SWAPPING		# Disable support for paging
 
-#options 	MD_ROOT_SIZE=21264
+# Debugging for use in -current
+options 	KDB			# Enable kernel debugger support.
+options 	DDB			# Support DDB.
+options 	GDB			# Support remote GDB.
+options 	DEADLKRES		# Enable the deadlock resolver
+options 	INVARIANTS		# Enable calls of extra sanity checking
+options 	INVARIANT_SUPPORT	# Extra sanity checks of internal structures, required by INVARIANTS
+options 	WITNESS			# Enable checks to detect deadlocks and cycles
+options 	WITNESS_SKIPSPIN	# Don't run witness on spinlocks for speed
+options 	MALLOC_DEBUG_MAXZONES=8	# Separate malloc(9) zones
+
+# Make an SMP-capable kernel by default
+options 	SMP			# Symmetric MultiProcessor Kernel
+
+# Bus support.
+device		pci
+
+# ATA and ATAPI devices
+device		ata
+device		atadisk		# ATA disk drives
+device		ataraid		# ATA RAID drives
+device		atapicd		# ATAPI CDROM drives
+device		atapifd		# ATAPI floppy drives
+device		atapist		# ATAPI tape drives
+options 	ATA_STATIC_ID	# Static device numbering
+
+# On-board Compact Flash driver.
+device		cf
+options 	ROOTDEVNAME=\"ufs:cf0s2a\"	# Default root filesystem.
+
+# SCSI Controllers
+device		ahc		# AHA2940 and onboard AIC7xxx devices
+options 	AHC_REG_PRETTY_PRINT	# Print register bitfields in debug
+					# output.  Adds ~128k to driver.
+device		ahd		# AHA39320/29320 and onboard AIC79xx devices
+options 	AHD_REG_PRETTY_PRINT	# Print register bitfields in debug
+					# output.  Adds ~215k to driver.
+device		amd		# AMD 53C974 (Tekram DC-390(T))
+device		hptiop		# Highpoint RocketRaid 3xxx series
+device		isp		# Qlogic family
+#device		ispfw		# Firmware for QLogic HBAs- normally a module
+device		mpt		# LSI-Logic MPT-Fusion
+device		mps		# LSI-Logic MPT-Fusion 2
+#device		ncr		# NCR/Symbios Logic
+device		trm		# Tekram DC395U/UW/F DC315U adapters
+
+device		adv		# Advansys SCSI adapters
+device		adw		# Advansys wide SCSI adapters
+device		aic		# Adaptec 15[012]x SCSI adapters, AIC-6[23]60.
+device		bt		# Buslogic/Mylex MultiMaster SCSI adapters
+
+# SCSI peripherals
+device		scbus		# SCSI bus (required for SCSI)
+device		ch		# SCSI media changers
+device		da		# Direct Access (disks)
+device		sa		# Sequential Access (tape etc)
+device		cd		# CD
+device		pass		# Passthrough device (direct SCSI access)
+device		ses		# SCSI Environmental Services (and SAF-TE)
+
+# RAID controllers interfaced to the SCSI subsystem
+device		amr		# AMI MegaRAID
+#XXX it is not 64-bit clean, -scottl
+#device		asr		# DPT SmartRAID V, VI and Adaptec SCSI RAID
+device		ciss		# Compaq Smart RAID 5*
+device		dpt		# DPT Smartcache III, IV - See NOTES for options
+device		iir		# Intel Integrated RAID
+device		ips		# IBM (Adaptec) ServeRAID
+device		mly		# Mylex AcceleRAID/eXtremeRAID
+
+# RAID controllers
+device		aac		# Adaptec FSA RAID
+device		aacp		# SCSI passthrough for aac (requires CAM)
+device		ida		# Compaq Smart RAID
+device		mfi		# LSI MegaRAID SAS
+device		mlx		# Mylex DAC960 family
+#XXX pointer/int warnings
+#device		pst		# Promise Supertrak SX6000
+device		twe		# 3ware ATA RAID
+
+# PCCARD (PCMCIA) support
+# PCMCIA and cardbus bridge support
+device		cbb		# cardbus (yenta) bridge
+device		pccard		# PC Card (16-bit) bus
+device		cardbus		# CardBus (32-bit) bus
+
+# Serial (COM) ports
+device		uart		# Generic UART driver
+
+# If you've got a "dumb" serial or parallel PCI card that is
+# supported by the puc(4) glue driver, uncomment the following
+# line to enable it (connects to sio, uart and/or ppc drivers):
+#device		puc
+
+# On-board Cavium Octeon Ethernet.
+# NOTE: Be sure to keep the 'device miibus' line in order to use these NICs!
+device		octe
+
+# PCI Ethernet NICs.
+device		de		# DEC/Intel DC21x4x (``Tulip'')
+device		em		# Intel PRO/1000 Gigabit Ethernet Family
+device		igb		# Intel PRO/1000 PCIE Server Gigabit Family
+device		ixgbe		# Intel PRO/10GbE PCIE Ethernet Family
+device		le		# AMD Am7900 LANCE and Am79C9xx PCnet
+device		ti		# Alteon Networks Tigon I/II gigabit Ethernet
+device		txp		# 3Com 3cR990 (``Typhoon'')
+device		vx		# 3Com 3c590, 3c595 (``Vortex'')
+
+# PCI Ethernet NICs that use the common MII bus controller code.
+# NOTE: Be sure to keep the 'device miibus' line in order to use these NICs!
+device		miibus		# MII bus support
+device		ae		# Attansic/Atheros L2 FastEthernet
+device		age		# Attansic/Atheros L1 Gigabit Ethernet
+device		alc		# Atheros AR8131/AR8132 Ethernet
+device		ale		# Atheros AR8121/AR8113/AR8114 Ethernet
+device		bce		# Broadcom BCM5706/BCM5708 Gigabit Ethernet
+device		bfe		# Broadcom BCM440x 10/100 Ethernet
+device		bge		# Broadcom BCM570xx Gigabit Ethernet
+device		dc		# DEC/Intel 21143 and various workalikes
+device		et		# Agere ET1310 10/100/Gigabit Ethernet
+device		fxp		# Intel EtherExpress PRO/100B (82557, 82558)
+device		jme		# JMicron JMC250 Gigabit/JMC260 Fast Ethernet
+device		lge		# Level 1 LXT1001 gigabit Ethernet
+device		msk		# Marvell/SysKonnect Yukon II Gigabit Ethernet
+device		nge		# NatSemi DP83820 gigabit Ethernet
+#device		nve		# nVidia nForce MCP on-board Ethernet Networking
+device		pcn		# AMD Am79C97x PCI 10/100 (precedence over 'le')
+device		re		# RealTek 8139C+/8169/8169S/8110S
+device		rl		# RealTek 8129/8139
+device		sf		# Adaptec AIC-6915 (``Starfire'')
+device		sge		# Silicon Integrated Systems SiS190/191
+device		sis		# Silicon Integrated Systems SiS 900/SiS 7016
+device		sk		# SysKonnect SK-984x & SK-982x gigabit Ethernet
+device		ste		# Sundance ST201 (D-Link DFE-550TX)
+device		stge		# Sundance/Tamarack TC9021 gigabit Ethernet
+device		tl		# Texas Instruments ThunderLAN
+device		tx		# SMC EtherPower II (83c170 ``EPIC'')
+device		vge		# VIA VT612x gigabit Ethernet
+device		vr		# VIA Rhine, Rhine II
+device		wb		# Winbond W89C840F
+device		xl		# 3Com 3c90x (``Boomerang'', ``Cyclone'')
+
+# Wireless NIC cards
+device		wlan		# 802.11 support
+options 	IEEE80211_DEBUG	# enable debug msgs
+options 	IEEE80211_AMPDU_AGE # age frames in AMPDU reorder q's
+options 	IEEE80211_SUPPORT_MESH	# enable 802.11s draft support
+device		wlan_wep	# 802.11 WEP support
+device		wlan_ccmp	# 802.11 CCMP support
+device		wlan_tkip	# 802.11 TKIP support
+device		wlan_amrr	# AMRR transmit rate control algorithm
+device		an		# Aironet 4500/4800 802.11 wireless NICs.
+device		ath		# Atheros pci/cardbus NIC's
+device		ath_hal		# pci/cardbus chip support
+options 	AH_SUPPORT_AR5416	# enable AR5416 tx/rx descriptors
+device		ath_rate_sample	# SampleRate tx rate control for ath
+device		ral		# Ralink Technology RT2500 wireless NICs.
+device		wi		# WaveLAN/Intersil/Symbol 802.11 wireless NICs.
+
+# Pseudo devices.
+device		loop		# Network loopback
+device		random		# Entropy device
+device		ether		# Ethernet support
+device		vlan		# 802.1Q VLAN support
+device		tun		# Packet tunnel.
+device		pty		# BSD-style compatibility pseudo ttys
+device		md		# Memory "disks"
+device		gif		# IPv6 and IPv4 tunneling
+device		faith		# IPv6-to-IPv4 relaying (translation)
+device		firmware	# firmware assist module
+
+# The `bpf' device enables the Berkeley Packet Filter.
+# Be aware of the administrative consequences of enabling this!
+# Note that 'bpf' is required for DHCP.
+device		bpf		# Berkeley packet filter
+
+# USB support
+options 	USB_DEBUG	# enable debug msgs
+device		octusb		# Cavium Octeon on-board USB interface (USB 2.0)
+device		uhci		# UHCI PCI->USB interface
+device		ohci		# OHCI PCI->USB interface
+device		ehci		# EHCI PCI->USB interface (USB 2.0)
+device		usb		# USB Bus (required)
+#device		udbp		# USB Double Bulk Pipe devices
+device		uhid		# "Human Interface Devices"
+device		ulpt		# Printer
+device		umass		# Disks/Mass storage - Requires scbus and da
+device		ums		# Mouse
+device		urio		# Diamond Rio 500 MP3 player
+# USB Serial devices
+device		u3g		# USB-based 3G modems (Option, Huawei, Sierra)
+device		uark		# Technologies ARK3116 based serial adapters
+device		ubsa		# Belkin F5U103 and compatible serial adapters
+device		uftdi		# For FTDI usb serial adapters
+device		uipaq		# Some WinCE based devices
+device		uplcom		# Prolific PL-2303 serial adapters
+device		uslcom		# SI Labs CP2101/CP2102 serial adapters
+device		uvisor		# Visor and Palm devices
+device		uvscom		# USB serial support for DDI pocket's PHS
+# USB Ethernet, requires miibus
+device		aue		# ADMtek USB Ethernet
+device		axe		# ASIX Electronics USB Ethernet
+device		cdce		# Generic USB over Ethernet
+device		cue		# CATC USB Ethernet
+device		kue		# Kawasaki LSI USB Ethernet
+device		rue		# RealTek RTL8150 USB Ethernet
+device		udav		# Davicom DM9601E USB
+# USB Wireless
+device		rum		# Ralink Technology RT2501USB wireless NICs
+device		uath		# Atheros AR5523 wireless NICs
+device		ural		# Ralink Technology RT2500USB wireless NICs
+device		zyd		# ZyDAS zb1211/zb1211b wireless NICs

From owner-svn-src-head@FreeBSD.ORG  Sat Oct  2 01:28:19 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 206EC106564A;
	Sat,  2 Oct 2010 01:28:19 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 106AA8FC08;
	Sat,  2 Oct 2010 01:28: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 o921SIaO022934;
	Sat, 2 Oct 2010 01:28:18 GMT (envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o921SIgE022932;
	Sat, 2 Oct 2010 01:28:18 GMT (envelope-from jmallett@svn.freebsd.org)
Message-Id: <201010020128.o921SIgE022932@svn.freebsd.org>
From: Juli Mallett 
Date: Sat, 2 Oct 2010 01:28:18 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r213341 - head/sys/mips/cavium
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 02 Oct 2010 01:28:19 -0000

Author: jmallett
Date: Sat Oct  2 01:28:18 2010
New Revision: 213341
URL: http://svn.freebsd.org/changeset/base/213341

Log:
  Remove extra cpu setting and commented-out devices, some of which don't exist.

Modified:
  head/sys/mips/cavium/std.octeon1

Modified: head/sys/mips/cavium/std.octeon1
==============================================================================
--- head/sys/mips/cavium/std.octeon1	Sat Oct  2 01:24:20 2010	(r213340)
+++ head/sys/mips/cavium/std.octeon1	Sat Oct  2 01:28:18 2010	(r213341)
@@ -5,15 +5,3 @@
 # $FreeBSD$
 # 
 files	"../cavium/files.octeon1"
-
-#
-# 
-#
-cpu     CPU_MIPS4KC
-#device	pci
-#device	ata
-#device	atadisk
-
-#device clock
-#device obio
-#device uart

From owner-svn-src-head@FreeBSD.ORG  Sat Oct  2 01:29:09 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 84C711065675;
	Sat,  2 Oct 2010 01:29:09 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 74D648FC24;
	Sat,  2 Oct 2010 01:29: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 o921T9fT022986;
	Sat, 2 Oct 2010 01:29:09 GMT (envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o921T9BY022984;
	Sat, 2 Oct 2010 01:29:09 GMT (envelope-from jmallett@svn.freebsd.org)
Message-Id: <201010020129.o921T9BY022984@svn.freebsd.org>
From: Juli Mallett 
Date: Sat, 2 Oct 2010 01:29:09 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r213342 - head/sys/mips/mips
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 02 Oct 2010 01:29:09 -0000

Author: jmallett
Date: Sat Oct  2 01:29:09 2010
New Revision: 213342
URL: http://svn.freebsd.org/changeset/base/213342

Log:
  Use ABI-aware macros for setting up a fake frame.

Modified:
  head/sys/mips/mips/locore.S

Modified: head/sys/mips/mips/locore.S
==============================================================================
--- head/sys/mips/mips/locore.S	Sat Oct  2 01:28:18 2010	(r213341)
+++ head/sys/mips/mips/locore.S	Sat Oct  2 01:29:09 2010	(r213342)
@@ -161,11 +161,11 @@ VECTOR(_locore, unknown)
 	/*
 	 * Initialize stack and call machine startup.
 	 */
-	PTR_LA	sp, _C_LABEL(pcpu_space)
-	addiu	sp, (PAGE_SIZE * 2) - CALLFRAME_SIZ
+	PTR_LA		sp, _C_LABEL(pcpu_space)
+	PTR_ADDU	sp, (PAGE_SIZE * 2) - CALLFRAME_SIZ
 
-	sw	zero, CALLFRAME_SIZ - 4(sp)	# Zero out old ra for debugger
-	sw	zero, CALLFRAME_SIZ - 8(sp)	# Zero out old fp for debugger
+	REG_S	zero, CALLFRAME_RA(sp)	# Zero out old ra for debugger
+	REG_S	zero, CALLFRAME_SP(sp)	# Zero out old fp for debugger
 
 	PTR_LA	gp, _C_LABEL(_gp)
 

From owner-svn-src-head@FreeBSD.ORG  Sat Oct  2 05:38:45 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id BB6F7106564A;
	Sat,  2 Oct 2010 05:38:45 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id AA4ED8FC08;
	Sat,  2 Oct 2010 05:38: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 o925cjFd028712;
	Sat, 2 Oct 2010 05:38:45 GMT (envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o925cjaI028708;
	Sat, 2 Oct 2010 05:38:45 GMT (envelope-from jmallett@svn.freebsd.org)
Message-Id: <201010020538.o925cjaI028708@svn.freebsd.org>
From: Juli Mallett 
Date: Sat, 2 Oct 2010 05:38:45 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r213345 - head/sys/mips/cavium
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 02 Oct 2010 05:38:45 -0000

Author: jmallett
Date: Sat Oct  2 05:38:45 2010
New Revision: 213345
URL: http://svn.freebsd.org/changeset/base/213345

Log:
  Rather than shifting offsets by three, set register offset to 3.  All our
  bus interface does that's special here now is to use a 64-bit register size.
  In theory, uart(4) ought to support a regsz as well as regshft and support
  64-bit registers directly.
  
  Also use the UART class's range rather than a hand-coded 1024 for the address
  range.

Modified:
  head/sys/mips/cavium/uart_bus_octeonusart.c
  head/sys/mips/cavium/uart_cpu_octeonusart.c
  head/sys/mips/cavium/uart_dev_oct16550.c

Modified: head/sys/mips/cavium/uart_bus_octeonusart.c
==============================================================================
--- head/sys/mips/cavium/uart_bus_octeonusart.c	Sat Oct  2 02:46:32 2010	(r213344)
+++ head/sys/mips/cavium/uart_bus_octeonusart.c	Sat Oct  2 05:38:45 2010	(r213345)
@@ -105,11 +105,10 @@ uart_octeon_probe(device_t dev)
 	sc->sc_bas.bst = uart_bus_space_mem;
 	/*
 	 * XXX
-	 * RBR isn't really a great base address and it'd be great to not have
-	 * a hard-coded 1024.
+	 * RBR isn't really a great base address.
 	 */
-	if (bus_space_map(sc->sc_bas.bst, CVMX_MIO_UARTX_RBR(0), 1024,
-	    0, &sc->sc_bas.bsh) != 0)
+	if (bus_space_map(sc->sc_bas.bst, CVMX_MIO_UARTX_RBR(0),
+	    uart_getrange(sc->sc_class), 0, &sc->sc_bas.bsh) != 0)
 		return (ENXIO);
 	return (uart_bus_probe(dev, sc->sc_bas.regshft, 0, 0, unit));
 }

Modified: head/sys/mips/cavium/uart_cpu_octeonusart.c
==============================================================================
--- head/sys/mips/cavium/uart_cpu_octeonusart.c	Sat Oct  2 02:46:32 2010	(r213344)
+++ head/sys/mips/cavium/uart_cpu_octeonusart.c	Sat Oct  2 05:38:45 2010	(r213345)
@@ -58,56 +58,56 @@ static uint8_t
 ou_bs_r_1(void *t, bus_space_handle_t handle, bus_size_t offset)
 {
 
-	return (oct_read64(handle + (offset << 3)));
+	return (oct_read64(handle + offset));
 }
 
 static uint16_t
 ou_bs_r_2(void *t, bus_space_handle_t handle, bus_size_t offset)
 {
 
-	return (oct_read64(handle + (offset << 3)));
+	return (oct_read64(handle + offset));
 }
 
 static uint32_t
 ou_bs_r_4(void *t, bus_space_handle_t handle, bus_size_t offset)
 {
 
-	return (oct_read64(handle + (offset << 3)));
+	return (oct_read64(handle + offset));
 }
 
 static uint64_t
 ou_bs_r_8(void *t, bus_space_handle_t handle, bus_size_t offset)
 {
 
-	return (oct_read64(handle + (offset << 3)));
+	return (oct_read64(handle + offset));
 }
 
 static void
 ou_bs_w_1(void *t, bus_space_handle_t bsh, bus_size_t offset, uint8_t value)
 {
 
-	oct_write64(bsh + (offset << 3), value);
+	oct_write64(bsh + offset, value);
 }
 
 static void
 ou_bs_w_2(void *t, bus_space_handle_t bsh, bus_size_t offset, uint16_t value)
 {
 
-	oct_write64(bsh + (offset << 3), value);
+	oct_write64(bsh + offset, value);
 }
 
 static void
 ou_bs_w_4(void *t, bus_space_handle_t bsh, bus_size_t offset, uint32_t value)
 {
 
-	oct_write64(bsh + (offset << 3), value);
+	oct_write64(bsh + offset, value);
 }
 
 static void
 ou_bs_w_8(void *t, bus_space_handle_t bsh, bus_size_t offset, uint64_t value)
 {
 
-	oct_write64(bsh + (offset << 3), value);
+	oct_write64(bsh + offset, value);
 }
 
 struct bus_space octeon_uart_tag = {
@@ -160,10 +160,10 @@ uart_cpu_getdev(int devtype, struct uart
 	di->ops = uart_getops(class);
 	di->bas.chan = 0;
 	/* XXX */
-	if (bus_space_map(di->bas.bst, CVMX_MIO_UARTX_RBR(0), 1024,
-	    0, &di->bas.bsh) != 0)
+	if (bus_space_map(di->bas.bst, CVMX_MIO_UARTX_RBR(0),
+	    uart_getrange(class), 0, &di->bas.bsh) != 0)
 		return (ENXIO);
-	di->bas.regshft = 0;
+	di->bas.regshft = 3;
 	di->bas.rclk = 0;
 	di->baudrate = 115200;
 	di->databits = 8;

Modified: head/sys/mips/cavium/uart_dev_oct16550.c
==============================================================================
--- head/sys/mips/cavium/uart_dev_oct16550.c	Sat Oct  2 02:46:32 2010	(r213344)
+++ head/sys/mips/cavium/uart_dev_oct16550.c	Sat Oct  2 05:38:45 2010	(r213345)
@@ -420,7 +420,7 @@ struct uart_class uart_oct16550_class = 
 	oct16550_methods,
 	sizeof(struct oct16550_softc),
 	.uc_ops = &uart_oct16550_ops,
-	.uc_range = 8,
+	.uc_range = 8 << 3,
 	.uc_rclk = 0
 };
 

From owner-svn-src-head@FreeBSD.ORG  Sat Oct  2 05:43:18 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 4D5FE1065670;
	Sat,  2 Oct 2010 05:43:18 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 377538FC16;
	Sat,  2 Oct 2010 05:43: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 o925hI3m028846;
	Sat, 2 Oct 2010 05:43:18 GMT (envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o925hIrY028836;
	Sat, 2 Oct 2010 05:43:18 GMT (envelope-from jmallett@svn.freebsd.org)
Message-Id: <201010020543.o925hIrY028836@svn.freebsd.org>
From: Juli Mallett 
Date: Sat, 2 Oct 2010 05:43:18 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r213346 - in head/sys: contrib/octeon-sdk mips/cavium
	mips/cavium/octe
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 02 Oct 2010 05:43:18 -0000

Author: jmallett
Date: Sat Oct  2 05:43:17 2010
New Revision: 213346
URL: http://svn.freebsd.org/changeset/base/213346

Log:
  o) Allow devices to override the MDIO read and write functions presented to
     the miibus attached to octe interfaces.
  o) Add an SMI/MDIO interface to the MV88E61XX and use it for the switch PHY on
     the Lanner MR-320.  An actual driver for the switch PHY will come later.
     Note that for now it intercepts and fakes MII_BMSR reads to prevent the
     miibus from talking to anything but the switch itself.

Added:
  head/sys/mips/cavium/octe/ethernet-mv88e61xx.c   (contents, props changed)
  head/sys/mips/cavium/octe/ethernet-mv88e61xx.h   (contents, props changed)
Modified:
  head/sys/contrib/octeon-sdk/cvmx-helper-board.c
  head/sys/mips/cavium/files.octeon1
  head/sys/mips/cavium/octe/cavium-ethernet.h
  head/sys/mips/cavium/octe/ethernet-common.c
  head/sys/mips/cavium/octe/ethernet-headers.h
  head/sys/mips/cavium/octe/ethernet-mdio.c
  head/sys/mips/cavium/octe/octe.c

Modified: head/sys/contrib/octeon-sdk/cvmx-helper-board.c
==============================================================================
--- head/sys/contrib/octeon-sdk/cvmx-helper-board.c	Sat Oct  2 05:38:45 2010	(r213345)
+++ head/sys/contrib/octeon-sdk/cvmx-helper-board.c	Sat Oct  2 05:43:17 2010	(r213346)
@@ -181,10 +181,11 @@ int cvmx_helper_board_get_mii_address(in
 	/* Private vendor-defined boards.  */
 #if defined(OCTEON_VENDOR_LANNER)
 	case CVMX_BOARD_TYPE_CUST_LANNER_MR320:
+	    /* Port 0 is a Marvell 88E6161 switch, ports 1 and 2 are Marvell
+	       88E1111 interfaces.  */
 	    switch (ipd_port) {
 	    case 0:
-		/* XXX Switch PHY?  */
-		return -1;
+		return 16;
 	    case 1:
 		return 1;
 	    case 2:

Modified: head/sys/mips/cavium/files.octeon1
==============================================================================
--- head/sys/mips/cavium/files.octeon1	Sat Oct  2 05:38:45 2010	(r213345)
+++ head/sys/mips/cavium/files.octeon1	Sat Oct  2 05:43:17 2010	(r213346)
@@ -21,6 +21,7 @@ mips/cavium/cryptocteon/cavium_crypto.c	
 mips/cavium/cryptocteon/cryptocteon.c		optional cryptocteon
 
 mips/cavium/octe/ethernet.c			optional octe
+mips/cavium/octe/ethernet-mv88e61xx.c		optional octe octeon_vendor_lanner
 mips/cavium/octe/ethernet-common.c		optional octe
 mips/cavium/octe/ethernet-mdio.c		optional octe
 mips/cavium/octe/ethernet-mem.c			optional octe

Modified: head/sys/mips/cavium/octe/cavium-ethernet.h
==============================================================================
--- head/sys/mips/cavium/octe/cavium-ethernet.h	Sat Oct  2 05:38:45 2010	(r213345)
+++ head/sys/mips/cavium/octe/cavium-ethernet.h	Sat Oct  2 05:43:17 2010	(r213346)
@@ -72,6 +72,8 @@ typedef struct {
 
 	uint8_t mac[6];
 	int phy_id;
+	int (*mdio_read)(struct ifnet *, int, int);
+	void (*mdio_write)(struct ifnet *, int, int, int);
 
 	struct ifqueue tx_free_queue[16];
 

Modified: head/sys/mips/cavium/octe/ethernet-common.c
==============================================================================
--- head/sys/mips/cavium/octe/ethernet-common.c	Sat Oct  2 05:38:45 2010	(r213345)
+++ head/sys/mips/cavium/octe/ethernet-common.c	Sat Oct  2 05:43:17 2010	(r213346)
@@ -266,6 +266,20 @@ int cvm_oct_common_init(struct ifnet *if
 	memset(ifp->get_stats(ifp), 0, sizeof(struct ifnet_stats));
 #endif
 
+	/*
+	 * Do any last-minute board-specific initialization.
+	 */
+	switch (cvmx_sysinfo_get()->board_type) {
+#if defined(OCTEON_VENDOR_LANNER)
+	case CVMX_BOARD_TYPE_CUST_LANNER_MR320:
+		if (priv->phy_id == 16)
+			cvm_oct_mv88e61xx_setup_device(ifp);
+		break;
+#endif
+	default:
+		break;
+	}
+
 	device_attach(priv->dev);
 
 	return 0;

Modified: head/sys/mips/cavium/octe/ethernet-headers.h
==============================================================================
--- head/sys/mips/cavium/octe/ethernet-headers.h	Sat Oct  2 05:38:45 2010	(r213345)
+++ head/sys/mips/cavium/octe/ethernet-headers.h	Sat Oct  2 05:43:17 2010	(r213346)
@@ -40,4 +40,11 @@ AND WITH ALL FAULTS AND CAVIUM  NETWORKS
 #include "ethernet-tx.h"
 #include "ethernet-util.h"
 
+/*
+ * Any board- or vendor-specific includes.
+ */
+#ifdef OCTEON_VENDOR_LANNER
+#include "ethernet-mv88e61xx.h"
+#endif
+
 #endif

Modified: head/sys/mips/cavium/octe/ethernet-mdio.c
==============================================================================
--- head/sys/mips/cavium/octe/ethernet-mdio.c	Sat Oct  2 05:38:45 2010	(r213345)
+++ head/sys/mips/cavium/octe/ethernet-mdio.c	Sat Oct  2 05:43:17 2010	(r213346)
@@ -132,6 +132,8 @@ int cvm_oct_mdio_setup_device(struct ifn
 	cvm_oct_private_t *priv = (cvm_oct_private_t *)ifp->if_softc;
 
 	priv->phy_id = cvmx_helper_board_get_mii_address(priv->port);
+	priv->mdio_read = NULL;
+	priv->mdio_write = NULL;
 
 	return 0;
 }

Added: head/sys/mips/cavium/octe/ethernet-mv88e61xx.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/mips/cavium/octe/ethernet-mv88e61xx.c	Sat Oct  2 05:43:17 2010	(r213346)
@@ -0,0 +1,151 @@
+/*-
+ * Copyright (c) 2010 Juli Mallett 
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+/*
+ * Interface to the Marvell 88E61XX SMI/MDIO.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include 
+#include 
+
+#include "wrapper-cvmx-includes.h"
+#include "ethernet-headers.h"
+
+#define	MV88E61XX_SMI_PHY_SW	0x10	/* Switch PHY.  */
+
+#define	MV88E61XX_SMI_REG_CMD	0x00	/* Indirect command register.  */
+#define	 MV88E61XX_SMI_CMD_BUSY		0x8000	/* Busy bit.  */
+#define	 MV88E61XX_SMI_CMD_22		0x1000	/* Clause 22 (default 45.)  */
+#define	 MV88E61XX_SMI_CMD_READ		0x0800	/* Read command.  */
+#define	 MV88E61XX_SMI_CMD_WRITE	0x0400	/* Write command.  */
+#define	 MV88E61XX_SMI_CMD_PHY(phy)	(((phy) & 0x1f) << 5)
+#define	 MV88E61XX_SMI_CMD_REG(reg)	((reg) & 0x1f)
+
+#define	MV88E61XX_SMI_REG_DAT	0x01	/* Indirect data register.  */
+
+static int cvm_oct_mv88e61xx_mdio_read(struct ifnet *, int, int);
+static void cvm_oct_mv88e61xx_mdio_write(struct ifnet *, int, int, int);
+static int cvm_oct_mv88e61xx_smi_read(struct ifnet *, int, int);
+static void cvm_oct_mv88e61xx_smi_write(struct ifnet *, int, int, int);
+static int cvm_oct_mv88e61xx_smi_wait(struct ifnet *, int);
+
+int
+cvm_oct_mv88e61xx_setup_device(struct ifnet *ifp)
+{
+	cvm_oct_private_t *priv = (cvm_oct_private_t *)ifp->if_softc;
+
+	priv->mdio_read = cvm_oct_mv88e61xx_mdio_read;
+	priv->mdio_write = cvm_oct_mv88e61xx_mdio_write;
+
+	return (0);
+}
+
+static int
+cvm_oct_mv88e61xx_mdio_read(struct ifnet *ifp, int phy_id, int location)
+{
+	/*
+	 * Intercept reads of MII_BMSR.  The miibus uses this to determine
+	 * PHY presence and we only want it to look for a PHY attachment
+	 * for the switch PHY itself.  The PHY driver will talk to all of
+	 * the other ports as need be.
+	 */
+	switch (location) {
+	case MII_BMSR:
+		if (phy_id != MV88E61XX_SMI_PHY_SW)
+			return (0);
+		return (BMSR_EXTSTAT | BMSR_ACOMP | BMSR_LINK);
+	default:
+		return (cvm_oct_mv88e61xx_smi_read(ifp, phy_id, location));
+	}
+}
+
+static void
+cvm_oct_mv88e61xx_mdio_write(struct ifnet *ifp, int phy_id, int location, int val)
+{
+	return (cvm_oct_mv88e61xx_smi_write(ifp, phy_id, location, val));
+}
+
+static int
+cvm_oct_mv88e61xx_smi_read(struct ifnet *ifp, int phy_id, int location)
+{
+	int error;
+
+	error = cvm_oct_mv88e61xx_smi_wait(ifp, phy_id);
+	if (error != 0)
+		return (0);
+
+	cvm_oct_mdio_write(ifp, phy_id, MV88E61XX_SMI_REG_CMD,
+	    MV88E61XX_SMI_CMD_BUSY | MV88E61XX_SMI_CMD_22 |
+	    MV88E61XX_SMI_CMD_READ | MV88E61XX_SMI_CMD_PHY(phy_id) |
+	    MV88E61XX_SMI_CMD_REG(location));
+
+	error = cvm_oct_mv88e61xx_smi_wait(ifp, phy_id);
+	if (error != 0)
+		return (0);
+
+	return (cvm_oct_mdio_read(ifp, phy_id, MV88E61XX_SMI_REG_DAT));
+}
+
+static void
+cvm_oct_mv88e61xx_smi_write(struct ifnet *ifp, int phy_id, int location, int val)
+{
+	cvm_oct_mv88e61xx_smi_wait(ifp, phy_id);
+	cvm_oct_mdio_write(ifp, phy_id, MV88E61XX_SMI_REG_DAT, val);
+	cvm_oct_mdio_write(ifp, phy_id, MV88E61XX_SMI_REG_CMD,
+	    MV88E61XX_SMI_CMD_BUSY | MV88E61XX_SMI_CMD_22 |
+	    MV88E61XX_SMI_CMD_WRITE | MV88E61XX_SMI_CMD_PHY(phy_id) |
+	    MV88E61XX_SMI_CMD_REG(location));
+	cvm_oct_mv88e61xx_smi_wait(ifp, phy_id);
+}
+
+static int
+cvm_oct_mv88e61xx_smi_wait(struct ifnet *ifp, int phy_id)
+{
+	uint16_t cmd;
+	unsigned i;
+
+	for (i = 0; i < 10000; i++) {
+		cmd = cvm_oct_mdio_read(ifp, phy_id, MV88E61XX_SMI_REG_CMD);
+		if ((cmd & MV88E61XX_SMI_CMD_BUSY) == 0)
+			return (0);
+	}
+	return (ETIMEDOUT);
+}

Added: head/sys/mips/cavium/octe/ethernet-mv88e61xx.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/mips/cavium/octe/ethernet-mv88e61xx.h	Sat Oct  2 05:43:17 2010	(r213346)
@@ -0,0 +1,34 @@
+/*-
+ * Copyright (c) 2010 Juli Mallett 
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef	_CAVIUM_OCTE_ETHERNET_MV88E61XX_H_
+#define	_CAVIUM_OCTE_ETHERNET_MV88E61XX_H_
+
+int cvm_oct_mv88e61xx_setup_device(struct ifnet *ifp);
+
+#endif /* !_CAVIUM_OCTE_ETHERNET_MV88E61XX_H_ */

Modified: head/sys/mips/cavium/octe/octe.c
==============================================================================
--- head/sys/mips/cavium/octe/octe.c	Sat Oct  2 05:38:45 2010	(r213345)
+++ head/sys/mips/cavium/octe/octe.c	Sat Oct  2 05:43:17 2010	(r213346)
@@ -224,6 +224,15 @@ octe_miibus_readreg(device_t dev, int ph
 
 	priv = device_get_softc(dev);
 
+	/*
+	 * Try interface-specific MII routine.
+	 */
+	if (priv->mdio_read != NULL)
+		return (priv->mdio_read(priv->ifp, phy, reg));
+
+	/*
+	 * Try generic MII routine.
+	 */
 	if (phy != priv->phy_id)
 		return (0);
 
@@ -237,9 +246,19 @@ octe_miibus_writereg(device_t dev, int p
 
 	priv = device_get_softc(dev);
 
+	/*
+	 * Try interface-specific MII routine.
+	 */
+	if (priv->mdio_write != NULL) {
+		priv->mdio_write(priv->ifp, phy, reg, val);
+		return (0);
+	}
+
+	/*
+	 * Try generic MII routine.
+	 */
 	KASSERT(phy == priv->phy_id,
 	    ("write to phy %u but our phy is %u", phy, priv->phy_id));
-
 	cvm_oct_mdio_write(priv->ifp, phy, reg, val);
 
 	return (0);

From owner-svn-src-head@FreeBSD.ORG  Sat Oct  2 06:55:13 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 0B282106576A;
	Sat,  2 Oct 2010 06:55:04 +0000 (UTC)
	(envelope-from gordon@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id B1BF48FC1D;
	Sat,  2 Oct 2010 06:55:04 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o926t4uM030489;
	Sat, 2 Oct 2010 06:55:04 GMT (envelope-from gordon@svn.freebsd.org)
Received: (from gordon@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o926t41J030487;
	Sat, 2 Oct 2010 06:55:04 GMT (envelope-from gordon@svn.freebsd.org)
Message-Id: <201010020655.o926t41J030487@svn.freebsd.org>
From: Gordon Tetlow 
Date: Sat, 2 Oct 2010 06:55:04 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r213349 - head/usr.bin/man
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 02 Oct 2010 06:55:13 -0000

Author: gordon
Date: Sat Oct  2 06:55:04 2010
New Revision: 213349
URL: http://svn.freebsd.org/changeset/base/213349

Log:
  Fix up whatis/apropos issue displaying all output on a single due to
  forgotten quotes.
  
  Submitted by:	Brandon Gooch
  Approved by:	wes (mentor, implicit)

Modified:
  head/usr.bin/man/man.sh

Modified: head/usr.bin/man/man.sh
==============================================================================
--- head/usr.bin/man/man.sh	Sat Oct  2 06:54:59 2010	(r213348)
+++ head/usr.bin/man/man.sh	Sat Oct  2 06:55:04 2010	(r213349)
@@ -719,11 +719,11 @@ search_whatis() {
 	bad=${bad#\\n}
 
 	if [ -n "$good" ]; then
-		echo -e $good | $PAGER
+		echo -e "$good" | $PAGER
 	fi
 
 	if [ -n "$bad" ]; then
-		echo -e $bad >&2
+		echo -e "$bad" >&2
 	fi
 
 	exit $rval

From owner-svn-src-head@FreeBSD.ORG  Sat Oct  2 07:12:08 2010
Return-Path: 
Delivered-To: svn-src-head@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 14C951065672;
	Sat,  2 Oct 2010 07:12:08 +0000 (UTC) (envelope-from obrien@NUXI.org)
Received: from dragon.nuxi.org (trang.nuxi.org [74.95.12.85])
	by mx1.freebsd.org (Postfix) with ESMTP id E64458FC17;
	Sat,  2 Oct 2010 07:12:07 +0000 (UTC)
Received: from dragon.nuxi.org (obrien@localhost [127.0.0.1])
	by dragon.nuxi.org (8.14.4/8.14.4) with ESMTP id o927C7mV060714;
	Sat, 2 Oct 2010 00:12:07 -0700 (PDT)
	(envelope-from obrien@dragon.nuxi.org)
Received: (from obrien@localhost)
	by dragon.nuxi.org (8.14.4/8.14.4/Submit) id o927C7VG060713;
	Sat, 2 Oct 2010 00:12:07 -0700 (PDT) (envelope-from obrien)
Date: Sat, 2 Oct 2010 00:12:07 -0700
From: "David O'Brien" 
To: Dimitry Andric 
Message-ID: <20101002071207.GA60377@dragon.NUXI.org>
References: <201009201643.o8KGhJ95058838@svn.freebsd.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <201009201643.o8KGhJ95058838@svn.freebsd.org>
X-Operating-System: FreeBSD 9.0-CURRENT
X-to-the-FBI-CIA-and-NSA: HI! HOW YA DOIN?
User-Agent: Mutt/1.5.16 (2007-06-09)
Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org,
	src-committers@FreeBSD.org
Subject: Re: svn commit: r212904 - in head: contrib/llvm
	contrib/llvm/autoconf contrib/llvm/autoconf/m4
	contrib/llvm/bindings/ada/llvm contrib/llvm/bindings/ocaml/llvm
	contrib/llvm/include/llvm contrib/llvm/inc...
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: obrien@FreeBSD.org
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 02 Oct 2010 07:12:08 -0000

On Mon, Sep 20, 2010 at 04:43:19PM +0000, Dimitry Andric wrote:
> Author: dim
> Date: Mon Sep 20 16:43:17 2010
> New Revision: 212904
> Log:
>   Upgrade our Clang in base to r114020, from upstream's release_28 branch.
..
>   head/contrib/llvm/tools/llvmc/examples/
>      - copied from r212799, vendor/llvm/dist/tools/llvmc/examples/
..
>   head/contrib/llvm/tools/llvmc/example/Hello/Hello.cpp

We seem to now have contrib/llvm/tools/llvmc/example and
contrib/llvm/tools/llvmc/examples

Can one be svn rm'ed?  Or preferably, both?

-- 
-- David  (obrien@FreeBSD.org)

From owner-svn-src-head@FreeBSD.ORG  Sat Oct  2 08:18:20 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 2C5FF106566C;
	Sat,  2 Oct 2010 08:18:20 +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 1C5F08FC17;
	Sat,  2 Oct 2010 08:18: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 o928IK0i032586;
	Sat, 2 Oct 2010 08:18:20 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o928IJ6d032584;
	Sat, 2 Oct 2010 08:18:19 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <201010020818.o928IJ6d032584@svn.freebsd.org>
From: Konstantin Belousov 
Date: Sat, 2 Oct 2010 08:18:19 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r213354 - head/sys/dev/ciss
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 02 Oct 2010 08:18:20 -0000

Author: kib
Date: Sat Oct  2 08:18:19 2010
New Revision: 213354
URL: http://svn.freebsd.org/changeset/base/213354

Log:
  Cosmetic: make it less confusing when displaying RAID 1 level, that might
  be 1+0 as well.
  
  PR:	kern/150936
  MFC after:	2 weeks

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

Modified: head/sys/dev/ciss/ciss.c
==============================================================================
--- head/sys/dev/ciss/ciss.c	Sat Oct  2 08:11:38 2010	(r213353)
+++ head/sys/dev/ciss/ciss.c	Sat Oct  2 08:18:19 2010	(r213354)
@@ -4394,7 +4394,7 @@ ciss_name_ldrive_org(int org)
     case CISS_LDRIVE_RAID0:
 	return("RAID 0");
     case CISS_LDRIVE_RAID1:
-	return("RAID 1");
+	return("RAID 1(1+0)");
     case CISS_LDRIVE_RAID4:
 	return("RAID 4");
     case CISS_LDRIVE_RAID5:

From owner-svn-src-head@FreeBSD.ORG  Sat Oct  2 08:21:11 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 8CF2F1065675;
	Sat,  2 Oct 2010 08:21:11 +0000 (UTC)
	(envelope-from obrien@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 62C168FC1A;
	Sat,  2 Oct 2010 08:21:11 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o928LBYm032718;
	Sat, 2 Oct 2010 08:21:11 GMT (envelope-from obrien@svn.freebsd.org)
Received: (from obrien@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o928LBpf032717;
	Sat, 2 Oct 2010 08:21:11 GMT (envelope-from obrien@svn.freebsd.org)
Message-Id: <201010020821.o928LBpf032717@svn.freebsd.org>
From: "David E. O'Brien" 
Date: Sat, 2 Oct 2010 08:21:11 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r213355 - head/contrib/bzip2
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 02 Oct 2010 08:21:11 -0000

Author: obrien
Date: Sat Oct  2 08:21:11 2010
New Revision: 213355
URL: http://svn.freebsd.org/changeset/base/213355

Log:
  Note that ^/vendor/bzip2/dist has been merged into HEAD upto r213348.

Modified:
Directory Properties:
  head/contrib/bzip2/   (props changed)

From owner-svn-src-head@FreeBSD.ORG  Sat Oct  2 10:39:19 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 6DFF5106564A;
	Sat,  2 Oct 2010 10:39:19 +0000 (UTC)
	(envelope-from rpaulo@freebsd.org)
Received: from karen.lavabit.com (karen.lavabit.com [72.249.41.33])
	by mx1.freebsd.org (Postfix) with ESMTP id 3BDD78FC17;
	Sat,  2 Oct 2010 10:39:19 +0000 (UTC)
Received: from d.earth.lavabit.com (d.earth.lavabit.com [192.168.111.13])
	by karen.lavabit.com (Postfix) with ESMTP id 4BB8411B893;
	Sat,  2 Oct 2010 05:39:18 -0500 (CDT)
Received: from 10.0.10.3 (221.163.108.93.rev.vodafone.pt [93.108.163.221])
	by lavabit.com with ESMTP id VUUN498SX149;
	Sat, 02 Oct 2010 05:39:18 -0500
Mime-Version: 1.0 (Apple Message framework v1081)
Content-Type: text/plain; charset=us-ascii
From: Rui Paulo 
In-Reply-To: <20101002071207.GA60377@dragon.NUXI.org>
Date: Sat, 2 Oct 2010 11:39:14 +0100
Content-Transfer-Encoding: 7bit
Message-Id: <7EA1375A-28D9-478A-B985-083B625A569E@FreeBSD.org>
References: <201009201643.o8KGhJ95058838@svn.freebsd.org>
	<20101002071207.GA60377@dragon.NUXI.org>
To: obrien@FreeBSD.org
X-Mailer: Apple Mail (2.1081)
Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org,
	src-committers@FreeBSD.org, Dimitry Andric 
Subject: Re: svn commit: r212904 - in head: contrib/llvm
	contrib/llvm/autoconf contrib/llvm/autoconf/m4
	contrib/llvm/bindings/ada/llvm
	contrib/llvm/bindings/ocaml/llvm contrib/llvm/include/llvm
	contrib/llvm/inc...
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 02 Oct 2010 10:39:19 -0000

On 2 Oct 2010, at 08:12, David O'Brien wrote:

> On Mon, Sep 20, 2010 at 04:43:19PM +0000, Dimitry Andric wrote:
>> Author: dim
>> Date: Mon Sep 20 16:43:17 2010
>> New Revision: 212904
>> Log:
>>  Upgrade our Clang in base to r114020, from upstream's release_28 branch.
> ..
>>  head/contrib/llvm/tools/llvmc/examples/
>>     - copied from r212799, vendor/llvm/dist/tools/llvmc/examples/
> ..
>>  head/contrib/llvm/tools/llvmc/example/Hello/Hello.cpp
> 
> We seem to now have contrib/llvm/tools/llvmc/example and
> contrib/llvm/tools/llvmc/examples
> 
> Can one be svn rm'ed?  Or preferably, both?

IIRC, we can remove both.

Regards,
--
Rui Paulo



From owner-svn-src-head@FreeBSD.ORG  Sat Oct  2 11:45:18 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 8F9C01065698;
	Sat,  2 Oct 2010 11:45:18 +0000 (UTC) (envelope-from dim@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 7CFB08FC1F;
	Sat,  2 Oct 2010 11:45: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 o92BjIh5039376;
	Sat, 2 Oct 2010 11:45:18 GMT (envelope-from dim@svn.freebsd.org)
Received: (from dim@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o92BjIWr039375;
	Sat, 2 Oct 2010 11:45:18 GMT (envelope-from dim@svn.freebsd.org)
Message-Id: <201010021145.o92BjIWr039375@svn.freebsd.org>
From: Dimitry Andric 
Date: Sat, 2 Oct 2010 11:45:18 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r213358 - in head/contrib/llvm: tools/llvm2cpp
	tools/llvmc/driver tools/llvmc/example tools/llvmc/examples
	tools/llvmc/plugins utils/lit/ExampleTests
	utils/lit/ExampleTests.ObjDir utils...
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 02 Oct 2010 11:45:18 -0000

Author: dim
Date: Sat Oct  2 11:45:18 2010
New Revision: 213358
URL: http://svn.freebsd.org/changeset/base/213358

Log:
  Cleanup some example and empty directories that were left around after
  the last import of contrib/llvm.
  
  Suggested by:	obrien
  Approved by:	rpaulo (mentor)

Deleted:
  head/contrib/llvm/tools/llvm2cpp/
  head/contrib/llvm/tools/llvmc/driver/
  head/contrib/llvm/tools/llvmc/example/
  head/contrib/llvm/tools/llvmc/examples/
  head/contrib/llvm/tools/llvmc/plugins/
  head/contrib/llvm/utils/lit/ExampleTests/
  head/contrib/llvm/utils/lit/ExampleTests.ObjDir/
  head/contrib/llvm/utils/unittest/googletest/src/

From owner-svn-src-head@FreeBSD.ORG  Sat Oct  2 16:04:50 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id DE696106564A;
	Sat,  2 Oct 2010 16:04:50 +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 CDF2D8FC0A;
	Sat,  2 Oct 2010 16:04: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 o92G4o0W044418;
	Sat, 2 Oct 2010 16:04:50 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o92G4oCR044415;
	Sat, 2 Oct 2010 16:04:50 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <201010021604.o92G4oCR044415@svn.freebsd.org>
From: Konstantin Belousov 
Date: Sat, 2 Oct 2010 16:04:50 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r213359 - head/sys/kern
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 02 Oct 2010 16:04:51 -0000

Author: kib
Date: Sat Oct  2 16:04:50 2010
New Revision: 213359
URL: http://svn.freebsd.org/changeset/base/213359

Log:
  Release the vnode lock and close the linker file vnode earlier in
  the linker_load_file methods. The change is that the consequent
  linker_file_unload() call is not under the vnode lock anymore.
  This prevents the LOR between kernel linker sx xlock and vnode lock,
  because linker_file_unload() relocks kernel linker lock.
  
  MFC after:	2 weeks

Modified:
  head/sys/kern/link_elf.c
  head/sys/kern/link_elf_obj.c

Modified: head/sys/kern/link_elf.c
==============================================================================
--- head/sys/kern/link_elf.c	Sat Oct  2 11:45:18 2010	(r213358)
+++ head/sys/kern/link_elf.c	Sat Oct  2 16:04:50 2010	(r213359)
@@ -967,15 +967,15 @@ nosyms:
     *result = lf;
 
 out:
+    VOP_UNLOCK(nd.ni_vp, 0);
+    vn_close(nd.ni_vp, FREAD, td->td_ucred, td);
+    VFS_UNLOCK_GIANT(vfslocked);
     if (error && lf)
 	linker_file_unload(lf, LINKER_UNLOAD_FORCE);
     if (shdr)
 	free(shdr, M_LINKER);
     if (firstpage)
 	free(firstpage, M_LINKER);
-    VOP_UNLOCK(nd.ni_vp, 0);
-    vn_close(nd.ni_vp, FREAD, td->td_ucred, td);
-    VFS_UNLOCK_GIANT(vfslocked);
 
     return error;
 }

Modified: head/sys/kern/link_elf_obj.c
==============================================================================
--- head/sys/kern/link_elf_obj.c	Sat Oct  2 11:45:18 2010	(r213358)
+++ head/sys/kern/link_elf_obj.c	Sat Oct  2 16:04:50 2010	(r213359)
@@ -885,13 +885,13 @@ link_elf_load_file(linker_class_t cls, c
 	*result = lf;
 
 out:
+	VOP_UNLOCK(nd.ni_vp, 0);
+	vn_close(nd.ni_vp, FREAD, td->td_ucred, td);
+	VFS_UNLOCK_GIANT(vfslocked);
 	if (error && lf)
 		linker_file_unload(lf, LINKER_UNLOAD_FORCE);
 	if (hdr)
 		free(hdr, M_LINKER);
-	VOP_UNLOCK(nd.ni_vp, 0);
-	vn_close(nd.ni_vp, FREAD, td->td_ucred, td);
-	VFS_UNLOCK_GIANT(vfslocked);
 
 	return error;
 }

From owner-svn-src-head@FreeBSD.ORG  Sat Oct  2 17:19:38 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 5E461106566B;
	Sat,  2 Oct 2010 17:19:38 +0000 (UTC)
	(envelope-from nwhitehorn@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 4D3D08FC13;
	Sat,  2 Oct 2010 17:19:38 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o92HJcA6045972;
	Sat, 2 Oct 2010 17:19:38 GMT
	(envelope-from nwhitehorn@svn.freebsd.org)
Received: (from nwhitehorn@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o92HJc1p045970;
	Sat, 2 Oct 2010 17:19:38 GMT
	(envelope-from nwhitehorn@svn.freebsd.org)
Message-Id: <201010021719.o92HJc1p045970@svn.freebsd.org>
From: Nathan Whitehorn 
Date: Sat, 2 Oct 2010 17:19:38 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r213360 - head/sys/powerpc/powerpc
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 02 Oct 2010 17:19:38 -0000

Author: nwhitehorn
Date: Sat Oct  2 17:19:38 2010
New Revision: 213360
URL: http://svn.freebsd.org/changeset/base/213360

Log:
  Fix some KTR arguments that were breaking the LINT build.
  
  Pointy hat to:	me

Modified:
  head/sys/powerpc/powerpc/pmap_dispatch.c

Modified: head/sys/powerpc/powerpc/pmap_dispatch.c
==============================================================================
--- head/sys/powerpc/powerpc/pmap_dispatch.c	Sat Oct  2 16:04:50 2010	(r213359)
+++ head/sys/powerpc/powerpc/pmap_dispatch.c	Sat Oct  2 17:19:38 2010	(r213360)
@@ -437,7 +437,7 @@ void *
 pmap_mapdev_attr(vm_offset_t pa, vm_size_t size, vm_memattr_t attr)
 {
 
-	CTR3(KTR_PMAP, "%s(%#x, %#x)", __func__, pa, size);
+	CTR4(KTR_PMAP, "%s(%#x, %#x, %#x)", __func__, pa, size, attr);
 	return (MMU_MAPDEV_ATTR(mmu_obj, pa, size, attr));
 }
 
@@ -445,7 +445,7 @@ void
 pmap_page_set_memattr(vm_page_t m, vm_memattr_t ma)
 {
 
-	CTR3(KTR_PMAP, "%s(%#x, %#x)", __func__, pa, size);
+	CTR3(KTR_PMAP, "%s(%p, %#x)", __func__, m, ma);
 	return (MMU_PAGE_SET_MEMATTR(mmu_obj, m, ma));
 }
 
@@ -477,7 +477,7 @@ void
 pmap_kenter_attr(vm_offset_t va, vm_offset_t pa, vm_memattr_t ma)
 {
 
-	CTR3(KTR_PMAP, "%s(%#x, %#x)", __func__, va, pa);
+	CTR4(KTR_PMAP, "%s(%#x, %#x, %#x)", __func__, va, pa, ma);
 	MMU_KENTER_ATTR(mmu_obj, va, pa, ma);
 }
 

From owner-svn-src-head@FreeBSD.ORG  Sat Oct  2 17:20:30 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C818A10656AE;
	Sat,  2 Oct 2010 17:20:30 +0000 (UTC)
	(envelope-from marius@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id B71DB8FC21;
	Sat,  2 Oct 2010 17:20:30 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o92HKUT4046033;
	Sat, 2 Oct 2010 17:20:30 GMT (envelope-from marius@svn.freebsd.org)
Received: (from marius@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o92HKUG0046031;
	Sat, 2 Oct 2010 17:20:30 GMT (envelope-from marius@svn.freebsd.org)
Message-Id: <201010021720.o92HKUG0046031@svn.freebsd.org>
From: Marius Strobl 
Date: Sat, 2 Oct 2010 17:20:30 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r213361 - head/sys/dev/mii
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 02 Oct 2010 17:20:31 -0000

Author: marius
Date: Sat Oct  2 17:20:30 2010
New Revision: 213361
URL: http://svn.freebsd.org/changeset/base/213361

Log:
  Try to adhere to style(9) and be consistent within this file.

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

Modified: head/sys/dev/mii/mii.c
==============================================================================
--- head/sys/dev/mii/mii.c	Sat Oct  2 17:19:38 2010	(r213360)
+++ head/sys/dev/mii/mii.c	Sat Oct  2 17:20:30 2010	(r213361)
@@ -128,7 +128,7 @@ miibus_probe(device_t dev)
 	 	 */
 		bmsr = MIIBUS_READREG(parent, ma.mii_phyno, MII_BMSR);
 		if (bmsr == 0 || bmsr == 0xffff ||
-		    (bmsr & (BMSR_EXTSTAT|BMSR_MEDIAMASK)) == 0) {
+		    (bmsr & (BMSR_EXTSTAT | BMSR_MEDIAMASK)) == 0) {
 			/* Assume no PHY at this address. */
 			continue;
 		}
@@ -154,11 +154,11 @@ miibus_probe(device_t dev)
 	}
 
 	if (child == NULL)
-		return(ENXIO);
+		return (ENXIO);
 
 	device_set_desc(dev, "MII bus");
 
-	return(0);
+	return (0);
 }
 
 int
@@ -180,7 +180,7 @@ miibus_attach(device_t dev)
 	    ivars->ifmedia_sts);
 	bus_generic_attach(dev);
 
-	return(0);
+	return (0);
 }
 
 int
@@ -193,7 +193,7 @@ miibus_detach(device_t dev)
 	ifmedia_removeall(&mii->mii_media);
 	mii->mii_ifp = NULL;
 
-	return(0);
+	return (0);
 }
 
 static int
@@ -214,10 +214,12 @@ static int
 miibus_child_pnpinfo_str(device_t bus, device_t child, char *buf,
     size_t buflen)
 {
-	struct mii_attach_args *maa = device_get_ivars(child);
+	struct mii_attach_args *ma;
+
+	ma = device_get_ivars(child);
 	snprintf(buf, buflen, "oui=0x%x model=0x%x rev=0x%x",
-	    MII_OUI(maa->mii_id1, maa->mii_id2),
-	    MII_MODEL(maa->mii_id2), MII_REV(maa->mii_id2));
+	    MII_OUI(ma->mii_id1, ma->mii_id2),
+	    MII_MODEL(ma->mii_id2), MII_REV(ma->mii_id2));
 	return (0);
 }
 
@@ -225,8 +227,10 @@ static int
 miibus_child_location_str(device_t bus, device_t child, char *buf,
     size_t buflen)
 {
-	struct mii_attach_args *maa = device_get_ivars(child);
-	snprintf(buf, buflen, "phyno=%d", maa->mii_phyno);
+	struct mii_attach_args *ma;
+
+	ma = device_get_ivars(child);
+	snprintf(buf, buflen, "phyno=%d", ma->mii_phyno);
 	return (0);
 }
 
@@ -236,7 +240,7 @@ miibus_readreg(device_t dev, int phy, in
 	device_t		parent;
 
 	parent = device_get_parent(dev);
-	return(MIIBUS_READREG(parent, phy, reg));
+	return (MIIBUS_READREG(parent, phy, reg));
 }
 
 static int
@@ -245,7 +249,7 @@ miibus_writereg(device_t dev, int phy, i
 	device_t		parent;
 
 	parent = device_get_parent(dev);
-	return(MIIBUS_WRITEREG(parent, phy, reg, data));
+	return (MIIBUS_WRITEREG(parent, phy, reg, data));
 }
 
 static void
@@ -259,7 +263,6 @@ miibus_statchg(device_t dev)
 
 	mii = device_get_softc(dev);
 	mii->mii_ifp->if_baudrate = ifmedia_baudrate(mii->mii_media_active);
-	return;
 }
 
 static void
@@ -297,13 +300,11 @@ miibus_mediainit(device_t dev)
 	mii = device_get_softc(dev);
 	LIST_FOREACH(m, &mii->mii_media.ifm_list, ifm_list) {
 		media = m->ifm_media;
-		if (media == (IFM_ETHER|IFM_AUTO))
+		if (media == (IFM_ETHER | IFM_AUTO))
 			break;
 	}
 
 	ifmedia_set(&mii->mii_media, media);
-
-	return;
 }
 
 int
@@ -324,7 +325,7 @@ mii_phy_probe(device_t dev, device_t *ch
 	for (i = 0; i < MII_NPHY; i++) {
 		bmsr = MIIBUS_READREG(dev, i, MII_BMSR);
                 if (bmsr == 0 || bmsr == 0xffff ||
-                    (bmsr & (BMSR_EXTSTAT|BMSR_MEDIAMASK)) == 0) {
+                    (bmsr & (BMSR_EXTSTAT | BMSR_MEDIAMASK)) == 0) {
                         /* Assume no PHY at this address. */
                         continue;
                 } else
@@ -334,12 +335,12 @@ mii_phy_probe(device_t dev, device_t *ch
 	if (i == MII_NPHY) {
 		device_delete_child(dev, *child);
 		*child = NULL;
-		return(ENXIO);
+		return (ENXIO);
 	}
 
 	bus_generic_attach(dev);
 
-	return(0);
+	return (0);
 }
 
 /*
@@ -371,7 +372,7 @@ mii_tick(struct mii_data *mii)
 	struct mii_softc *child;
 
 	LIST_FOREACH(child, &mii->mii_phys, mii_list)
-		(void) (*child->mii_service)(child, mii, MII_TICK);
+		(void)(*child->mii_service)(child, mii, MII_TICK);
 }
 
 /*
@@ -386,7 +387,7 @@ mii_pollstat(struct mii_data *mii)
 	mii->mii_media_active = IFM_NONE;
 
 	LIST_FOREACH(child, &mii->mii_phys, mii_list)
-		(void) (*child->mii_service)(child, mii, MII_POLLSTAT);
+		(void)(*child->mii_service)(child, mii, MII_POLLSTAT);
 }
 
 /*

From owner-svn-src-head@FreeBSD.ORG  Sat Oct  2 17:58:58 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 41F5A106564A;
	Sat,  2 Oct 2010 17:58:58 +0000 (UTC) (envelope-from alc@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 16ADA8FC17;
	Sat,  2 Oct 2010 17:58: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 o92HwvSh046940;
	Sat, 2 Oct 2010 17:58:57 GMT (envelope-from alc@svn.freebsd.org)
Received: (from alc@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o92HwvnH046936;
	Sat, 2 Oct 2010 17:58:57 GMT (envelope-from alc@svn.freebsd.org)
Message-Id: <201010021758.o92HwvnH046936@svn.freebsd.org>
From: Alan Cox 
Date: Sat, 2 Oct 2010 17:58:57 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r213363 - in head/sys: fs/nwfs fs/smbfs ufs/ffs
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 02 Oct 2010 17:58:58 -0000

Author: alc
Date: Sat Oct  2 17:58:57 2010
New Revision: 213363
URL: http://svn.freebsd.org/changeset/base/213363

Log:
  M_USE_RESERVE has been deprecated for a decade.  Eliminate any uses that
  have no run-time effect.

Modified:
  head/sys/fs/nwfs/nwfs_vfsops.c
  head/sys/fs/smbfs/smbfs_vfsops.c
  head/sys/ufs/ffs/ffs_softdep.c

Modified: head/sys/fs/nwfs/nwfs_vfsops.c
==============================================================================
--- head/sys/fs/nwfs/nwfs_vfsops.c	Sat Oct  2 17:41:47 2010	(r213362)
+++ head/sys/fs/nwfs/nwfs_vfsops.c	Sat Oct  2 17:58:57 2010	(r213363)
@@ -186,8 +186,7 @@ static int nwfs_mount(struct mount *mp)
 	ncp_conn_unlock(conn, td);	/* we keep the ref */
 	mp->mnt_stat.f_iosize = conn->buffer_size;
         /* We must malloc our own mount info */
-        nmp = malloc(sizeof(struct nwmount),M_NWFSDATA,
-	    M_WAITOK | M_USE_RESERVE | M_ZERO);
+        nmp = malloc(sizeof(struct nwmount), M_NWFSDATA, M_WAITOK | M_ZERO);
         if (nmp == NULL) {
                 nwfs_printf("could not alloc nwmount\n");
                 error = ENOMEM;

Modified: head/sys/fs/smbfs/smbfs_vfsops.c
==============================================================================
--- head/sys/fs/smbfs/smbfs_vfsops.c	Sat Oct  2 17:41:47 2010	(r213362)
+++ head/sys/fs/smbfs/smbfs_vfsops.c	Sat Oct  2 17:58:57 2010	(r213363)
@@ -175,8 +175,7 @@ smbfs_mount(struct mount *mp)
 #ifdef SMBFS_USEZONE
 	smp = zalloc(smbfsmount_zone);
 #else
-	smp = malloc(sizeof(*smp), M_SMBFSDATA,
-	    M_WAITOK|M_USE_RESERVE);
+	smp = malloc(sizeof(*smp), M_SMBFSDATA, M_WAITOK);
 #endif
         if (smp == NULL) {
 		printf("could not alloc smbmount\n");

Modified: head/sys/ufs/ffs/ffs_softdep.c
==============================================================================
--- head/sys/ufs/ffs/ffs_softdep.c	Sat Oct  2 17:41:47 2010	(r213362)
+++ head/sys/ufs/ffs/ffs_softdep.c	Sat Oct  2 17:58:57 2010	(r213363)
@@ -580,7 +580,7 @@ softdep_get_depcounts(struct mount *mp,
  * this file is being ported.
  */
 
-#define M_SOFTDEP_FLAGS	(M_WAITOK | M_USE_RESERVE)
+#define M_SOFTDEP_FLAGS	(M_WAITOK)
 
 #define	D_PAGEDEP	0
 #define	D_INODEDEP	1

From owner-svn-src-head@FreeBSD.ORG  Sat Oct  2 18:36:54 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 5B0BA1065706;
	Sat,  2 Oct 2010 18:36:54 +0000 (UTC)
	(envelope-from antoine.brodin.freebsd@gmail.com)
Received: from mail-qy0-f175.google.com (mail-qy0-f175.google.com
	[209.85.216.175])
	by mx1.freebsd.org (Postfix) with ESMTP id C081F8FC17;
	Sat,  2 Oct 2010 18:36:53 +0000 (UTC)
Received: by qyk8 with SMTP id 8so857218qyk.13
	for ; Sat, 02 Oct 2010 11:36:53 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=domainkey-signature:mime-version:received:sender:received
	:in-reply-to:references:date:x-google-sender-auth:message-id:subject
	:from:to:cc:content-type:content-transfer-encoding;
	bh=2xhapBFWWi1ZEkMiMzk2W90N7bobpLeOhOG3AaQ97As=;
	b=nX2s4guLM/cXMLy0ORP7MfwfRcQ036227oNsK3v2IWFwfJPR+zylPte45LsUeryG1t
	HFNXwv/m5GQymd8eLOtnO0lZPkrs3MbDFmbSg06nj4Fa38Zn1JLqekd1L0EujgUIXj8X
	XZPN3g9voGpCMXxe78sNo9mC8+kuRWZNYuefU=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
	h=mime-version:sender:in-reply-to:references:date
	:x-google-sender-auth:message-id:subject:from:to:cc:content-type
	:content-transfer-encoding;
	b=ZgaGFBnSZfqjX4KZmRCVlTIqZWMnfUpJbKV4/B4BDnMc3oRbvaMO3QpOO8Ad+na9Mr
	WYZA4XVzebJ59bMGVfsnTIPlvbv9IjnSP//ZR1gQhOhafXDIEltZCA2y7KtfqyWO4UBW
	kKERItS4Aie08VviwBH6yd0RCaTlZWOYGjL5A=
MIME-Version: 1.0
Received: by 10.229.1.161 with SMTP id 33mr5176978qcf.279.1286043133464; Sat,
	02 Oct 2010 11:12:13 -0700 (PDT)
Sender: antoine.brodin.freebsd@gmail.com
Received: by 10.229.66.166 with HTTP; Sat, 2 Oct 2010 11:12:13 -0700 (PDT)
In-Reply-To: <201009281533.o8SFXULh078409@svn.freebsd.org>
References: <201009281533.o8SFXULh078409@svn.freebsd.org>
Date: Sat, 2 Oct 2010 20:12:13 +0200
X-Google-Sender-Auth: Ust0pEL0SjEWMYSWv-EhsjYGjFU
Message-ID: 
From: Antoine Brodin 
To: Warner Losh 
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r213248 - head/sys/kern
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 02 Oct 2010 18:36:54 -0000

On Tue, Sep 28, 2010 at 5:33 PM, Warner Losh  wrote:
> Author: imp
> Date: Tue Sep 28 15:33:30 2010
> New Revision: 213248
> URL: http://svn.freebsd.org/changeset/base/213248
>
> Log:
> =A0This file has been unused for ages. =A0Retire it.
>
> =A0Submitted by: pluknet
>
> Deleted:
> =A0head/sys/kern/Makefile

Hi,

What is the correct way to "make sysent" now ?

Cheers,

Antoine

From owner-svn-src-head@FreeBSD.ORG  Sat Oct  2 18:53:13 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 4A28A106564A;
	Sat,  2 Oct 2010 18:53:13 +0000 (UTC)
	(envelope-from marius@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 37D5B8FC1A;
	Sat,  2 Oct 2010 18:53: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 o92IrD6L048070;
	Sat, 2 Oct 2010 18:53:13 GMT (envelope-from marius@svn.freebsd.org)
Received: (from marius@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o92IrDN6048051;
	Sat, 2 Oct 2010 18:53:13 GMT (envelope-from marius@svn.freebsd.org)
Message-Id: <201010021853.o92IrDN6048051@svn.freebsd.org>
From: Marius Strobl 
Date: Sat, 2 Oct 2010 18:53:13 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r213364 - in head/sys/dev: dc mii
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 02 Oct 2010 18:53:13 -0000

Author: marius
Date: Sat Oct  2 18:53:12 2010
New Revision: 213364
URL: http://svn.freebsd.org/changeset/base/213364

Log:
  - In the spirit of previous simplifications factor out the checks for a
    different PHY instance being selected and isolation out into the wrappers
    around the service methods rather than duplicating them over and over
    again (besides, a PHY driver shouldn't need to care about which instance
    it actually is).
  - Centralize the check for the need to isolate a non-zero PHY instance not
    supporting isolation in mii_mediachg() and just ignore it rather than
    panicing, which should sufficient given that a) things are likely to
    just work anyway if one doesn't plug in more than one port at a time and
    b) refusing to attach in this case just leaves us in a unknown but most
    likely also not exactly correct configuration (besides several drivers
    setting MIIF_NOISOLATE didn't care about these anyway, probably due to
    setting this flag for no real reason).
  - Minor fixes like removing unnecessary setting of sc->mii_anegticks,
    using sc->mii_anegticks instead of hardcoded values etc.

Modified:
  head/sys/dev/dc/dcphy.c
  head/sys/dev/dc/pnphy.c
  head/sys/dev/mii/acphy.c
  head/sys/dev/mii/amphy.c
  head/sys/dev/mii/atphy.c
  head/sys/dev/mii/axphy.c
  head/sys/dev/mii/bmtphy.c
  head/sys/dev/mii/brgphy.c
  head/sys/dev/mii/ciphy.c
  head/sys/dev/mii/e1000phy.c
  head/sys/dev/mii/exphy.c
  head/sys/dev/mii/gentbi.c
  head/sys/dev/mii/icsphy.c
  head/sys/dev/mii/inphy.c
  head/sys/dev/mii/ip1000phy.c
  head/sys/dev/mii/jmphy.c
  head/sys/dev/mii/lxtphy.c
  head/sys/dev/mii/mii.c
  head/sys/dev/mii/mlphy.c
  head/sys/dev/mii/nsgphy.c
  head/sys/dev/mii/nsphy.c
  head/sys/dev/mii/nsphyter.c
  head/sys/dev/mii/pnaphy.c
  head/sys/dev/mii/qsphy.c
  head/sys/dev/mii/rgephy.c
  head/sys/dev/mii/rlphy.c
  head/sys/dev/mii/rlswitch.c
  head/sys/dev/mii/ruephy.c
  head/sys/dev/mii/smcphy.c
  head/sys/dev/mii/tdkphy.c
  head/sys/dev/mii/tlphy.c
  head/sys/dev/mii/truephy.c
  head/sys/dev/mii/ukphy.c
  head/sys/dev/mii/xmphy.c

Modified: head/sys/dev/dc/dcphy.c
==============================================================================
--- head/sys/dev/dc/dcphy.c	Sat Oct  2 17:58:57 2010	(r213363)
+++ head/sys/dev/dc/dcphy.c	Sat Oct  2 18:53:12 2010	(r213364)
@@ -149,7 +149,7 @@ dcphy_attach(device_t dev)
 	mii = ma->mii_data;
 	LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list);
 
-	sc->mii_inst = mii->mii_instance;
+	sc->mii_inst = mii->mii_instance++;
 	sc->mii_phy = ma->mii_phyno;
 	sc->mii_service = dcphy_service;
 	sc->mii_pdata = mii;
@@ -159,8 +159,6 @@ dcphy_attach(device_t dev)
 	 */
 	sc->mii_flags |= MIIF_NOISOLATE | MIIF_NOLOOP;
 
-	mii->mii_instance++;
-
 	/*dcphy_reset(sc);*/
 	dc_sc = mii->mii_ifp->if_softc;
 	CSR_WRITE_4(dc_sc, DC_10BTSTAT, 0);
@@ -204,22 +202,10 @@ dcphy_service(struct mii_softc *sc, stru
 
 	switch (cmd) {
 	case MII_POLLSTAT:
-		/*
-		 * If we're not polling our PHY instance, just return.
-		 */
-		if (IFM_INST(ife->ifm_media) != sc->mii_inst)
-			return (0);
 		break;
 
 	case MII_MEDIACHG:
 		/*
-		 * If the media indicates a different PHY instance,
-		 * isolate ourselves.
-		 */
-		if (IFM_INST(ife->ifm_media) != sc->mii_inst)
-			return (0);
-
-		/*
 		 * If the interface is not up, don't do anything.
 		 */
 		if ((mii->mii_ifp->if_flags & IFF_UP) == 0)
@@ -276,12 +262,6 @@ dcphy_service(struct mii_softc *sc, stru
 
 	case MII_TICK:
 		/*
-		 * If we're not currently selected, just return.
-		 */
-		if (IFM_INST(ife->ifm_media) != sc->mii_inst)
-			return (0);
-
-		/*
 		 * Is the interface even up?
 		 */
 		if ((mii->mii_ifp->if_flags & IFF_UP) == 0)

Modified: head/sys/dev/dc/pnphy.c
==============================================================================
--- head/sys/dev/dc/pnphy.c	Sat Oct  2 17:58:57 2010	(r213363)
+++ head/sys/dev/dc/pnphy.c	Sat Oct  2 18:53:12 2010	(r213364)
@@ -132,7 +132,7 @@ pnphy_attach(device_t dev)
 	mii = ma->mii_data;
 	LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list);
 
-	sc->mii_inst = mii->mii_instance;
+	sc->mii_inst = mii->mii_instance++;
 	sc->mii_phy = ma->mii_phyno;
 	sc->mii_service = pnphy_service;
 	sc->mii_pdata = mii;
@@ -142,8 +142,6 @@ pnphy_attach(device_t dev)
 	 */
 	sc->mii_flags |= MIIF_NOISOLATE | MIIF_NOLOOP;
 
-	mii->mii_instance++;
-
 	sc->mii_capabilities =
 	    BMSR_100TXFDX | BMSR_100TXHDX | BMSR_10TFDX | BMSR_10THDX;
 	sc->mii_capabilities &= ma->mii_capmask;
@@ -162,22 +160,10 @@ pnphy_service(struct mii_softc *sc, stru
 
 	switch (cmd) {
 	case MII_POLLSTAT:
-		/*
-		 * If we're not polling our PHY instance, just return.
-		 */
-		if (IFM_INST(ife->ifm_media) != sc->mii_inst)
-			return (0);
 		break;
 
 	case MII_MEDIACHG:
 		/*
-		 * If the media indicates a different PHY instance,
-		 * isolate ourselves.
-		 */
-		if (IFM_INST(ife->ifm_media) != sc->mii_inst)
-			return (0);
-
-		/*
 		 * If the interface is not up, don't do anything.
 		 */
 		if ((mii->mii_ifp->if_flags & IFF_UP) == 0)
@@ -212,12 +198,6 @@ pnphy_service(struct mii_softc *sc, stru
 
 	case MII_TICK:
 		/*
-		 * If we're not currently selected, just return.
-		 */
-		if (IFM_INST(ife->ifm_media) != sc->mii_inst)
-			return (0);
-
-		/*
 		 * Is the interface even up?
 		 */
 		if ((mii->mii_ifp->if_flags & IFF_UP) == 0)

Modified: head/sys/dev/mii/acphy.c
==============================================================================
--- head/sys/dev/mii/acphy.c	Sat Oct  2 17:58:57 2010	(r213363)
+++ head/sys/dev/mii/acphy.c	Sat Oct  2 18:53:12 2010	(r213364)
@@ -132,17 +132,14 @@ acphy_attach(device_t dev)
 	mii = ma->mii_data;
 	LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list);
 
-	sc->mii_inst = mii->mii_instance;
+	sc->mii_inst = mii->mii_instance++;
 	sc->mii_phy = ma->mii_phyno;
 	sc->mii_service = acphy_service;
 	sc->mii_pdata = mii;
 
-	mii->mii_instance++;
-
 	acphy_reset(sc);
 
-	sc->mii_capabilities =
-	    PHY_READ(sc, MII_BMSR) & ma->mii_capmask;
+	sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & ma->mii_capmask;
 	device_printf(dev, " ");
 
 #define	ADD(m, c)	ifmedia_add(&mii->mii_media, (m), (c), NULL)
@@ -167,22 +164,8 @@ acphy_attach(device_t dev)
 static int
 acphy_service(struct mii_softc *sc, struct mii_data *mii, int cmd)
 {
-	struct ifmedia_entry *ife = mii->mii_media.ifm_cur;
 	int reg;
 
-	/*
-	 * If we're not selected, then do nothing, just isolate and power
-	 * down, if changing media.
-	 */
-	if (IFM_INST(ife->ifm_media) != sc->mii_inst) {
-		if (cmd == MII_MEDIACHG) {
-			reg = PHY_READ(sc, MII_BMCR);
-			PHY_WRITE(sc, MII_BMCR, reg | BMCR_ISO | BMCR_PDOWN);
-		}
-
-		return (0);
-	}
-
 	switch (cmd) {
 	case MII_POLLSTAT:
 		break;

Modified: head/sys/dev/mii/amphy.c
==============================================================================
--- head/sys/dev/mii/amphy.c	Sat Oct  2 17:58:57 2010	(r213363)
+++ head/sys/dev/mii/amphy.c	Sat Oct  2 18:53:12 2010	(r213364)
@@ -109,13 +109,11 @@ amphy_attach(device_t dev)
 	mii = ma->mii_data;
 	LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list);
 
-	sc->mii_inst = mii->mii_instance;
+	sc->mii_inst = mii->mii_instance++;
 	sc->mii_phy = ma->mii_phyno;
 	sc->mii_service = amphy_service;
 	sc->mii_pdata = mii;
 
-	mii->mii_instance++;
-
 #define	ADD(m, c)	ifmedia_add(&mii->mii_media, (m), (c), NULL)
 
 #if 0
@@ -125,8 +123,7 @@ amphy_attach(device_t dev)
 
 	mii_phy_reset(sc);
 
-	sc->mii_capabilities =
-	    PHY_READ(sc, MII_BMSR) & ma->mii_capmask;
+	sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & ma->mii_capmask;
 	device_printf(dev, " ");
 	mii_phy_add_media(sc);
 	printf("\n");
@@ -138,30 +135,13 @@ amphy_attach(device_t dev)
 static int
 amphy_service(struct mii_softc *sc, struct mii_data *mii, int cmd)
 {
-	struct ifmedia_entry *ife = mii->mii_media.ifm_cur;
-	int reg;
 
 	switch (cmd) {
 	case MII_POLLSTAT:
-		/*
-		 * If we're not polling our PHY instance, just return.
-		 */
-		if (IFM_INST(ife->ifm_media) != sc->mii_inst)
-			return (0);
 		break;
 
 	case MII_MEDIACHG:
 		/*
-		 * If the media indicates a different PHY instance,
-		 * isolate ourselves.
-		 */
-		if (IFM_INST(ife->ifm_media) != sc->mii_inst) {
-			reg = PHY_READ(sc, MII_BMCR);
-			PHY_WRITE(sc, MII_BMCR, reg | BMCR_ISO);
-			return (0);
-		}
-
-		/*
 		 * If the interface is not up, don't do anything.
 		 */
 		if ((mii->mii_ifp->if_flags & IFF_UP) == 0)
@@ -171,11 +151,6 @@ amphy_service(struct mii_softc *sc, stru
 		break;
 
 	case MII_TICK:
-		/*
-		 * If we're not currently selected, just return.
-		 */
-		if (IFM_INST(ife->ifm_media) != sc->mii_inst)
-			return (0);
 		if (mii_phy_tick(sc) == EJUSTRETURN)
 			return (0);
 		break;

Modified: head/sys/dev/mii/atphy.c
==============================================================================
--- head/sys/dev/mii/atphy.c	Sat Oct  2 17:58:57 2010	(r213363)
+++ head/sys/dev/mii/atphy.c	Sat Oct  2 18:53:12 2010	(r213364)
@@ -113,13 +113,10 @@ atphy_attach(device_t dev)
 	mii = ma->mii_data;
 	LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list);
 
-	sc->mii_inst = mii->mii_instance;
+	sc->mii_inst = mii->mii_instance++;
 	sc->mii_phy = ma->mii_phyno;
 	sc->mii_service = atphy_service;
 	sc->mii_pdata = mii;
-	sc->mii_anegticks = MII_ANEGTICKS_GIGE;
-
-	mii->mii_instance++;
 
 	asc->mii_oui = MII_OUI(ma->mii_id1, ma->mii_id2);
 	asc->mii_model = MII_MODEL(ma->mii_id2);
@@ -138,7 +135,7 @@ atphy_attach(device_t dev)
 	printf("\n");
 
 	MIIBUS_MEDIAINIT(sc->mii_dev);
-	return(0);
+	return (0);
 }
 
 static int
@@ -149,25 +146,10 @@ atphy_service(struct mii_softc *sc, stru
 
 	switch (cmd) {
 	case MII_POLLSTAT:
-		/*
-		 * If we're not polling our PHY instance, just return.
-		 */
-		if (IFM_INST(ife->ifm_media) != sc->mii_inst)
-			return (0);
 		break;
 
 	case MII_MEDIACHG:
 		/*
-		 * If the media indicates a different PHY instance,
-		 * isolate ourselves.
-		 */
-		if (IFM_INST(ife->ifm_media) != sc->mii_inst) {
-			bmcr = PHY_READ(sc, MII_BMCR);
-			PHY_WRITE(sc, MII_BMCR, bmcr | BMCR_ISO);
-			return (0);
-		}
-
-		/*
 		 * If the interface is not up, don't do anything.
 		 */
 		if ((mii->mii_ifp->if_flags & IFF_UP) == 0)
@@ -225,12 +207,6 @@ done:
 
 	case MII_TICK:
 		/*
-		 * If we're not currently selected, just return.
-		 */
-		if (IFM_INST(ife->ifm_media) != sc->mii_inst)
-			return (0);
-
-		/*
 		 * Is the interface even up?
 		 */
 		if ((mii->mii_ifp->if_flags & IFF_UP) == 0)

Modified: head/sys/dev/mii/axphy.c
==============================================================================
--- head/sys/dev/mii/axphy.c	Sat Oct  2 17:58:57 2010	(r213363)
+++ head/sys/dev/mii/axphy.c	Sat Oct  2 18:53:12 2010	(r213364)
@@ -99,12 +99,12 @@ axphy_attach(device_t dev)
 	mii = ma->mii_data;
 	LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list);
 
-	sc->mii_inst = mii->mii_instance;
+	sc->mii_inst = mii->mii_instance++;
 	sc->mii_phy = ma->mii_phyno;
 	sc->mii_service = axphy_service;
 	sc->mii_pdata = mii;
+
 	sc->mii_flags |= MIIF_NOISOLATE;
-	mii->mii_instance++;
 
 	mii_phy_reset(sc);
 
@@ -122,22 +122,12 @@ axphy_attach(device_t dev)
 static int
 axphy_service(struct mii_softc *sc, struct mii_data *mii, int cmd)
 {
-	struct ifmedia_entry *ife = mii->mii_media.ifm_cur;
-	int reg;
 
 	switch (cmd) {
 	case MII_POLLSTAT:
-		if (IFM_INST(ife->ifm_media) != sc->mii_inst)
-			return (0);
 		break;
 
 	case MII_MEDIACHG:
-		if (IFM_INST(ife->ifm_media) != sc->mii_inst) {
-			reg = PHY_READ(sc, MII_BMCR);
-			PHY_WRITE(sc, MII_BMCR, reg | BMCR_ISO);
-			return (0);
-		}
-
 		/*
 		 * If the interface is not up, don't do anything.
 		 */
@@ -148,8 +138,6 @@ axphy_service(struct mii_softc *sc, stru
 		break;
 
 	case MII_TICK:
-		if (IFM_INST(ife->ifm_media) != sc->mii_inst)
-			return (0);
 		if (mii_phy_tick(sc) == EJUSTRETURN)
 			return (0);
 		break;

Modified: head/sys/dev/mii/bmtphy.c
==============================================================================
--- head/sys/dev/mii/bmtphy.c	Sat Oct  2 17:58:57 2010	(r213363)
+++ head/sys/dev/mii/bmtphy.c	Sat Oct  2 18:53:12 2010	(r213364)
@@ -147,17 +147,14 @@ bmtphy_attach(device_t dev)
 	mii = ma->mii_data;
 	LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list);
 
-	sc->mii_inst = mii->mii_instance;
+	sc->mii_inst = mii->mii_instance++;
 	sc->mii_phy = ma->mii_phyno;
 	sc->mii_service = bmtphy_service;
 	sc->mii_pdata = mii;
 
 	mii_phy_reset(sc);
 
-	mii->mii_instance++;
-
-	sc->mii_capabilities =
-	    PHY_READ(sc, MII_BMSR) & ma->mii_capmask;
+	sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & ma->mii_capmask;
 	device_printf(dev, " ");
 	mii_phy_add_media(sc);
 	printf("\n");
@@ -170,32 +167,13 @@ bmtphy_attach(device_t dev)
 static int
 bmtphy_service(struct mii_softc *sc, struct mii_data *mii, int cmd)
 {
-	struct	ifmedia_entry *ife;
-	int	reg;
-
-	ife = mii->mii_media.ifm_cur;
 
 	switch (cmd) {
 	case MII_POLLSTAT:
-		/*
-		 * If we're not polling our PHY instance, just return.
-		 */
-		if (IFM_INST(ife->ifm_media) != sc->mii_inst)
-			return (0);
 		break;
 
 	case MII_MEDIACHG:
 		/*
-		 * If the media indicates a different PHY instance,
-		 * isolate ourselves.
-		 */
-		if (IFM_INST(ife->ifm_media) != sc->mii_inst) {
-			reg = PHY_READ(sc, MII_BMCR);
-			PHY_WRITE(sc, MII_BMCR, reg | BMCR_ISO);
-			return (0);
-		}
-
-		/*
 		 * If the interface is not up, don't do anything.
 		 */
 		if ((mii->mii_ifp->if_flags & IFF_UP) == 0)
@@ -205,11 +183,6 @@ bmtphy_service(struct mii_softc *sc, str
 		break;
 
 	case MII_TICK:
-		/*
-		 * If we're not currently selected, just return.
-		 */
-		if (IFM_INST(ife->ifm_media) != sc->mii_inst)
-			return (0);
 		if (mii_phy_tick(sc) == EJUSTRETURN)
 			return (0);
 		break;

Modified: head/sys/dev/mii/brgphy.c
==============================================================================
--- head/sys/dev/mii/brgphy.c	Sat Oct  2 17:58:57 2010	(r213363)
+++ head/sys/dev/mii/brgphy.c	Sat Oct  2 18:53:12 2010	(r213364)
@@ -191,13 +191,17 @@ brgphy_attach(device_t dev)
 	LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list);
 
 	/* Initialize mii_softc structure */
-	sc->mii_inst = mii->mii_instance;
+	sc->mii_inst = mii->mii_instance++;
 	sc->mii_phy = ma->mii_phyno;
 	sc->mii_service = brgphy_service;
 	sc->mii_pdata = mii;
-	sc->mii_anegticks = MII_ANEGTICKS_GIGE;
+
+	/*
+	 * At least some variants wedge when isolating, at least some also
+	 * don't support loopback.
+	 */
 	sc->mii_flags |= MIIF_NOISOLATE | MIIF_NOLOOP;
-	mii->mii_instance++;
+	sc->mii_anegticks = MII_ANEGTICKS_GIGE;
 
 	/* Initialize brgphy_softc structure */
 	bsc->mii_oui = MII_OUI(ma->mii_id1, ma->mii_id2);
@@ -283,9 +287,6 @@ brgphy_attach(device_t dev)
 
 #define	ADD(m, c)	ifmedia_add(&mii->mii_media, (m), (c), NULL)
 
-	/* Create an instance of Ethernet media. */
-	ADD(IFM_MAKEWORD(IFM_ETHER, IFM_NONE, 0, sc->mii_inst), BMCR_ISO);
-
 	/* Add the supported media types */
 	if ((sc->mii_flags & MIIF_HAVEFIBER) == 0) {
 		ADD(IFM_MAKEWORD(IFM_ETHER, IFM_10_T, 0, sc->mii_inst),
@@ -345,26 +346,12 @@ brgphy_service(struct mii_softc *sc, str
 {
 	struct brgphy_softc *bsc = (struct brgphy_softc *)sc;
 	struct ifmedia_entry *ife = mii->mii_media.ifm_cur;
-	int error = 0;
 	int val;
 
 	switch (cmd) {
 	case MII_POLLSTAT:
-		/* If we're not polling our PHY instance, just return. */
-		if (IFM_INST(ife->ifm_media) != sc->mii_inst)
-			goto brgphy_service_exit;
 		break;
 	case MII_MEDIACHG:
-		/*
-		 * If the media indicates a different PHY instance,
-		 * isolate ourselves.
-		 */
-		if (IFM_INST(ife->ifm_media) != sc->mii_inst) {
-			PHY_WRITE(sc, MII_BMCR,
-			    PHY_READ(sc, MII_BMCR) | BMCR_ISO);
-			goto brgphy_service_exit;
-		}
-
 		/* If the interface is not up, don't do anything. */
 		if ((mii->mii_ifp->if_flags & IFF_UP) == 0)
 			break;
@@ -385,18 +372,13 @@ brgphy_service(struct mii_softc *sc, str
 			    mii->mii_ifp->if_flags & IFF_LINK0);
 			break;
 		default:
-			error = EINVAL;
-			goto brgphy_service_exit;
+			return (EINVAL);
 		}
 		break;
 	case MII_TICK:
-		/* Bail if we're not currently selected. */
-		if (IFM_INST(ife->ifm_media) != sc->mii_inst)
-			goto brgphy_service_exit;
-
 		/* Bail if the interface isn't up. */
 		if ((mii->mii_ifp->if_flags & IFF_UP) == 0)
-			goto brgphy_service_exit;
+			return (0);
 
 
 		/* Bail if autoneg isn't in process. */
@@ -465,8 +447,7 @@ brgphy_service(struct mii_softc *sc, str
 		}
 	}
 	mii_phy_update(sc, cmd);
-brgphy_service_exit:
-	return (error);
+	return (0);
 }
 
 
@@ -1182,4 +1163,3 @@ brgphy_reset(struct mii_softc *sc)
 
 	}
 }
-

Modified: head/sys/dev/mii/ciphy.c
==============================================================================
--- head/sys/dev/mii/ciphy.c	Sat Oct  2 17:58:57 2010	(r213363)
+++ head/sys/dev/mii/ciphy.c	Sat Oct  2 18:53:12 2010	(r213364)
@@ -118,18 +118,16 @@ ciphy_attach(device_t dev)
 	mii = ma->mii_data;
 	LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list);
 
-	sc->mii_inst = mii->mii_instance;
+	sc->mii_inst = mii->mii_instance++;
 	sc->mii_phy = ma->mii_phyno;
 	sc->mii_service = ciphy_service;
 	sc->mii_pdata = mii;
 
 	sc->mii_flags |= MIIF_NOISOLATE;
-	mii->mii_instance++;
 
 	ciphy_reset(sc);
 
-	sc->mii_capabilities =
-	    PHY_READ(sc, MII_BMSR) & ma->mii_capmask;
+	sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & ma->mii_capmask;
 	if (sc->mii_capabilities & BMSR_EXTSTAT)
 		sc->mii_extcapabilities = PHY_READ(sc, MII_EXTSR);
 	device_printf(dev, " ");
@@ -148,25 +146,10 @@ ciphy_service(struct mii_softc *sc, stru
 
 	switch (cmd) {
 	case MII_POLLSTAT:
-		/*
-		 * If we're not polling our PHY instance, just return.
-		 */
-		if (IFM_INST(ife->ifm_media) != sc->mii_inst)
-			return (0);
 		break;
 
 	case MII_MEDIACHG:
 		/*
-		 * If the media indicates a different PHY instance,
-		 * isolate ourselves.
-		 */
-		if (IFM_INST(ife->ifm_media) != sc->mii_inst) {
-			reg = PHY_READ(sc, MII_BMCR);
-			PHY_WRITE(sc, MII_BMCR, reg | BMCR_ISO);
-			return (0);
-		}
-
-		/*
 		 * If the interface is not up, don't do anything.
 		 */
 		if ((mii->mii_ifp->if_flags & IFF_UP) == 0)
@@ -239,12 +222,6 @@ setit:
 
 	case MII_TICK:
 		/*
-		 * If we're not currently selected, just return.
-		 */
-		if (IFM_INST(ife->ifm_media) != sc->mii_inst)
-			return (0);
-
-		/*
 		 * Is the interface even up?
 		 */
 		if ((mii->mii_ifp->if_flags & IFF_UP) == 0)

Modified: head/sys/dev/mii/e1000phy.c
==============================================================================
--- head/sys/dev/mii/e1000phy.c	Sat Oct  2 17:58:57 2010	(r213363)
+++ head/sys/dev/mii/e1000phy.c	Sat Oct  2 18:53:12 2010	(r213364)
@@ -144,11 +144,10 @@ e1000phy_attach(device_t dev)
 	mii = ma->mii_data;
 	LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list);
 
-	sc->mii_inst = mii->mii_instance;
+	sc->mii_inst = mii->mii_instance++;
 	sc->mii_phy = ma->mii_phyno;
 	sc->mii_service = e1000phy_service;
 	sc->mii_pdata = mii;
-	mii->mii_instance++;
 
 	esc->mii_model = MII_MODEL(ma->mii_id2);
 	ifp = sc->mii_pdata->mii_ifp;
@@ -322,25 +321,10 @@ e1000phy_service(struct mii_softc *sc, s
 
 	switch (cmd) {
 	case MII_POLLSTAT:
-		/*
-		 * If we're not polling our PHY instance, just return.
-		 */
-		if (IFM_INST(ife->ifm_media) != sc->mii_inst)
-			return (0);
 		break;
 
 	case MII_MEDIACHG:
 		/*
-		 * If the media indicates a different PHY instance,
-		 * isolate ourselves.
-		 */
-		if (IFM_INST(ife->ifm_media) != sc->mii_inst) {
-			reg = PHY_READ(sc, E1000_CR);
-			PHY_WRITE(sc, E1000_CR, reg | E1000_CR_ISOLATE);
-			return (0);
-		}
-
-		/*
 		 * If the interface is not up, don't do anything.
 		 */
 		if ((mii->mii_ifp->if_flags & IFF_UP) == 0)
@@ -417,12 +401,6 @@ done:
 		break;
 	case MII_TICK:
 		/*
-		 * If we're not currently selected, just return.
-		 */
-		if (IFM_INST(ife->ifm_media) != sc->mii_inst)
-			return (0);
-
-		/*
 		 * Is the interface even up?
 		 */
 		if ((mii->mii_ifp->if_flags & IFF_UP) == 0)

Modified: head/sys/dev/mii/exphy.c
==============================================================================
--- head/sys/dev/mii/exphy.c	Sat Oct  2 17:58:57 2010	(r213363)
+++ head/sys/dev/mii/exphy.c	Sat Oct  2 18:53:12 2010	(r213364)
@@ -136,24 +136,16 @@ exphy_attach(device_t dev)
 	ma = device_get_ivars(dev);
 	sc->mii_dev = device_get_parent(dev);
 	mii = ma->mii_data;
-
-	/*
-	 * The 3Com PHY can never be isolated, so never allow non-zero
-	 * instances!
-	 */
-	if (mii->mii_instance != 0) {
-		device_printf(dev, "ignoring this PHY, non-zero instance\n");
-		return (ENXIO);
-	}
-
 	LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list);
 
-	sc->mii_inst = mii->mii_instance;
+	sc->mii_inst = mii->mii_instance++;
 	sc->mii_phy = ma->mii_phyno;
 	sc->mii_service = exphy_service;
 	sc->mii_pdata = mii;
-	mii->mii_instance++;
 
+	/*
+	 * The 3Com PHY can never be isolated.
+	 */
 	sc->mii_flags |= MIIF_NOISOLATE;
 
 #define	ADD(m, c)	ifmedia_add(&mii->mii_media, (m), (c), NULL)
@@ -163,8 +155,7 @@ exphy_attach(device_t dev)
 
 	exphy_reset(sc);
 
-	sc->mii_capabilities =
-	    PHY_READ(sc, MII_BMSR) & ma->mii_capmask;
+	sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & ma->mii_capmask;
 	device_printf(dev, " ");
 	mii_phy_add_media(sc);
 	printf("\n");
@@ -176,13 +167,6 @@ exphy_attach(device_t dev)
 static int
 exphy_service(struct mii_softc *sc, struct mii_data *mii, int cmd)
 {
-	struct ifmedia_entry *ife = mii->mii_media.ifm_cur;
-
-	/*
-	 * We can't isolate the 3Com PHY, so it has to be the only one!
-	 */
-	if (IFM_INST(ife->ifm_media) != sc->mii_inst)
-		panic("exphy_service: can't isolate 3Com PHY");
 
 	switch (cmd) {
 	case MII_POLLSTAT:

Modified: head/sys/dev/mii/gentbi.c
==============================================================================
--- head/sys/dev/mii/gentbi.c	Sat Oct  2 17:58:57 2010	(r213363)
+++ head/sys/dev/mii/gentbi.c	Sat Oct  2 18:53:12 2010	(r213364)
@@ -55,7 +55,7 @@
  */
 
 /*
- * Driver for generic ten-bit (1000BASE-SX) interfaces, built in to
+ * Driver for generic ten-bit (1000BASE-SX) interfaces, built into
  * many Gigabit Ethernet chips.
  *
  * All we have to do here is correctly report speed and duplex.
@@ -166,13 +166,11 @@ gentbi_attach(device_t dev)
 		    MII_OUI(ma->mii_id1, ma->mii_id2),
 		    MII_MODEL(ma->mii_id2), MII_REV(ma->mii_id2));
 
-	sc->mii_inst = mii->mii_instance;
+	sc->mii_inst = mii->mii_instance++;
 	sc->mii_phy = ma->mii_phyno;
 	sc->mii_service = gentbi_service;
 	sc->mii_pdata = mii;
 
-	mii->mii_instance++;
-
 	mii_phy_reset(sc);
 
 	/*
@@ -195,30 +193,13 @@ gentbi_attach(device_t dev)
 static int
 gentbi_service(struct mii_softc *sc, struct mii_data *mii, int cmd)
 {
-	struct ifmedia_entry *ife = mii->mii_media.ifm_cur;
-	int reg;
 
 	switch (cmd) {
 	case MII_POLLSTAT:
-		/*
-		 * If we're not polling our PHY instance, just return.
-		 */
-		if (IFM_INST(ife->ifm_media) != sc->mii_inst)
-			return (0);
 		break;
 
 	case MII_MEDIACHG:
 		/*
-		 * If the media indicates a different PHY instance,
-		 * isolate ourselves.
-		 */
-		if (IFM_INST(ife->ifm_media) != sc->mii_inst) {
-			reg = PHY_READ(sc, MII_BMCR);
-			PHY_WRITE(sc, MII_BMCR, reg | BMCR_ISO);
-			return (0);
-		}
-
-		/*
 		 * If the interface is not up, don't do anything.
 		 */
 		if ((mii->mii_ifp->if_flags & IFF_UP) == 0)
@@ -228,12 +209,6 @@ gentbi_service(struct mii_softc *sc, str
 		break;
 
 	case MII_TICK:
-		/*
-		 * If we're not currently selected, just return.
-		 */
-		if (IFM_INST(ife->ifm_media) != sc->mii_inst)
-			return (0);
-
 		if (mii_phy_tick(sc) == EJUSTRETURN)
 			return (0);
 		break;

Modified: head/sys/dev/mii/icsphy.c
==============================================================================
--- head/sys/dev/mii/icsphy.c	Sat Oct  2 17:58:57 2010	(r213363)
+++ head/sys/dev/mii/icsphy.c	Sat Oct  2 18:53:12 2010	(r213364)
@@ -141,14 +141,12 @@ icsphy_attach(device_t dev)
 	mii = ma->mii_data;
 	LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list);
 
-	sc->mii_inst = mii->mii_instance;
+	sc->mii_inst = mii->mii_instance++;
 	sc->mii_phy = ma->mii_phyno;
 	sc->mii_service = icsphy_service;
 	sc->mii_pdata = mii;
-	sc->mii_anegticks = MII_ANEGTICKS;
-	sc->mii_flags |= MIIF_NOISOLATE;
 
-	mii->mii_instance++;
+	sc->mii_flags |= MIIF_NOISOLATE;
 
 	ifmedia_add(&mii->mii_media,
 	    IFM_MAKEWORD(IFM_ETHER, IFM_100_TX, IFM_LOOP, sc->mii_inst),
@@ -170,20 +168,6 @@ icsphy_attach(device_t dev)
 static int
 icsphy_service(struct mii_softc *sc, struct mii_data *mii, int cmd)
 {
-	struct ifmedia_entry *ife = mii->mii_media.ifm_cur;
-	int reg;
-
-	/*
-	 * If we're not selected, then do nothing, just isolate, if
-	 * changing media.
-	 */
-	if (IFM_INST(ife->ifm_media) != sc->mii_inst) {
-		if (cmd == MII_MEDIACHG) {
-			reg = PHY_READ(sc, MII_BMCR);
-			PHY_WRITE(sc, MII_BMCR, reg | BMCR_ISO);
-		}
-                return (0);
-        }
 
 	switch (cmd) {
 	case MII_POLLSTAT:

Modified: head/sys/dev/mii/inphy.c
==============================================================================
--- head/sys/dev/mii/inphy.c	Sat Oct  2 17:58:57 2010	(r213363)
+++ head/sys/dev/mii/inphy.c	Sat Oct  2 18:53:12 2010	(r213364)
@@ -107,11 +107,10 @@ inphy_attach(device_t dev)
 	mii = ma->mii_data;
 	LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list);
 
-	sc->mii_inst = mii->mii_instance;
+	sc->mii_inst = mii->mii_instance++;
 	sc->mii_phy = ma->mii_phyno;
 	sc->mii_service = inphy_service;
 	sc->mii_pdata = mii;
-	mii->mii_instance++;
 
 	ifmedia_add(&mii->mii_media,
 	    IFM_MAKEWORD(IFM_ETHER, IFM_100_TX, IFM_LOOP, sc->mii_inst),
@@ -132,22 +131,12 @@ inphy_attach(device_t dev)
 static int
 inphy_service(struct mii_softc *sc, struct mii_data *mii, int cmd)
 {
-	struct ifmedia_entry *ife = mii->mii_media.ifm_cur;
-	int reg;
 
 	switch (cmd) {
 	case MII_POLLSTAT:
-		if (IFM_INST(ife->ifm_media) != sc->mii_inst)
-			return (0);
 		break;
 
 	case MII_MEDIACHG:
-		if (IFM_INST(ife->ifm_media) != sc->mii_inst) {
-			reg = PHY_READ(sc, MII_BMCR);
-			PHY_WRITE(sc, MII_BMCR, reg | BMCR_ISO);
-			return (0);
-		}
-
 		/*
 		 * If the interface is not up, don't do anything.
 		 */
@@ -158,8 +147,6 @@ inphy_service(struct mii_softc *sc, stru
 		break;
 
 	case MII_TICK:
-		if (IFM_INST(ife->ifm_media) != sc->mii_inst)
-			return (0);
 		if (mii_phy_tick(sc) == EJUSTRETURN)
 			return (0);
 		break;

Modified: head/sys/dev/mii/ip1000phy.c
==============================================================================
--- head/sys/dev/mii/ip1000phy.c	Sat Oct  2 17:58:57 2010	(r213363)
+++ head/sys/dev/mii/ip1000phy.c	Sat Oct  2 18:53:12 2010	(r213364)
@@ -114,13 +114,12 @@ ip1000phy_attach(device_t dev)
 	mii = ma->mii_data;
 	LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list);
 
-	sc->mii_inst = mii->mii_instance;
+	sc->mii_inst = mii->mii_instance++;
 	sc->mii_phy = ma->mii_phyno;
 	sc->mii_service = ip1000phy_service;
 	sc->mii_pdata = mii;
-	sc->mii_flags |= MIIF_NOISOLATE;
 
-	mii->mii_instance++;
+	sc->mii_flags |= MIIF_NOISOLATE;
 
 	isc->model = MII_MODEL(ma->mii_id2);
 	isc->revision = MII_REV(ma->mii_id2);
@@ -135,7 +134,7 @@ ip1000phy_attach(device_t dev)
 	printf("\n");
 
 	MIIBUS_MEDIAINIT(sc->mii_dev);
-	return(0);
+	return (0);
 }
 
 static int
@@ -146,26 +145,10 @@ ip1000phy_service(struct mii_softc *sc, 
 
 	switch (cmd) {
 	case MII_POLLSTAT:
-		/*
-		 * If we're not polling our PHY instance, just return.
-		 */
-		if (IFM_INST(ife->ifm_media) != sc->mii_inst)
-			return (0);
 		break;
 
 	case MII_MEDIACHG:
 		/*
-		 * If the media indicates a different PHY instance,
-		 * isolate ourselves.
-		 */
-		if (IFM_INST(ife->ifm_media) != sc->mii_inst) {
-			reg = PHY_READ(sc, IP1000PHY_MII_BMCR);
-			PHY_WRITE(sc, IP1000PHY_MII_BMCR,
-			    reg | IP1000PHY_BMCR_ISO);
-			return (0);
-		}
-
-		/*
 		 * If the interface is not up, don't do anything.
 		 */
 		if ((mii->mii_ifp->if_flags & IFF_UP) == 0) {
@@ -237,11 +220,6 @@ done:
 
 	case MII_TICK:
 		/*
-		 * If we're not currently selected, just return.
-		 */
-		if (IFM_INST(ife->ifm_media) != sc->mii_inst)
-			return (0);
-		/*
 		 * Is the interface even up?
 		 */
 		if ((mii->mii_ifp->if_flags & IFF_UP) == 0)

Modified: head/sys/dev/mii/jmphy.c
==============================================================================
--- head/sys/dev/mii/jmphy.c	Sat Oct  2 17:58:57 2010	(r213363)
+++ head/sys/dev/mii/jmphy.c	Sat Oct  2 18:53:12 2010	(r213364)
@@ -112,13 +112,11 @@ jmphy_attach(device_t dev)
 	mii = ma->mii_data;
 	LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list);
 
-	sc->mii_inst = mii->mii_instance;
+	sc->mii_inst = mii->mii_instance++;
 	sc->mii_phy = ma->mii_phyno;
 	sc->mii_service = jmphy_service;
 	sc->mii_pdata = mii;
 
-	mii->mii_instance++;
-
 	jsc->mii_oui = MII_OUI(ma->mii_id1, ma->mii_id2);
 	jsc->mii_model = MII_MODEL(ma->mii_id2);
 	jsc->mii_rev = MII_REV(ma->mii_id2);
@@ -136,36 +134,20 @@ jmphy_attach(device_t dev)
 	printf("\n");
 
 	MIIBUS_MEDIAINIT(sc->mii_dev);
-	return(0);
+	return (0);
 }
 
 static int
 jmphy_service(struct mii_softc *sc, struct mii_data *mii, int cmd)
 {
 	struct ifmedia_entry *ife = mii->mii_media.ifm_cur;
-	uint16_t bmcr;
 
 	switch (cmd) {
 	case MII_POLLSTAT:
-		/*
-		 * If we're not polling our PHY instance, just return.
-		 */
-		if (IFM_INST(ife->ifm_media) != sc->mii_inst)
-			return (0);
 		break;
 
 	case MII_MEDIACHG:
 		/*
-		 * If the media indicates a different PHY instance,
-		 * isolate ourselves.
-		 */
-		if (IFM_INST(ife->ifm_media) != sc->mii_inst) {
-			bmcr = PHY_READ(sc, MII_BMCR);
-			PHY_WRITE(sc, MII_BMCR, bmcr | BMCR_ISO);
-			return (0);
-		}
-
-		/*
 		 * If the interface is not up, don't do anything.
 		 */
 		if ((mii->mii_ifp->if_flags & IFF_UP) == 0)
@@ -177,12 +159,6 @@ jmphy_service(struct mii_softc *sc, stru
 
 	case MII_TICK:
 		/*
-		 * If we're not currently selected, just return.
-		 */
-		if (IFM_INST(ife->ifm_media) != sc->mii_inst)
-			return (0);
-
-		/*
 		 * Is the interface even up?
 		 */
 		if ((mii->mii_ifp->if_flags & IFF_UP) == 0)

Modified: head/sys/dev/mii/lxtphy.c
==============================================================================
--- head/sys/dev/mii/lxtphy.c	Sat Oct  2 17:58:57 2010	(r213363)
+++ head/sys/dev/mii/lxtphy.c	Sat Oct  2 18:53:12 2010	(r213364)
@@ -135,17 +135,14 @@ lxtphy_attach(device_t dev)
 	mii = ma->mii_data;
 	LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list);
 
-	sc->mii_inst = mii->mii_instance;
+	sc->mii_inst = mii->mii_instance++;
 	sc->mii_phy = ma->mii_phyno;
 	sc->mii_service = lxtphy_service;
 	sc->mii_pdata = mii;
 
-	mii->mii_instance++;
-
 	mii_phy_reset(sc);
 
-	sc->mii_capabilities =
-	    PHY_READ(sc, MII_BMSR) & ma->mii_capmask;
+	sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & ma->mii_capmask;
 	device_printf(dev, " ");
 
 	/*
@@ -177,29 +174,13 @@ static int
 lxtphy_service(struct mii_softc *sc, struct mii_data *mii, int cmd)
 {
 	struct ifmedia_entry *ife = mii->mii_media.ifm_cur;
-	int reg;
 
 	switch (cmd) {
 	case MII_POLLSTAT:
-		/*
-		 * If we're not polling our PHY instance, just return.
-		 */
-		if (IFM_INST(ife->ifm_media) != sc->mii_inst)

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

From owner-svn-src-head@FreeBSD.ORG  Sat Oct  2 19:44:13 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 51467106566C;
	Sat,  2 Oct 2010 19:44:13 +0000 (UTC)
	(envelope-from marcel@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 3F5478FC15;
	Sat,  2 Oct 2010 19:44: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 o92JiDZq049635;
	Sat, 2 Oct 2010 19:44:13 GMT (envelope-from marcel@svn.freebsd.org)
Received: (from marcel@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o92JiD7v049631;
	Sat, 2 Oct 2010 19:44:13 GMT (envelope-from marcel@svn.freebsd.org)
Message-Id: <201010021944.o92JiD7v049631@svn.freebsd.org>
From: Marcel Moolenaar 
Date: Sat, 2 Oct 2010 19:44:13 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r213365 - in head/sys: conf kern
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 02 Oct 2010 19:44:13 -0000

Author: marcel
Date: Sat Oct  2 19:44:13 2010
New Revision: 213365
URL: http://svn.freebsd.org/changeset/base/213365

Log:
  Split the root mount logic from the (generic) mount code and move
  it (the root mount code) into a new file called vfs_mountroot.c
  
  The split is almost trivial, as the code is almost perfectly
  non-intertwined. The only adjustment needed was to move the UMA
  zone allocation out of vfs_mountroot() [in vfs_mountroot.c] and
  into vfs_mount.c, where it had to be done as a SYSINIT [see
  vfs_mount_init()].
  
  There are no functional changes with this commit.

Added:
  head/sys/kern/vfs_mountroot.c   (contents, props changed)
Modified:
  head/sys/conf/files
  head/sys/kern/vfs_mount.c

Modified: head/sys/conf/files
==============================================================================
--- head/sys/conf/files	Sat Oct  2 18:53:12 2010	(r213364)
+++ head/sys/conf/files	Sat Oct  2 19:44:13 2010	(r213365)
@@ -2264,6 +2264,7 @@ kern/vfs_hash.c			standard
 kern/vfs_init.c			standard
 kern/vfs_lookup.c		standard
 kern/vfs_mount.c		standard
+kern/vfs_mountroot.c		standard
 kern/vfs_subr.c			standard
 kern/vfs_syscalls.c		standard
 kern/vfs_vnops.c		standard

Modified: head/sys/kern/vfs_mount.c
==============================================================================
--- head/sys/kern/vfs_mount.c	Sat Oct  2 18:53:12 2010	(r213364)
+++ head/sys/kern/vfs_mount.c	Sat Oct  2 19:44:13 2010	(r213365)
@@ -67,16 +67,10 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#include "opt_rootdevname.h"
-
-#define	ROOTNAME		"root_device"
 #define	VFS_MOUNTARG_SIZE_MAX	(1024 * 64)
 
-static void	set_rootvnode(void);
 static int	vfs_domount(struct thread *td, const char *fstype,
 		    char *fspath, int fsflags, void *fsdata);
-static int	vfs_mountroot_ask(void);
-static int	vfs_mountroot_try(const char *mountfrom, const char *options);
 static void	free_mntarg(struct mntarg *ma);
 
 static int	usermount = 0;
@@ -95,31 +89,6 @@ struct mtx mountlist_mtx;
 MTX_SYSINIT(mountlist, &mountlist_mtx, "mountlist", MTX_DEF);
 
 /*
- * The vnode of the system's root (/ in the filesystem, without chroot
- * active.)
- */
-struct vnode	*rootvnode;
-
-/*
- * The root filesystem is detailed in the kernel environment variable
- * vfs.root.mountfrom, which is expected to be in the general format
- *
- * :[][	:[] ...]
- * vfsname   := the name of a VFS known to the kernel and capable
- *              of being mounted as root
- * path      := disk device name or other data used by the filesystem
- *              to locate its physical store
- *
- * If the environment variable vfs.root.mountfrom is a space separated list,
- * each list element is tried in turn and the root filesystem will be mounted
- * from the first one that suceeds.
- *
- * The environment variable vfs.root.mountfrom.options is a comma delimited
- * set of string mount options.  These mount options must be parseable
- * by nmount() in the kernel.
- */
-
-/*
  * Global opts, taken by all filesystems
  */
 static const char *global_opts[] = {
@@ -133,21 +102,35 @@ static const char *global_opts[] = {
 	NULL
 };
 
-/*
- * The root specifiers we will try if RB_CDROM is specified.
- */
-static char *cdrom_rootdevnames[] = {
-	"cd9660:cd0",
-	"cd9660:acd0",
-	NULL
-};
+static int
+mount_init(void *mem, int size, int flags)
+{
+	struct mount *mp;
 
-/* legacy find-root code */
-char		*rootdevnames[2] = {NULL, NULL};
-#ifndef ROOTDEVNAME
-#  define ROOTDEVNAME NULL
-#endif
-static const char	*ctrootdevname = ROOTDEVNAME;
+	mp = (struct mount *)mem;
+	mtx_init(&mp->mnt_mtx, "struct mount mtx", NULL, MTX_DEF);
+	lockinit(&mp->mnt_explock, PVFS, "explock", 0, 0);
+	return (0);
+}
+
+static void
+mount_fini(void *mem, int size)
+{
+	struct mount *mp;
+
+	mp = (struct mount *)mem;
+	lockdestroy(&mp->mnt_explock);
+	mtx_destroy(&mp->mnt_mtx);
+}
+
+static void
+vfs_mount_init(void *dummy __unused)
+{
+
+	mount_zone = uma_zcreate("Mountpoints", sizeof(struct mount), NULL,
+	    NULL, mount_init, mount_fini, UMA_ALIGN_PTR, UMA_ZONE_NOFREE);
+}
+SYSINIT(vfs_mount, SI_SUB_VFS, SI_ORDER_ANY, vfs_mount_init, NULL);
 
 /*
  * ---------------------------------------------------------------------
@@ -452,27 +435,6 @@ vfs_rel(struct mount *mp)
 	MNT_IUNLOCK(mp);
 }
 
-static int
-mount_init(void *mem, int size, int flags)
-{
-	struct mount *mp;
-
-	mp = (struct mount *)mem;
-	mtx_init(&mp->mnt_mtx, "struct mount mtx", NULL, MTX_DEF);
-	lockinit(&mp->mnt_explock, PVFS, "explock", 0, 0);
-	return (0);
-}
-
-static void
-mount_fini(void *mem, int size)
-{
-	struct mount *mp;
-
-	mp = (struct mount *)mem;
-	lockdestroy(&mp->mnt_explock);
-	mtx_destroy(&mp->mnt_mtx);
-}
-
 /*
  * Allocate and initialize the mount point struct.
  */
@@ -1384,281 +1346,6 @@ dounmount(mp, flags, td)
 }
 
 /*
- * ---------------------------------------------------------------------
- * Mounting of root filesystem
- *
- */
-
-struct root_hold_token {
-	const char			*who;
-	LIST_ENTRY(root_hold_token)	list;
-};
-
-static LIST_HEAD(, root_hold_token)	root_holds =
-    LIST_HEAD_INITIALIZER(root_holds);
-
-static int root_mount_complete;
-
-/*
- * Hold root mount.
- */
-struct root_hold_token *
-root_mount_hold(const char *identifier)
-{
-	struct root_hold_token *h;
-
-	if (root_mounted())
-		return (NULL);
-
-	h = malloc(sizeof *h, M_DEVBUF, M_ZERO | M_WAITOK);
-	h->who = identifier;
-	mtx_lock(&mountlist_mtx);
-	LIST_INSERT_HEAD(&root_holds, h, list);
-	mtx_unlock(&mountlist_mtx);
-	return (h);
-}
-
-/*
- * Release root mount.
- */
-void
-root_mount_rel(struct root_hold_token *h)
-{
-
-	if (h == NULL)
-		return;
-	mtx_lock(&mountlist_mtx);
-	LIST_REMOVE(h, list);
-	wakeup(&root_holds);
-	mtx_unlock(&mountlist_mtx);
-	free(h, M_DEVBUF);
-}
-
-/*
- * Wait for all subsystems to release root mount.
- */
-static void
-root_mount_prepare(void)
-{
-	struct root_hold_token *h;
-	struct timeval lastfail;
-	int curfail = 0;
-
-	for (;;) {
-		DROP_GIANT();
-		g_waitidle();
-		PICKUP_GIANT();
-		mtx_lock(&mountlist_mtx);
-		if (LIST_EMPTY(&root_holds)) {
-			mtx_unlock(&mountlist_mtx);
-			break;
-		}
-		if (ppsratecheck(&lastfail, &curfail, 1)) {
-			printf("Root mount waiting for:");
-			LIST_FOREACH(h, &root_holds, list)
-				printf(" %s", h->who);
-			printf("\n");
-		}
-		msleep(&root_holds, &mountlist_mtx, PZERO | PDROP, "roothold",
-		    hz);
-	}
-}
-
-/*
- * Root was mounted, share the good news.
- */
-static void
-root_mount_done(void)
-{
-
-	/* Keep prison0's root in sync with the global rootvnode. */
-	mtx_lock(&prison0.pr_mtx);
-	prison0.pr_root = rootvnode;
-	vref(prison0.pr_root);
-	mtx_unlock(&prison0.pr_mtx);
-	/*
-	 * Use a mutex to prevent the wakeup being missed and waiting for
-	 * an extra 1 second sleep.
-	 */
-	mtx_lock(&mountlist_mtx);
-	root_mount_complete = 1;
-	wakeup(&root_mount_complete);
-	mtx_unlock(&mountlist_mtx);
-}
-
-/*
- * Return true if root is already mounted.
- */
-int
-root_mounted(void)
-{
-
-	/* No mutex is acquired here because int stores are atomic. */
-	return (root_mount_complete);
-}
-
-/*
- * Wait until root is mounted.
- */
-void
-root_mount_wait(void)
-{
-
-	/*
-	 * Panic on an obvious deadlock - the function can't be called from
-	 * a thread which is doing the whole SYSINIT stuff.
-	 */
-	KASSERT(curthread->td_proc->p_pid != 0,
-	    ("root_mount_wait: cannot be called from the swapper thread"));
-	mtx_lock(&mountlist_mtx);
-	while (!root_mount_complete) {
-		msleep(&root_mount_complete, &mountlist_mtx, PZERO, "rootwait",
-		    hz);
-	}
-	mtx_unlock(&mountlist_mtx);
-}
-
-static void
-set_rootvnode()
-{
-	struct proc *p;
-
-	if (VFS_ROOT(TAILQ_FIRST(&mountlist), LK_EXCLUSIVE, &rootvnode))
-		panic("Cannot find root vnode");
-
-	VOP_UNLOCK(rootvnode, 0);
-
-	p = curthread->td_proc;
-	FILEDESC_XLOCK(p->p_fd);
-
-	if (p->p_fd->fd_cdir != NULL)
-		vrele(p->p_fd->fd_cdir);
-	p->p_fd->fd_cdir = rootvnode;
-	VREF(rootvnode);
-
-	if (p->p_fd->fd_rdir != NULL)
-		vrele(p->p_fd->fd_rdir);
-	p->p_fd->fd_rdir = rootvnode;
-	VREF(rootvnode);
-
-	FILEDESC_XUNLOCK(p->p_fd);
-
-	EVENTHANDLER_INVOKE(mountroot);
-}
-
-/*
- * Mount /devfs as our root filesystem, but do not put it on the mountlist
- * yet.  Create a /dev -> / symlink so that absolute pathnames will lookup.
- */
-
-static void
-devfs_first(void)
-{
-	struct thread *td = curthread;
-	struct vfsoptlist *opts;
-	struct vfsconf *vfsp;
-	struct mount *mp = NULL;
-	int error;
-
-	vfsp = vfs_byname("devfs");
-	KASSERT(vfsp != NULL, ("Could not find devfs by name"));
-	if (vfsp == NULL)
-		return;
-
-	mp = vfs_mount_alloc(NULLVP, vfsp, "/dev", td->td_ucred);
-
-	error = VFS_MOUNT(mp);
-	KASSERT(error == 0, ("VFS_MOUNT(devfs) failed %d", error));
-	if (error)
-		return;
-
-	opts = malloc(sizeof(struct vfsoptlist), M_MOUNT, M_WAITOK);
-	TAILQ_INIT(opts);
-	mp->mnt_opt = opts;
-
-	mtx_lock(&mountlist_mtx);
-	TAILQ_INSERT_HEAD(&mountlist, mp, mnt_list);
-	mtx_unlock(&mountlist_mtx);
-
-	set_rootvnode();
-
-	error = kern_symlink(td, "/", "dev", UIO_SYSSPACE);
-	if (error)
-		printf("kern_symlink /dev -> / returns %d\n", error);
-}
-
-/*
- * Surgically move our devfs to be mounted on /dev.
- */
-
-static void
-devfs_fixup(struct thread *td)
-{
-	struct nameidata nd;
-	struct vnode *vp, *dvp;
-	struct mount *mp;
-	int error;
-
-	/* Remove our devfs mount from the mountlist and purge the cache */
-	mtx_lock(&mountlist_mtx);
-	mp = TAILQ_FIRST(&mountlist);
-	TAILQ_REMOVE(&mountlist, mp, mnt_list);
-	mtx_unlock(&mountlist_mtx);
-	cache_purgevfs(mp);
-
-	VFS_ROOT(mp, LK_EXCLUSIVE, &dvp);
-	VI_LOCK(dvp);
-	dvp->v_iflag &= ~VI_MOUNT;
-	VI_UNLOCK(dvp);
-	dvp->v_mountedhere = NULL;
-
-	/* Set up the real rootvnode, and purge the cache */
-	TAILQ_FIRST(&mountlist)->mnt_vnodecovered = NULL;
-	set_rootvnode();
-	cache_purgevfs(rootvnode->v_mount);
-
-	NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_SYSSPACE, "/dev", td);
-	error = namei(&nd);
-	if (error) {
-		printf("Lookup of /dev for devfs, error: %d\n", error);
-		vput(dvp);
-		vfs_unbusy(mp);
-		return;
-	}
-	NDFREE(&nd, NDF_ONLY_PNBUF);
-	vp = nd.ni_vp;
-	if (vp->v_type != VDIR) {
-		printf("/dev is not a directory\n");
-		vput(dvp);
-		vput(vp);
-		vfs_unbusy(mp);
-		return;
-	}
-	error = vinvalbuf(vp, V_SAVE, 0, 0);
-	if (error) {
-		printf("vinvalbuf() of /dev failed, error: %d\n", error);
-		vput(dvp);
-		vput(vp);
-		vfs_unbusy(mp);
-		return;
-	}
-	cache_purge(vp);
-	mp->mnt_vnodecovered = vp;
-	vp->v_mountedhere = mp;
-	mtx_lock(&mountlist_mtx);
-	TAILQ_INSERT_TAIL(&mountlist, mp, mnt_list);
-	mtx_unlock(&mountlist_mtx);
-	VOP_UNLOCK(vp, 0);
-	vput(dvp);
-	vfs_unbusy(mp);
-
-	/* Unlink the no longer needed /dev/dev -> / symlink */
-	error = kern_unlink(td, "/dev/dev", UIO_SYSSPACE);
-	if (error)
-		printf("kern_unlink of /dev/dev failed, error: %d\n", error);
-}
-
-/*
  * Report errors during filesystem mounting.
  */
 void
@@ -1695,288 +1382,6 @@ vfs_opterror(struct vfsoptlist *opts, co
 }
 
 /*
- * Find and mount the root filesystem
- */
-void
-vfs_mountroot(void)
-{
-	char *cp, *cpt, *options, *tmpdev;
-	int error, i, asked = 0;
-
-	options = NULL;
-
-	root_mount_prepare();
-
-	mount_zone = uma_zcreate("Mountpoints", sizeof(struct mount),
-	    NULL, NULL, mount_init, mount_fini,
-	    UMA_ALIGN_PTR, UMA_ZONE_NOFREE);
-	devfs_first();
-
-	/*
-	 * We are booted with instructions to prompt for the root filesystem.
-	 */
-	if (boothowto & RB_ASKNAME) {
-		if (!vfs_mountroot_ask())
-			goto mounted;
-		asked = 1;
-	}
-
-	options = getenv("vfs.root.mountfrom.options");
-
-	/*
-	 * The root filesystem information is compiled in, and we are
-	 * booted with instructions to use it.
-	 */
-	if (ctrootdevname != NULL && (boothowto & RB_DFLTROOT)) {
-		if (!vfs_mountroot_try(ctrootdevname, options))
-			goto mounted;
-		ctrootdevname = NULL;
-	}
-
-	/*
-	 * We've been given the generic "use CDROM as root" flag.  This is
-	 * necessary because one media may be used in many different
-	 * devices, so we need to search for them.
-	 */
-	if (boothowto & RB_CDROM) {
-		for (i = 0; cdrom_rootdevnames[i] != NULL; i++) {
-			if (!vfs_mountroot_try(cdrom_rootdevnames[i], options))
-				goto mounted;
-		}
-	}
-
-	/*
-	 * Try to use the value read by the loader from /etc/fstab, or
-	 * supplied via some other means.  This is the preferred
-	 * mechanism.
-	 */
-	cp = getenv("vfs.root.mountfrom");
-	if (cp != NULL) {
-		cpt = cp;
-		while ((tmpdev = strsep(&cpt, " \t")) != NULL) {
-			error = vfs_mountroot_try(tmpdev, options);
-			if (error == 0) {
-				freeenv(cp);
-				goto mounted;
-			}
-		}
-		freeenv(cp);
-	}
-
-	/*
-	 * Try values that may have been computed by code during boot
-	 */
-	if (!vfs_mountroot_try(rootdevnames[0], options))
-		goto mounted;
-	if (!vfs_mountroot_try(rootdevnames[1], options))
-		goto mounted;
-
-	/*
-	 * If we (still) have a compiled-in default, try it.
-	 */
-	if (ctrootdevname != NULL)
-		if (!vfs_mountroot_try(ctrootdevname, options))
-			goto mounted;
-	/*
-	 * Everything so far has failed, prompt on the console if we haven't
-	 * already tried that.
-	 */
-	if (!asked)
-		if (!vfs_mountroot_ask())
-			goto mounted;
-
-	panic("Root mount failed, startup aborted.");
-
-mounted:
-	root_mount_done();
-	freeenv(options);
-}
-
-static struct mntarg *
-parse_mountroot_options(struct mntarg *ma, const char *options)
-{
-	char *p;
-	char *name, *name_arg;
-	char *val, *val_arg;
-	char *opts;
-
-	if (options == NULL || options[0] == '\0')
-		return (ma);
-
-	p = opts = strdup(options, M_MOUNT);
-	if (opts == NULL) {
-		return (ma);
-	} 
-
-	while((name = strsep(&p, ",")) != NULL) {
-		if (name[0] == '\0')
-			break;
-
-		val = strchr(name, '=');
-		if (val != NULL) {
-			*val = '\0';
-			++val;
-		}
-		if( strcmp(name, "rw") == 0 ||
-		    strcmp(name, "noro") == 0) {
-			/*
-			 * The first time we mount the root file system,
-			 * we need to mount 'ro', so We need to ignore
-			 * 'rw' and 'noro' mount options.
-			 */
-			continue;
-		}
-		name_arg = strdup(name, M_MOUNT);
-		val_arg = NULL;
-		if (val != NULL) 
-			val_arg = strdup(val, M_MOUNT);
-
-		ma = mount_arg(ma, name_arg, val_arg,
-		    (val_arg != NULL ? -1 : 0));
-	}
-	free(opts, M_MOUNT);
-	return (ma);
-}
-
-/*
- * Mount (mountfrom) as the root filesystem.
- */
-static int
-vfs_mountroot_try(const char *mountfrom, const char *options)
-{
-	struct mount	*mp;
-	struct mntarg	*ma;
-	char		*vfsname, *path;
-	time_t		timebase;
-	int		error;
-	char		patt[32];
-	char		errmsg[255];
-
-	vfsname = NULL;
-	path    = NULL;
-	mp      = NULL;
-	ma	= NULL;
-	error   = EINVAL;
-	bzero(errmsg, sizeof(errmsg));
-
-	if (mountfrom == NULL)
-		return (error);		/* don't complain */
-	printf("Trying to mount root from %s\n", mountfrom);
-
-	/* parse vfs name and path */
-	vfsname = malloc(MFSNAMELEN, M_MOUNT, M_WAITOK);
-	path = malloc(MNAMELEN, M_MOUNT, M_WAITOK);
-	vfsname[0] = path[0] = 0;
-	sprintf(patt, "%%%d[a-z0-9]:%%%ds", MFSNAMELEN, MNAMELEN);
-	if (sscanf(mountfrom, patt, vfsname, path) < 1)
-		goto out;
-
-	if (path[0] == '\0')
-		strcpy(path, ROOTNAME);
-
-	ma = mount_arg(ma, "fstype", vfsname, -1);
-	ma = mount_arg(ma, "fspath", "/", -1);
-	ma = mount_arg(ma, "from", path, -1);
-	ma = mount_arg(ma, "errmsg", errmsg, sizeof(errmsg));
-	ma = mount_arg(ma, "ro", NULL, 0);
-	ma = parse_mountroot_options(ma, options);
-	error = kernel_mount(ma, MNT_ROOTFS);
-
-	if (error == 0) {
-		/*
-		 * We mount devfs prior to mounting the / FS, so the first
-		 * entry will typically be devfs.
-		 */
-		mp = TAILQ_FIRST(&mountlist);
-		KASSERT(mp != NULL, ("%s: mountlist is empty", __func__));
-
-		/*
-		 * Iterate over all currently mounted file systems and use
-		 * the time stamp found to check and/or initialize the RTC.
-		 * Typically devfs has no time stamp and the only other FS
-		 * is the actual / FS.
-		 * Call inittodr() only once and pass it the largest of the
-		 * timestamps we encounter.
-		 */
-		timebase = 0;
-		do {
-			if (mp->mnt_time > timebase)
-				timebase = mp->mnt_time;
-			mp = TAILQ_NEXT(mp, mnt_list);
-		} while (mp != NULL);
-		inittodr(timebase);
-
-		devfs_fixup(curthread);
-	}
-
-	if (error != 0 ) {
-		printf("ROOT MOUNT ERROR: %s\n", errmsg);
-		printf("If you have invalid mount options, reboot, and ");
-		printf("first try the following from\n");
-		printf("the loader prompt:\n\n");
-		printf("     set vfs.root.mountfrom.options=rw\n\n");
-		printf("and then remove invalid mount options from ");
-		printf("/etc/fstab.\n\n");
-	}
-out:
-	free(path, M_MOUNT);
-	free(vfsname, M_MOUNT);
-	return (error);
-}
-
-/*
- * ---------------------------------------------------------------------
- * Interactive root filesystem selection code.
- */
-
-static int
-vfs_mountroot_ask(void)
-{
-	char name[128];
-	char *mountfrom;
-	char *options;
-
-	for(;;) {
-		printf("Loader variables:\n");
-		printf("vfs.root.mountfrom=");
-		mountfrom = getenv("vfs.root.mountfrom");
-		if (mountfrom != NULL) {
-			printf("%s", mountfrom);
-		}
-		printf("\n");
-		printf("vfs.root.mountfrom.options=");
-		options = getenv("vfs.root.mountfrom.options");
-		if (options != NULL) {
-			printf("%s", options);
-		}
-		printf("\n");
-		freeenv(mountfrom);
-		freeenv(options);
-		printf("\nManual root filesystem specification:\n");
-		printf("  :  Mount  using filesystem \n");
-		printf("                       eg. zfs:tank\n");
-		printf("                       eg. ufs:/dev/da0s1a\n");
-		printf("                       eg. cd9660:/dev/acd0\n");
-		printf("                       This is equivalent to: ");
-		printf("mount -t cd9660 /dev/acd0 /\n"); 
-		printf("\n");
-		printf("  ?                  List valid disk boot devices\n");
-		printf("         Abort manual input\n");
-		printf("\nmountroot> ");
-		gets(name, sizeof(name), 1);
-		if (name[0] == '\0')
-			return (1);
-		if (name[0] == '?') {
-			printf("\nList of GEOM managed disk devices:\n  ");
-			g_dev_print();
-			continue;
-		}
-		if (!vfs_mountroot_try(name, NULL))
-			return (0);
-	}
-}
-
-/*
  * ---------------------------------------------------------------------
  * Functions for querying mount options/arguments from filesystems.
  */

Added: head/sys/kern/vfs_mountroot.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/kern/vfs_mountroot.c	Sat Oct  2 19:44:13 2010	(r213365)
@@ -0,0 +1,626 @@
+/*-
+ * Copyright (c) 1999-2004 Poul-Henning Kamp
+ * Copyright (c) 1999 Michael Smith
+ * Copyright (c) 1989, 1993
+ *      The Regents of the University of California.  All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include 
+
+#include "opt_rootdevname.h"
+
+#define	ROOTNAME		"root_device"
+
+static int	vfs_mountroot_ask(void);
+static int	vfs_mountroot_try(const char *mountfrom, const char *options);
+
+/*
+ * The vnode of the system's root (/ in the filesystem, without chroot
+ * active.)
+ */
+struct vnode	*rootvnode;
+
+/*
+ * The root filesystem is detailed in the kernel environment variable
+ * vfs.root.mountfrom, which is expected to be in the general format
+ *
+ * :[][	:[] ...]
+ * vfsname   := the name of a VFS known to the kernel and capable
+ *              of being mounted as root
+ * path      := disk device name or other data used by the filesystem
+ *              to locate its physical store
+ *
+ * If the environment variable vfs.root.mountfrom is a space separated list,
+ * each list element is tried in turn and the root filesystem will be mounted
+ * from the first one that suceeds.
+ *
+ * The environment variable vfs.root.mountfrom.options is a comma delimited
+ * set of string mount options.  These mount options must be parseable
+ * by nmount() in the kernel.
+ */
+
+/*
+ * The root specifiers we will try if RB_CDROM is specified.
+ */
+static char *cdrom_rootdevnames[] = {
+	"cd9660:cd0",
+	"cd9660:acd0",
+	NULL
+};
+
+/* legacy find-root code */
+char		*rootdevnames[2] = {NULL, NULL};
+#ifndef ROOTDEVNAME
+#  define ROOTDEVNAME NULL
+#endif
+static const char	*ctrootdevname = ROOTDEVNAME;
+
+struct root_hold_token {
+	const char			*who;
+	LIST_ENTRY(root_hold_token)	list;
+};
+
+static LIST_HEAD(, root_hold_token)	root_holds =
+    LIST_HEAD_INITIALIZER(root_holds);
+
+static int root_mount_complete;
+
+struct root_hold_token *
+root_mount_hold(const char *identifier)
+{
+	struct root_hold_token *h;
+
+	if (root_mounted())
+		return (NULL);
+
+	h = malloc(sizeof *h, M_DEVBUF, M_ZERO | M_WAITOK);
+	h->who = identifier;
+	mtx_lock(&mountlist_mtx);
+	LIST_INSERT_HEAD(&root_holds, h, list);
+	mtx_unlock(&mountlist_mtx);
+	return (h);
+}
+
+void
+root_mount_rel(struct root_hold_token *h)
+{
+
+	if (h == NULL)
+		return;
+	mtx_lock(&mountlist_mtx);
+	LIST_REMOVE(h, list);
+	wakeup(&root_holds);
+	mtx_unlock(&mountlist_mtx);
+	free(h, M_DEVBUF);
+}
+
+static void
+root_mount_prepare(void)
+{
+	struct root_hold_token *h;
+	struct timeval lastfail;
+	int curfail = 0;
+
+	for (;;) {
+		DROP_GIANT();
+		g_waitidle();
+		PICKUP_GIANT();
+		mtx_lock(&mountlist_mtx);
+		if (LIST_EMPTY(&root_holds)) {
+			mtx_unlock(&mountlist_mtx);
+			break;
+		}
+		if (ppsratecheck(&lastfail, &curfail, 1)) {
+			printf("Root mount waiting for:");
+			LIST_FOREACH(h, &root_holds, list)
+				printf(" %s", h->who);
+			printf("\n");
+		}
+		msleep(&root_holds, &mountlist_mtx, PZERO | PDROP, "roothold",
+		    hz);
+	}
+}
+
+static void
+root_mount_done(void)
+{
+
+	/* Keep prison0's root in sync with the global rootvnode. */
+	mtx_lock(&prison0.pr_mtx);
+	prison0.pr_root = rootvnode;
+	vref(prison0.pr_root);
+	mtx_unlock(&prison0.pr_mtx);
+	/*
+	 * Use a mutex to prevent the wakeup being missed and waiting for
+	 * an extra 1 second sleep.
+	 */
+	mtx_lock(&mountlist_mtx);
+	root_mount_complete = 1;
+	wakeup(&root_mount_complete);
+	mtx_unlock(&mountlist_mtx);
+}
+
+int
+root_mounted(void)
+{
+
+	/* No mutex is acquired here because int stores are atomic. */
+	return (root_mount_complete);
+}
+
+void
+root_mount_wait(void)
+{
+
+	/*
+	 * Panic on an obvious deadlock - the function can't be called from
+	 * a thread which is doing the whole SYSINIT stuff.
+	 */
+	KASSERT(curthread->td_proc->p_pid != 0,
+	    ("root_mount_wait: cannot be called from the swapper thread"));
+	mtx_lock(&mountlist_mtx);
+	while (!root_mount_complete) {
+		msleep(&root_mount_complete, &mountlist_mtx, PZERO, "rootwait",
+		    hz);
+	}
+	mtx_unlock(&mountlist_mtx);
+}
+
+static void
+set_rootvnode(void)
+{
+	struct proc *p;
+
+	if (VFS_ROOT(TAILQ_FIRST(&mountlist), LK_EXCLUSIVE, &rootvnode))
+		panic("Cannot find root vnode");
+
+	VOP_UNLOCK(rootvnode, 0);
+
+	p = curthread->td_proc;
+	FILEDESC_XLOCK(p->p_fd);
+
+	if (p->p_fd->fd_cdir != NULL)
+		vrele(p->p_fd->fd_cdir);
+	p->p_fd->fd_cdir = rootvnode;
+	VREF(rootvnode);
+
+	if (p->p_fd->fd_rdir != NULL)
+		vrele(p->p_fd->fd_rdir);
+	p->p_fd->fd_rdir = rootvnode;
+	VREF(rootvnode);
+
+	FILEDESC_XUNLOCK(p->p_fd);
+
+	EVENTHANDLER_INVOKE(mountroot);
+}
+
+static void
+devfs_first(void)
+{
+	struct thread *td = curthread;
+	struct vfsoptlist *opts;
+	struct vfsconf *vfsp;
+	struct mount *mp = NULL;
+	int error;
+
+	vfsp = vfs_byname("devfs");
+	KASSERT(vfsp != NULL, ("Could not find devfs by name"));
+	if (vfsp == NULL)
+		return;
+
+	mp = vfs_mount_alloc(NULLVP, vfsp, "/dev", td->td_ucred);
+
+	error = VFS_MOUNT(mp);
+	KASSERT(error == 0, ("VFS_MOUNT(devfs) failed %d", error));
+	if (error)
+		return;
+
+	opts = malloc(sizeof(struct vfsoptlist), M_MOUNT, M_WAITOK);
+	TAILQ_INIT(opts);
+	mp->mnt_opt = opts;
+
+	mtx_lock(&mountlist_mtx);
+	TAILQ_INSERT_HEAD(&mountlist, mp, mnt_list);
+	mtx_unlock(&mountlist_mtx);
+
+	set_rootvnode();
+
+	error = kern_symlink(td, "/", "dev", UIO_SYSSPACE);
+	if (error)
+		printf("kern_symlink /dev -> / returns %d\n", error);

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

From owner-svn-src-head@FreeBSD.ORG  Sat Oct  2 20:09:16 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 687871065670;
	Sat,  2 Oct 2010 20:09:16 +0000 (UTC)
	(envelope-from pluknet@gmail.com)
Received: from mail-qy0-f182.google.com (mail-qy0-f182.google.com
	[209.85.216.182])
	by mx1.freebsd.org (Postfix) with ESMTP id C5C798FC0A;
	Sat,  2 Oct 2010 20:09:15 +0000 (UTC)
Received: by qyk33 with SMTP id 33so2315850qyk.13
	for ; Sat, 02 Oct 2010 13:09:15 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=domainkey-signature:mime-version:received:received:in-reply-to
	:references:date:message-id:subject:from:to:cc:content-type
	:content-transfer-encoding;
	bh=qjhwxLt7VFltuzQFHdJ2/EccHaGQ1aZ+L2gHh+a+V1c=;
	b=rPGTBFy9/YHIYMBMfufOcyksEl7C74K6DwHjW4VLlsFBnKxmNzXaOnnMKw6QqJeJC6
	jAVHlw+0wgRSRiugM0kocvuolxrMj7l3wq6ogTtHsIqAJ2mS4cfORCPE6swWnF7g4S++
	vrYAsjf0ax3k1AQCjkfX/mTTGWR6oI4G3aG1A=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
	h=mime-version:in-reply-to:references:date:message-id:subject:from:to
	:cc:content-type:content-transfer-encoding;
	b=upSHCrLtxZFbpv1+BHvCPrTvQ2BbcdztqGA/y4coMfvlQ6Z8wwXp6j62GvFFmpLWia
	2wR00MXrjVL8iBxLIzRxjD0/MfaPjVgYn6APhMRUEqNZFNZUv4erqpAlXWdixiEEbyM1
	cZm6ic3jQen6gCuD2Jbr4zGGiDdI8I+KhaVFo=
MIME-Version: 1.0
Received: by 10.224.78.233 with SMTP id m41mr5184646qak.27.1286050154899; Sat,
	02 Oct 2010 13:09:14 -0700 (PDT)
Received: by 10.229.50.8 with HTTP; Sat, 2 Oct 2010 13:09:14 -0700 (PDT)
In-Reply-To: 
References: <201009281533.o8SFXULh078409@svn.freebsd.org>
	
Date: Sun, 3 Oct 2010 00:09:14 +0400
Message-ID: 
From: Sergey Kandaurov 
To: Antoine Brodin 
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org, Warner Losh 
Subject: Re: svn commit: r213248 - head/sys/kern
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 02 Oct 2010 20:09:16 -0000

On 2 October 2010 22:12, Antoine Brodin  wrote:
> On Tue, Sep 28, 2010 at 5:33 PM, Warner Losh  wrote:
>> Author: imp
>> Date: Tue Sep 28 15:33:30 2010
>> New Revision: 213248
>> URL: http://svn.freebsd.org/changeset/base/213248
>>
>> Log:
>> =A0This file has been unused for ages. =A0Retire it.
>>
>> =A0Submitted by: pluknet
>>
>> Deleted:
>> =A0head/sys/kern/Makefile
>
> Hi,
>
> What is the correct way to "make sysent" now ?
>

Hi.

It seems I just dumbbroke the useful functionality. I'm sorry.
Obviously that was somehow overlooked last time I checked it.
So, removing sysent target is not something intentional.

I think it should be simply reverted for now, or more preferably
restored with sysent target only.

--=20
wbr,
pluknet

From owner-svn-src-head@FreeBSD.ORG  Sat Oct  2 21:35:34 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id DD9EE106564A;
	Sat,  2 Oct 2010 21:35:33 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id CD70A8FC17;
	Sat,  2 Oct 2010 21:35:33 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o92LZX3D055112;
	Sat, 2 Oct 2010 21:35:33 GMT (envelope-from imp@svn.freebsd.org)
Received: (from imp@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o92LZX2n055111;
	Sat, 2 Oct 2010 21:35:33 GMT (envelope-from imp@svn.freebsd.org)
Message-Id: <201010022135.o92LZX2n055111@svn.freebsd.org>
From: Warner Losh 
Date: Sat, 2 Oct 2010 21:35:33 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r213368 - head/sys/kern
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 02 Oct 2010 21:35:34 -0000

Author: imp
Date: Sat Oct  2 21:35:33 2010
New Revision: 213368
URL: http://svn.freebsd.org/changeset/base/213368

Log:
  Turns out this file was how we make sysent stuff, so add that part only back...

Added:
  head/sys/kern/Makefile   (contents, props changed)

Added: head/sys/kern/Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/kern/Makefile	Sat Oct  2 21:35:33 2010	(r213368)
@@ -0,0 +1,20 @@
+#	@(#)Makefile	8.2 (Berkeley) 3/21/94
+# $FreeBSD$
+
+# Makefile for init_sysent
+
+all:
+	@echo "make tags, make links or make sysent only"
+
+sysent: init_sysent.c syscalls.c ../sys/syscall.h ../sys/syscall.mk \
+../sys/sysproto.h
+
+init_sysent.c syscalls.c systrace_args.c ../sys/syscall.h \
+../sys/syscall.mk ../sys/sysproto.h: makesyscalls.sh syscalls.master
+	-mv -f init_sysent.c init_sysent.c.bak
+	-mv -f syscalls.c syscalls.c.bak
+	-mv -f systrace_args.c systrace_args.c.bak
+	-mv -f ../sys/syscall.h ../sys/syscall.h.bak
+	-mv -f ../sys/syscall.mk ../sys/syscall.mk.bak
+	-mv -f ../sys/sysproto.h ../sys/sysproto.h.bak
+	sh makesyscalls.sh syscalls.master

From owner-svn-src-head@FreeBSD.ORG  Sat Oct  2 21:41:11 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 615BB106564A;
	Sat,  2 Oct 2010 21:41:11 +0000 (UTC) (envelope-from imp@bsdimp.com)
Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85])
	by mx1.freebsd.org (Postfix) with ESMTP id 241A18FC14;
	Sat,  2 Oct 2010 21:41:11 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
	by harmony.bsdimp.com (8.14.3/8.14.1) with ESMTP id o92LZWn3075267;
	Sat, 2 Oct 2010 15:35:32 -0600 (MDT) (envelope-from imp@bsdimp.com)
Date: Sat, 02 Oct 2010 15:35:52 -0600 (MDT)
Message-Id: <20101002.153552.976690109574172273.imp@bsdimp.com>
To: antoine@freebsd.org
From: "M. Warner Losh" 
In-Reply-To: 
References: <201009281533.o8SFXULh078409@svn.freebsd.org>
	
X-Mailer: Mew version 6.3 on Emacs 22.3 / Mule 5.0 (SAKAKI)
Mime-Version: 1.0
Content-Type: Text/Plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r213248 - head/sys/kern
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 02 Oct 2010 21:41:11 -0000

In message: 
            Antoine Brodin  writes:
: On Tue, Sep 28, 2010 at 5:33 PM, Warner Losh  wrote:=

: > Author: imp
: > Date: Tue Sep 28 15:33:30 2010
: > New Revision: 213248
: > URL: http://svn.freebsd.org/changeset/base/213248
: >
: > Log:
: > =A0This file has been unused for ages. =A0Retire it.
: >
: > =A0Submitted by: pluknet
: >
: > Deleted:
: > =A0head/sys/kern/Makefile
: =

: Hi,
: =

: What is the correct way to "make sysent" now ?

Hmmm....  It looks like the tags part was the only obsolete part...
I'll add the other one back...  Sorry...

Warner

From owner-svn-src-head@FreeBSD.ORG  Sat Oct  2 21:41:28 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 551B01065673;
	Sat,  2 Oct 2010 21:41:28 +0000 (UTC) (envelope-from imp@bsdimp.com)
Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85])
	by mx1.freebsd.org (Postfix) with ESMTP id 150F28FC1E;
	Sat,  2 Oct 2010 21:41:28 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
	by harmony.bsdimp.com (8.14.3/8.14.1) with ESMTP id o92LaP6g075270;
	Sat, 2 Oct 2010 15:36:25 -0600 (MDT) (envelope-from imp@bsdimp.com)
Date: Sat, 02 Oct 2010 15:36:45 -0600 (MDT)
Message-Id: <20101002.153645.1021672927781301295.imp@bsdimp.com>
To: pluknet@gmail.com
From: "M. Warner Losh" 
In-Reply-To: 
References: <201009281533.o8SFXULh078409@svn.freebsd.org>
	
	
X-Mailer: Mew version 6.3 on Emacs 22.3 / Mule 5.0 (SAKAKI)
Mime-Version: 1.0
Content-Type: Text/Plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
Cc: svn-src-head@freebsd.org, antoine@freebsd.org, src-committers@freebsd.org,
	svn-src-all@freebsd.org
Subject: Re: svn commit: r213248 - head/sys/kern
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 02 Oct 2010 21:41:28 -0000

In message: 
            Sergey Kandaurov  writes:
: On 2 October 2010 22:12, Antoine Brodin  wrote:
: > On Tue, Sep 28, 2010 at 5:33 PM, Warner Losh  wrot=
e:
: >> Author: imp
: >> Date: Tue Sep 28 15:33:30 2010
: >> New Revision: 213248
: >> URL: http://svn.freebsd.org/changeset/base/213248
: >>
: >> Log:
: >> =A0This file has been unused for ages. =A0Retire it.
: >>
: >> =A0Submitted by: pluknet
: >>
: >> Deleted:
: >> =A0head/sys/kern/Makefile
: >
: > Hi,
: >
: > What is the correct way to "make sysent" now ?
: >
: =

: Hi.
: =

: It seems I just dumbbroke the useful functionality. I'm sorry.
: Obviously that was somehow overlooked last time I checked it.
: So, removing sysent target is not something intentional.
: =

: I think it should be simply reverted for now, or more preferably
: restored with sysent target only.

Please review the commit I just made to make sure that I didn't botch
anything.  I'm pretty sure I got it right, but you never know.

Warner

From owner-svn-src-head@FreeBSD.ORG  Sat Oct  2 22:12:41 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E4023106566B;
	Sat,  2 Oct 2010 22:12:41 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id D424A8FC19;
	Sat,  2 Oct 2010 22:12: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 o92MCfZF056102;
	Sat, 2 Oct 2010 22:12:41 GMT (envelope-from imp@svn.freebsd.org)
Received: (from imp@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o92MCfuU056100;
	Sat, 2 Oct 2010 22:12:41 GMT (envelope-from imp@svn.freebsd.org)
Message-Id: <201010022212.o92MCfuU056100@svn.freebsd.org>
From: Warner Losh 
Date: Sat, 2 Oct 2010 22:12:41 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r213372 - head/sys/kern
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 02 Oct 2010 22:12:42 -0000

Author: imp
Date: Sat Oct  2 22:12:41 2010
New Revision: 213372
URL: http://svn.freebsd.org/changeset/base/213372

Log:
  Adjust the all target message (but maybe all: sysent is better?

Modified:
  head/sys/kern/Makefile

Modified: head/sys/kern/Makefile
==============================================================================
--- head/sys/kern/Makefile	Sat Oct  2 22:12:04 2010	(r213371)
+++ head/sys/kern/Makefile	Sat Oct  2 22:12:41 2010	(r213372)
@@ -4,7 +4,7 @@
 # Makefile for init_sysent
 
 all:
-	@echo "make tags, make links or make sysent only"
+	@echo "make sysent only"
 
 sysent: init_sysent.c syscalls.c ../sys/syscall.h ../sys/syscall.mk \
 ../sys/sysproto.h