From owner-svn-src-stable-9@FreeBSD.ORG Mon Oct 21 05:57:37 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 8A291D79; Mon, 21 Oct 2013 05:57:37 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 755052BFD; Mon, 21 Oct 2013 05:57:37 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9L5vbEf058800; Mon, 21 Oct 2013 05:57:37 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9L5vbcN058799; Mon, 21 Oct 2013 05:57:37 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201310210557.r9L5vbcN058799@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 21 Oct 2013 05:57:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r256825 - stable/9/sys/dev/nfe X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 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, 21 Oct 2013 05:57:37 -0000 Author: yongari Date: Mon Oct 21 05:57:36 2013 New Revision: 256825 URL: http://svnweb.freebsd.org/changeset/base/256825 Log: MFC r256038: Fix clearing MAC stats registers. Previously it cleared every fourth register. Submitted by: Paul A. Patience Modified: stable/9/sys/dev/nfe/if_nfe.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/nfe/if_nfe.c ============================================================================== --- stable/9/sys/dev/nfe/if_nfe.c Mon Oct 21 05:14:00 2013 (r256824) +++ stable/9/sys/dev/nfe/if_nfe.c Mon Oct 21 05:57:36 2013 (r256825) @@ -3206,8 +3206,8 @@ nfe_stats_clear(struct nfe_softc *sc) else return; - for (i = 0; i < mib_cnt; i += sizeof(uint32_t)) - NFE_READ(sc, NFE_TX_OCTET + i); + for (i = 0; i < mib_cnt; i++) + NFE_READ(sc, NFE_TX_OCTET + i * sizeof(uint32_t)); if ((sc->nfe_flags & NFE_MIB_V3) != 0) { NFE_READ(sc, NFE_TX_UNICAST); From owner-svn-src-stable-9@FreeBSD.ORG Mon Oct 21 18:20:22 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 0887FB97; Mon, 21 Oct 2013 18:20:22 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id DB3F32AF4; Mon, 21 Oct 2013 18:20:21 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9LIKLXn063551; Mon, 21 Oct 2013 18:20:21 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9LIKKNa063541; Mon, 21 Oct 2013 18:20:20 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201310211820.r9LIKKNa063541@svn.freebsd.org> From: Ed Maste Date: Mon, 21 Oct 2013 18:20:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r256851 - stable/9/contrib/gdb/gdb X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 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, 21 Oct 2013 18:20:22 -0000 Author: emaste Date: Mon Oct 21 18:20:20 2013 New Revision: 256851 URL: http://svnweb.freebsd.org/changeset/base/256851 Log: MFC r244437: Support restrict qualifier in dwarf debug info Newer clang/llvm emit DW_TAG_restrict_type, which wasn't handled by gdb. Import support from Apple's gdb-1822: | 2009-03-24 Jason Molenda (jmolenda@apple.com) | | * gdbtypes.c (make_cv_type): Rename this function to make_cvr_type to | also handle restrict qualifiers. | (check_typedef): Handle TYPE_RESTRICT. | * gdbtypes.h (TYPE_FLAG_RESTRICT, TYPE_RESTRICT): New. | * hpread.c (hpread_type_lookup): Update to use make_cvr_type. | * stabsread.c (read_type): Pass the restrict qualifiers along. | * parse.c (follow_types): Pass the restrict qualifiers along. | * dwarf2read.c (read_tag_const_type): Call make_cvr_type. | (read_tag_volatile_type): Same. | (read_tag_restrict_type): New function. | (read_type_die): Handle DW_TAG_restrict_type. Obtained from: Apple Modified: stable/9/contrib/gdb/gdb/dwarf2read.c stable/9/contrib/gdb/gdb/gdbtypes.c stable/9/contrib/gdb/gdb/gdbtypes.h stable/9/contrib/gdb/gdb/hpread.c stable/9/contrib/gdb/gdb/parse.c stable/9/contrib/gdb/gdb/stabsread.c Directory Properties: stable/9/contrib/gdb/ (props changed) Modified: stable/9/contrib/gdb/gdb/dwarf2read.c ============================================================================== --- stable/9/contrib/gdb/gdb/dwarf2read.c Mon Oct 21 16:46:12 2013 (r256850) +++ stable/9/contrib/gdb/gdb/dwarf2read.c Mon Oct 21 18:20:20 2013 (r256851) @@ -834,6 +834,8 @@ static void read_tag_const_type (struct static void read_tag_volatile_type (struct die_info *, struct dwarf2_cu *); +static void read_tag_restrict_type (struct die_info *, struct dwarf2_cu *); + static void read_tag_string_type (struct die_info *, struct dwarf2_cu *); static void read_subroutine_type (struct die_info *, struct dwarf2_cu *); @@ -3729,7 +3731,8 @@ read_tag_const_type (struct die_info *di } base_type = die_type (die, cu); - die->type = make_cv_type (1, TYPE_VOLATILE (base_type), base_type, 0); + die->type = make_cvr_type (1, TYPE_VOLATILE (base_type), + TYPE_RESTRICT (base_type), base_type, 0); } static void @@ -3743,7 +3746,23 @@ read_tag_volatile_type (struct die_info } base_type = die_type (die, cu); - die->type = make_cv_type (TYPE_CONST (base_type), 1, base_type, 0); + die->type = make_cvr_type (TYPE_CONST (base_type), 1, + TYPE_RESTRICT (base_type), base_type, 0); +} + +static void +read_tag_restrict_type (struct die_info *die, struct dwarf2_cu *cu) +{ + struct type *base_type; + + if (die->type) + { + return; + } + + base_type = die_type (die, cu); + die->type = make_cvr_type (TYPE_CONST (base_type), TYPE_VOLATILE (base_type), + 1, base_type, 0); } /* Extract all information from a DW_TAG_string_type DIE and add to @@ -6086,6 +6105,9 @@ read_type_die (struct die_info *die, str case DW_TAG_volatile_type: read_tag_volatile_type (die, cu); break; + case DW_TAG_restrict_type: + read_tag_restrict_type (die, cu); + break; case DW_TAG_string_type: read_tag_string_type (die, cu); break; Modified: stable/9/contrib/gdb/gdb/gdbtypes.c ============================================================================== --- stable/9/contrib/gdb/gdb/gdbtypes.c Mon Oct 21 16:46:12 2013 (r256850) +++ stable/9/contrib/gdb/gdb/gdbtypes.c Mon Oct 21 18:20:20 2013 (r256851) @@ -502,7 +502,8 @@ make_type_with_address_space (struct typ We allocate new memory if needed. */ struct type * -make_cv_type (int cnst, int voltl, struct type *type, struct type **typeptr) +make_cvr_type (int cnst, int voltl, int restrct, struct type *type, + struct type **typeptr) { struct type *ntype; /* New type */ struct type *tmp_type = type; /* tmp type */ @@ -517,6 +518,9 @@ make_cv_type (int cnst, int voltl, struc if (voltl) new_flags |= TYPE_FLAG_VOLATILE; + if (restrct) + new_flags |= TYPE_FLAG_RESTRICT; + if (typeptr && *typeptr != NULL) { /* Objfile is per-core-type. This const-qualified type had best @@ -1371,7 +1375,7 @@ struct type * check_typedef (struct type *type) { struct type *orig_type = type; - int is_const, is_volatile; + int is_const, is_volatile, is_restrict; while (TYPE_CODE (type) == TYPE_CODE_TYPEDEF) { @@ -1407,6 +1411,7 @@ check_typedef (struct type *type) is_const = TYPE_CONST (type); is_volatile = TYPE_VOLATILE (type); + is_restrict = TYPE_RESTRICT (type); /* If this is a struct/class/union with no fields, then check whether a full definition exists somewhere else. This is for systems where a @@ -1424,7 +1429,7 @@ check_typedef (struct type *type) } newtype = lookup_transparent_type (name); if (newtype) - make_cv_type (is_const, is_volatile, newtype, &type); + make_cvr_type (is_const, is_volatile, is_restrict, newtype, &type); } /* Otherwise, rely on the stub flag being set for opaque/stubbed types */ else if (TYPE_STUB (type) && !currently_reading_symtab) @@ -1442,7 +1447,8 @@ check_typedef (struct type *type) } sym = lookup_symbol (name, 0, STRUCT_DOMAIN, 0, (struct symtab **) NULL); if (sym) - make_cv_type (is_const, is_volatile, SYMBOL_TYPE (sym), &type); + make_cvr_type (is_const, is_volatile, is_restrict, SYMBOL_TYPE (sym), + &type); } if (TYPE_TARGET_STUB (type)) Modified: stable/9/contrib/gdb/gdb/gdbtypes.h ============================================================================== --- stable/9/contrib/gdb/gdb/gdbtypes.h Mon Oct 21 16:46:12 2013 (r256850) +++ stable/9/contrib/gdb/gdb/gdbtypes.h Mon Oct 21 18:20:20 2013 (r256851) @@ -273,6 +273,13 @@ enum type_code #define TYPE_ADDRESS_CLASS_ALL(t) (TYPE_INSTANCE_FLAGS(t) \ & TYPE_FLAG_ADDRESS_CLASS_ALL) +/* Restrict type. If this is set, the corresponding type has a + * restrict modifier. + */ + +#define TYPE_FLAG_RESTRICT (1 << 17) +#define TYPE_RESTRICT(t) (TYPE_INSTANCE_FLAGS (t) & TYPE_FLAG_RESTRICT) + /* Array bound type. */ enum array_bound_type { @@ -1099,7 +1106,8 @@ extern struct type *lookup_reference_typ extern struct type *make_reference_type (struct type *, struct type **); -extern struct type *make_cv_type (int, int, struct type *, struct type **); +extern struct type *make_cvr_type (int, int, int, struct type *, + struct type **); extern void replace_type (struct type *, struct type *); Modified: stable/9/contrib/gdb/gdb/hpread.c ============================================================================== --- stable/9/contrib/gdb/gdb/hpread.c Mon Oct 21 16:46:12 2013 (r256850) +++ stable/9/contrib/gdb/gdb/hpread.c Mon Oct 21 18:20:20 2013 (r256851) @@ -4939,8 +4939,9 @@ hpread_type_lookup (dnttpointer hp_type, * "m_void" modifiers? Is static_flag really needed here? * (m_static used for methods of classes, elsewhere). */ - tmp_type = make_cv_type (dn_bufp->dmodifier.m_const, + tmp_type = make_cvr_type (dn_bufp->dmodifier.m_const, dn_bufp->dmodifier.m_volatile, + 0, hpread_type_lookup (dn_bufp->dmodifier.type, objfile), 0); return tmp_type; Modified: stable/9/contrib/gdb/gdb/parse.c ============================================================================== --- stable/9/contrib/gdb/gdb/parse.c Mon Oct 21 16:46:12 2013 (r256850) +++ stable/9/contrib/gdb/gdb/parse.c Mon Oct 21 18:20:20 2013 (r256851) @@ -1167,13 +1167,15 @@ follow_types (struct type *follow_type) case tp_end: done = 1; if (make_const) - follow_type = make_cv_type (make_const, - TYPE_VOLATILE (follow_type), - follow_type, 0); + follow_type = make_cvr_type (make_const, + TYPE_VOLATILE (follow_type), + TYPE_RESTRICT (follow_type), + follow_type, 0); if (make_volatile) - follow_type = make_cv_type (TYPE_CONST (follow_type), - make_volatile, - follow_type, 0); + follow_type = make_cvr_type (TYPE_CONST (follow_type), + make_volatile, + TYPE_RESTRICT (follow_type), + follow_type, 0); if (make_addr_space) follow_type = make_type_with_address_space (follow_type, make_addr_space); @@ -1192,13 +1194,15 @@ follow_types (struct type *follow_type) case tp_pointer: follow_type = lookup_pointer_type (follow_type); if (make_const) - follow_type = make_cv_type (make_const, - TYPE_VOLATILE (follow_type), - follow_type, 0); + follow_type = make_cvr_type (make_const, + TYPE_VOLATILE (follow_type), + TYPE_RESTRICT (follow_type), + follow_type, 0); if (make_volatile) - follow_type = make_cv_type (TYPE_CONST (follow_type), - make_volatile, - follow_type, 0); + follow_type = make_cvr_type (TYPE_CONST (follow_type), + make_volatile, + TYPE_RESTRICT (follow_type), + follow_type, 0); if (make_addr_space) follow_type = make_type_with_address_space (follow_type, make_addr_space); @@ -1208,13 +1212,15 @@ follow_types (struct type *follow_type) case tp_reference: follow_type = lookup_reference_type (follow_type); if (make_const) - follow_type = make_cv_type (make_const, - TYPE_VOLATILE (follow_type), - follow_type, 0); + follow_type = make_cvr_type (make_const, + TYPE_VOLATILE (follow_type), + TYPE_RESTRICT (follow_type), + follow_type, 0); if (make_volatile) - follow_type = make_cv_type (TYPE_CONST (follow_type), - make_volatile, - follow_type, 0); + follow_type = make_cvr_type (TYPE_CONST (follow_type), + make_volatile, + TYPE_RESTRICT (follow_type), + follow_type, 0); if (make_addr_space) follow_type = make_type_with_address_space (follow_type, make_addr_space); Modified: stable/9/contrib/gdb/gdb/stabsread.c ============================================================================== --- stable/9/contrib/gdb/gdb/stabsread.c Mon Oct 21 16:46:12 2013 (r256850) +++ stable/9/contrib/gdb/gdb/stabsread.c Mon Oct 21 18:20:20 2013 (r256851) @@ -1750,13 +1750,13 @@ again: case 'k': /* Const qualifier on some type (Sun) */ type = read_type (pp, objfile); - type = make_cv_type (1, TYPE_VOLATILE (type), type, + type = make_cvr_type (1, TYPE_VOLATILE (type), TYPE_RESTRICT(type), type, dbx_lookup_type (typenums)); break; case 'B': /* Volatile qual on some type (Sun) */ type = read_type (pp, objfile); - type = make_cv_type (TYPE_CONST (type), 1, type, + type = make_cvr_type (TYPE_CONST (type), 1, TYPE_RESTRICT(type), type, dbx_lookup_type (typenums)); break; From owner-svn-src-stable-9@FreeBSD.ORG Mon Oct 21 18:23:17 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id CF608DA3; Mon, 21 Oct 2013 18:23:17 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id A2F782B3F; Mon, 21 Oct 2013 18:23:17 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9LINHRe066859; Mon, 21 Oct 2013 18:23:17 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9LINHRa066840; Mon, 21 Oct 2013 18:23:17 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201310211823.r9LINHRa066840@svn.freebsd.org> From: Ed Maste Date: Mon, 21 Oct 2013 18:23:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r256852 - in stable/9/contrib: binutils/include/elf gdb/gdb X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 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, 21 Oct 2013 18:23:17 -0000 Author: emaste Date: Mon Oct 21 18:23:16 2013 New Revision: 256852 URL: http://svnweb.freebsd.org/changeset/base/256852 Log: MFC r251665: Handle DW_TAG_rvalue_reference_type 2012-05-21 Jim Ingham * dwarf2read.c (process_die): Handle DW_TAG_rvalue_reference_type. (read_type_die): Ditto. (dwarf_tag_name): Ditto. * elf/dwarf2.h: Add DW_TAG_rvalue_reference_type. Obtained from: Apple, gdb-1820 Modified: stable/9/contrib/binutils/include/elf/dwarf2.h stable/9/contrib/gdb/gdb/dwarf2read.c Directory Properties: stable/9/contrib/binutils/ (props changed) stable/9/contrib/gdb/ (props changed) Modified: stable/9/contrib/binutils/include/elf/dwarf2.h ============================================================================== --- stable/9/contrib/binutils/include/elf/dwarf2.h Mon Oct 21 18:20:20 2013 (r256851) +++ stable/9/contrib/binutils/include/elf/dwarf2.h Mon Oct 21 18:23:16 2013 (r256852) @@ -189,6 +189,7 @@ enum dwarf_tag DW_TAG_imported_unit = 0x3d, DW_TAG_condition = 0x3f, DW_TAG_shared_type = 0x40, + DW_TAG_rvalue_reference_type = 0x42, /* SGI/MIPS Extensions. */ DW_TAG_MIPS_loop = 0x4081, /* HP extensions. See: ftp://ftp.hp.com/pub/lang/tools/WDB/wdb-4.0.tar.gz . */ Modified: stable/9/contrib/gdb/gdb/dwarf2read.c ============================================================================== --- stable/9/contrib/gdb/gdb/dwarf2read.c Mon Oct 21 18:20:20 2013 (r256851) +++ stable/9/contrib/gdb/gdb/dwarf2read.c Mon Oct 21 18:23:16 2013 (r256852) @@ -1977,6 +1977,7 @@ process_die (struct die_info *die, struc read_tag_ptr_to_member_type (die, cu); break; case DW_TAG_reference_type: + case DW_TAG_rvalue_reference_type: read_tag_reference_type (die, cu); break; case DW_TAG_string_type: @@ -6097,6 +6098,7 @@ read_type_die (struct die_info *die, str read_tag_ptr_to_member_type (die, cu); break; case DW_TAG_reference_type: + case DW_TAG_rvalue_reference_type: read_tag_reference_type (die, cu); break; case DW_TAG_const_type: @@ -6425,6 +6427,8 @@ dwarf_tag_name (unsigned tag) return "DW_TAG_pointer_type"; case DW_TAG_reference_type: return "DW_TAG_reference_type"; + case DW_TAG_rvalue_reference_type: + return "DW_TAG_rvalue_reference_type"; case DW_TAG_compile_unit: return "DW_TAG_compile_unit"; case DW_TAG_string_type: From owner-svn-src-stable-9@FreeBSD.ORG Mon Oct 21 18:25:36 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id C3020FEC; Mon, 21 Oct 2013 18:25:36 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 948182B62; Mon, 21 Oct 2013 18:25:36 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9LIPaxm067874; Mon, 21 Oct 2013 18:25:36 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9LIPavK067873; Mon, 21 Oct 2013 18:25:36 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201310211825.r9LIPavK067873@svn.freebsd.org> From: Ed Maste Date: Mon, 21 Oct 2013 18:25:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r256853 - stable/9/contrib/gdb/gdb X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 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, 21 Oct 2013 18:25:36 -0000 Author: emaste Date: Mon Oct 21 18:25:36 2013 New Revision: 256853 URL: http://svnweb.freebsd.org/changeset/base/256853 Log: MFC r251667: Handle DW_TAG_unspecified_type 2011-11-14 Jim Ingham * dwarf2read.c (read_type_die): Handle DW_TAG_unspecified_type. (read_tag_unspecified_type): New function, add a type for the DW_TAG_unspecified_type die. Obtained from: Apple, gdb-1752 Modified: stable/9/contrib/gdb/gdb/dwarf2read.c Directory Properties: stable/9/contrib/gdb/ (props changed) Modified: stable/9/contrib/gdb/gdb/dwarf2read.c ============================================================================== --- stable/9/contrib/gdb/gdb/dwarf2read.c Mon Oct 21 18:23:16 2013 (r256852) +++ stable/9/contrib/gdb/gdb/dwarf2read.c Mon Oct 21 18:25:36 2013 (r256853) @@ -825,6 +825,8 @@ static void read_array_type (struct die_ static void read_tag_pointer_type (struct die_info *, struct dwarf2_cu *); +static void read_tag_unspecified_type (struct die_info *, struct dwarf2_cu *); + static void read_tag_ptr_to_member_type (struct die_info *, struct dwarf2_cu *); @@ -3722,6 +3724,27 @@ read_tag_reference_type (struct die_info } static void +read_tag_unspecified_type (struct die_info *die, struct dwarf2_cu *cu) +{ + struct objfile *objfile = cu->objfile; + struct type *type; + struct attribute *attr; + + if (die->type) + { + return; + } + + type = alloc_type (objfile); + TYPE_LENGTH (type) = 0; + attr = dwarf2_attr (die, DW_AT_name, cu); + if (attr && DW_STRING (attr)) + TYPE_NAME (type) = DW_STRING (attr); + + die->type = type; +} + +static void read_tag_const_type (struct die_info *die, struct dwarf2_cu *cu) { struct type *base_type; @@ -6094,6 +6117,9 @@ read_type_die (struct die_info *die, str case DW_TAG_pointer_type: read_tag_pointer_type (die, cu); break; + case DW_TAG_unspecified_type: + read_tag_unspecified_type (die, cu); + break; case DW_TAG_ptr_to_member_type: read_tag_ptr_to_member_type (die, cu); break; From owner-svn-src-stable-9@FreeBSD.ORG Mon Oct 21 18:26:23 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id A662C25D; Mon, 21 Oct 2013 18:26:23 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 48EAC2B6B; Mon, 21 Oct 2013 18:26:23 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9LIQNfX068244; Mon, 21 Oct 2013 18:26:23 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9LIQNWi068243; Mon, 21 Oct 2013 18:26:23 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201310211826.r9LIQNWi068243@svn.freebsd.org> From: Ed Maste Date: Mon, 21 Oct 2013 18:26:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r256854 - stable/9/contrib/gdb/gdb X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 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, 21 Oct 2013 18:26:23 -0000 Author: emaste Date: Mon Oct 21 18:26:22 2013 New Revision: 256854 URL: http://svnweb.freebsd.org/changeset/base/256854 Log: MFC r251844: Include die tag in error message Modified: stable/9/contrib/gdb/gdb/dwarf2read.c Directory Properties: stable/9/contrib/gdb/ (props changed) Modified: stable/9/contrib/gdb/gdb/dwarf2read.c ============================================================================== --- stable/9/contrib/gdb/gdb/dwarf2read.c Mon Oct 21 18:25:36 2013 (r256853) +++ stable/9/contrib/gdb/gdb/dwarf2read.c Mon Oct 21 18:26:22 2013 (r256854) @@ -6082,8 +6082,8 @@ tag_type_to_type (struct die_info *die, if (!die->type) { dump_die (die); - error ("Dwarf Error: Cannot find type of die [in module %s]", - cu->objfile->name); + error ("Dwarf Error: Cannot find type of die 0x%x [in module %s]", + die->tag, cu->objfile->name); } return die->type; } From owner-svn-src-stable-9@FreeBSD.ORG Tue Oct 22 09:58:32 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 1B6D8A5C; Tue, 22 Oct 2013 09:58:32 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id ED31A2CCD; Tue, 22 Oct 2013 09:58:31 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9M9wVJo082403; Tue, 22 Oct 2013 09:58:31 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9M9wVqx082402; Tue, 22 Oct 2013 09:58:31 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201310220958.r9M9wVqx082402@svn.freebsd.org> From: Gleb Smirnoff Date: Tue, 22 Oct 2013 09:58:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r256882 - stable/9/sys/contrib/pf/net X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 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, 22 Oct 2013 09:58:32 -0000 Author: glebius Date: Tue Oct 22 09:58:31 2013 New Revision: 256882 URL: http://svnweb.freebsd.org/changeset/base/256882 Log: Merge r255143 from head: Merge 1.12 of pf_lb.c from OpenBSD, with some changes. Original commit: date: 2010/02/04 14:10:12; author: sthen; state: Exp; lines: +24 -19; pf_get_sport() picks a random port from the port range specified in a nat rule. It should check to see if it's in-use (i.e. matches an existing PF state), if it is, it cycles sequentially through other ports until it finds a free one. However the check was being done with the state keys the wrong way round so it was never actually finding the state to be in-use. - switch the keys to correct this, avoiding random state collisions with nat. Fixes PR 6300 and problems reported by robert@ and viq. - check pf_get_sport() return code in pf_test(); if port allocation fails the packet should be dropped rather than sent out untranslated. Help/ok claudio@. Some additional changes to 1.12: - We also need to bzero() the key to zero padding, otherwise key won't match. - Collapse two if blocks into one with ||, since both conditions lead to the same processing. - Only naddr changes in the cycle, so move initialization of other fields above the cycle. - s/u_intXX_t/uintXX_t/g PR: kern/181690 Submitted by: Olivier Cochard-Labbé Sponsored by: Nginx, Inc. Modified: stable/9/sys/contrib/pf/net/pf_lb.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/contrib/pf/ (props changed) Modified: stable/9/sys/contrib/pf/net/pf_lb.c ============================================================================== --- stable/9/sys/contrib/pf/net/pf_lb.c Tue Oct 22 09:43:14 2013 (r256881) +++ stable/9/sys/contrib/pf/net/pf_lb.c Tue Oct 22 09:58:31 2013 (r256882) @@ -165,8 +165,8 @@ struct pf_rule *pf_match_translation(st struct pf_addr *, u_int16_t, struct pf_addr *, u_int16_t, int); int pf_get_sport(sa_family_t, u_int8_t, struct pf_rule *, - struct pf_addr *, struct pf_addr *, u_int16_t, - struct pf_addr *, u_int16_t*, u_int16_t, u_int16_t, + struct pf_addr *, uint16_t, struct pf_addr *, uint16_t, + struct pf_addr *, uint16_t*, uint16_t, uint16_t, struct pf_src_node **); #define mix(a,b,c) \ @@ -318,13 +318,13 @@ pf_match_translation(struct pf_pdesc *pd int pf_get_sport(sa_family_t af, u_int8_t proto, struct pf_rule *r, - struct pf_addr *saddr, struct pf_addr *daddr, u_int16_t dport, - struct pf_addr *naddr, u_int16_t *nport, u_int16_t low, u_int16_t high, - struct pf_src_node **sn) + struct pf_addr *saddr, uint16_t sport, struct pf_addr *daddr, + uint16_t dport, struct pf_addr *naddr, uint16_t *nport, uint16_t low, + uint16_t high, struct pf_src_node **sn) { struct pf_state_key_cmp key; struct pf_addr init_addr; - u_int16_t cut; + uint16_t cut; bzero(&init_addr, sizeof(init_addr)); if (pf_map_addr(af, r, saddr, naddr, &init_addr, sn)) @@ -335,34 +335,38 @@ pf_get_sport(sa_family_t af, u_int8_t pr high = 65535; } + bzero(&key,sizeof(key)); + key.af = af; + key.proto = proto; + key.port[0] = dport; + PF_ACPY(&key.addr[0], daddr, key.af); + do { - key.af = af; - key.proto = proto; - PF_ACPY(&key.addr[1], daddr, key.af); - PF_ACPY(&key.addr[0], naddr, key.af); - key.port[1] = dport; + PF_ACPY(&key.addr[1], naddr, key.af); /* * port search; start random, step; * similar 2 portloop in in_pcbbind */ if (!(proto == IPPROTO_TCP || proto == IPPROTO_UDP || - proto == IPPROTO_ICMP)) { - key.port[0] = dport; - if (pf_find_state_all(&key, PF_IN, NULL) == NULL) - return (0); - } else if (low == 0 && high == 0) { - key.port[0] = *nport; - if (pf_find_state_all(&key, PF_IN, NULL) == NULL) + proto == IPPROTO_ICMP) || (low == 0 && high == 0)) { + /* + * XXX bug: icmp state don't use the id on both sides. + * (traceroute -l through nat) + */ + key.port[1] = sport; + if (pf_find_state_all(&key, PF_IN, NULL) == NULL) { + *nport = sport; return (0); + } } else if (low == high) { - key.port[0] = htons(low); + key.port[1] = htons(low); if (pf_find_state_all(&key, PF_IN, NULL) == NULL) { *nport = htons(low); return (0); } } else { - u_int16_t tmp; + uint16_t tmp; if (low > high) { tmp = low; @@ -377,7 +381,7 @@ pf_get_sport(sa_family_t af, u_int8_t pr #endif /* low <= cut <= high */ for (tmp = cut; tmp <= high; ++(tmp)) { - key.port[0] = htons(tmp); + key.port[1] = htons(tmp); if (pf_find_state_all(&key, PF_IN, NULL) == #ifdef __FreeBSD__ NULL) { @@ -389,7 +393,7 @@ pf_get_sport(sa_family_t af, u_int8_t pr } } for (tmp = cut - 1; tmp >= low; --(tmp)) { - key.port[0] = htons(tmp); + key.port[1] = htons(tmp); if (pf_find_state_all(&key, PF_IN, NULL) == #ifdef __FreeBSD__ NULL) { @@ -655,8 +659,8 @@ pf_get_translation(struct pf_pdesc *pd, case PF_NORDR: return (NULL); case PF_NAT: - if (pf_get_sport(pd->af, pd->proto, r, saddr, - daddr, dport, naddr, nport, r->rpool.proxy_port[0], + if (pf_get_sport(pd->af, pd->proto, r, saddr, sport, daddr, + dport, naddr, nport, r->rpool.proxy_port[0], r->rpool.proxy_port[1], sn)) { DPFPRINTF(PF_DEBUG_MISC, ("pf: NAT proxy port allocation " From owner-svn-src-stable-9@FreeBSD.ORG Tue Oct 22 16:13:17 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id DDB79251; Tue, 22 Oct 2013 16:13:16 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id C9BAD2567; Tue, 22 Oct 2013 16:13:16 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9MGDGSx099378; Tue, 22 Oct 2013 16:13:16 GMT (envelope-from cperciva@svn.freebsd.org) Received: (from cperciva@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9MGDF7w099373; Tue, 22 Oct 2013 16:13:15 GMT (envelope-from cperciva@svn.freebsd.org) Message-Id: <201310221613.r9MGDF7w099373@svn.freebsd.org> From: Colin Percival Date: Tue, 22 Oct 2013 16:13:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r256917 - in stable/9: etc etc/defaults share/man/man5 share/man/man8 sys/sys X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 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, 22 Oct 2013 16:13:17 -0000 Author: cperciva Date: Tue Oct 22 16:13:15 2013 New Revision: 256917 URL: http://svnweb.freebsd.org/changeset/base/256917 Log: MFC r256775,r256776: Add support for "first boot" rc.d scripts. Document this new functionality in rc.conf(5) and rc(8). Bump __FreeBSD_version so that ports can make use of this. Modified: stable/9/etc/defaults/rc.conf stable/9/etc/rc stable/9/share/man/man5/rc.conf.5 stable/9/share/man/man8/rc.8 stable/9/sys/sys/param.h Directory Properties: stable/9/etc/ (props changed) stable/9/share/man/man5/ (props changed) stable/9/share/man/man8/ (props changed) stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) stable/9/sys/sys/ (props changed) Modified: stable/9/etc/defaults/rc.conf ============================================================================== --- stable/9/etc/defaults/rc.conf Tue Oct 22 16:09:44 2013 (r256916) +++ stable/9/etc/defaults/rc.conf Tue Oct 22 16:13:15 2013 (r256917) @@ -613,6 +613,9 @@ quotacheck_flags="-a" # Check all file s accounting_enable="NO" # Turn on process accounting (or NO). ibcs2_enable="NO" # Ibcs2 (SCO) emulation loaded at startup (or NO). ibcs2_loaders="coff" # List of additional Ibcs2 loaders (or NO). +firstboot_sentinel="/firstboot" # Scripts with "firstboot" keyword are run if + # this file exists. Should be on a R/W filesystem so + # the file can be deleted after the boot completes. # Emulation/compatibility services provided by /etc/rc.d/abi sysvipc_enable="NO" # Load System V IPC primitives at startup (or NO). Modified: stable/9/etc/rc ============================================================================== --- stable/9/etc/rc Tue Oct 22 16:09:44 2013 (r256916) +++ stable/9/etc/rc Tue Oct 22 16:13:15 2013 (r256917) @@ -82,10 +82,15 @@ if [ `/sbin/sysctl -n security.jail.jail fi fi +# If the firstboot sentinel doesn't exist, we want to skip firstboot scripts. +if ! [ -e ${firstboot_sentinel} ]; then + skip_firstboot="-s firstboot" +fi + # Do a first pass to get everything up to $early_late_divider so that # we can do a second pass that includes $local_startup directories # -files=`rcorder ${skip} /etc/rc.d/* 2>/dev/null` +files=`rcorder ${skip} ${skip_firstboot} /etc/rc.d/* 2>/dev/null` _rc_elem_done=' ' for _rc_elem in ${files}; do @@ -107,7 +112,13 @@ case ${local_startup} in *) find_local_scripts_new ;; esac -files=`rcorder ${skip} /etc/rc.d/* ${local_rc} 2>/dev/null` +# The firstboot sentinel might be on a newly mounted filesystem; look for it +# again and unset skip_firstboot if we find it. +if [ -e ${firstboot_sentinel} ]; then + skip_firstboot="" +fi + +files=`rcorder ${skip} ${skip_firstboot} /etc/rc.d/* ${local_rc} 2>/dev/null` for _rc_elem in ${files}; do case "$_rc_elem_done" in *" $_rc_elem "*) continue ;; @@ -116,6 +127,15 @@ for _rc_elem in ${files}; do run_rc_script ${_rc_elem} ${_boot} done +# Remove the firstboot sentinel, and reboot if it was requested. +if [ -e ${firstboot_sentinel} ]; then + rm ${firstboot_sentinel} + if [ -e ${firstboot_sentinel}-reboot ]; then + rm ${firstboot_sentinel}-reboot + kill -INT 1 + fi +fi + echo '' date exit 0 Modified: stable/9/share/man/man5/rc.conf.5 ============================================================================== --- stable/9/share/man/man5/rc.conf.5 Tue Oct 22 16:09:44 2013 (r256916) +++ stable/9/share/man/man5/rc.conf.5 Tue Oct 22 16:13:15 2013 (r256917) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 12, 2013 +.Dd October 19, 2013 .Dt RC.CONF 5 .Os .Sh NAME @@ -3629,6 +3629,23 @@ and if is set to .Dq Li YES , this specifies a list of additional iBCS2 loaders to enable. +.It Va firstboot_sentinel +.Pq Vt str +This variable specifies the full path to a +.Dq first boot +sentinel file. +If a file exists with this path, +.Pa rc.d +scripts with the +.Dq firstboot +keyword will be run on startup and the sentinel file will be deleted +after the boot process completes. +The sentinel file must be located on a writable file system which is +mounted no later than +.Va early_late_divider +to function properly. +The default is +.Pa /firstboot . .It Va linux_enable .Pq Vt bool Set to Modified: stable/9/share/man/man8/rc.8 ============================================================================== --- stable/9/share/man/man8/rc.8 Tue Oct 22 16:09:44 2013 (r256916) +++ stable/9/share/man/man8/rc.8 Tue Oct 22 16:13:15 2013 (r256917) @@ -35,7 +35,7 @@ .\" @(#)rc.8 8.2 (Berkeley) 12/11/93 .\" $FreeBSD$ .\" -.Dd November 17, 2009 +.Dd October 19, 2013 .Dt RC 8 .Os .Sh NAME @@ -129,6 +129,13 @@ and add (only allow vnet-enabled jails) to the list of KEYWORDS to skip in .Xr rcorder 8 . .It +If the file +.Va ${firstboot_sentinel} +does not exist, add +.Dq Li firstboot +to the list of KEYWORDS to skip in +.Xr rcorder 8 . +.It Invoke .Xr rcorder 8 to order the files in @@ -156,6 +163,11 @@ Stop processing when the script that is .Va $early_late_divider has been run. .It +Check again to see if the file +.Va ${firstboot_sentinel} +exists (in case it is located on a newly mounted file system) +and adjust the list of KEYWORDs to skip appropriately. +.It Re-run .Xr rcorder 8 , this time including the scripts in the @@ -164,6 +176,13 @@ directories. Ignore everything up to the .Va $early_late_divider , then start executing the scripts as described above. +.It +If the file +.Va ${firstboot_sentinel} +exists, delete it. +If the file +.Va ${firstboot_sentinel}-reboot +also exists (because it was created by a script), then delete it and reboot. .El .Ss Operation of Nm rc.shutdown .Bl -enum Modified: stable/9/sys/sys/param.h ============================================================================== --- stable/9/sys/sys/param.h Tue Oct 22 16:09:44 2013 (r256916) +++ stable/9/sys/sys/param.h Tue Oct 22 16:13:15 2013 (r256917) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 902503 /* Master, propagated to newvers */ +#define __FreeBSD_version 902504 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-stable-9@FreeBSD.ORG Tue Oct 22 19:49:19 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id BF81F956; Tue, 22 Oct 2013 19:49:19 +0000 (UTC) (envelope-from ambrisko@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id ABCB0231A; Tue, 22 Oct 2013 19:49:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9MJnJkZ015297; Tue, 22 Oct 2013 19:49:19 GMT (envelope-from ambrisko@svn.freebsd.org) Received: (from ambrisko@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9MJnJIt015296; Tue, 22 Oct 2013 19:49:19 GMT (envelope-from ambrisko@svn.freebsd.org) Message-Id: <201310221949.r9MJnJIt015296@svn.freebsd.org> From: Doug Ambrisko Date: Tue, 22 Oct 2013 19:49:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r256924 - stable/9/sys/dev/mfi X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 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, 22 Oct 2013 19:49:19 -0000 Author: ambrisko Date: Tue Oct 22 19:49:19 2013 New Revision: 256924 URL: http://svnweb.freebsd.org/changeset/base/256924 Log: MFC r255869: Add PCI device ID for MegaRAID Invader cards. This was the only change needed to make it work on my card. Modified: stable/9/sys/dev/mfi/mfi_pci.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/mfi/mfi_pci.c ============================================================================== --- stable/9/sys/dev/mfi/mfi_pci.c Tue Oct 22 18:55:52 2013 (r256923) +++ stable/9/sys/dev/mfi/mfi_pci.c Tue Oct 22 19:49:19 2013 (r256924) @@ -131,6 +131,7 @@ struct mfi_ident { {0x1000, 0x005b, 0x8086, 0x9265, MFI_FLAGS_SKINNY| MFI_FLAGS_TBOLT, "Intel (R) RAID Controller RS25DB080"}, {0x1000, 0x005b, 0x8086, 0x9285, MFI_FLAGS_SKINNY| MFI_FLAGS_TBOLT, "Intel (R) RAID Controller RS25NB008"}, {0x1000, 0x005b, 0xffff, 0xffff, MFI_FLAGS_SKINNY| MFI_FLAGS_TBOLT, "ThunderBolt"}, + {0x1000, 0x005d, 0xffff, 0xffff, MFI_FLAGS_SKINNY| MFI_FLAGS_TBOLT, "Invader"}, {0x1000, 0x0060, 0x1028, 0xffff, MFI_FLAGS_1078, "Dell PERC 6"}, {0x1000, 0x0060, 0xffff, 0xffff, MFI_FLAGS_1078, "LSI MegaSAS 1078"}, {0x1000, 0x0071, 0xffff, 0xffff, MFI_FLAGS_SKINNY, "Drake Skinny"}, From owner-svn-src-stable-9@FreeBSD.ORG Wed Oct 23 17:08:51 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 46A045A8; Wed, 23 Oct 2013 17:08:51 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 1941D2E2A; Wed, 23 Oct 2013 17:08:51 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9NH8ovV061653; Wed, 23 Oct 2013 17:08:50 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9NH8oVP061652; Wed, 23 Oct 2013 17:08:50 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201310231708.r9NH8oVP061652@svn.freebsd.org> From: Alexander Motin Date: Wed, 23 Oct 2013 17:08:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r256988 - stable/9/sys/cam X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 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, 23 Oct 2013 17:08:51 -0000 Author: mav Date: Wed Oct 23 17:08:50 2013 New Revision: 256988 URL: http://svnweb.freebsd.org/changeset/base/256988 Log: MFC r256188: Close the race on path ID allocation in xpt_bus_register() if two buses are registered simultaneously. Due to topology unlock between the ID allocation and the bus registration there is a chance that two buses may get the same IDs. That is supposed reason of lock assertion panic in CAM during initial bus scanning after new iscsid initiates two sessions same time. Modified: stable/9/sys/cam/cam_xpt.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/cam/cam_xpt.c ============================================================================== --- stable/9/sys/cam/cam_xpt.c Wed Oct 23 17:04:09 2013 (r256987) +++ stable/9/sys/cam/cam_xpt.c Wed Oct 23 17:08:50 2013 (r256988) @@ -2450,7 +2450,7 @@ xptsetasyncbusfunc(struct cam_eb *bus, v struct ccb_setasync *csa = (struct ccb_setasync *)arg; xpt_compile_path(&path, /*periph*/NULL, - bus->sim->path_id, + bus->path_id, CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD); xpt_setup_ccb(&cpi.ccb_h, &path, CAM_PRIORITY_NORMAL); @@ -3874,13 +3874,8 @@ xpt_bus_register(struct cam_sim *sim, de /* Couldn't satisfy request */ return (CAM_RESRC_UNAVAIL); } - if (strcmp(sim->sim_name, "xpt") != 0) { - sim->path_id = - xptpathid(sim->sim_name, sim->unit_number, sim->bus_id); - } TAILQ_INIT(&new_bus->et_entries); - new_bus->path_id = sim->path_id; cam_sim_hold(sim); new_bus->sim = sim; timevalclear(&new_bus->last_reset); @@ -3889,6 +3884,8 @@ xpt_bus_register(struct cam_sim *sim, de new_bus->generation = 0; xpt_lock_buses(); + sim->path_id = new_bus->path_id = + xptpathid(sim->sim_name, sim->unit_number, sim->bus_id); old_bus = TAILQ_FIRST(&xsoftc.xpt_busses); while (old_bus != NULL && old_bus->path_id < new_bus->path_id) @@ -3991,8 +3988,8 @@ xptnextfreepathid(void) path_id_t pathid; const char *strval; + mtx_assert(&xsoftc.xpt_topo_lock, MA_OWNED); pathid = 0; - xpt_lock_buses(); bus = TAILQ_FIRST(&xsoftc.xpt_busses); retry: /* Find an unoccupied pathid */ @@ -4001,7 +3998,6 @@ retry: pathid++; bus = TAILQ_NEXT(bus, links); } - xpt_unlock_buses(); /* * Ensure that this pathid is not reserved for @@ -4010,7 +4006,6 @@ retry: if (resource_string_value("scbus", pathid, "at", &strval) == 0) { ++pathid; /* Start the search over */ - xpt_lock_buses(); goto retry; } return (pathid); @@ -4026,6 +4021,8 @@ xptpathid(const char *sim_name, int sim_ pathid = CAM_XPT_PATH_ID; snprintf(buf, sizeof(buf), "%s%d", sim_name, sim_unit); + if (strcmp(buf, "xpt0") == 0 && sim_bus == 0) + return (pathid); i = 0; while ((resource_find_match(&i, &dname, &dunit, "at", buf)) == 0) { if (strcmp(dname, "scbus")) { From owner-svn-src-stable-9@FreeBSD.ORG Thu Oct 24 06:06:20 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 211FE1F9; Thu, 24 Oct 2013 06:06:20 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id F2CBF2B9E; Thu, 24 Oct 2013 06:06:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9O66JJ5031929; Thu, 24 Oct 2013 06:06:19 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9O66HXB031913; Thu, 24 Oct 2013 06:06:17 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201310240606.r9O66HXB031913@svn.freebsd.org> From: Hans Petter Selasky Date: Thu, 24 Oct 2013 06:06:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r257040 - in stable/9/sys: dev/usb dev/usb/controller mips/cavium/usb X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 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, 24 Oct 2013 06:06:20 -0000 Author: hselasky Date: Thu Oct 24 06:06:17 2013 New Revision: 257040 URL: http://svnweb.freebsd.org/changeset/base/257040 Log: MFC r241082: Inherit USB mode from RootHUB port where the USB device is connected. Only RootHUB ports can be dual mode. Disallow OTG ports on external HUBs. This simplifies some checks in the USB controller drivers. Modified: stable/9/sys/dev/usb/controller/at91dci.c stable/9/sys/dev/usb/controller/atmegadci.c stable/9/sys/dev/usb/controller/avr32dci.c stable/9/sys/dev/usb/controller/ehci.c stable/9/sys/dev/usb/controller/musb_otg.c stable/9/sys/dev/usb/controller/ohci.c stable/9/sys/dev/usb/controller/uhci.c stable/9/sys/dev/usb/controller/uss820dci.c stable/9/sys/dev/usb/controller/xhci.c stable/9/sys/dev/usb/usb_hub.c stable/9/sys/mips/cavium/usb/octusb.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/usb/controller/at91dci.c ============================================================================== --- stable/9/sys/dev/usb/controller/at91dci.c Thu Oct 24 05:01:49 2013 (r257039) +++ stable/9/sys/dev/usb/controller/at91dci.c Thu Oct 24 06:06:17 2013 (r257040) @@ -2277,10 +2277,6 @@ at91dci_ep_init(struct usb_device *udev, if (udev->device_index != sc->sc_rt_addr) { - if (udev->flags.usb_mode != USB_MODE_DEVICE) { - /* not supported */ - return; - } if (udev->speed != USB_SPEED_FULL) { /* not supported */ return; Modified: stable/9/sys/dev/usb/controller/atmegadci.c ============================================================================== --- stable/9/sys/dev/usb/controller/atmegadci.c Thu Oct 24 05:01:49 2013 (r257039) +++ stable/9/sys/dev/usb/controller/atmegadci.c Thu Oct 24 06:06:17 2013 (r257040) @@ -2110,10 +2110,6 @@ atmegadci_ep_init(struct usb_device *ude if (udev->device_index != sc->sc_rt_addr) { - if (udev->flags.usb_mode != USB_MODE_DEVICE) { - /* not supported */ - return; - } if (udev->speed != USB_SPEED_FULL) { /* not supported */ return; Modified: stable/9/sys/dev/usb/controller/avr32dci.c ============================================================================== --- stable/9/sys/dev/usb/controller/avr32dci.c Thu Oct 24 05:01:49 2013 (r257039) +++ stable/9/sys/dev/usb/controller/avr32dci.c Thu Oct 24 06:06:17 2013 (r257040) @@ -2054,10 +2054,6 @@ avr32dci_ep_init(struct usb_device *udev if (udev->device_index != sc->sc_rt_addr) { - if (udev->flags.usb_mode != USB_MODE_DEVICE) { - /* not supported */ - return; - } if ((udev->speed != USB_SPEED_FULL) && (udev->speed != USB_SPEED_HIGH)) { /* not supported */ Modified: stable/9/sys/dev/usb/controller/ehci.c ============================================================================== --- stable/9/sys/dev/usb/controller/ehci.c Thu Oct 24 05:01:49 2013 (r257039) +++ stable/9/sys/dev/usb/controller/ehci.c Thu Oct 24 06:06:17 2013 (r257040) @@ -3705,10 +3705,6 @@ ehci_ep_init(struct usb_device *udev, st edesc->bEndpointAddress, udev->flags.usb_mode, sc->sc_addr); - if (udev->flags.usb_mode != USB_MODE_HOST) { - /* not supported */ - return; - } if (udev->device_index != sc->sc_addr) { if ((udev->speed != USB_SPEED_HIGH) && Modified: stable/9/sys/dev/usb/controller/musb_otg.c ============================================================================== --- stable/9/sys/dev/usb/controller/musb_otg.c Thu Oct 24 05:01:49 2013 (r257039) +++ stable/9/sys/dev/usb/controller/musb_otg.c Thu Oct 24 06:06:17 2013 (r257040) @@ -2746,10 +2746,6 @@ musbotg_ep_init(struct usb_device *udev, if (udev->device_index != sc->sc_rt_addr) { - if (udev->flags.usb_mode != USB_MODE_DEVICE) { - /* not supported */ - return; - } if ((udev->speed != USB_SPEED_FULL) && (udev->speed != USB_SPEED_HIGH)) { /* not supported */ Modified: stable/9/sys/dev/usb/controller/ohci.c ============================================================================== --- stable/9/sys/dev/usb/controller/ohci.c Thu Oct 24 05:01:49 2013 (r257039) +++ stable/9/sys/dev/usb/controller/ohci.c Thu Oct 24 06:06:17 2013 (r257040) @@ -2314,6 +2314,7 @@ ohci_roothub_exec(struct usb_device *ude } v = OREAD4(sc, OHCI_RH_PORT_STATUS(index)); DPRINTFN(9, "port status=0x%04x\n", v); + v &= ~UPS_PORT_MODE_DEVICE; /* force host mode */ USETW(sc->sc_hub_desc.ps.wPortStatus, v); USETW(sc->sc_hub_desc.ps.wPortChange, v >> 16); len = sizeof(sc->sc_hub_desc.ps); @@ -2550,10 +2551,6 @@ ohci_ep_init(struct usb_device *udev, st edesc->bEndpointAddress, udev->flags.usb_mode, sc->sc_addr); - if (udev->flags.usb_mode != USB_MODE_HOST) { - /* not supported */ - return; - } if (udev->device_index != sc->sc_addr) { switch (edesc->bmAttributes & UE_XFERTYPE) { case UE_CONTROL: Modified: stable/9/sys/dev/usb/controller/uhci.c ============================================================================== --- stable/9/sys/dev/usb/controller/uhci.c Thu Oct 24 05:01:49 2013 (r257039) +++ stable/9/sys/dev/usb/controller/uhci.c Thu Oct 24 06:06:17 2013 (r257040) @@ -3029,10 +3029,6 @@ uhci_ep_init(struct usb_device *udev, st edesc->bEndpointAddress, udev->flags.usb_mode, sc->sc_addr); - if (udev->flags.usb_mode != USB_MODE_HOST) { - /* not supported */ - return; - } if (udev->device_index != sc->sc_addr) { switch (edesc->bmAttributes & UE_XFERTYPE) { case UE_CONTROL: Modified: stable/9/sys/dev/usb/controller/uss820dci.c ============================================================================== --- stable/9/sys/dev/usb/controller/uss820dci.c Thu Oct 24 05:01:49 2013 (r257039) +++ stable/9/sys/dev/usb/controller/uss820dci.c Thu Oct 24 06:06:17 2013 (r257040) @@ -2331,10 +2331,6 @@ uss820dci_ep_init(struct usb_device *ude if (udev->device_index != sc->sc_rt_addr) { - if (udev->flags.usb_mode != USB_MODE_DEVICE) { - /* not supported */ - return; - } if (udev->speed != USB_SPEED_FULL) { /* not supported */ return; Modified: stable/9/sys/dev/usb/controller/xhci.c ============================================================================== --- stable/9/sys/dev/usb/controller/xhci.c Thu Oct 24 05:01:49 2013 (r257039) +++ stable/9/sys/dev/usb/controller/xhci.c Thu Oct 24 06:06:17 2013 (r257040) @@ -3742,10 +3742,6 @@ xhci_ep_init(struct usb_device *udev, st DPRINTFN(2, "endpoint=%p, addr=%d, endpt=%d, mode=%d\n", ep, udev->address, edesc->bEndpointAddress, udev->flags.usb_mode); - if (udev->flags.usb_mode != USB_MODE_HOST) { - /* not supported */ - return; - } if (udev->parent_hub == NULL) { /* root HUB has special endpoint handling */ return; Modified: stable/9/sys/dev/usb/usb_hub.c ============================================================================== --- stable/9/sys/dev/usb/usb_hub.c Thu Oct 24 05:01:49 2013 (r257039) +++ stable/9/sys/dev/usb/usb_hub.c Thu Oct 24 06:06:17 2013 (r257040) @@ -519,7 +519,10 @@ repeat: * * NOTE: This part is currently FreeBSD specific. */ - if (sc->sc_st.port_status & UPS_PORT_MODE_DEVICE) + if (udev->parent_hub != NULL) { + /* inherit mode from the parent HUB */ + mode = udev->parent_hub->flags.usb_mode; + } else if (sc->sc_st.port_status & UPS_PORT_MODE_DEVICE) mode = USB_MODE_DEVICE; else mode = USB_MODE_HOST; Modified: stable/9/sys/mips/cavium/usb/octusb.c ============================================================================== --- stable/9/sys/mips/cavium/usb/octusb.c Thu Oct 24 05:01:49 2013 (r257039) +++ stable/9/sys/mips/cavium/usb/octusb.c Thu Oct 24 06:06:17 2013 (r257040) @@ -1851,10 +1851,6 @@ octusb_ep_init(struct usb_device *udev, ep, udev->address, edesc->bEndpointAddress, udev->flags.usb_mode, sc->sc_addr); - if (udev->flags.usb_mode != USB_MODE_HOST) { - /* not supported */ - return; - } if (udev->device_index != sc->sc_addr) { switch (edesc->bmAttributes & UE_XFERTYPE) { case UE_CONTROL: From owner-svn-src-stable-9@FreeBSD.ORG Thu Oct 24 06:22:43 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id EA1317B8; Thu, 24 Oct 2013 06:22:43 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id C96962C94; Thu, 24 Oct 2013 06:22:43 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9O6MhZa038740; Thu, 24 Oct 2013 06:22:43 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9O6Mh7s038738; Thu, 24 Oct 2013 06:22:43 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201310240622.r9O6Mh7s038738@svn.freebsd.org> From: Hans Petter Selasky Date: Thu, 24 Oct 2013 06:22:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r257041 - stable/9/sys/dev/usb/controller X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 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, 24 Oct 2013 06:22:44 -0000 Author: hselasky Date: Thu Oct 24 06:22:43 2013 New Revision: 257041 URL: http://svnweb.freebsd.org/changeset/base/257041 Log: MFC r252912, r254828 and r256548: Add host mode support to the Mentor Graphics USB OTG controller driver. PR: usb/181987 Modified: stable/9/sys/dev/usb/controller/musb_otg.c stable/9/sys/dev/usb/controller/musb_otg.h stable/9/sys/dev/usb/controller/musb_otg_atmelarm.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/usb/controller/musb_otg.c ============================================================================== --- stable/9/sys/dev/usb/controller/musb_otg.c Thu Oct 24 06:06:17 2013 (r257040) +++ stable/9/sys/dev/usb/controller/musb_otg.c Thu Oct 24 06:22:43 2013 (r257041) @@ -90,6 +90,8 @@ SYSCTL_INT(_hw_usb_musbotg, OID_AUTO, de &musbotgdebug, 0, "Debug level"); #endif +#define MAX_NAK_TO 16 + /* prototypes */ struct usb_bus_methods musbotg_bus_methods; @@ -98,17 +100,35 @@ struct usb_pipe_methods musbotg_device_c struct usb_pipe_methods musbotg_device_intr_methods; struct usb_pipe_methods musbotg_device_isoc_methods; -static musbotg_cmd_t musbotg_setup_rx; -static musbotg_cmd_t musbotg_setup_data_rx; -static musbotg_cmd_t musbotg_setup_data_tx; -static musbotg_cmd_t musbotg_setup_status; -static musbotg_cmd_t musbotg_data_rx; -static musbotg_cmd_t musbotg_data_tx; +/* Control transfers: Device mode */ +static musbotg_cmd_t musbotg_dev_ctrl_setup_rx; +static musbotg_cmd_t musbotg_dev_ctrl_data_rx; +static musbotg_cmd_t musbotg_dev_ctrl_data_tx; +static musbotg_cmd_t musbotg_dev_ctrl_status; + +/* Control transfers: Host mode */ +static musbotg_cmd_t musbotg_host_ctrl_setup_tx; +static musbotg_cmd_t musbotg_host_ctrl_data_rx; +static musbotg_cmd_t musbotg_host_ctrl_data_tx; +static musbotg_cmd_t musbotg_host_ctrl_status_rx; +static musbotg_cmd_t musbotg_host_ctrl_status_tx; + +/* Bulk, Interrupt, Isochronous: Device mode */ +static musbotg_cmd_t musbotg_dev_data_rx; +static musbotg_cmd_t musbotg_dev_data_tx; + +/* Bulk, Interrupt, Isochronous: Host mode */ +static musbotg_cmd_t musbotg_host_data_rx; +static musbotg_cmd_t musbotg_host_data_tx; + static void musbotg_device_done(struct usb_xfer *, usb_error_t); static void musbotg_do_poll(struct usb_bus *); static void musbotg_standard_done(struct usb_xfer *); static void musbotg_interrupt_poll(struct musbotg_softc *); static void musbotg_root_intr(struct musbotg_softc *); +static int musbotg_channel_alloc(struct musbotg_softc *, struct musbotg_td *td); +static void musbotg_channel_free(struct musbotg_softc *, struct musbotg_td *td); +static void musbotg_ep_int_set(struct musbotg_softc *sc, int channel, int on); /* * Here is a configuration that the chip supports. @@ -123,6 +143,64 @@ static const struct usb_hw_ep_profile mu } }; +static int +musbotg_channel_alloc(struct musbotg_softc *sc, struct musbotg_td *td) +{ + int ch; + int ep; + + ep = td->ep_no; + + /* In device mode each EP got its own channel */ + if (sc->sc_mode == MUSB2_DEVICE_MODE) { + musbotg_ep_int_set(sc, ep, 1); + return (ep); + } + + /* + * All control transactions go through EP0 + */ + if (ep == 0) { + if (sc->sc_channel_mask & (1 << 0)) + return (-1); + sc->sc_channel_mask |= (1 << 0); + musbotg_ep_int_set(sc, ep, 1); + return (0); + } + + for (ch = 1; ch < MUSB2_EP_MAX; ch++) { + if (!(sc->sc_channel_mask & (1 << ch))) { + sc->sc_channel_mask |= (1 << ch); + musbotg_ep_int_set(sc, ch, 1); + return (ch); + } + } + + DPRINTFN(-1, "No available channels. Mask: %04x\n", sc->sc_channel_mask); + + return (-1); +} + +static void +musbotg_channel_free(struct musbotg_softc *sc, struct musbotg_td *td) +{ + + DPRINTFN(1, "ep_no=%d\n", td->channel); + + if (sc->sc_mode == MUSB2_DEVICE_MODE) + return; + + if (td == NULL) + return; + if (td->channel == -1) + return; + + musbotg_ep_int_set(sc, td->channel, 0); + sc->sc_channel_mask &= ~(1 << td->channel); + + td->channel = -1; +} + static void musbotg_get_hw_ep_profile(struct usb_device *udev, const struct usb_hw_ep_profile **ppf, uint8_t ep_addr) @@ -213,6 +291,46 @@ musbotg_pull_down(struct musbotg_softc * } static void +musbotg_suspend_host(struct musbotg_softc *sc) +{ + uint8_t temp; + + if (sc->sc_flags.status_suspend) { + return; + } + + temp = MUSB2_READ_1(sc, MUSB2_REG_POWER); + temp |= MUSB2_MASK_SUSPMODE; + MUSB2_WRITE_1(sc, MUSB2_REG_POWER, temp); + sc->sc_flags.status_suspend = 1; +} + +static void +musbotg_wakeup_host(struct musbotg_softc *sc) +{ + uint8_t temp; + + if (!(sc->sc_flags.status_suspend)) { + return; + } + + temp = MUSB2_READ_1(sc, MUSB2_REG_POWER); + temp &= ~MUSB2_MASK_SUSPMODE; + temp |= MUSB2_MASK_RESUME; + MUSB2_WRITE_1(sc, MUSB2_REG_POWER, temp); + + /* wait 20 milliseconds */ + /* Wait for reset to complete. */ + usb_pause_mtx(&sc->sc_bus.bus_mtx, hz / 50); + + temp = MUSB2_READ_1(sc, MUSB2_REG_POWER); + temp &= ~MUSB2_MASK_RESUME; + MUSB2_WRITE_1(sc, MUSB2_REG_POWER, temp); + + sc->sc_flags.status_suspend = 0; +} + +static void musbotg_wakeup_peer(struct musbotg_softc *sc) { uint8_t temp; @@ -243,7 +361,7 @@ musbotg_set_address(struct musbotg_softc } static uint8_t -musbotg_setup_rx(struct musbotg_td *td) +musbotg_dev_ctrl_setup_rx(struct musbotg_td *td) { struct musbotg_softc *sc; struct usb_device_request req; @@ -253,6 +371,15 @@ musbotg_setup_rx(struct musbotg_td *td) /* get pointer to softc */ sc = MUSBOTG_PC2SC(td->pc); + if (td->channel == -1) + td->channel = musbotg_channel_alloc(sc, td); + + /* EP0 is busy, wait */ + if (td->channel == -1) + return (1); + + DPRINTFN(1, "ep_no=%d\n", td->channel); + /* select endpoint 0 */ MUSB2_WRITE_1(sc, MUSB2_REG_EPINDEX, 0); @@ -269,8 +396,10 @@ musbotg_setup_rx(struct musbotg_td *td) /* do not stall at this point */ td->did_stall = 1; /* wait for interrupt */ + DPRINTFN(0, "CSR0 DATAEND\n"); goto not_complete; } + if (csr & MUSB2_MASK_CSR0L_SENTSTALL) { /* clear SENTSTALL */ MUSB2_WRITE_1(sc, MUSB2_REG_TXCSRL, 0); @@ -289,6 +418,7 @@ musbotg_setup_rx(struct musbotg_td *td) sc->sc_ep0_busy = 0; } if (sc->sc_ep0_busy) { + DPRINTFN(0, "EP0 BUSY\n"); goto not_complete; } if (!(csr & MUSB2_MASK_CSR0L_RXPKTRDY)) { @@ -337,6 +467,8 @@ musbotg_setup_rx(struct musbotg_td *td) } else { sc->sc_dv_addr = 0xFF; } + + musbotg_channel_free(sc, td); return (0); /* complete */ not_complete: @@ -350,10 +482,117 @@ not_complete: return (1); /* not complete */ } +static uint8_t +musbotg_host_ctrl_setup_tx(struct musbotg_td *td) +{ + struct musbotg_softc *sc; + struct usb_device_request req; + uint8_t csr, csrh; + + /* get pointer to softc */ + sc = MUSBOTG_PC2SC(td->pc); + + if (td->channel == -1) + td->channel = musbotg_channel_alloc(sc, td); + + /* EP0 is busy, wait */ + if (td->channel == -1) + return (1); + + DPRINTFN(1, "ep_no=%d\n", td->channel); + + /* select endpoint 0 */ + MUSB2_WRITE_1(sc, MUSB2_REG_EPINDEX, 0); + + /* read out FIFO status */ + csr = MUSB2_READ_1(sc, MUSB2_REG_TXCSRL); + DPRINTFN(4, "csr=0x%02x\n", csr); + + /* Not ready yet yet */ + if (csr & MUSB2_MASK_CSR0L_TXPKTRDY) + return (1); + + /* Failed */ + if (csr & (MUSB2_MASK_CSR0L_RXSTALL | + MUSB2_MASK_CSR0L_ERROR)) + { + /* Clear status bit */ + MUSB2_WRITE_1(sc, MUSB2_REG_TXCSRL, 0); + DPRINTFN(1, "error bit set, csr=0x%02x\n", csr); + td->error = 1; + } + + if (csr & MUSB2_MASK_CSR0L_NAKTIMO) { + DPRINTFN(1, "NAK timeout\n"); + + if (csr & MUSB2_MASK_CSR0L_TXFIFONEMPTY) { + csrh = MUSB2_READ_1(sc, MUSB2_REG_TXCSRH); + csrh |= MUSB2_MASK_CSR0H_FFLUSH; + MUSB2_WRITE_1(sc, MUSB2_REG_TXCSRH, csrh); + csr = MUSB2_READ_1(sc, MUSB2_REG_TXCSRL); + if (csr & MUSB2_MASK_CSR0L_TXFIFONEMPTY) { + csrh = MUSB2_READ_1(sc, MUSB2_REG_TXCSRH); + csrh |= MUSB2_MASK_CSR0H_FFLUSH; + MUSB2_WRITE_1(sc, MUSB2_REG_TXCSRH, csrh); + csr = MUSB2_READ_1(sc, MUSB2_REG_TXCSRL); + } + } + + csr &= ~MUSB2_MASK_CSR0L_NAKTIMO; + MUSB2_WRITE_1(sc, MUSB2_REG_TXCSRL, csr); + + td->error = 1; + } + + if (td->error) { + musbotg_channel_free(sc, td); + return (0); + } + + /* Fifo is not empty and there is no NAK timeout */ + if (csr & MUSB2_MASK_CSR0L_TXPKTRDY) + return (1); + + /* check if we are complete */ + if (td->remainder == 0) { + /* we are complete */ + musbotg_channel_free(sc, td); + return (0); + } + + /* copy data into real buffer */ + usbd_copy_out(td->pc, 0, &req, sizeof(req)); + + /* send data */ + bus_space_write_multi_1(sc->sc_io_tag, sc->sc_io_hdl, + MUSB2_REG_EPFIFO(0), (void *)&req, sizeof(req)); + + /* update offset and remainder */ + td->offset += sizeof(req); + td->remainder -= sizeof(req); + + + MUSB2_WRITE_1(sc, MUSB2_REG_TXNAKLIMIT, MAX_NAK_TO); + MUSB2_WRITE_1(sc, MUSB2_REG_TXFADDR(0), td->dev_addr); + MUSB2_WRITE_1(sc, MUSB2_REG_TXHADDR(0), td->haddr); + MUSB2_WRITE_1(sc, MUSB2_REG_TXHUBPORT(0), td->hport); + MUSB2_WRITE_1(sc, MUSB2_REG_TXTI, td->transfer_type); + + /* write command */ + MUSB2_WRITE_1(sc, MUSB2_REG_TXCSRL, + MUSB2_MASK_CSR0L_TXPKTRDY | + MUSB2_MASK_CSR0L_SETUPPKT); + + /* Just to be consistent, not used above */ + td->transaction_started = 1; + + return (1); /* in progress */ +} + /* Control endpoint only data handling functions (RX/TX/SYNC) */ static uint8_t -musbotg_setup_data_rx(struct musbotg_td *td) +musbotg_dev_ctrl_data_rx(struct musbotg_td *td) { struct usb_page_search buf_res; struct musbotg_softc *sc; @@ -496,7 +735,7 @@ musbotg_setup_data_rx(struct musbotg_td } static uint8_t -musbotg_setup_data_tx(struct musbotg_td *td) +musbotg_dev_ctrl_data_tx(struct musbotg_td *td) { struct usb_page_search buf_res; struct musbotg_softc *sc; @@ -614,77 +853,943 @@ musbotg_setup_data_tx(struct musbotg_td } static uint8_t -musbotg_setup_status(struct musbotg_td *td) +musbotg_host_ctrl_data_rx(struct musbotg_td *td) { + struct usb_page_search buf_res; struct musbotg_softc *sc; + uint16_t count; uint8_t csr; + uint8_t got_short; /* get pointer to softc */ sc = MUSBOTG_PC2SC(td->pc); + if (td->channel == -1) + td->channel = musbotg_channel_alloc(sc, td); + + /* EP0 is busy, wait */ + if (td->channel == -1) + return (1); + + DPRINTFN(1, "ep_no=%d\n", td->channel); + /* select endpoint 0 */ MUSB2_WRITE_1(sc, MUSB2_REG_EPINDEX, 0); - if (sc->sc_ep0_busy) { - sc->sc_ep0_busy = 0; - sc->sc_ep0_cmd |= MUSB2_MASK_CSR0L_DATAEND; - MUSB2_WRITE_1(sc, MUSB2_REG_TXCSRL, sc->sc_ep0_cmd); - sc->sc_ep0_cmd = 0; - } /* read out FIFO status */ csr = MUSB2_READ_1(sc, MUSB2_REG_TXCSRL); DPRINTFN(4, "csr=0x%02x\n", csr); - if (csr & MUSB2_MASK_CSR0L_DATAEND) { - /* wait for interrupt */ - return (1); /* not complete */ + got_short = 0; + if (!td->transaction_started) { + td->transaction_started = 1; + + MUSB2_WRITE_1(sc, MUSB2_REG_RXNAKLIMIT, MAX_NAK_TO); + + MUSB2_WRITE_1(sc, MUSB2_REG_RXFADDR(0), + td->dev_addr); + MUSB2_WRITE_1(sc, MUSB2_REG_RXHADDR(0), td->haddr); + MUSB2_WRITE_1(sc, MUSB2_REG_RXHUBPORT(0), td->hport); + MUSB2_WRITE_1(sc, MUSB2_REG_RXTI, td->transfer_type); + + MUSB2_WRITE_1(sc, MUSB2_REG_TXCSRL, + MUSB2_MASK_CSR0L_REQPKT); + + return (1); + } + + if (csr & MUSB2_MASK_CSR0L_NAKTIMO) { + csr &= ~MUSB2_MASK_CSR0L_REQPKT; + MUSB2_WRITE_1(sc, MUSB2_REG_TXCSRL, csr); + + csr &= ~MUSB2_MASK_CSR0L_NAKTIMO; + MUSB2_WRITE_1(sc, MUSB2_REG_TXCSRL, csr); + + td->error = 1; + } + + /* Failed */ + if (csr & (MUSB2_MASK_CSR0L_RXSTALL | + MUSB2_MASK_CSR0L_ERROR)) + { + /* Clear status bit */ + MUSB2_WRITE_1(sc, MUSB2_REG_TXCSRL, 0); + DPRINTFN(1, "error bit set, csr=0x%02x\n", csr); + td->error = 1; + } + + if (td->error) { + musbotg_channel_free(sc, td); + return (0); /* we are complete */ + } + + if (!(csr & MUSB2_MASK_CSR0L_RXPKTRDY)) + return (1); /* not yet */ + + /* get the packet byte count */ + count = MUSB2_READ_2(sc, MUSB2_REG_RXCOUNT); + + /* verify the packet byte count */ + if (count != td->max_frame_size) { + if (count < td->max_frame_size) { + /* we have a short packet */ + td->short_pkt = 1; + got_short = 1; + } else { + /* invalid USB packet */ + td->error = 1; + musbotg_channel_free(sc, td); + return (0); /* we are complete */ + } + } + /* verify the packet byte count */ + if (count > td->remainder) { + /* invalid USB packet */ + td->error = 1; + musbotg_channel_free(sc, td); + return (0); /* we are complete */ + } + while (count > 0) { + uint32_t temp; + + usbd_get_page(td->pc, td->offset, &buf_res); + + /* get correct length */ + if (buf_res.length > count) { + buf_res.length = count; + } + /* check for unaligned memory address */ + if (USB_P2U(buf_res.buffer) & 3) { + + temp = count & ~3; + + if (temp) { + /* receive data 4 bytes at a time */ + bus_space_read_multi_4(sc->sc_io_tag, sc->sc_io_hdl, + MUSB2_REG_EPFIFO(0), sc->sc_bounce_buf, + temp / 4); + } + temp = count & 3; + if (temp) { + /* receive data 1 byte at a time */ + bus_space_read_multi_1(sc->sc_io_tag, sc->sc_io_hdl, + MUSB2_REG_EPFIFO(0), + (void *)(&sc->sc_bounce_buf[count / 4]), temp); + } + usbd_copy_in(td->pc, td->offset, + sc->sc_bounce_buf, count); + + /* update offset and remainder */ + td->offset += count; + td->remainder -= count; + break; + } + /* check if we can optimise */ + if (buf_res.length >= 4) { + + /* receive data 4 bytes at a time */ + bus_space_read_multi_4(sc->sc_io_tag, sc->sc_io_hdl, + MUSB2_REG_EPFIFO(0), buf_res.buffer, + buf_res.length / 4); + + temp = buf_res.length & ~3; + + /* update counters */ + count -= temp; + td->offset += temp; + td->remainder -= temp; + continue; + } + /* receive data */ + bus_space_read_multi_1(sc->sc_io_tag, sc->sc_io_hdl, + MUSB2_REG_EPFIFO(0), buf_res.buffer, buf_res.length); + + /* update counters */ + count -= buf_res.length; + td->offset += buf_res.length; + td->remainder -= buf_res.length; + } + + csr &= ~MUSB2_MASK_CSR0L_RXPKTRDY; + MUSB2_WRITE_1(sc, MUSB2_REG_TXCSRL, csr); + + /* check if we are complete */ + if ((td->remainder == 0) || got_short) { + if (td->short_pkt) { + /* we are complete */ + + musbotg_channel_free(sc, td); + return (0); + } + /* else need to receive a zero length packet */ + } + + td->transaction_started = 1; + MUSB2_WRITE_1(sc, MUSB2_REG_TXCSRL, + MUSB2_MASK_CSR0L_REQPKT); + + return (1); /* not complete */ +} + +static uint8_t +musbotg_host_ctrl_data_tx(struct musbotg_td *td) +{ + struct usb_page_search buf_res; + struct musbotg_softc *sc; + uint16_t count; + uint8_t csr, csrh; + + /* get pointer to softc */ + sc = MUSBOTG_PC2SC(td->pc); + + if (td->channel == -1) + td->channel = musbotg_channel_alloc(sc, td); + + /* No free EPs */ + if (td->channel == -1) + return (1); + + DPRINTFN(1, "ep_no=%d\n", td->channel); + + /* select endpoint */ + MUSB2_WRITE_1(sc, MUSB2_REG_EPINDEX, 0); + + /* read out FIFO status */ + csr = MUSB2_READ_1(sc, MUSB2_REG_TXCSRL); + DPRINTFN(4, "csr=0x%02x\n", csr); + + if (csr & (MUSB2_MASK_CSR0L_RXSTALL | + MUSB2_MASK_CSR0L_ERROR)) { + /* clear status bits */ + MUSB2_WRITE_1(sc, MUSB2_REG_TXCSRL, 0); + td->error = 1; + } + + if (csr & MUSB2_MASK_CSR0L_NAKTIMO ) { + + if (csr & MUSB2_MASK_CSR0L_TXFIFONEMPTY) { + csrh = MUSB2_READ_1(sc, MUSB2_REG_TXCSRH); + csrh |= MUSB2_MASK_CSR0H_FFLUSH; + MUSB2_WRITE_1(sc, MUSB2_REG_TXCSRH, csrh); + csr = MUSB2_READ_1(sc, MUSB2_REG_TXCSRL); + if (csr & MUSB2_MASK_CSR0L_TXFIFONEMPTY) { + csrh = MUSB2_READ_1(sc, MUSB2_REG_TXCSRH); + csrh |= MUSB2_MASK_CSR0H_FFLUSH; + MUSB2_WRITE_1(sc, MUSB2_REG_TXCSRH, csrh); + csr = MUSB2_READ_1(sc, MUSB2_REG_TXCSRL); + } + } + + csr &= ~MUSB2_MASK_CSR0L_NAKTIMO; + MUSB2_WRITE_1(sc, MUSB2_REG_TXCSRL, csr); + + td->error = 1; + } + + + if (td->error) { + musbotg_channel_free(sc, td); + return (0); /* complete */ + } + + /* + * Wait while FIFO is empty. + * Do not flush it because it will cause transactions + * with size more then packet size. It might upset + * some devices + */ + if (csr & MUSB2_MASK_CSR0L_TXFIFONEMPTY) + return (1); + + /* Packet still being processed */ + if (csr & MUSB2_MASK_CSR0L_TXPKTRDY) + return (1); + + if (td->transaction_started) { + /* check remainder */ + if (td->remainder == 0) { + if (td->short_pkt) { + musbotg_channel_free(sc, td); + return (0); /* complete */ + } + /* else we need to transmit a short packet */ + } + + /* We're not complete - more transactions required */ + td->transaction_started = 0; + } + + /* check for short packet */ + count = td->max_frame_size; + if (td->remainder < count) { + /* we have a short packet */ + td->short_pkt = 1; + count = td->remainder; + } + + while (count > 0) { + uint32_t temp; + + usbd_get_page(td->pc, td->offset, &buf_res); + + /* get correct length */ + if (buf_res.length > count) { + buf_res.length = count; + } + /* check for unaligned memory address */ + if (USB_P2U(buf_res.buffer) & 3) { + + usbd_copy_out(td->pc, td->offset, + sc->sc_bounce_buf, count); + + temp = count & ~3; + + if (temp) { + /* transmit data 4 bytes at a time */ + bus_space_write_multi_4(sc->sc_io_tag, + sc->sc_io_hdl, MUSB2_REG_EPFIFO(0), + sc->sc_bounce_buf, temp / 4); + } + temp = count & 3; + if (temp) { + /* receive data 1 byte at a time */ + bus_space_write_multi_1(sc->sc_io_tag, sc->sc_io_hdl, + MUSB2_REG_EPFIFO(0), + ((void *)&sc->sc_bounce_buf[count / 4]), temp); + } + /* update offset and remainder */ + td->offset += count; + td->remainder -= count; + break; + } + /* check if we can optimise */ + if (buf_res.length >= 4) { + + /* transmit data 4 bytes at a time */ + bus_space_write_multi_4(sc->sc_io_tag, sc->sc_io_hdl, + MUSB2_REG_EPFIFO(0), buf_res.buffer, + buf_res.length / 4); + + temp = buf_res.length & ~3; + + /* update counters */ + count -= temp; + td->offset += temp; + td->remainder -= temp; + continue; + } + /* transmit data */ + bus_space_write_multi_1(sc->sc_io_tag, sc->sc_io_hdl, + MUSB2_REG_EPFIFO(0), buf_res.buffer, + buf_res.length); + + /* update counters */ + count -= buf_res.length; + td->offset += buf_res.length; + td->remainder -= buf_res.length; + } + + /* Function address */ + MUSB2_WRITE_1(sc, MUSB2_REG_TXFADDR(0), td->dev_addr); + MUSB2_WRITE_1(sc, MUSB2_REG_TXHADDR(0), td->haddr); + MUSB2_WRITE_1(sc, MUSB2_REG_TXHUBPORT(0), td->hport); + MUSB2_WRITE_1(sc, MUSB2_REG_TXTI, td->transfer_type); + + /* TX NAK timeout */ + MUSB2_WRITE_1(sc, MUSB2_REG_TXNAKLIMIT, MAX_NAK_TO); + + /* write command */ + MUSB2_WRITE_1(sc, MUSB2_REG_TXCSRL, + MUSB2_MASK_CSR0L_TXPKTRDY); + + td->transaction_started = 1; + + return (1); /* not complete */ +} + +static uint8_t +musbotg_dev_ctrl_status(struct musbotg_td *td) +{ + struct musbotg_softc *sc; + uint8_t csr; + + /* get pointer to softc */ + sc = MUSBOTG_PC2SC(td->pc); + + /* select endpoint 0 */ + MUSB2_WRITE_1(sc, MUSB2_REG_EPINDEX, 0); + + if (sc->sc_ep0_busy) { + sc->sc_ep0_busy = 0; + sc->sc_ep0_cmd |= MUSB2_MASK_CSR0L_DATAEND; + MUSB2_WRITE_1(sc, MUSB2_REG_TXCSRL, sc->sc_ep0_cmd); + sc->sc_ep0_cmd = 0; + } + /* read out FIFO status */ + csr = MUSB2_READ_1(sc, MUSB2_REG_TXCSRL); + + DPRINTFN(4, "csr=0x%02x\n", csr); + + if (csr & MUSB2_MASK_CSR0L_DATAEND) { + /* wait for interrupt */ + return (1); /* not complete */ + } + if (sc->sc_dv_addr != 0xFF) { + /* write function address */ + musbotg_set_address(sc, sc->sc_dv_addr); + } + + musbotg_channel_free(sc, td); + return (0); /* complete */ +} + +static uint8_t +musbotg_host_ctrl_status_rx(struct musbotg_td *td) +{ + struct musbotg_softc *sc; + uint8_t csr, csrh; + + /* get pointer to softc */ + sc = MUSBOTG_PC2SC(td->pc); + + if (td->channel == -1) + td->channel = musbotg_channel_alloc(sc, td); + + /* EP0 is busy, wait */ + if (td->channel == -1) + return (1); + + DPRINTFN(1, "ep_no=%d\n", td->channel); + + /* select endpoint 0 */ + MUSB2_WRITE_1(sc, MUSB2_REG_EPINDEX, 0); + + if (!td->transaction_started) { + MUSB2_WRITE_1(sc, MUSB2_REG_RXFADDR(0), + td->dev_addr); + + MUSB2_WRITE_1(sc, MUSB2_REG_RXHADDR(0), td->haddr); + MUSB2_WRITE_1(sc, MUSB2_REG_RXHUBPORT(0), td->hport); + MUSB2_WRITE_1(sc, MUSB2_REG_RXTI, td->transfer_type); + + /* RX NAK timeout */ + MUSB2_WRITE_1(sc, MUSB2_REG_RXNAKLIMIT, MAX_NAK_TO); + + td->transaction_started = 1; + + /* Disable PING */ + csrh = MUSB2_READ_1(sc, MUSB2_REG_RXCSRH); + csrh |= MUSB2_MASK_CSR0H_PING_DIS; + MUSB2_WRITE_1(sc, MUSB2_REG_RXCSRH, csrh); + + /* write command */ + MUSB2_WRITE_1(sc, MUSB2_REG_TXCSRL, + MUSB2_MASK_CSR0L_STATUSPKT | + MUSB2_MASK_CSR0L_REQPKT); + + return (1); /* Just started */ + + } + + csr = MUSB2_READ_1(sc, MUSB2_REG_TXCSRL); + + DPRINTFN(4, "IN STATUS csr=0x%02x\n", csr); + + if (csr & MUSB2_MASK_CSR0L_RXPKTRDY) { + MUSB2_WRITE_1(sc, MUSB2_REG_TXCSRL, + MUSB2_MASK_CSR0L_RXPKTRDY_CLR); + musbotg_channel_free(sc, td); + return (0); /* complete */ + } + + if (csr & MUSB2_MASK_CSR0L_NAKTIMO) { + csr &= ~ (MUSB2_MASK_CSR0L_STATUSPKT | + MUSB2_MASK_CSR0L_REQPKT); + MUSB2_WRITE_1(sc, MUSB2_REG_TXCSRL, csr); + + csr &= ~MUSB2_MASK_CSR0L_NAKTIMO; + MUSB2_WRITE_1(sc, MUSB2_REG_TXCSRL, csr); + td->error = 1; + } + + /* Failed */ + if (csr & (MUSB2_MASK_CSR0L_RXSTALL | + MUSB2_MASK_CSR0L_ERROR)) + { + /* Clear status bit */ + MUSB2_WRITE_1(sc, MUSB2_REG_TXCSRL, 0); + DPRINTFN(1, "error bit set, csr=0x%02x\n", csr); + td->error = 1; + } + + if (td->error) { + musbotg_channel_free(sc, td); + return (0); + } + + return (1); /* Not ready yet */ +} + +static uint8_t +musbotg_host_ctrl_status_tx(struct musbotg_td *td) +{ + struct musbotg_softc *sc; + uint8_t csr; + + /* get pointer to softc */ + sc = MUSBOTG_PC2SC(td->pc); + + if (td->channel == -1) + td->channel = musbotg_channel_alloc(sc, td); + + /* EP0 is busy, wait */ + if (td->channel == -1) + return (1); + + DPRINTFN(1, "ep_no=%d/%d [%d@%d.%d/%02x]\n", td->channel, td->transaction_started, + td->dev_addr,td->haddr,td->hport, td->transfer_type); + + /* select endpoint 0 */ + MUSB2_WRITE_1(sc, MUSB2_REG_EPINDEX, 0); + + csr = MUSB2_READ_1(sc, MUSB2_REG_TXCSRL); + DPRINTFN(4, "csr=0x%02x\n", csr); + + /* Not yet */ + if (csr & MUSB2_MASK_CSR0L_TXPKTRDY) + return (1); + + /* Failed */ + if (csr & (MUSB2_MASK_CSR0L_RXSTALL | + MUSB2_MASK_CSR0L_ERROR)) + { + /* Clear status bit */ + MUSB2_WRITE_1(sc, MUSB2_REG_TXCSRL, 0); + DPRINTFN(1, "error bit set, csr=0x%02x\n", csr); + td->error = 1; + musbotg_channel_free(sc, td); + return (0); /* complete */ + } + + if (td->transaction_started) { + musbotg_channel_free(sc, td); + return (0); /* complete */ + } + + MUSB2_WRITE_1(sc, MUSB2_REG_RXCSRH, MUSB2_MASK_CSR0H_PING_DIS); + + MUSB2_WRITE_1(sc, MUSB2_REG_TXFADDR(0), td->dev_addr); + MUSB2_WRITE_1(sc, MUSB2_REG_TXHADDR(0), td->haddr); + MUSB2_WRITE_1(sc, MUSB2_REG_TXHUBPORT(0), td->hport); + MUSB2_WRITE_1(sc, MUSB2_REG_TXTI, td->transfer_type); + + /* TX NAK timeout */ + MUSB2_WRITE_1(sc, MUSB2_REG_TXNAKLIMIT, MAX_NAK_TO); + + td->transaction_started = 1; + + /* write command */ + MUSB2_WRITE_1(sc, MUSB2_REG_TXCSRL, + MUSB2_MASK_CSR0L_STATUSPKT | + MUSB2_MASK_CSR0L_TXPKTRDY); + + return (1); /* wait for interrupt */ +} + +static uint8_t +musbotg_dev_data_rx(struct musbotg_td *td) +{ + struct usb_page_search buf_res; + struct musbotg_softc *sc; + uint16_t count; + uint8_t csr; + uint8_t to; + uint8_t got_short; + + to = 8; /* don't loop forever! */ + got_short = 0; + + /* get pointer to softc */ + sc = MUSBOTG_PC2SC(td->pc); + + if (td->channel == -1) + td->channel = musbotg_channel_alloc(sc, td); + + /* EP0 is busy, wait */ + if (td->channel == -1) + return (1); + + /* select endpoint */ + MUSB2_WRITE_1(sc, MUSB2_REG_EPINDEX, td->channel); + +repeat: + /* read out FIFO status */ + csr = MUSB2_READ_1(sc, MUSB2_REG_RXCSRL); + + DPRINTFN(4, "csr=0x%02x\n", csr); + + /* clear overrun */ + if (csr & MUSB2_MASK_CSRL_RXOVERRUN) { + /* make sure we don't clear "RXPKTRDY" */ + MUSB2_WRITE_1(sc, MUSB2_REG_RXCSRL, + MUSB2_MASK_CSRL_RXPKTRDY); + } + + /* check status */ + if (!(csr & MUSB2_MASK_CSRL_RXPKTRDY)) + return (1); /* not complete */ + + /* get the packet byte count */ + count = MUSB2_READ_2(sc, MUSB2_REG_RXCOUNT); + + DPRINTFN(4, "count=0x%04x\n", count); + + /* + * Check for short or invalid packet: + */ + if (count != td->max_frame_size) { + if (count < td->max_frame_size) { + /* we have a short packet */ + td->short_pkt = 1; + got_short = 1; + } else { + /* invalid USB packet */ + td->error = 1; + musbotg_channel_free(sc, td); + return (0); /* we are complete */ + } + } + /* verify the packet byte count */ + if (count > td->remainder) { + /* invalid USB packet */ + td->error = 1; + musbotg_channel_free(sc, td); + return (0); /* we are complete */ + } + while (count > 0) { + uint32_t temp; + + usbd_get_page(td->pc, td->offset, &buf_res); + + /* get correct length */ + if (buf_res.length > count) { + buf_res.length = count; + } + /* check for unaligned memory address */ + if (USB_P2U(buf_res.buffer) & 3) { + + temp = count & ~3; + + if (temp) { + /* receive data 4 bytes at a time */ + bus_space_read_multi_4(sc->sc_io_tag, sc->sc_io_hdl, + MUSB2_REG_EPFIFO(td->channel), sc->sc_bounce_buf, + temp / 4); + } + temp = count & 3; + if (temp) { + /* receive data 1 byte at a time */ + bus_space_read_multi_1(sc->sc_io_tag, + sc->sc_io_hdl, MUSB2_REG_EPFIFO(td->channel), + ((void *)&sc->sc_bounce_buf[count / 4]), temp); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-9@FreeBSD.ORG Thu Oct 24 06:25:53 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 70C53945; Thu, 24 Oct 2013 06:25:53 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 5E7132CB1; Thu, 24 Oct 2013 06:25:53 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9O6Prw3039136; Thu, 24 Oct 2013 06:25:53 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9O6PrBB039134; Thu, 24 Oct 2013 06:25:53 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201310240625.r9O6PrBB039134@svn.freebsd.org> From: Hans Petter Selasky Date: Thu, 24 Oct 2013 06:25:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r257042 - in stable/9/sys/dev/usb: . wlan X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 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, 24 Oct 2013 06:25:53 -0000 Author: hselasky Date: Thu Oct 24 06:25:52 2013 New Revision: 257042 URL: http://svnweb.freebsd.org/changeset/base/257042 Log: MFC r256500: Add new USB ID. PR: usb/182936 Modified: stable/9/sys/dev/usb/usbdevs stable/9/sys/dev/usb/wlan/if_run.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/usb/usbdevs ============================================================================== --- stable/9/sys/dev/usb/usbdevs Thu Oct 24 06:22:43 2013 (r257041) +++ stable/9/sys/dev/usb/usbdevs Thu Oct 24 06:25:52 2013 (r257042) @@ -1228,6 +1228,7 @@ product BELKIN F5D8055V2 0x825b F5D8055 product BELKIN F5D9050V3 0x905b F5D9050 ver 3 Wireless Adapter product BELKIN2 F5U002 0x0002 F5U002 Parallel printer product BELKIN F6D4050V1 0x935a F6D4050 v1 +product BELKIN F6D4050V2 0x935b F6D4050 v2 /* Billionton products */ product BILLIONTON USB100 0x0986 USB100N 10/100 FastEthernet Modified: stable/9/sys/dev/usb/wlan/if_run.c ============================================================================== --- stable/9/sys/dev/usb/wlan/if_run.c Thu Oct 24 06:22:43 2013 (r257041) +++ stable/9/sys/dev/usb/wlan/if_run.c Thu Oct 24 06:25:52 2013 (r257042) @@ -147,6 +147,7 @@ static const STRUCT_USB_HOST_ID run_devs RUN_DEV(BELKIN, F5D8055), RUN_DEV(BELKIN, F5D8055V2), RUN_DEV(BELKIN, F6D4050V1), + RUN_DEV(BELKIN, F6D4050V2), RUN_DEV(BELKIN, RT2870_1), RUN_DEV(BELKIN, RT2870_2), RUN_DEV(CISCOLINKSYS, AE1000), From owner-svn-src-stable-9@FreeBSD.ORG Thu Oct 24 10:31:54 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 32832BF9; Thu, 24 Oct 2013 10:31:54 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 2070420EA; Thu, 24 Oct 2013 10:31:54 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9OAVrcO022251; Thu, 24 Oct 2013 10:31:53 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9OAVrYY022250; Thu, 24 Oct 2013 10:31:53 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201310241031.r9OAVrYY022250@svn.freebsd.org> From: Alexander Motin Date: Thu, 24 Oct 2013 10:31:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r257048 - stable/9/sys/cam X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 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, 24 Oct 2013 10:31:54 -0000 Author: mav Date: Thu Oct 24 10:31:53 2013 New Revision: 257048 URL: http://svnweb.freebsd.org/changeset/base/257048 Log: MFC r256533: Unhide "Serial Number" lines from bootverbose. That information may be useful for system administration to have in hard copy (in logs) if one of several devices suddenly dies. Modified: stable/9/sys/cam/cam_xpt.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/cam/cam_xpt.c ============================================================================== --- stable/9/sys/cam/cam_xpt.c Thu Oct 24 10:31:02 2013 (r257047) +++ stable/9/sys/cam/cam_xpt.c Thu Oct 24 10:31:53 2013 (r257048) @@ -1045,7 +1045,7 @@ xpt_announce_periph(struct cam_periph *p (struct sep_identify_data *)&path->device->ident_data); else printf("Unknown protocol device\n"); - if (bootverbose && path->device->serial_num_len > 0) { + if (path->device->serial_num_len > 0) { /* Don't wrap the screen - print only the first 60 chars */ printf("%s%d: Serial Number %.60s\n", periph->periph_name, periph->unit_number, path->device->serial_num); From owner-svn-src-stable-9@FreeBSD.ORG Thu Oct 24 10:34:17 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id C3993FB6; Thu, 24 Oct 2013 10:34:17 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id B09E9211E; Thu, 24 Oct 2013 10:34:17 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9OAYHKE022778; Thu, 24 Oct 2013 10:34:17 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9OAYEvr022755; Thu, 24 Oct 2013 10:34:14 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201310241034.r9OAYEvr022755@svn.freebsd.org> From: Alexander Motin Date: Thu, 24 Oct 2013 10:34:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r257050 - in stable/9/sys/cam: . ata scsi X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 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, 24 Oct 2013 10:34:18 -0000 Author: mav Date: Thu Oct 24 10:34:13 2013 New Revision: 257050 URL: http://svnweb.freebsd.org/changeset/base/257050 Log: MFC r256552: Unify periph invalidation and destruction reporting. Print message containing device model and serial number on invalidation. Modified: stable/9/sys/cam/ata/ata_all.c stable/9/sys/cam/ata/ata_all.h stable/9/sys/cam/ata/ata_da.c stable/9/sys/cam/ata/ata_pmp.c stable/9/sys/cam/cam_periph.c stable/9/sys/cam/cam_periph.h stable/9/sys/cam/cam_xpt.c stable/9/sys/cam/cam_xpt_periph.h 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_ch.c stable/9/sys/cam/scsi/scsi_da.c stable/9/sys/cam/scsi/scsi_enc.c stable/9/sys/cam/scsi/scsi_pass.c stable/9/sys/cam/scsi/scsi_pt.c stable/9/sys/cam/scsi/scsi_sa.c stable/9/sys/cam/scsi/scsi_sg.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/cam/ata/ata_all.c ============================================================================== --- stable/9/sys/cam/ata/ata_all.c Thu Oct 24 10:33:31 2013 (r257049) +++ stable/9/sys/cam/ata/ata_all.c Thu Oct 24 10:34:13 2013 (r257050) @@ -297,6 +297,18 @@ ata_print_ident(struct ata_params *ident } void +ata_print_ident_short(struct ata_params *ident_data) +{ + char product[48], revision[16]; + + cam_strvis(product, ident_data->model, sizeof(ident_data->model), + sizeof(product)); + cam_strvis(revision, ident_data->revision, sizeof(ident_data->revision), + sizeof(revision)); + printf("<%s %s>", product, revision); +} + +void semb_print_ident(struct sep_identify_data *ident_data) { char vendor[9], product[17], revision[5], fw[5], in[7], ins[5]; @@ -311,6 +323,18 @@ semb_print_ident(struct sep_identify_dat vendor, product, revision, fw, in, ins); } +void +semb_print_ident_short(struct sep_identify_data *ident_data) +{ + char vendor[9], product[17], revision[5], fw[5]; + + cam_strvis(vendor, ident_data->vendor_id, 8, sizeof(vendor)); + cam_strvis(product, ident_data->product_id, 16, sizeof(product)); + cam_strvis(revision, ident_data->product_rev, 4, sizeof(revision)); + cam_strvis(fw, ident_data->firmware_rev, 4, sizeof(fw)); + printf("<%s %s %s %s>", vendor, product, revision, fw); +} + uint32_t ata_logical_sector_size(struct ata_params *ident_data) { Modified: stable/9/sys/cam/ata/ata_all.h ============================================================================== --- stable/9/sys/cam/ata/ata_all.h Thu Oct 24 10:33:31 2013 (r257049) +++ stable/9/sys/cam/ata/ata_all.h Thu Oct 24 10:34:13 2013 (r257050) @@ -109,6 +109,7 @@ int ata_status_sbuf(struct ccb_ataio *at int ata_res_sbuf(struct ccb_ataio *ataio, struct sbuf *sb); void ata_print_ident(struct ata_params *ident_data); +void ata_print_ident_short(struct ata_params *ident_data); uint32_t ata_logical_sector_size(struct ata_params *ident_data); uint64_t ata_physical_sector_size(struct ata_params *ident_data); @@ -143,6 +144,7 @@ int ata_identify_match(caddr_t identbuff int ata_static_identify_match(caddr_t identbuffer, caddr_t table_entry); void semb_print_ident(struct sep_identify_data *ident_data); +void semb_print_ident_short(struct sep_identify_data *ident_data); void semb_receive_diagnostic_results(struct ccb_ataio *ataio, u_int32_t retries, void (*cbfcnp)(struct cam_periph *, union ccb*), Modified: stable/9/sys/cam/ata/ata_da.c ============================================================================== --- stable/9/sys/cam/ata/ata_da.c Thu Oct 24 10:33:31 2013 (r257049) +++ stable/9/sys/cam/ata/ata_da.c Thu Oct 24 10:34:13 2013 (r257050) @@ -912,7 +912,6 @@ adaoninvalidate(struct cam_periph *perip bioq_flush(&softc->trim_queue, NULL, ENXIO); disk_gone(softc->disk); - xpt_print(periph->path, "lost device\n"); } static void @@ -922,7 +921,6 @@ adacleanup(struct cam_periph *periph) softc = (struct ada_softc *)periph->softc; - xpt_print(periph->path, "removing device entry\n"); cam_periph_unlock(periph); /* Modified: stable/9/sys/cam/ata/ata_pmp.c ============================================================================== --- stable/9/sys/cam/ata/ata_pmp.c Thu Oct 24 10:33:31 2013 (r257049) +++ stable/9/sys/cam/ata/ata_pmp.c Thu Oct 24 10:34:13 2013 (r257050) @@ -241,7 +241,6 @@ pmponinvalidate(struct cam_periph *perip } } pmprelease(periph, -1); - xpt_print(periph->path, "lost device\n"); } static void @@ -251,7 +250,6 @@ pmpcleanup(struct cam_periph *periph) softc = (struct pmp_softc *)periph->softc; - xpt_print(periph->path, "removing device entry\n"); cam_periph_unlock(periph); /* Modified: stable/9/sys/cam/cam_periph.c ============================================================================== --- stable/9/sys/cam/cam_periph.c Thu Oct 24 10:33:31 2013 (r257049) +++ stable/9/sys/cam/cam_periph.c Thu Oct 24 10:34:13 2013 (r257050) @@ -586,6 +586,8 @@ cam_periph_invalidate(struct cam_periph return; CAM_DEBUG(periph->path, CAM_DEBUG_INFO, ("Periph invalidated\n")); + if (periph->flags & CAM_PERIPH_ANNOUNCED) + xpt_denounce_periph(periph); periph->flags |= CAM_PERIPH_INVALID; periph->flags &= ~CAM_PERIPH_NEW_DEV_FOUND; if (periph->periph_oninval != NULL) @@ -648,7 +650,10 @@ camperiphfree(struct cam_periph *periph) xpt_remove_periph(periph); xpt_unlock_buses(); - CAM_DEBUG(periph->path, CAM_DEBUG_INFO, ("Periph destroyed\n")); + if (periph->flags & CAM_PERIPH_ANNOUNCED) { + xpt_print(periph->path, "Periph destroyed\n"); + } else + CAM_DEBUG(periph->path, CAM_DEBUG_INFO, ("Periph destroyed\n")); if (periph->flags & CAM_PERIPH_NEW_DEV_FOUND) { union ccb ccb; Modified: stable/9/sys/cam/cam_periph.h ============================================================================== --- stable/9/sys/cam/cam_periph.h Thu Oct 24 10:33:31 2013 (r257049) +++ stable/9/sys/cam/cam_periph.h Thu Oct 24 10:34:13 2013 (r257050) @@ -121,6 +121,7 @@ struct cam_periph { #define CAM_PERIPH_NEW_DEV_FOUND 0x10 #define CAM_PERIPH_RECOVERY_INPROG 0x20 #define CAM_PERIPH_FREE 0x80 +#define CAM_PERIPH_ANNOUNCED 0x100 u_int32_t immediate_priority; u_int32_t refcount; SLIST_HEAD(, ccb_hdr) ccb_list; /* For "immediate" requests */ Modified: stable/9/sys/cam/cam_xpt.c ============================================================================== --- stable/9/sys/cam/cam_xpt.c Thu Oct 24 10:33:31 2013 (r257049) +++ stable/9/sys/cam/cam_xpt.c Thu Oct 24 10:34:13 2013 (r257050) @@ -1025,6 +1025,7 @@ xpt_announce_periph(struct cam_periph *p struct cam_path *path = periph->path; mtx_assert(periph->sim->mtx, MA_OWNED); + periph->flags |= CAM_PERIPH_ANNOUNCED; printf("%s%d at %s%d bus %d scbus%d target %d lun %d\n", periph->periph_name, periph->unit_number, @@ -1073,6 +1074,37 @@ xpt_announce_quirks(struct cam_periph *p } } +void +xpt_denounce_periph(struct cam_periph *periph) +{ + struct cam_path *path = periph->path; + + mtx_assert(periph->sim->mtx, MA_OWNED); + printf("%s%d at %s%d bus %d scbus%d target %d lun %d\n", + periph->periph_name, periph->unit_number, + path->bus->sim->sim_name, + path->bus->sim->unit_number, + path->bus->sim->bus_id, + path->bus->path_id, + path->target->target_id, + path->device->lun_id); + printf("%s%d: ", periph->periph_name, periph->unit_number); + if (path->device->protocol == PROTO_SCSI) + scsi_print_inquiry_short(&path->device->inq_data); + else if (path->device->protocol == PROTO_ATA || + path->device->protocol == PROTO_SATAPM) + ata_print_ident_short(&path->device->ident_data); + else if (path->device->protocol == PROTO_SEMB) + semb_print_ident_short( + (struct sep_identify_data *)&path->device->ident_data); + else + printf("Unknown protocol device"); + if (path->device->serial_num_len > 0) + printf(" s/n %.60s", path->device->serial_num); + printf(" detached\n"); +} + + int xpt_getattr(char *buf, size_t len, const char *attr, struct cam_path *path) { Modified: stable/9/sys/cam/cam_xpt_periph.h ============================================================================== --- stable/9/sys/cam/cam_xpt_periph.h Thu Oct 24 10:33:31 2013 (r257049) +++ stable/9/sys/cam/cam_xpt_periph.h Thu Oct 24 10:34:13 2013 (r257050) @@ -47,6 +47,7 @@ void xpt_announce_periph(struct cam_per char *announce_string); void xpt_announce_quirks(struct cam_periph *periph, int quirks, char *bit_string); +void xpt_denounce_periph(struct cam_periph *periph); #endif #endif /* _CAM_CAM_XPT_PERIPH_H */ Modified: stable/9/sys/cam/scsi/scsi_all.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_all.c Thu Oct 24 10:33:31 2013 (r257049) +++ stable/9/sys/cam/scsi/scsi_all.c Thu Oct 24 10:34:13 2013 (r257050) @@ -5249,6 +5249,21 @@ scsi_print_inquiry(struct scsi_inquiry_d dtype, rstr, qtype); } +void +scsi_print_inquiry_short(struct scsi_inquiry_data *inq_data) +{ + char vendor[16], product[48], revision[16]; + + cam_strvis(vendor, inq_data->vendor, sizeof(inq_data->vendor), + sizeof(vendor)); + cam_strvis(product, inq_data->product, sizeof(inq_data->product), + sizeof(product)); + cam_strvis(revision, inq_data->revision, sizeof(inq_data->revision), + sizeof(revision)); + + printf("<%s %s %s>", vendor, product, revision); +} + /* * Table of syncrates that don't follow the "divisible by 4" * rule. This table will be expanded in future SCSI specs. Modified: stable/9/sys/cam/scsi/scsi_all.h ============================================================================== --- stable/9/sys/cam/scsi/scsi_all.h Thu Oct 24 10:33:31 2013 (r257049) +++ stable/9/sys/cam/scsi/scsi_all.h Thu Oct 24 10:34:13 2013 (r257050) @@ -2312,6 +2312,7 @@ char * scsi_cdb_string(u_int8_t *cdb_pt size_t len); void scsi_print_inquiry(struct scsi_inquiry_data *inq_data); +void scsi_print_inquiry_short(struct scsi_inquiry_data *inq_data); u_int scsi_calc_syncsrate(u_int period_factor); u_int scsi_calc_syncparam(u_int period); Modified: stable/9/sys/cam/scsi/scsi_cd.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_cd.c Thu Oct 24 10:33:31 2013 (r257049) +++ stable/9/sys/cam/scsi/scsi_cd.c Thu Oct 24 10:34:13 2013 (r257050) @@ -428,7 +428,6 @@ cdoninvalidate(struct cam_periph *periph camq_remove(&softc->changer->devq, softc->pinfo.index); disk_gone(softc->disk); - xpt_print(periph->path, "lost device, %d refs\n", periph->refcount); } static void @@ -438,8 +437,6 @@ cdcleanup(struct cam_periph *periph) softc = (struct cd_softc *)periph->softc; - xpt_print(periph->path, "removing device entry\n"); - /* * In the queued, non-active case, the device in question * has already been removed from the changer run queue. Since this Modified: stable/9/sys/cam/scsi/scsi_ch.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_ch.c Thu Oct 24 10:33:31 2013 (r257049) +++ stable/9/sys/cam/scsi/scsi_ch.c Thu Oct 24 10:34:13 2013 (r257050) @@ -306,9 +306,6 @@ choninvalidate(struct cam_periph *periph * when it has cleaned up its state. */ destroy_dev_sched_cb(softc->dev, chdevgonecb, periph); - - xpt_print(periph->path, "lost device\n"); - } static void @@ -318,8 +315,6 @@ chcleanup(struct cam_periph *periph) softc = (struct ch_softc *)periph->softc; - xpt_print(periph->path, "removing device entry\n"); - devstat_remove_entry(softc->device_stats); free(softc, M_DEVBUF); Modified: stable/9/sys/cam/scsi/scsi_da.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_da.c Thu Oct 24 10:33:31 2013 (r257049) +++ stable/9/sys/cam/scsi/scsi_da.c Thu Oct 24 10:34:13 2013 (r257050) @@ -1561,9 +1561,6 @@ daoninvalidate(struct cam_periph *periph * done cleaning up its resources. */ disk_gone(softc->disk); - - xpt_print(periph->path, "lost device - %d outstanding, %d refs\n", - softc->outstanding_cmds, periph->refcount); } static void @@ -1573,7 +1570,6 @@ dacleanup(struct cam_periph *periph) softc = (struct da_softc *)periph->softc; - xpt_print(periph->path, "removing device entry\n"); cam_periph_unlock(periph); /* Modified: stable/9/sys/cam/scsi/scsi_enc.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_enc.c Thu Oct 24 10:33:31 2013 (r257049) +++ stable/9/sys/cam/scsi/scsi_enc.c Thu Oct 24 10:34:13 2013 (r257050) @@ -178,8 +178,6 @@ enc_oninvalidate(struct cam_periph *peri callout_drain(&enc->status_updater); destroy_dev_sched_cb(enc->enc_dev, enc_devgonecb, periph); - - xpt_print(periph->path, "lost device\n"); } static void @@ -189,9 +187,6 @@ enc_dtor(struct cam_periph *periph) enc = periph->softc; - xpt_print(periph->path, "removing device entry\n"); - - /* If the sub-driver has a cleanup routine, call it */ if (enc->enc_vec.softc_cleanup != NULL) enc->enc_vec.softc_cleanup(enc); Modified: stable/9/sys/cam/scsi/scsi_pass.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_pass.c Thu Oct 24 10:33:31 2013 (r257049) +++ stable/9/sys/cam/scsi/scsi_pass.c Thu Oct 24 10:34:13 2013 (r257050) @@ -207,11 +207,6 @@ passoninvalidate(struct cam_periph *peri * XXX Handle any transactions queued to the card * with XPT_ABORT_CCB. */ - - if (bootverbose) { - xpt_print(periph->path, "lost device\n"); - } - } static void @@ -221,8 +216,6 @@ passcleanup(struct cam_periph *periph) softc = (struct pass_softc *)periph->softc; - if (bootverbose) - xpt_print(periph->path, "removing device entry\n"); devstat_remove_entry(softc->device_stats); cam_periph_unlock(periph); Modified: stable/9/sys/cam/scsi/scsi_pt.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_pt.c Thu Oct 24 10:33:31 2013 (r257049) +++ stable/9/sys/cam/scsi/scsi_pt.c Thu Oct 24 10:34:13 2013 (r257050) @@ -333,8 +333,6 @@ ptoninvalidate(struct cam_periph *periph * with XPT_ABORT_CCB. */ bioq_flush(&softc->bio_queue, NULL, ENXIO); - - xpt_print(periph->path, "lost device\n"); } static void @@ -344,7 +342,6 @@ ptdtor(struct cam_periph *periph) softc = (struct pt_softc *)periph->softc; - xpt_print(periph->path, "removing device entry\n"); devstat_remove_entry(softc->device_stats); cam_periph_unlock(periph); destroy_dev(softc->dev); Modified: stable/9/sys/cam/scsi/scsi_sa.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_sa.c Thu Oct 24 10:33:31 2013 (r257049) +++ stable/9/sys/cam/scsi/scsi_sa.c Thu Oct 24 10:34:13 2013 (r257050) @@ -1377,9 +1377,6 @@ saoninvalidate(struct cam_periph *periph */ bioq_flush(&softc->bio_queue, NULL, ENXIO); softc->queue_count = 0; - - xpt_print(periph->path, "lost device\n"); - } static void @@ -1390,7 +1387,6 @@ sacleanup(struct cam_periph *periph) softc = (struct sa_softc *)periph->softc; - xpt_print(periph->path, "removing device entry\n"); devstat_remove_entry(softc->device_stats); cam_periph_unlock(periph); destroy_dev(softc->devs.ctl_dev); Modified: stable/9/sys/cam/scsi/scsi_sg.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_sg.c Thu Oct 24 10:33:31 2013 (r257049) +++ stable/9/sys/cam/scsi/scsi_sg.c Thu Oct 24 10:34:13 2013 (r257050) @@ -238,9 +238,6 @@ sgoninvalidate(struct cam_periph *periph * with XPT_ABORT_CCB. */ - if (bootverbose) { - xpt_print(periph->path, "lost device\n"); - } } static void @@ -249,8 +246,6 @@ sgcleanup(struct cam_periph *periph) struct sg_softc *softc; softc = (struct sg_softc *)periph->softc; - if (bootverbose) - xpt_print(periph->path, "removing device entry\n"); devstat_remove_entry(softc->device_stats); From owner-svn-src-stable-9@FreeBSD.ORG Thu Oct 24 10:53:36 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 2CA87934; Thu, 24 Oct 2013 10:53:36 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 15C3122E6; Thu, 24 Oct 2013 10:53:36 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9OArZtr029145; Thu, 24 Oct 2013 10:53:35 GMT (envelope-from bdrewery@svn.freebsd.org) Received: (from bdrewery@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9OArZQh029144; Thu, 24 Oct 2013 10:53:35 GMT (envelope-from bdrewery@svn.freebsd.org) Message-Id: <201310241053.r9OArZQh029144@svn.freebsd.org> From: Bryan Drewery Date: Thu, 24 Oct 2013 10:53:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r257052 - stable/9 X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 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, 24 Oct 2013 10:53:36 -0000 Author: bdrewery (ports committer) Date: Thu Oct 24 10:53:35 2013 New Revision: 257052 URL: http://svnweb.freebsd.org/changeset/base/257052 Log: MFC r256842: Fix 'make delete-old-libs' and 'make check-libs' to delete .debug files created by WITH_DEBUG_FILES. Also cleanup .symbols files from the period between r244236 when .symbols were supported and r251512 when they were renamed to .debug. Only propose to delete a .debug file if the corresponding library itself was deleted already. Approved by: bapt Modified: stable/9/Makefile.inc1 (contents, props changed) Modified: stable/9/Makefile.inc1 ============================================================================== --- stable/9/Makefile.inc1 Thu Oct 24 10:49:55 2013 (r257051) +++ stable/9/Makefile.inc1 Thu Oct 24 10:53:35 2013 (r257052) @@ -1574,6 +1574,13 @@ delete-old-libs: chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \ rm ${RM_I} "${DESTDIR}/$${file}" <&3; \ fi; \ + for ext in debug symbols; do \ + if ! [ -e "${DESTDIR}/$${file}" ] && [ -f \ + "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" ]; then \ + rm ${RM_I} "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" \ + <&3; \ + fi; \ + done; \ done @echo ">>> Old libraries removed" @@ -1585,6 +1592,11 @@ check-old-libs: if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \ echo "${DESTDIR}/$${file}"; \ fi; \ + for ext in debug symbols; do \ + if [ -f "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" ]; then \ + echo "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}"; \ + fi; \ + done; \ done delete-old-dirs: From owner-svn-src-stable-9@FreeBSD.ORG Fri Oct 25 06:03:07 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id DF9B7F62; Fri, 25 Oct 2013 06:03:07 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id CB7C12E11; Fri, 25 Oct 2013 06:03:07 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9P637hH020308; Fri, 25 Oct 2013 06:03:07 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9P637Ul020307; Fri, 25 Oct 2013 06:03:07 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201310250603.r9P637Ul020307@svn.freebsd.org> From: Alexander Motin Date: Fri, 25 Oct 2013 06:03:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r257101 - stable/9/sbin/camcontrol X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 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, 25 Oct 2013 06:03:08 -0000 Author: mav Date: Fri Oct 25 06:03:07 2013 New Revision: 257101 URL: http://svnweb.freebsd.org/changeset/base/257101 Log: MFC r256317: Fix mode page length calculation to remove last garbage line from the `camcontrol mode daX -l` output. Modified: stable/9/sbin/camcontrol/modeedit.c Directory Properties: stable/9/sbin/camcontrol/ (props changed) Modified: stable/9/sbin/camcontrol/modeedit.c ============================================================================== --- stable/9/sbin/camcontrol/modeedit.c Fri Oct 25 05:33:04 2013 (r257100) +++ stable/9/sbin/camcontrol/modeedit.c Fri Oct 25 06:03:07 2013 (r257101) @@ -886,12 +886,12 @@ mode_list(struct cam_device *device, int timeout, data, sizeof(data)); mh = (struct scsi_mode_header_6 *)data; - len = mh->blk_desc_len; /* Skip block descriptors. */ + len = sizeof(*mh) + mh->blk_desc_len; /* Skip block descriptors. */ /* Iterate through the pages in the reply. */ while (len < mh->data_length) { /* Locate the next mode page header. */ mph = (struct scsi_mode_page_header *) - ((intptr_t)mh + sizeof(*mh) + len); + ((intptr_t)mh + len); mph->page_code &= SMS_PAGE_CODE; nameentry = nameentry_lookup(mph->page_code); From owner-svn-src-stable-9@FreeBSD.ORG Fri Oct 25 06:48:58 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 2D55B504; Fri, 25 Oct 2013 06:48:58 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 191EA20D3; Fri, 25 Oct 2013 06:48:58 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9P6mvL6036095; Fri, 25 Oct 2013 06:48:57 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9P6mvni036094; Fri, 25 Oct 2013 06:48:57 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201310250648.r9P6mvni036094@svn.freebsd.org> From: Hans Petter Selasky Date: Fri, 25 Oct 2013 06:48:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r257107 - stable/9/sys/dev/usb/controller X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 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, 25 Oct 2013 06:48:58 -0000 Author: hselasky Date: Fri Oct 25 06:48:57 2013 New Revision: 257107 URL: http://svnweb.freebsd.org/changeset/base/257107 Log: MFC r256750: Improve XHCI stability. When a command timeout happens, the command should be aborted else the command queue can stop. Refer to section "4.6.1.2" of the XHCI specification. Modified: stable/9/sys/dev/usb/controller/xhci.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/usb/controller/xhci.c ============================================================================== --- stable/9/sys/dev/usb/controller/xhci.c Fri Oct 25 06:47:01 2013 (r257106) +++ stable/9/sys/dev/usb/controller/xhci.c Fri Oct 25 06:48:57 2013 (r257107) @@ -1110,6 +1110,25 @@ xhci_do_command(struct xhci_softc *sc, s } if (err != 0) { DPRINTFN(0, "Command timeout!\n"); + + /* + * Try to abort the last command as per section + * 4.6.1.2 "Aborting a Command" of the XHCI + * specification: + */ + temp = XREAD4(sc, oper, XHCI_CRCR_LO); + XWRITE4(sc, oper, XHCI_CRCR_LO, temp | XHCI_CRCR_LO_CA); + + /* wait for abort event, if any */ + err = cv_timedwait(&sc->sc_cmd_cv, &sc->sc_bus.bus_mtx, hz / 16); + + if (err != 0 && xhci_interrupt_poll(sc) != 0) { + DPRINTF("Command was completed when polling\n"); + err = 0; + } + if (err != 0) { + DPRINTF("Command abort timeout!\n"); + } err = USB_ERR_TIMEOUT; trb->dwTrb2 = 0; trb->dwTrb3 = 0; From owner-svn-src-stable-9@FreeBSD.ORG Fri Oct 25 13:25:50 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 29952DE; Fri, 25 Oct 2013 13:25:50 +0000 (UTC) (envelope-from tijl@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 16ED026A1; Fri, 25 Oct 2013 13:25:50 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9PDPnRs070556; Fri, 25 Oct 2013 13:25:49 GMT (envelope-from tijl@svn.freebsd.org) Received: (from tijl@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9PDPnM2070555; Fri, 25 Oct 2013 13:25:49 GMT (envelope-from tijl@svn.freebsd.org) Message-Id: <201310251325.r9PDPnM2070555@svn.freebsd.org> From: Tijl Coosemans Date: Fri, 25 Oct 2013 13:25:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r257112 - stable/9/include X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 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, 25 Oct 2013 13:25:50 -0000 Author: tijl Date: Fri Oct 25 13:25:49 2013 New Revision: 257112 URL: http://svnweb.freebsd.org/changeset/base/257112 Log: MFC r256925: Add a dummy statement to the beginning of the pthread_cleanup_pop() macro to allow a call of the macro to be labelled as in: label: pthread_cleanup_pop(); Reviewed by: imp Modified: stable/9/include/pthread.h Directory Properties: stable/9/include/ (props changed) Modified: stable/9/include/pthread.h ============================================================================== --- stable/9/include/pthread.h Fri Oct 25 11:44:39 2013 (r257111) +++ stable/9/include/pthread.h Fri Oct 25 13:25:49 2013 (r257112) @@ -175,6 +175,7 @@ int pthread_barrierattr_setpshared(pthr { #define pthread_cleanup_pop(execute) \ + (void)0; \ } \ __pthread_cleanup_pop_imp(execute); \ } From owner-svn-src-stable-9@FreeBSD.ORG Fri Oct 25 15:44:01 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 2A9302CA; Fri, 25 Oct 2013 15:44:01 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 08CDA2EE0; Fri, 25 Oct 2013 15:44:01 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9PFi1M2019052; Fri, 25 Oct 2013 15:44:01 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9PFhxMr018989; Fri, 25 Oct 2013 15:43:59 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201310251543.r9PFhxMr018989@svn.freebsd.org> From: Xin LI Date: Fri, 25 Oct 2013 15:43:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r257119 - in stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 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, 25 Oct 2013 15:44:01 -0000 Author: delphij Date: Fri Oct 25 15:43:59 2013 New Revision: 257119 URL: http://svnweb.freebsd.org/changeset/base/257119 Log: MFC r253816: MFV r253780: To quote Illumos #3875: The problem here is that if we ever end up in the error path, we drop the locks protecting access to the zfsvfs_t prior to forcibly unmounting the filesystem. Because z_os is NULL, any thread that had already picked up the zfsvfs_t and was sitting in ZFS_ENTER() when we dropped our locks in zfs_resume_fs() will now acquire the lock, attempt to use z_os, and panic. Illumos ZFS issues: 3875 panic in zfs_root() after failed rollback Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_objset.h stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_send.h stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c Fri Oct 25 15:37:58 2013 (r257118) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c Fri Oct 25 15:43:59 2013 (r257119) @@ -517,6 +517,38 @@ dmu_objset_rele(objset_t *os, void *tag) dsl_pool_rele(dp, tag); } +/* + * When we are called, os MUST refer to an objset associated with a dataset + * that is owned by 'tag'; that is, is held and long held by 'tag' and ds_owner + * == tag. We will then release and reacquire ownership of the dataset while + * holding the pool config_rwlock to avoid intervening namespace or ownership + * changes may occur. + * + * This exists solely to accommodate zfs_ioc_userspace_upgrade()'s desire to + * release the hold on its dataset and acquire a new one on the dataset of the + * same name so that it can be partially torn down and reconstructed. + */ +void +dmu_objset_refresh_ownership(objset_t *os, void *tag) +{ + dsl_pool_t *dp; + dsl_dataset_t *ds, *newds; + char name[MAXNAMELEN]; + + ds = os->os_dsl_dataset; + VERIFY3P(ds, !=, NULL); + VERIFY3P(ds->ds_owner, ==, tag); + VERIFY(dsl_dataset_long_held(ds)); + + dsl_dataset_name(ds, name); + dp = dmu_objset_pool(os); + dsl_pool_config_enter(dp, FTAG); + dmu_objset_disown(os, tag); + VERIFY0(dsl_dataset_own(dp, name, tag, &newds)); + VERIFY3P(newds, ==, os->os_dsl_dataset); + dsl_pool_config_exit(dp, FTAG); +} + void dmu_objset_disown(objset_t *os, void *tag) { Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c Fri Oct 25 15:37:58 2013 (r257118) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c Fri Oct 25 15:43:59 2013 (r257119) @@ -1602,7 +1602,7 @@ dmu_recv_end_check(void *arg, dmu_tx_t * if (error != 0) return (error); error = dsl_dataset_clone_swap_check_impl(drc->drc_ds, - origin_head, drc->drc_force); + origin_head, drc->drc_force, drc->drc_owner, tx); if (error != 0) { dsl_dataset_rele(origin_head, FTAG); return (error); @@ -1654,6 +1654,9 @@ dmu_recv_end_sync(void *arg, dmu_tx_t *t dsl_dataset_rele(origin_head, FTAG); dsl_destroy_head_sync_impl(drc->drc_ds, tx); + + if (drc->drc_owner != NULL) + VERIFY3P(origin_head->ds_owner, ==, drc->drc_owner); } else { dsl_dataset_t *ds = drc->drc_ds; @@ -1752,8 +1755,10 @@ dmu_recv_new_end(dmu_recv_cookie_t *drc) } int -dmu_recv_end(dmu_recv_cookie_t *drc) +dmu_recv_end(dmu_recv_cookie_t *drc, void *owner) { + drc->drc_owner = owner; + if (drc->drc_newfs) return (dmu_recv_new_end(drc)); else Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c Fri Oct 25 15:37:58 2013 (r257118) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c Fri Oct 25 15:43:59 2013 (r257119) @@ -1755,16 +1755,52 @@ dsl_dataset_rename_snapshot(const char * dsl_dataset_rename_snapshot_sync, &ddrsa, 1)); } +/* + * If we're doing an ownership handoff, we need to make sure that there is + * only one long hold on the dataset. We're not allowed to change anything here + * so we don't permanently release the long hold or regular hold here. We want + * to do this only when syncing to avoid the dataset unexpectedly going away + * when we release the long hold. + */ +static int +dsl_dataset_handoff_check(dsl_dataset_t *ds, void *owner, dmu_tx_t *tx) +{ + boolean_t held; + + if (!dmu_tx_is_syncing(tx)) + return (0); + + if (owner != NULL) { + VERIFY3P(ds->ds_owner, ==, owner); + dsl_dataset_long_rele(ds, owner); + } + + held = dsl_dataset_long_held(ds); + + if (owner != NULL) + dsl_dataset_long_hold(ds, owner); + + if (held) + return (SET_ERROR(EBUSY)); + + return (0); +} + +typedef struct dsl_dataset_rollback_arg { + const char *ddra_fsname; + void *ddra_owner; +} dsl_dataset_rollback_arg_t; + static int dsl_dataset_rollback_check(void *arg, dmu_tx_t *tx) { - const char *fsname = arg; + dsl_dataset_rollback_arg_t *ddra = arg; dsl_pool_t *dp = dmu_tx_pool(tx); dsl_dataset_t *ds; int64_t unused_refres_delta; int error; - error = dsl_dataset_hold(dp, fsname, FTAG, &ds); + error = dsl_dataset_hold(dp, ddra->ddra_fsname, FTAG, &ds); if (error != 0) return (error); @@ -1780,9 +1816,10 @@ dsl_dataset_rollback_check(void *arg, dm return (SET_ERROR(EINVAL)); } - if (dsl_dataset_long_held(ds)) { + error = dsl_dataset_handoff_check(ds, ddra->ddra_owner, tx); + if (error != 0) { dsl_dataset_rele(ds, FTAG); - return (SET_ERROR(EBUSY)); + return (error); } /* @@ -1819,12 +1856,12 @@ dsl_dataset_rollback_check(void *arg, dm static void dsl_dataset_rollback_sync(void *arg, dmu_tx_t *tx) { - const char *fsname = arg; + dsl_dataset_rollback_arg_t *ddra = arg; dsl_pool_t *dp = dmu_tx_pool(tx); dsl_dataset_t *ds, *clone; uint64_t cloneobj; - VERIFY0(dsl_dataset_hold(dp, fsname, FTAG, &ds)); + VERIFY0(dsl_dataset_hold(dp, ddra->ddra_fsname, FTAG, &ds)); cloneobj = dsl_dataset_create_sync(ds->ds_dir, "%rollback", ds->ds_prev, DS_CREATE_FLAG_NODIRTY, kcred, tx); @@ -1840,11 +1877,26 @@ dsl_dataset_rollback_sync(void *arg, dmu dsl_dataset_rele(ds, FTAG); } +/* + * If owner != NULL: + * + * - The existing dataset MUST be owned by the specified owner at entry + * - Upon return, dataset will still be held by the same owner, whether we + * succeed or not. + * + * This mode is required any time the existing filesystem is mounted. See + * notes above zfs_suspend_fs() for further details. + */ int -dsl_dataset_rollback(const char *fsname) +dsl_dataset_rollback(const char *fsname, void *owner) { + dsl_dataset_rollback_arg_t ddra; + + ddra.ddra_fsname = fsname; + ddra.ddra_owner = owner; + return (dsl_sync_task(fsname, dsl_dataset_rollback_check, - dsl_dataset_rollback_sync, (void *)fsname, 1)); + dsl_dataset_rollback_sync, (void *)&ddra, 1)); } struct promotenode { @@ -2362,7 +2414,7 @@ dsl_dataset_promote(const char *name, ch int dsl_dataset_clone_swap_check_impl(dsl_dataset_t *clone, - dsl_dataset_t *origin_head, boolean_t force) + dsl_dataset_t *origin_head, boolean_t force, void *owner, dmu_tx_t *tx) { int64_t unused_refres_delta; @@ -2391,7 +2443,7 @@ dsl_dataset_clone_swap_check_impl(dsl_da return (SET_ERROR(ETXTBSY)); /* origin_head should have no long holds (e.g. is not mounted) */ - if (dsl_dataset_long_held(origin_head)) + if (dsl_dataset_handoff_check(origin_head, owner, tx)) return (SET_ERROR(EBUSY)); /* check amount of any unconsumed refreservation */ Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_objset.h ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_objset.h Fri Oct 25 15:37:58 2013 (r257118) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_objset.h Fri Oct 25 15:43:59 2013 (r257119) @@ -136,6 +136,7 @@ struct objset { int dmu_objset_hold(const char *name, void *tag, objset_t **osp); int dmu_objset_own(const char *name, dmu_objset_type_t type, boolean_t readonly, void *tag, objset_t **osp); +void dmu_objset_refresh_ownership(objset_t *os, void *tag); void dmu_objset_rele(objset_t *os, void *tag); void dmu_objset_disown(objset_t *os, void *tag); int dmu_objset_from_ds(struct dsl_dataset *ds, objset_t **osp); Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_send.h ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_send.h Fri Oct 25 15:37:58 2013 (r257118) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_send.h Fri Oct 25 15:43:59 2013 (r257119) @@ -62,6 +62,7 @@ typedef struct dmu_recv_cookie { struct avl_tree *drc_guid_to_ds_map; zio_cksum_t drc_cksum; uint64_t drc_newsnapobj; + void *drc_owner; } dmu_recv_cookie_t; int dmu_recv_begin(char *tofs, char *tosnap, struct drr_begin *drrb, @@ -72,6 +73,6 @@ int dmu_recv_stream(dmu_recv_cookie_t *d int dmu_recv_stream(dmu_recv_cookie_t *drc, struct file *fp, offset_t *voffp, #endif int cleanup_fd, uint64_t *action_handlep); -int dmu_recv_end(dmu_recv_cookie_t *drc); +int dmu_recv_end(dmu_recv_cookie_t *drc, void *owner); #endif /* _DMU_SEND_H */ Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h Fri Oct 25 15:37:58 2013 (r257118) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h Fri Oct 25 15:43:59 2013 (r257119) @@ -247,7 +247,7 @@ void dsl_dataset_long_rele(dsl_dataset_t boolean_t dsl_dataset_long_held(dsl_dataset_t *ds); int dsl_dataset_clone_swap_check_impl(dsl_dataset_t *clone, - dsl_dataset_t *origin_head, boolean_t force); + dsl_dataset_t *origin_head, boolean_t force, void *owner, dmu_tx_t *tx); void dsl_dataset_clone_swap_sync_impl(dsl_dataset_t *clone, dsl_dataset_t *origin_head, dmu_tx_t *tx); int dsl_dataset_snapshot_check_impl(dsl_dataset_t *ds, const char *snapname, @@ -264,7 +264,7 @@ int dsl_dataset_snap_lookup(dsl_dataset_ int dsl_dataset_snap_remove(dsl_dataset_t *ds, const char *name, dmu_tx_t *tx); void dsl_dataset_set_refreservation_sync_impl(dsl_dataset_t *ds, zprop_source_t source, uint64_t value, dmu_tx_t *tx); -int dsl_dataset_rollback(const char *fsname); +int dsl_dataset_rollback(const char *fsname, void *owner); #ifdef ZFS_DEBUG #define dprintf_ds(ds, fmt, ...) do { \ Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Fri Oct 25 15:37:58 2013 (r257118) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Fri Oct 25 15:43:59 2013 (r257119) @@ -3568,13 +3568,13 @@ zfs_ioc_rollback(zfs_cmd_t *zc) if (error == 0) { int resume_err; - error = dsl_dataset_rollback(zc->zc_name); + error = dsl_dataset_rollback(zc->zc_name, zfsvfs); resume_err = zfs_resume_fs(zfsvfs, zc->zc_name); error = error ? error : resume_err; } VFS_RELE(zfsvfs->z_vfs); } else { - error = dsl_dataset_rollback(zc->zc_name); + error = dsl_dataset_rollback(zc->zc_name, NULL); } return (error); } @@ -4110,13 +4110,13 @@ zfs_ioc_recv(zfs_cmd_t *zc) * If the suspend fails, then the recv_end will * likely also fail, and clean up after itself. */ - end_err = dmu_recv_end(&drc); + end_err = dmu_recv_end(&drc, zfsvfs); if (error == 0) error = zfs_resume_fs(zfsvfs, tofs); error = error ? error : end_err; VFS_RELE(zfsvfs->z_vfs); } else { - error = dmu_recv_end(&drc); + error = dmu_recv_end(&drc, NULL); } } @@ -4607,8 +4607,11 @@ zfs_ioc_userspace_upgrade(zfs_cmd_t *zc) * objset_phys_t). Suspend/resume the fs will do that. */ error = zfs_suspend_fs(zfsvfs); - if (error == 0) + if (error == 0) { + dmu_objset_refresh_ownership(zfsvfs->z_os, + zfsvfs); error = zfs_resume_fs(zfsvfs, zc->zc_name); + } } if (error == 0) error = dmu_objset_userspace_upgrade(zfsvfs->z_os); Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Fri Oct 25 15:37:58 2013 (r257118) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Fri Oct 25 15:43:59 2013 (r257119) @@ -2210,7 +2210,9 @@ zfs_fhtovp(vfs_t *vfsp, fid_t *fidp, int * Block out VOPs and close zfsvfs_t::z_os * * Note, if successful, then we return with the 'z_teardown_lock' and - * 'z_teardown_inactive_lock' write held. + * 'z_teardown_inactive_lock' write held. We leave ownership of the underlying + * dataset and objset intact so that they can be atomically handed off during + * a subsequent rollback or recv operation and the resume thereafter. */ int zfs_suspend_fs(zfsvfs_t *zfsvfs) @@ -2219,71 +2221,76 @@ zfs_suspend_fs(zfsvfs_t *zfsvfs) if ((error = zfsvfs_teardown(zfsvfs, B_FALSE)) != 0) return (error); - dmu_objset_disown(zfsvfs->z_os, zfsvfs); return (0); } /* - * Reopen zfsvfs_t::z_os and release VOPs. + * Rebuild SA and release VOPs. Note that ownership of the underlying dataset + * is an invariant across any of the operations that can be performed while the + * filesystem was suspended. Whether it succeeded or failed, the preconditions + * are the same: the relevant objset and associated dataset are owned by + * zfsvfs, held, and long held on entry. */ int zfs_resume_fs(zfsvfs_t *zfsvfs, const char *osname) { int err; + znode_t *zp; + uint64_t sa_obj = 0; ASSERT(RRW_WRITE_HELD(&zfsvfs->z_teardown_lock)); ASSERT(RW_WRITE_HELD(&zfsvfs->z_teardown_inactive_lock)); - err = dmu_objset_own(osname, DMU_OST_ZFS, B_FALSE, zfsvfs, - &zfsvfs->z_os); - if (err) { - zfsvfs->z_os = NULL; - } else { - znode_t *zp; - uint64_t sa_obj = 0; + /* + * We already own this, so just hold and rele it to update the + * objset_t, as the one we had before may have been evicted. + */ + VERIFY0(dmu_objset_hold(osname, zfsvfs, &zfsvfs->z_os)); + VERIFY3P(zfsvfs->z_os->os_dsl_dataset->ds_owner, ==, zfsvfs); + VERIFY(dsl_dataset_long_held(zfsvfs->z_os->os_dsl_dataset)); + dmu_objset_rele(zfsvfs->z_os, zfsvfs); - /* - * Make sure version hasn't changed - */ + /* + * Make sure version hasn't changed + */ - err = zfs_get_zplprop(zfsvfs->z_os, ZFS_PROP_VERSION, - &zfsvfs->z_version); + err = zfs_get_zplprop(zfsvfs->z_os, ZFS_PROP_VERSION, + &zfsvfs->z_version); - if (err) - goto bail; + if (err) + goto bail; - err = zap_lookup(zfsvfs->z_os, MASTER_NODE_OBJ, - ZFS_SA_ATTRS, 8, 1, &sa_obj); + err = zap_lookup(zfsvfs->z_os, MASTER_NODE_OBJ, + ZFS_SA_ATTRS, 8, 1, &sa_obj); - if (err && zfsvfs->z_version >= ZPL_VERSION_SA) - goto bail; + if (err && zfsvfs->z_version >= ZPL_VERSION_SA) + goto bail; - if ((err = sa_setup(zfsvfs->z_os, sa_obj, - zfs_attr_table, ZPL_END, &zfsvfs->z_attr_table)) != 0) - goto bail; + if ((err = sa_setup(zfsvfs->z_os, sa_obj, + zfs_attr_table, ZPL_END, &zfsvfs->z_attr_table)) != 0) + goto bail; - if (zfsvfs->z_version >= ZPL_VERSION_SA) - sa_register_update_callback(zfsvfs->z_os, - zfs_sa_upgrade); + if (zfsvfs->z_version >= ZPL_VERSION_SA) + sa_register_update_callback(zfsvfs->z_os, + zfs_sa_upgrade); - VERIFY(zfsvfs_setup(zfsvfs, B_FALSE) == 0); + VERIFY(zfsvfs_setup(zfsvfs, B_FALSE) == 0); - zfs_set_fuid_feature(zfsvfs); + zfs_set_fuid_feature(zfsvfs); - /* - * Attempt to re-establish all the active znodes with - * their dbufs. If a zfs_rezget() fails, then we'll let - * any potential callers discover that via ZFS_ENTER_VERIFY_VP - * when they try to use their znode. - */ - mutex_enter(&zfsvfs->z_znodes_lock); - for (zp = list_head(&zfsvfs->z_all_znodes); zp; - zp = list_next(&zfsvfs->z_all_znodes, zp)) { - (void) zfs_rezget(zp); - } - mutex_exit(&zfsvfs->z_znodes_lock); + /* + * Attempt to re-establish all the active znodes with + * their dbufs. If a zfs_rezget() fails, then we'll let + * any potential callers discover that via ZFS_ENTER_VERIFY_VP + * when they try to use their znode. + */ + mutex_enter(&zfsvfs->z_znodes_lock); + for (zp = list_head(&zfsvfs->z_all_znodes); zp; + zp = list_next(&zfsvfs->z_all_znodes, zp)) { + (void) zfs_rezget(zp); } + mutex_exit(&zfsvfs->z_znodes_lock); bail: /* release the VOPs */ @@ -2292,8 +2299,8 @@ bail: if (err) { /* - * Since we couldn't reopen zfsvfs::z_os, or - * setup the sa framework force unmount this file system. + * Since we couldn't setup the sa framework, try to force + * unmount this file system. */ if (vn_vfswlock(zfsvfs->z_vfs->vfs_vnodecovered) == 0) (void) dounmount(zfsvfs->z_vfs, MS_FORCE, curthread); From owner-svn-src-stable-9@FreeBSD.ORG Fri Oct 25 16:49:33 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 4CBDF4C8; Fri, 25 Oct 2013 16:49:33 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 3A382230B; Fri, 25 Oct 2013 16:49:33 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9PGnXYL041247; Fri, 25 Oct 2013 16:49:33 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9PGnX7B041246; Fri, 25 Oct 2013 16:49:33 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201310251649.r9PGnX7B041246@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 25 Oct 2013 16:49:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r257124 - stable/9/sys/fs/devfs X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 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, 25 Oct 2013 16:49:33 -0000 Author: kib Date: Fri Oct 25 16:49:32 2013 New Revision: 257124 URL: http://svnweb.freebsd.org/changeset/base/257124 Log: MFC r256501: Remove two instances of ARGSUSED comment, and wrap lines nearby the code that is to be changed. Modified: stable/9/sys/fs/devfs/devfs_vnops.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/fs/ (props changed) Modified: stable/9/sys/fs/devfs/devfs_vnops.c ============================================================================== --- stable/9/sys/fs/devfs/devfs_vnops.c Fri Oct 25 16:36:16 2013 (r257123) +++ stable/9/sys/fs/devfs/devfs_vnops.c Fri Oct 25 16:49:32 2013 (r257124) @@ -1168,9 +1168,9 @@ devfs_print(struct vop_print_args *ap) return (0); } -/* ARGSUSED */ static int -devfs_read_f(struct file *fp, struct uio *uio, struct ucred *cred, int flags, struct thread *td) +devfs_read_f(struct file *fp, struct uio *uio, struct ucred *cred, + int flags, struct thread *td) { struct cdev *dev; int ioflag, error, ref; @@ -1643,9 +1643,9 @@ devfs_truncate_f(struct file *fp, off_t return (vnops.fo_truncate(fp, length, cred, td)); } -/* ARGSUSED */ static int -devfs_write_f(struct file *fp, struct uio *uio, struct ucred *cred, int flags, struct thread *td) +devfs_write_f(struct file *fp, struct uio *uio, struct ucred *cred, + int flags, struct thread *td) { struct cdev *dev; int error, ioflag, ref; From owner-svn-src-stable-9@FreeBSD.ORG Fri Oct 25 17:04:47 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 79273AA3; Fri, 25 Oct 2013 17:04:47 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4C59723DE; Fri, 25 Oct 2013 17:04:47 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9PH4kXO047666; Fri, 25 Oct 2013 17:04:46 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9PH4kuN047662; Fri, 25 Oct 2013 17:04:46 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201310251704.r9PH4kuN047662@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 25 Oct 2013 17:04:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r257125 - in stable/9/sys: fs/devfs kern sys X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 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, 25 Oct 2013 17:04:47 -0000 Author: kib Date: Fri Oct 25 17:04:46 2013 New Revision: 257125 URL: http://svnweb.freebsd.org/changeset/base/257125 Log: MFC r256502: Similar to debug.iosize_max_clamp sysctl, introduce devfs_iosize_max_clamp sysctl, which allows/disables SSIZE_MAX-sized i/o requests on the devfs files. Modified: stable/9/sys/fs/devfs/devfs_vnops.c stable/9/sys/kern/sys_generic.c stable/9/sys/sys/systm.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/fs/ (props changed) stable/9/sys/sys/ (props changed) Modified: stable/9/sys/fs/devfs/devfs_vnops.c ============================================================================== --- stable/9/sys/fs/devfs/devfs_vnops.c Fri Oct 25 16:49:32 2013 (r257124) +++ stable/9/sys/fs/devfs/devfs_vnops.c Fri Oct 25 17:04:46 2013 (r257125) @@ -49,6 +49,7 @@ #include #include #include +#include #include #include #include @@ -1178,6 +1179,8 @@ devfs_read_f(struct file *fp, struct uio struct cdevsw *dsw; struct file *fpop; + if (uio->uio_resid > DEVFS_IOSIZE_MAX) + return (EINVAL); fpop = td->td_fpop; error = devfs_fp_check(fp, &dev, &dsw, &ref); if (error) @@ -1653,6 +1656,8 @@ devfs_write_f(struct file *fp, struct ui struct cdevsw *dsw; struct file *fpop; + if (uio->uio_resid > DEVFS_IOSIZE_MAX) + return (EINVAL); fpop = td->td_fpop; error = devfs_fp_check(fp, &dev, &dsw, &ref); if (error) Modified: stable/9/sys/kern/sys_generic.c ============================================================================== --- stable/9/sys/kern/sys_generic.c Fri Oct 25 16:49:32 2013 (r257124) +++ stable/9/sys/kern/sys_generic.c Fri Oct 25 17:04:46 2013 (r257125) @@ -77,6 +77,10 @@ __FBSDID("$FreeBSD$"); int iosize_max_clamp = 1; SYSCTL_INT(_debug, OID_AUTO, iosize_max_clamp, CTLFLAG_RW, &iosize_max_clamp, 0, "Clamp max i/o size to INT_MAX"); +int devfs_iosize_max_clamp = 1; +SYSCTL_INT(_debug, OID_AUTO, devfs_iosize_max_clamp, CTLFLAG_RW, + &devfs_iosize_max_clamp, 0, "Clamp max i/o size to INT_MAX for devices"); + /* * Assert that the return value of read(2) and write(2) syscalls fits * into a register. If not, an architecture will need to provide the Modified: stable/9/sys/sys/systm.h ============================================================================== --- stable/9/sys/sys/systm.h Fri Oct 25 16:49:32 2013 (r257124) +++ stable/9/sys/sys/systm.h Fri Oct 25 17:04:46 2013 (r257125) @@ -138,7 +138,9 @@ extern const void *zero_region; /* addre extern int unmapped_buf_allowed; extern int iosize_max_clamp; +extern int devfs_iosize_max_clamp; #define IOSIZE_MAX (iosize_max_clamp ? INT_MAX : SSIZE_MAX) +#define DEVFS_IOSIZE_MAX (devfs_iosize_max_clamp ? INT_MAX : SSIZE_MAX) /* * General function declarations. From owner-svn-src-stable-9@FreeBSD.ORG Fri Oct 25 17:15:58 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 0AF3C16C; Fri, 25 Oct 2013 17:15:58 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id D122C248F; Fri, 25 Oct 2013 17:15:57 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9PHFvWS054228; Fri, 25 Oct 2013 17:15:57 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9PHFvfG054225; Fri, 25 Oct 2013 17:15:57 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201310251715.r9PHFvfG054225@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 25 Oct 2013 17:15:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r257126 - in stable/9/sys: kern sys X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 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, 25 Oct 2013 17:15:58 -0000 Author: kib Date: Fri Oct 25 17:15:57 2013 New Revision: 257126 URL: http://svnweb.freebsd.org/changeset/base/257126 Log: MFC r256504: Add a sysctl kern.disallow_high_osrel which disables executing the images compiled on the world with higher major version number than the high version number of the booted kernel. Default to disable. Modified: stable/9/sys/kern/kern_exec.c stable/9/sys/sys/param.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/sys/ (props changed) Modified: stable/9/sys/kern/kern_exec.c ============================================================================== --- stable/9/sys/kern/kern_exec.c Fri Oct 25 17:04:46 2013 (r257125) +++ stable/9/sys/kern/kern_exec.c Fri Oct 25 17:15:57 2013 (r257126) @@ -122,6 +122,11 @@ u_long ps_arg_cache_limit = PAGE_SIZE / SYSCTL_ULONG(_kern, OID_AUTO, ps_arg_cache_limit, CTLFLAG_RW, &ps_arg_cache_limit, 0, ""); +static int disallow_high_osrel; +SYSCTL_INT(_kern, OID_AUTO, disallow_high_osrel, CTLFLAG_RW, + &disallow_high_osrel, 0, + "Disallow execution of binaries built for higher version of the world"); + static int map_at_zero = 0; TUNABLE_INT("security.bsd.map_at_zero", &map_at_zero); SYSCTL_INT(_security_bsd, OID_AUTO, map_at_zero, CTLFLAG_RW, &map_at_zero, 0, @@ -558,6 +563,15 @@ interpret: vn_fullpath(td, imgp->vp, &imgp->execpath, &imgp->freepath) != 0)) imgp->execpath = args->fname; + if (disallow_high_osrel && + P_OSREL_MAJOR(p->p_osrel) > P_OSREL_MAJOR(__FreeBSD_version)) { + error = ENOEXEC; + uprintf("Osrel %d for image %s too high\n", p->p_osrel, + imgp->execpath != NULL ? imgp->execpath : ""); + vn_lock(imgp->vp, LK_SHARED | LK_RETRY); + goto exec_fail_dealloc; + } + /* * Copy out strings (args and env) and initialize stack base */ Modified: stable/9/sys/sys/param.h ============================================================================== --- stable/9/sys/sys/param.h Fri Oct 25 17:04:46 2013 (r257125) +++ stable/9/sys/sys/param.h Fri Oct 25 17:15:57 2013 (r257126) @@ -80,6 +80,8 @@ #define P_OSREL_SIGWAIT 700000 #define P_OSREL_SIGSEGV 700004 #define P_OSREL_MAP_ANON 800104 + +#define P_OSREL_MAJOR(x) ((x) / 100000) #endif #ifndef LOCORE From owner-svn-src-stable-9@FreeBSD.ORG Sat Oct 26 11:56:52 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 8A4B7309; Sat, 26 Oct 2013 11:56:52 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 78C512930; Sat, 26 Oct 2013 11:56:52 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9QBuqjG045324; Sat, 26 Oct 2013 11:56:52 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9QBuqZi045323; Sat, 26 Oct 2013 11:56:52 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201310261156.r9QBuqZi045323@svn.freebsd.org> From: Dimitry Andric Date: Sat, 26 Oct 2013 11:56:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r257156 - stable/9/sys/dev/random X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 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: Sat, 26 Oct 2013 11:56:52 -0000 Author: dim Date: Sat Oct 26 11:56:51 2013 New Revision: 257156 URL: http://svnweb.freebsd.org/changeset/base/257156 Log: MFC r256157: Now our binutils's assembler supports the Intel Random Number Generator extensions, we can change the .byte directives in sys/dev/random/ivy.c to plain 'rdrand' mnemonics. This already worked for clang users, but now it will also work for gcc users. Approved by: so (des) Modified: stable/9/sys/dev/random/ivy.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/dev/random/ivy.c ============================================================================== --- stable/9/sys/dev/random/ivy.c Sat Oct 26 08:38:21 2013 (r257155) +++ stable/9/sys/dev/random/ivy.c Sat Oct 26 11:56:51 2013 (r257156) @@ -64,12 +64,12 @@ ivy_rng_store(long *tmp) __asm __volatile( #ifdef __amd64__ - ".byte\t0x48,0x0f,0xc7,0xf0\n\t" /* rdrand %rax */ + "rdrand\t%%rax\n\t" "jnc\t1f\n\t" "movq\t%%rax,%1\n\t" "movl\t$8,%%eax\n" #else /* i386 */ - ".byte\t0x0f,0xc7,0xf0\n\t" /* rdrand %eax */ + "rdrand\t%%eax\n\t" "jnc\t1f\n\t" "movl\t%%eax,%1\n\t" "movl\t$4,%%eax\n" From owner-svn-src-stable-9@FreeBSD.ORG Sat Oct 26 19:54:29 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 15C2D5A5; Sat, 26 Oct 2013 19:54:29 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 01F542FE7; Sat, 26 Oct 2013 19:54:29 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9QJsSJh010721; Sat, 26 Oct 2013 19:54:28 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9QJsSWh010720; Sat, 26 Oct 2013 19:54:28 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201310261954.r9QJsSWh010720@svn.freebsd.org> From: Xin LI Date: Sat, 26 Oct 2013 19:54:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r257192 - in stable: 8/usr.sbin/freebsd-update 9/usr.sbin/freebsd-update X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 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: Sat, 26 Oct 2013 19:54:29 -0000 Author: delphij Date: Sat Oct 26 19:54:28 2013 New Revision: 257192 URL: http://svnweb.freebsd.org/changeset/base/257192 Log: MFC r256646, r256767, r257038: When installing updates, install new directories first and remove old directories last. Allow ~ in file names so libtool droppings in contrib don't break updates. It has happened twice now, and is likely to happen again. Be more selective when filtering for lib*.so.N files. These are deleted at the end of the upgrade process, after warning users to upgrade any 3rd party software (e.g., from the ports tree) which might link to the libraries being removed. Errata Notice: FreeBSD-EN-13:04.freebsd-update Modified: stable/9/usr.sbin/freebsd-update/freebsd-update.sh Directory Properties: stable/9/usr.sbin/freebsd-update/ (props changed) Changes in other areas also in this revision: Modified: stable/8/usr.sbin/freebsd-update/freebsd-update.sh Directory Properties: stable/8/usr.sbin/freebsd-update/ (props changed) Modified: stable/9/usr.sbin/freebsd-update/freebsd-update.sh ============================================================================== --- stable/9/usr.sbin/freebsd-update/freebsd-update.sh Sat Oct 26 19:50:40 2013 (r257191) +++ stable/9/usr.sbin/freebsd-update/freebsd-update.sh Sat Oct 26 19:54:28 2013 (r257192) @@ -1200,7 +1200,7 @@ fetch_metadata_sanity () { # Some aliases to save space later: ${P} is a character which can # appear in a path; ${M} is the four numeric metadata fields; and # ${H} is a sha256 hash. - P="[-+./:=%@_[[:alnum:]]" + P="[-+./:=%@_[~[:alnum:]]" M="[0-9]+\|[0-9]+\|[0-9]+\|[0-9]+" H="[0-9a-f]{64}" @@ -2814,16 +2814,24 @@ Kernel updates have been installed. Ple # If we haven't already dealt with the world, deal with it. if ! [ -f $1/worlddone ]; then + # Create any necessary directories first + grep -vE '^/boot/' $1/INDEX-NEW | + grep -E '^[^|]+\|d\|' > INDEX-NEW + install_from_index INDEX-NEW || return 1 + # Install new shared libraries next grep -vE '^/boot/' $1/INDEX-NEW | - grep -E '/lib/.*\.so\.[0-9]+\|' > INDEX-NEW + grep -vE '^[^|]+\|d\|' | + grep -E '^[^|]*/lib/[^|]*\.so\.[0-9]+\|' > INDEX-NEW install_from_index INDEX-NEW || return 1 # Deal with everything else grep -vE '^/boot/' $1/INDEX-OLD | - grep -vE '/lib/.*\.so\.[0-9]+\|' > INDEX-OLD + grep -vE '^[^|]+\|d\|' | + grep -vE '^[^|]*/lib/[^|]*\.so\.[0-9]+\|' > INDEX-OLD grep -vE '^/boot/' $1/INDEX-NEW | - grep -vE '/lib/.*\.so\.[0-9]+\|' > INDEX-NEW + grep -vE '^[^|]+\|d\|' | + grep -vE '^[^|]*/lib/[^|]*\.so\.[0-9]+\|' > INDEX-NEW install_from_index INDEX-NEW || return 1 install_delete INDEX-OLD INDEX-NEW || return 1 @@ -2844,11 +2852,11 @@ Kernel updates have been installed. Ple # Do we need to ask the user to portupgrade now? grep -vE '^/boot/' $1/INDEX-NEW | - grep -E '/lib/.*\.so\.[0-9]+\|' | + grep -E '^[^|]*/lib/[^|]*\.so\.[0-9]+\|' | cut -f 1 -d '|' | sort > newfiles if grep -vE '^/boot/' $1/INDEX-OLD | - grep -E '/lib/.*\.so\.[0-9]+\|' | + grep -E '^[^|]*/lib/[^|]*\.so\.[0-9]+\|' | cut -f 1 -d '|' | sort | join -v 1 - newfiles | @@ -2868,9 +2876,18 @@ again to finish installing updates. # Remove old shared libraries grep -vE '^/boot/' $1/INDEX-NEW | - grep -E '/lib/.*\.so\.[0-9]+\|' > INDEX-NEW + grep -vE '^[^|]+\|d\|' | + grep -E '^[^|]*/lib/[^|]*\.so\.[0-9]+\|' > INDEX-NEW grep -vE '^/boot/' $1/INDEX-OLD | - grep -E '/lib/.*\.so\.[0-9]+\|' > INDEX-OLD + grep -vE '^[^|]+\|d\|' | + grep -E '^[^|]*/lib/[^|]*\.so\.[0-9]+\|' > INDEX-OLD + install_delete INDEX-OLD INDEX-NEW || return 1 + + # Remove old directories + grep -vE '^/boot/' $1/INDEX-OLD | + grep -E '^[^|]+\|d\|' > INDEX-OLD + grep -vE '^/boot/' $1/INDEX-OLD | + grep -E '^[^|]+\|d\|' > INDEX-OLD install_delete INDEX-OLD INDEX-NEW || return 1 # Remove temporary files