From owner-svn-src-stable-9@FreeBSD.ORG Sun Oct 2 11:13:28 2011 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E6E75106566B; Sun, 2 Oct 2011 11:13:28 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BCE5F8FC08; Sun, 2 Oct 2011 11:13:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p92BDSQA061329; Sun, 2 Oct 2011 11:13:28 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p92BDS7C061327; Sun, 2 Oct 2011 11:13:28 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201110021113.p92BDS7C061327@svn.freebsd.org> From: Alexander Motin Date: Sun, 2 Oct 2011 11:13:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225917 - stable/9/sys/powerpc/powerpc X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Oct 2011 11:13:29 -0000 Author: mav Date: Sun Oct 2 11:13:28 2011 New Revision: 225917 URL: http://svn.freebsd.org/changeset/base/225917 Log: MFC r225875, r225877: Handle the race in cpu_idle() when due to the critical section CPU could get into sleep after receiving interrupt, delaying interrupt thread execution indefinitely until the next interrupt arrive. Reviewed by: nwhitehorn Approved by: re (kib) Modified: stable/9/sys/powerpc/powerpc/cpu.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/powerpc/powerpc/cpu.c ============================================================================== --- stable/9/sys/powerpc/powerpc/cpu.c Sun Oct 2 09:44:28 2011 (r225916) +++ stable/9/sys/powerpc/powerpc/cpu.c Sun Oct 2 11:13:28 2011 (r225917) @@ -65,6 +65,7 @@ #include #include #include +#include #include #include @@ -553,6 +554,11 @@ cpu_idle_60x(void) vers = mfpvr() >> 16; #ifdef AIM + mtmsr(msr & ~PSL_EE); + if (sched_runnable()) { + mtmsr(msr); + return; + } switch (vers) { case IBM970: case IBM970FX: @@ -583,6 +589,11 @@ cpu_idle_e500(void) msr = mfmsr(); #ifdef E500 + mtmsr(msr & ~PSL_EE); + if (sched_runnable()) { + mtmsr(msr); + return; + } /* Freescale E500 core RM section 6.4.1. */ __asm __volatile("msync; mtmsr %0; isync" :: "r" (msr | PSL_WE)); From owner-svn-src-stable-9@FreeBSD.ORG Sun Oct 2 12:15:15 2011 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 726641065672; Sun, 2 Oct 2011 12:15:15 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 612978FC18; Sun, 2 Oct 2011 12:15:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p92CFF39063147; Sun, 2 Oct 2011 12:15:15 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p92CFFw4063144; Sun, 2 Oct 2011 12:15:15 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201110021215.p92CFFw4063144@svn.freebsd.org> From: Alexander Motin Date: Sun, 2 Oct 2011 12:15:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225918 - stable/9/sys/dev/mfi X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Oct 2011 12:15:15 -0000 Author: mav Date: Sun Oct 2 12:15:15 2011 New Revision: 225918 URL: http://svn.freebsd.org/changeset/base/225918 Log: MFC r225869: - Add special support for the MFI_CMD ioctl with MFI_CMD_STP command, used by present MegaCLI version. It has some special meaning for the first s/g list entry, while the main s/g list begins from the the second entry, and those lists should remain separate after loading to the busdma map. - Fix bug in 32bit ioctl compatibility shims when s/g list consists of more then on element. Approved by: re (kib) Modified: stable/9/sys/dev/mfi/mfi.c stable/9/sys/dev/mfi/mfivar.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/dev/mfi/mfi.c ============================================================================== --- stable/9/sys/dev/mfi/mfi.c Sun Oct 2 11:13:28 2011 (r225917) +++ stable/9/sys/dev/mfi/mfi.c Sun Oct 2 12:15:15 2011 (r225918) @@ -1488,7 +1488,7 @@ mfi_data_cb(void *arg, bus_dma_segment_t struct mfi_command *cm; union mfi_sgl *sgl; struct mfi_softc *sc; - int i, dir; + int i, j, first, dir; cm = (struct mfi_command *)arg; sc = cm->cm_sc; @@ -1502,19 +1502,33 @@ mfi_data_cb(void *arg, bus_dma_segment_t return; } + j = 0; + if (cm->cm_frame->header.cmd == MFI_CMD_STP) { + first = cm->cm_stp_len; + if ((sc->mfi_flags & MFI_FLAGS_SG64) == 0) { + sgl->sg32[j].addr = segs[0].ds_addr; + sgl->sg32[j++].len = first; + } else { + sgl->sg64[j].addr = segs[0].ds_addr; + sgl->sg64[j++].len = first; + } + } else + first = 0; if ((sc->mfi_flags & MFI_FLAGS_SG64) == 0) { for (i = 0; i < nsegs; i++) { - sgl->sg32[i].addr = segs[i].ds_addr; - sgl->sg32[i].len = segs[i].ds_len; + sgl->sg32[j].addr = segs[i].ds_addr + first; + sgl->sg32[j++].len = segs[i].ds_len - first; + first = 0; } } else { for (i = 0; i < nsegs; i++) { - sgl->sg64[i].addr = segs[i].ds_addr; - sgl->sg64[i].len = segs[i].ds_len; + sgl->sg64[j].addr = segs[i].ds_addr + first; + sgl->sg64[j++].len = segs[i].ds_len - first; + first = 0; } hdr->flags |= MFI_FRAME_SGL64; } - hdr->sg_count = nsegs; + hdr->sg_count = j; dir = 0; if (cm->cm_flags & MFI_CMD_DATAIN) { @@ -1525,6 +1539,8 @@ mfi_data_cb(void *arg, bus_dma_segment_t dir |= BUS_DMASYNC_PREWRITE; hdr->flags |= MFI_FRAME_DIR_WRITE; } + if (cm->cm_frame->header.cmd == MFI_CMD_STP) + dir |= BUS_DMASYNC_PREWRITE; bus_dmamap_sync(sc->mfi_buffer_dmat, cm->cm_dmamap, dir); cm->cm_flags |= MFI_CMD_MAPPED; @@ -1602,7 +1618,8 @@ mfi_complete(struct mfi_softc *sc, struc if ((cm->cm_flags & MFI_CMD_MAPPED) != 0) { dir = 0; - if (cm->cm_flags & MFI_CMD_DATAIN) + if ((cm->cm_flags & MFI_CMD_DATAIN) || + (cm->cm_frame->header.cmd == MFI_CMD_STP)) dir |= BUS_DMASYNC_POSTREAD; if (cm->cm_flags & MFI_CMD_DATAOUT) dir |= BUS_DMASYNC_POSTWRITE; @@ -1927,7 +1944,8 @@ mfi_ioctl(struct cdev *dev, u_long cmd, struct mfi_command *cm = NULL; uint32_t context; union mfi_sense_ptr sense_ptr; - uint8_t *data = NULL, *temp; + uint8_t *data = NULL, *temp, *addr; + size_t len; int i; struct mfi_ioc_passthru *iop = (struct mfi_ioc_passthru *)arg; #ifdef __amd64__ @@ -2024,6 +2042,21 @@ mfi_ioctl(struct cdev *dev, u_long cmd, if (cm->cm_flags == 0) cm->cm_flags |= MFI_CMD_DATAIN | MFI_CMD_DATAOUT; cm->cm_len = cm->cm_frame->header.data_len; + if (cm->cm_frame->header.cmd == MFI_CMD_STP) { +#ifdef __amd64__ + if (cmd == MFI_CMD) { +#endif + /* Native */ + cm->cm_stp_len = ioc->mfi_sgl[0].iov_len; +#ifdef __amd64__ + } else { + /* 32bit on 64bit */ + ioc32 = (struct mfi_ioc_packet32 *)ioc; + cm->cm_stp_len = ioc32->mfi_sgl[0].iov_len; + } +#endif + cm->cm_len += cm->cm_stp_len; + } if (cm->cm_len && (cm->cm_flags & (MFI_CMD_DATAIN | MFI_CMD_DATAOUT))) { cm->cm_data = data = malloc(cm->cm_len, M_MFIBUF, @@ -2040,35 +2073,30 @@ mfi_ioctl(struct cdev *dev, u_long cmd, cm->cm_frame->header.context = context; temp = data; - if (cm->cm_flags & MFI_CMD_DATAOUT) { + if ((cm->cm_flags & MFI_CMD_DATAOUT) || + (cm->cm_frame->header.cmd == MFI_CMD_STP)) { for (i = 0; i < ioc->mfi_sge_count; i++) { #ifdef __amd64__ if (cmd == MFI_CMD) { +#endif /* Native */ - error = copyin(ioc->mfi_sgl[i].iov_base, - temp, - ioc->mfi_sgl[i].iov_len); + addr = ioc->mfi_sgl[i].iov_base; + len = ioc->mfi_sgl[i].iov_len; +#ifdef __amd64__ } else { - void *temp_convert; - /* 32bit */ + /* 32bit on 64bit */ ioc32 = (struct mfi_ioc_packet32 *)ioc; - temp_convert = - PTRIN(ioc32->mfi_sgl[i].iov_base); - error = copyin(temp_convert, - temp, - ioc32->mfi_sgl[i].iov_len); + addr = PTRIN(ioc32->mfi_sgl[i].iov_base); + len = ioc32->mfi_sgl[i].iov_len; } -#else - error = copyin(ioc->mfi_sgl[i].iov_base, - temp, - ioc->mfi_sgl[i].iov_len); #endif + error = copyin(addr, temp, len); if (error != 0) { device_printf(sc->mfi_dev, "Copy in failed\n"); goto out; } - temp = &temp[ioc->mfi_sgl[i].iov_len]; + temp = &temp[len]; } } @@ -2098,35 +2126,30 @@ mfi_ioctl(struct cdev *dev, u_long cmd, mtx_unlock(&sc->mfi_io_lock); temp = data; - if (cm->cm_flags & MFI_CMD_DATAIN) { + if ((cm->cm_flags & MFI_CMD_DATAIN) || + (cm->cm_frame->header.cmd == MFI_CMD_STP)) { for (i = 0; i < ioc->mfi_sge_count; i++) { #ifdef __amd64__ if (cmd == MFI_CMD) { +#endif /* Native */ - error = copyout(temp, - ioc->mfi_sgl[i].iov_base, - ioc->mfi_sgl[i].iov_len); + addr = ioc->mfi_sgl[i].iov_base; + len = ioc->mfi_sgl[i].iov_len; +#ifdef __amd64__ } else { - void *temp_convert; - /* 32bit */ + /* 32bit on 64bit */ ioc32 = (struct mfi_ioc_packet32 *)ioc; - temp_convert = - PTRIN(ioc32->mfi_sgl[i].iov_base); - error = copyout(temp, - temp_convert, - ioc32->mfi_sgl[i].iov_len); + addr = PTRIN(ioc32->mfi_sgl[i].iov_base); + len = ioc32->mfi_sgl[i].iov_len; } -#else - error = copyout(temp, - ioc->mfi_sgl[i].iov_base, - ioc->mfi_sgl[i].iov_len); #endif + error = copyout(temp, addr, len); if (error != 0) { device_printf(sc->mfi_dev, "Copy out failed\n"); goto out; } - temp = &temp[ioc->mfi_sgl[i].iov_len]; + temp = &temp[len]; } } Modified: stable/9/sys/dev/mfi/mfivar.h ============================================================================== --- stable/9/sys/dev/mfi/mfivar.h Sun Oct 2 11:13:28 2011 (r225917) +++ stable/9/sys/dev/mfi/mfivar.h Sun Oct 2 12:15:15 2011 (r225918) @@ -87,6 +87,7 @@ struct mfi_command { union mfi_sgl *cm_sg; void *cm_data; int cm_len; + int cm_stp_len; int cm_total_frame_size; int cm_extra_frames; int cm_flags; From owner-svn-src-stable-9@FreeBSD.ORG Mon Oct 3 20:27:52 2011 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 63DD4106566B; Mon, 3 Oct 2011 20:27:52 +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 4FF568FC12; Mon, 3 Oct 2011 20:27:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p93KRqfs026472; Mon, 3 Oct 2011 20:27:52 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p93KRqf7026466; Mon, 3 Oct 2011 20:27:52 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201110032027.p93KRqf7026466@svn.freebsd.org> From: Dimitry Andric Date: Mon, 3 Oct 2011 20:27:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225949 - in stable/9: contrib/llvm contrib/llvm/lib/Support contrib/llvm/tools/clang etc/mtree share/doc share/doc/llvm X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Oct 2011 20:27:52 -0000 Author: dim Date: Mon Oct 3 20:27:51 2011 New Revision: 225949 URL: http://svn.freebsd.org/changeset/base/225949 Log: MFC r225880: Revive the LLVM and Clang license files, which were removed in my too-thorough cleanup of unused files, in r213695. Also make sure these get installed under /usr/share/doc. Submitted by: rwatson, brooks Pointy hat to: dim Approved by: re (kib) Added: stable/9/contrib/llvm/LICENSE.TXT - copied unchanged from r225880, head/contrib/llvm/LICENSE.TXT stable/9/contrib/llvm/lib/Support/COPYRIGHT.regex - copied unchanged from r225880, head/contrib/llvm/lib/Support/COPYRIGHT.regex stable/9/contrib/llvm/tools/clang/LICENSE.TXT - copied unchanged from r225880, head/contrib/llvm/tools/clang/LICENSE.TXT stable/9/share/doc/llvm/ - copied from r225880, head/share/doc/llvm/ Modified: stable/9/etc/mtree/BSD.usr.dist stable/9/share/doc/Makefile Directory Properties: stable/9/contrib/llvm/ (props changed) stable/9/contrib/llvm/tools/clang/ (props changed) stable/9/etc/ (props changed) stable/9/share/doc/ (props changed) Copied: stable/9/contrib/llvm/LICENSE.TXT (from r225880, head/contrib/llvm/LICENSE.TXT) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/contrib/llvm/LICENSE.TXT Mon Oct 3 20:27:51 2011 (r225949, copy of r225880, head/contrib/llvm/LICENSE.TXT) @@ -0,0 +1,69 @@ +============================================================================== +LLVM Release License +============================================================================== +University of Illinois/NCSA +Open Source License + +Copyright (c) 2003-2011 University of Illinois at Urbana-Champaign. +All rights reserved. + +Developed by: + + LLVM Team + + University of Illinois at Urbana-Champaign + + http://llvm.org + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal with +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: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimers. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimers in the + documentation and/or other materials provided with the distribution. + + * Neither the names of the LLVM Team, University of Illinois at + Urbana-Champaign, nor the names of its contributors may be used to + endorse or promote products derived from this Software without specific + prior written permission. + +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 +CONTRIBUTORS 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 WITH THE +SOFTWARE. + +============================================================================== +Copyrights and Licenses for Third Party Software Distributed with LLVM: +============================================================================== +The LLVM software contains code written by third parties. Such software will +have its own individual LICENSE.TXT file in the directory in which it appears. +This file will describe the copyrights, license, and restrictions which apply +to that code. + +The disclaimer of warranty in the University of Illinois Open Source License +applies to all code in the LLVM Distribution, and nothing in any of the +other licenses gives permission to use the names of the LLVM Team or the +University of Illinois to endorse or promote products derived from this +Software. + +The following pieces of software have additional or alternate copyrights, +licenses, and/or restrictions: + +Program Directory +------- --------- +Autoconf llvm/autoconf + llvm/projects/ModuleMaker/autoconf + llvm/projects/sample/autoconf +CellSPU backend llvm/lib/Target/CellSPU/README.txt +Google Test llvm/utils/unittest/googletest +OpenBSD regex llvm/lib/Support/{reg*, COPYRIGHT.regex} Copied: stable/9/contrib/llvm/lib/Support/COPYRIGHT.regex (from r225880, head/contrib/llvm/lib/Support/COPYRIGHT.regex) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/contrib/llvm/lib/Support/COPYRIGHT.regex Mon Oct 3 20:27:51 2011 (r225949, copy of r225880, head/contrib/llvm/lib/Support/COPYRIGHT.regex) @@ -0,0 +1,54 @@ +$OpenBSD: COPYRIGHT,v 1.3 2003/06/02 20:18:36 millert Exp $ + +Copyright 1992, 1993, 1994 Henry Spencer. All rights reserved. +This software is not subject to any license of the American Telephone +and Telegraph Company or of the Regents of the University of California. + +Permission is granted to anyone to use this software for any purpose on +any computer system, and to alter it and redistribute it, subject +to the following restrictions: + +1. The author is not responsible for the consequences of use of this + software, no matter how awful, even if they arise from flaws in it. + +2. The origin of this software must not be misrepresented, either by + explicit claim or by omission. Since few users ever read sources, + credits must appear in the documentation. + +3. Altered versions must be plainly marked as such, and must not be + misrepresented as being the original software. Since few users + ever read sources, credits must appear in the documentation. + +4. This notice may not be removed or altered. + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +/*- + * Copyright (c) 1994 + * 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. 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. + * + * @(#)COPYRIGHT 8.1 (Berkeley) 3/16/94 + */ Copied: stable/9/contrib/llvm/tools/clang/LICENSE.TXT (from r225880, head/contrib/llvm/tools/clang/LICENSE.TXT) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/contrib/llvm/tools/clang/LICENSE.TXT Mon Oct 3 20:27:51 2011 (r225949, copy of r225880, head/contrib/llvm/tools/clang/LICENSE.TXT) @@ -0,0 +1,63 @@ +============================================================================== +LLVM Release License +============================================================================== +University of Illinois/NCSA +Open Source License + +Copyright (c) 2007-2011 University of Illinois at Urbana-Champaign. +All rights reserved. + +Developed by: + + LLVM Team + + University of Illinois at Urbana-Champaign + + http://llvm.org + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal with +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: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimers. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimers in the + documentation and/or other materials provided with the distribution. + + * Neither the names of the LLVM Team, University of Illinois at + Urbana-Champaign, nor the names of its contributors may be used to + endorse or promote products derived from this Software without specific + prior written permission. + +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 +CONTRIBUTORS 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 WITH THE +SOFTWARE. + +============================================================================== +The LLVM software contains code written by third parties. Such software will +have its own individual LICENSE.TXT file in the directory in which it appears. +This file will describe the copyrights, license, and restrictions which apply +to that code. + +The disclaimer of warranty in the University of Illinois Open Source License +applies to all code in the LLVM Distribution, and nothing in any of the +other licenses gives permission to use the names of the LLVM Team or the +University of Illinois to endorse or promote products derived from this +Software. + +The following pieces of software have additional or alternate copyrights, +licenses, and/or restrictions: + +Program Directory +------- --------- + + Modified: stable/9/etc/mtree/BSD.usr.dist ============================================================================== --- stable/9/etc/mtree/BSD.usr.dist Mon Oct 3 20:05:21 2011 (r225948) +++ stable/9/etc/mtree/BSD.usr.dist Mon Oct 3 20:27:51 2011 (r225949) @@ -93,6 +93,10 @@ intel_wpi .. .. + llvm + clang + .. + .. ncurses .. ntp Modified: stable/9/share/doc/Makefile ============================================================================== --- stable/9/share/doc/Makefile Mon Oct 3 20:05:21 2011 (r225948) +++ stable/9/share/doc/Makefile Mon Oct 3 20:27:51 2011 (r225949) @@ -3,12 +3,16 @@ .include -SUBDIR= ${_bind9} IPv6 legal ${_roffdocs} +SUBDIR= ${_bind9} IPv6 legal ${_llvm} ${_roffdocs} .if ${MK_BIND} != "no" _bind9= bind9 .endif +.if ${MK_CLANG} != "no" +_llvm= llvm +.endif + # FIXME this is not a real solution ... .if ${MK_GROFF} != "no" _roffdocs= papers psd smm usd From owner-svn-src-stable-9@FreeBSD.ORG Tue Oct 4 10:00:29 2011 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7319A1065675; Tue, 4 Oct 2011 10:00:29 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2D39C8FC20; Tue, 4 Oct 2011 10:00:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p94A0TSn052272; Tue, 4 Oct 2011 10:00:29 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p94A0T75052269; Tue, 4 Oct 2011 10:00:29 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201110041000.p94A0T75052269@svn.freebsd.org> From: Mikolaj Golub Date: Tue, 4 Oct 2011 10:00:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225962 - stable/9/usr.bin/script X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Oct 2011 10:00:29 -0000 Author: trociny Date: Tue Oct 4 10:00:28 2011 New Revision: 225962 URL: http://svn.freebsd.org/changeset/base/225962 Log: MFC r225809: When script(1) reads EOF from input it starts spinning on zero-byte reads eating 100% CPU. Fix this by skipping select on STDIN after reading EOF -- permanently if STDIN is not terminal and for one second if it is. Also after reading EOF from STDIN we have to pass it to the program being scripted. The previous approach was to write zero bytes into the pseudo-terminal. This does not work because zero-byte write does not have any effect on read. Fix this by sending VEOF instead. Submitted by: Ronald Klop Discussed with: kib, Chris Torek Approved by: re (kib) Modified: stable/9/usr.bin/script/script.1 stable/9/usr.bin/script/script.c Directory Properties: stable/9/usr.bin/script/ (props changed) Modified: stable/9/usr.bin/script/script.1 ============================================================================== --- stable/9/usr.bin/script/script.1 Tue Oct 4 09:55:15 2011 (r225961) +++ stable/9/usr.bin/script/script.1 Tue Oct 4 10:00:28 2011 (r225962) @@ -166,3 +166,12 @@ The slave terminal mode is checked for ECHO mode to check when to avoid manual echo logging. This does not work when in a raw mode where the program being run is doing manual echo. +.Pp +If the +.Nm +reads zero bytes from the terminal it switches to a mode when it probes read +only once a second until it gets some data. +This prevents the +.Nm +spinning on zero-byte reads, but might cause a 1-second delay in +processing of the user input. Modified: stable/9/usr.bin/script/script.c ============================================================================== --- stable/9/usr.bin/script/script.c Tue Oct 4 09:55:15 2011 (r225961) +++ stable/9/usr.bin/script/script.c Tue Oct 4 10:00:28 2011 (r225962) @@ -86,6 +86,7 @@ main(int argc, char *argv[]) char ibuf[BUFSIZ]; fd_set rfd; int flushtime = 30; + int readstdin; aflg = kflg = 0; while ((ch = getopt(argc, argv, "aqkt:")) != -1) @@ -155,19 +156,21 @@ main(int argc, char *argv[]) doshell(argv); close(slave); - if (flushtime > 0) - tvp = &tv; - else - tvp = NULL; - - start = time(0); - FD_ZERO(&rfd); + start = tvec = time(0); + readstdin = 1; for (;;) { + FD_ZERO(&rfd); FD_SET(master, &rfd); - FD_SET(STDIN_FILENO, &rfd); - if (flushtime > 0) { - tv.tv_sec = flushtime; + if (readstdin) + FD_SET(STDIN_FILENO, &rfd); + if ((!readstdin && ttyflg) || flushtime > 0) { + tv.tv_sec = !readstdin && ttyflg ? 1 : + flushtime - (tvec - start); tv.tv_usec = 0; + tvp = &tv; + readstdin = 1; + } else { + tvp = NULL; } n = select(master + 1, &rfd, 0, 0, tvp); if (n < 0 && errno != EINTR) @@ -176,8 +179,13 @@ main(int argc, char *argv[]) cc = read(STDIN_FILENO, ibuf, BUFSIZ); if (cc < 0) break; - if (cc == 0) - (void)write(master, ibuf, 0); + if (cc == 0) { + if (tcgetattr(master, &stt) == 0 && + (stt.c_lflag & ICANON) != 0) { + (void)write(master, &stt.c_cc[VEOF], 1); + } + readstdin = 0; + } if (cc > 0) { (void)write(master, ibuf, cc); if (kflg && tcgetattr(master, &stt) >= 0 && From owner-svn-src-stable-9@FreeBSD.ORG Tue Oct 4 10:02:14 2011 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 89223106566C; Tue, 4 Oct 2011 10:02:14 +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 60A608FC1F; Tue, 4 Oct 2011 10:02:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p94A2Ela052386; Tue, 4 Oct 2011 10:02:14 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p94A2Elo052384; Tue, 4 Oct 2011 10:02:14 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201110041002.p94A2Elo052384@svn.freebsd.org> From: Alexander Motin Date: Tue, 4 Oct 2011 10:02:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225963 - stable/9/sys/powerpc/powerpc X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Oct 2011 10:02:14 -0000 Author: mav Date: Tue Oct 4 10:02:14 2011 New Revision: 225963 URL: http://svn.freebsd.org/changeset/base/225963 Log: MFC 225953: Revert r225875, r225877: It is reported that on some chips (e.g. the 970MP) behavior of POW bit set simultaneously with modifying other bits is undefined and may cause hangs. The race should be handled in some other way, but for now just get back. Reported by: nwitehorn Approved by: re (kib) Modified: stable/9/sys/powerpc/powerpc/cpu.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/powerpc/powerpc/cpu.c ============================================================================== --- stable/9/sys/powerpc/powerpc/cpu.c Tue Oct 4 10:00:28 2011 (r225962) +++ stable/9/sys/powerpc/powerpc/cpu.c Tue Oct 4 10:02:14 2011 (r225963) @@ -65,7 +65,6 @@ #include #include #include -#include #include #include @@ -554,11 +553,6 @@ cpu_idle_60x(void) vers = mfpvr() >> 16; #ifdef AIM - mtmsr(msr & ~PSL_EE); - if (sched_runnable()) { - mtmsr(msr); - return; - } switch (vers) { case IBM970: case IBM970FX: @@ -589,11 +583,6 @@ cpu_idle_e500(void) msr = mfmsr(); #ifdef E500 - mtmsr(msr & ~PSL_EE); - if (sched_runnable()) { - mtmsr(msr); - return; - } /* Freescale E500 core RM section 6.4.1. */ __asm __volatile("msync; mtmsr %0; isync" :: "r" (msr | PSL_WE)); From owner-svn-src-stable-9@FreeBSD.ORG Tue Oct 4 11:02:49 2011 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 57F80106566C; Tue, 4 Oct 2011 11:02:49 +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 3E8798FC08; Tue, 4 Oct 2011 11:02:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p94B2nRw054516; Tue, 4 Oct 2011 11:02:49 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p94B2neP054513; Tue, 4 Oct 2011 11:02:49 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201110041102.p94B2neP054513@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Tue, 4 Oct 2011 11:02:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225965 - in stable/9/sys: modules/ipfw netinet/ipfw X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Oct 2011 11:02:49 -0000 Author: bz Date: Tue Oct 4 11:02:48 2011 New Revision: 225965 URL: http://svn.freebsd.org/changeset/base/225965 Log: MFC r225793: Unbreak no-ip and no-inet6 module builds with ipfw. For now continue to build the ip_fw_pfil.c hooks and ipfw even in case of no-ip under the assumption that the private L2 hook (which hopefully eventually will be a pfil hook as well) can still be useful. Allow building the module without inet as well. Approved by: re (kib) Modified: stable/9/sys/modules/ipfw/Makefile stable/9/sys/netinet/ipfw/ip_fw_pfil.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/modules/ipfw/Makefile ============================================================================== --- stable/9/sys/modules/ipfw/Makefile Tue Oct 4 10:08:02 2011 (r225964) +++ stable/9/sys/modules/ipfw/Makefile Tue Oct 4 11:02:48 2011 (r225965) @@ -8,7 +8,7 @@ KMOD= ipfw SRCS= ip_fw2.c ip_fw_pfil.c SRCS+= ip_fw_dynamic.c ip_fw_log.c SRCS+= ip_fw_sockopt.c ip_fw_table.c -SRCS+= opt_inet6.h opt_ipfw.h opt_ipsec.h +SRCS+= opt_inet.h opt_inet6.h opt_ipfw.h opt_ipsec.h CFLAGS+= -DIPFIREWALL CFLAGS+= -I${.CURDIR}/../../contrib/pf @@ -22,6 +22,10 @@ CFLAGS+= -I${.CURDIR}/../../contrib/pf # .if !defined(KERNBUILDDIR) +.if ${MK_INET_SUPPORT} != "no" +opt_inet.h: + echo "#define INET 1" > ${.TARGET} +.endif .if ${MK_INET6_SUPPORT} != "no" opt_inet6.h: echo "#define INET6 1" > ${.TARGET} Modified: stable/9/sys/netinet/ipfw/ip_fw_pfil.c ============================================================================== --- stable/9/sys/netinet/ipfw/ip_fw_pfil.c Tue Oct 4 10:08:02 2011 (r225964) +++ stable/9/sys/netinet/ipfw/ip_fw_pfil.c Tue Oct 4 11:02:48 2011 (r225965) @@ -31,11 +31,11 @@ __FBSDID("$FreeBSD$"); #if !defined(KLD_MODULE) #include "opt_ipdn.h" #include "opt_inet.h" +#include "opt_inet6.h" #ifndef INET #error IPFIREWALL requires INET. #endif /* INET */ #endif /* KLD_MODULE */ -#include "opt_inet6.h" #include #include @@ -154,7 +154,7 @@ again: /* next_hop may be set by ipfw_chk */ if (args.next_hop == NULL && args.next_hop6 == NULL) break; /* pass */ -#ifndef IPFIREWALL_FORWARD +#if !defined(IPFIREWALL_FORWARD) || (!defined(INET6) && !defined(INET)) ret = EACCES; #else { @@ -205,7 +205,7 @@ again: #endif m_tag_prepend(*m0, fwd_tag); } -#endif +#endif /* IPFIREWALL_FORWARD */ break; case IP_FW_DENY: From owner-svn-src-stable-9@FreeBSD.ORG Tue Oct 4 11:08:45 2011 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 29A2E106578A; Tue, 4 Oct 2011 11:08:45 +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 190738FC12; Tue, 4 Oct 2011 11:08:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p94B8iIP054781; Tue, 4 Oct 2011 11:08:44 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p94B8iuH054778; Tue, 4 Oct 2011 11:08:44 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201110041108.p94B8iuH054778@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 4 Oct 2011 11:08:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225967 - in stable/9: etc/mtree include X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Oct 2011 11:08:45 -0000 Author: kib Date: Tue Oct 4 11:08:44 2011 New Revision: 225967 URL: http://svn.freebsd.org/changeset/base/225967 Log: MFC r225790: Install ciss(4) ioctl header. PR: kern/109813 Approved by: re (bz) Modified: stable/9/etc/mtree/BSD.include.dist stable/9/include/Makefile Directory Properties: stable/9/etc/ (props changed) stable/9/include/ (props changed) Modified: stable/9/etc/mtree/BSD.include.dist ============================================================================== --- stable/9/etc/mtree/BSD.include.dist Tue Oct 4 11:08:31 2011 (r225966) +++ stable/9/etc/mtree/BSD.include.dist Tue Oct 4 11:08:44 2011 (r225967) @@ -96,6 +96,8 @@ .. bktr .. + ciss + .. firewire .. hwpmc Modified: stable/9/include/Makefile ============================================================================== --- stable/9/include/Makefile Tue Oct 4 11:08:31 2011 (r225966) +++ stable/9/include/Makefile Tue Oct 4 11:08:44 2011 (r225967) @@ -39,7 +39,7 @@ LDIRS= bsm cam geom net net80211 netatal sys vm LSUBDIRS= cam/ata cam/scsi \ - dev/acpica dev/an dev/bktr dev/firewire dev/hwpmc \ + dev/acpica dev/an dev/bktr dev/ciss dev/firewire dev/hwpmc \ dev/ic dev/iicbus ${_dev_ieee488} dev/io dev/lmc dev/mfi dev/ofw \ dev/pbio ${_dev_powermac_nvram} dev/ppbus dev/smbus \ dev/speaker dev/usb dev/utopia dev/vkbd dev/wi \ From owner-svn-src-stable-9@FreeBSD.ORG Tue Oct 4 11:35:18 2011 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D8716106566B; Tue, 4 Oct 2011 11:35:18 +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 C6F638FC08; Tue, 4 Oct 2011 11:35:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p94BZICF055777; Tue, 4 Oct 2011 11:35:18 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p94BZIBO055771; Tue, 4 Oct 2011 11:35:18 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201110041135.p94BZIBO055771@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Tue, 4 Oct 2011 11:35:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225970 - stable/9/sys/net X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Oct 2011 11:35:19 -0000 Author: bz Date: Tue Oct 4 11:35:18 2011 New Revision: 225970 URL: http://svn.freebsd.org/changeset/base/225970 Log: MFC r225837: Pass the fibnum where we need filtering of the message on the rtsock allowing routing daemons to filter routing updates on an rtsock per FIB. Adjust raw_input() and split it into wrapper and a new function taking an optional callback argument even though we only have one consumer [1] to keep the hackish flags local to rtsock.c. Submitted by: multiple (see PR) Suggested by: rwatson [1] Reviewed by: rwatson PR: kern/134931 Approved by: re (kib) Modified: stable/9/sys/net/raw_cb.h stable/9/sys/net/raw_usrreq.c stable/9/sys/net/route.c stable/9/sys/net/route.h stable/9/sys/net/rtsock.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/net/raw_cb.h ============================================================================== --- stable/9/sys/net/raw_cb.h Tue Oct 4 11:23:03 2011 (r225969) +++ stable/9/sys/net/raw_cb.h Tue Oct 4 11:35:18 2011 (r225970) @@ -70,9 +70,14 @@ pr_init_t raw_init; * Library routines for raw socket usrreq functions; will always be wrapped * so that protocol-specific functions can be handled. */ +typedef int (*raw_input_cb_fn)(struct mbuf *, struct sockproto *, + struct sockaddr *, struct rawcb *); + int raw_attach(struct socket *, int); void raw_detach(struct rawcb *); void raw_input(struct mbuf *, struct sockproto *, struct sockaddr *); +void raw_input_ext(struct mbuf *, struct sockproto *, struct sockaddr *, + raw_input_cb_fn); /* * Generic pr_usrreqs entries for raw socket protocols, usually wrapped so Modified: stable/9/sys/net/raw_usrreq.c ============================================================================== --- stable/9/sys/net/raw_usrreq.c Tue Oct 4 11:23:03 2011 (r225969) +++ stable/9/sys/net/raw_usrreq.c Tue Oct 4 11:35:18 2011 (r225970) @@ -71,6 +71,14 @@ raw_init(void) void raw_input(struct mbuf *m0, struct sockproto *proto, struct sockaddr *src) { + + return (raw_input_ext(m0, proto, src, NULL)); +} + +void +raw_input_ext(struct mbuf *m0, struct sockproto *proto, struct sockaddr *src, + raw_input_cb_fn cb) +{ struct rawcb *rp; struct mbuf *m = m0; struct socket *last; @@ -83,6 +91,8 @@ raw_input(struct mbuf *m0, struct sockpr if (rp->rcb_proto.sp_protocol && rp->rcb_proto.sp_protocol != proto->sp_protocol) continue; + if (cb != NULL && (*cb)(m, proto, src, rp) != 0) + continue; if (last) { struct mbuf *n; n = m_copy(m, 0, (int)M_COPYALL); Modified: stable/9/sys/net/route.c ============================================================================== --- stable/9/sys/net/route.c Tue Oct 4 11:23:03 2011 (r225969) +++ stable/9/sys/net/route.c Tue Oct 4 11:35:18 2011 (r225970) @@ -384,7 +384,7 @@ miss: */ bzero(&info, sizeof(info)); info.rti_info[RTAX_DST] = dst; - rt_missmsg(msgtype, &info, 0, err); + rt_missmsg_fib(msgtype, &info, 0, err, fibnum); } done: if (newrt) @@ -609,7 +609,7 @@ out: info.rti_info[RTAX_GATEWAY] = gateway; info.rti_info[RTAX_NETMASK] = netmask; info.rti_info[RTAX_AUTHOR] = src; - rt_missmsg(RTM_REDIRECT, &info, flags, error); + rt_missmsg_fib(RTM_REDIRECT, &info, flags, error, fibnum); if (ifa != NULL) ifa_free(ifa); } @@ -1522,7 +1522,7 @@ rtinit1(struct ifaddr *ifa, int cmd, int } RT_ADDREF(rt); RT_UNLOCK(rt); - rt_newaddrmsg(cmd, ifa, error, rt); + rt_newaddrmsg_fib(cmd, ifa, error, rt, fibnum); RT_LOCK(rt); RT_REMREF(rt); if (cmd == RTM_DELETE) { Modified: stable/9/sys/net/route.h ============================================================================== --- stable/9/sys/net/route.h Tue Oct 4 11:23:03 2011 (r225969) +++ stable/9/sys/net/route.h Tue Oct 4 11:35:18 2011 (r225970) @@ -369,7 +369,9 @@ void rt_ieee80211msg(struct ifnet *, in void rt_ifannouncemsg(struct ifnet *, int); void rt_ifmsg(struct ifnet *); void rt_missmsg(int, struct rt_addrinfo *, int, int); +void rt_missmsg_fib(int, struct rt_addrinfo *, int, int, int); void rt_newaddrmsg(int, struct ifaddr *, int, struct rtentry *); +void rt_newaddrmsg_fib(int, struct ifaddr *, int, struct rtentry *, int); void rt_newmaddrmsg(int, struct ifmultiaddr *); int rt_setgate(struct rtentry *, struct sockaddr *, struct sockaddr *); void rt_maskedcopy(struct sockaddr *, struct sockaddr *, struct sockaddr *); Modified: stable/9/sys/net/rtsock.c ============================================================================== --- stable/9/sys/net/rtsock.c Tue Oct 4 11:23:03 2011 (r225969) +++ stable/9/sys/net/rtsock.c Tue Oct 4 11:35:18 2011 (r225970) @@ -122,6 +122,13 @@ MALLOC_DEFINE(M_RTABLE, "routetbl", "rou static struct sockaddr route_src = { 2, PF_ROUTE, }; static struct sockaddr sa_zero = { sizeof(sa_zero), AF_INET, }; +/* + * Used by rtsock/raw_input callback code to decide whether to filter the update + * notification to a socket bound to a particular FIB. + */ +#define RTS_FILTER_FIB M_PROTO8 +#define RTS_ALLFIBS -1 + static struct { int ip_count; /* attached w/ AF_INET */ int ip6_count; /* attached w/ AF_INET6 */ @@ -196,6 +203,31 @@ rts_init(void) } SYSINIT(rtsock, SI_SUB_PROTO_DOMAIN, SI_ORDER_THIRD, rts_init, 0); +static int +raw_input_rts_cb(struct mbuf *m, struct sockproto *proto, struct sockaddr *src, + struct rawcb *rp) +{ + int fibnum; + + KASSERT(m != NULL, ("%s: m is NULL", __func__)); + KASSERT(proto != NULL, ("%s: proto is NULL", __func__)); + KASSERT(rp != NULL, ("%s: rp is NULL", __func__)); + + /* No filtering requested. */ + if ((m->m_flags & RTS_FILTER_FIB) == 0) + return (0); + + /* Check if it is a rts and the fib matches the one of the socket. */ + fibnum = M_GETFIB(m); + if (proto->sp_family != PF_ROUTE || + rp->rcb_socket == NULL || + rp->rcb_socket->so_fibnum == fibnum) + return (0); + + /* Filtering requested and no match, the socket shall be skipped. */ + return (1); +} + static void rts_input(struct mbuf *m) { @@ -212,7 +244,7 @@ rts_input(struct mbuf *m) } else route_proto.sp_protocol = 0; - raw_input(m, &route_proto, &route_src); + raw_input_ext(m, &route_proto, &route_src, raw_input_rts_cb); } /* @@ -885,6 +917,8 @@ flush: m_adj(m, rtm->rtm_msglen - m->m_pkthdr.len); } if (m) { + M_SETFIB(m, so->so_fibnum); + m->m_flags |= RTS_FILTER_FIB; if (rp) { /* * XXX insure we don't get a copy by @@ -1127,7 +1161,8 @@ again: * destination. */ void -rt_missmsg(int type, struct rt_addrinfo *rtinfo, int flags, int error) +rt_missmsg_fib(int type, struct rt_addrinfo *rtinfo, int flags, int error, + int fibnum) { struct rt_msghdr *rtm; struct mbuf *m; @@ -1138,6 +1173,14 @@ rt_missmsg(int type, struct rt_addrinfo m = rt_msg1(type, rtinfo); if (m == NULL) return; + + if (fibnum != RTS_ALLFIBS) { + KASSERT(fibnum >= 0 && fibnum < rt_numfibs, ("%s: fibnum out " + "of range 0 <= %d < %d", __func__, fibnum, rt_numfibs)); + M_SETFIB(m, fibnum); + m->m_flags |= RTS_FILTER_FIB; + } + rtm = mtod(m, struct rt_msghdr *); rtm->rtm_flags = RTF_DONE | flags; rtm->rtm_errno = error; @@ -1145,6 +1188,13 @@ rt_missmsg(int type, struct rt_addrinfo rt_dispatch(m, sa); } +void +rt_missmsg(int type, struct rt_addrinfo *rtinfo, int flags, int error) +{ + + rt_missmsg_fib(type, rtinfo, flags, error, RTS_ALLFIBS); +} + /* * This routine is called to generate a message from the routing * socket indicating that the status of a network interface has changed. @@ -1179,7 +1229,8 @@ rt_ifmsg(struct ifnet *ifp) * copies of it. */ void -rt_newaddrmsg(int cmd, struct ifaddr *ifa, int error, struct rtentry *rt) +rt_newaddrmsg_fib(int cmd, struct ifaddr *ifa, int error, struct rtentry *rt, + int fibnum) { struct rt_addrinfo info; struct sockaddr *sa = NULL; @@ -1237,10 +1288,24 @@ rt_newaddrmsg(int cmd, struct ifaddr *if rtm->rtm_errno = error; rtm->rtm_addrs = info.rti_addrs; } + if (fibnum != RTS_ALLFIBS) { + KASSERT(fibnum >= 0 && fibnum < rt_numfibs, ("%s: " + "fibnum out of range 0 <= %d < %d", __func__, + fibnum, rt_numfibs)); + M_SETFIB(m, fibnum); + m->m_flags |= RTS_FILTER_FIB; + } rt_dispatch(m, sa); } } +void +rt_newaddrmsg(int cmd, struct ifaddr *ifa, int error, struct rtentry *rt) +{ + + rt_newaddrmsg_fib(cmd, ifa, error, rt, RTS_ALLFIBS); +} + /* * This is the analogue to the rt_newaddrmsg which performs the same * function but for multicast group memberhips. This is easier since From owner-svn-src-stable-9@FreeBSD.ORG Tue Oct 4 11:54:57 2011 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 754AA106566B; Tue, 4 Oct 2011 11:54:57 +0000 (UTC) (envelope-from melifaro@yandex-team.ru) Received: from forward6.mail.yandex.net (forward6.mail.yandex.net [IPv6:2a02:6b8:0:202::1]) by mx1.freebsd.org (Postfix) with ESMTP id D1E978FC0C; Tue, 4 Oct 2011 11:54:53 +0000 (UTC) Received: from smtpcorp2.mail.yandex.net (smtpcorp2.mail.yandex.net [77.88.61.36]) by forward6.mail.yandex.net (Yandex) with ESMTP id F2A3CF82AF7; Tue, 4 Oct 2011 15:54:51 +0400 (MSD) Received: from smtpcorp2.mail.yandex.net (localhost [127.0.0.1]) by smtpcorp2.mail.yandex.net (Yandex) with ESMTP id DF1BD740110; Tue, 4 Oct 2011 15:54:51 +0400 (MSD) Received: from dhcp170-36-red.yandex.net (dhcp170-36-red.yandex.net [95.108.170.36]) by smtpcorp2.mail.yandex.net (nwsmtp/Yandex) with ESMTP id spLCWQo9; Tue, 4 Oct 2011 15:54:51 +0400 Message-ID: <4E8AF3AC.8050001@yandex-team.ru> Date: Tue, 04 Oct 2011 15:53:16 +0400 From: "Alexander V. Chernikov" User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.1.16) Gecko/20110120 Thunderbird/3.0.11 MIME-Version: 1.0 To: "Bjoern A. Zeeb" References: <201110041135.p94BZIBO055771@svn.freebsd.org> In-Reply-To: <201110041135.p94BZIBO055771@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Mailman-Approved-At: Tue, 04 Oct 2011 12:24:43 +0000 Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-9@freebsd.org Subject: Re: svn commit: r225970 - stable/9/sys/net X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Oct 2011 11:54:57 -0000 On 04.10.2011 15:35, Bjoern A. Zeeb wrote: > Author: bz > Date: Tue Oct 4 11:35:18 2011 > New Revision: 225970 > URL: http://svn.freebsd.org/changeset/base/225970 > > Log: > MFC r225837: Thanks for merging this very very long-awaited fix! From owner-svn-src-stable-9@FreeBSD.ORG Tue Oct 4 12:45:24 2011 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E402E106566C; Tue, 4 Oct 2011 12:45:24 +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 D337F8FC1A; Tue, 4 Oct 2011 12:45:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p94CjOdR057980; Tue, 4 Oct 2011 12:45:24 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p94CjOZM057978; Tue, 4 Oct 2011 12:45:24 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201110041245.p94CjOZM057978@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Tue, 4 Oct 2011 12:45:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225971 - stable/9/sys/netinet6 X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Oct 2011 12:45:25 -0000 Author: bz Date: Tue Oct 4 12:45:24 2011 New Revision: 225971 URL: http://svn.freebsd.org/changeset/base/225971 Log: MFC r225885: Fix an obvious bug from r186196 shadowing a variable, not correctly appending the new mbuf to the chain reference but possibly causing an mbuf nextpkt loop leading to a memory used after handoff (or having been freed) and leaking an mbuf here. Reviewed by: rwatson, brooks Approved by: re (kib) Modified: stable/9/sys/netinet6/nd6.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/netinet6/nd6.c ============================================================================== --- stable/9/sys/netinet6/nd6.c Tue Oct 4 11:35:18 2011 (r225970) +++ stable/9/sys/netinet6/nd6.c Tue Oct 4 12:45:24 2011 (r225971) @@ -2042,14 +2042,15 @@ nd6_output_lle(struct ifnet *ifp, struct if (*chain == NULL) *chain = m; else { - struct mbuf *m = *chain; + struct mbuf *mb; /* * append mbuf to end of deferred chain */ - while (m->m_nextpkt != NULL) - m = m->m_nextpkt; - m->m_nextpkt = m; + mb = *chain; + while (mb->m_nextpkt != NULL) + mb = mb->m_nextpkt; + mb->m_nextpkt = m; } return (error); } From owner-svn-src-stable-9@FreeBSD.ORG Tue Oct 4 15:06:12 2011 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 00C92106566B; Tue, 4 Oct 2011 15:06:12 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CA7088FC12; Tue, 4 Oct 2011 15:06:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p94F6BOg063041; Tue, 4 Oct 2011 15:06:11 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p94F6BOd063039; Tue, 4 Oct 2011 15:06:11 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201110041506.p94F6BOd063039@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Tue, 4 Oct 2011 15:06:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225983 - stable/9/crypto/openssh X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Oct 2011 15:06:12 -0000 Author: des Date: Tue Oct 4 15:06:11 2011 New Revision: 225983 URL: http://svn.freebsd.org/changeset/base/225983 Log: MFH r225852: regenerate after hpn patch Approved by: re (kib) Modified: stable/9/crypto/openssh/ssh_namespace.h Directory Properties: stable/9/crypto/openssh/ (props changed) Modified: stable/9/crypto/openssh/ssh_namespace.h ============================================================================== --- stable/9/crypto/openssh/ssh_namespace.h Tue Oct 4 15:00:54 2011 (r225982) +++ stable/9/crypto/openssh/ssh_namespace.h Tue Oct 4 15:06:11 2011 (r225983) @@ -7,7 +7,7 @@ * * A list of symbols which need munging is obtained as follows: * - * nm libssh.a | awk '/[0-9a-z] [A-Z] / && $3 !~ /^ssh_/ { print "#define" $3 "\t\tssh_" $3 }' + * nm libssh.a | awk '/[0-9a-z] [A-Z] / && $3 !~ /^ssh_/ { print "#define " $3 "\t\tssh_" $3 }' * * $FreeBSD$ */ @@ -58,6 +58,7 @@ #define buffer_get_int64 ssh_buffer_get_int64 #define buffer_get_int64_ret ssh_buffer_get_int64_ret #define buffer_get_int_ret ssh_buffer_get_int_ret +#define buffer_get_max_len ssh_buffer_get_max_len #define buffer_get_ret ssh_buffer_get_ret #define buffer_get_short ssh_buffer_get_short #define buffer_get_short_ret ssh_buffer_get_short_ret @@ -139,6 +140,7 @@ #define channel_send_window_changes ssh_channel_send_window_changes #define channel_set_af ssh_channel_set_af #define channel_set_fds ssh_channel_set_fds +#define channel_set_hpn ssh_channel_set_hpn #define channel_setup_local_fwd_listener ssh_channel_setup_local_fwd_listener #define channel_setup_remote_fwd_listener ssh_channel_setup_remote_fwd_listener #define channel_still_open ssh_channel_still_open @@ -438,6 +440,7 @@ #define set_nonblock ssh_set_nonblock #define shadow_pw ssh_shadow_pw #define sigdie ssh_sigdie +#define sock_get_rcvbuf ssh_sock_get_rcvbuf #define sock_set_v6only ssh_sock_set_v6only #define ssh1_3des_iv ssh_ssh1_3des_iv #define start_progress_meter ssh_start_progress_meter From owner-svn-src-stable-9@FreeBSD.ORG Tue Oct 4 17:26:41 2011 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 691811065673; Tue, 4 Oct 2011 17:26:41 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3E7398FC0C; Tue, 4 Oct 2011 17:26:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p94HQfc4071880; Tue, 4 Oct 2011 17:26:41 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p94HQflE071877; Tue, 4 Oct 2011 17:26:41 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201110041726.p94HQflE071877@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Tue, 4 Oct 2011 17:26:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r226015 - stable/9/lib/libfetch X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Oct 2011 17:26:41 -0000 Author: des Date: Tue Oct 4 17:26:40 2011 New Revision: 226015 URL: http://svn.freebsd.org/changeset/base/226015 Log: MFH r225810 r225812: make passive mode the default. Approved by: re (kib) Modified: stable/9/lib/libfetch/fetch.3 stable/9/lib/libfetch/ftp.c Directory Properties: stable/9/lib/libfetch/ (props changed) Modified: stable/9/lib/libfetch/fetch.3 ============================================================================== --- stable/9/lib/libfetch/fetch.3 Tue Oct 4 17:14:59 2011 (r226014) +++ stable/9/lib/libfetch/fetch.3 Tue Oct 4 17:26:40 2011 (r226015) @@ -318,9 +318,19 @@ and implement the FTP protocol as described in RFC959. .Pp If the +.Ql P +(not passive) flag is specified, an active (rather than passive) +connection will be attempted. +.Pp +The .Ql p -(passive) flag is specified, a passive (rather than active) connection -will be attempted. +flag is supported for compatibility with earlier versions where active +connections were the default. +It has precedence over the +.Ql P +flag, so if both are specified, +.Nm +will use a passive connection. .Pp If the .Ql l @@ -475,9 +485,11 @@ connections will be bound. .It Ev FTP_LOGIN Default FTP login if none was provided in the URL. .It Ev FTP_PASSIVE_MODE -If set to anything but +If set to .Ql no , -forces the FTP code to use passive mode. +forces the FTP code to use active mode. +If set to any other value, forces passive mode even if the application +requested active mode. .It Ev FTP_PASSWORD Default FTP password if the remote server requests one and none was provided in the URL. Modified: stable/9/lib/libfetch/ftp.c ============================================================================== --- stable/9/lib/libfetch/ftp.c Tue Oct 4 17:14:59 2011 (r226014) +++ stable/9/lib/libfetch/ftp.c Tue Oct 4 17:26:40 2011 (r226015) @@ -633,13 +633,12 @@ ftp_transfer(conn_t *conn, const char *o /* check flags */ low = CHECK_FLAG('l'); - pasv = CHECK_FLAG('p'); + pasv = CHECK_FLAG('p') || !CHECK_FLAG('P'); verbose = CHECK_FLAG('v'); /* passive mode */ - if (!pasv) - pasv = ((s = getenv("FTP_PASSIVE_MODE")) != NULL && - strncasecmp(s, "no", 2) != 0); + if ((s = getenv("FTP_PASSIVE_MODE")) != NULL) + pasv = (strncasecmp(s, "no", 2) != 0); /* isolate filename */ filename = ftp_filename(file, &filenamelen, &type); From owner-svn-src-stable-9@FreeBSD.ORG Tue Oct 4 17:27:11 2011 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 055E1106564A; Tue, 4 Oct 2011 17:27:11 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CEE708FC18; Tue, 4 Oct 2011 17:27:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p94HRAm4071935; Tue, 4 Oct 2011 17:27:10 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p94HRAZO071932; Tue, 4 Oct 2011 17:27:10 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201110041727.p94HRAZO071932@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Tue, 4 Oct 2011 17:27:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r226016 - stable/9/usr.bin/fetch X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Oct 2011 17:27:11 -0000 Author: des Date: Tue Oct 4 17:27:10 2011 New Revision: 226016 URL: http://svn.freebsd.org/changeset/base/226016 Log: MFH r225815: document that passive mode is the default MFH r225982: convert to UTF-8 Approved by: re (kib) Modified: stable/9/usr.bin/fetch/fetch.1 stable/9/usr.bin/fetch/fetch.c Directory Properties: stable/9/usr.bin/fetch/ (props changed) Modified: stable/9/usr.bin/fetch/fetch.1 ============================================================================== --- stable/9/usr.bin/fetch/fetch.1 Tue Oct 4 17:26:40 2011 (r226015) +++ stable/9/usr.bin/fetch/fetch.1 Tue Oct 4 17:27:10 2011 (r226016) @@ -1,5 +1,5 @@ .\"- -.\" Copyright (c) 2000-2004 Dag-Erling Coïdan Smørgrav +.\" Copyright (c) 2000-2011 Dag-Erling Smørgrav .\" All rights reserved. .\" Portions Copyright (c) 1999 Massachusetts Institute of Technology; used .\" by permission. @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 14, 2008 +.Dd September 27, 2011 .Dt FETCH 1 .Os .Sh NAME @@ -165,11 +165,13 @@ directory, with name(s) selected as in t .It Fl P .It Fl p Use passive FTP. -This is useful if you are behind a firewall which blocks incoming -connections. -Try this flag if -.Nm -seems to hang when retrieving FTP URLs. +These flags have no effect, since passive FTP is the default, but are +provided for compatibility with earlier versions where active FTP was +the default. +To force active mode, set the +.Ev FTP_PASSIVE_MODE +environment variable to +.Ql NO . .It Fl q Quiet mode. .It Fl R Modified: stable/9/usr.bin/fetch/fetch.c ============================================================================== --- stable/9/usr.bin/fetch/fetch.c Tue Oct 4 17:26:40 2011 (r226015) +++ stable/9/usr.bin/fetch/fetch.c Tue Oct 4 17:27:10 2011 (r226016) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2000-2004 Dag-Erling Coïdan Smørgrav + * Copyright (c) 2000-2011 Dag-Erling Smørgrav * All rights reserved. * * Redistribution and use in source and binary forms, with or without From owner-svn-src-stable-9@FreeBSD.ORG Tue Oct 4 19:07:40 2011 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0B011106568D; Tue, 4 Oct 2011 19:07:40 +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 D1F9F8FC14; Tue, 4 Oct 2011 19:07:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p94J7d8V075305; Tue, 4 Oct 2011 19:07:39 GMT (envelope-from cperciva@svn.freebsd.org) Received: (from cperciva@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p94J7dHA075303; Tue, 4 Oct 2011 19:07:39 GMT (envelope-from cperciva@svn.freebsd.org) Message-Id: <201110041907.p94J7dHA075303@svn.freebsd.org> From: Colin Percival Date: Tue, 4 Oct 2011 19:07:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r226023 - head/sys/compat/linux releng/7.3 releng/7.3/sys/compat/linux releng/7.3/sys/conf releng/7.4 releng/7.4/sys/compat/linux releng/7.4/sys/conf releng/8.1 releng/8.1/sys/compat/li... X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Oct 2011 19:07:40 -0000 Author: cperciva Date: Tue Oct 4 19:07:38 2011 New Revision: 226023 URL: http://svn.freebsd.org/changeset/base/226023 Log: Fix a bug in UNIX socket handling in the linux emulator which was exposed by the security fix in FreeBSD-SA-11:05.unix. Approved by: so (cperciva) Approved by: re (kib) Security: Related to FreeBSD-SA-11:05.unix, but not actually a security fix. Modified: stable/9/sys/compat/linux/linux_socket.c Changes in other areas also in this revision: Modified: head/sys/compat/linux/linux_socket.c releng/7.3/UPDATING releng/7.3/sys/compat/linux/linux_socket.c releng/7.3/sys/conf/newvers.sh releng/7.4/UPDATING releng/7.4/sys/compat/linux/linux_socket.c releng/7.4/sys/conf/newvers.sh releng/8.1/UPDATING releng/8.1/sys/compat/linux/linux_socket.c releng/8.1/sys/conf/newvers.sh releng/8.2/UPDATING releng/8.2/sys/compat/linux/linux_socket.c releng/8.2/sys/conf/newvers.sh stable/7/sys/compat/linux/linux_socket.c stable/8/sys/compat/linux/linux_socket.c Modified: stable/9/sys/compat/linux/linux_socket.c ============================================================================== --- stable/9/sys/compat/linux/linux_socket.c Tue Oct 4 18:45:29 2011 (r226022) +++ stable/9/sys/compat/linux/linux_socket.c Tue Oct 4 19:07:38 2011 (r226023) @@ -104,6 +104,7 @@ do_sa_get(struct sockaddr **sap, const s int oldv6size; struct sockaddr_in6 *sin6; #endif + int namelen; if (*osalen < 2 || *osalen > UCHAR_MAX || !osa) return (EINVAL); @@ -166,6 +167,20 @@ do_sa_get(struct sockaddr **sap, const s } } + if ((bdom == AF_LOCAL) && (*osalen > sizeof(struct sockaddr_un))) { + for (namelen = 0; + namelen < *osalen - offsetof(struct sockaddr_un, sun_path); + namelen++) + if (!((struct sockaddr_un *)kosa)->sun_path[namelen]) + break; + if (namelen + offsetof(struct sockaddr_un, sun_path) > + sizeof(struct sockaddr_un)) { + error = EINVAL; + goto out; + } + alloclen = sizeof(struct sockaddr_un); + } + sa = (struct sockaddr *) kosa; sa->sa_family = bdom; sa->sa_len = alloclen; From owner-svn-src-stable-9@FreeBSD.ORG Wed Oct 5 15:50:05 2011 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CC70E106566B; Wed, 5 Oct 2011 15:50:05 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B71BA8FC08; Wed, 5 Oct 2011 15:50:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p95Fo5ol018419; Wed, 5 Oct 2011 15:50:05 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p95Fo5N1018417; Wed, 5 Oct 2011 15:50:05 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201110051550.p95Fo5N1018417@svn.freebsd.org> From: Jung-uk Kim Date: Wed, 5 Oct 2011 15:50:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r226036 - stable/9/include X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Oct 2011 15:50:06 -0000 Author: jkim Date: Wed Oct 5 15:50:05 2011 New Revision: 226036 URL: http://svn.freebsd.org/changeset/base/226036 Log: MFC: r226035 Avoid accidental conflicts with C++ operator keywords. Approved by: re (kib) Modified: stable/9/include/iso646.h Directory Properties: stable/9/include/ (props changed) Modified: stable/9/include/iso646.h ============================================================================== --- stable/9/include/iso646.h Wed Oct 5 09:56:43 2011 (r226035) +++ stable/9/include/iso646.h Wed Oct 5 15:50:05 2011 (r226036) @@ -29,6 +29,8 @@ #ifndef _ISO646_H_ #define _ISO646_H_ +#ifndef __cplusplus + #define and && #define and_eq &= #define bitand & @@ -41,4 +43,6 @@ #define xor ^ #define xor_eq ^= +#endif /* !__cplusplus */ + #endif /* !_ISO646_H_ */ From owner-svn-src-stable-9@FreeBSD.ORG Wed Oct 5 15:54:40 2011 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from [127.0.0.1] (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by hub.freebsd.org (Postfix) with ESMTP id 86EF7106564A; Wed, 5 Oct 2011 15:54:39 +0000 (UTC) (envelope-from jkim@FreeBSD.org) From: Jung-uk Kim To: src-committers@FreeBSD.org Date: Wed, 5 Oct 2011 11:54:26 -0400 User-Agent: KMail/1.6.2 References: <201110051550.p95Fo5N1018417@svn.freebsd.org> In-Reply-To: <201110051550.p95Fo5N1018417@svn.freebsd.org> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201110051154.28931.jkim@FreeBSD.org> Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, svn-src-stable-9@freebsd.org Subject: Re: svn commit: r226036 - stable/9/include X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Oct 2011 15:54:40 -0000 On Wednesday 05 October 2011 11:50 am, Jung-uk Kim wrote: > Author: jkim > Date: Wed Oct 5 15:50:05 2011 > New Revision: 226036 > URL: http://svn.freebsd.org/changeset/base/226036 > > Log: > MFC: r226035 ^^^^^^^ r225801 > > Avoid accidental conflicts with C++ operator keywords. > > Approved by: re (kib) Sorry for the copy-and-pasto. Jung-uk Kim From owner-svn-src-stable-9@FreeBSD.ORG Wed Oct 5 19:58:00 2011 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4AD8B1065670; Wed, 5 Oct 2011 19:58:00 +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 39BF18FC12; Wed, 5 Oct 2011 19:58:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p95Jw0DN026506; Wed, 5 Oct 2011 19:58:00 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p95Jw0lb026504; Wed, 5 Oct 2011 19:58:00 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201110051958.p95Jw0lb026504@svn.freebsd.org> From: Martin Matuska Date: Wed, 5 Oct 2011 19:58:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r226044 - stable/9/cddl/contrib/opensolaris/lib/libzfs/common X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Oct 2011 19:58:00 -0000 Author: mm Date: Wed Oct 5 19:57:59 2011 New Revision: 226044 URL: http://svn.freebsd.org/changeset/base/226044 Log: MFC r225828: Remove assertion that prevents zfs rename of datasets with mountpoint=none or mountpoint=legacy that have children datasets. This also fixes dataset rename when receiving incremental snapshots as reported on freebsd-fs@ This assertion was made triggerable by opensolaris change #10196. PR: bin/160400 Reviewed by: pjd Approved by: re (kib) Modified: stable/9/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_changelist.c Directory Properties: stable/9/cddl/contrib/opensolaris/ (props changed) Modified: stable/9/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_changelist.c ============================================================================== --- stable/9/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_changelist.c Wed Oct 5 17:29:49 2011 (r226043) +++ stable/9/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_changelist.c Wed Oct 5 19:57:59 2011 (r226044) @@ -467,7 +467,6 @@ change_one(zfs_handle_t *zhp, void *data * This is necessary when the original mountpoint * is legacy or none. */ - ASSERT(!clp->cl_alldependents); verify(uu_list_insert_before(clp->cl_list, uu_list_first(clp->cl_list), cn) == 0); } From owner-svn-src-stable-9@FreeBSD.ORG Thu Oct 6 14:33:33 2011 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 51A541065679; Thu, 6 Oct 2011 14:33: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 413398FC0C; Thu, 6 Oct 2011 14:33:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p96EXX51064731; Thu, 6 Oct 2011 14:33:33 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p96EXXgc064729; Thu, 6 Oct 2011 14:33:33 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201110061433.p96EXXgc064729@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Thu, 6 Oct 2011 14:33:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r226061 - stable/9/sys/dev/puc X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Oct 2011 14:33:33 -0000 Author: ae Date: Thu Oct 6 14:33:32 2011 New Revision: 226061 URL: http://svn.freebsd.org/changeset/base/226061 Log: MFC r225878: Add Oxford Semiconductor OXPCIe952 (0x1c38) 1 port serial card. PR: kern/160895 Submitted by: Konstantin V. Krotov Approved by: re (kib) Modified: stable/9/sys/dev/puc/pucdata.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/dev/puc/pucdata.c ============================================================================== --- stable/9/sys/dev/puc/pucdata.c Thu Oct 6 14:29:38 2011 (r226060) +++ stable/9/sys/dev/puc/pucdata.c Thu Oct 6 14:33:32 2011 (r226061) @@ -733,6 +733,13 @@ const struct puc_cfg puc_pci_devices[] = * */ + { 0x1415, 0xc138, 0xffff, 0, + "Oxford Semiconductor OXPCIe952 UARTs", + DEFAULT_RCLK * 0x22, + PUC_PORT_NONSTANDARD, 0x10, 0, -1, + .config_function = puc_config_oxford_pcie + }, + { 0x1415, 0xc158, 0xffff, 0, "Oxford Semiconductor OXPCIe952 UARTs", DEFAULT_RCLK * 0x22, From owner-svn-src-stable-9@FreeBSD.ORG Thu Oct 6 19:15:51 2011 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E9603106566C; Thu, 6 Oct 2011 19:15:51 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D49EB8FC12; Thu, 6 Oct 2011 19:15:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p96JFpAX074081; Thu, 6 Oct 2011 19:15:51 GMT (envelope-from ken@svn.freebsd.org) Received: (from ken@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p96JFpBW074072; Thu, 6 Oct 2011 19:15:51 GMT (envelope-from ken@svn.freebsd.org) Message-Id: <201110061915.p96JFpBW074072@svn.freebsd.org> From: "Kenneth D. Merry" Date: Thu, 6 Oct 2011 19:15:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r226067 - in stable/9: sbin/camcontrol share/examples/scsi_target share/misc sys/cam sys/cam/scsi sys/dev/ciss sys/dev/firewire sys/dev/iir sys/dev/iscsi/initiator sys/dev/isp sys/dev/m... X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Oct 2011 19:15:52 -0000 Author: ken Date: Thu Oct 6 19:15:51 2011 New Revision: 226067 URL: http://svn.freebsd.org/changeset/base/226067 Log: MFC r225950: Add descriptor sense support to CAM, and honor sense residuals properly in CAM. Desriptor sense is a new sense data format that originated in SPC-3. Among other things, it allows for an 8-byte info field, which is necessary to pass back block numbers larger than 4 bytes. This change adds a number of new functions to scsi_all.c (and therefore libcam) that abstract out most access to sense data. This includes a bump of CAM_VERSION, because the CCB ABI has changed. Userland programs that use the CAM pass(4) driver will need to be recompiled. camcontrol.c: Change uses of scsi_extract_sense() to use scsi_extract_sense_len(). Use scsi_get_sks() instead of accessing sense key specific data directly. scsi_modes: Update the control mode page to the latest version (SPC-4). scsi_cmds.c, scsi_target.c: Change references to struct scsi_sense_data to struct scsi_sense_data_fixed. This should be changed to allow the user to specify fixed or descriptor sense, and then use scsi_set_sense_data() to build the sense data. ps3cdrom.c: Use scsi_set_sense_data() instead of setting sense data manually. cam_periph.c: Use scsi_extract_sense_len() instead of using scsi_extract_sense() or accessing sense data directly. cam_ccb.h: Bump the CAM_VERSION from 0x15 to 0x16. The change of struct scsi_sense_data from 32 to 252 bytes changes the size of struct ccb_scsiio, but not the size of union ccb. So the version must be bumped to prevent structure mis-matches. scsi_all.h: Lots of updated SCSI sense data and other structures. Add function prototypes for the new sense data functions. Take out the inline implementation of scsi_extract_sense(). It is now too large to put in a header file. Add macros to calculate whether fields are present and filled in fixed and descriptor sense data scsi_all.c: In scsi_op_desc(), allow the user to pass in NULL inquiry data, and we'll assume a direct access device in that case. Changed the SCSI RESERVED sense key name and description to COMPLETED, as it is now defined in the spec. Change the error recovery action for a number of read errors to prevent lots of retries when the drive has said that the block isn't accessible. This speeds up reconstruction of the block by any RAID software running on top of the drive (e.g. ZFS). In scsi_sense_desc(), allow for invalid sense key numbers. This allows calling this routine without checking the input values first. Change scsi_error_action() to use scsi_extract_sense_len(), and handle things when invalid asc/ascq values are encountered. Add a new routine, scsi_desc_iterate(), that will call the supplied function for every descriptor in descriptor format sense data. Add scsi_set_sense_data(), and scsi_set_sense_data_va(), which build descriptor and fixed format sense data. They currently default to fixed format sense data. Add a number of scsi_get_*() functions, which get different types of sense data fields from either fixed or descriptor format sense data, if the data is present. Add a number of scsi_*_sbuf() functions, which print formatted versions of various sense data fields. These functions work for either fixed or descriptor sense. Add a number of scsi_sense_*_sbuf() functions, which have a standard calling interface and print the indicated field. These functions take descriptors only. Add scsi_sense_desc_sbuf(), which will print a formatted version of the given sense descriptor. Pull out a majority of the scsi_sense_sbuf() function and put it into scsi_sense_only_sbuf(). This allows callers that don't use struct ccb_scsiio to easily utilize the printing routines. Revamp that function to handle descriptor sense and use the new sense fetching and printing routines. Move scsi_extract_sense() into scsi_all.c, and implement it in terms of the new function, scsi_extract_sense_len(). The _len() version takes a length (which should be the sense length - residual) and can indicate which fields are present and valid in the sense data. Add a couple of new scsi_get_*() routines to get the sense key, asc, and ascq only. mly.c: Rename struct scsi_sense_data to struct scsi_sense_data_fixed. sbp_targ.c: Use the new sense fetching routines to get sense data instead of accessing it directly. sbp.c: Change the firewire/SCSI sense data transformation code to use struct scsi_sense_data_fixed instead of struct scsi_sense_data. This should be changed later to use scsi_set_sense_data(). ciss.c: Calculate the sense residual properly. Use scsi_get_sense_key() to fetch the sense key. mps_sas.c, mpt_cam.c: Set the sense residual properly. iir.c: Use scsi_set_sense_data() instead of building sense data by hand. iscsi_subr.c: Use scsi_extract_sense_len() instead of grabbing sense data directly. umass.c: Use scsi_set_sense_data() to build sense data. Grab the sense key using scsi_get_sense_key(). Calculate the sense residual properly. isp_freebsd.h: Use scsi_get_*() routines to grab asc, ascq, and sense key values. Calculate and set the sense residual. Approved by: re (kib) Sponsored by: Spectra Logic Corporation Modified: stable/9/sbin/camcontrol/camcontrol.c stable/9/share/examples/scsi_target/scsi_cmds.c stable/9/share/examples/scsi_target/scsi_target.c stable/9/share/misc/scsi_modes stable/9/sys/cam/cam_ccb.h stable/9/sys/cam/cam_periph.c stable/9/sys/cam/scsi/scsi_all.c stable/9/sys/cam/scsi/scsi_all.h stable/9/sys/cam/scsi/scsi_cd.c stable/9/sys/cam/scsi/scsi_da.c stable/9/sys/cam/scsi/scsi_low.c stable/9/sys/cam/scsi/scsi_sa.c stable/9/sys/cam/scsi/scsi_targ_bh.c stable/9/sys/dev/ciss/ciss.c stable/9/sys/dev/firewire/sbp.c stable/9/sys/dev/firewire/sbp_targ.c stable/9/sys/dev/iir/iir.c stable/9/sys/dev/iscsi/initiator/iscsi_subr.c stable/9/sys/dev/isp/isp_freebsd.h stable/9/sys/dev/mly/mly.c stable/9/sys/dev/mps/mps_sas.c stable/9/sys/dev/mpt/mpt_cam.c stable/9/sys/dev/usb/storage/umass.c stable/9/sys/powerpc/ps3/ps3cdrom.c Directory Properties: stable/9/sbin/camcontrol/ (props changed) stable/9/share/examples/ (props changed) stable/9/share/misc/ (props changed) stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sbin/camcontrol/camcontrol.c ============================================================================== --- stable/9/sbin/camcontrol/camcontrol.c Thu Oct 6 17:35:38 2011 (r226066) +++ stable/9/sbin/camcontrol/camcontrol.c Thu Oct 6 19:15:51 2011 (r226067) @@ -1907,7 +1907,9 @@ readdefects(struct cam_device *device, i int error_code, sense_key, asc, ascq; sense = &ccb->csio.sense_data; - scsi_extract_sense(sense, &error_code, &sense_key, &asc, &ascq); + scsi_extract_sense_len(sense, ccb->csio.sense_len - + ccb->csio.sense_resid, &error_code, &sense_key, &asc, + &ascq, /*show_errors*/ 1); /* * According to the SCSI spec, if the disk doesn't support @@ -3798,8 +3800,9 @@ doreport: int error_code, sense_key, asc, ascq; sense = &ccb->csio.sense_data; - scsi_extract_sense(sense, &error_code, &sense_key, - &asc, &ascq); + scsi_extract_sense_len(sense, ccb->csio.sense_len - + ccb->csio.sense_resid, &error_code, &sense_key, + &asc, &ascq, /*show_errors*/ 1); /* * According to the SCSI-2 and SCSI-3 specs, a @@ -3810,15 +3813,15 @@ doreport: */ if ((sense_key == SSD_KEY_NOT_READY) && (asc == 0x04) && (ascq == 0x04)) { - if ((sense->extra_len >= 10) - && ((sense->sense_key_spec[0] & - SSD_SCS_VALID) != 0) + uint8_t sks[3]; + + if ((scsi_get_sks(sense, ccb->csio.sense_len - + ccb->csio.sense_resid, sks) == 0) && (quiet == 0)) { int val; u_int64_t percentage; - val = scsi_2btoul( - &sense->sense_key_spec[1]); + val = scsi_2btoul(&sks[1]); percentage = 10000 * val; fprintf(stdout, Modified: stable/9/share/examples/scsi_target/scsi_cmds.c ============================================================================== --- stable/9/share/examples/scsi_target/scsi_cmds.c Thu Oct 6 17:35:38 2011 (r226066) +++ stable/9/share/examples/scsi_target/scsi_cmds.c Thu Oct 6 19:15:51 2011 (r226067) @@ -242,22 +242,22 @@ tcmd_sense(u_int init_id, struct ccb_scs u_int8_t asc, u_int8_t ascq) { struct initiator_state *istate; - struct scsi_sense_data *sense; + struct scsi_sense_data_fixed *sense; /* Set our initiator's istate */ istate = tcmd_get_istate(init_id); if (istate == NULL) return; istate->pending_ca |= CA_CMD_SENSE; /* XXX set instead of or? */ - sense = &istate->sense_data; + sense = (struct scsi_sense_data_fixed *)&istate->sense_data; bzero(sense, sizeof(*sense)); sense->error_code = SSD_CURRENT_ERROR; sense->flags = flags; sense->add_sense_code = asc; sense->add_sense_code_qual = ascq; sense->extra_len = - offsetof(struct scsi_sense_data, sense_key_spec[2]) - - offsetof(struct scsi_sense_data, extra_len); + offsetof(struct scsi_sense_data_fixed, sense_key_spec[2]) - + offsetof(struct scsi_sense_data_fixed, extra_len); /* Fill out the supplied CTIO */ if (ctio != NULL) { @@ -298,7 +298,7 @@ tcmd_inquiry(struct ccb_accept_tio *atio struct scsi_inquiry *inq; struct atio_descr *a_descr; struct initiator_state *istate; - struct scsi_sense_data *sense; + struct scsi_sense_data_fixed *sense; a_descr = (struct atio_descr *)atio->ccb_h.targ_descr; inq = (struct scsi_inquiry *)a_descr->cdb; @@ -310,7 +310,7 @@ tcmd_inquiry(struct ccb_accept_tio *atio * complain if EVPD or CMDDT is set. */ istate = tcmd_get_istate(ctio->init_id); - sense = &istate->sense_data; + sense = (struct scsi_sense_data_fixed *)&istate->sense_data; if ((inq->byte2 & SI_EVPD) != 0) { tcmd_illegal_req(atio, ctio); sense->sense_key_spec[0] = SSD_SCS_VALID | SSD_FIELDPTR_CMD | @@ -376,7 +376,7 @@ static int tcmd_req_sense(struct ccb_accept_tio *atio, struct ccb_scsiio *ctio) { struct scsi_request_sense *rsense; - struct scsi_sense_data *sense; + struct scsi_sense_data_fixed *sense; struct initiator_state *istate; size_t dlen; struct atio_descr *a_descr; @@ -385,7 +385,7 @@ tcmd_req_sense(struct ccb_accept_tio *at rsense = (struct scsi_request_sense *)a_descr->cdb; istate = tcmd_get_istate(ctio->init_id); - sense = &istate->sense_data; + sense = (struct scsi_sense_data_fixed *)&istate->sense_data; if (debug) { cdb_debug(a_descr->cdb, "REQ SENSE from %u: ", atio->init_id); @@ -400,7 +400,7 @@ tcmd_req_sense(struct ccb_accept_tio *at } bcopy(sense, ctio->data_ptr, sizeof(struct scsi_sense_data)); - dlen = offsetof(struct scsi_sense_data, extra_len) + + dlen = offsetof(struct scsi_sense_data_fixed, extra_len) + sense->extra_len + 1; ctio->dxfer_len = min(dlen, SCSI_CDB6_LEN(rsense->length)); ctio->ccb_h.flags |= CAM_DIR_IN | CAM_SEND_STATUS; @@ -482,7 +482,7 @@ tcmd_rdwr(struct ccb_accept_tio *atio, s c_descr = (struct ctio_descr *)ctio->ccb_h.targ_descr; /* Command needs to be decoded */ - if ((a_descr->flags & CAM_DIR_MASK) == CAM_DIR_RESV) { + if ((a_descr->flags & CAM_DIR_MASK) == CAM_DIR_BOTH) { if (debug) warnx("Calling rdwr_decode"); ret = tcmd_rdwr_decode(atio, ctio); Modified: stable/9/share/examples/scsi_target/scsi_target.c ============================================================================== --- stable/9/share/examples/scsi_target/scsi_target.c Thu Oct 6 17:35:38 2011 (r226066) +++ stable/9/share/examples/scsi_target/scsi_target.c Thu Oct 6 19:15:51 2011 (r226067) @@ -651,7 +651,7 @@ work_atio(struct ccb_accept_tio *atio) * receiving this ATIO. */ if (atio->sense_len != 0) { - struct scsi_sense_data *sense; + struct scsi_sense_data_fixed *sense; if (debug) { warnx("ATIO with %u bytes sense received", @@ -825,9 +825,9 @@ work_inot(struct ccb_immed_notify *inot) /* If there is sense data, use it */ if (sense != 0) { - struct scsi_sense_data *sense; + struct scsi_sense_data_fixed *sense; - sense = &inot->sense_data; + sense = (struct scsi_sense_data_fixed *)&inot->sense_data; tcmd_sense(inot->initiator_id, NULL, sense->flags, sense->add_sense_code, sense->add_sense_code_qual); if (debug) Modified: stable/9/share/misc/scsi_modes ============================================================================== --- stable/9/share/misc/scsi_modes Thu Oct 6 17:35:38 2011 (r226066) +++ stable/9/share/misc/scsi_modes Thu Oct 6 19:15:51 2011 (r226067) @@ -50,19 +50,32 @@ # ALL DEVICE TYPES 0x0a "Control Mode Page" { - {Reserved} *t7 + {TST} t3 + {TMF_ONLY} t1 + {DPICZ} t1 + {D_SENSE} t1 + {GLTSD} t1 {RLEC} t1 {Queue Algorithm Modifier} t4 - {Reserved} *t2 - {QErr} t1 + {NUAR} t1 + {QErr} t2 {DQue} t1 {EECA} t1 - {Reserved} *t4 + {RAC} t1 + {UA_INTLCK_CTRL} t2 + {SWP} t1 {RAENP} t1 {UAAENP} t1 {EAENP} t1 - {Reserved} *i1 + {ATO} t1 + {TAS} t1 + {ATMPE} t1 + {RWWP} t1 + {Reserved} *t1 + {Autoload Mode} t3 {Ready AEN Holdoff Period} i2 + {Busy Timeout Period} i2 + {Extended Self-Test Completion Time} i2 } 0x02 "Disconnect-Reconnect Page" { Modified: stable/9/sys/cam/cam_ccb.h ============================================================================== --- stable/9/sys/cam/cam_ccb.h Thu Oct 6 17:35:38 2011 (r226066) +++ stable/9/sys/cam/cam_ccb.h Thu Oct 6 19:15:51 2011 (r226067) @@ -539,7 +539,7 @@ struct ccb_dev_match { /* * Definitions for the path inquiry CCB fields. */ -#define CAM_VERSION 0x15 /* Hex value for current version */ +#define CAM_VERSION 0x16 /* Hex value for current version */ typedef enum { PI_MDP_ABLE = 0x80, /* Supports MDP message */ Modified: stable/9/sys/cam/cam_periph.c ============================================================================== --- stable/9/sys/cam/cam_periph.c Thu Oct 6 17:35:38 2011 (r226066) +++ stable/9/sys/cam/cam_periph.c Thu Oct 6 19:15:51 2011 (r226067) @@ -1085,7 +1085,6 @@ camperiphsensedone(struct cam_periph *pe union ccb *saved_ccb = (union ccb *)done_ccb->ccb_h.saved_ccb_ptr; cam_status status; int frozen = 0; - u_int sense_key; int depth = done_ccb->ccb_h.recovery_depth; status = done_ccb->ccb_h.status; @@ -1101,22 +1100,25 @@ camperiphsensedone(struct cam_periph *pe switch (status) { case CAM_REQ_CMP: { + int error_code, sense_key, asc, ascq; + + scsi_extract_sense_len(&saved_ccb->csio.sense_data, + saved_ccb->csio.sense_len - + saved_ccb->csio.sense_resid, + &error_code, &sense_key, &asc, &ascq, + /*show_errors*/ 1); /* * If we manually retrieved sense into a CCB and got * something other than "NO SENSE" send the updated CCB * back to the client via xpt_done() to be processed via * the error recovery code again. */ - sense_key = saved_ccb->csio.sense_data.flags; - sense_key &= SSD_KEY; - if (sense_key != SSD_KEY_NO_SENSE) { - saved_ccb->ccb_h.status |= - CAM_AUTOSNS_VALID; + if ((sense_key != -1) + && (sense_key != SSD_KEY_NO_SENSE)) { + saved_ccb->ccb_h.status |= CAM_AUTOSNS_VALID; } else { - saved_ccb->ccb_h.status &= - ~CAM_STATUS_MASK; - saved_ccb->ccb_h.status |= - CAM_AUTOSENSE_FAIL; + saved_ccb->ccb_h.status &= ~CAM_STATUS_MASK; + saved_ccb->ccb_h.status |= CAM_AUTOSENSE_FAIL; } saved_ccb->csio.sense_resid = done_ccb->csio.resid; bcopy(saved_ccb, done_ccb, sizeof(union ccb)); @@ -1198,12 +1200,15 @@ camperiphdone(struct cam_periph *periph, if (status & CAM_AUTOSNS_VALID) { struct ccb_getdev cgd; struct scsi_sense_data *sense; - int error_code, sense_key, asc, ascq; + int error_code, sense_key, asc, ascq, sense_len; scsi_sense_action err_action; sense = &done_ccb->csio.sense_data; - scsi_extract_sense(sense, &error_code, - &sense_key, &asc, &ascq); + sense_len = done_ccb->csio.sense_len - + done_ccb->csio.sense_resid; + scsi_extract_sense_len(sense, sense_len, &error_code, + &sense_key, &asc, &ascq, + /*show_errors*/ 1); /* * Grab the inquiry data for this device. */ Modified: stable/9/sys/cam/scsi/scsi_all.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_all.c Thu Oct 6 17:35:38 2011 (r226066) +++ stable/9/sys/cam/scsi/scsi_all.c Thu Oct 6 19:15:51 2011 (r226067) @@ -31,6 +31,8 @@ __FBSDID("$FreeBSD$"); #include +#include +#include #ifdef _KERNEL #include @@ -54,6 +56,7 @@ __FBSDID("$FreeBSD$"); #include #ifndef _KERNEL #include +#include #ifndef FALSE #define FALSE 0 @@ -608,14 +611,24 @@ scsi_op_desc(u_int16_t opcode, struct sc struct op_table_entry *table[2]; int num_tables; - pd_type = SID_TYPE(inq_data); + /* + * If we've got inquiry data, use it to determine what type of + * device we're dealing with here. Otherwise, assume direct + * access. + */ + if (inq_data == NULL) { + pd_type = T_DIRECT; + match = NULL; + } else { + pd_type = SID_TYPE(inq_data); - match = cam_quirkmatch((caddr_t)inq_data, - (caddr_t)scsi_op_quirk_table, - sizeof(scsi_op_quirk_table)/ - sizeof(*scsi_op_quirk_table), - sizeof(*scsi_op_quirk_table), - scsi_inquiry_match); + match = cam_quirkmatch((caddr_t)inq_data, + (caddr_t)scsi_op_quirk_table, + sizeof(scsi_op_quirk_table)/ + sizeof(*scsi_op_quirk_table), + sizeof(*scsi_op_quirk_table), + scsi_inquiry_match); + } if (match != NULL) { table[0] = ((struct scsi_op_quirk_entry *)match)->op_table; @@ -699,7 +712,7 @@ const struct sense_key_table_entry sense { SSD_KEY_EQUAL, SS_NOP, "EQUAL" }, { SSD_KEY_VOLUME_OVERFLOW, SS_FATAL|EIO, "VOLUME OVERFLOW" }, { SSD_KEY_MISCOMPARE, SS_NOP, "MISCOMPARE" }, - { SSD_KEY_RESERVED, SS_FATAL|EIO, "RESERVED" } + { SSD_KEY_COMPLETED, SS_NOP, "COMPLETED" } }; const int sense_key_table_size = @@ -1062,25 +1075,25 @@ static struct asc_table_entry asc_table[ { SST(0x10, 0x03, SS_RDEF, /* XXX TBD */ "Logical block reference tag check failed") }, /* DT WRO BK */ - { SST(0x11, 0x00, SS_RDEF, + { SST(0x11, 0x00, SS_FATAL|EIO, "Unrecovered read error") }, /* DT WRO BK */ - { SST(0x11, 0x01, SS_RDEF, + { SST(0x11, 0x01, SS_FATAL|EIO, "Read retries exhausted") }, /* DT WRO BK */ - { SST(0x11, 0x02, SS_RDEF, + { SST(0x11, 0x02, SS_FATAL|EIO, "Error too long to correct") }, /* DT W O BK */ - { SST(0x11, 0x03, SS_RDEF, + { SST(0x11, 0x03, SS_FATAL|EIO, "Multiple read errors") }, /* D W O BK */ - { SST(0x11, 0x04, SS_RDEF, + { SST(0x11, 0x04, SS_FATAL|EIO, "Unrecovered read error - auto reallocate failed") }, /* WRO B */ - { SST(0x11, 0x05, SS_RDEF, + { SST(0x11, 0x05, SS_FATAL|EIO, "L-EC uncorrectable error") }, /* WRO B */ - { SST(0x11, 0x06, SS_RDEF, + { SST(0x11, 0x06, SS_FATAL|EIO, "CIRC unrecovered error") }, /* W O B */ { SST(0x11, 0x07, SS_RDEF, @@ -1095,10 +1108,10 @@ static struct asc_table_entry asc_table[ { SST(0x11, 0x0A, SS_RDEF, "Miscorrected error") }, /* D W O BK */ - { SST(0x11, 0x0B, SS_RDEF, + { SST(0x11, 0x0B, SS_FATAL|EIO, "Unrecovered read error - recommend reassignment") }, /* D W O BK */ - { SST(0x11, 0x0C, SS_RDEF, + { SST(0x11, 0x0C, SS_FATAL|EIO, "Unrecovered read error - recommend rewrite the data") }, /* DT WRO B */ { SST(0x11, 0x0D, SS_RDEF, @@ -2790,7 +2803,10 @@ scsi_sense_desc(int sense_key, int asc, &sense_entry, &asc_entry); - *sense_key_desc = sense_entry->desc; + if (sense_entry != NULL) + *sense_key_desc = sense_entry->desc; + else + *sense_key_desc = "Invalid Sense Key"; if (asc_entry != NULL) *asc_desc = asc_entry->desc; @@ -2816,10 +2832,12 @@ scsi_error_action(struct ccb_scsiio *csi int error_code, sense_key, asc, ascq; scsi_sense_action action; - scsi_extract_sense(&csio->sense_data, &error_code, - &sense_key, &asc, &ascq); + scsi_extract_sense_len(&csio->sense_data, csio->sense_len - + csio->sense_resid, &error_code, + &sense_key, &asc, &ascq, /*show_errors*/ 1); - if (error_code == SSD_DEFERRED_ERROR) { + if ((error_code == SSD_DEFERRED_ERROR) + || (error_code == SSD_DESC_DEFERRED_ERROR)) { /* * XXX dufault@FreeBSD.org * This error doesn't relate to the command associated @@ -2857,8 +2875,10 @@ scsi_error_action(struct ccb_scsiio *csi if (asc_entry != NULL && (asc != 0 || ascq != 0)) action = asc_entry->action; - else + else if (sense_entry != NULL) action = sense_entry->action; + else + action = SS_RETRY|SSQ_DECREMENT_COUNT|SSQ_PRINT_SENSE; if (sense_key == SSD_KEY_RECOVERED_ERROR) { /* @@ -3040,308 +3060,1530 @@ scsi_command_string(struct cam_device *d return(0); } - /* - * scsi_sense_sbuf() returns 0 for success and -1 for failure. + * Iterate over sense descriptors. Each descriptor is passed into iter_func(). + * If iter_func() returns 0, list traversal continues. If iter_func() + * returns non-zero, list traversal is stopped. */ -#ifdef _KERNEL -int -scsi_sense_sbuf(struct ccb_scsiio *csio, struct sbuf *sb, - scsi_sense_string_flags flags) -#else /* !_KERNEL */ -int -scsi_sense_sbuf(struct cam_device *device, struct ccb_scsiio *csio, - struct sbuf *sb, scsi_sense_string_flags flags) -#endif /* _KERNEL/!_KERNEL */ +void +scsi_desc_iterate(struct scsi_sense_data_desc *sense, u_int sense_len, + int (*iter_func)(struct scsi_sense_data_desc *sense, + u_int, struct scsi_sense_desc_header *, + void *), void *arg) { - struct scsi_sense_data *sense; - struct scsi_inquiry_data *inq_data; -#ifdef _KERNEL - struct ccb_getdev *cgd; -#endif /* _KERNEL */ - u_int32_t info; - int error_code; - int sense_key; - int asc, ascq; - char path_str[64]; - -#ifndef _KERNEL - if (device == NULL) - return(-1); -#endif /* !_KERNEL */ - if ((csio == NULL) || (sb == NULL)) - return(-1); + int cur_pos; + int desc_len; /* - * If the CDB is a physical address, we can't deal with it.. + * First make sure the extra length field is present. */ - if ((csio->ccb_h.flags & CAM_CDB_PHYS) != 0) - flags &= ~SSS_FLAG_PRINT_COMMAND; + if (SSD_DESC_IS_PRESENT(sense, sense_len, extra_len) == 0) + return; -#ifdef _KERNEL - xpt_path_string(csio->ccb_h.path, path_str, sizeof(path_str)); -#else /* !_KERNEL */ - cam_path_string(device, path_str, sizeof(path_str)); -#endif /* _KERNEL/!_KERNEL */ + /* + * The length of data actually returned may be different than the + * extra_len recorded in the sturcture. + */ + desc_len = sense_len -offsetof(struct scsi_sense_data_desc, sense_desc); -#ifdef _KERNEL - if ((cgd = (struct ccb_getdev*)xpt_alloc_ccb_nowait()) == NULL) - return(-1); /* - * Get the device information. + * Limit this further by the extra length reported, and the maximum + * allowed extra length. */ - xpt_setup_ccb(&cgd->ccb_h, - csio->ccb_h.path, - CAM_PRIORITY_NORMAL); - cgd->ccb_h.func_code = XPT_GDEV_TYPE; - xpt_action((union ccb *)cgd); + desc_len = MIN(desc_len, MIN(sense->extra_len, SSD_EXTRA_MAX)); /* - * If the device is unconfigured, just pretend that it is a hard - * drive. scsi_op_desc() needs this. + * Subtract the size of the header from the descriptor length. + * This is to ensure that we have at least the header left, so we + * don't have to check that inside the loop. This can wind up + * being a negative value. */ - if (cgd->ccb_h.status == CAM_DEV_NOT_THERE) - cgd->inq_data.device = T_DIRECT; + desc_len -= sizeof(struct scsi_sense_desc_header); - inq_data = &cgd->inq_data; + for (cur_pos = 0; cur_pos < desc_len;) { + struct scsi_sense_desc_header *header; -#else /* !_KERNEL */ + header = (struct scsi_sense_desc_header *) + &sense->sense_desc[cur_pos]; - inq_data = &device->inq_data; + /* + * Check to make sure we have the entire descriptor. We + * don't call iter_func() unless we do. + * + * Note that although cur_pos is at the beginning of the + * descriptor, desc_len already has the header length + * subtracted. So the comparison of the length in the + * header (which does not include the header itself) to + * desc_len - cur_pos is correct. + */ + if (header->length > (desc_len - cur_pos)) + break; -#endif /* _KERNEL/!_KERNEL */ + if (iter_func(sense, sense_len, header, arg) != 0) + break; - sense = NULL; + cur_pos += sizeof(*header) + header->length; + } +} - if (flags & SSS_FLAG_PRINT_COMMAND) { +struct scsi_find_desc_info { + uint8_t desc_type; + struct scsi_sense_desc_header *header; +}; - sbuf_cat(sb, path_str); +static int +scsi_find_desc_func(struct scsi_sense_data_desc *sense, u_int sense_len, + struct scsi_sense_desc_header *header, void *arg) +{ + struct scsi_find_desc_info *desc_info; -#ifdef _KERNEL - scsi_command_string(csio, sb); -#else /* !_KERNEL */ - scsi_command_string(device, csio, sb); -#endif /* _KERNEL/!_KERNEL */ - sbuf_printf(sb, "\n"); - } + desc_info = (struct scsi_find_desc_info *)arg; + + if (header->desc_type == desc_info->desc_type) { + desc_info->header = header; + + /* We found the descriptor, tell the iterator to stop. */ + return (1); + } else + return (0); +} + +/* + * Given a descriptor type, return a pointer to it if it is in the sense + * data and not truncated. Avoiding truncating sense data will simplify + * things significantly for the caller. + */ +uint8_t * +scsi_find_desc(struct scsi_sense_data_desc *sense, u_int sense_len, + uint8_t desc_type) +{ + struct scsi_find_desc_info desc_info; + + desc_info.desc_type = desc_type; + desc_info.header = NULL; + + scsi_desc_iterate(sense, sense_len, scsi_find_desc_func, &desc_info); + + return ((uint8_t *)desc_info.header); +} + +/* + * Fill in SCSI sense data with the specified parameters. This routine can + * fill in either fixed or descriptor type sense data. + */ +void +scsi_set_sense_data_va(struct scsi_sense_data *sense_data, + scsi_sense_data_type sense_format, int current_error, + int sense_key, int asc, int ascq, va_list ap) +{ + int descriptor_sense; + scsi_sense_elem_type elem_type; /* - * If the sense data is a physical pointer, forget it. + * Determine whether to return fixed or descriptor format sense + * data. If the user specifies SSD_TYPE_NONE for some reason, + * they'll just get fixed sense data. */ - if (csio->ccb_h.flags & CAM_SENSE_PTR) { - if (csio->ccb_h.flags & CAM_SENSE_PHYS) { -#ifdef _KERNEL - xpt_free_ccb((union ccb*)cgd); -#endif /* _KERNEL/!_KERNEL */ - return(-1); - } else { - /* - * bcopy the pointer to avoid unaligned access - * errors on finicky architectures. We don't - * ensure that the sense data is pointer aligned. - */ - bcopy(&csio->sense_data, &sense, - sizeof(struct scsi_sense_data *)); - } - } else { + if (sense_format == SSD_TYPE_DESC) + descriptor_sense = 1; + else + descriptor_sense = 0; + + /* + * Zero the sense data, so that we don't pass back any garbage data + * to the user. + */ + memset(sense_data, 0, sizeof(*sense_data)); + + if (descriptor_sense != 0) { + struct scsi_sense_data_desc *sense; + + sense = (struct scsi_sense_data_desc *)sense_data; /* - * If the physical sense flag is set, but the sense pointer - * is not also set, we assume that the user is an idiot and - * return. (Well, okay, it could be that somehow, the - * entire csio is physical, but we would have probably core - * dumped on one of the bogus pointer deferences above - * already.) + * The descriptor sense format eliminates the use of the + * valid bit. */ - if (csio->ccb_h.flags & CAM_SENSE_PHYS) { -#ifdef _KERNEL - xpt_free_ccb((union ccb*)cgd); -#endif /* _KERNEL/!_KERNEL */ - return(-1); - } else - sense = &csio->sense_data; - } - + if (current_error != 0) + sense->error_code = SSD_DESC_CURRENT_ERROR; + else + sense->error_code = SSD_DESC_DEFERRED_ERROR; + sense->sense_key = sense_key; + sense->add_sense_code = asc; + sense->add_sense_code_qual = ascq; + /* + * Start off with no extra length, since the above data + * fits in the standard descriptor sense information. + */ + sense->extra_len = 0; + while ((elem_type = (scsi_sense_elem_type)va_arg(ap, + scsi_sense_elem_type)) != SSD_ELEM_NONE) { + int sense_len, len_to_copy; + uint8_t *data; + + if (elem_type >= SSD_ELEM_MAX) { + printf("%s: invalid sense type %d\n", __func__, + elem_type); + break; + } - sbuf_cat(sb, path_str); + sense_len = (int)va_arg(ap, int); + len_to_copy = MIN(sense_len, SSD_EXTRA_MAX - + sense->extra_len); + data = (uint8_t *)va_arg(ap, uint8_t *); - error_code = sense->error_code & SSD_ERRCODE; - sense_key = sense->flags & SSD_KEY; + /* + * We've already consumed the arguments for this one. + */ + if (elem_type == SSD_ELEM_SKIP) + continue; - sbuf_printf(sb, "SCSI sense: "); - switch (error_code) { - case SSD_DEFERRED_ERROR: - sbuf_printf(sb, "Deferred error: "); + switch (elem_type) { + case SSD_ELEM_DESC: { - /* FALLTHROUGH */ - case SSD_CURRENT_ERROR: - { - const char *sense_key_desc; - const char *asc_desc; + /* + * This is a straight descriptor. All we + * need to do is copy the data in. + */ + bcopy(data, &sense->sense_desc[ + sense->extra_len], len_to_copy); + sense->extra_len += len_to_copy; + break; + } + case SSD_ELEM_SKS: { + struct scsi_sense_sks sks; - asc = (sense->extra_len >= 5) ? sense->add_sense_code : 0; - ascq = (sense->extra_len >= 6) ? sense->add_sense_code_qual : 0; - scsi_sense_desc(sense_key, asc, ascq, inq_data, - &sense_key_desc, &asc_desc); - sbuf_cat(sb, sense_key_desc); + bzero(&sks, sizeof(sks)); - info = scsi_4btoul(sense->info); - - if (sense->error_code & SSD_ERRCODE_VALID) { + /* + * This is already-formatted sense key + * specific data. We just need to fill out + * the header and copy everything in. + */ + bcopy(data, &sks.sense_key_spec, + MIN(len_to_copy, + sizeof(sks.sense_key_spec))); + + sks.desc_type = SSD_DESC_SKS; + sks.length = sizeof(sks) - + offsetof(struct scsi_sense_sks, reserved1); + bcopy(&sks,&sense->sense_desc[sense->extra_len], + sizeof(sks)); + sense->extra_len += sizeof(sks); + break; + } + case SSD_ELEM_INFO: + case SSD_ELEM_COMMAND: { + struct scsi_sense_command cmd; + struct scsi_sense_info info; + uint8_t *data_dest; + uint8_t *descriptor; + int descriptor_size, i, copy_len; + + bzero(&cmd, sizeof(cmd)); + bzero(&info, sizeof(info)); + + /* + * Command or information data. The + * operate in pretty much the same way. + */ + if (elem_type == SSD_ELEM_COMMAND) { + len_to_copy = MIN(len_to_copy, + sizeof(cmd.command_info)); + descriptor = (uint8_t *)&cmd; + descriptor_size = sizeof(cmd); + data_dest =(uint8_t *)&cmd.command_info; + cmd.desc_type = SSD_DESC_COMMAND; + cmd.length = sizeof(cmd) - + offsetof(struct scsi_sense_command, + reserved); + } else { + len_to_copy = MIN(len_to_copy, + sizeof(info.info)); + descriptor = (uint8_t *)&info; + descriptor_size = sizeof(cmd); + data_dest = (uint8_t *)&info.info; + info.desc_type = SSD_DESC_INFO; + info.byte2 = SSD_INFO_VALID; + info.length = sizeof(info) - + offsetof(struct scsi_sense_info, + byte2); + } - switch (sense_key) { - case SSD_KEY_NOT_READY: - case SSD_KEY_ILLEGAL_REQUEST: - case SSD_KEY_UNIT_ATTENTION: - case SSD_KEY_DATA_PROTECT: + /* + * Copy this in reverse because the spec + * (SPC-4) says that when 4 byte quantities + * are stored in this 8 byte field, the + * first four bytes shall be 0. + * + * So we fill the bytes in from the end, and + * if we have less than 8 bytes to copy, + * the initial, most significant bytes will + * be 0. + */ + for (i = sense_len - 1; i >= 0 && + len_to_copy > 0; i--, len_to_copy--) + data_dest[len_to_copy - 1] = data[i]; + + /* + * This calculation looks much like the + * initial len_to_copy calculation, but + * we have to do it again here, because + * we're looking at a larger amount that + * may or may not fit. It's not only the + * data the user passed in, but also the + * rest of the descriptor. + */ + copy_len = MIN(descriptor_size, + SSD_EXTRA_MAX - sense->extra_len); + bcopy(descriptor, &sense->sense_desc[ + sense->extra_len], copy_len); + sense->extra_len += copy_len; + break; + } + case SSD_ELEM_FRU: { + struct scsi_sense_fru fru; + int copy_len; + + bzero(&fru, sizeof(fru)); + + fru.desc_type = SSD_DESC_FRU; + fru.length = sizeof(fru) - + offsetof(struct scsi_sense_fru, reserved); + fru.fru = *data; + + copy_len = MIN(sizeof(fru), SSD_EXTRA_MAX - + sense->extra_len); + bcopy(&fru, &sense->sense_desc[ + sense->extra_len], copy_len); + sense->extra_len += copy_len; break; - case SSD_KEY_BLANK_CHECK: - sbuf_printf(sb, " req sz: %d (decimal)", info); + } + case SSD_ELEM_STREAM: { + struct scsi_sense_stream stream_sense; + int copy_len; + + bzero(&stream_sense, sizeof(stream_sense)); + stream_sense.desc_type = SSD_DESC_STREAM; + stream_sense.length = sizeof(stream_sense) - + offsetof(struct scsi_sense_stream, reserved); + stream_sense.byte3 = *data; + + copy_len = MIN(sizeof(stream_sense), + SSD_EXTRA_MAX - sense->extra_len); + bcopy(&stream_sense, &sense->sense_desc[ + sense->extra_len], copy_len); + sense->extra_len += copy_len; break; + } default: - if (info) { - if (sense->flags & SSD_ILI) { - sbuf_printf(sb, " ILI (length " - "mismatch): %d", info); - - } else { - sbuf_printf(sb, " info:%x", - info); - } - } + /* + * We shouldn't get here, but if we do, do + * nothing. We've already consumed the + * arguments above. + */ + break; } - } else if (info) { - sbuf_printf(sb, " info?:%x", info); } + } else { + struct scsi_sense_data_fixed *sense; - if (sense->extra_len >= 4) { - if (bcmp(sense->cmd_spec_info, "\0\0\0\0", 4)) { - sbuf_printf(sb, " csi:%x,%x,%x,%x", - sense->cmd_spec_info[0], - sense->cmd_spec_info[1], - sense->cmd_spec_info[2], - sense->cmd_spec_info[3]); - } - } + sense = (struct scsi_sense_data_fixed *)sense_data; - sbuf_printf(sb, " asc:%x,%x (%s)", asc, ascq, asc_desc); + if (current_error != 0) + sense->error_code = SSD_CURRENT_ERROR; + else + sense->error_code = SSD_DEFERRED_ERROR; - if (sense->extra_len >= 7 && sense->fru) { - sbuf_printf(sb, " field replaceable unit: %x", - sense->fru); - } + sense->flags = sense_key; + sense->add_sense_code = asc; + sense->add_sense_code_qual = ascq; + /* + * We've set the ASC and ASCQ, so we have 6 more bytes of + * valid data. If we wind up setting any of the other + * fields, we'll bump this to 10 extra bytes. + */ + sense->extra_len = 6; - if ((sense->extra_len >= 10) - && (sense->sense_key_spec[0] & SSD_SCS_VALID) != 0) { - switch(sense_key) { - case SSD_KEY_ILLEGAL_REQUEST: { - int bad_command; - char tmpstr2[40]; - - if (sense->sense_key_spec[0] & 0x40) - bad_command = 1; - else - bad_command = 0; - - tmpstr2[0] = '\0'; - - /* Bit pointer is valid */ - if (sense->sense_key_spec[0] & 0x08) - snprintf(tmpstr2, sizeof(tmpstr2), - "bit %d ", - sense->sense_key_spec[0] & 0x7); - sbuf_printf(sb, ": %s byte %d %sis invalid", - bad_command ? "Command" : "Data", - scsi_2btoul( - &sense->sense_key_spec[1]), - tmpstr2); + while ((elem_type = (scsi_sense_elem_type)va_arg(ap, + scsi_sense_elem_type)) != SSD_ELEM_NONE) { + int sense_len, len_to_copy; + uint8_t *data; + + if (elem_type >= SSD_ELEM_MAX) { + printf("%s: invalid sense type %d\n", __func__, + elem_type); break; } - case SSD_KEY_RECOVERED_ERROR: - case SSD_KEY_HARDWARE_ERROR: - case SSD_KEY_MEDIUM_ERROR: - sbuf_printf(sb, " actual retry count: %d", - scsi_2btoul( - &sense->sense_key_spec[1])); + /* + * If we get in here, just bump the extra length to + * 10 bytes. That will encompass anything we're + * going to set here. + */ + sense->extra_len = 10; + sense_len = (int)va_arg(ap, int); + len_to_copy = MIN(sense_len, SSD_EXTRA_MAX - + sense->extra_len); + data = (uint8_t *)va_arg(ap, uint8_t *); + + switch (elem_type) { + case SSD_ELEM_SKS: + /* + * The user passed in pre-formatted sense + * key specific data. + */ + bcopy(data, &sense->sense_key_spec[0], + MIN(sizeof(sense->sense_key_spec), + sense_len)); break; - default: - sbuf_printf(sb, " sks:%#x,%#x", - sense->sense_key_spec[0], - scsi_2btoul( - &sense->sense_key_spec[1])); + case SSD_ELEM_INFO: + case SSD_ELEM_COMMAND: { + uint8_t *data_dest; + int i; + + if (elem_type == SSD_ELEM_COMMAND) + data_dest = &sense->cmd_spec_info[0]; + else { + data_dest = &sense->info[0]; + /* + * We're setting the info field, so + * set the valid bit. + */ + sense->error_code |= SSD_ERRCODE_VALID; + } + + /* + * Copy this in reverse so that if we have + * less than 4 bytes to fill, the least + * significant bytes will be at the end. + * If we have more than 4 bytes, only the + * least significant bytes will be included. + */ + for (i = sense_len - 1; i >= 0 && + len_to_copy > 0; i--, len_to_copy--) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-9@FreeBSD.ORG Thu Oct 6 20:25:36 2011 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 244621065673; Thu, 6 Oct 2011 20:25:36 +0000 (UTC) (envelope-from pluknet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 13CB88FC0C; Thu, 6 Oct 2011 20:25:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p96KPZuF076346; Thu, 6 Oct 2011 20:25:35 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p96KPZV3076344; Thu, 6 Oct 2011 20:25:35 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201110062025.p96KPZV3076344@svn.freebsd.org> From: Sergey Kandaurov Date: Thu, 6 Oct 2011 20:25:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r226070 - stable/9/share/man/man9 X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Oct 2011 20:25:36 -0000 Author: pluknet Date: Thu Oct 6 20:25:35 2011 New Revision: 226070 URL: http://svn.freebsd.org/changeset/base/226070 Log: MFC r225776: Fix typo in OSIOCGIFADDR. Approved by: re (kib) Modified: stable/9/share/man/man9/ifnet.9 Directory Properties: stable/9/share/man/man9/ (props changed) Modified: stable/9/share/man/man9/ifnet.9 ============================================================================== --- stable/9/share/man/man9/ifnet.9 Thu Oct 6 20:20:30 2011 (r226069) +++ stable/9/share/man/man9/ifnet.9 Thu Oct 6 20:25:35 2011 (r226070) @@ -1252,7 +1252,7 @@ function is called to perform the operat The socket's protocol control routine is called to implement the requested action. .Pp -.It Dv OSIOGIFADDR +.It Dv OSIOCGIFADDR .It Dv OSIOCGIFDSTADDR .It Dv OSIOCGIFBRDADDR .It Dv OSIOCGIFNETMASK From owner-svn-src-stable-9@FreeBSD.ORG Fri Oct 7 06:46:46 2011 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D91301065672; Fri, 7 Oct 2011 06:46:46 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C734C8FC15; Fri, 7 Oct 2011 06:46:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p976kkQW097321; Fri, 7 Oct 2011 06:46:46 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p976kkm4097316; Fri, 7 Oct 2011 06:46:46 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <201110070646.p976kkm4097316@svn.freebsd.org> From: Edward Tomasz Napierala Date: Fri, 7 Oct 2011 06:46:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r226092 - in stable/9/sys: kern sys X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Oct 2011 06:46:47 -0000 Author: trasz Date: Fri Oct 7 06:46:46 2011 New Revision: 226092 URL: http://svn.freebsd.org/changeset/base/226092 Log: MFC r225938: Fix bug introduced in r225641, which would cause panic if racct_proc_fork() returned error -- the racct_destroy_locked() would get called twice. MFC r225940: Fix another bug introduced in r225641, which caused rctl to access certain fields in 'struct proc' before they got initialized in do_fork(). MFC r225944: Move some code inside the racct_proc_fork(); it spares a few lock operations and it's more logical this way. MFC r225981: Actually enforce limit for inheritable resources on fork. Approved by: re (kib) Modified: stable/9/sys/kern/kern_fork.c stable/9/sys/kern/kern_racct.c stable/9/sys/kern/kern_rctl.c stable/9/sys/sys/racct.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/kern/kern_fork.c ============================================================================== --- stable/9/sys/kern/kern_fork.c Fri Oct 7 06:13:38 2011 (r226091) +++ stable/9/sys/kern/kern_fork.c Fri Oct 7 06:46:46 2011 (r226092) @@ -879,17 +879,6 @@ fork1(struct thread *td, int flags, int goto fail1; } -#ifdef RACCT - PROC_LOCK(newproc); - error = racct_add(newproc, RACCT_NPROC, 1); - error += racct_add(newproc, RACCT_NTHR, 1); - PROC_UNLOCK(newproc); - if (error != 0) { - error = EAGAIN; - goto fail1; - } -#endif - #ifdef MAC mac_proc_init(newproc); #endif @@ -939,6 +928,7 @@ fork1(struct thread *td, int flags, int if (flags & RFPROCDESC) procdesc_finit(newproc->p_procdesc, fp_procdesc); #endif + racct_proc_fork_done(newproc); return (0); } Modified: stable/9/sys/kern/kern_racct.c ============================================================================== --- stable/9/sys/kern/kern_racct.c Fri Oct 7 06:13:38 2011 (r226091) +++ stable/9/sys/kern/kern_racct.c Fri Oct 7 06:46:46 2011 (r226092) @@ -261,12 +261,8 @@ racct_alloc_resource(struct racct *racct } } -/* - * Increase allocation of 'resource' by 'amount' for process 'p'. - * Return 0 if it's below limits, or errno, if it's not. - */ -int -racct_add(struct proc *p, int resource, uint64_t amount) +static int +racct_add_locked(struct proc *p, int resource, uint64_t amount) { #ifdef RCTL int error; @@ -282,23 +278,35 @@ racct_add(struct proc *p, int resource, */ PROC_LOCK_ASSERT(p, MA_OWNED); - mtx_lock(&racct_lock); #ifdef RCTL error = rctl_enforce(p, resource, amount); if (error && RACCT_IS_DENIABLE(resource)) { SDT_PROBE(racct, kernel, rusage, add_failure, p, resource, amount, 0, 0); - mtx_unlock(&racct_lock); return (error); } #endif racct_alloc_resource(p->p_racct, resource, amount); racct_add_cred_locked(p->p_ucred, resource, amount); - mtx_unlock(&racct_lock); return (0); } +/* + * Increase allocation of 'resource' by 'amount' for process 'p'. + * Return 0 if it's below limits, or errno, if it's not. + */ +int +racct_add(struct proc *p, int resource, uint64_t amount) +{ + int error; + + mtx_lock(&racct_lock); + error = racct_add_locked(p, resource, amount); + mtx_unlock(&racct_lock); + return (error); +} + static void racct_add_cred_locked(struct ucred *cred, int resource, uint64_t amount) { @@ -559,6 +567,12 @@ racct_proc_fork(struct proc *parent, str PROC_LOCK(child); mtx_lock(&racct_lock); +#ifdef RCTL + error = rctl_proc_fork(parent, child); + if (error != 0) + goto out; +#endif + /* * Inherit resource usage. */ @@ -569,32 +583,14 @@ racct_proc_fork(struct proc *parent, str error = racct_set_locked(child, i, parent->p_racct->r_resources[i]); - if (error != 0) { - /* - * XXX: The only purpose of these two lines is - * to prevent from tripping checks in racct_destroy(). - */ - for (i = 0; i <= RACCT_MAX; i++) - racct_set_locked(child, i, 0); + if (error != 0) goto out; - } } -#ifdef RCTL - error = rctl_proc_fork(parent, child); - if (error != 0) { - /* - * XXX: The only purpose of these two lines is to prevent from - * tripping checks in racct_destroy(). - */ - for (i = 0; i <= RACCT_MAX; i++) - racct_set_locked(child, i, 0); - } -#endif + error = racct_add_locked(child, RACCT_NPROC, 1); + error += racct_add_locked(child, RACCT_NTHR, 1); out: - if (error != 0) - racct_destroy_locked(&child->p_racct); mtx_unlock(&racct_lock); PROC_UNLOCK(child); PROC_UNLOCK(parent); @@ -602,6 +598,24 @@ out: return (error); } +/* + * Called at the end of fork1(), to handle rules that require the process + * to be fully initialized. + */ +void +racct_proc_fork_done(struct proc *child) +{ + +#ifdef RCTL + PROC_LOCK(child); + mtx_lock(&racct_lock); + rctl_enforce(child, RACCT_NPROC, 0); + rctl_enforce(child, RACCT_NTHR, 0); + mtx_unlock(&racct_lock); + PROC_UNLOCK(child); +#endif +} + void racct_proc_exit(struct proc *p) { @@ -827,6 +841,11 @@ racct_proc_fork(struct proc *parent, str } void +racct_proc_fork_done(struct proc *child) +{ +} + +void racct_proc_exit(struct proc *p) { } Modified: stable/9/sys/kern/kern_rctl.c ============================================================================== --- stable/9/sys/kern/kern_rctl.c Fri Oct 7 06:13:38 2011 (r226091) +++ stable/9/sys/kern/kern_rctl.c Fri Oct 7 06:46:46 2011 (r226092) @@ -312,6 +312,16 @@ rctl_enforce(struct proc *p, int resourc if (link->rrl_exceeded != 0) continue; + /* + * If the process state is not fully initialized yet, + * we can't access most of the required fields, e.g. + * p->p_comm. This happens when called from fork1(). + * Ignore this rule for now; it will be processed just + * after fork, when called from racct_proc_fork_done(). + */ + if (p->p_state != PRS_NORMAL) + continue; + if (!ppsratecheck(&lasttime, &curtime, 10)) continue; @@ -335,6 +345,9 @@ rctl_enforce(struct proc *p, int resourc if (link->rrl_exceeded != 0) continue; + if (p->p_state != PRS_NORMAL) + continue; + buf = malloc(RCTL_LOG_BUFSIZE, M_RCTL, M_NOWAIT); if (buf == NULL) { printf("rctl_enforce: out of memory\n"); @@ -357,23 +370,15 @@ rctl_enforce(struct proc *p, int resourc if (link->rrl_exceeded != 0) continue; + if (p->p_state != PRS_NORMAL) + continue; + KASSERT(rule->rr_action > 0 && rule->rr_action <= RCTL_ACTION_SIGNAL_MAX, ("rctl_enforce: unknown action %d", rule->rr_action)); /* - * We're supposed to send a signal, but the process - * is not fully initialized yet, probably because we - * got called from fork1(). For now just deny the - * allocation instead. - */ - if (p->p_state != PRS_NORMAL) { - should_deny = 1; - continue; - } - - /* * We're using the fact that RCTL_ACTION_SIG* values * are equal to their counterparts from sys/signal.h. */ Modified: stable/9/sys/sys/racct.h ============================================================================== --- stable/9/sys/sys/racct.h Fri Oct 7 06:13:38 2011 (r226091) +++ stable/9/sys/sys/racct.h Fri Oct 7 06:46:46 2011 (r226092) @@ -137,6 +137,7 @@ void racct_create(struct racct **racctp) void racct_destroy(struct racct **racctp); int racct_proc_fork(struct proc *parent, struct proc *child); +void racct_proc_fork_done(struct proc *child); void racct_proc_exit(struct proc *p); void racct_proc_ucred_changed(struct proc *p, struct ucred *oldcred, From owner-svn-src-stable-9@FreeBSD.ORG Fri Oct 7 20:40:45 2011 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E80AD1065731; Fri, 7 Oct 2011 20:40:45 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D3D3E8FC0A; Fri, 7 Oct 2011 20:40:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p97Kejum026804; Fri, 7 Oct 2011 20:40:45 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p97KejXU026797; Fri, 7 Oct 2011 20:40:45 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201110072040.p97KejXU026797@svn.freebsd.org> From: Xin LI Date: Fri, 7 Oct 2011 20:40:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r226115 - in stable/9: share/man/man4 sys/amd64/conf sys/conf sys/dev/tws sys/i386/conf sys/modules sys/modules/tws X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Oct 2011 20:40:46 -0000 Author: delphij Date: Fri Oct 7 20:40:45 2011 New Revision: 226115 URL: http://svn.freebsd.org/changeset/base/226115 Log: MFC r226026: Add the 9750 SATA+SAS 6Gb/s RAID controller card driver, tws(4). Many thanks for their contiued support to FreeBSD. This is version 10.80.00.003 from codeset 10.2.1 [1] Obtained from: LSI http://kb.lsi.com/Download16574.aspx [1] Approved by: re (kib) Added: stable/9/share/man/man4/tws.4 - copied unchanged from r226026, head/share/man/man4/tws.4 stable/9/sys/dev/tws/ - copied from r226026, head/sys/dev/tws/ stable/9/sys/modules/tws/ - copied from r226026, head/sys/modules/tws/ Modified: stable/9/share/man/man4/Makefile stable/9/sys/amd64/conf/GENERIC stable/9/sys/conf/files stable/9/sys/i386/conf/GENERIC stable/9/sys/modules/Makefile Directory Properties: stable/9/share/man/man4/ (props changed) stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/share/man/man4/Makefile ============================================================================== --- stable/9/share/man/man4/Makefile Fri Oct 7 18:01:34 2011 (r226114) +++ stable/9/share/man/man4/Makefile Fri Oct 7 20:40:45 2011 (r226115) @@ -447,6 +447,7 @@ MAN= aac.4 \ tun.4 \ twa.4 \ twe.4 \ + tws.4 \ tx.4 \ txp.4 \ u3g.4 \ Copied: stable/9/share/man/man4/tws.4 (from r226026, head/share/man/man4/tws.4) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/share/man/man4/tws.4 Fri Oct 7 20:40:45 2011 (r226115, copy of r226026, head/share/man/man4/tws.4) @@ -0,0 +1,118 @@ +.\" +.\"Copyright (c) 2010, 2011 iXsystems, Inc. +.\"All rights reserved. +.\" written by: Xin LI +.\" +.\"Redistribution and use in source and binary forms, with or without +.\"modification, are permitted provided that the following conditions +.\"are met: +.\"1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\"2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\"THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\"ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\"IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\"ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\"FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\"DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\"OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\"HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\"LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\"OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\"SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd October 4, 2011 +.Dt TWS 4 +.Os +.Sh NAME +.Nm tws +.Nd 3ware 9750 SATA+SAS 6Gb/s RAID controller card driver +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following lines in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device scbus" +.Cd "device tws" +.Ed +.Pp +Alternatively, to load the driver as a +module at boot time, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +tws_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +driver provides support for LSI's 3ware 9750 SATA+SAS 6Gb/s RAID controller cards. +.Pp +These controllers feature the LSISAS2108 6Gb/s SAS RAID-on-Chip (ROC) +and are available in 4- and 8-port configurations, supports RAID levels +0, 1, 5, 6, 10, 50 and single disk, with 96 SATA and/or SAS hard drives and SSDs. +.Pp +For further hardware information, see +.Pa http://www.lsi.com/. +.Sh HARDWARE +The +.Nm +driver supports the following SATA/SAS RAID controller: +.Pp +.Bl -bullet -compact +.It +LSI's 3ware SAS 9750 series +.El +.Sh LOADER TUNABLES +Tunables can be set at the +.Xr loader 8 +prompt before booting the kernel or stored in +.Xr loader.conf 5 . +.Bl -tag -width "hw.tws.use_32bit_sgls" +.It Va hw.tws.cam_depth +The maximium queued CAM SIM requests for one controller. +The default value is 256. +.It Va hw.tws.enable_msi +This tunable enables MSI support on the controller if set to a non-zero value. +The default value is 0. +.It Va hw.tws.queue_depth +The maximium queued requests for one controller. +.It Va hw.tws.use_32bit_sgls +Limit the driver to use only 32-bit SG elements regardless whether the operating +system is running in 64-bit mode. +The default value is 0. +.El +.Sh FILES +.Bl -tag -width ".Pa /dev/tws?" -compact +.It Pa /dev/da? +array/logical disk interface +.It Pa /dev/tws? +management interface +.El +.Sh DIAGNOSTICS +Whenever the driver encounters a command failure, it prints out an error code in +the format: +.Qq Li "ERROR: (: ):" , +followed by a text description of the error. +There are other error messages and warnings that the +driver prints out, depending on the kinds of errors that it encounters. +If the driver is compiled with +.Dv TWS_DEBUG +defined, it prints out a whole bunch of debug +messages. +.Sh SEE ALSO +.Xr da 4 , +.Xr scsi 4 +.Sh AUTHORS +.An -nosplit +The +.Nm +driver was written by +.An Manjunath Ranganathaiah +for LSI and this manual page was written by +.An Xin LI Aq delphij@FreeBSD.org +for iXsystems, Inc. Modified: stable/9/sys/amd64/conf/GENERIC ============================================================================== --- stable/9/sys/amd64/conf/GENERIC Fri Oct 7 18:01:34 2011 (r226114) +++ stable/9/sys/amd64/conf/GENERIC Fri Oct 7 20:40:45 2011 (r226115) @@ -151,6 +151,7 @@ device mlx # Mylex DAC960 family #XXX pointer/int warnings #device pst # Promise Supertrak SX6000 device twe # 3ware ATA RAID +device tws # LSI 3ware 9750 SATA+SAS 6Gb/s RAID controller # atkbdc0 controls both the keyboard and the PS/2 mouse device atkbdc # AT keyboard controller Modified: stable/9/sys/conf/files ============================================================================== --- stable/9/sys/conf/files Fri Oct 7 18:01:34 2011 (r226114) +++ stable/9/sys/conf/files Fri Oct 7 20:40:45 2011 (r226115) @@ -1833,6 +1833,11 @@ dev/twa/tw_osl_freebsd.c optional twa \ compile-with "${NORMAL_C} -I$S/dev/twa" dev/twe/twe.c optional twe dev/twe/twe_freebsd.c optional twe +dev/tws/tws.c optional tws +dev/tws/tws_cam.c optional tws +dev/tws/tws_hdm.c optional tws +dev/tws/tws_services.c optional tws +dev/tws/tws_user.c optional tws dev/tx/if_tx.c optional tx dev/txp/if_txp.c optional txp dev/uart/uart_bus_acpi.c optional uart acpi Modified: stable/9/sys/i386/conf/GENERIC ============================================================================== --- stable/9/sys/i386/conf/GENERIC Fri Oct 7 18:01:34 2011 (r226114) +++ stable/9/sys/i386/conf/GENERIC Fri Oct 7 20:40:45 2011 (r226115) @@ -147,6 +147,7 @@ device iir # Intel Integrated RAID device ips # IBM (Adaptec) ServeRAID device mly # Mylex AcceleRAID/eXtremeRAID device twa # 3ware 9000 series PATA/SATA RAID +device tws # LSI 3ware 9750 SATA+SAS 6Gb/s RAID controller # RAID controllers device aac # Adaptec FSA RAID Modified: stable/9/sys/modules/Makefile ============================================================================== --- stable/9/sys/modules/Makefile Fri Oct 7 18:01:34 2011 (r226114) +++ stable/9/sys/modules/Makefile Fri Oct 7 20:40:45 2011 (r226115) @@ -302,6 +302,7 @@ SUBDIR= ${_3dfx} \ trm \ ${_twa} \ twe \ + tws \ tx \ txp \ uart \