From owner-svn-src-stable-10@FreeBSD.ORG Sun Dec 15 03:47:35 2013 Return-Path: Delivered-To: svn-src-stable-10@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 ESMTPS id 8BF62B7C; Sun, 15 Dec 2013 03:47:35 +0000 (UTC) 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 7399C14D2; Sun, 15 Dec 2013 03:47:35 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBF3lZsl008393; Sun, 15 Dec 2013 03:47:35 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBF3lWNJ008373; Sun, 15 Dec 2013 03:47:32 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201312150347.rBF3lWNJ008373@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Sun, 15 Dec 2013 03:47:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259405 - in stable/10: contrib/gcc contrib/gcc/cp contrib/gcc/doc contrib/gcclibs/libcpp contrib/gcclibs/libcpp/include contrib/libstdc++/include/ext gnu/usr.bin/cc/cc_int gnu/usr.bin/... X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Dec 2013 03:47:35 -0000 Author: pfg Date: Sun Dec 15 03:47:31 2013 New Revision: 259405 URL: http://svnweb.freebsd.org/changeset/base/259405 Log: MFC rr258501, r258507; gcc: Bring updates from Google's enhanced gcc-4.2.1. Google released and enhanced version of gcc-4.2.1 plus their local patches for Android[1]. The patches are owned by Google and the license hasn't been changed from the original GPLv2. We are only bringing a subset of the available patches that may be helpful in FreeBSD, in other words, changes specific to android are not included. From the README.google file[1]. Patches applied to google_vendor_src_branch/gcc/gcc-4.2.1: gcc/Makefile.in gcc/c-common.c gcc/c-common.h gcc/c-opts.c gcc/c-typeck.c gcc/cp/typeck.c gcc/doc/invoke.texi gcc/flags.h gcc/opts.c gcc/tree-flow.h gcc/tree-ssa-alias-warnings.c gcc/tree-ssa-alias.c Backport of -Wstrict-aliasing from mainline. Silvius Rus gcc/coverage.c: Patch coverage_checksum_string for PR 25351. Seongbae Park Not yet submitted to FSF. gcc/c-opts.c gcc/c-ppoutput.c gcc/c.opt gcc/doc/cppopts.texi libcpp/Makefile.in libcpp/directives-only.c libcpp/directives.c libcpp/files.c libcpp/include/cpplib.h libcpp/init.c libcpp/internal.h libcpp/macro.c Support for -fdirectives-only. Ollie Wild . Submitted to FSF but not yet approved. libstdc++-v3/include/ext/hashtable.h http://b/742065 http://b/629994 Reduce min size of hashtable for hash_map, hash_set from 53 to 5 libstdc++-v3/include/ext/hashtable.h http://b/629994 Do not iterate over buckets if hashtable is empty. gcc/common.opt gcc/doc/invoke.texi gcc/flags.h gcc/gimplify.c gcc/opts.c Add Saito's patch for -finstrument-functions-exclude-* options. gcc/common.opt gcc/doc/invoke.texi gcc/final.c gcc/flags.h gcc/opts.c gcc/testsuite/gcc.dg/Wframe-larger-than.c Add a new flag -Wframe-larger-than- which enables a new warning when a frame size of a function is larger than specified. This patch hasn't been integrated into gcc mainline yet. gcc/tree-vrp.c Add a hack to avoid using ivopts information for pointers starting at constant values. Reference: [1] https://android.googlesource.com/toolchain/gcc/+/master/gcc-4.2.1/ Obtained from: Google Inc. Added: stable/10/contrib/gcc/tree-ssa-alias-warnings.c - copied unchanged from r258501, head/contrib/gcc/tree-ssa-alias-warnings.c stable/10/contrib/gcclibs/libcpp/directives-only.c - copied unchanged from r258501, head/contrib/gcclibs/libcpp/directives-only.c Modified: stable/10/contrib/gcc/c-common.c stable/10/contrib/gcc/c-common.h stable/10/contrib/gcc/c-opts.c stable/10/contrib/gcc/c-ppoutput.c stable/10/contrib/gcc/c-typeck.c stable/10/contrib/gcc/c.opt stable/10/contrib/gcc/common.opt stable/10/contrib/gcc/coverage.c stable/10/contrib/gcc/cp/typeck.c stable/10/contrib/gcc/doc/cppopts.texi stable/10/contrib/gcc/doc/invoke.texi stable/10/contrib/gcc/final.c stable/10/contrib/gcc/flags.h stable/10/contrib/gcc/gimplify.c stable/10/contrib/gcc/opts.c stable/10/contrib/gcc/tree-flow.h stable/10/contrib/gcc/tree-ssa-alias.c stable/10/contrib/gcc/tree-vrp.c stable/10/contrib/gcclibs/libcpp/Makefile.in stable/10/contrib/gcclibs/libcpp/directives.c stable/10/contrib/gcclibs/libcpp/files.c stable/10/contrib/gcclibs/libcpp/include/cpplib.h stable/10/contrib/gcclibs/libcpp/init.c stable/10/contrib/gcclibs/libcpp/internal.h stable/10/contrib/gcclibs/libcpp/macro.c stable/10/contrib/libstdc++/include/ext/hashtable.h stable/10/gnu/usr.bin/cc/cc_int/Makefile stable/10/gnu/usr.bin/cc/libcpp/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/gcc/c-common.c ============================================================================== --- stable/10/contrib/gcc/c-common.c Sun Dec 15 03:31:36 2013 (r259404) +++ stable/10/contrib/gcc/c-common.c Sun Dec 15 03:47:31 2013 (r259405) @@ -983,35 +983,67 @@ unsigned_conversion_warning (tree result strict aliasing mode is in effect. OTYPE is the original TREE_TYPE of EXPR, and TYPE the type we're casting to. */ -void +bool strict_aliasing_warning (tree otype, tree type, tree expr) { - if (flag_strict_aliasing && warn_strict_aliasing - && POINTER_TYPE_P (type) && POINTER_TYPE_P (otype) - && TREE_CODE (expr) == ADDR_EXPR + if (!(flag_strict_aliasing && POINTER_TYPE_P (type) + && POINTER_TYPE_P (otype) && !VOID_TYPE_P (TREE_TYPE (type)))) + return false; + + if ((warn_strict_aliasing > 1) && TREE_CODE (expr) == ADDR_EXPR && (DECL_P (TREE_OPERAND (expr, 0)) - || handled_component_p (TREE_OPERAND (expr, 0))) - && !VOID_TYPE_P (TREE_TYPE (type))) + || handled_component_p (TREE_OPERAND (expr, 0)))) { /* Casting the address of an object to non void pointer. Warn if the cast breaks type based aliasing. */ - if (!COMPLETE_TYPE_P (TREE_TYPE (type))) - warning (OPT_Wstrict_aliasing, "type-punning to incomplete type " - "might break strict-aliasing rules"); + if (!COMPLETE_TYPE_P (TREE_TYPE (type)) && warn_strict_aliasing == 2) + { + warning (OPT_Wstrict_aliasing, "type-punning to incomplete type " + "might break strict-aliasing rules"); + return true; + } else { - HOST_WIDE_INT set1 = get_alias_set (TREE_TYPE (TREE_OPERAND (expr, 0))); + /* warn_strict_aliasing >= 3. This includes the default (3). + Only warn if the cast is dereferenced immediately. */ + HOST_WIDE_INT set1 = + get_alias_set (TREE_TYPE (TREE_OPERAND (expr, 0))); HOST_WIDE_INT set2 = get_alias_set (TREE_TYPE (type)); if (!alias_sets_conflict_p (set1, set2)) - warning (OPT_Wstrict_aliasing, "dereferencing type-punned " - "pointer will break strict-aliasing rules"); - else if (warn_strict_aliasing > 1 - && !alias_sets_might_conflict_p (set1, set2)) - warning (OPT_Wstrict_aliasing, "dereferencing type-punned " - "pointer might break strict-aliasing rules"); + { + warning (OPT_Wstrict_aliasing, "dereferencing type-punned " + "pointer will break strict-aliasing rules"); + return true; + } + else if (warn_strict_aliasing == 2 + && !alias_sets_might_conflict_p (set1, set2)) + { + warning (OPT_Wstrict_aliasing, "dereferencing type-punned " + "pointer might break strict-aliasing rules"); + return true; + } } } + else + if ((warn_strict_aliasing == 1) && !VOID_TYPE_P (TREE_TYPE (otype))) + { + /* At this level, warn for any conversions, even if an address is + not taken in the same statement. This will likely produce many + false positives, but could be useful to pinpoint problems that + are not revealed at higher levels. */ + HOST_WIDE_INT set1 = get_alias_set (TREE_TYPE (otype)); + HOST_WIDE_INT set2 = get_alias_set (TREE_TYPE (type)); + if (!COMPLETE_TYPE_P(type) + || !alias_sets_might_conflict_p (set1, set2)) + { + warning (OPT_Wstrict_aliasing, "dereferencing type-punned " + "pointer might break strict-aliasing rules"); + return true; + } + } + + return false; } @@ -3108,6 +3140,85 @@ def_fn_type (builtin_type def, builtin_t builtin_types[def] = t; } +/* Build builtin functions common to both C and C++ language + frontends. */ + +static void +c_define_builtins (tree va_list_ref_type_node, tree va_list_arg_type_node) +{ +#define DEF_PRIMITIVE_TYPE(ENUM, VALUE) \ + builtin_types[ENUM] = VALUE; +#define DEF_FUNCTION_TYPE_0(ENUM, RETURN) \ + def_fn_type (ENUM, RETURN, 0, 0); +#define DEF_FUNCTION_TYPE_1(ENUM, RETURN, ARG1) \ + def_fn_type (ENUM, RETURN, 0, 1, ARG1); +#define DEF_FUNCTION_TYPE_2(ENUM, RETURN, ARG1, ARG2) \ + def_fn_type (ENUM, RETURN, 0, 2, ARG1, ARG2); +#define DEF_FUNCTION_TYPE_3(ENUM, RETURN, ARG1, ARG2, ARG3) \ + def_fn_type (ENUM, RETURN, 0, 3, ARG1, ARG2, ARG3); +#define DEF_FUNCTION_TYPE_4(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4) \ + def_fn_type (ENUM, RETURN, 0, 4, ARG1, ARG2, ARG3, ARG4); +#define DEF_FUNCTION_TYPE_5(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5) \ + def_fn_type (ENUM, RETURN, 0, 5, ARG1, ARG2, ARG3, ARG4, ARG5); +#define DEF_FUNCTION_TYPE_6(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, \ + ARG6) \ + def_fn_type (ENUM, RETURN, 0, 6, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6); +#define DEF_FUNCTION_TYPE_7(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, \ + ARG6, ARG7) \ + def_fn_type (ENUM, RETURN, 0, 7, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, ARG7); +#define DEF_FUNCTION_TYPE_VAR_0(ENUM, RETURN) \ + def_fn_type (ENUM, RETURN, 1, 0); +#define DEF_FUNCTION_TYPE_VAR_1(ENUM, RETURN, ARG1) \ + def_fn_type (ENUM, RETURN, 1, 1, ARG1); +#define DEF_FUNCTION_TYPE_VAR_2(ENUM, RETURN, ARG1, ARG2) \ + def_fn_type (ENUM, RETURN, 1, 2, ARG1, ARG2); +#define DEF_FUNCTION_TYPE_VAR_3(ENUM, RETURN, ARG1, ARG2, ARG3) \ + def_fn_type (ENUM, RETURN, 1, 3, ARG1, ARG2, ARG3); +#define DEF_FUNCTION_TYPE_VAR_4(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4) \ + def_fn_type (ENUM, RETURN, 1, 4, ARG1, ARG2, ARG3, ARG4); +#define DEF_FUNCTION_TYPE_VAR_5(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5) \ + def_fn_type (ENUM, RETURN, 1, 5, ARG1, ARG2, ARG3, ARG4, ARG5); +#define DEF_POINTER_TYPE(ENUM, TYPE) \ + builtin_types[(int) ENUM] = build_pointer_type (builtin_types[(int) TYPE]); + +#include "builtin-types.def" + +#undef DEF_PRIMITIVE_TYPE +#undef DEF_FUNCTION_TYPE_1 +#undef DEF_FUNCTION_TYPE_2 +#undef DEF_FUNCTION_TYPE_3 +#undef DEF_FUNCTION_TYPE_4 +#undef DEF_FUNCTION_TYPE_5 +#undef DEF_FUNCTION_TYPE_6 +#undef DEF_FUNCTION_TYPE_VAR_0 +#undef DEF_FUNCTION_TYPE_VAR_1 +#undef DEF_FUNCTION_TYPE_VAR_2 +#undef DEF_FUNCTION_TYPE_VAR_3 +#undef DEF_FUNCTION_TYPE_VAR_4 +#undef DEF_FUNCTION_TYPE_VAR_5 +#undef DEF_POINTER_TYPE + builtin_types[(int) BT_LAST] = NULL_TREE; + + c_init_attributes (); + +#define DEF_BUILTIN(ENUM, NAME, CLASS, TYPE, LIBTYPE, BOTH_P, FALLBACK_P, \ + NONANSI_P, ATTRS, IMPLICIT, COND) \ + if (NAME && COND) \ + def_builtin_1 (ENUM, NAME, CLASS, \ + builtin_types[(int) TYPE], \ + builtin_types[(int) LIBTYPE], \ + BOTH_P, FALLBACK_P, NONANSI_P, \ + built_in_attributes[(int) ATTRS], IMPLICIT); +#include "builtins.def" +#undef DEF_BUILTIN + + build_common_builtin_nodes (); + + targetm.init_builtins (); + if (flag_mudflap) + mudflap_init (); +} + /* Build tree nodes and builtin functions common to both C and C++ language frontends. */ @@ -3320,77 +3431,8 @@ c_common_nodes_and_builtins (void) va_list_ref_type_node = build_reference_type (va_list_type_node); } -#define DEF_PRIMITIVE_TYPE(ENUM, VALUE) \ - builtin_types[ENUM] = VALUE; -#define DEF_FUNCTION_TYPE_0(ENUM, RETURN) \ - def_fn_type (ENUM, RETURN, 0, 0); -#define DEF_FUNCTION_TYPE_1(ENUM, RETURN, ARG1) \ - def_fn_type (ENUM, RETURN, 0, 1, ARG1); -#define DEF_FUNCTION_TYPE_2(ENUM, RETURN, ARG1, ARG2) \ - def_fn_type (ENUM, RETURN, 0, 2, ARG1, ARG2); -#define DEF_FUNCTION_TYPE_3(ENUM, RETURN, ARG1, ARG2, ARG3) \ - def_fn_type (ENUM, RETURN, 0, 3, ARG1, ARG2, ARG3); -#define DEF_FUNCTION_TYPE_4(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4) \ - def_fn_type (ENUM, RETURN, 0, 4, ARG1, ARG2, ARG3, ARG4); -#define DEF_FUNCTION_TYPE_5(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5) \ - def_fn_type (ENUM, RETURN, 0, 5, ARG1, ARG2, ARG3, ARG4, ARG5); -#define DEF_FUNCTION_TYPE_6(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, \ - ARG6) \ - def_fn_type (ENUM, RETURN, 0, 6, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6); -#define DEF_FUNCTION_TYPE_7(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, \ - ARG6, ARG7) \ - def_fn_type (ENUM, RETURN, 0, 7, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, ARG7); -#define DEF_FUNCTION_TYPE_VAR_0(ENUM, RETURN) \ - def_fn_type (ENUM, RETURN, 1, 0); -#define DEF_FUNCTION_TYPE_VAR_1(ENUM, RETURN, ARG1) \ - def_fn_type (ENUM, RETURN, 1, 1, ARG1); -#define DEF_FUNCTION_TYPE_VAR_2(ENUM, RETURN, ARG1, ARG2) \ - def_fn_type (ENUM, RETURN, 1, 2, ARG1, ARG2); -#define DEF_FUNCTION_TYPE_VAR_3(ENUM, RETURN, ARG1, ARG2, ARG3) \ - def_fn_type (ENUM, RETURN, 1, 3, ARG1, ARG2, ARG3); -#define DEF_FUNCTION_TYPE_VAR_4(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4) \ - def_fn_type (ENUM, RETURN, 1, 4, ARG1, ARG2, ARG3, ARG4); -#define DEF_FUNCTION_TYPE_VAR_5(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5) \ - def_fn_type (ENUM, RETURN, 1, 5, ARG1, ARG2, ARG3, ARG4, ARG5); -#define DEF_POINTER_TYPE(ENUM, TYPE) \ - builtin_types[(int) ENUM] = build_pointer_type (builtin_types[(int) TYPE]); - -#include "builtin-types.def" - -#undef DEF_PRIMITIVE_TYPE -#undef DEF_FUNCTION_TYPE_1 -#undef DEF_FUNCTION_TYPE_2 -#undef DEF_FUNCTION_TYPE_3 -#undef DEF_FUNCTION_TYPE_4 -#undef DEF_FUNCTION_TYPE_5 -#undef DEF_FUNCTION_TYPE_6 -#undef DEF_FUNCTION_TYPE_VAR_0 -#undef DEF_FUNCTION_TYPE_VAR_1 -#undef DEF_FUNCTION_TYPE_VAR_2 -#undef DEF_FUNCTION_TYPE_VAR_3 -#undef DEF_FUNCTION_TYPE_VAR_4 -#undef DEF_FUNCTION_TYPE_VAR_5 -#undef DEF_POINTER_TYPE - builtin_types[(int) BT_LAST] = NULL_TREE; - - c_init_attributes (); - -#define DEF_BUILTIN(ENUM, NAME, CLASS, TYPE, LIBTYPE, BOTH_P, FALLBACK_P, \ - NONANSI_P, ATTRS, IMPLICIT, COND) \ - if (NAME && COND) \ - def_builtin_1 (ENUM, NAME, CLASS, \ - builtin_types[(int) TYPE], \ - builtin_types[(int) LIBTYPE], \ - BOTH_P, FALLBACK_P, NONANSI_P, \ - built_in_attributes[(int) ATTRS], IMPLICIT); -#include "builtins.def" -#undef DEF_BUILTIN - - build_common_builtin_nodes (); - - targetm.init_builtins (); - if (flag_mudflap) - mudflap_init (); + if (!flag_preprocess_only) + c_define_builtins (va_list_ref_type_node, va_list_arg_type_node); main_identifier_node = get_identifier ("main"); Modified: stable/10/contrib/gcc/c-common.h ============================================================================== --- stable/10/contrib/gcc/c-common.h Sun Dec 15 03:31:36 2013 (r259404) +++ stable/10/contrib/gcc/c-common.h Sun Dec 15 03:47:31 2013 (r259405) @@ -654,7 +654,7 @@ extern void binary_op_error (enum tree_c extern tree fix_string_type (tree); struct varray_head_tag; extern void constant_expression_warning (tree); -extern void strict_aliasing_warning(tree, tree, tree); +extern bool strict_aliasing_warning (tree, tree, tree); extern void empty_body_warning (tree, tree); extern tree convert_and_check (tree, tree); extern void overflow_warning (tree); Modified: stable/10/contrib/gcc/c-opts.c ============================================================================== --- stable/10/contrib/gcc/c-opts.c Sun Dec 15 03:31:36 2013 (r259404) +++ stable/10/contrib/gcc/c-opts.c Sun Dec 15 03:47:31 2013 (r259405) @@ -396,7 +396,7 @@ c_common_handle_option (size_t scode, co if (c_dialect_cxx ()) warn_sign_compare = value; warn_switch = value; - warn_strict_aliasing = value; + set_warn_strict_aliasing (value); warn_strict_overflow = value; warn_address = value; @@ -606,6 +606,10 @@ c_common_handle_option (size_t scode, co disable_builtin_function (arg); break; + case OPT_fdirectives_only: + cpp_opts->directives_only = 1; + break; + case OPT_fdollars_in_identifiers: cpp_opts->dollars_in_ident = value; break; @@ -1329,6 +1333,11 @@ sanitize_cpp_opts (void) if (flag_dump_macros == 'M') flag_no_output = 1; + /* By default, -fdirectives-only implies -dD. This allows subsequent phases + to perform proper macro expansion. */ + if (cpp_opts->directives_only && !cpp_opts->preprocessed && !flag_dump_macros) + flag_dump_macros = 'D'; + /* Disable -dD, -dN and -dI if normal output is suppressed. Allow -dM since at least glibc relies on -M -dM to work. */ /* Also, flag_no_output implies flag_no_line_commands, always. */ @@ -1359,6 +1368,14 @@ sanitize_cpp_opts (void) actually output the current directory? */ if (flag_working_directory == -1) flag_working_directory = (debug_info_level != DINFO_LEVEL_NONE); + + if (cpp_opts->directives_only) + { + if (warn_unused_macros) + error ("-fdirectives-only is incompatible with -Wunused_macros"); + if (cpp_opts->traditional) + error ("-fdirectives-only is incompatible with -traditional"); + } } /* Add include path with a prefix at the front of its name. */ @@ -1442,6 +1459,8 @@ finish_options (void) } } } + else if (cpp_opts->directives_only) + cpp_init_special_builtins (parse_in); include_cursor = 0; push_command_line_include (); Modified: stable/10/contrib/gcc/c-ppoutput.c ============================================================================== --- stable/10/contrib/gcc/c-ppoutput.c Sun Dec 15 03:31:36 2013 (r259404) +++ stable/10/contrib/gcc/c-ppoutput.c Sun Dec 15 03:47:31 2013 (r259405) @@ -41,6 +41,8 @@ static struct /* General output routines. */ static void scan_translation_unit (cpp_reader *); +static void print_lines_directives_only (int, const void *, size_t); +static void scan_translation_unit_directives_only (cpp_reader *); static void scan_translation_unit_trad (cpp_reader *); static void account_for_newlines (const unsigned char *, size_t); static int dump_macro (cpp_reader *, cpp_hashnode *, void *); @@ -75,6 +77,9 @@ preprocess_file (cpp_reader *pfile) } else if (cpp_get_options (pfile)->traditional) scan_translation_unit_trad (pfile); + else if (cpp_get_options (pfile)->directives_only + && !cpp_get_options (pfile)->preprocessed) + scan_translation_unit_directives_only (pfile); else scan_translation_unit (pfile); @@ -179,6 +184,26 @@ scan_translation_unit (cpp_reader *pfile } } +static void +print_lines_directives_only (int lines, const void *buf, size_t size) +{ + print.src_line += lines; + fwrite (buf, 1, size, print.outf); +} + +/* Writes out the preprocessed file, handling spacing and paste + avoidance issues. */ +static void +scan_translation_unit_directives_only (cpp_reader *pfile) +{ + struct _cpp_dir_only_callbacks cb; + + cb.print_lines = print_lines_directives_only; + cb.maybe_print_line = maybe_print_line; + + _cpp_preprocess_dir_only (pfile, &cb); +} + /* Adjust print.src_line for newlines embedded in output. */ static void account_for_newlines (const unsigned char *str, size_t len) Modified: stable/10/contrib/gcc/c-typeck.c ============================================================================== --- stable/10/contrib/gcc/c-typeck.c Sun Dec 15 03:31:36 2013 (r259404) +++ stable/10/contrib/gcc/c-typeck.c Sun Dec 15 03:47:31 2013 (r259405) @@ -1876,6 +1876,19 @@ build_indirect_ref (tree ptr, const char if (TREE_CODE (type) == POINTER_TYPE) { + if (TREE_CODE (pointer) == CONVERT_EXPR + || TREE_CODE (pointer) == NOP_EXPR + || TREE_CODE (pointer) == VIEW_CONVERT_EXPR) + { + /* If a warning is issued, mark it to avoid duplicates from + the backend. This only needs to be done at + warn_strict_aliasing > 2. */ + if (warn_strict_aliasing > 2) + if (strict_aliasing_warning (TREE_TYPE (TREE_OPERAND (pointer, 0)), + type, TREE_OPERAND (pointer, 0))) + TREE_NO_WARNING (pointer) = 1; + } + if (TREE_CODE (pointer) == ADDR_EXPR && (TREE_TYPE (TREE_OPERAND (pointer, 0)) == TREE_TYPE (type))) @@ -3562,7 +3575,8 @@ build_c_cast (tree type, tree expr) warning (OPT_Wint_to_pointer_cast, "cast to pointer from integer " "of different size"); - strict_aliasing_warning (otype, type, expr); + if (warn_strict_aliasing <= 2) + strict_aliasing_warning (otype, type, expr); /* If pedantic, warn for conversions between function and object pointer types, except for converting a null pointer constant Modified: stable/10/contrib/gcc/c.opt ============================================================================== --- stable/10/contrib/gcc/c.opt Sun Dec 15 03:31:36 2013 (r259404) +++ stable/10/contrib/gcc/c.opt Sun Dec 15 03:47:31 2013 (r259405) @@ -494,6 +494,10 @@ fdefault-inline C++ ObjC++ Inline member functions by default +fdirectives-only +C ObjC C++ ObjC++ +Preprocess directives only. + fdollars-in-identifiers C ObjC C++ ObjC++ Permit '$' as an identifier character Modified: stable/10/contrib/gcc/common.opt ============================================================================== --- stable/10/contrib/gcc/common.opt Sun Dec 15 03:31:36 2013 (r259404) +++ stable/10/contrib/gcc/common.opt Sun Dec 15 03:47:31 2013 (r259405) @@ -95,7 +95,11 @@ Warn when an inlined function cannot be Wlarger-than- Common RejectNegative Joined UInteger --Wlarger-than- Warn if an object is larger than bytes +-Wlarger-than- Warn if an object is larger than bytes + +Wframe-larger-than- +Common RejectNegative Joined UInteger +-Wframe-larger-than- Warn if the frame size of a function is larger than bytes Wunsafe-loop-optimizations Common Var(warn_unsafe_loop_optimizations) @@ -537,6 +541,14 @@ finstrument-functions Common Report Var(flag_instrument_function_entry_exit) Instrument function entry and exit with profiling calls +finstrument-functions-exclude-function-list= +Common RejectNegative Joined +-finstrument-functions-exclude-function-list=name,... Do not instrument listed functions + +finstrument-functions-exclude-file-list= +Common RejectNegative Joined +-finstrument-functions-exclude-file-list=filename,... Do not instrument functions listed in files + fipa-cp Common Report Var(flag_ipa_cp) Perform Interprocedural constant propagation Modified: stable/10/contrib/gcc/coverage.c ============================================================================== --- stable/10/contrib/gcc/coverage.c Sun Dec 15 03:31:36 2013 (r259404) +++ stable/10/contrib/gcc/coverage.c Sun Dec 15 03:47:31 2013 (r259405) @@ -429,57 +429,75 @@ tree_coverage_counter_ref (unsigned coun static unsigned coverage_checksum_string (unsigned chksum, const char *string) { - int i; char *dup = NULL; + char *ptr; /* Look for everything that looks if it were produced by get_file_function_name_long and zero out the second part that may result from flag_random_seed. This is not critical as the checksums are used only for sanity checking. */ - for (i = 0; string[i]; i++) +#define GLOBAL_PREFIX "_GLOBAL__" +#define TRAILING_N "N_" +#define ISCAPXDIGIT(a) (((a) >= '0' && (a) <= '9') || ((a) >= 'A' && (a) <= 'F')) + if ((ptr = strstr (string, GLOBAL_PREFIX))) { - int offset = 0; - if (!strncmp (string + i, "_GLOBAL__N_", 11)) - offset = 11; - if (!strncmp (string + i, "_GLOBAL__", 9)) - offset = 9; - - /* C++ namespaces do have scheme: - _GLOBAL__N___functionname - since filename might contain extra underscores there seems - to be no better chance then walk all possible offsets looking - for magicnuber. */ - if (offset) - { - for (i = i + offset; string[i]; i++) - if (string[i]=='_') - { - int y; - - for (y = 1; y < 9; y++) - if (!(string[i + y] >= '0' && string[i + y] <= '9') - && !(string[i + y] >= 'A' && string[i + y] <= 'F')) - break; - if (y != 9 || string[i + 9] != '_') - continue; - for (y = 10; y < 18; y++) - if (!(string[i + y] >= '0' && string[i + y] <= '9') - && !(string[i + y] >= 'A' && string[i + y] <= 'F')) - break; - if (y != 18) - continue; - if (!dup) - string = dup = xstrdup (string); - for (y = 10; y < 18; y++) - dup[i + y] = '0'; - } - break; - } + /* Skip _GLOBAL__. */ + ptr += strlen (GLOBAL_PREFIX); + + /* Skip optional N_ (in case __GLOBAL_N__). */ + if (!strncmp (ptr, TRAILING_N, strlen (TRAILING_N))) + ptr += strlen (TRAILING_N); + /* At this point, ptr should point after "_GLOBAL__N_" or "_GLOBAL__". */ + + while ((ptr = strchr (ptr, '_')) != NULL) + { + int y; + /* For every "_" in the rest of the string, + try the follwing pattern matching */ + + /* Skip over '_'. */ + ptr++; +#define NDIGITS (8) + /* Try matching the pattern: + <8-digit hex>_<8-digit hex> + The second number is randomly generated + so we want to mask it out before computing the checksum. */ + for (y = 0; *ptr != 0 && y < NDIGITS; y++, ptr++) + if (!ISCAPXDIGIT (*ptr)) + break; + if (y != NDIGITS || *ptr != '_') + continue; + /* Skip over '_' again. */ + ptr++; + for (y = 0; *ptr != 0 && y < NDIGITS; y++, ptr++) + if (!ISCAPXDIGIT (*ptr)) + break; + + if (y == NDIGITS) + { + /* We have a match. + Duplicate the string and mask out + the second 8-digit number. */ + dup = xstrdup (string); + ptr = dup + (ptr - string); + for(y = -NDIGITS - 1 ; y < 0; y++) + { + ptr[y] = '0'; + } + ptr = dup; + break; + } + } + /* "ptr" should be NULL if we couldn't find the match + (strchr will return NULL if no match is found), + or it should point to dup which contains the string + with the random part masked. */ } - chksum = crc32_string (chksum, string); + chksum = crc32_string (chksum, (ptr) ? ptr : string); + if (dup) - free (dup); + free (dup); return chksum; } Modified: stable/10/contrib/gcc/cp/typeck.c ============================================================================== --- stable/10/contrib/gcc/cp/typeck.c Sun Dec 15 03:31:36 2013 (r259404) +++ stable/10/contrib/gcc/cp/typeck.c Sun Dec 15 03:47:31 2013 (r259405) @@ -2334,6 +2334,19 @@ build_indirect_ref (tree ptr, const char types. */ tree t = canonical_type_variant (TREE_TYPE (type)); + if (TREE_CODE (ptr) == CONVERT_EXPR + || TREE_CODE (ptr) == NOP_EXPR + || TREE_CODE (ptr) == VIEW_CONVERT_EXPR) + { + /* If a warning is issued, mark it to avoid duplicates from + the backend. This only needs to be done at + warn_strict_aliasing > 2. */ + if (warn_strict_aliasing > 2) + if (strict_aliasing_warning (TREE_TYPE (TREE_OPERAND (ptr, 0)), + type, TREE_OPERAND (ptr, 0))) + TREE_NO_WARNING (ptr) = 1; + } + if (VOID_TYPE_P (t)) { /* A pointer to incomplete type (other than cv void) can be @@ -5256,7 +5269,8 @@ build_reinterpret_cast_1 (tree type, tre /* We need to strip nops here, because the frontend likes to create (int *)&a for array-to-pointer decay, instead of &a[0]. */ STRIP_NOPS (sexpr); - strict_aliasing_warning (intype, type, sexpr); + if (warn_strict_aliasing <= 2) + strict_aliasing_warning (intype, type, sexpr); return fold_if_not_in_template (build_nop (type, expr)); } Modified: stable/10/contrib/gcc/doc/cppopts.texi ============================================================================== --- stable/10/contrib/gcc/doc/cppopts.texi Sun Dec 15 03:31:36 2013 (r259404) +++ stable/10/contrib/gcc/doc/cppopts.texi Sun Dec 15 03:47:31 2013 (r259405) @@ -506,6 +506,22 @@ Search @var{dir} only for header files r @xref{Search Path}. @end ifset +@item -fdirectives-only +@opindex fdirectives-only +This option provides a simplified preprocessor to improve the +performance of distributed build systems such as distcc. It's +behavior depends on a number of other flags. + +If the @option{-E} option is enabled, it suppresses things like macro +expansion, trigraph conversion, and escaped newline splicing +outside of directives. All directives are processed normally, except that +macro definitions are output similar to the @option{-dD} option. + +If the @option{-fpreprocessed} option is enabled, it suppresses +predefinition of most builtin and command line macros. This +prevents duplicate definition of macros output with the @option{-E} +option. + @item -fdollars-in-identifiers @opindex fdollars-in-identifiers @anchor{fdollars-in-identifiers} Modified: stable/10/contrib/gcc/doc/invoke.texi ============================================================================== --- stable/10/contrib/gcc/doc/invoke.texi Sun Dec 15 03:31:36 2013 (r259404) +++ stable/10/contrib/gcc/doc/invoke.texi Sun Dec 15 03:47:31 2013 (r259405) @@ -214,7 +214,8 @@ in the following sections. -Wimport -Wno-import -Winit-self -Winline @gol -Wno-int-to-pointer-cast @gol -Wno-invalid-offsetof -Winvalid-pch @gol --Wlarger-than-@var{len} -Wunsafe-loop-optimizations -Wlong-long @gol +-Wlarger-than-@var{len} -Wframe-larger-than-@var{len} @gol +-Wunsafe-loop-optimizations -Wlong-long @gol -Wmain -Wmissing-braces -Wmissing-field-initializers @gol -Wmissing-format-attribute -Wmissing-include-dirs @gol -Wmissing-noreturn @gol @@ -758,6 +759,8 @@ See S/390 and zSeries Options. -fnon-call-exceptions -funwind-tables @gol -fasynchronous-unwind-tables @gol -finhibit-size-directive -finstrument-functions @gol +-finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} @gol +-finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{} @gol -fno-common -fno-ident @gol -fpcc-struct-return -fpic -fPIC -fpie -fPIE @gol -fno-jump-tables @gol @@ -2505,14 +2508,40 @@ It warns about code which might break th compiler is using for optimization. The warning does not catch all cases, but does attempt to catch the more common pitfalls. It is included in @option{-Wall}. +It is equivalent to -Wstrict-aliasing=3 -@item -Wstrict-aliasing=2 -@opindex Wstrict-aliasing=2 +@item -Wstrict-aliasing=n +@opindex Wstrict-aliasing=n This option is only active when @option{-fstrict-aliasing} is active. It warns about code which might break the strict aliasing rules that the -compiler is using for optimization. This warning catches more cases than -@option{-Wstrict-aliasing}, but it will also give a warning for some ambiguous -cases that are safe. +compiler is using for optimization. +Higher levels correspond to higher accuracy (fewer false positives). +Higher levels also correspond to more effort, similar to the way -O works. +@option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=n}, +with n=3. + +Level 1: Most aggressive, quick, least accurate. +Possibly useful when higher levels +do not warn but -fstrict-aliasing still breaks the code, as it has very few +false negatives. However, it has many false positives. +Warns for all pointer conversions between possibly incompatible types, +even if never dereferenced. Runs in the frontend only. + +Level 2: Aggressive, quick, not too precise. +May still have many false positives (not as many as level 1 though), +and few false negatives (but possibly more than level 1). +Unlike level 1, it only warns when an address is taken. Warns about +incomplete types. Runs in the frontend only. + +Level 3 (default for @option{-Wstrict-aliasing}): +Should have very few false positives and few false +negatives. Slightly slower than levels 1 or 2 when optimization is enabled. +Takes care of the common punn+dereference pattern in the frontend: +@code{*(int*)&some_float}. +If optimization is enabled, it also runs in the backend, where it deals +with multiple statement cases using flow-sensitive points-to information. +Only warns when the converted pointer is dereferenced. +Does not warn about incomplete types. @item -Wstrict-overflow @item -Wstrict-overflow=@var{n} @@ -2828,6 +2857,10 @@ global variable or whenever a built-in f @opindex Wlarger-than Warn whenever an object of larger than @var{len} bytes is defined. +@item -Wframe-larger-than-@var{len} +@opindex Wframe-larger-than +Warn whenever the frame size of a function is larger than @var{len} bytes. + @item -Wunsafe-loop-optimizations @opindex Wunsafe-loop-optimizations Warn if the loop cannot be optimized because the compiler could not @@ -13355,6 +13388,37 @@ interrupt routines, and any functions fr cannot safely be called (perhaps signal handlers, if the profiling routines generate output or allocate memory). +@item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{} +@opindex finstrument-functions-exclude-file-list + +Set the list of functions that are excluded from instrumentation (see +the description of @code{-finstrument-functions}). If the file that +contains a function definition matches with one of @var{file}, then +that function is not instrumented. The match is done on substrings: +if the @var{file} parameter is a substring of the file name, it is +considered to be a match. + +For example, +@code{-finstrument-functions-exclude-file-list=/bits/stl,include/sys} +will exclude any inline function defined in files whose pathnames +contain @code{/bits/stl} or @code{include/sys}. + +If, for some reason, you want to include letter @code{','} in one of +@var{sym}, write @code{'\,'}. For example, +@code{-finstrument-functions-exclude-file-list='\,\,tmp'} +(note the single quote surrounding the option). + +@item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} +@opindex finstrument-functions-exclude-function-list + +This is similar to @code{-finstrument-functions-exclude-file-list}, +but this option sets the list of function names to be excluded from +instrumentation. The function name to be matched is its user-visible +name, such as @code{vector blah(const vector &)}, not the +internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}). The +match is done on substrings: if the @var{sym} parameter is a substring +of the function name, it is considered to be a match. + @item -fstack-check @opindex fstack-check Generate code to verify that you do not go beyond the boundary of the @@ -13932,3 +13996,4 @@ exist, because otherwise they won't get @xref{Protoize Caveats}, for more information on how to use @code{protoize} successfully. + Modified: stable/10/contrib/gcc/final.c ============================================================================== --- stable/10/contrib/gcc/final.c Sun Dec 15 03:31:36 2013 (r259404) +++ stable/10/contrib/gcc/final.c Sun Dec 15 03:47:31 2013 (r259405) @@ -1425,6 +1425,15 @@ final_start_function (rtx first ATTRIBUT TREE_ASM_WRITTEN (DECL_INITIAL (current_function_decl)) = 1; } + if (warn_frame_larger_than + && get_frame_size () > frame_larger_than_size) + { + /* Issue a warning */ + warning (OPT_Wframe_larger_than_, + "the frame size of %wd bytes is larger than %wd bytes", + get_frame_size (), frame_larger_than_size); + } + /* First output the function prologue: code to set up the stack frame. */ targetm.asm_out.function_prologue (file, get_frame_size ()); @@ -4083,4 +4092,3 @@ struct tree_opt_pass pass_clean_state = 0, /* todo_flags_finish */ 0 /* letter */ }; - Modified: stable/10/contrib/gcc/flags.h ============================================================================== --- stable/10/contrib/gcc/flags.h Sun Dec 15 03:31:36 2013 (r259404) +++ stable/10/contrib/gcc/flags.h Sun Dec 15 03:47:31 2013 (r259405) @@ -122,6 +122,15 @@ extern bool extra_warnings; extern void set_Wunused (int setting); +/* Used to set the level of -Wstrict-aliasing, when no level is specified. + The external way to set the default level is to use + -Wstrict-aliasing=level. + ONOFF is assumed to take value 1 when -Wstrict-aliasing is specified, + and 0 otherwise. After calling this function, wstrict_aliasing will be + set to the default value of -Wstrict_aliasing=level. */ + +extern void set_warn_strict_aliasing (int onoff); + /* Nonzero means warn about any objects definitions whose size is larger than N bytes. Also want about function definitions whose returned values are larger than N bytes. The value N is in `larger_than_size'. */ @@ -129,6 +138,12 @@ extern void set_Wunused (int setting); extern bool warn_larger_than; extern HOST_WIDE_INT larger_than_size; +/* Nonzero means warn about any function whose frame size is larger + than N bytes. */ + +extern bool warn_frame_larger_than; +extern HOST_WIDE_INT frame_larger_than_size; + /* Nonzero means warn about constructs which might not be strict aliasing safe. */ @@ -287,6 +302,10 @@ extern const char *flag_random_seed; #define abi_version_at_least(N) \ (flag_abi_version == 0 || flag_abi_version >= (N)) +/* Return whether the function should be excluded from + instrumentation. */ +extern bool flag_instrument_functions_exclude_p (tree fndecl); + /* True if the given mode has a NaN representation and the treatment of NaN operands is important. Certain optimizations, such as folding x * 0 into 0, are not correct for NaN operands, and are normally Modified: stable/10/contrib/gcc/gimplify.c ============================================================================== --- stable/10/contrib/gcc/gimplify.c Sun Dec 15 03:31:36 2013 (r259404) +++ stable/10/contrib/gcc/gimplify.c Sun Dec 15 03:47:31 2013 (r259405) @@ -6397,7 +6397,8 @@ gimplify_function_tree (tree fndecl) catch the exit hook. */ /* ??? Add some way to ignore exceptions for this TFE. */ if (flag_instrument_function_entry_exit - && ! DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT (fndecl)) + && !DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT (fndecl) + && !flag_instrument_functions_exclude_p (fndecl)) { tree tf, x, bind; Modified: stable/10/contrib/gcc/opts.c ============================================================================== --- stable/10/contrib/gcc/opts.c Sun Dec 15 03:31:36 2013 (r259404) +++ stable/10/contrib/gcc/opts.c Sun Dec 15 03:47:31 2013 (r259405) @@ -59,6 +59,11 @@ bool extra_warnings; bool warn_larger_than; HOST_WIDE_INT larger_than_size; +/* True to warn about any function whose frame size is larger + * than N bytes. */ +bool warn_frame_larger_than; +HOST_WIDE_INT frame_larger_than_size; + /* Nonzero means warn about constructs which might not be strict-aliasing safe. */ int warn_strict_aliasing; @@ -358,6 +363,15 @@ static bool flag_unroll_loops_set, flag_ static bool flag_value_profile_transformations_set; static bool flag_peel_loops_set, flag_branch_probabilities_set; +/* Functions excluded from profiling. */ + +typedef char *char_p; /* For DEF_VEC_P. */ +DEF_VEC_P(char_p); +DEF_VEC_ALLOC_P(char_p,heap); + +static VEC(char_p,heap) *flag_instrument_functions_exclude_functions; +static VEC(char_p,heap) *flag_instrument_functions_exclude_files; + /* Input file names. */ const char **in_fnames; unsigned num_in_fnames; @@ -604,6 +618,87 @@ add_input_filename (const char *filename in_fnames[num_in_fnames - 1] = filename; } +/* Add functions or file names to a vector of names to exclude from + instrumentation. */ + +static void +add_instrument_functions_exclude_list (VEC(char_p,heap) **pvec, + const char* arg) +{ + char *tmp; + char *r; + char *w; + char *token_start; + + /* We never free this string. */ + tmp = xstrdup (arg); + + r = tmp; + w = tmp; + token_start = tmp; + + while (*r != '\0') + { + if (*r == ',') + { + *w++ = '\0'; + ++r; + VEC_safe_push (char_p, heap, *pvec, token_start); + token_start = w; + } + if (*r == '\\' && r[1] == ',') + { + *w++ = ','; + r += 2; + } + else + *w++ = *r++; + } + if (*token_start != '\0') + VEC_safe_push (char_p, heap, *pvec, token_start); +} + +/* Return whether we should exclude FNDECL from instrumentation. */ + +bool +flag_instrument_functions_exclude_p (tree fndecl) +{ + if (VEC_length (char_p, flag_instrument_functions_exclude_functions) > 0) + { + const char *name; + int i; + char *s; + + name = lang_hooks.decl_printable_name (fndecl, 0); + for (i = 0; + VEC_iterate (char_p, flag_instrument_functions_exclude_functions, + i, s); + ++i) + { + if (strstr (name, s) != NULL) + return true; + } + } + + if (VEC_length (char_p, flag_instrument_functions_exclude_files) > 0) + { + const char *name; + int i; + char *s; + + name = DECL_SOURCE_FILE (fndecl); + for (i = 0; + VEC_iterate (char_p, flag_instrument_functions_exclude_files, i, s); + ++i) + { + if (strstr (name, s) != NULL) + return true; + } + } + + return false; +} + /* Decode and handle the vector of command line options. LANG_MASK contains has a single bit set representing the current language. */ @@ -979,7 +1074,15 @@ common_handle_option (size_t scode, cons warn_larger_than = value != -1; break; + case OPT_Wframe_larger_than_: + frame_larger_than_size = value; + warn_frame_larger_than = value != -1; + break; + case OPT_Wstrict_aliasing: + set_warn_strict_aliasing (value); + break; + case OPT_Wstrict_aliasing_: warn_strict_aliasing = value; break; @@ -1086,6 +1189,16 @@ common_handle_option (size_t scode, cons set_param_value ("max-inline-insns-auto", value / 2); break; + case OPT_finstrument_functions_exclude_function_list_: + add_instrument_functions_exclude_list + (&flag_instrument_functions_exclude_functions, arg); + break; + + case OPT_finstrument_functions_exclude_file_list_: + add_instrument_functions_exclude_list + (&flag_instrument_functions_exclude_files, arg); + break; + case OPT_fmessage_length_: pp_set_line_maximum_length (global_dc->printer, value); break; @@ -1348,6 +1461,20 @@ set_Wunused (int setting) warn_unused_value = setting; } +/* Used to set the level of strict aliasing warnings, + when no level is specified (i.e., when -Wstrict-aliasing, and not + -Wstrict-aliasing=level was given). + ONOFF is assumed to take value 1 when -Wstrict-aliasing is specified, + and 0 otherwise. After calling this function, wstrict_aliasing will be + set to the default value of -Wstrict_aliasing=level, currently 3. */ +void +set_warn_strict_aliasing (int onoff) +{ + gcc_assert (onoff == 0 || onoff == 1); + if (onoff != 0) + warn_strict_aliasing = 3; +} + /* The following routines are useful in setting all the flags that -ffast-math and -fno-fast-math imply. */ void Modified: stable/10/contrib/gcc/tree-flow.h ============================================================================== --- stable/10/contrib/gcc/tree-flow.h Sun Dec 15 03:31:36 2013 (r259404) +++ stable/10/contrib/gcc/tree-flow.h Sun Dec 15 03:47:31 2013 (r259405) @@ -694,6 +694,8 @@ static inline bool overlap_subvar (unsig definition, a function with this prototype is called. */ typedef bool (*walk_use_def_chains_fn) (tree, tree, void *); +/* In tree-ssa-alias-warnings.c */ +extern void strict_aliasing_warning_backend (void); /* In tree-ssa.c */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-10@FreeBSD.ORG Sun Dec 15 04:27:49 2013 Return-Path: Delivered-To: svn-src-stable-10@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 ESMTPS id CC3171B8; Sun, 15 Dec 2013 04:27:49 +0000 (UTC) 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 9930016C1; Sun, 15 Dec 2013 04:27:49 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBF4Rn53023025; Sun, 15 Dec 2013 04:27:49 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBF4Rnk4023024; Sun, 15 Dec 2013 04:27:49 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201312150427.rBF4Rnk4023024@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Sun, 15 Dec 2013 04:27:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259408 - stable/10/contrib/gcclibs/libcpp X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Dec 2013 04:27:50 -0000 Author: pfg Date: Sun Dec 15 04:27:49 2013 New Revision: 259408 URL: http://svnweb.freebsd.org/changeset/base/259408 Log: MFC r258530; libcpp: Keep a record of changes from upstream GCC (pre-43). Added: stable/10/contrib/gcclibs/libcpp/ChangeLog.gcc43 - copied unchanged from r258530, head/contrib/gcclibs/libcpp/ChangeLog.gcc43 Modified: Directory Properties: stable/10/ (props changed) Copied: stable/10/contrib/gcclibs/libcpp/ChangeLog.gcc43 (from r258530, head/contrib/gcclibs/libcpp/ChangeLog.gcc43) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/contrib/gcclibs/libcpp/ChangeLog.gcc43 Sun Dec 15 04:27:49 2013 (r259408, copy of r258530, head/contrib/gcclibs/libcpp/ChangeLog.gcc43) @@ -0,0 +1,29 @@ +2007-06-05 Joerg Wunsch (r250566) + + PR preprocessor/23479 + * expr.c (cpp_classify_number): Implement 0b-prefixed binary + integer constants. + (append_digit): Likewise. + * include/cpplib.h: Add CPP_N_BINARY, to be used for 0b-prefixed + binary integer constants. + +2007-05-21 Ian Lance Taylor (r124929) + + * internal.h (struct cpp_reader): Add new fields: + nonexistent_file_hash and nonexistent_file_ob. + * files.c: Include "obstack.h". + (find_file_in_dir): Before trying to open the file, look up the + path name in the hash table of nonexistent files. After failing + to open the file, add the path name to the hash table. + (_cpp_find_file): Cache the results of looking up the file name + starting with the quote and bracket chain heads, if we can. + (nonexistent_file_hash_eq): New static function. + (_cpp_init_files): Initialize pfile->nonexistent_file_hash and + pfile->nonexistent_file_ob. + (_cpp_cleanup_files): Free pfile->nonexistent_file_hash and + pfile->nonexistent_file_ob. + +2006-12-29 Ian Lance Taylor (r120263) + + * lex.c (_cpp_clean_line): Add uses of __builtin_expect. Don't + look backward at the end of the line unless we saw a backslash. From owner-svn-src-stable-10@FreeBSD.ORG Mon Dec 16 01:20:19 2013 Return-Path: Delivered-To: svn-src-stable-10@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 ESMTPS id A9A93713; Mon, 16 Dec 2013 01:20:19 +0000 (UTC) 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 941C312D6; Mon, 16 Dec 2013 01:20: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 rBG1KJWl082793; Mon, 16 Dec 2013 01:20:19 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBG1KItL082437; Mon, 16 Dec 2013 01:20:18 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201312160120.rBG1KItL082437@svn.freebsd.org> From: Eitan Adler Date: Mon, 16 Dec 2013 01:20:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259443 - in stable/10: tools/regression/usr.bin/sed usr.bin/sed usr.sbin/bsdinstall/scripts X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Dec 2013 01:20:19 -0000 Author: eadler Date: Mon Dec 16 01:20:18 2013 New Revision: 259443 URL: http://svnweb.freebsd.org/changeset/base/259443 Log: MFC r259132,r259133,r259143: Per the resolution of POSIX bug 0000779 (note 0002050) add support for using 'i' as a case insensitive flag. Add regression test for recently added 'i' flag in r259132. the i modifier was added in r259132 since POSIX recently agreed to add it. Switch uses of /I to /i. PR: standards/184641 Added: stable/10/tools/regression/usr.bin/sed/regress.icase4.out - copied unchanged from r259133, head/tools/regression/usr.bin/sed/regress.icase4.out Modified: stable/10/tools/regression/usr.bin/sed/regress.sh stable/10/usr.bin/sed/compile.c stable/10/usr.bin/sed/sed.1 stable/10/usr.sbin/bsdinstall/scripts/services Directory Properties: stable/10/ (props changed) Copied: stable/10/tools/regression/usr.bin/sed/regress.icase4.out (from r259133, head/tools/regression/usr.bin/sed/regress.icase4.out) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/tools/regression/usr.bin/sed/regress.icase4.out Mon Dec 16 01:20:18 2013 (r259443, copy of r259133, head/tools/regression/usr.bin/sed/regress.icase4.out) @@ -0,0 +1,4 @@ +input +data +for validation +of Foo(1) Modified: stable/10/tools/regression/usr.bin/sed/regress.sh ============================================================================== --- stable/10/tools/regression/usr.bin/sed/regress.sh Mon Dec 16 00:59:05 2013 (r259442) +++ stable/10/tools/regression/usr.bin/sed/regress.sh Mon Dec 16 01:20:18 2013 (r259443) @@ -66,6 +66,7 @@ REGRESSION_TEST_FREEFORM(`inplace5', `in REGRESSION_TEST(`icase1', `sed /SED/Id < regress.in') REGRESSION_TEST(`icase2', `sed s/SED/Foo/I < regress.in') REGRESSION_TEST(`icase3', `sed s/SED/Foo/ < regress.in') +REGRESSION_TEST(`icase4', `sed s/SED/Foo/i < regress.in') REGRESSION_TEST(`hanoi', `echo ":abcd: : :" | sed -f hanoi.sed') REGRESSION_TEST(`math', `echo "4+7*3+2^7/3" | sed -f math.sed') Modified: stable/10/usr.bin/sed/compile.c ============================================================================== --- stable/10/usr.bin/sed/compile.c Mon Dec 16 00:59:05 2013 (r259442) +++ stable/10/usr.bin/sed/compile.c Mon Dec 16 01:20:18 2013 (r259443) @@ -582,6 +582,7 @@ compile_flags(char *p, struct s_subst *s case 'p': s->p = 1; break; + case 'i': case 'I': s->icase = 1; break; Modified: stable/10/usr.bin/sed/sed.1 ============================================================================== --- stable/10/usr.bin/sed/sed.1 Mon Dec 16 00:59:05 2013 (r259442) +++ stable/10/usr.bin/sed/sed.1 Mon Dec 16 01:20:18 2013 (r259443) @@ -31,7 +31,7 @@ .\" @(#)sed.1 8.2 (Berkeley) 12/30/93 .\" $FreeBSD$ .\" -.Dd May 24, 2009 +.Dd December 9, 2013 .Dt SED 1 .Os .Sh NAME @@ -196,7 +196,7 @@ option was specified); a context address that consists of a regular expression preceded and followed by a delimiter. The closing delimiter can also optionally be followed by the -.Dq I +.Dq i character, to indicate that the regular expression is to be matched in a case-insensitive way. .El @@ -507,7 +507,7 @@ Append the pattern space to if a replacement was made. If the replacement string is identical to that which it replaces, it is still considered to have been a replacement. -.It I +.It i or I Match the regular expression in a case-insensitive way. .El .Pp Modified: stable/10/usr.sbin/bsdinstall/scripts/services ============================================================================== --- stable/10/usr.sbin/bsdinstall/scripts/services Mon Dec 16 00:59:05 2013 (r259442) +++ stable/10/usr.sbin/bsdinstall/scripts/services Mon Dec 16 01:20:18 2013 (r259443) @@ -29,7 +29,7 @@ : ${DIALOG_OK=0} if [ -f $BSDINSTALL_TMPETC/rc.conf.services ]; then - eval `sed -e s/YES/on/I -e s/NO/off/I $BSDINSTALL_TMPETC/rc.conf.services` + eval `sed -e s/YES/on/i -e s/NO/off/i $BSDINSTALL_TMPETC/rc.conf.services` else # Default service states. Everything is off if not enabled. sshd_enable="on" From owner-svn-src-stable-10@FreeBSD.ORG Mon Dec 16 01:47:52 2013 Return-Path: Delivered-To: svn-src-stable-10@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 ESMTPS id BA111C20; Mon, 16 Dec 2013 01:47:52 +0000 (UTC) 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 8BB7414B1; Mon, 16 Dec 2013 01:47: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 rBG1lqqO090859; Mon, 16 Dec 2013 01:47:52 GMT (envelope-from peter@svn.freebsd.org) Received: (from peter@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBG1lqg6090858; Mon, 16 Dec 2013 01:47:52 GMT (envelope-from peter@svn.freebsd.org) Message-Id: <201312160147.rBG1lqg6090858@svn.freebsd.org> From: Peter Wemm Date: Mon, 16 Dec 2013 01:47:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259445 - stable/10 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Dec 2013 01:47:52 -0000 Author: peter Date: Mon Dec 16 01:47:52 2013 New Revision: 259445 URL: http://svnweb.freebsd.org/changeset/base/259445 Log: Record r258428 and r258445 as not merged. Modified: Directory Properties: stable/10/ (props changed) From owner-svn-src-stable-10@FreeBSD.ORG Mon Dec 16 02:04:29 2013 Return-Path: Delivered-To: svn-src-stable-10@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 ESMTPS id 7A22819B; Mon, 16 Dec 2013 02:04:29 +0000 (UTC) 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 6576C15D2; Mon, 16 Dec 2013 02:04: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 rBG24Tcj097915; Mon, 16 Dec 2013 02:04:29 GMT (envelope-from bjk@svn.freebsd.org) Received: (from bjk@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBG24ST3097912; Mon, 16 Dec 2013 02:04:28 GMT (envelope-from bjk@svn.freebsd.org) Message-Id: <201312160204.rBG24ST3097912@svn.freebsd.org> From: Benjamin Kaduk Date: Mon, 16 Dec 2013 02:04:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259447 - in stable/10: . crypto/heimdal/lib/gssapi/krb5 sys/sys X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Dec 2013 02:04:29 -0000 Author: bjk (doc committer) Date: Mon Dec 16 02:04:28 2013 New Revision: 259447 URL: http://svnweb.freebsd.org/changeset/base/259447 Log: MFC r259286,259424,259425: Apply patch from upstream Heimdal for encoding fix RFC 4402 specifies the implementation of the gss_pseudo_random() function for the krb5 mechanism (and the C bindings therein). The implementation uses a PRF+ function that concatenates the output of individual krb5 pseudo-random operations produced with a counter and seed. The original implementation of this function in Heimdal incorrectly encoded the counter as a little-endian integer, but the RFC specifies the counter encoding as big-endian. The implementation initializes the counter to zero, so the first block of output (16 octets, for the modern AES enctypes 17 and 18) is unchanged. (RFC 4402 specifies that the counter should begin at 1, but both existing implementations begin with zero and it looks like the standard will be re-issued, with test vectors, to begin at zero.) This is upstream's commit f85652af868e64811f2b32b815d4198e7f9017f6, from 13 October, 2013: % Fix krb5's gss_pseudo_random() (n is big-endian) % % The first enctype RFC3961 prf output length's bytes are correct because % the little- and big-endian representations of unsigned zero are the % same. The second block of output was wrong because the counter was not % being encoded as big-endian. % % This change could break applications. But those applications would not % have been interoperating with other implementations anyways (in % particular: MIT's). Bump __FreeBSD_version accordingly and add a note in UPDATING. Approved by: hrs (mentor, src committer) Modified: stable/10/UPDATING stable/10/crypto/heimdal/lib/gssapi/krb5/prf.c stable/10/sys/sys/param.h Directory Properties: stable/10/ (props changed) Modified: stable/10/UPDATING ============================================================================== --- stable/10/UPDATING Mon Dec 16 01:58:12 2013 (r259446) +++ stable/10/UPDATING Mon Dec 16 02:04:28 2013 (r259447) @@ -16,6 +16,17 @@ from older versions of FreeBSD, try WITH stable/10, and then rebuild without this option. The bootstrap process from older version of current is a bit fragile. +20131216: + The behavior of gss_pseudo_random() for the krb5 mechanism + has changed, for applications requesting a longer random string + than produced by the underlying enctype's pseudo-random() function. + In particular, the random string produced from a session key of + enctype aes256-cts-hmac-sha1-96 or aes256-cts-hmac-sha1-96 will + be different at the 17th octet and later, after this change. + The counter used in the PRF+ construction is now encoded as a + big-endian integer in accordance with RFC 4402. + __FreeBSD_version is bumped to 1000701. + 20131031: The default version of mtree is nmtree which is obtained from NetBSD. The output is generally the same, but may vary Modified: stable/10/crypto/heimdal/lib/gssapi/krb5/prf.c ============================================================================== --- stable/10/crypto/heimdal/lib/gssapi/krb5/prf.c Mon Dec 16 01:58:12 2013 (r259446) +++ stable/10/crypto/heimdal/lib/gssapi/krb5/prf.c Mon Dec 16 02:04:28 2013 (r259447) @@ -119,7 +119,7 @@ _gsskrb5_pseudo_random(OM_uint32 *minor_ while(dol > 0) { size_t tsize; - _gsskrb5_encode_om_uint32(num, input.data); + _gsskrb5_encode_be_om_uint32(num, input.data); ret = krb5_crypto_prf(context, crypto, &input, &output); if (ret) { @@ -133,7 +133,7 @@ _gsskrb5_pseudo_random(OM_uint32 *minor_ tsize = min(dol, output.length); memcpy(p, output.data, tsize); - p += output.length; + p += tsize; dol -= tsize; krb5_data_free(&output); num++; Modified: stable/10/sys/sys/param.h ============================================================================== --- stable/10/sys/sys/param.h Mon Dec 16 01:58:12 2013 (r259446) +++ stable/10/sys/sys/param.h Mon Dec 16 02:04:28 2013 (r259447) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1000700 /* Master, propagated to newvers */ +#define __FreeBSD_version 1000701 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-stable-10@FreeBSD.ORG Mon Dec 16 06:41:32 2013 Return-Path: Delivered-To: svn-src-stable-10@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 ESMTPS id 4A42417E; Mon, 16 Dec 2013 06:41:32 +0000 (UTC) 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 356DF1CC6; Mon, 16 Dec 2013 06:41:32 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBG6fWGL098453; Mon, 16 Dec 2013 06:41:32 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBG6fWiY098452; Mon, 16 Dec 2013 06:41:32 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201312160641.rBG6fWiY098452@svn.freebsd.org> From: Xin LI Date: Mon, 16 Dec 2013 06:41:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259450 - stable/10/sys/i386/conf X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Dec 2013 06:41:32 -0000 Author: delphij Date: Mon Dec 16 06:41:31 2013 New Revision: 259450 URL: http://svnweb.freebsd.org/changeset/base/259450 Log: MFC r258950: Enable Hyper-V support in i386 GENERIC. Modified: stable/10/sys/i386/conf/GENERIC Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/i386/conf/GENERIC ============================================================================== --- stable/10/sys/i386/conf/GENERIC Mon Dec 16 02:30:56 2013 (r259449) +++ stable/10/sys/i386/conf/GENERIC Mon Dec 16 06:41:31 2013 (r259450) @@ -346,6 +346,9 @@ device virtio_blk # VirtIO Block device device virtio_scsi # VirtIO SCSI device device virtio_balloon # VirtIO Memory Balloon device +# HyperV drivers +device hyperv # HyperV drivers + # Xen HVM Guest Optimizations # NOTE: XENHVM depends on xenpci. They must be added or removed together. options XENHVM # Xen HVM kernel infrastructure From owner-svn-src-stable-10@FreeBSD.ORG Mon Dec 16 08:10:40 2013 Return-Path: Delivered-To: svn-src-stable-10@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 ESMTPS id 4A704D3B; Mon, 16 Dec 2013 08:10:40 +0000 (UTC) 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 33D0C13DB; Mon, 16 Dec 2013 08:10:40 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBG8AeV5030107; Mon, 16 Dec 2013 08:10:40 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBG8Adg4030099; Mon, 16 Dec 2013 08:10:39 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201312160810.rBG8Adg4030099@svn.freebsd.org> From: Hans Petter Selasky Date: Mon, 16 Dec 2013 08:10:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259453 - in stable/10: share/man/man4 sys/dev/usb sys/dev/usb/wlan X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Dec 2013 08:10:40 -0000 Author: hselasky Date: Mon Dec 16 08:10:38 2013 New Revision: 259453 URL: http://svnweb.freebsd.org/changeset/base/259453 Log: MFC r238274, r246752, r256720, r256721, r256722, r256955, r257409 r257429, r257435, r257712, r257732, r257743, r257748, r257955 r257957, r257958, r258082, r258641, r258643, r258732, r258733, r258840, r258919, r258921, r259029, r259030, r259031, r259032 and r259046: - Add support for the MediaTek/Ralink RT5370/RT5372 chipset. - Various minor USB WLAN fixes and improvements. PR: usb/182936 Modified: stable/10/share/man/man4/run.4 stable/10/share/man/man4/runfw.4 stable/10/sys/dev/usb/usbdevs stable/10/sys/dev/usb/wlan/if_rsu.c stable/10/sys/dev/usb/wlan/if_rum.c stable/10/sys/dev/usb/wlan/if_run.c stable/10/sys/dev/usb/wlan/if_runreg.h stable/10/sys/dev/usb/wlan/if_runvar.h stable/10/sys/dev/usb/wlan/if_uath.c stable/10/sys/dev/usb/wlan/if_upgt.c stable/10/sys/dev/usb/wlan/if_ural.c stable/10/sys/dev/usb/wlan/if_urtw.c stable/10/sys/dev/usb/wlan/if_urtwn.c stable/10/sys/dev/usb/wlan/if_zyd.c Directory Properties: stable/10/ (props changed) Modified: stable/10/share/man/man4/run.4 ============================================================================== --- stable/10/share/man/man4/run.4 Mon Dec 16 06:56:38 2013 (r259452) +++ stable/10/share/man/man4/run.4 Mon Dec 16 08:10:38 2013 (r259453) @@ -16,7 +16,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 9, 2012 +.Dd November 11, 2013 .Dt RUN 4 .Os .Sh NAME @@ -52,7 +52,7 @@ runfw_load="YES" The .Nm driver supports USB 2.0 wireless adapters based on the Ralink RT2700U, -RT2800U and RT3000U chipsets. +RT2800U, RT3000U and RT3900E chipsets. .Pp The RT2700U chipset consists of two integrated chips, an RT2770 MAC/BBP and an RT2720 (1T2R) or RT2750 (dual-band 1T2R) radio transceiver. @@ -64,6 +64,9 @@ The RT3000U is a single-chip solution ba an RT3020 (1T1R), RT3021 (1T2R) or RT3022 (2T2R) single-band radio transceiver. .Pp +The RT3900E is a single-chip solution based on an RT5390 MAC/BBP and +an RT5370 (1T1R) or RT5372 (2T2R) single-band radio transceiver. +.Pp These are the modes the .Nm driver can operate in: @@ -129,7 +132,8 @@ driver supports the following wireless a .It Corega CG-WLUSB300AGN .It Corega CG-WLUSB300GNM .It D-Link DWA-130 rev B1 -.It D-Link DWA-140 rev B1, B2 +.It D-Link DWA-140 rev B1, B2, B3 +.It D-Link DWA-160 rev B2 .It DrayTek Vigor N61 .It Edimax EW-7711UAn .It Edimax EW-7711UTn @@ -156,6 +160,8 @@ driver supports the following wireless a .It SMC SMCWUSBS-N2 .It Sweex LW303 .It Sweex LW313 +.It TP-LINK TL-WDN3200 +.It TP-LINK TL-WN727N v3 .It Unex DNUR-81 .It Unex DNUR-82 .It ZyXEL NWD210N Modified: stable/10/share/man/man4/runfw.4 ============================================================================== --- stable/10/share/man/man4/runfw.4 Mon Dec 16 06:56:38 2013 (r259452) +++ stable/10/share/man/man4/runfw.4 Mon Dec 16 08:10:38 2013 (r259453) @@ -18,7 +18,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 12, 2011 +.Dd November 11, 2013 .Dt RUNFW 4 .Os .Sh NAME @@ -43,7 +43,7 @@ runfw_load="YES" .Ed .Sh DESCRIPTION This module provides firmware sets for the Ralink RT2700U, -RT2800U and RT3000U chip based USB WiFi adapters. +RT2800U, RT3000U and RT3900E chip based USB WiFi adapters. Please read Ralink's license, src/sys/contrib/dev/run/LICENSE. .Sh SEE ALSO .Xr run 4 , Modified: stable/10/sys/dev/usb/usbdevs ============================================================================== --- stable/10/sys/dev/usb/usbdevs Mon Dec 16 06:56:38 2013 (r259452) +++ stable/10/sys/dev/usb/usbdevs Mon Dec 16 08:10:38 2013 (r259453) @@ -1549,6 +1549,8 @@ product DLINK DWLG122 0x3c00 DWL-G122 b product DLINK DUBE100B1 0x3c05 DUB-E100 rev B1 product DLINK RT2870 0x3c09 RT2870 product DLINK RT3072 0x3c0a RT3072 +product DLINK DWA140B3 0x3c15 DWA-140 rev B3 +product DLINK DWA160B2 0x3c1a DWA-160 rev B2 product DLINK DWA127 0x3c1b DWA-127 Wireless Adapter product DLINK DSB650C 0x4000 10Mbps Ethernet product DLINK DSB650TX1 0x4001 10/100 Ethernet @@ -3572,6 +3574,7 @@ product RALINK RT3072 0x3072 RT3072 product RALINK RT3370 0x3370 RT3370 product RALINK RT3572 0x3572 RT3572 product RALINK RT5370 0x5370 RT5370 +product RALINK RT5572 0x5572 RT5572 product RALINK RT8070 0x8070 RT8070 product RALINK RT2570_3 0x9020 RT2500USB Wireless Adapter product RALINK RT2573_2 0x9021 RT2501USB Wireless Adapter Modified: stable/10/sys/dev/usb/wlan/if_rsu.c ============================================================================== --- stable/10/sys/dev/usb/wlan/if_rsu.c Mon Dec 16 06:56:38 2013 (r259452) +++ stable/10/sys/dev/usb/wlan/if_rsu.c Mon Dec 16 08:10:38 2013 (r259453) @@ -480,8 +480,13 @@ rsu_vap_create(struct ieee80211com *ic, if (uvp == NULL) return (NULL); vap = &uvp->vap; - ieee80211_vap_setup(ic, vap, name, unit, opmode, - flags, bssid, mac); + + if (ieee80211_vap_setup(ic, vap, name, unit, opmode, + flags, bssid, mac) != 0) { + /* out of memory */ + free(uvp, M_80211_VAP); + return (NULL); + } /* override state transition machine */ uvp->newstate = vap->iv_newstate; @@ -1153,7 +1158,7 @@ rsu_event_survey(struct rsu_softc *sc, u wh->i_fc[0] = IEEE80211_FC0_VERSION_0 | IEEE80211_FC0_TYPE_MGT | IEEE80211_FC0_SUBTYPE_BEACON; wh->i_fc[1] = IEEE80211_FC1_DIR_NODS; - *(uint16_t *)wh->i_dur = 0; + USETW(wh->i_dur, 0); IEEE80211_ADDR_COPY(wh->i_addr1, ifp->if_broadcastaddr); IEEE80211_ADDR_COPY(wh->i_addr2, bss->macaddr); IEEE80211_ADDR_COPY(wh->i_addr3, bss->macaddr); Modified: stable/10/sys/dev/usb/wlan/if_rum.c ============================================================================== --- stable/10/sys/dev/usb/wlan/if_rum.c Mon Dec 16 06:56:38 2013 (r259452) +++ stable/10/sys/dev/usb/wlan/if_rum.c Mon Dec 16 08:10:38 2013 (r259453) @@ -604,8 +604,13 @@ rum_vap_create(struct ieee80211com *ic, return NULL; vap = &rvp->vap; /* enable s/w bmiss handling for sta mode */ - ieee80211_vap_setup(ic, vap, name, unit, opmode, - flags | IEEE80211_CLONE_NOBEACONS, bssid, mac); + + if (ieee80211_vap_setup(ic, vap, name, unit, opmode, + flags | IEEE80211_CLONE_NOBEACONS, bssid, mac) != 0) { + /* out of memory */ + free(rvp, M_80211_VAP); + return (NULL); + } /* override state transition machine */ rvp->newstate = vap->iv_newstate; @@ -1131,7 +1136,7 @@ rum_tx_mgt(struct rum_softc *sc, struct dur = ieee80211_ack_duration(ic->ic_rt, tp->mgmtrate, ic->ic_flags & IEEE80211_F_SHPREAMBLE); - *(uint16_t *)wh->i_dur = htole16(dur); + USETW(wh->i_dur, dur); /* tell hardware to add timestamp for probe responses */ if ((wh->i_fc[0] & @@ -1275,7 +1280,7 @@ rum_tx_data(struct rum_softc *sc, struct dur = ieee80211_ack_duration(ic->ic_rt, rate, ic->ic_flags & IEEE80211_F_SHPREAMBLE); - *(uint16_t *)wh->i_dur = htole16(dur); + USETW(wh->i_dur, dur); } rum_setup_tx_desc(sc, &data->desc, flags, 0, m0->m_pkthdr.len, rate); Modified: stable/10/sys/dev/usb/wlan/if_run.c ============================================================================== --- stable/10/sys/dev/usb/wlan/if_run.c Mon Dec 16 06:56:38 2013 (r259452) +++ stable/10/sys/dev/usb/wlan/if_run.c Mon Dec 16 08:10:38 2013 (r259453) @@ -2,6 +2,7 @@ * Copyright (c) 2008,2010 Damien Bergamini * ported to FreeBSD by Akinori Furukoshi * USB Consulting, Hans Petter Selasky + * Copyright (c) 2013 Kevin Lo * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -20,7 +21,7 @@ __FBSDID("$FreeBSD$"); /*- - * Ralink Technology RT2700U/RT2800U/RT3000U chipset driver. + * Ralink Technology RT2700U/RT2800U/RT3000U/RT3900E chipset driver. * http://www.ralinktech.com/ */ @@ -74,8 +75,6 @@ __FBSDID("$FreeBSD$"); #include #include -#define N(_a) ((int)(sizeof((_a)) / sizeof((_a)[0]))) - #ifdef USB_DEBUG #define RUN_DEBUG #endif @@ -173,6 +172,8 @@ static const STRUCT_USB_HOST_ID run_devs RUN_DEV(DLINK, RT2870), RUN_DEV(DLINK, RT3072), RUN_DEV(DLINK, DWA127), + RUN_DEV(DLINK, DWA140B3), + RUN_DEV(DLINK, DWA160B2), RUN_DEV(DLINK2, DWA130), RUN_DEV(DLINK2, RT2870_1), RUN_DEV(DLINK2, RT2870_2), @@ -256,6 +257,8 @@ static const STRUCT_USB_HOST_ID run_devs RUN_DEV(RALINK, RT3072), RUN_DEV(RALINK, RT3370), RUN_DEV(RALINK, RT3572), + RUN_DEV(RALINK, RT5370), + RUN_DEV(RALINK, RT5572), RUN_DEV(RALINK, RT8070), RUN_DEV(SAMSUNG, WIS09ABGN), RUN_DEV(SAMSUNG2, RT2870_1), @@ -319,7 +322,7 @@ static usb_callback_t run_bulk_tx_callba static usb_callback_t run_bulk_tx_callback5; static void run_bulk_tx_callbackN(struct usb_xfer *xfer, - usb_error_t error, unsigned int index); + usb_error_t error, u_int index); static struct ieee80211vap *run_vap_create(struct ieee80211com *, const char [IFNAMSIZ], int, enum ieee80211_opmode, int, const uint8_t [IEEE80211_ADDR_LEN], @@ -343,13 +346,13 @@ static int run_write_region_1(struct run static int run_set_region_4(struct run_softc *, uint16_t, uint32_t, int); static int run_efuse_read_2(struct run_softc *, uint16_t, uint16_t *); static int run_eeprom_read_2(struct run_softc *, uint16_t, uint16_t *); -static int run_rt2870_rf_write(struct run_softc *, uint8_t, uint32_t); +static int run_rt2870_rf_write(struct run_softc *, uint32_t); static int run_rt3070_rf_read(struct run_softc *, uint8_t, uint8_t *); static int run_rt3070_rf_write(struct run_softc *, uint8_t, uint8_t); static int run_bbp_read(struct run_softc *, uint8_t, uint8_t *); static int run_bbp_write(struct run_softc *, uint8_t, uint8_t); static int run_mcu_cmd(struct run_softc *, uint8_t, uint16_t); -static const char *run_get_rf(int); +static const char *run_get_rf(uint16_t); static int run_read_eeprom(struct run_softc *); static struct ieee80211_node *run_node_alloc(struct ieee80211vap *, const uint8_t mac[IEEE80211_ADDR_LEN]); @@ -361,7 +364,7 @@ static void run_key_update_begin(struct static void run_key_update_end(struct ieee80211vap *); static void run_key_set_cb(void *); static int run_key_set(struct ieee80211vap *, struct ieee80211_key *, - const uint8_t mac[IEEE80211_ADDR_LEN]); + const uint8_t mac[IEEE80211_ADDR_LEN]); static void run_key_delete_cb(void *); static int run_key_delete(struct ieee80211vap *, struct ieee80211_key *); static void run_ratectl_to(void *); @@ -393,6 +396,8 @@ static void run_set_rx_antenna(struct ru static void run_rt2870_set_chan(struct run_softc *, u_int); static void run_rt3070_set_chan(struct run_softc *, u_int); static void run_rt3572_set_chan(struct run_softc *, u_int); +static void run_rt5390_set_chan(struct run_softc *, u_int); +static void run_rt5592_set_chan(struct run_softc *, u_int); static int run_set_chan(struct run_softc *, struct ieee80211_channel *); static void run_set_channel(struct ieee80211com *); static void run_scan_start(struct ieee80211com *); @@ -416,16 +421,19 @@ static void run_update_mcast(struct ifne static int8_t run_rssi2dbm(struct run_softc *, uint8_t, uint8_t); static void run_update_promisc_locked(struct ifnet *); static void run_update_promisc(struct ifnet *); +static void run_rt5390_bbp_init(struct run_softc *); static int run_bbp_init(struct run_softc *); static int run_rt3070_rf_init(struct run_softc *); +static void run_rt5390_rf_init(struct run_softc *); static int run_rt3070_filter_calib(struct run_softc *, uint8_t, uint8_t, uint8_t *); static void run_rt3070_rf_setup(struct run_softc *); static int run_txrx_enable(struct run_softc *); +static void run_adjust_freq_offset(struct run_softc *); static void run_init(void *); static void run_init_locked(struct run_softc *); static void run_stop(void *); -static void run_delay(struct run_softc *, unsigned int); +static void run_delay(struct run_softc *, u_int); static const struct { uint16_t reg; @@ -439,6 +447,25 @@ static const struct { uint8_t val; } rt2860_def_bbp[] = { RT2860_DEF_BBP +},rt5390_def_bbp[] = { + RT5390_DEF_BBP +},rt5592_def_bbp[] = { + RT5592_DEF_BBP +}; + +/* + * Default values for BBP register R196 for RT5592. + */ +static const uint8_t rt5592_bbp_r196[] = { + 0xe0, 0x1f, 0x38, 0x32, 0x08, 0x28, 0x19, 0x0a, 0xff, 0x00, + 0x16, 0x10, 0x10, 0x0b, 0x36, 0x2c, 0x26, 0x24, 0x42, 0x36, + 0x30, 0x2d, 0x4c, 0x46, 0x3d, 0x40, 0x3e, 0x42, 0x3d, 0x40, + 0x3c, 0x34, 0x2c, 0x2f, 0x3c, 0x35, 0x2e, 0x2a, 0x49, 0x41, + 0x36, 0x31, 0x30, 0x30, 0x0e, 0x0d, 0x28, 0x21, 0x1c, 0x16, + 0x50, 0x4a, 0x43, 0x40, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x7d, 0x14, 0x32, 0x2c, 0x36, 0x4c, 0x43, 0x2c, + 0x2e, 0x36, 0x30, 0x6e }; static const struct rfprog { @@ -454,6 +481,15 @@ struct { RT3070_RF3052 }; +static const struct rt5592_freqs { + uint16_t n; + uint8_t k, m, r; +} rt5592_freqs_20mhz[] = { + RT5592_RF5592_20MHZ +},rt5592_freqs_40mhz[] = { + RT5592_RF5592_40MHZ +}; + static const struct { uint8_t reg; uint8_t val; @@ -461,6 +497,25 @@ static const struct { RT3070_DEF_RF },rt3572_def_rf[] = { RT3572_DEF_RF +},rt5390_def_rf[] = { + RT5390_DEF_RF +},rt5392_def_rf[] = { + RT5392_DEF_RF +},rt5592_def_rf[] = { + RT5592_DEF_RF +},rt5592_2ghz_def_rf[] = { + RT5592_2GHZ_DEF_RF +},rt5592_5ghz_def_rf[] = { + RT5592_5GHZ_DEF_RF +}; + +static const struct { + u_int firstchan; + u_int lastchan; + uint8_t reg; + uint8_t val; +} rt5592_chan_5ghz[] = { + RT5592_CHAN_5GHZ }; static const struct usb_config run_config[RUN_N_XFER] = { @@ -557,7 +612,7 @@ run_attach(device_t self) struct ieee80211com *ic; struct ifnet *ifp; uint32_t ver; - int i, ntries, error; + int ntries, error; uint8_t iface_index, bands; device_set_usb_desc(self); @@ -654,27 +709,11 @@ run_attach(device_t self) bands = 0; setbit(&bands, IEEE80211_MODE_11B); setbit(&bands, IEEE80211_MODE_11G); + if (sc->rf_rev == RT2860_RF_2750 || sc->rf_rev == RT2860_RF_2850 || + sc->rf_rev == RT3070_RF_3052 || sc->rf_rev == RT5592_RF_5592) + setbit(&bands, IEEE80211_MODE_11A); ieee80211_init_channels(ic, NULL, &bands); - /* - * Do this by own because h/w supports - * more channels than ieee80211_init_channels() - */ - if (sc->rf_rev == RT2860_RF_2750 || - sc->rf_rev == RT2860_RF_2850 || - sc->rf_rev == RT3070_RF_3052) { - /* set supported .11a rates */ - for (i = 14; i < N(rt2860_rf2850); i++) { - uint8_t chan = rt2860_rf2850[i].chan; - ic->ic_channels[ic->ic_nchans].ic_freq = - ieee80211_ieee2mhz(chan, IEEE80211_CHAN_A); - ic->ic_channels[ic->ic_nchans].ic_ieee = chan; - ic->ic_channels[ic->ic_nchans].ic_flags = IEEE80211_CHAN_A; - ic->ic_channels[ic->ic_nchans].ic_extieee = 0; - ic->ic_nchans++; - } - } - ieee80211_ifattach(ic, sc->sc_bssid); ic->ic_scan_start = run_scan_start; @@ -699,7 +738,7 @@ run_attach(device_t self) TASK_INIT(&sc->cmdq_task, 0, run_cmdq_cb, sc); TASK_INIT(&sc->ratectl_task, 0, run_ratectl_cb, sc); - callout_init((struct callout *)&sc->ratectl_ch, 1); + usb_callout_init_mtx(&sc->ratectl_ch, &sc->sc_mtx, 0); if (bootverbose) ieee80211_announce(ic); @@ -803,7 +842,13 @@ run_vap_create(struct ieee80211com *ic, if (rvp == NULL) return (NULL); vap = &rvp->vap; - ieee80211_vap_setup(ic, vap, name, unit, opmode, flags, bssid, mac); + + if (ieee80211_vap_setup(ic, vap, name, unit, + opmode, flags, bssid, mac) != 0) { + /* out of memory */ + free(rvp, M_80211_VAP); + return (NULL); + } vap->iv_key_update_begin = run_key_update_begin; vap->iv_key_update_end = run_key_update_end; @@ -1009,13 +1054,12 @@ run_load_microcode(struct run_softc *sc) /* cheap sanity check */ temp = fw->data; bytes = *temp; - if (bytes != be64toh(0xffffff0210280210)) { + if (bytes != be64toh(0xffffff0210280210ULL)) { device_printf(sc->sc_dev, "firmware checksum failed\n"); error = EINVAL; goto fail; } - run_read(sc, RT2860_ASIC_VER_ID, &tmp); /* write microcode image */ run_write_region_1(sc, RT2870_FW_BASE, base, 4096); run_write(sc, RT2860_H2M_MAILBOX_CID, 0xffffffff); @@ -1062,7 +1106,7 @@ fail: return (error); } -int +static int run_reset(struct run_softc *sc) { usb_device_request_t req; @@ -1164,13 +1208,32 @@ run_write_region_1(struct run_softc *sc, return (error); #else usb_device_request_t req; + int error = 0; - req.bmRequestType = UT_WRITE_VENDOR_DEVICE; - req.bRequest = RT2870_WRITE_REGION_1; - USETW(req.wValue, 0); - USETW(req.wIndex, reg); - USETW(req.wLength, len); - return (run_do_request(sc, &req, buf)); + /* + * NOTE: It appears the WRITE_REGION_1 command cannot be + * passed a huge amount of data, which will crash the + * firmware. Limit amount of data passed to 64-bytes at a + * time. + */ + while (len > 0) { + int delta = 64; + if (delta > len) + delta = len; + + req.bmRequestType = UT_WRITE_VENDOR_DEVICE; + req.bRequest = RT2870_WRITE_REGION_1; + USETW(req.wValue, 0); + USETW(req.wIndex, reg); + USETW(req.wLength, delta); + error = run_do_request(sc, &req, __DECONST(uint8_t *, buf)); + if (error != 0) + break; + reg += delta; + buf += delta; + len -= delta; + } + return (error); #endif } @@ -1260,7 +1323,7 @@ run_srom_read(struct run_softc *sc, uint } static int -run_rt2870_rf_write(struct run_softc *sc, uint8_t reg, uint32_t val) +run_rt2870_rf_write(struct run_softc *sc, uint32_t val) { uint32_t tmp; int error, ntries; @@ -1274,10 +1337,7 @@ run_rt2870_rf_write(struct run_softc *sc if (ntries == 10) return (ETIMEDOUT); - /* RF registers are 24-bit on the RT2860 */ - tmp = RT2860_RF_REG_CTRL | 24 << RT2860_RF_REG_WIDTH_SHIFT | - (val & 0x3fffff) << 2 | (reg & 3); - return (run_write(sc, RT2860_RF_CSR_CFG0, tmp)); + return (run_write(sc, RT2860_RF_CSR_CFG0, val)); } static int @@ -1428,7 +1488,7 @@ b4inc(uint32_t b32, int8_t delta) } static const char * -run_get_rf(int rev) +run_get_rf(uint16_t rev) { switch (rev) { case RT2860_RF_2820: return "RT2820"; @@ -1440,11 +1500,14 @@ run_get_rf(int rev) case RT3070_RF_3021: return "RT3021"; case RT3070_RF_3022: return "RT3022"; case RT3070_RF_3052: return "RT3052"; + case RT5592_RF_5592: return "RT5592"; + case RT5390_RF_5370: return "RT5370"; + case RT5390_RF_5372: return "RT5372"; } return ("unknown"); } -int +static int run_read_eeprom(struct run_softc *sc) { int8_t delta_2ghz, delta_5ghz; @@ -1476,21 +1539,25 @@ run_read_eeprom(struct run_softc *sc) sc->sc_bssid[4] = val & 0xff; sc->sc_bssid[5] = val >> 8; - /* read vender BBP settings */ - for (i = 0; i < 10; i++) { - run_srom_read(sc, RT2860_EEPROM_BBP_BASE + i, &val); - sc->bbp[i].val = val & 0xff; - sc->bbp[i].reg = val >> 8; - DPRINTF("BBP%d=0x%02x\n", sc->bbp[i].reg, sc->bbp[i].val); - } - if (sc->mac_ver >= 0x3071) { - /* read vendor RF settings */ + if (sc->mac_ver < 0x5390) { + /* read vender BBP settings */ for (i = 0; i < 10; i++) { - run_srom_read(sc, RT3071_EEPROM_RF_BASE + i, &val); - sc->rf[i].val = val & 0xff; - sc->rf[i].reg = val >> 8; - DPRINTF("RF%d=0x%02x\n", sc->rf[i].reg, - sc->rf[i].val); + run_srom_read(sc, RT2860_EEPROM_BBP_BASE + i, &val); + sc->bbp[i].val = val & 0xff; + sc->bbp[i].reg = val >> 8; + DPRINTF("BBP%d=0x%02x\n", sc->bbp[i].reg, + sc->bbp[i].val); + } + if (sc->mac_ver >= 0x3071) { + /* read vendor RF settings */ + for (i = 0; i < 10; i++) { + run_srom_read(sc, RT3071_EEPROM_RF_BASE + i, + &val); + sc->rf[i].val = val & 0xff; + sc->rf[i].reg = val >> 8; + DPRINTF("RF%d=0x%02x\n", sc->rf[i].reg, + sc->rf[i].val); + } } } @@ -1516,7 +1583,11 @@ run_read_eeprom(struct run_softc *sc) sc->leds, sc->led[0], sc->led[1], sc->led[2]); /* read RF information */ - run_srom_read(sc, RT2860_EEPROM_ANTENNA, &val); + if (sc->mac_ver == 0x5390 || sc->mac_ver ==0x5392) + run_srom_read(sc, 0x00, &val); + else + run_srom_read(sc, RT2860_EEPROM_ANTENNA, &val); + if (val == 0xffff) { DPRINTF("invalid EEPROM antenna info, using default\n"); if (sc->mac_ver == 0x3572) { @@ -1536,11 +1607,15 @@ run_read_eeprom(struct run_softc *sc) sc->nrxchains = 2; } } else { - sc->rf_rev = (val >> 8) & 0xf; + if (sc->mac_ver == 0x5390 || sc->mac_ver ==0x5392) { + sc->rf_rev = val; + run_srom_read(sc, RT2860_EEPROM_ANTENNA, &val); + } else + sc->rf_rev = (val >> 8) & 0xf; sc->ntxchains = (val >> 4) & 0xf; sc->nrxchains = val & 0xf; } - DPRINTF("EEPROM RF rev=0x%02x chains=%dT%dR\n", + DPRINTF("EEPROM RF rev=0x%04x chains=%dT%dR\n", sc->rf_rev, sc->ntxchains, sc->nrxchains); /* check if RF supports automatic Tx access gain control */ @@ -1564,16 +1639,29 @@ run_read_eeprom(struct run_softc *sc) sc->txpow1[i + 0] = (int8_t)(val & 0xff); sc->txpow1[i + 1] = (int8_t)(val >> 8); - run_srom_read(sc, RT2860_EEPROM_PWR2GHZ_BASE2 + i / 2, &val); - sc->txpow2[i + 0] = (int8_t)(val & 0xff); - sc->txpow2[i + 1] = (int8_t)(val >> 8); + if (sc->mac_ver != 0x5390) { + run_srom_read(sc, + RT2860_EEPROM_PWR2GHZ_BASE2 + i / 2, &val); + sc->txpow2[i + 0] = (int8_t)(val & 0xff); + sc->txpow2[i + 1] = (int8_t)(val >> 8); + } } /* fix broken Tx power entries */ for (i = 0; i < 14; i++) { - if (sc->txpow1[i] < 0 || sc->txpow1[i] > 31) - sc->txpow1[i] = 5; - if (sc->txpow2[i] < 0 || sc->txpow2[i] > 31) - sc->txpow2[i] = 5; + if (sc->mac_ver >= 0x5390) { + if (sc->txpow1[i] < 0 || sc->txpow1[i] > 27) + sc->txpow1[i] = 5; + } else { + if (sc->txpow1[i] < 0 || sc->txpow1[i] > 31) + sc->txpow1[i] = 5; + } + if (sc->mac_ver > 0x5390) { + if (sc->txpow2[i] < 0 || sc->txpow2[i] > 27) + sc->txpow2[i] = 5; + } else if (sc->mac_ver < 0x5390) { + if (sc->txpow2[i] < 0 || sc->txpow2[i] > 31) + sc->txpow2[i] = 5; + } DPRINTF("chan %d: power1=%d, power2=%d\n", rt2860_rf2850[i].chan, sc->txpow1[i], sc->txpow2[i]); } @@ -1588,11 +1676,13 @@ run_read_eeprom(struct run_softc *sc) sc->txpow2[i + 15] = (int8_t)(val >> 8); } /* fix broken Tx power entries */ - for (i = 0; i < 40; i++) { - if (sc->txpow1[14 + i] < -7 || sc->txpow1[14 + i] > 15) - sc->txpow1[14 + i] = 5; - if (sc->txpow2[14 + i] < -7 || sc->txpow2[14 + i] > 15) - sc->txpow2[14 + i] = 5; + for (i = 0; i < 40; i++ ) { + if (sc->mac_ver != 0x5592) { + if (sc->txpow1[14 + i] < -7 || sc->txpow1[14 + i] > 15) + sc->txpow1[14 + i] = 5; + if (sc->txpow2[14 + i] < -7 || sc->txpow2[14 + i] > 15) + sc->txpow2[14 + i] = 5; + } DPRINTF("chan %d: power1=%d, power2=%d\n", rt2860_rf2850[14 + i].chan, sc->txpow1[14 + i], sc->txpow2[14 + i]); @@ -2236,8 +2326,10 @@ run_ratectl_cb(void *arg, int pending) ieee80211_iterate_nodes(&ic->ic_sta, run_iter_func, sc); } + RUN_LOCK(sc); if(sc->ratectl_run != RUN_RATECTL_OFF) usb_callout_reset(&sc->ratectl_ch, hz, run_ratectl_to, sc); + RUN_UNLOCK(sc); } static void @@ -2472,12 +2564,15 @@ run_rx_frame(struct run_softc *sc, struc struct rt2870_rxd *rxd; struct rt2860_rxwi *rxwi; uint32_t flags; - uint16_t len, phy; + uint16_t len, rxwisize; uint8_t ant, rssi; int8_t nf; rxwi = mtod(m, struct rt2860_rxwi *); len = le16toh(rxwi->len) & 0xfff; + rxwisize = (sc->mac_ver == 0x5592) ? + sizeof(struct rt2860_rxwi) + sizeof(uint64_t) : + sizeof(struct rt2860_rxwi); if (__predict_false(len > dmalen)) { m_freem(m); ifp->if_ierrors++; @@ -2495,8 +2590,8 @@ run_rx_frame(struct run_softc *sc, struc return; } - m->m_data += sizeof(struct rt2860_rxwi); - m->m_pkthdr.len = m->m_len -= sizeof(struct rt2860_rxwi); + m->m_data += rxwisize; + m->m_pkthdr.len = m->m_len -= rxwisize; wh = mtod(m, struct ieee80211_frame *); @@ -2516,7 +2611,8 @@ run_rx_frame(struct run_softc *sc, struc if (__predict_false(flags & RT2860_RX_MICERR)) { /* report MIC failures to net80211 for TKIP */ if (ni != NULL) - ieee80211_notify_michael_failure(ni->ni_vap, wh, rxwi->keyidx); + ieee80211_notify_michael_failure(ni->ni_vap, wh, + rxwi->keyidx); m_freem(m); ifp->if_ierrors++; DPRINTF("MIC error. Someone is lying.\n"); @@ -2539,6 +2635,7 @@ run_rx_frame(struct run_softc *sc, struc if (__predict_false(ieee80211_radiotap_active(ic))) { struct run_rx_radiotap_header *tap = &sc->sc_rxtap; + uint16_t phy; tap->wr_flags = 0; tap->wr_chan_freq = htole16(ic->ic_curchan->ic_freq); @@ -2583,8 +2680,13 @@ run_bulk_rx_callback(struct usb_xfer *xf struct mbuf *m = NULL; struct mbuf *m0; uint32_t dmalen; + uint16_t rxwisize; int xferlen; + rxwisize = (sc->mac_ver == 0x5592) ? + sizeof(struct rt2860_rxwi) + sizeof(uint64_t) : + sizeof(struct rt2860_rxwi); + usbd_xfer_status(xfer, &xferlen, NULL, NULL, NULL); switch (USB_GET_STATE(xfer)) { @@ -2592,8 +2694,8 @@ run_bulk_rx_callback(struct usb_xfer *xf DPRINTFN(15, "rx done, actlen=%d\n", xferlen); - if (xferlen < (int)(sizeof(uint32_t) + - sizeof(struct rt2860_rxwi) + sizeof(struct rt2870_rxd))) { + if (xferlen < (int)(sizeof(uint32_t) + rxwisize + + sizeof(struct rt2870_rxd))) { DPRINTF("xfer too short %d\n", xferlen); goto tr_setup; } @@ -2675,6 +2777,7 @@ tr_setup: m->m_data += 4; m->m_pkthdr.len = m->m_len -= 4; run_rx_frame(sc, m, dmalen); + m = NULL; /* don't free source buffer */ break; } @@ -2696,6 +2799,9 @@ tr_setup: m->m_pkthdr.len = m->m_len -= dmalen + 8; } + /* make sure we free the source buffer, if any */ + m_freem(m); + RUN_LOCK(sc); } @@ -2723,7 +2829,7 @@ run_tx_free(struct run_endpoint_queue *p } static void -run_bulk_tx_callbackN(struct usb_xfer *xfer, usb_error_t error, unsigned int index) +run_bulk_tx_callbackN(struct usb_xfer *xfer, usb_error_t error, u_int index) { struct run_softc *sc = usbd_xfer_softc(xfer); struct ifnet *ifp = sc->sc_ifp; @@ -2763,8 +2869,10 @@ tr_setup: STAILQ_REMOVE_HEAD(&pq->tx_qh, next); m = data->m; + size = (sc->mac_ver == 0x5592) ? + RUN_MAX_TXSZ + sizeof(uint32_t) : RUN_MAX_TXSZ; if ((m->m_pkthdr.len + - sizeof(data->desc) + 3 + 8) > RUN_MAX_TXSZ) { + sizeof(data->desc) + 3 + 8) > size) { DPRINTF("data overflow, %u bytes\n", m->m_pkthdr.len); @@ -2776,7 +2884,8 @@ tr_setup: } pc = usbd_xfer_get_frame(xfer, 0); - size = sizeof(data->desc); + size = (sc->mac_ver == 0x5592) ? + sizeof(data->desc) + sizeof(uint32_t) : sizeof(data->desc); usbd_copy_in(pc, 0, &data->desc, size); usbd_m_copy_in(pc, size, m, 0, m->m_pkthdr.len); size += m->m_pkthdr.len; @@ -2791,9 +2900,8 @@ tr_setup: vap = data->ni->ni_vap; if (ieee80211_radiotap_active_vap(vap)) { struct run_tx_radiotap_header *tap = &sc->sc_txtap; - struct rt2860_txwi *txwi = + struct rt2860_txwi *txwi = (struct rt2860_txwi *)(&data->desc + sizeof(struct rt2870_txd)); - tap->wt_flags = 0; tap->wt_rate = rt2860_rates[data->ridx].rate; tap->wt_chan_freq = htole16(ic->ic_curchan->ic_freq); @@ -2903,7 +3011,7 @@ run_set_tx_desc(struct run_softc *sc, st struct ieee80211_frame *wh; struct rt2870_txd *txd; struct rt2860_txwi *txwi; - uint16_t xferlen; + uint16_t xferlen, txwisize; uint16_t mcs; uint8_t ridx = data->ridx; uint8_t pad; @@ -2911,7 +3019,9 @@ run_set_tx_desc(struct run_softc *sc, st /* get MCS code from rate index */ mcs = rt2860_rates[ridx].mcs; - xferlen = sizeof(*txwi) + m->m_pkthdr.len; + txwisize = (sc->mac_ver == 0x5592) ? + sizeof(*txwi) + sizeof(uint32_t) : sizeof(*txwi); + xferlen = txwisize + m->m_pkthdr.len; /* roundup to 32-bit alignment */ xferlen = (xferlen + 3) & ~3; @@ -3037,7 +3147,7 @@ run_tx(struct run_softc *sc, struct mbuf dur = rt2860_rates[ctl_ridx].sp_ack_dur; else dur = rt2860_rates[ctl_ridx].lp_ack_dur; - *(uint16_t *)wh->i_dur = htole16(dur); + USETW(wh->i_dur, dur); } /* reserve slots for mgmt packets, just in case */ @@ -3054,12 +3164,12 @@ run_tx(struct run_softc *sc, struct mbuf txd->flags = qflags; txwi = (struct rt2860_txwi *)(txd + 1); txwi->xflags = xflags; - if (IEEE80211_IS_MULTICAST(wh->i_addr1)) { + if (IEEE80211_IS_MULTICAST(wh->i_addr1)) txwi->wcid = 0; - } else { + else txwi->wcid = (vap->iv_opmode == IEEE80211_M_STA) ? 1 : RUN_AID2WCID(ni->ni_associd); - } + /* clear leftover garbage bits */ txwi->flags = 0; txwi->txop = 0; @@ -3117,9 +3227,9 @@ run_tx(struct run_softc *sc, struct mbuf usbd_transfer_start(sc->sc_xfer[qid]); - DPRINTFN(8, "sending data frame len=%d rate=%d qid=%d\n", m->m_pkthdr.len + - (int)(sizeof (struct rt2870_txd) + sizeof (struct rt2860_rxwi)), - rt2860_rates[ridx].rate, qid); + DPRINTFN(8, "sending data frame len=%d rate=%d qid=%d\n", + m->m_pkthdr.len + (int)(sizeof(struct rt2870_txd) + + sizeof(struct rt2860_txwi)), rt2860_rates[ridx].rate, qid); return (0); } @@ -3156,7 +3266,7 @@ run_tx_mgt(struct run_softc *sc, struct dur = ieee80211_ack_duration(ic->ic_rt, rt2860_rates[ridx].rate, ic->ic_flags & IEEE80211_F_SHPREAMBLE); - *(uint16_t *)wh->i_dur = htole16(dur); + USETW(wh->i_dur, dur); } if (sc->sc_epq[0].tx_nfree == 0) { @@ -3183,7 +3293,7 @@ run_tx_mgt(struct run_softc *sc, struct run_set_tx_desc(sc, data); DPRINTFN(10, "sending mgt frame len=%d rate=%d\n", m->m_pkthdr.len + - (int)(sizeof (struct rt2870_txd) + sizeof (struct rt2860_rxwi)), + (int)(sizeof(struct rt2870_txd) + sizeof(struct rt2860_txwi)), rt2860_rates[ridx].rate); STAILQ_INSERT_TAIL(&sc->sc_epq[0].tx_qh, data, next); @@ -3513,18 +3623,63 @@ run_select_chan_group(struct run_softc * run_bbp_write(sc, 62, 0x37 - sc->lna[group]); run_bbp_write(sc, 63, 0x37 - sc->lna[group]); run_bbp_write(sc, 64, 0x37 - sc->lna[group]); - run_bbp_write(sc, 86, 0x00); + if (sc->mac_ver < 0x3572) + run_bbp_write(sc, 86, 0x00); if (group == 0) { if (sc->ext_2ghz_lna) { - run_bbp_write(sc, 82, 0x62); - run_bbp_write(sc, 75, 0x46); + if (sc->mac_ver >= 0x5390) + run_bbp_write(sc, 75, 0x52); + else { + run_bbp_write(sc, 82, 0x62); + run_bbp_write(sc, 75, 0x46); + } } else { - run_bbp_write(sc, 82, 0x84); - run_bbp_write(sc, 75, 0x50); + if (sc->mac_ver == 0x5592) { + run_bbp_write(sc, 79, 0x1c); + run_bbp_write(sc, 80, 0x0e); + run_bbp_write(sc, 81, 0x3a); + run_bbp_write(sc, 82, 0x62); + + run_bbp_write(sc, 195, 0x80); + run_bbp_write(sc, 196, 0xe0); + run_bbp_write(sc, 195, 0x81); + run_bbp_write(sc, 196, 0x1f); + run_bbp_write(sc, 195, 0x82); + run_bbp_write(sc, 196, 0x38); + run_bbp_write(sc, 195, 0x83); + run_bbp_write(sc, 196, 0x32); + run_bbp_write(sc, 195, 0x85); + run_bbp_write(sc, 196, 0x28); + run_bbp_write(sc, 195, 0x86); + run_bbp_write(sc, 196, 0x19); + } else if (sc->mac_ver >= 0x5390) + run_bbp_write(sc, 75, 0x50); + else { + run_bbp_write(sc, 82, 0x84); + run_bbp_write(sc, 75, 0x50); + } } } else { - if (sc->mac_ver == 0x3572) + if (sc->mac_ver == 0x5592) { + run_bbp_write(sc, 79, 0x18); + run_bbp_write(sc, 80, 0x08); + run_bbp_write(sc, 81, 0x38); + run_bbp_write(sc, 82, 0x92); + + run_bbp_write(sc, 195, 0x80); + run_bbp_write(sc, 196, 0xf0); + run_bbp_write(sc, 195, 0x81); + run_bbp_write(sc, 196, 0x1e); + run_bbp_write(sc, 195, 0x82); + run_bbp_write(sc, 196, 0x28); + run_bbp_write(sc, 195, 0x83); + run_bbp_write(sc, 196, 0x20); + run_bbp_write(sc, 195, 0x85); + run_bbp_write(sc, 196, 0x7f); + run_bbp_write(sc, 195, 0x86); + run_bbp_write(sc, 196, 0x7f); + } else if (sc->mac_ver == 0x3572) run_bbp_write(sc, 82, 0x94); else run_bbp_write(sc, 82, 0xf2); @@ -3559,6 +3714,11 @@ run_select_chan_group(struct run_softc * } else run_write(sc, RT2860_TX_PIN_CFG, tmp); + if (sc->mac_ver == 0x5592) { + run_bbp_write(sc, 195, 0x8d); + run_bbp_write(sc, 196, 0x1a); + } + /* set initial AGC value */ if (group == 0) { /* 2GHz band */ if (sc->mac_ver >= 0x3070) @@ -3566,7 +3726,9 @@ run_select_chan_group(struct run_softc * else agc = 0x2e + sc->lna[0]; } else { /* 5GHz band */ - if (sc->mac_ver == 0x3572) + if (sc->mac_ver == 0x5592) + agc = 0x24 + sc->lna[group] * 2; + else if (sc->mac_ver == 0x3572) agc = 0x22 + (sc->lna[group] * 5) / 3; else agc = 0x32 + (sc->lna[group] * 5) / 3; @@ -3575,7 +3737,7 @@ run_select_chan_group(struct run_softc * } static void -run_rt2870_set_chan(struct run_softc *sc, uint32_t chan) +run_rt2870_set_chan(struct run_softc *sc, u_int chan) { const struct rfprog *rfprog = rt2860_rf2850; uint32_t r2, r3, r4; @@ -3587,58 +3749,71 @@ run_rt2870_set_chan(struct run_softc *sc r2 = rfprog[i].r2; if (sc->ntxchains == 1) - r2 |= 1 << 12; /* 1T: disable Tx chain 2 */ + r2 |= 1 << 14; /* 1T: disable Tx chain 2 */ if (sc->nrxchains == 1) - r2 |= 1 << 15 | 1 << 4; /* 1R: disable Rx chains 2 & 3 */ + r2 |= 1 << 17 | 1 << 6; /* 1R: disable Rx chains 2 & 3 */ else if (sc->nrxchains == 2) - r2 |= 1 << 4; /* 2R: disable Rx chain 3 */ + r2 |= 1 << 6; /* 2R: disable Rx chain 3 */ /* use Tx power values from EEPROM */ txpow1 = sc->txpow1[i]; txpow2 = sc->txpow2[i]; + + /* Initialize RF R3 and R4. */ + r3 = rfprog[i].r3 & 0xffffc1ff; + r4 = (rfprog[i].r4 & ~(0x001f87c0)) | (sc->freq << 15); if (chan > 14) { - if (txpow1 >= 0) - txpow1 = txpow1 << 1 | 1; - else - txpow1 = (7 + txpow1) << 1; - if (txpow2 >= 0) - txpow2 = txpow2 << 1 | 1; - else - txpow2 = (7 + txpow2) << 1; + if (txpow1 >= 0) { + txpow1 = (txpow1 > 0xf) ? (0xf) : (txpow1); + r3 |= (txpow1 << 10) | (1 << 9); + } else { + txpow1 += 7; + + /* txpow1 is not possible larger than 15. */ + r3 |= (txpow1 << 10); + } + if (txpow2 >= 0) { + txpow2 = (txpow2 > 0xf) ? (0xf) : (txpow2); + r4 |= (txpow2 << 7) | (1 << 6); + } else { + txpow2 += 7; + r4 |= (txpow2 << 7); + } + } else { + /* Set Tx0 power. */ + r3 |= (txpow1 << 9); + + /* Set frequency offset and Tx1 power. */ + r4 |= (txpow2 << 6); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-10@FreeBSD.ORG Mon Dec 16 09:48:09 2013 Return-Path: Delivered-To: svn-src-stable-10@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 ESMTPS id 537EC2A0; Mon, 16 Dec 2013 09:48:09 +0000 (UTC) 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 3DE0E1CEC; Mon, 16 Dec 2013 09:48:09 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBG9m9WQ063318; Mon, 16 Dec 2013 09:48:09 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBG9m9aZ063317; Mon, 16 Dec 2013 09:48:09 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201312160948.rBG9m9aZ063317@svn.freebsd.org> From: Hans Petter Selasky Date: Mon, 16 Dec 2013 09:48:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259461 - stable/10/sys/dev/usb/wlan X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Dec 2013 09:48:09 -0000 Author: hselasky Date: Mon Dec 16 09:48:08 2013 New Revision: 259461 URL: http://svnweb.freebsd.org/changeset/base/259461 Log: MFC r256718, r257410 and r257411: - Fix RF registers for RT3070. - Initialize BBP68 to improve RX sensitivity. - Add RT2860_BCN_OFFSET1 and RT2860_MAX_LEN_CFG register initialization to match with the vendor driver. While here, remove unused RT2860_DEF_MAC definition. Modified: stable/10/sys/dev/usb/wlan/if_runreg.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/usb/wlan/if_runreg.h ============================================================================== --- stable/10/sys/dev/usb/wlan/if_runreg.h Mon Dec 16 09:34:01 2013 (r259460) +++ stable/10/sys/dev/usb/wlan/if_runreg.h Mon Dec 16 09:48:08 2013 (r259461) @@ -968,39 +968,9 @@ static const struct rt2860_rate { /* * Default values for MAC registers; values taken from the reference driver. */ -#define RT2860_DEF_MAC \ - { RT2860_BCN_OFFSET0, 0xf8f0e8e0 }, \ - { RT2860_LEGACY_BASIC_RATE, 0x0000013f }, \ - { RT2860_HT_BASIC_RATE, 0x00008003 }, \ - { RT2860_MAC_SYS_CTRL, 0x00000000 }, \ - { RT2860_BKOFF_SLOT_CFG, 0x00000209 }, \ - { RT2860_TX_SW_CFG0, 0x00000000 }, \ - { RT2860_TX_SW_CFG1, 0x00080606 }, \ - { RT2860_TX_LINK_CFG, 0x00001020 }, \ - { RT2860_TX_TIMEOUT_CFG, 0x000a2090 }, \ - { RT2860_LED_CFG, 0x7f031e46 }, \ - { RT2860_WMM_AIFSN_CFG, 0x00002273 }, \ - { RT2860_WMM_CWMIN_CFG, 0x00002344 }, \ - { RT2860_WMM_CWMAX_CFG, 0x000034aa }, \ - { RT2860_MAX_PCNT, 0x1f3fbf9f }, \ - { RT2860_TX_RTY_CFG, 0x47d01f0f }, \ - { RT2860_AUTO_RSP_CFG, 0x00000013 }, \ - { RT2860_CCK_PROT_CFG, 0x05740003 }, \ - { RT2860_OFDM_PROT_CFG, 0x05740003 }, \ - { RT2860_GF20_PROT_CFG, 0x01744004 }, \ - { RT2860_GF40_PROT_CFG, 0x03f44084 }, \ - { RT2860_MM20_PROT_CFG, 0x01744004 }, \ - { RT2860_MM40_PROT_CFG, 0x03f54084 }, \ - { RT2860_TXOP_CTRL_CFG, 0x0000583f }, \ - { RT2860_TXOP_HLDR_ET, 0x00000002 }, \ - { RT2860_TX_RTS_CFG, 0x00092b20 }, \ - { RT2860_EXP_ACK_TIME, 0x002400ca }, \ - { RT2860_XIFS_TIME_CFG, 0x33a41010 }, \ - { RT2860_PWR_PIN_CFG, 0x00000003 } - -/* XXX only a few registers differ from above, try to merge? */ #define RT2870_DEF_MAC \ { RT2860_BCN_OFFSET0, 0xf8f0e8e0 }, \ + { RT2860_BCN_OFFSET1, 0x6f77d0c8 }, \ { RT2860_LEGACY_BASIC_RATE, 0x0000013f }, \ { RT2860_HT_BASIC_RATE, 0x00008003 }, \ { RT2860_MAC_SYS_CTRL, 0x00000000 }, \ @@ -1009,6 +979,7 @@ static const struct rt2860_rate { { RT2860_TX_SW_CFG1, 0x00080606 }, \ { RT2860_TX_LINK_CFG, 0x00001020 }, \ { RT2860_TX_TIMEOUT_CFG, 0x000a2090 }, \ + { RT2860_MAX_LEN_CFG, 0x00001f00 }, \ { RT2860_LED_CFG, 0x7f031e46 }, \ { RT2860_WMM_AIFSN_CFG, 0x00002273 }, \ { RT2860_WMM_CWMIN_CFG, 0x00002344 }, \ @@ -1037,6 +1008,7 @@ static const struct rt2860_rate { #define RT2860_DEF_BBP \ { 65, 0x2c }, \ { 66, 0x38 }, \ + { 68, 0x0b }, \ { 69, 0x12 }, \ { 70, 0x0a }, \ { 73, 0x10 }, \ @@ -1341,7 +1313,7 @@ static const struct rt2860_rate { { 4, 0x40 }, \ { 5, 0x03 }, \ { 6, 0x02 }, \ - { 7, 0x70 }, \ + { 7, 0x60 }, \ { 9, 0x0f }, \ { 10, 0x41 }, \ { 11, 0x21 }, \ @@ -1355,7 +1327,7 @@ static const struct rt2860_rate { { 20, 0xba }, \ { 21, 0xdb }, \ { 24, 0x16 }, \ - { 25, 0x01 }, \ + { 25, 0x03 }, \ { 29, 0x1f } #define RT3572_DEF_RF \ From owner-svn-src-stable-10@FreeBSD.ORG Mon Dec 16 15:00:06 2013 Return-Path: Delivered-To: svn-src-stable-10@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 ESMTPS id BAFAD345; Mon, 16 Dec 2013 15:00:06 +0000 (UTC) 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 A652716B5; Mon, 16 Dec 2013 15:00:06 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBGF06F0081601; Mon, 16 Dec 2013 15:00:06 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBGF0645081600; Mon, 16 Dec 2013 15:00:06 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201312161500.rBGF0645081600@svn.freebsd.org> From: Nathan Whitehorn Date: Mon, 16 Dec 2013 15:00:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259465 - stable/10/sys/kern X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Dec 2013 15:00:06 -0000 Author: nwhitehorn Date: Mon Dec 16 15:00:06 2013 New Revision: 259465 URL: http://svnweb.freebsd.org/changeset/base/259465 Log: MFC r258819,258928: Add new sysctl, kern.supported_archs, containing the list of FreeBSD MACHINE_ARCH values whose binaries this kernel can run. This patch provides a feature requested for implementing pkgng ABI identifiers in a robust way. The list is designed to indicate whether, say, an i386 package can be run on the current system. If kern.supported_abis contains "i386", then the answer is yes. Otherwise, the answer is no. At the moment, this only supports MACHINE_ARCH and MACHINE_ARCH32. As we gain support for more interesting combinations, this needs to become more flexible, possibily through the sysent framework, along with the hw.machine_arch emulation immediately preceding this code in kern_mib.c. Reviewed by: imp Modified: stable/10/sys/kern/kern_mib.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/kern_mib.c ============================================================================== --- stable/10/sys/kern/kern_mib.c Mon Dec 16 13:52:18 2013 (r259464) +++ stable/10/sys/kern/kern_mib.c Mon Dec 16 15:00:06 2013 (r259465) @@ -261,6 +261,13 @@ sysctl_hw_machine_arch(SYSCTL_HANDLER_AR SYSCTL_PROC(_hw, HW_MACHINE_ARCH, machine_arch, CTLTYPE_STRING | CTLFLAG_RD, NULL, 0, sysctl_hw_machine_arch, "A", "System architecture"); +SYSCTL_STRING(_kern, OID_AUTO, supported_archs, CTLFLAG_RD | CTLFLAG_MPSAFE, +#ifdef COMPAT_FREEBSD32 + MACHINE_ARCH " " MACHINE_ARCH32, 0, "Supported architectures for binaries"); +#else + MACHINE_ARCH, 0, "Supported architectures for binaries"); +#endif + static int sysctl_hostname(SYSCTL_HANDLER_ARGS) { From owner-svn-src-stable-10@FreeBSD.ORG Mon Dec 16 16:53:28 2013 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx2.freebsd.org (mx2.freebsd.org [IPv6:2001:1900:2254:206a::19:2]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id AB8D11FF; Mon, 16 Dec 2013 16:53:28 +0000 (UTC) Received: from butcher-nb.yandex.net (hub.freebsd.org [IPv6:2001:1900:2254:206c::16:88]) by mx2.freebsd.org (Postfix) with ESMTP id 5CC49435B; Mon, 16 Dec 2013 16:53:27 +0000 (UTC) Message-ID: <52AF3001.2000208@FreeBSD.org> Date: Mon, 16 Dec 2013 20:53:21 +0400 From: "Andrey V. Elsukov" User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:24.0) Gecko/20100101 Thunderbird/24.1.0 MIME-Version: 1.0 To: Oleg Bulyzhin , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: Re: svn commit: r258346 - stable/10/sys/dev/ixgbe References: <201311191424.rAJEOQ8U037410@svn.freebsd.org> In-Reply-To: <201311191424.rAJEOQ8U037410@svn.freebsd.org> X-Enigmail-Version: 1.6 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Dec 2013 16:53:28 -0000 On 19.11.2013 18:24, Oleg Bulyzhin wrote: > Author: oleg > Date: Tue Nov 19 14:24:25 2013 > New Revision: 258346 > URL: http://svnweb.freebsd.org/changeset/base/258346 > > Log: > MFC: 257695 > > - Fix link loss on vlan reconfiguration. > - Fix issues with 'vlanhwfilter'. Hi, Oleg, do you plan to merge this in stable/9 too? -- WBR, Andrey V. Elsukov From owner-svn-src-stable-10@FreeBSD.ORG Mon Dec 16 19:59:35 2013 Return-Path: Delivered-To: svn-src-stable-10@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 ESMTPS id 2B6FBD1C; Mon, 16 Dec 2013 19:59:35 +0000 (UTC) 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 0BBB71535; Mon, 16 Dec 2013 19:59:35 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBGJxYOP091610; Mon, 16 Dec 2013 19:59:34 GMT (envelope-from asomers@svn.freebsd.org) Received: (from asomers@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBGJxYTV091609; Mon, 16 Dec 2013 19:59:34 GMT (envelope-from asomers@svn.freebsd.org) Message-Id: <201312161959.rBGJxYTV091609@svn.freebsd.org> From: Alan Somers Date: Mon, 16 Dec 2013 19:59:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259483 - stable/10/sys/cddl/contrib/opensolaris/uts/common/dtrace X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Dec 2013 19:59:35 -0000 Author: asomers Date: Mon Dec 16 19:59:34 2013 New Revision: 259483 URL: http://svnweb.freebsd.org/changeset/base/259483 Log: MFC r258311 opensolaris/uts/common/dtrace/fasttrap.c Fix several problems that can cause panics on kldload and kldunload. * kproc_create(fasttrap_pid_cleanup_cb, ...) gets called before fasttrap_provs.fth_table gets allocated. This can lead to a panic on module load, because fasttrap_pid_cleanup_cb references fasttrap_provs.fth_table. Move kproc_create down after the point that fasttrap_provs.fth_table gets allocated, and modify the error handling accordingly. * dtrace_fasttrap_{fork,exec,exit} weren't getting NULLed until after fasttrap_provs.fth_table got freed. That caused panics on module unload because fasttrap_exec_exit calls fasttrap_provider_retire, which references fasttrap_provs.fth_table. NULL those function pointers earlier. * There wasn't any code to destroy the fasttrap_{tpoints,provs,procs}.fth_table mutexes on module unload, leading to a resource leak when WITNESS is enabled. Destroy those mutexes during fasttrap_unload(). Sponsored by: Spectra Logic Corporation Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c Mon Dec 16 19:59:31 2013 (r259482) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c Mon Dec 16 19:59:34 2013 (r259483) @@ -2284,13 +2284,6 @@ fasttrap_load(void) mutex_init(&fasttrap_count_mtx, "fasttrap count mtx", MUTEX_DEFAULT, NULL); - ret = kproc_create(fasttrap_pid_cleanup_cb, NULL, - &fasttrap_cleanup_proc, 0, 0, "ftcleanup"); - if (ret != 0) { - destroy_dev(fasttrap_cdev); - return (ret); - } - #if defined(sun) fasttrap_max = ddi_getprop(DDI_DEV_T_ANY, devi, DDI_PROP_DONTPASS, "fasttrap-max-probes", FASTTRAP_MAX_DEFAULT); @@ -2344,6 +2337,24 @@ fasttrap_load(void) "providers bucket mtx", MUTEX_DEFAULT, NULL); #endif + ret = kproc_create(fasttrap_pid_cleanup_cb, NULL, + &fasttrap_cleanup_proc, 0, 0, "ftcleanup"); + if (ret != 0) { + destroy_dev(fasttrap_cdev); +#if !defined(sun) + for (i = 0; i < fasttrap_provs.fth_nent; i++) + mutex_destroy(&fasttrap_provs.fth_table[i].ftb_mtx); + for (i = 0; i < fasttrap_tpoints.fth_nent; i++) + mutex_destroy(&fasttrap_tpoints.fth_table[i].ftb_mtx); +#endif + kmem_free(fasttrap_provs.fth_table, fasttrap_provs.fth_nent * + sizeof (fasttrap_bucket_t)); + mtx_destroy(&fasttrap_cleanup_mtx); + mutex_destroy(&fasttrap_count_mtx); + return (ret); + } + + /* * ... and the procs hash table. */ @@ -2436,6 +2447,20 @@ fasttrap_unload(void) return (-1); } + /* + * Stop new processes from entering these hooks now, before the + * fasttrap_cleanup thread runs. That way all processes will hopefully + * be out of these hooks before we free fasttrap_provs.fth_table + */ + ASSERT(dtrace_fasttrap_fork == &fasttrap_fork); + dtrace_fasttrap_fork = NULL; + + ASSERT(dtrace_fasttrap_exec == &fasttrap_exec_exit); + dtrace_fasttrap_exec = NULL; + + ASSERT(dtrace_fasttrap_exit == &fasttrap_exec_exit); + dtrace_fasttrap_exit = NULL; + mtx_lock(&fasttrap_cleanup_mtx); fasttrap_cleanup_drain = 1; /* Wait for the cleanup thread to finish up and signal us. */ @@ -2451,6 +2476,14 @@ fasttrap_unload(void) mutex_exit(&fasttrap_count_mtx); #endif +#if !defined(sun) + for (i = 0; i < fasttrap_tpoints.fth_nent; i++) + mutex_destroy(&fasttrap_tpoints.fth_table[i].ftb_mtx); + for (i = 0; i < fasttrap_provs.fth_nent; i++) + mutex_destroy(&fasttrap_provs.fth_table[i].ftb_mtx); + for (i = 0; i < fasttrap_procs.fth_nent; i++) + mutex_destroy(&fasttrap_procs.fth_table[i].ftb_mtx); +#endif kmem_free(fasttrap_tpoints.fth_table, fasttrap_tpoints.fth_nent * sizeof (fasttrap_bucket_t)); fasttrap_tpoints.fth_nent = 0; @@ -2463,22 +2496,6 @@ fasttrap_unload(void) fasttrap_procs.fth_nent * sizeof (fasttrap_bucket_t)); fasttrap_procs.fth_nent = 0; - /* - * We know there are no tracepoints in any process anywhere in - * the system so there is no process which has its p_dtrace_count - * greater than zero, therefore we know that no thread can actively - * be executing code in fasttrap_fork(). Similarly for p_dtrace_probes - * and fasttrap_exec() and fasttrap_exit(). - */ - ASSERT(dtrace_fasttrap_fork == &fasttrap_fork); - dtrace_fasttrap_fork = NULL; - - ASSERT(dtrace_fasttrap_exec == &fasttrap_exec_exit); - dtrace_fasttrap_exec = NULL; - - ASSERT(dtrace_fasttrap_exit == &fasttrap_exec_exit); - dtrace_fasttrap_exit = NULL; - #if !defined(sun) destroy_dev(fasttrap_cdev); mutex_destroy(&fasttrap_count_mtx); From owner-svn-src-stable-10@FreeBSD.ORG Tue Dec 17 01:02:34 2013 Return-Path: Delivered-To: svn-src-stable-10@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 ESMTPS id B3D9826D; Tue, 17 Dec 2013 01:02:34 +0000 (UTC) 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 859681350; Tue, 17 Dec 2013 01:02:34 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBH12Yah007445; Tue, 17 Dec 2013 01:02:34 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBH12YFD007444; Tue, 17 Dec 2013 01:02:34 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201312170102.rBH12YFD007444@svn.freebsd.org> From: Glen Barber Date: Tue, 17 Dec 2013 01:02:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259488 - stable/10 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Dec 2013 01:02:34 -0000 Author: gjb Date: Tue Dec 17 01:02:34 2013 New Revision: 259488 URL: http://svnweb.freebsd.org/changeset/base/259488 Log: Record mergeinfo for r258927. Sponsored by: The FreeBSD Foundation Modified: Directory Properties: stable/10/ (props changed) From owner-svn-src-stable-10@FreeBSD.ORG Tue Dec 17 03:46:45 2013 Return-Path: Delivered-To: svn-src-stable-10@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 ESMTPS id 16589E1F; Tue, 17 Dec 2013 03:46:45 +0000 (UTC) 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 0352712EC; Tue, 17 Dec 2013 03:46:45 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBH3kiLm067096; Tue, 17 Dec 2013 03:46:44 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBH3ki0K067095; Tue, 17 Dec 2013 03:46:44 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201312170346.rBH3ki0K067095@svn.freebsd.org> From: Glen Barber Date: Tue, 17 Dec 2013 03:46:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259491 - stable/10/release/scripts X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Dec 2013 03:46:45 -0000 Author: gjb Date: Tue Dec 17 03:46:44 2013 New Revision: 259491 URL: http://svnweb.freebsd.org/changeset/base/259491 Log: MFC r259246: Prevent release build errors found during snapshot builds where if NOPORTS=1, pkg-stage.sh cannot build the ports-mgmt/pkg port if WITH_DVD=1. Sponsored by: The FreeBSD Foundation Modified: stable/10/release/scripts/pkg-stage.sh Directory Properties: stable/10/ (props changed) Modified: stable/10/release/scripts/pkg-stage.sh ============================================================================== --- stable/10/release/scripts/pkg-stage.sh Tue Dec 17 03:38:36 2013 (r259490) +++ stable/10/release/scripts/pkg-stage.sh Tue Dec 17 03:46:44 2013 (r259491) @@ -24,6 +24,11 @@ fi REVISION="${2}" . "${1}" || exit 1 +# If NOPORTS is set for the release, do not attempt to build pkg(8). +if [ ! -f /usr/ports/Makefile ]; then + exit 0 +fi + if [ ! -x /usr/local/sbin/pkg ]; then /usr/bin/make -C /usr/ports/ports-mgmt/pkg install clean fi From owner-svn-src-stable-10@FreeBSD.ORG Tue Dec 17 04:16:21 2013 Return-Path: Delivered-To: svn-src-stable-10@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 ESMTPS id 80D7EC52; Tue, 17 Dec 2013 04:16:21 +0000 (UTC) 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 6D8271609; Tue, 17 Dec 2013 04:16: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 rBH4GLX9078428; Tue, 17 Dec 2013 04:16:21 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBH4GLlM078427; Tue, 17 Dec 2013 04:16:21 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201312170416.rBH4GLlM078427@svn.freebsd.org> From: Glen Barber Date: Tue, 17 Dec 2013 04:16:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259492 - stable/10/release X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Dec 2013 04:16:21 -0000 Author: gjb Date: Tue Dec 17 04:16:20 2013 New Revision: 259492 URL: http://svnweb.freebsd.org/changeset/base/259492 Log: MFC r258770 (hrs): Add NOPKG to disable pkg-stage. Sponsored by: The FreeBSD Foundation Modified: stable/10/release/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/release/Makefile ============================================================================== --- stable/10/release/Makefile Tue Dec 17 03:46:44 2013 (r259491) +++ stable/10/release/Makefile Tue Dec 17 04:16:20 2013 (r259492) @@ -16,6 +16,7 @@ # (by default, the directory above this one) # PORTSDIR: location of ports tree to distribute (default: /usr/ports) # DOCDIR: location of doc tree (default: /usr/doc) +# NOPKG: if set, do not distribute third-party packages # NOPORTS: if set, do not distribute ports tree # NOSRC: if set, do not distribute source tree # NODOC: if set, do not generate release documentation @@ -221,7 +222,7 @@ packagesystem: base.txz kernel.txz ${EXT touch ${.TARGET} pkg-stage: -.if(exists(${.CURDIR}/${TARGET}/pkg-stage.conf)) +.if !defined(NOPKG) && exists(${.CURDIR}/${TARGET}/pkg-stage.conf) sh ${.CURDIR}/scripts/pkg-stage.sh ${.CURDIR}/${TARGET}/pkg-stage.conf \ ${REVISION} .endif From owner-svn-src-stable-10@FreeBSD.ORG Tue Dec 17 04:26:21 2013 Return-Path: Delivered-To: svn-src-stable-10@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 ESMTPS id 21994183; Tue, 17 Dec 2013 04:26:21 +0000 (UTC) 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 0D19B16C8; Tue, 17 Dec 2013 04:26: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 rBH4QKEu082050; Tue, 17 Dec 2013 04:26:20 GMT (envelope-from rodrigc@svn.freebsd.org) Received: (from rodrigc@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBH4QKDd082049; Tue, 17 Dec 2013 04:26:20 GMT (envelope-from rodrigc@svn.freebsd.org) Message-Id: <201312170426.rBH4QKDd082049@svn.freebsd.org> From: Craig Rodrigues Date: Tue, 17 Dec 2013 04:26:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259494 - stable/10/release/doc/en_US.ISO8859-1/relnotes X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Dec 2013 04:26:21 -0000 Author: rodrigc Date: Tue Dec 17 04:26:20 2013 New Revision: 259494 URL: http://svnweb.freebsd.org/changeset/base/259494 Log: MFC r259493: Add OFED and Mellanox items to release notes. Submitted by: Meny Yossefi MFC r259490: Add release note items from Chelsio. Submitted by: np Modified: stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml Directory Properties: stable/10/ (props changed) Modified: stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml ============================================================================== --- stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml Tue Dec 17 04:19:03 2013 (r259493) +++ stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml Tue Dec 17 04:26:20 2013 (r259494) @@ -248,6 +248,21 @@ The &man.wpi.4; driver has been updated to include a number of stability fixes. + The &man.cxgbe.4; driver has been updated to support + 40G/10G Ethernet NICs based on Chelsio's Terminator 5 (T5) ASIC. + + The iw_cxgbe driver has been added. This is an experimental iWARP/RDMA driver + (kernel verbs only) for Chelsio's T4 and T5 based cards. + + The Open Fabrics Enterprise Distribution (OFED) and OFED Infiniband core has been + updated to the same version as supplied by Linux version 3.7 + + The Mellanox Infiniband driver has been updated to firmware + version 2.30.3200 for ConnectX3 NICs. Support has been added for ConnectX3 VPI NICs, where + each port can be used as Infiniband 56 GB/s or Ethernet 40 GB/s. Support has been added + for dynamically loading kernel modules for Infiniband core (ibcore) and + IP over Infiniband (ipoib). + From owner-svn-src-stable-10@FreeBSD.ORG Tue Dec 17 09:21:57 2013 Return-Path: Delivered-To: svn-src-stable-10@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 ESMTPS id 256229F5; Tue, 17 Dec 2013 09:21:57 +0000 (UTC) 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 EA7501E5D; Tue, 17 Dec 2013 09:21:56 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBH9LuRH089565; Tue, 17 Dec 2013 09:21:56 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBH9LunD089563; Tue, 17 Dec 2013 09:21:56 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201312170921.rBH9LunD089563@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 17 Dec 2013 09:21:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259499 - in stable/10/sys: kern vm X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Dec 2013 09:21:57 -0000 Author: kib Date: Tue Dec 17 09:21:56 2013 New Revision: 259499 URL: http://svnweb.freebsd.org/changeset/base/259499 Log: MFC r258039: Avoid overflow for the page counts. MFC r258365: Revert back to use int for the page counts. Rearrange the checks to correctly handle overflowing address arithmetic. Modified: stable/10/sys/kern/vfs_vnops.c stable/10/sys/vm/vm_fault.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/vfs_vnops.c ============================================================================== --- stable/10/sys/kern/vfs_vnops.c Tue Dec 17 07:59:00 2013 (r259498) +++ stable/10/sys/kern/vfs_vnops.c Tue Dec 17 09:21:56 2013 (r259499) @@ -933,7 +933,7 @@ vn_io_fault(struct file *fp, struct uio void *rl_cookie; struct mount *mp; vm_page_t *prev_td_ma; - int cnt, error, save, saveheld, prev_td_ma_cnt; + int error, cnt, save, saveheld, prev_td_ma_cnt; vm_offset_t addr, end; vm_prot_t prot; size_t len, resid; @@ -1007,21 +1007,20 @@ vn_io_fault(struct file *fp, struct uio uio_clone->uio_iovcnt--; continue; } - - addr = (vm_offset_t)uio_clone->uio_iov->iov_base; + if (len > io_hold_cnt * PAGE_SIZE) + len = io_hold_cnt * PAGE_SIZE; + addr = (uintptr_t)uio_clone->uio_iov->iov_base; end = round_page(addr + len); - cnt = howmany(end - trunc_page(addr), PAGE_SIZE); + if (end < addr) { + error = EFAULT; + break; + } + cnt = atop(end - trunc_page(addr)); /* * A perfectly misaligned address and length could cause * both the start and the end of the chunk to use partial * page. +2 accounts for such a situation. */ - if (cnt > io_hold_cnt + 2) { - len = io_hold_cnt * PAGE_SIZE; - KASSERT(howmany(round_page(addr + len) - - trunc_page(addr), PAGE_SIZE) <= io_hold_cnt + 2, - ("cnt overflow")); - } cnt = vm_fault_quick_hold_pages(&td->td_proc->p_vmspace->vm_map, addr, len, prot, ma, io_hold_cnt + 2); if (cnt == -1) { Modified: stable/10/sys/vm/vm_fault.c ============================================================================== --- stable/10/sys/vm/vm_fault.c Tue Dec 17 07:59:00 2013 (r259498) +++ stable/10/sys/vm/vm_fault.c Tue Dec 17 09:21:56 2013 (r259499) @@ -1079,7 +1079,7 @@ vm_fault_quick_hold_pages(vm_map_t map, if (len == 0) return (0); - end = round_page(addr + len); + end = round_page(addr + len); addr = trunc_page(addr); /* @@ -1088,9 +1088,9 @@ vm_fault_quick_hold_pages(vm_map_t map, if (addr < vm_map_min(map) || addr > end || end > vm_map_max(map)) return (-1); - count = howmany(end - addr, PAGE_SIZE); - if (count > max_count) + if (atop(end - addr) > max_count) panic("vm_fault_quick_hold_pages: count > max_count"); + count = atop(end - addr); /* * Most likely, the physical pages are resident in the pmap, so it is From owner-svn-src-stable-10@FreeBSD.ORG Tue Dec 17 13:10:28 2013 Return-Path: Delivered-To: svn-src-stable-10@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 ESMTPS id AF553E50; Tue, 17 Dec 2013 13:10:28 +0000 (UTC) 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 9B11C1084; Tue, 17 Dec 2013 13:10:28 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBHDAS4B070537; Tue, 17 Dec 2013 13:10:28 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBHDASYK070536; Tue, 17 Dec 2013 13:10:28 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201312171310.rBHDASYK070536@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 17 Dec 2013 13:10:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259506 - stable/10/sys/fs/pseudofs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Dec 2013 13:10:28 -0000 Author: kib Date: Tue Dec 17 13:10:28 2013 New Revision: 259506 URL: http://svnweb.freebsd.org/changeset/base/259506 Log: MFC r258088: Add check for buflen overflow by comparing the buflen with both offset and resid. MFC r258397: Redo r258088 to avoid relying on signed arithmetic overflow. Modified: stable/10/sys/fs/pseudofs/pseudofs_vnops.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/pseudofs/pseudofs_vnops.c ============================================================================== --- stable/10/sys/fs/pseudofs/pseudofs_vnops.c Tue Dec 17 13:02:23 2013 (r259505) +++ stable/10/sys/fs/pseudofs/pseudofs_vnops.c Tue Dec 17 13:10:28 2013 (r259506) @@ -616,8 +616,7 @@ pfs_read(struct vop_read_args *va) struct proc *proc; struct sbuf *sb = NULL; int error, locked; - off_t offset; - ssize_t buflen, resid; + off_t buflen; PFS_TRACE(("%s", pn->pn_name)); pfs_assert_not_owned(pn); @@ -654,14 +653,12 @@ pfs_read(struct vop_read_args *va) goto ret; } - /* beaucoup sanity checks so we don't ask for bogus allocation */ - if (uio->uio_offset < 0 || uio->uio_resid < 0 || - (offset = uio->uio_offset) != uio->uio_offset || - (resid = uio->uio_resid) != uio->uio_resid || - (buflen = offset + resid) < offset || buflen >= INT_MAX) { + if (uio->uio_resid < 0 || uio->uio_offset < 0 || + uio->uio_resid > OFF_MAX - uio->uio_offset) { error = EINVAL; goto ret; } + buflen = uio->uio_offset + uio->uio_resid; if (buflen > MAXPHYS) buflen = MAXPHYS; From owner-svn-src-stable-10@FreeBSD.ORG Tue Dec 17 13:18:42 2013 Return-Path: Delivered-To: svn-src-stable-10@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 ESMTPS id 2B04A785; Tue, 17 Dec 2013 13:18:42 +0000 (UTC) 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 0ADF71171; Tue, 17 Dec 2013 13:18:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBHDIfSA074033; Tue, 17 Dec 2013 13:18:41 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBHDIfXO074028; Tue, 17 Dec 2013 13:18:41 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201312171318.rBHDIfXO074028@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 17 Dec 2013 13:18:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259508 - stable/10/sys/dev/e1000 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Dec 2013 13:18:42 -0000 Author: kib Date: Tue Dec 17 13:18:41 2013 New Revision: 259508 URL: http://svnweb.freebsd.org/changeset/base/259508 Log: MFC r257541: Fix several issues with the busdma(9) KPI use in the e1000 drivers. Modified: stable/10/sys/dev/e1000/if_em.c stable/10/sys/dev/e1000/if_igb.c stable/10/sys/dev/e1000/if_lem.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/e1000/if_em.c ============================================================================== --- stable/10/sys/dev/e1000/if_em.c Tue Dec 17 13:13:02 2013 (r259507) +++ stable/10/sys/dev/e1000/if_em.c Tue Dec 17 13:18:41 2013 (r259508) @@ -4059,8 +4059,7 @@ em_allocate_receive_buffers(struct rx_ri rxbuf = rxr->rx_buffers; for (int i = 0; i < adapter->num_rx_desc; i++, rxbuf++) { rxbuf = &rxr->rx_buffers[i]; - error = bus_dmamap_create(rxr->rxtag, BUS_DMA_NOWAIT, - &rxbuf->map); + error = bus_dmamap_create(rxr->rxtag, 0, &rxbuf->map); if (error) { device_printf(dev, "%s: bus_dmamap_create failed: %d\n", __func__, error); @@ -4465,6 +4464,7 @@ em_rxeof(struct rx_ring *rxr, int count, em_rx_discard(rxr, i); goto next_desc; } + bus_dmamap_unload(rxr->rxtag, rxr->rx_buffers[i].map); /* Assign correct length to the current fragment */ mp = rxr->rx_buffers[i].m_head; @@ -4551,6 +4551,8 @@ em_rx_discard(struct rx_ring *rxr, int i struct em_buffer *rbuf; rbuf = &rxr->rx_buffers[i]; + bus_dmamap_unload(rxr->rxtag, rbuf->map); + /* Free any previous pieces */ if (rxr->fmp != NULL) { rxr->fmp->m_flags |= M_PKTHDR; Modified: stable/10/sys/dev/e1000/if_igb.c ============================================================================== --- stable/10/sys/dev/e1000/if_igb.c Tue Dec 17 13:13:02 2013 (r259507) +++ stable/10/sys/dev/e1000/if_igb.c Tue Dec 17 13:18:41 2013 (r259508) @@ -3996,7 +3996,6 @@ igb_txeof(struct tx_ring *txr) buf->map); m_freem(buf->m_head); buf->m_head = NULL; - buf->map = NULL; } buf->eop = NULL; ++txr->tx_avail; @@ -4022,7 +4021,6 @@ igb_txeof(struct tx_ring *txr) buf->map); m_freem(buf->m_head); buf->m_head = NULL; - buf->map = NULL; } ++txr->tx_avail; buf->eop = NULL; @@ -4230,15 +4228,13 @@ igb_allocate_receive_buffers(struct rx_r for (i = 0; i < adapter->num_rx_desc; i++) { rxbuf = &rxr->rx_buffers[i]; - error = bus_dmamap_create(rxr->htag, - BUS_DMA_NOWAIT, &rxbuf->hmap); + error = bus_dmamap_create(rxr->htag, 0, &rxbuf->hmap); if (error) { device_printf(dev, "Unable to create RX head DMA maps\n"); goto fail; } - error = bus_dmamap_create(rxr->ptag, - BUS_DMA_NOWAIT, &rxbuf->pmap); + error = bus_dmamap_create(rxr->ptag, 0, &rxbuf->pmap); if (error) { device_printf(dev, "Unable to create RX packet DMA maps\n"); @@ -4758,11 +4754,13 @@ igb_rx_discard(struct rx_ring *rxr, int if (rbuf->m_head) { m_free(rbuf->m_head); rbuf->m_head = NULL; + bus_dmamap_unload(rxr->htag, rbuf->hmap); } if (rbuf->m_pack) { m_free(rbuf->m_pack); rbuf->m_pack = NULL; + bus_dmamap_unload(rxr->ptag, rbuf->pmap); } return; @@ -4885,6 +4883,7 @@ igb_rxeof(struct igb_queue *que, int cou ** case only the first header is valid. */ if (rxr->hdr_split && rxr->fmp == NULL) { + bus_dmamap_unload(rxr->htag, rxbuf->hmap); hlen = (hdr & E1000_RXDADV_HDRBUFLEN_MASK) >> E1000_RXDADV_HDRBUFLEN_SHIFT; if (hlen > IGB_HDR_BUF) @@ -4917,6 +4916,7 @@ igb_rxeof(struct igb_queue *que, int cou /* clear buf info for refresh */ rxbuf->m_pack = NULL; } + bus_dmamap_unload(rxr->ptag, rxbuf->pmap); ++processed; /* So we know when to refresh */ Modified: stable/10/sys/dev/e1000/if_lem.c ============================================================================== --- stable/10/sys/dev/e1000/if_lem.c Tue Dec 17 13:13:02 2013 (r259507) +++ stable/10/sys/dev/e1000/if_lem.c Tue Dec 17 13:18:41 2013 (r259508) @@ -3182,8 +3182,7 @@ lem_allocate_receive_structures(struct a } /* Create the spare map (used by getbuf) */ - error = bus_dmamap_create(adapter->rxtag, BUS_DMA_NOWAIT, - &adapter->rx_sparemap); + error = bus_dmamap_create(adapter->rxtag, 0, &adapter->rx_sparemap); if (error) { device_printf(dev, "%s: bus_dmamap_create failed: %d\n", __func__, error); @@ -3192,8 +3191,7 @@ lem_allocate_receive_structures(struct a rx_buffer = adapter->rx_buffer_area; for (i = 0; i < adapter->num_rx_desc; i++, rx_buffer++) { - error = bus_dmamap_create(adapter->rxtag, BUS_DMA_NOWAIT, - &rx_buffer->map); + error = bus_dmamap_create(adapter->rxtag, 0, &rx_buffer->map); if (error) { device_printf(dev, "%s: bus_dmamap_create failed: %d\n", __func__, error); From owner-svn-src-stable-10@FreeBSD.ORG Tue Dec 17 13:38:23 2013 Return-Path: Delivered-To: svn-src-stable-10@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 ESMTPS id B016D1BC; Tue, 17 Dec 2013 13:38:23 +0000 (UTC) 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 993AB12D9; Tue, 17 Dec 2013 13:38: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 rBHDcNa3081153; Tue, 17 Dec 2013 13:38:23 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBHDcLOB081138; Tue, 17 Dec 2013 13:38:21 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201312171338.rBHDcLOB081138@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 17 Dec 2013 13:38:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259510 - in stable/10/sys: arm/arm ia64/ia64 kern mips/mips powerpc/powerpc sparc64/include sys x86/x86 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Dec 2013 13:38:23 -0000 Author: kib Date: Tue Dec 17 13:38:21 2013 New Revision: 259510 URL: http://svnweb.freebsd.org/changeset/base/259510 Log: MFC r257228: Add bus_dmamap_load_ma() function to load map with the array of vm_pages. Modified: stable/10/sys/arm/arm/busdma_machdep-v6.c stable/10/sys/arm/arm/busdma_machdep.c stable/10/sys/ia64/ia64/busdma_machdep.c stable/10/sys/kern/subr_bus_dma.c stable/10/sys/mips/mips/busdma_machdep.c stable/10/sys/powerpc/powerpc/busdma_machdep.c stable/10/sys/sparc64/include/bus_dma.h stable/10/sys/sys/bus_dma.h stable/10/sys/x86/x86/busdma_machdep.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/arm/arm/busdma_machdep-v6.c ============================================================================== --- stable/10/sys/arm/arm/busdma_machdep-v6.c Tue Dec 17 13:37:02 2013 (r259509) +++ stable/10/sys/arm/arm/busdma_machdep-v6.c Tue Dec 17 13:38:21 2013 (r259510) @@ -975,6 +975,16 @@ _bus_dmamap_load_phys(bus_dma_tag_t dmat return (0); } +int +_bus_dmamap_load_ma(bus_dma_tag_t dmat, bus_dmamap_t map, + struct vm_page **ma, bus_size_t tlen, int ma_offs, int flags, + bus_dma_segment_t *segs, int *segp) +{ + + return (bus_dmamap_load_ma_triv(dmat, map, ma, tlen, ma_offs, flags, + segs, segp)); +} + /* * Utility function to load a linear buffer. segp contains * the starting segment on entrace, and the ending segment on exit. Modified: stable/10/sys/arm/arm/busdma_machdep.c ============================================================================== --- stable/10/sys/arm/arm/busdma_machdep.c Tue Dec 17 13:37:02 2013 (r259509) +++ stable/10/sys/arm/arm/busdma_machdep.c Tue Dec 17 13:38:21 2013 (r259510) @@ -992,6 +992,17 @@ _bus_dmamap_load_phys(bus_dma_tag_t dmat } return (0); } + +int +_bus_dmamap_load_ma(bus_dma_tag_t dmat, bus_dmamap_t map, + struct vm_page **ma, bus_size_t tlen, int ma_offs, int flags, + bus_dma_segment_t *segs, int *segp) +{ + + return (bus_dmamap_load_ma_triv(dmat, map, ma, tlen, ma_offs, flags, + segs, segp)); +} + /* * Utility function to load a linear buffer. segp contains * the starting segment on entrance, and the ending segment on exit. Modified: stable/10/sys/ia64/ia64/busdma_machdep.c ============================================================================== --- stable/10/sys/ia64/ia64/busdma_machdep.c Tue Dec 17 13:37:02 2013 (r259509) +++ stable/10/sys/ia64/ia64/busdma_machdep.c Tue Dec 17 13:38:21 2013 (r259510) @@ -658,6 +658,17 @@ _bus_dmamap_load_phys(bus_dma_tag_t dmat */ return (buflen != 0 ? EFBIG : 0); /* XXX better return value here? */ } + +int +_bus_dmamap_load_ma(bus_dma_tag_t dmat, bus_dmamap_t map, + struct vm_page **ma, bus_size_t tlen, int ma_offs, int flags, + bus_dma_segment_t *segs, int *segp) +{ + + return (bus_dmamap_load_ma_triv(dmat, map, ma, tlen, ma_offs, flags, + segs, segp)); +} + /* * Utility function to load a linear buffer. segp contains * the starting segment on entrace, and the ending segment on exit. Modified: stable/10/sys/kern/subr_bus_dma.c ============================================================================== --- stable/10/sys/kern/subr_bus_dma.c Tue Dec 17 13:37:02 2013 (r259509) +++ stable/10/sys/kern/subr_bus_dma.c Tue Dec 17 13:38:21 2013 (r259510) @@ -124,24 +124,33 @@ static int _bus_dmamap_load_bio(bus_dma_tag_t dmat, bus_dmamap_t map, struct bio *bio, int *nsegs, int flags) { - vm_paddr_t paddr; - bus_size_t len, tlen; - int error, i, ma_offs; + int error; if ((bio->bio_flags & BIO_UNMAPPED) == 0) { error = _bus_dmamap_load_buffer(dmat, map, bio->bio_data, bio->bio_bcount, kernel_pmap, flags, NULL, nsegs); - return (error); + } else { + error = _bus_dmamap_load_ma(dmat, map, bio->bio_ma, + bio->bio_bcount, bio->bio_ma_offset, flags, NULL, nsegs); } + return (error); +} + +int +bus_dmamap_load_ma_triv(bus_dma_tag_t dmat, bus_dmamap_t map, + struct vm_page **ma, bus_size_t tlen, int ma_offs, int flags, + bus_dma_segment_t *segs, int *segp) +{ + vm_paddr_t paddr; + bus_size_t len; + int error, i; error = 0; - tlen = bio->bio_bcount; - ma_offs = bio->bio_ma_offset; for (i = 0; tlen > 0; i++, tlen -= len) { len = min(PAGE_SIZE - ma_offs, tlen); - paddr = VM_PAGE_TO_PHYS(bio->bio_ma[i]) + ma_offs; + paddr = VM_PAGE_TO_PHYS(ma[i]) + ma_offs; error = _bus_dmamap_load_phys(dmat, map, paddr, len, - flags, NULL, nsegs); + flags, segs, segp); if (error != 0) break; ma_offs = 0; Modified: stable/10/sys/mips/mips/busdma_machdep.c ============================================================================== --- stable/10/sys/mips/mips/busdma_machdep.c Tue Dec 17 13:37:02 2013 (r259509) +++ stable/10/sys/mips/mips/busdma_machdep.c Tue Dec 17 13:38:21 2013 (r259510) @@ -878,6 +878,16 @@ _bus_dmamap_load_phys(bus_dma_tag_t dmat return (0); } +int +_bus_dmamap_load_ma(bus_dma_tag_t dmat, bus_dmamap_t map, + struct vm_page **ma, bus_size_t tlen, int ma_offs, int flags, + bus_dma_segment_t *segs, int *segp) +{ + + return (bus_dmamap_load_ma_triv(dmat, map, ma, tlen, ma_offs, flags, + segs, segp)); +} + /* * Utility function to load a linear buffer. segp contains * the starting segment on entrance, and the ending segment on exit. Modified: stable/10/sys/powerpc/powerpc/busdma_machdep.c ============================================================================== --- stable/10/sys/powerpc/powerpc/busdma_machdep.c Tue Dec 17 13:37:02 2013 (r259509) +++ stable/10/sys/powerpc/powerpc/busdma_machdep.c Tue Dec 17 13:38:21 2013 (r259510) @@ -754,6 +754,16 @@ _bus_dmamap_load_phys(bus_dma_tag_t dmat return (buflen != 0 ? EFBIG : 0); /* XXX better return value here? */ } +int +_bus_dmamap_load_ma(bus_dma_tag_t dmat, bus_dmamap_t map, + struct vm_page **ma, bus_size_t tlen, int ma_offs, int flags, + bus_dma_segment_t *segs, int *segp) +{ + + return (bus_dmamap_load_ma_triv(dmat, map, ma, tlen, ma_offs, flags, + segs, segp)); +} + /* * Utility function to load a linear buffer. segp contains * the starting segment on entrance, and the ending segment on exit. Modified: stable/10/sys/sparc64/include/bus_dma.h ============================================================================== --- stable/10/sys/sparc64/include/bus_dma.h Tue Dec 17 13:37:02 2013 (r259509) +++ stable/10/sys/sparc64/include/bus_dma.h Tue Dec 17 13:38:21 2013 (r259510) @@ -146,5 +146,7 @@ struct bus_dma_tag { ((t)->dt_mt->dm_dmamem_alloc((t), (v), (f), (m))) #define bus_dmamem_free(t, v, m) \ ((t)->dt_mt->dm_dmamem_free((t), (v), (m))) +#define _bus_dmamap_load_ma(t, m, a, tt, o, f, s, p) \ + bus_dmamap_load_ma_triv((t), (m), (a), (tt), (o), (f), (s), (p)) #endif /* !_SPARC64_BUS_DMA_H_ */ Modified: stable/10/sys/sys/bus_dma.h ============================================================================== --- stable/10/sys/sys/bus_dma.h Tue Dec 17 13:37:02 2013 (r259509) +++ stable/10/sys/sys/bus_dma.h Tue Dec 17 13:38:21 2013 (r259510) @@ -247,6 +247,15 @@ int bus_dmamap_load_mem(bus_dma_tag_t dm void *callback_arg, int flags); /* + * Placeholder for use by busdma implementations which do not benefit + * from optimized procedure to load an array of vm_page_t. Falls back + * to do _bus_dmamap_load_phys() in loop. + */ +int bus_dmamap_load_ma_triv(bus_dma_tag_t dmat, bus_dmamap_t map, + struct vm_page **ma, bus_size_t tlen, int ma_offs, int flags, + bus_dma_segment_t *segs, int *segp); + +/* * XXX sparc64 uses the same interface, but a much different implementation. * for the sparc64 arch contains the equivalent * declarations. @@ -324,6 +333,10 @@ int _bus_dmamap_load_phys(bus_dma_tag_t vm_paddr_t paddr, bus_size_t buflen, int flags, bus_dma_segment_t *segs, int *segp); +int _bus_dmamap_load_ma(bus_dma_tag_t dmat, bus_dmamap_t map, + struct vm_page **ma, bus_size_t tlen, int ma_offs, int flags, + bus_dma_segment_t *segs, int *segp); + bus_dma_segment_t *_bus_dmamap_complete(bus_dma_tag_t dmat, bus_dmamap_t map, bus_dma_segment_t *segs, Modified: stable/10/sys/x86/x86/busdma_machdep.c ============================================================================== --- stable/10/sys/x86/x86/busdma_machdep.c Tue Dec 17 13:37:02 2013 (r259509) +++ stable/10/sys/x86/x86/busdma_machdep.c Tue Dec 17 13:38:21 2013 (r259510) @@ -849,6 +849,16 @@ _bus_dmamap_load_buffer(bus_dma_tag_t dm return (buflen != 0 ? EFBIG : 0); /* XXX better return value here? */ } +int +_bus_dmamap_load_ma(bus_dma_tag_t dmat, bus_dmamap_t map, + struct vm_page **ma, bus_size_t tlen, int ma_offs, int flags, + bus_dma_segment_t *segs, int *segp) +{ + + return (bus_dmamap_load_ma_triv(dmat, map, ma, tlen, ma_offs, flags, + segs, segp)); +} + void __bus_dmamap_waitok(bus_dma_tag_t dmat, bus_dmamap_t map, struct memdesc *mem, bus_dmamap_callback_t *callback, From owner-svn-src-stable-10@FreeBSD.ORG Tue Dec 17 13:39:51 2013 Return-Path: Delivered-To: svn-src-stable-10@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 ESMTPS id 635F3314; Tue, 17 Dec 2013 13:39:51 +0000 (UTC) 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 4C89E12EB; Tue, 17 Dec 2013 13:39: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 rBHDdpkg081340; Tue, 17 Dec 2013 13:39:51 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBHDdoCl081332; Tue, 17 Dec 2013 13:39:50 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201312171339.rBHDdoCl081332@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 17 Dec 2013 13:39:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259511 - in stable/10/sys: conf x86/include x86/x86 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Dec 2013 13:39:51 -0000 Author: kib Date: Tue Dec 17 13:39:50 2013 New Revision: 259511 URL: http://svnweb.freebsd.org/changeset/base/259511 Log: MFC r257230: Add a virtual table for the busdma methods on x86, to allow different busdma implementations to coexist. Added: stable/10/sys/x86/include/busdma_impl.h - copied unchanged from r257230, head/sys/x86/include/busdma_impl.h stable/10/sys/x86/x86/busdma_bounce.c - copied unchanged from r257230, head/sys/x86/x86/busdma_bounce.c Modified: stable/10/sys/conf/files.amd64 stable/10/sys/conf/files.i386 stable/10/sys/conf/files.pc98 stable/10/sys/x86/x86/busdma_machdep.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/conf/files.amd64 ============================================================================== --- stable/10/sys/conf/files.amd64 Tue Dec 17 13:38:21 2013 (r259510) +++ stable/10/sys/conf/files.amd64 Tue Dec 17 13:39:50 2013 (r259511) @@ -541,6 +541,7 @@ x86/isa/nmi.c standard x86/isa/orm.c optional isa x86/pci/pci_bus.c optional pci x86/pci/qpi.c optional pci +x86/x86/busdma_bounce.c standard x86/x86/busdma_machdep.c standard x86/x86/dump_machdep.c standard x86/x86/fdt_machdep.c optional fdt Modified: stable/10/sys/conf/files.i386 ============================================================================== --- stable/10/sys/conf/files.i386 Tue Dec 17 13:38:21 2013 (r259510) +++ stable/10/sys/conf/files.i386 Tue Dec 17 13:39:50 2013 (r259511) @@ -576,6 +576,7 @@ x86/isa/nmi.c standard x86/isa/orm.c optional isa x86/pci/pci_bus.c optional pci x86/pci/qpi.c optional pci +x86/x86/busdma_bounce.c standard x86/x86/busdma_machdep.c standard x86/x86/dump_machdep.c standard x86/x86/fdt_machdep.c optional fdt Modified: stable/10/sys/conf/files.pc98 ============================================================================== --- stable/10/sys/conf/files.pc98 Tue Dec 17 13:38:21 2013 (r259510) +++ stable/10/sys/conf/files.pc98 Tue Dec 17 13:39:50 2013 (r259511) @@ -247,6 +247,7 @@ x86/isa/atpic.c optional atpic x86/isa/clock.c standard x86/isa/isa.c optional isa x86/pci/pci_bus.c optional pci +x86/x86/busdma_bounce.c standard x86/x86/busdma_machdep.c standard x86/x86/dump_machdep.c standard x86/x86/intr_machdep.c standard Copied: stable/10/sys/x86/include/busdma_impl.h (from r257230, head/sys/x86/include/busdma_impl.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/sys/x86/include/busdma_impl.h Tue Dec 17 13:39:50 2013 (r259511, copy of r257230, head/sys/x86/include/busdma_impl.h) @@ -0,0 +1,97 @@ +/*- + * Copyright (c) 2013 The FreeBSD Foundation + * All rights reserved. + * + * This software was developed by Konstantin Belousov + * under sponsorship from the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef __X86_BUSDMA_IMPL_H +#define __X86_BUSDMA_IMPL_H + +struct bus_dma_tag_common { + struct bus_dma_impl *impl; + struct bus_dma_tag_common *parent; + bus_size_t alignment; + bus_addr_t boundary; + bus_addr_t lowaddr; + bus_addr_t highaddr; + bus_dma_filter_t *filter; + void *filterarg; + bus_size_t maxsize; + u_int nsegments; + bus_size_t maxsegsz; + int flags; + bus_dma_lock_t *lockfunc; + void *lockfuncarg; + int ref_count; +}; + +struct bus_dma_impl { + int (*tag_create)(bus_dma_tag_t parent, + bus_size_t alignment, bus_addr_t boundary, bus_addr_t lowaddr, + bus_addr_t highaddr, bus_dma_filter_t *filter, + void *filterarg, bus_size_t maxsize, int nsegments, + bus_size_t maxsegsz, int flags, bus_dma_lock_t *lockfunc, + void *lockfuncarg, bus_dma_tag_t *dmat); + int (*tag_destroy)(bus_dma_tag_t dmat); + int (*map_create)(bus_dma_tag_t dmat, int flags, bus_dmamap_t *mapp); + int (*map_destroy)(bus_dma_tag_t dmat, bus_dmamap_t map); + int (*mem_alloc)(bus_dma_tag_t dmat, void** vaddr, int flags, + bus_dmamap_t *mapp); + void (*mem_free)(bus_dma_tag_t dmat, void *vaddr, bus_dmamap_t map); + int (*load_ma)(bus_dma_tag_t dmat, bus_dmamap_t map, + struct vm_page **ma, bus_size_t tlen, int ma_offs, int flags, + bus_dma_segment_t *segs, int *segp); + int (*load_phys)(bus_dma_tag_t dmat, bus_dmamap_t map, + vm_paddr_t buf, bus_size_t buflen, int flags, + bus_dma_segment_t *segs, int *segp); + int (*load_buffer)(bus_dma_tag_t dmat, bus_dmamap_t map, + void *buf, bus_size_t buflen, pmap_t pmap, int flags, + bus_dma_segment_t *segs, int *segp); + void (*map_waitok)(bus_dma_tag_t dmat, bus_dmamap_t map, + struct memdesc *mem, bus_dmamap_callback_t *callback, + void *callback_arg); + bus_dma_segment_t *(*map_complete)(bus_dma_tag_t dmat, bus_dmamap_t map, + bus_dma_segment_t *segs, int nsegs, int error); + void (*map_unload)(bus_dma_tag_t dmat, bus_dmamap_t map); + void (*map_sync)(bus_dma_tag_t dmat, bus_dmamap_t map, + bus_dmasync_op_t op); +}; + +void busdma_lock_mutex(void *arg, bus_dma_lock_op_t op); +void bus_dma_dflt_lock(void *arg, bus_dma_lock_op_t op); +int bus_dma_run_filter(struct bus_dma_tag_common *dmat, bus_addr_t paddr); +int common_bus_dma_tag_create(struct bus_dma_tag_common *parent, + bus_size_t alignment, + bus_addr_t boundary, bus_addr_t lowaddr, bus_addr_t highaddr, + bus_dma_filter_t *filter, void *filterarg, bus_size_t maxsize, + int nsegments, bus_size_t maxsegsz, int flags, bus_dma_lock_t *lockfunc, + void *lockfuncarg, size_t sz, void **dmat); + +extern struct bus_dma_impl bus_dma_bounce_impl; + +#endif Copied: stable/10/sys/x86/x86/busdma_bounce.c (from r257230, head/sys/x86/x86/busdma_bounce.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/sys/x86/x86/busdma_bounce.c Tue Dec 17 13:39:50 2013 (r259511, copy of r257230, head/sys/x86/x86/busdma_bounce.c) @@ -0,0 +1,1080 @@ +/*- + * Copyright (c) 1997, 1998 Justin T. Gibbs. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer, + * without modification, immediately at the beginning of the file. + * 2. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#ifdef __i386__ +#define MAX_BPAGES 512 +#else +#define MAX_BPAGES 8192 +#endif +#define BUS_DMA_COULD_BOUNCE BUS_DMA_BUS3 +#define BUS_DMA_MIN_ALLOC_COMP BUS_DMA_BUS4 + +struct bounce_zone; + +struct bus_dma_tag { + struct bus_dma_tag_common common; + int map_count; + bus_dma_segment_t *segments; + struct bounce_zone *bounce_zone; +}; + +struct bounce_page { + vm_offset_t vaddr; /* kva of bounce buffer */ + bus_addr_t busaddr; /* Physical address */ + vm_offset_t datavaddr; /* kva of client data */ + bus_addr_t dataaddr; /* client physical address */ + bus_size_t datacount; /* client data count */ + STAILQ_ENTRY(bounce_page) links; +}; + +int busdma_swi_pending; + +struct bounce_zone { + STAILQ_ENTRY(bounce_zone) links; + STAILQ_HEAD(bp_list, bounce_page) bounce_page_list; + int total_bpages; + int free_bpages; + int reserved_bpages; + int active_bpages; + int total_bounced; + int total_deferred; + int map_count; + bus_size_t alignment; + bus_addr_t lowaddr; + char zoneid[8]; + char lowaddrid[20]; + struct sysctl_ctx_list sysctl_tree; + struct sysctl_oid *sysctl_tree_top; +}; + +static struct mtx bounce_lock; +static int total_bpages; +static int busdma_zonecount; +static STAILQ_HEAD(, bounce_zone) bounce_zone_list; + +static SYSCTL_NODE(_hw, OID_AUTO, busdma, CTLFLAG_RD, 0, "Busdma parameters"); +SYSCTL_INT(_hw_busdma, OID_AUTO, total_bpages, CTLFLAG_RD, &total_bpages, 0, + "Total bounce pages"); + +struct bus_dmamap { + struct bp_list bpages; + int pagesneeded; + int pagesreserved; + bus_dma_tag_t dmat; + struct memdesc mem; + bus_dmamap_callback_t *callback; + void *callback_arg; + STAILQ_ENTRY(bus_dmamap) links; +}; + +static STAILQ_HEAD(, bus_dmamap) bounce_map_waitinglist; +static STAILQ_HEAD(, bus_dmamap) bounce_map_callbacklist; +static struct bus_dmamap nobounce_dmamap, contig_dmamap; + +static void init_bounce_pages(void *dummy); +static int alloc_bounce_zone(bus_dma_tag_t dmat); +static int alloc_bounce_pages(bus_dma_tag_t dmat, u_int numpages); +static int reserve_bounce_pages(bus_dma_tag_t dmat, bus_dmamap_t map, + int commit); +static bus_addr_t add_bounce_page(bus_dma_tag_t dmat, bus_dmamap_t map, + vm_offset_t vaddr, bus_addr_t addr, + bus_size_t size); +static void free_bounce_page(bus_dma_tag_t dmat, struct bounce_page *bpage); +int run_filter(bus_dma_tag_t dmat, bus_addr_t paddr); +static void _bus_dmamap_count_pages(bus_dma_tag_t dmat, bus_dmamap_t map, + pmap_t pmap, void *buf, bus_size_t buflen, + int flags); +static void _bus_dmamap_count_phys(bus_dma_tag_t dmat, bus_dmamap_t map, + vm_paddr_t buf, bus_size_t buflen, + int flags); +static int _bus_dmamap_reserve_pages(bus_dma_tag_t dmat, bus_dmamap_t map, + int flags); + +#ifdef XEN +#undef pmap_kextract +#define pmap_kextract pmap_kextract_ma +#endif + +/* + * Allocate a device specific dma_tag. + */ +static int +bounce_bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t alignment, + bus_addr_t boundary, bus_addr_t lowaddr, bus_addr_t highaddr, + bus_dma_filter_t *filter, void *filterarg, bus_size_t maxsize, + int nsegments, bus_size_t maxsegsz, int flags, bus_dma_lock_t *lockfunc, + void *lockfuncarg, bus_dma_tag_t *dmat) +{ + bus_dma_tag_t newtag; + int error; + + *dmat = NULL; + error = common_bus_dma_tag_create(parent != NULL ? &parent->common : + NULL, alignment, boundary, lowaddr, highaddr, filter, filterarg, + maxsize, nsegments, maxsegsz, flags, lockfunc, lockfuncarg, + sizeof (struct bus_dma_tag), (void **)&newtag); + if (error != 0) + return (error); + + newtag->common.impl = &bus_dma_bounce_impl; + newtag->map_count = 0; + newtag->segments = NULL; + + if (parent != NULL && ((newtag->common.filter != NULL) || + ((parent->common.flags & BUS_DMA_COULD_BOUNCE) != 0))) + newtag->common.flags |= BUS_DMA_COULD_BOUNCE; + + if (newtag->common.lowaddr < ptoa((vm_paddr_t)Maxmem) || + newtag->common.alignment > 1) + newtag->common.flags |= BUS_DMA_COULD_BOUNCE; + + if (((newtag->common.flags & BUS_DMA_COULD_BOUNCE) != 0) && + (flags & BUS_DMA_ALLOCNOW) != 0) { + struct bounce_zone *bz; + + /* Must bounce */ + if ((error = alloc_bounce_zone(newtag)) != 0) { + free(newtag, M_DEVBUF); + return (error); + } + bz = newtag->bounce_zone; + + if (ptoa(bz->total_bpages) < maxsize) { + int pages; + + pages = atop(maxsize) - bz->total_bpages; + + /* Add pages to our bounce pool */ + if (alloc_bounce_pages(newtag, pages) < pages) + error = ENOMEM; + } + /* Performed initial allocation */ + newtag->common.flags |= BUS_DMA_MIN_ALLOC_COMP; + } else + error = 0; + + if (error != 0) + free(newtag, M_DEVBUF); + else + *dmat = newtag; + CTR4(KTR_BUSDMA, "%s returned tag %p tag flags 0x%x error %d", + __func__, newtag, (newtag != NULL ? newtag->common.flags : 0), + error); + return (error); +} + +static int +bounce_bus_dma_tag_destroy(bus_dma_tag_t dmat) +{ + bus_dma_tag_t dmat_copy, parent; + int error; + + error = 0; + dmat_copy = dmat; + + if (dmat != NULL) { + if (dmat->map_count != 0) { + error = EBUSY; + goto out; + } + while (dmat != NULL) { + parent = (bus_dma_tag_t)dmat->common.parent; + atomic_subtract_int(&dmat->common.ref_count, 1); + if (dmat->common.ref_count == 0) { + if (dmat->segments != NULL) + free(dmat->segments, M_DEVBUF); + free(dmat, M_DEVBUF); + /* + * Last reference count, so + * release our reference + * count on our parent. + */ + dmat = parent; + } else + dmat = NULL; + } + } +out: + CTR3(KTR_BUSDMA, "%s tag %p error %d", __func__, dmat_copy, error); + return (error); +} + +/* + * Allocate a handle for mapping from kva/uva/physical + * address space into bus device space. + */ +static int +bounce_bus_dmamap_create(bus_dma_tag_t dmat, int flags, bus_dmamap_t *mapp) +{ + struct bounce_zone *bz; + int error, maxpages, pages; + + error = 0; + + if (dmat->segments == NULL) { + dmat->segments = (bus_dma_segment_t *)malloc( + sizeof(bus_dma_segment_t) * dmat->common.nsegments, + M_DEVBUF, M_NOWAIT); + if (dmat->segments == NULL) { + CTR3(KTR_BUSDMA, "%s: tag %p error %d", + __func__, dmat, ENOMEM); + return (ENOMEM); + } + } + + /* + * Bouncing might be required if the driver asks for an active + * exclusion region, a data alignment that is stricter than 1, and/or + * an active address boundary. + */ + if (dmat->common.flags & BUS_DMA_COULD_BOUNCE) { + /* Must bounce */ + if (dmat->bounce_zone == NULL) { + if ((error = alloc_bounce_zone(dmat)) != 0) + return (error); + } + bz = dmat->bounce_zone; + + *mapp = (bus_dmamap_t)malloc(sizeof(**mapp), M_DEVBUF, + M_NOWAIT | M_ZERO); + if (*mapp == NULL) { + CTR3(KTR_BUSDMA, "%s: tag %p error %d", + __func__, dmat, ENOMEM); + return (ENOMEM); + } + + /* Initialize the new map */ + STAILQ_INIT(&((*mapp)->bpages)); + + /* + * Attempt to add pages to our pool on a per-instance + * basis up to a sane limit. + */ + if (dmat->common.alignment > 1) + maxpages = MAX_BPAGES; + else + maxpages = MIN(MAX_BPAGES, Maxmem - + atop(dmat->common.lowaddr)); + if ((dmat->common.flags & BUS_DMA_MIN_ALLOC_COMP) == 0 || + (bz->map_count > 0 && bz->total_bpages < maxpages)) { + pages = MAX(atop(dmat->common.maxsize), 1); + pages = MIN(maxpages - bz->total_bpages, pages); + pages = MAX(pages, 1); + if (alloc_bounce_pages(dmat, pages) < pages) + error = ENOMEM; + if ((dmat->common.flags & BUS_DMA_MIN_ALLOC_COMP) + == 0) { + if (error == 0) { + dmat->common.flags |= + BUS_DMA_MIN_ALLOC_COMP; + } + } else + error = 0; + } + bz->map_count++; + } else { + *mapp = NULL; + } + if (error == 0) + dmat->map_count++; + CTR4(KTR_BUSDMA, "%s: tag %p tag flags 0x%x error %d", + __func__, dmat, dmat->common.flags, error); + return (error); +} + +/* + * Destroy a handle for mapping from kva/uva/physical + * address space into bus device space. + */ +static int +bounce_bus_dmamap_destroy(bus_dma_tag_t dmat, bus_dmamap_t map) +{ + + if (map != NULL && map != &nobounce_dmamap && map != &contig_dmamap) { + if (STAILQ_FIRST(&map->bpages) != NULL) { + CTR3(KTR_BUSDMA, "%s: tag %p error %d", + __func__, dmat, EBUSY); + return (EBUSY); + } + if (dmat->bounce_zone) + dmat->bounce_zone->map_count--; + free(map, M_DEVBUF); + } + dmat->map_count--; + CTR2(KTR_BUSDMA, "%s: tag %p error 0", __func__, dmat); + return (0); +} + + +/* + * Allocate a piece of memory that can be efficiently mapped into + * bus device space based on the constraints lited in the dma tag. + * A dmamap to for use with dmamap_load is also allocated. + */ +static int +bounce_bus_dmamem_alloc(bus_dma_tag_t dmat, void** vaddr, int flags, + bus_dmamap_t *mapp) +{ + vm_memattr_t attr; + int mflags; + + if (flags & BUS_DMA_NOWAIT) + mflags = M_NOWAIT; + else + mflags = M_WAITOK; + + /* If we succeed, no mapping/bouncing will be required */ + *mapp = NULL; + + if (dmat->segments == NULL) { + dmat->segments = (bus_dma_segment_t *)malloc( + sizeof(bus_dma_segment_t) * dmat->common.nsegments, + M_DEVBUF, mflags); + if (dmat->segments == NULL) { + CTR4(KTR_BUSDMA, "%s: tag %p tag flags 0x%x error %d", + __func__, dmat, dmat->common.flags, ENOMEM); + return (ENOMEM); + } + } + if (flags & BUS_DMA_ZERO) + mflags |= M_ZERO; + if (flags & BUS_DMA_NOCACHE) + attr = VM_MEMATTR_UNCACHEABLE; + else + attr = VM_MEMATTR_DEFAULT; + + /* + * XXX: + * (dmat->alignment < dmat->maxsize) is just a quick hack; the exact + * alignment guarantees of malloc need to be nailed down, and the + * code below should be rewritten to take that into account. + * + * In the meantime, we'll warn the user if malloc gets it wrong. + */ + if ((dmat->common.maxsize <= PAGE_SIZE) && + (dmat->common.alignment < dmat->common.maxsize) && + dmat->common.lowaddr >= ptoa((vm_paddr_t)Maxmem) && + attr == VM_MEMATTR_DEFAULT) { + *vaddr = malloc(dmat->common.maxsize, M_DEVBUF, mflags); + } else if (dmat->common.nsegments >= btoc(dmat->common.maxsize) && + dmat->common.alignment <= PAGE_SIZE && + (dmat->common.boundary == 0 || + dmat->common.boundary >= dmat->common.lowaddr)) { + /* Page-based multi-segment allocations allowed */ + *vaddr = (void *)kmem_alloc_attr(kernel_arena, + dmat->common.maxsize, mflags, 0ul, dmat->common.lowaddr, + attr); + *mapp = &contig_dmamap; + } else { + *vaddr = (void *)kmem_alloc_contig(kernel_arena, + dmat->common.maxsize, mflags, 0ul, dmat->common.lowaddr, + dmat->common.alignment != 0 ? dmat->common.alignment : 1ul, + dmat->common.boundary, attr); + *mapp = &contig_dmamap; + } + if (*vaddr == NULL) { + CTR4(KTR_BUSDMA, "%s: tag %p tag flags 0x%x error %d", + __func__, dmat, dmat->common.flags, ENOMEM); + return (ENOMEM); + } else if (vtophys(*vaddr) & (dmat->common.alignment - 1)) { + printf("bus_dmamem_alloc failed to align memory properly.\n"); + } + CTR4(KTR_BUSDMA, "%s: tag %p tag flags 0x%x error %d", + __func__, dmat, dmat->common.flags, 0); + return (0); +} + +/* + * Free a piece of memory and it's allociated dmamap, that was allocated + * via bus_dmamem_alloc. Make the same choice for free/contigfree. + */ +static void +bounce_bus_dmamem_free(bus_dma_tag_t dmat, void *vaddr, bus_dmamap_t map) +{ + /* + * dmamem does not need to be bounced, so the map should be + * NULL if malloc() was used and contig_dmamap if + * kmem_alloc_contig() was used. + */ + if (!(map == NULL || map == &contig_dmamap)) + panic("bus_dmamem_free: Invalid map freed\n"); + if (map == NULL) + free(vaddr, M_DEVBUF); + else + kmem_free(kernel_arena, (vm_offset_t)vaddr, + dmat->common.maxsize); + CTR3(KTR_BUSDMA, "%s: tag %p flags 0x%x", __func__, dmat, + dmat->common.flags); +} + +static void +_bus_dmamap_count_phys(bus_dma_tag_t dmat, bus_dmamap_t map, vm_paddr_t buf, + bus_size_t buflen, int flags) +{ + bus_addr_t curaddr; + bus_size_t sgsize; + + if ((map != &nobounce_dmamap && map->pagesneeded == 0)) { + /* + * Count the number of bounce pages + * needed in order to complete this transfer + */ + curaddr = buf; + while (buflen != 0) { + sgsize = MIN(buflen, dmat->common.maxsegsz); + if (bus_dma_run_filter(&dmat->common, curaddr)) { + sgsize = MIN(sgsize, PAGE_SIZE); + map->pagesneeded++; + } + curaddr += sgsize; + buflen -= sgsize; + } + CTR1(KTR_BUSDMA, "pagesneeded= %d\n", map->pagesneeded); + } +} + +static void +_bus_dmamap_count_pages(bus_dma_tag_t dmat, bus_dmamap_t map, pmap_t pmap, + void *buf, bus_size_t buflen, int flags) +{ + vm_offset_t vaddr; + vm_offset_t vendaddr; + bus_addr_t paddr; + bus_size_t sg_len; + + if ((map != &nobounce_dmamap && map->pagesneeded == 0)) { + CTR4(KTR_BUSDMA, "lowaddr= %d Maxmem= %d, boundary= %d, " + "alignment= %d", dmat->common.lowaddr, + ptoa((vm_paddr_t)Maxmem), + dmat->common.boundary, dmat->common.alignment); + CTR3(KTR_BUSDMA, "map= %p, nobouncemap= %p, pagesneeded= %d", + map, &nobounce_dmamap, map->pagesneeded); + /* + * Count the number of bounce pages + * needed in order to complete this transfer + */ + vaddr = (vm_offset_t)buf; + vendaddr = (vm_offset_t)buf + buflen; + + while (vaddr < vendaddr) { + sg_len = PAGE_SIZE - ((vm_offset_t)vaddr & PAGE_MASK); + if (pmap == kernel_pmap) + paddr = pmap_kextract(vaddr); + else + paddr = pmap_extract(pmap, vaddr); + if (bus_dma_run_filter(&dmat->common, paddr) != 0) { + sg_len = roundup2(sg_len, + dmat->common.alignment); + map->pagesneeded++; + } + vaddr += sg_len; + } + CTR1(KTR_BUSDMA, "pagesneeded= %d\n", map->pagesneeded); + } +} + +static int +_bus_dmamap_reserve_pages(bus_dma_tag_t dmat, bus_dmamap_t map, int flags) +{ + + /* Reserve Necessary Bounce Pages */ + mtx_lock(&bounce_lock); + if (flags & BUS_DMA_NOWAIT) { + if (reserve_bounce_pages(dmat, map, 0) != 0) { + mtx_unlock(&bounce_lock); + return (ENOMEM); + } + } else { + if (reserve_bounce_pages(dmat, map, 1) != 0) { + /* Queue us for resources */ + STAILQ_INSERT_TAIL(&bounce_map_waitinglist, map, links); + mtx_unlock(&bounce_lock); + return (EINPROGRESS); + } + } + mtx_unlock(&bounce_lock); + + return (0); +} + +/* + * Add a single contiguous physical range to the segment list. + */ +static int +_bus_dmamap_addseg(bus_dma_tag_t dmat, bus_dmamap_t map, bus_addr_t curaddr, + bus_size_t sgsize, bus_dma_segment_t *segs, int *segp) +{ + bus_addr_t baddr, bmask; + int seg; + + /* + * Make sure we don't cross any boundaries. + */ + bmask = ~(dmat->common.boundary - 1); + if (dmat->common.boundary > 0) { + baddr = (curaddr + dmat->common.boundary) & bmask; + if (sgsize > (baddr - curaddr)) + sgsize = (baddr - curaddr); + } + + /* + * Insert chunk into a segment, coalescing with + * previous segment if possible. + */ + seg = *segp; + if (seg == -1) { + seg = 0; + segs[seg].ds_addr = curaddr; + segs[seg].ds_len = sgsize; + } else { + if (curaddr == segs[seg].ds_addr + segs[seg].ds_len && + (segs[seg].ds_len + sgsize) <= dmat->common.maxsegsz && + (dmat->common.boundary == 0 || + (segs[seg].ds_addr & bmask) == (curaddr & bmask))) + segs[seg].ds_len += sgsize; + else { + if (++seg >= dmat->common.nsegments) + return (0); + segs[seg].ds_addr = curaddr; + segs[seg].ds_len = sgsize; + } + } + *segp = seg; + return (sgsize); +} + +/* + * Utility function to load a physical buffer. segp contains + * the starting segment on entrace, and the ending segment on exit. + */ +static int +bounce_bus_dmamap_load_phys(bus_dma_tag_t dmat, bus_dmamap_t map, + vm_paddr_t buf, bus_size_t buflen, int flags, bus_dma_segment_t *segs, + int *segp) +{ + bus_size_t sgsize; + bus_addr_t curaddr; + int error; + + if (map == NULL || map == &contig_dmamap) + map = &nobounce_dmamap; + + if (segs == NULL) + segs = dmat->segments; + + if ((dmat->common.flags & BUS_DMA_COULD_BOUNCE) != 0) { + _bus_dmamap_count_phys(dmat, map, buf, buflen, flags); + if (map->pagesneeded != 0) { + error = _bus_dmamap_reserve_pages(dmat, map, flags); + if (error) + return (error); + } + } + + while (buflen > 0) { + curaddr = buf; + sgsize = MIN(buflen, dmat->common.maxsegsz); + if (((dmat->common.flags & BUS_DMA_COULD_BOUNCE) != 0) && + map->pagesneeded != 0 && + bus_dma_run_filter(&dmat->common, curaddr)) { + sgsize = MIN(sgsize, PAGE_SIZE); + curaddr = add_bounce_page(dmat, map, 0, curaddr, + sgsize); + } + sgsize = _bus_dmamap_addseg(dmat, map, curaddr, sgsize, segs, + segp); + if (sgsize == 0) + break; + buf += sgsize; + buflen -= sgsize; + } + + /* + * Did we fit? + */ + return (buflen != 0 ? EFBIG : 0); /* XXX better return value here? */ +} + +/* + * Utility function to load a linear buffer. segp contains + * the starting segment on entrace, and the ending segment on exit. + */ +static int +bounce_bus_dmamap_load_buffer(bus_dma_tag_t dmat, bus_dmamap_t map, void *buf, + bus_size_t buflen, pmap_t pmap, int flags, bus_dma_segment_t *segs, + int *segp) +{ + bus_size_t sgsize, max_sgsize; + bus_addr_t curaddr; + vm_offset_t vaddr; + int error; + + if (map == NULL || map == &contig_dmamap) + map = &nobounce_dmamap; + + if (segs == NULL) + segs = dmat->segments; + + if ((dmat->common.flags & BUS_DMA_COULD_BOUNCE) != 0) { + _bus_dmamap_count_pages(dmat, map, pmap, buf, buflen, flags); + if (map->pagesneeded != 0) { + error = _bus_dmamap_reserve_pages(dmat, map, flags); + if (error) + return (error); + } + } + + vaddr = (vm_offset_t)buf; + while (buflen > 0) { + /* + * Get the physical address for this segment. + */ + if (pmap == kernel_pmap) + curaddr = pmap_kextract(vaddr); + else + curaddr = pmap_extract(pmap, vaddr); + + /* + * Compute the segment size, and adjust counts. + */ + max_sgsize = MIN(buflen, dmat->common.maxsegsz); + sgsize = PAGE_SIZE - ((vm_offset_t)curaddr & PAGE_MASK); + if (((dmat->common.flags & BUS_DMA_COULD_BOUNCE) != 0) && + map->pagesneeded != 0 && + bus_dma_run_filter(&dmat->common, curaddr)) { + sgsize = roundup2(sgsize, dmat->common.alignment); + sgsize = MIN(sgsize, max_sgsize); + curaddr = add_bounce_page(dmat, map, vaddr, curaddr, + sgsize); + } else { + sgsize = MIN(sgsize, max_sgsize); + } + sgsize = _bus_dmamap_addseg(dmat, map, curaddr, sgsize, segs, + segp); + if (sgsize == 0) + break; + vaddr += sgsize; + buflen -= sgsize; + } + + /* + * Did we fit? + */ + return (buflen != 0 ? EFBIG : 0); /* XXX better return value here? */ +} + +static void +bounce_bus_dmamap_waitok(bus_dma_tag_t dmat, bus_dmamap_t map, + struct memdesc *mem, bus_dmamap_callback_t *callback, void *callback_arg) +{ + + if (map == NULL) + return; + map->mem = *mem; + map->dmat = dmat; + map->callback = callback; + map->callback_arg = callback_arg; +} + +static bus_dma_segment_t * +bounce_bus_dmamap_complete(bus_dma_tag_t dmat, bus_dmamap_t map, + bus_dma_segment_t *segs, int nsegs, int error) +{ + + if (segs == NULL) + segs = dmat->segments; + return (segs); +} + +/* + * Release the mapping held by map. + */ +static void +bounce_bus_dmamap_unload(bus_dma_tag_t dmat, bus_dmamap_t map) +{ + struct bounce_page *bpage; + + while ((bpage = STAILQ_FIRST(&map->bpages)) != NULL) { + STAILQ_REMOVE_HEAD(&map->bpages, links); + free_bounce_page(dmat, bpage); + } +} + +static void +bounce_bus_dmamap_sync(bus_dma_tag_t dmat, bus_dmamap_t map, + bus_dmasync_op_t op) +{ + struct bounce_page *bpage; + + if ((bpage = STAILQ_FIRST(&map->bpages)) != NULL) { + /* + * Handle data bouncing. We might also + * want to add support for invalidating + * the caches on broken hardware + */ + CTR4(KTR_BUSDMA, "%s: tag %p tag flags 0x%x op 0x%x " + "performing bounce", __func__, dmat, + dmat->common.flags, op); + + if ((op & BUS_DMASYNC_PREWRITE) != 0) { + while (bpage != NULL) { + if (bpage->datavaddr != 0) { + bcopy((void *)bpage->datavaddr, + (void *)bpage->vaddr, + bpage->datacount); + } else { + physcopyout(bpage->dataaddr, + (void *)bpage->vaddr, + bpage->datacount); + } + bpage = STAILQ_NEXT(bpage, links); + } + dmat->bounce_zone->total_bounced++; + } + + if ((op & BUS_DMASYNC_POSTREAD) != 0) { + while (bpage != NULL) { + if (bpage->datavaddr != 0) { + bcopy((void *)bpage->vaddr, + (void *)bpage->datavaddr, + bpage->datacount); + } else { + physcopyin((void *)bpage->vaddr, + bpage->dataaddr, + bpage->datacount); + } + bpage = STAILQ_NEXT(bpage, links); + } + dmat->bounce_zone->total_bounced++; + } + } +} + +static void +init_bounce_pages(void *dummy __unused) +{ + + total_bpages = 0; + STAILQ_INIT(&bounce_zone_list); + STAILQ_INIT(&bounce_map_waitinglist); + STAILQ_INIT(&bounce_map_callbacklist); + mtx_init(&bounce_lock, "bounce pages lock", NULL, MTX_DEF); +} +SYSINIT(bpages, SI_SUB_LOCK, SI_ORDER_ANY, init_bounce_pages, NULL); + +static struct sysctl_ctx_list * +busdma_sysctl_tree(struct bounce_zone *bz) +{ + return (&bz->sysctl_tree); +} + +static struct sysctl_oid * +busdma_sysctl_tree_top(struct bounce_zone *bz) +{ + return (bz->sysctl_tree_top); +} + +#if defined(__amd64__) || defined(PAE) +#define SYSCTL_ADD_BUS_SIZE_T SYSCTL_ADD_UQUAD +#else +#define SYSCTL_ADD_BUS_SIZE_T(ctx, parent, nbr, name, flag, ptr, desc) \ + SYSCTL_ADD_UINT(ctx, parent, nbr, name, flag, ptr, 0, desc) +#endif + +static int +alloc_bounce_zone(bus_dma_tag_t dmat) +{ + struct bounce_zone *bz; + + /* Check to see if we already have a suitable zone */ + STAILQ_FOREACH(bz, &bounce_zone_list, links) { + if ((dmat->common.alignment <= bz->alignment) && + (dmat->common.lowaddr >= bz->lowaddr)) { + dmat->bounce_zone = bz; + return (0); + } + } + + if ((bz = (struct bounce_zone *)malloc(sizeof(*bz), M_DEVBUF, + M_NOWAIT | M_ZERO)) == NULL) + return (ENOMEM); + + STAILQ_INIT(&bz->bounce_page_list); + bz->free_bpages = 0; + bz->reserved_bpages = 0; + bz->active_bpages = 0; + bz->lowaddr = dmat->common.lowaddr; + bz->alignment = MAX(dmat->common.alignment, PAGE_SIZE); + bz->map_count = 0; + snprintf(bz->zoneid, 8, "zone%d", busdma_zonecount); + busdma_zonecount++; + snprintf(bz->lowaddrid, 18, "%#jx", (uintmax_t)bz->lowaddr); + STAILQ_INSERT_TAIL(&bounce_zone_list, bz, links); + dmat->bounce_zone = bz; + + sysctl_ctx_init(&bz->sysctl_tree); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-10@FreeBSD.ORG Tue Dec 17 13:49:39 2013 Return-Path: Delivered-To: svn-src-stable-10@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 ESMTPS id 2F122734; Tue, 17 Dec 2013 13:49:39 +0000 (UTC) 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 17ED613C8; Tue, 17 Dec 2013 13:49:39 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBHDndBo085010; Tue, 17 Dec 2013 13:49:39 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBHDnauF084994; Tue, 17 Dec 2013 13:49:36 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201312171349.rBHDnauF084994@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 17 Dec 2013 13:49:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259512 - in stable/10/sys: amd64/conf conf dev/acpica i386/conf x86/include x86/iommu X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Dec 2013 13:49:39 -0000 Author: kib Date: Tue Dec 17 13:49:35 2013 New Revision: 259512 URL: http://svnweb.freebsd.org/changeset/base/259512 Log: MFC DMAR busdma implementation. MFC r257251: Import the driver for VT-d DMAR hardware. Implement the busdma(9) using DMARs. MFC r257512: Add support for queued invalidation. MFC miscellaneous follow-ups to r257251. MFC r257266: Remove redundand assignment to error variable and check for its value. MFC r257308: Remove redundand declaration. MFC r257511: Return BUS_PROBE_NOWILDCARD from the DMAR probe method. MFC r257860,r257896,r257900,r257902,r257903 (by dim): Fixes for gcc compilation. Added: stable/10/sys/x86/iommu/ - copied from r257251, head/sys/x86/iommu/ stable/10/sys/x86/iommu/intel_qi.c - copied unchanged from r257512, head/sys/x86/iommu/intel_qi.c Modified: stable/10/sys/amd64/conf/GENERIC stable/10/sys/conf/files.amd64 stable/10/sys/conf/files.i386 stable/10/sys/conf/options stable/10/sys/dev/acpica/acpi_pci.c stable/10/sys/i386/conf/NOTES stable/10/sys/x86/include/busdma_impl.h stable/10/sys/x86/iommu/busdma_dmar.c stable/10/sys/x86/iommu/intel_ctx.c stable/10/sys/x86/iommu/intel_dmar.h stable/10/sys/x86/iommu/intel_drv.c stable/10/sys/x86/iommu/intel_fault.c stable/10/sys/x86/iommu/intel_gas.c stable/10/sys/x86/iommu/intel_idpgtbl.c stable/10/sys/x86/iommu/intel_reg.h stable/10/sys/x86/iommu/intel_utils.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/amd64/conf/GENERIC ============================================================================== --- stable/10/sys/amd64/conf/GENERIC Tue Dec 17 13:39:50 2013 (r259511) +++ stable/10/sys/amd64/conf/GENERIC Tue Dec 17 13:49:35 2013 (r259512) @@ -85,6 +85,7 @@ device cpufreq # Bus support. device acpi +options ACPI_DMAR device pci # Floppy drives Modified: stable/10/sys/conf/files.amd64 ============================================================================== --- stable/10/sys/conf/files.amd64 Tue Dec 17 13:39:50 2013 (r259511) +++ stable/10/sys/conf/files.amd64 Tue Dec 17 13:49:35 2013 (r259512) @@ -531,6 +531,15 @@ x86/cpufreq/powernow.c optional cpufreq x86/cpufreq/est.c optional cpufreq x86/cpufreq/hwpstate.c optional cpufreq x86/cpufreq/p4tcc.c optional cpufreq +x86/iommu/busdma_dmar.c optional acpi acpi_dmar pci +x86/iommu/intel_ctx.c optional acpi acpi_dmar pci +x86/iommu/intel_drv.c optional acpi acpi_dmar pci +x86/iommu/intel_fault.c optional acpi acpi_dmar pci +x86/iommu/intel_gas.c optional acpi acpi_dmar pci +x86/iommu/intel_idpgtbl.c optional acpi acpi_dmar pci +x86/iommu/intel_qi.c optional acpi acpi_dmar pci +x86/iommu/intel_quirks.c optional acpi acpi_dmar pci +x86/iommu/intel_utils.c optional acpi acpi_dmar pci x86/isa/atpic.c optional atpic isa x86/isa/atrtc.c standard x86/isa/clock.c standard Modified: stable/10/sys/conf/files.i386 ============================================================================== --- stable/10/sys/conf/files.i386 Tue Dec 17 13:39:50 2013 (r259511) +++ stable/10/sys/conf/files.i386 Tue Dec 17 13:49:35 2013 (r259512) @@ -566,6 +566,15 @@ x86/cpufreq/hwpstate.c optional cpufreq x86/cpufreq/p4tcc.c optional cpufreq x86/cpufreq/powernow.c optional cpufreq x86/cpufreq/smist.c optional cpufreq +x86/iommu/busdma_dmar.c optional acpi acpi_dmar pci +x86/iommu/intel_ctx.c optional acpi acpi_dmar pci +x86/iommu/intel_drv.c optional acpi acpi_dmar pci +x86/iommu/intel_fault.c optional acpi acpi_dmar pci +x86/iommu/intel_gas.c optional acpi acpi_dmar pci +x86/iommu/intel_idpgtbl.c optional acpi acpi_dmar pci +x86/iommu/intel_qi.c optional acpi acpi_dmar pci +x86/iommu/intel_quirks.c optional acpi acpi_dmar pci +x86/iommu/intel_utils.c optional acpi acpi_dmar pci x86/isa/atpic.c optional atpic x86/isa/atrtc.c optional native x86/isa/clock.c optional native Modified: stable/10/sys/conf/options ============================================================================== --- stable/10/sys/conf/options Tue Dec 17 13:39:50 2013 (r259511) +++ stable/10/sys/conf/options Tue Dec 17 13:49:35 2013 (r259512) @@ -688,6 +688,7 @@ OPENSOLARIS_WITNESS opt_global.h ACPI_DEBUG opt_acpi.h ACPI_MAX_TASKS opt_acpi.h ACPI_MAX_THREADS opt_acpi.h +ACPI_DMAR opt_acpi.h # ISA support DEV_ISA opt_isa.h Modified: stable/10/sys/dev/acpica/acpi_pci.c ============================================================================== --- stable/10/sys/dev/acpica/acpi_pci.c Tue Dec 17 13:39:50 2013 (r259511) +++ stable/10/sys/dev/acpica/acpi_pci.c Tue Dec 17 13:49:35 2013 (r259512) @@ -29,6 +29,8 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_acpi.h" + #include #include #include @@ -80,6 +82,7 @@ static ACPI_STATUS acpi_pci_save_handle( static int acpi_pci_set_powerstate_method(device_t dev, device_t child, int state); static void acpi_pci_update_device(ACPI_HANDLE handle, device_t pci_child); +static bus_dma_tag_t acpi_pci_get_dma_tag(device_t bus, device_t child); static device_method_t acpi_pci_methods[] = { /* Device interface */ @@ -90,6 +93,7 @@ static device_method_t acpi_pci_methods[ DEVMETHOD(bus_read_ivar, acpi_pci_read_ivar), DEVMETHOD(bus_write_ivar, acpi_pci_write_ivar), DEVMETHOD(bus_child_location_str, acpi_pci_child_location_str_method), + DEVMETHOD(bus_get_dma_tag, acpi_pci_get_dma_tag), /* PCI interface */ DEVMETHOD(pci_set_powerstate, acpi_pci_set_powerstate_method), @@ -308,3 +312,28 @@ acpi_pci_attach(device_t dev) return (bus_generic_attach(dev)); } + +#ifdef ACPI_DMAR +bus_dma_tag_t dmar_get_dma_tag(device_t dev, device_t child); +static bus_dma_tag_t +acpi_pci_get_dma_tag(device_t bus, device_t child) +{ + bus_dma_tag_t tag; + + if (device_get_parent(child) == bus) { + /* try dmar and return if it works */ + tag = dmar_get_dma_tag(bus, child); + } else + tag = NULL; + if (tag == NULL) + tag = pci_get_dma_tag(bus, child); + return (tag); +} +#else +static bus_dma_tag_t +acpi_pci_get_dma_tag(device_t bus, device_t child) +{ + + return (pci_get_dma_tag(bus, child)); +} +#endif Modified: stable/10/sys/i386/conf/NOTES ============================================================================== --- stable/10/sys/i386/conf/NOTES Tue Dec 17 13:39:50 2013 (r259511) +++ stable/10/sys/i386/conf/NOTES Tue Dec 17 13:49:35 2013 (r259512) @@ -491,6 +491,7 @@ device tdfx_linux # Enable Linuxulator device acpi options ACPI_DEBUG +options ACPI_DMAR # ACPI WMI Mapping driver device acpi_wmi Modified: stable/10/sys/x86/include/busdma_impl.h ============================================================================== --- stable/10/sys/x86/include/busdma_impl.h Tue Dec 17 13:39:50 2013 (r259511) +++ stable/10/sys/x86/include/busdma_impl.h Tue Dec 17 13:49:35 2013 (r259512) @@ -82,7 +82,6 @@ struct bus_dma_impl { bus_dmasync_op_t op); }; -void busdma_lock_mutex(void *arg, bus_dma_lock_op_t op); void bus_dma_dflt_lock(void *arg, bus_dma_lock_op_t op); int bus_dma_run_filter(struct bus_dma_tag_common *dmat, bus_addr_t paddr); int common_bus_dma_tag_create(struct bus_dma_tag_common *parent, Modified: stable/10/sys/x86/iommu/busdma_dmar.c ============================================================================== --- head/sys/x86/iommu/busdma_dmar.c Mon Oct 28 13:33:29 2013 (r257251) +++ stable/10/sys/x86/iommu/busdma_dmar.c Tue Dec 17 13:49:35 2013 (r259512) @@ -163,18 +163,15 @@ dmar_bus_dma_tag_create(bus_dma_tag_t pa nsegments, maxsegsz, flags, lockfunc, lockfuncarg, sizeof(struct bus_dma_tag_dmar), (void **)&newtag); if (error != 0) - return (error); + goto out; oldtag = (struct bus_dma_tag_dmar *)parent; newtag->common.impl = &bus_dma_dmar_impl; newtag->ctx = oldtag->ctx; newtag->owner = oldtag->owner; - error = 0; - if (error != 0) - free(newtag, M_DEVBUF); - else - *dmat = (bus_dma_tag_t)newtag; + *dmat = (bus_dma_tag_t)newtag; +out: CTR4(KTR_BUSDMA, "%s returned tag %p tag flags 0x%x error %d", __func__, newtag, (newtag != NULL ? newtag->common.flags : 0), error); @@ -344,6 +341,7 @@ dmar_bus_dmamap_load_something1(struct b segs = tag->segments; ctx = tag->ctx; seg = *segp; + error = 0; idx = 0; while (buflen > 0) { seg++; Modified: stable/10/sys/x86/iommu/intel_ctx.c ============================================================================== --- head/sys/x86/iommu/intel_ctx.c Mon Oct 28 13:33:29 2013 (r257251) +++ stable/10/sys/x86/iommu/intel_ctx.c Tue Dec 17 13:49:35 2013 (r259512) @@ -385,17 +385,29 @@ dmar_get_ctx(struct dmar_unit *dmar, dev * negative TLB entries. */ if ((dmar->hw_cap & DMAR_CAP_CM) != 0 || enable) { - error = dmar_inv_ctx_glob(dmar); - if (error == 0 && - (dmar->hw_ecap & DMAR_ECAP_DI) != 0) - error = dmar_inv_iotlb_glob(dmar); - if (error != 0) { - dmar_free_ctx_locked(dmar, ctx); - TD_PINNED_ASSERT; - return (NULL); + if (dmar->qi_enabled) { + dmar_qi_invalidate_ctx_glob_locked(dmar); + if ((dmar->hw_ecap & DMAR_ECAP_DI) != 0) + dmar_qi_invalidate_iotlb_glob_locked(dmar); + } else { + error = dmar_inv_ctx_glob(dmar); + if (error == 0 && + (dmar->hw_ecap & DMAR_ECAP_DI) != 0) + error = dmar_inv_iotlb_glob(dmar); + if (error != 0) { + dmar_free_ctx_locked(dmar, ctx); + TD_PINNED_ASSERT; + return (NULL); + } } } - if (enable && !rmrr_init) { + + /* + * The dmar lock was potentially dropped between check for the + * empty context list and now. Recheck the state of GCMD_TE + * to avoid unneeded command. + */ + if (enable && !rmrr_init && (dmar->hw_gcmd & DMAR_GCMD_TE) == 0) { error = dmar_enable_translation(dmar); if (error != 0) { dmar_free_ctx_locked(dmar, ctx); @@ -469,8 +481,12 @@ dmar_free_ctx_locked(struct dmar_unit *d dmar_pte_clear(&ctxp->ctx1); ctxp->ctx2 = 0; dmar_inv_ctx_glob(dmar); - if ((dmar->hw_ecap & DMAR_ECAP_DI) != 0) - dmar_inv_iotlb_glob(dmar); + if ((dmar->hw_ecap & DMAR_ECAP_DI) != 0) { + if (dmar->qi_enabled) + dmar_qi_invalidate_iotlb_glob_locked(dmar); + else + dmar_inv_iotlb_glob(dmar); + } LIST_REMOVE(ctx, link); DMAR_UNLOCK(dmar); @@ -512,24 +528,86 @@ dmar_find_ctx_locked(struct dmar_unit *d } void +dmar_ctx_free_entry(struct dmar_map_entry *entry, bool free) +{ + struct dmar_ctx *ctx; + + ctx = entry->ctx; + DMAR_CTX_LOCK(ctx); + if ((entry->flags & DMAR_MAP_ENTRY_RMRR) != 0) + dmar_gas_free_region(ctx, entry); + else + dmar_gas_free_space(ctx, entry); + DMAR_CTX_UNLOCK(ctx); + if (free) + dmar_gas_free_entry(ctx, entry); + else + entry->flags = 0; +} + +void +dmar_ctx_unload_entry(struct dmar_map_entry *entry, bool free) +{ + struct dmar_unit *unit; + + unit = entry->ctx->dmar; + if (unit->qi_enabled) { + DMAR_LOCK(unit); + dmar_qi_invalidate_locked(entry->ctx, entry->start, + entry->end - entry->start, &entry->gseq); + if (!free) + entry->flags |= DMAR_MAP_ENTRY_QI_NF; + TAILQ_INSERT_TAIL(&unit->tlb_flush_entries, entry, dmamap_link); + DMAR_UNLOCK(unit); + } else { + ctx_flush_iotlb_sync(entry->ctx, entry->start, entry->end - + entry->start); + dmar_ctx_free_entry(entry, free); + } +} + +void dmar_ctx_unload(struct dmar_ctx *ctx, struct dmar_map_entries_tailq *entries, bool cansleep) { - struct dmar_map_entry *entry; + struct dmar_unit *unit; + struct dmar_map_entry *entry, *entry1; + struct dmar_qi_genseq gseq; int error; - while ((entry = TAILQ_FIRST(entries)) != NULL) { + unit = ctx->dmar; + + TAILQ_FOREACH_SAFE(entry, entries, dmamap_link, entry1) { KASSERT((entry->flags & DMAR_MAP_ENTRY_MAP) != 0, ("not mapped entry %p %p", ctx, entry)); - TAILQ_REMOVE(entries, entry, dmamap_link); error = ctx_unmap_buf(ctx, entry->start, entry->end - entry->start, cansleep ? DMAR_PGF_WAITOK : 0); KASSERT(error == 0, ("unmap %p error %d", ctx, error)); - DMAR_CTX_LOCK(ctx); - dmar_gas_free_space(ctx, entry); - DMAR_CTX_UNLOCK(ctx); - dmar_gas_free_entry(ctx, entry); + if (!unit->qi_enabled) { + ctx_flush_iotlb_sync(ctx, entry->start, + entry->end - entry->start); + TAILQ_REMOVE(entries, entry, dmamap_link); + dmar_ctx_free_entry(entry, true); + } + } + if (TAILQ_EMPTY(entries)) + return; + + KASSERT(unit->qi_enabled, ("loaded entry left")); + DMAR_LOCK(unit); + TAILQ_FOREACH(entry, entries, dmamap_link) { + entry->gseq.gen = 0; + entry->gseq.seq = 0; + dmar_qi_invalidate_locked(ctx, entry->start, entry->end - + entry->start, TAILQ_NEXT(entry, dmamap_link) == NULL ? + &gseq : NULL); + } + TAILQ_FOREACH_SAFE(entry, entries, dmamap_link, entry1) { + entry->gseq = gseq; + TAILQ_REMOVE(entries, entry, dmamap_link); + TAILQ_INSERT_TAIL(&unit->tlb_flush_entries, entry, dmamap_link); } + DMAR_UNLOCK(unit); } static void Modified: stable/10/sys/x86/iommu/intel_dmar.h ============================================================================== --- head/sys/x86/iommu/intel_dmar.h Mon Oct 28 13:33:29 2013 (r257251) +++ stable/10/sys/x86/iommu/intel_dmar.h Tue Dec 17 13:49:35 2013 (r259512) @@ -37,6 +37,11 @@ typedef uint64_t dmar_haddr_t; /* Guest or bus address, before translation. */ typedef uint64_t dmar_gaddr_t; +struct dmar_qi_genseq { + u_int gen; + uint32_t seq; +}; + struct dmar_map_entry { dmar_gaddr_t start; dmar_gaddr_t end; @@ -48,6 +53,8 @@ struct dmar_map_entry { RB_ENTRY(dmar_map_entry) rb_entry; /* Links for ctx entries */ TAILQ_ENTRY(dmar_map_entry) unroll_link; /* Link for unroll after dmamap_load failure */ + struct dmar_ctx *ctx; + struct dmar_qi_genseq gseq; }; RB_HEAD(dmar_gas_entries_tree, dmar_map_entry); @@ -60,6 +67,7 @@ RB_PROTOTYPE(dmar_gas_entries_tree, dmar #define DMAR_MAP_ENTRY_MAP 0x0004 /* Busdma created, linked by dmamap_link */ #define DMAR_MAP_ENTRY_UNMAPPED 0x0010 /* No backing pages */ +#define DMAR_MAP_ENTRY_QI_NF 0x0020 /* qi task, do not free entry */ #define DMAR_MAP_ENTRY_READ 0x1000 /* Read permitted */ #define DMAR_MAP_ENTRY_WRITE 0x2000 /* Write permitted */ #define DMAR_MAP_ENTRY_SNOOP 0x4000 /* Snoop */ @@ -113,6 +121,24 @@ struct dmar_ctx { #define DMAR_CTX_UNLOCK(ctx) mtx_unlock(&(ctx)->lock) #define DMAR_CTX_ASSERT_LOCKED(ctx) mtx_assert(&(ctx)->lock, MA_OWNED) +struct dmar_msi_data { + int irq; + int irq_rid; + struct resource *irq_res; + void *intr_handle; + int (*handler)(void *); + int msi_data_reg; + int msi_addr_reg; + int msi_uaddr_reg; + void (*enable_intr)(struct dmar_unit *); + void (*disable_intr)(struct dmar_unit *); + const char *name; +}; + +#define DMAR_INTR_FAULT 0 +#define DMAR_INTR_QI 1 +#define DMAR_INTR_TOTAL 2 + struct dmar_unit { device_t dev; int unit; @@ -122,10 +148,8 @@ struct dmar_unit { /* Resources */ int reg_rid; struct resource *regs; - int irq; - int irq_rid; - struct resource *irq_res; - void *intr_handle; + + struct dmar_msi_data intrs[DMAR_INTR_TOTAL]; /* Hardware registers cache */ uint32_t hw_ver; @@ -149,6 +173,25 @@ struct dmar_unit { struct task fault_task; struct taskqueue *fault_taskqueue; + /* QI */ + int qi_enabled; + vm_offset_t inv_queue; + vm_size_t inv_queue_size; + uint32_t inv_queue_avail; + uint32_t inv_queue_tail; + volatile uint32_t inv_waitd_seq_hw; /* hw writes there on wait + descr completion */ + uint64_t inv_waitd_seq_hw_phys; + uint32_t inv_waitd_seq; /* next sequence number to use for wait descr */ + u_int inv_waitd_gen; /* seq number generation AKA seq overflows */ + u_int inv_seq_waiters; /* count of waiters for seq */ + u_int inv_queue_full; /* informational counter */ + + /* Delayed freeing of map entries queue processing */ + struct dmar_map_entries_tailq tlb_flush_entries; + struct task qi_task; + struct taskqueue *qi_taskqueue; + /* Busdma delayed map load */ struct task dmamap_load_task; TAILQ_HEAD(, bus_dmamap_dmar) delayed_maps; @@ -164,6 +207,7 @@ struct dmar_unit { #define DMAR_FAULT_ASSERT_LOCKED(dmar) mtx_assert(&(dmar)->fault_lock, MA_OWNED) #define DMAR_IS_COHERENT(dmar) (((dmar)->hw_ecap & DMAR_ECAP_C) != 0) +#define DMAR_HAS_QI(dmar) (((dmar)->hw_ecap & DMAR_ECAP_QI) != 0) /* Barrier ids */ #define DMAR_BARRIER_RMRR 0 @@ -180,6 +224,8 @@ vm_pindex_t pglvl_max_pages(int pglvl); int ctx_is_sp_lvl(struct dmar_ctx *ctx, int lvl); dmar_gaddr_t pglvl_page_size(int total_pglvl, int lvl); dmar_gaddr_t ctx_page_size(struct dmar_ctx *ctx, int lvl); +int calc_am(struct dmar_unit *unit, dmar_gaddr_t base, dmar_gaddr_t size, + dmar_gaddr_t *isizep); struct vm_page *dmar_pgalloc(vm_object_t obj, vm_pindex_t idx, int flags); void dmar_pgfree(vm_object_t obj, vm_pindex_t idx, int flags); void *dmar_map_pgtbl(vm_object_t obj, vm_pindex_t idx, int flags, @@ -191,21 +237,33 @@ int dmar_inv_iotlb_glob(struct dmar_unit int dmar_flush_write_bufs(struct dmar_unit *unit); int dmar_enable_translation(struct dmar_unit *unit); int dmar_disable_translation(struct dmar_unit *unit); -void dmar_enable_intr(struct dmar_unit *unit); -void dmar_disable_intr(struct dmar_unit *unit); bool dmar_barrier_enter(struct dmar_unit *dmar, u_int barrier_id); void dmar_barrier_exit(struct dmar_unit *dmar, u_int barrier_id); -int dmar_intr(void *arg); +int dmar_fault_intr(void *arg); +void dmar_enable_fault_intr(struct dmar_unit *unit); +void dmar_disable_fault_intr(struct dmar_unit *unit); int dmar_init_fault_log(struct dmar_unit *unit); void dmar_fini_fault_log(struct dmar_unit *unit); +int dmar_qi_intr(void *arg); +void dmar_enable_qi_intr(struct dmar_unit *unit); +void dmar_disable_qi_intr(struct dmar_unit *unit); +int dmar_init_qi(struct dmar_unit *unit); +void dmar_fini_qi(struct dmar_unit *unit); +void dmar_qi_invalidate_locked(struct dmar_ctx *ctx, dmar_gaddr_t start, + dmar_gaddr_t size, struct dmar_qi_genseq *pseq); +void dmar_qi_invalidate_ctx_glob_locked(struct dmar_unit *unit); +void dmar_qi_invalidate_iotlb_glob_locked(struct dmar_unit *unit); + vm_object_t ctx_get_idmap_pgtbl(struct dmar_ctx *ctx, dmar_gaddr_t maxaddr); void put_idmap_pgtbl(vm_object_t obj); int ctx_map_buf(struct dmar_ctx *ctx, dmar_gaddr_t base, dmar_gaddr_t size, vm_page_t *ma, uint64_t pflags, int flags); int ctx_unmap_buf(struct dmar_ctx *ctx, dmar_gaddr_t base, dmar_gaddr_t size, int flags); +void ctx_flush_iotlb_sync(struct dmar_ctx *ctx, dmar_gaddr_t base, + dmar_gaddr_t size); int ctx_alloc_pgtbl(struct dmar_ctx *ctx); void ctx_free_pgtbl(struct dmar_ctx *ctx); @@ -217,8 +275,10 @@ void dmar_free_ctx_locked(struct dmar_un void dmar_free_ctx(struct dmar_ctx *ctx); struct dmar_ctx *dmar_find_ctx_locked(struct dmar_unit *dmar, int bus, int slot, int func); +void dmar_ctx_unload_entry(struct dmar_map_entry *entry, bool free); void dmar_ctx_unload(struct dmar_ctx *ctx, struct dmar_map_entries_tailq *entries, bool cansleep); +void dmar_ctx_free_entry(struct dmar_map_entry *entry, bool free); int dmar_init_busdma(struct dmar_unit *unit); void dmar_fini_busdma(struct dmar_unit *unit); @@ -231,6 +291,7 @@ void dmar_gas_free_space(struct dmar_ctx int dmar_gas_map(struct dmar_ctx *ctx, const struct bus_dma_tag_common *common, dmar_gaddr_t size, u_int eflags, u_int flags, vm_page_t *ma, struct dmar_map_entry **res); +void dmar_gas_free_region(struct dmar_ctx *ctx, struct dmar_map_entry *entry); int dmar_gas_map_region(struct dmar_ctx *ctx, struct dmar_map_entry *entry, u_int eflags, u_int flags, vm_page_t *ma); int dmar_gas_reserve_region(struct dmar_ctx *ctx, dmar_gaddr_t start, Modified: stable/10/sys/x86/iommu/intel_drv.c ============================================================================== --- head/sys/x86/iommu/intel_drv.c Mon Oct 28 13:33:29 2013 (r257251) +++ stable/10/sys/x86/iommu/intel_drv.c Tue Dec 17 13:49:35 2013 (r259512) @@ -71,8 +71,9 @@ __FBSDID("$FreeBSD$"); #include "pcib_if.h" #endif -#define DMAR_REG_RID 1 -#define DMAR_IRQ_RID 0 +#define DMAR_FAULT_IRQ_RID 0 +#define DMAR_QI_IRQ_RID 1 +#define DMAR_REG_RID 2 static devclass_t dmar_devclass; static device_t *dmar_devs; @@ -217,24 +218,35 @@ dmar_probe(device_t dev) if (acpi_get_handle(dev) != NULL) return (ENXIO); device_set_desc(dev, "DMA remap"); - return (0); + return (BUS_PROBE_NOWILDCARD); +} + +static void +dmar_release_intr(device_t dev, struct dmar_unit *unit, int idx) +{ + struct dmar_msi_data *dmd; + + dmd = &unit->intrs[idx]; + if (dmd->irq == -1) + return; + bus_teardown_intr(dev, dmd->irq_res, dmd->intr_handle); + bus_release_resource(dev, SYS_RES_IRQ, dmd->irq_rid, dmd->irq_res); + bus_delete_resource(dev, SYS_RES_IRQ, dmd->irq_rid); + PCIB_RELEASE_MSIX(device_get_parent(device_get_parent(dev)), + dev, dmd->irq); + dmd->irq = -1; } static void dmar_release_resources(device_t dev, struct dmar_unit *unit) { + int i; dmar_fini_busdma(unit); + dmar_fini_qi(unit); dmar_fini_fault_log(unit); - if (unit->irq != -1) { - bus_teardown_intr(dev, unit->irq_res, unit->intr_handle); - bus_release_resource(dev, SYS_RES_IRQ, unit->irq_rid, - unit->irq_res); - bus_delete_resource(dev, SYS_RES_IRQ, unit->irq_rid); - PCIB_RELEASE_MSIX(device_get_parent(device_get_parent(dev)), - dev, unit->irq); - unit->irq = -1; - } + for (i = 0; i < DMAR_INTR_TOTAL; i++) + dmar_release_intr(dev, unit, i); if (unit->regs != NULL) { bus_deactivate_resource(dev, SYS_RES_MEMORY, unit->reg_rid, unit->regs); @@ -253,62 +265,66 @@ dmar_release_resources(device_t dev, str } static int -dmar_alloc_irq(device_t dev, struct dmar_unit *unit) +dmar_alloc_irq(device_t dev, struct dmar_unit *unit, int idx) { device_t pcib; + struct dmar_msi_data *dmd; uint64_t msi_addr; uint32_t msi_data; int error; + dmd = &unit->intrs[idx]; pcib = device_get_parent(device_get_parent(dev)); /* Really not pcib */ - error = PCIB_ALLOC_MSIX(pcib, dev, &unit->irq); + error = PCIB_ALLOC_MSIX(pcib, dev, &dmd->irq); if (error != 0) { - device_printf(dev, "cannot allocate fault interrupt, %d\n", - error); + device_printf(dev, "cannot allocate %s interrupt, %d\n", + dmd->name, error); goto err1; } - unit->irq_rid = DMAR_IRQ_RID; - error = bus_set_resource(dev, SYS_RES_IRQ, unit->irq_rid, unit->irq, - 1); + error = bus_set_resource(dev, SYS_RES_IRQ, dmd->irq_rid, + dmd->irq, 1); if (error != 0) { - device_printf(dev, "cannot set interrupt resource, %d\n", - error); + device_printf(dev, "cannot set %s interrupt resource, %d\n", + dmd->name, error); goto err2; } - unit->irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, - &unit->irq_rid, RF_ACTIVE); - if (unit->irq_res == NULL) { - device_printf(dev, "cannot map fault interrupt\n"); + dmd->irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, + &dmd->irq_rid, RF_ACTIVE); + if (dmd->irq_res == NULL) { + device_printf(dev, + "cannot allocate resource for %s interrupt\n", dmd->name); error = ENXIO; goto err3; } - error = bus_setup_intr(dev, unit->irq_res, INTR_TYPE_MISC, - dmar_intr, NULL, unit, &unit->intr_handle); + error = bus_setup_intr(dev, dmd->irq_res, INTR_TYPE_MISC, + dmd->handler, NULL, unit, &dmd->intr_handle); if (error != 0) { - device_printf(dev, "cannot setup fault interrupt, %d\n", error); + device_printf(dev, "cannot setup %s interrupt, %d\n", + dmd->name, error); goto err4; } - bus_describe_intr(dev, unit->irq_res, unit->intr_handle, "fault"); - error = PCIB_MAP_MSI(pcib, dev, unit->irq, &msi_addr, &msi_data); + bus_describe_intr(dev, dmd->irq_res, dmd->intr_handle, dmd->name); + error = PCIB_MAP_MSI(pcib, dev, dmd->irq, &msi_addr, &msi_data); if (error != 0) { - device_printf(dev, "cannot map interrupt, %d\n", error); + device_printf(dev, "cannot map %s interrupt, %d\n", + dmd->name, error); goto err5; } - dmar_write4(unit, DMAR_FEDATA_REG, msi_data); - dmar_write4(unit, DMAR_FEADDR_REG, msi_addr); + dmar_write4(unit, dmd->msi_data_reg, msi_data); + dmar_write4(unit, dmd->msi_addr_reg, msi_addr); /* Only for xAPIC mode */ - dmar_write4(unit, DMAR_FEUADDR_REG, msi_addr >> 32); + dmar_write4(unit, dmd->msi_uaddr_reg, msi_addr >> 32); return (0); err5: - bus_teardown_intr(dev, unit->irq_res, unit->intr_handle); + bus_teardown_intr(dev, dmd->irq_res, dmd->intr_handle); err4: - bus_release_resource(dev, SYS_RES_IRQ, unit->irq_rid, unit->irq_res); + bus_release_resource(dev, SYS_RES_IRQ, dmd->irq_rid, dmd->irq_res); err3: - bus_delete_resource(dev, SYS_RES_IRQ, unit->irq_rid); + bus_delete_resource(dev, SYS_RES_IRQ, dmd->irq_rid); err2: - PCIB_RELEASE_MSIX(pcib, dev, unit->irq); - unit->irq = -1; + PCIB_RELEASE_MSIX(pcib, dev, dmd->irq); + dmd->irq = -1; err1: return (error); } @@ -318,23 +334,31 @@ static int dmar_remap_intr(device_t dev, device_t child, u_int irq) { struct dmar_unit *unit; + struct dmar_msi_data *dmd; uint64_t msi_addr; uint32_t msi_data; - int error; + int i, error; unit = device_get_softc(dev); - if (irq != unit->irq) - return (ENOENT); - error = PCIB_MAP_MSI(device_get_parent(device_get_parent(dev)), dev, - irq, &msi_addr, &msi_data); - if (error != 0) - return (error); - dmar_disable_intr(unit); - dmar_write4(unit, DMAR_FEDATA_REG, msi_data); - dmar_write4(unit, DMAR_FEADDR_REG, msi_addr); - dmar_write4(unit, DMAR_FEUADDR_REG, msi_addr >> 32); - dmar_enable_intr(unit); - return (0); + for (i = 0; i < DMAR_INTR_TOTAL; i++) { + dmd = &unit->intrs[i]; + if (irq == dmd->irq) { + error = PCIB_MAP_MSI(device_get_parent( + device_get_parent(dev)), + dev, irq, &msi_addr, &msi_data); + if (error != 0) + return (error); + DMAR_LOCK(unit); + (dmd->disable_intr)(unit); + dmar_write4(unit, dmd->msi_data_reg, msi_data); + dmar_write4(unit, dmd->msi_addr_reg, msi_addr); + dmar_write4(unit, dmd->msi_uaddr_reg, msi_addr >> 32); + (dmd->enable_intr)(unit); + DMAR_UNLOCK(unit); + return (0); + } + } + return (ENOENT); } #endif @@ -372,7 +396,7 @@ dmar_attach(device_t dev) { struct dmar_unit *unit; ACPI_DMAR_HARDWARE_UNIT *dmaru; - int error; + int i, error; unit = device_get_softc(dev); unit->dev = dev; @@ -380,7 +404,6 @@ dmar_attach(device_t dev) dmaru = dmar_find_by_index(unit->unit); if (dmaru == NULL) return (EINVAL); - unit->irq = -1; unit->segment = dmaru->Segment; unit->base = dmaru->Address; unit->reg_rid = DMAR_REG_RID; @@ -397,11 +420,38 @@ dmar_attach(device_t dev) dmar_print_caps(dev, unit, dmaru); dmar_quirks_post_ident(unit); - error = dmar_alloc_irq(dev, unit); + for (i = 0; i < DMAR_INTR_TOTAL; i++) + unit->intrs[i].irq = -1; + + unit->intrs[DMAR_INTR_FAULT].name = "fault"; + unit->intrs[DMAR_INTR_FAULT].irq_rid = DMAR_FAULT_IRQ_RID; + unit->intrs[DMAR_INTR_FAULT].handler = dmar_fault_intr; + unit->intrs[DMAR_INTR_FAULT].msi_data_reg = DMAR_FEDATA_REG; + unit->intrs[DMAR_INTR_FAULT].msi_addr_reg = DMAR_FEADDR_REG; + unit->intrs[DMAR_INTR_FAULT].msi_uaddr_reg = DMAR_FEUADDR_REG; + unit->intrs[DMAR_INTR_FAULT].enable_intr = dmar_enable_fault_intr; + unit->intrs[DMAR_INTR_FAULT].disable_intr = dmar_disable_fault_intr; + error = dmar_alloc_irq(dev, unit, DMAR_INTR_FAULT); if (error != 0) { dmar_release_resources(dev, unit); return (error); } + if (DMAR_HAS_QI(unit)) { + unit->intrs[DMAR_INTR_QI].name = "qi"; + unit->intrs[DMAR_INTR_QI].irq_rid = DMAR_QI_IRQ_RID; + unit->intrs[DMAR_INTR_QI].handler = dmar_qi_intr; + unit->intrs[DMAR_INTR_QI].msi_data_reg = DMAR_IEDATA_REG; + unit->intrs[DMAR_INTR_QI].msi_addr_reg = DMAR_IEADDR_REG; + unit->intrs[DMAR_INTR_QI].msi_uaddr_reg = DMAR_IEUADDR_REG; + unit->intrs[DMAR_INTR_QI].enable_intr = dmar_enable_qi_intr; + unit->intrs[DMAR_INTR_QI].disable_intr = dmar_disable_qi_intr; + error = dmar_alloc_irq(dev, unit, DMAR_INTR_QI); + if (error != 0) { + dmar_release_resources(dev, unit); + return (error); + } + } + mtx_init(&unit->lock, "dmarhw", NULL, MTX_DEF); unit->domids = new_unrhdr(0, dmar_nd2mask(DMAR_CAP_ND(unit->hw_cap)), &unit->lock); @@ -453,6 +503,11 @@ dmar_attach(device_t dev) dmar_release_resources(dev, unit); return (error); } + error = dmar_init_qi(unit); + if (error != 0) { + dmar_release_resources(dev, unit); + return (error); + } error = dmar_init_busdma(unit); if (error != 0) { dmar_release_resources(dev, unit); @@ -845,12 +900,12 @@ dmar_inst_rmrr_iter(ACPI_DMAR_HEADER *dm (uintmax_t)resmem->EndAddress); } - ptr = (char *)resmem + sizeof(*resmem); - ptrend = (char *)resmem + resmem->Header.Length; + ptr = (const char *)resmem + sizeof(*resmem); + ptrend = (const char *)resmem + resmem->Header.Length; for (;;) { if (ptr >= ptrend) break; - devscope = (ACPI_DMAR_DEVICE_SCOPE *)ptr; + devscope = (const ACPI_DMAR_DEVICE_SCOPE *)ptr; ptr += devscope->Length; /* XXXKIB bridge */ if (devscope->EntryType != ACPI_DMAR_SCOPE_TYPE_ENDPOINT) @@ -859,11 +914,11 @@ dmar_inst_rmrr_iter(ACPI_DMAR_HEADER *dm dmar_print_path(iria->dmar->dev, "RMRR scope", devscope->Bus, (devscope->Length - sizeof(ACPI_DMAR_DEVICE_SCOPE)) / 2, - (ACPI_DMAR_PCI_PATH *)(devscope + 1)); + (const ACPI_DMAR_PCI_PATH *)(devscope + 1)); } dev = dmar_path_dev(resmem->Segment, (devscope->Length - sizeof(ACPI_DMAR_DEVICE_SCOPE)) / 2, devscope->Bus, - (ACPI_DMAR_PCI_PATH *)(devscope + 1)); + (const ACPI_DMAR_PCI_PATH *)(devscope + 1)); if (dev == NULL) { if (dmar_match_verbose) printf("null dev\n"); @@ -994,6 +1049,8 @@ DB_FUNC(dmar_ctx, db_dmar_print_ctx, db_ } show_mappings = strchr(db_tok_string, 'm') != NULL; t = db_read_token(); + } else { + show_mappings = false; } if (t == tNUMBER) { domain = db_tok_number; @@ -1058,6 +1115,33 @@ dmar_print_one(int idx, bool show_ctxs, (uintmax_t)dmar_read8(unit, frir), (uintmax_t)dmar_read8(unit, frir + 8)); } + if (DMAR_HAS_QI(unit)) { + db_printf("ied 0x%x iea 0x%x ieua 0x%x\n", + dmar_read4(unit, DMAR_IEDATA_REG), + dmar_read4(unit, DMAR_IEADDR_REG), + dmar_read4(unit, DMAR_IEUADDR_REG)); + if (unit->qi_enabled) { + db_printf("qi is enabled: queue @0x%jx (IQA 0x%jx) " + "size 0x%jx\n" + " head 0x%x tail 0x%x avail 0x%x status 0x%x ctrl 0x%x\n" + " hw compl 0x%x@%p/phys@%jx next seq 0x%x gen 0x%x\n", + (uintmax_t)unit->inv_queue, + (uintmax_t)dmar_read8(unit, DMAR_IQA_REG), + (uintmax_t)unit->inv_queue_size, + dmar_read4(unit, DMAR_IQH_REG), + dmar_read4(unit, DMAR_IQT_REG), + unit->inv_queue_avail, + dmar_read4(unit, DMAR_ICS_REG), + dmar_read4(unit, DMAR_IECTL_REG), + unit->inv_waitd_seq_hw, + &unit->inv_waitd_seq_hw, + (uintmax_t)unit->inv_waitd_seq_hw_phys, + unit->inv_waitd_seq, + unit->inv_waitd_gen); + } else { + db_printf("qi is disabled\n"); + } + } if (show_ctxs) { db_printf("contexts:\n"); LIST_FOREACH(ctx, &unit->contexts, link) { Modified: stable/10/sys/x86/iommu/intel_fault.c ============================================================================== --- head/sys/x86/iommu/intel_fault.c Mon Oct 28 13:33:29 2013 (r257251) +++ stable/10/sys/x86/iommu/intel_fault.c Tue Dec 17 13:49:35 2013 (r259512) @@ -85,7 +85,7 @@ dmar_fault_next(struct dmar_unit *unit, } static void -dmar_intr_clear(struct dmar_unit *unit, uint32_t fsts) +dmar_fault_intr_clear(struct dmar_unit *unit, uint32_t fsts) { uint32_t clear; @@ -117,7 +117,7 @@ dmar_intr_clear(struct dmar_unit *unit, } int -dmar_intr(void *arg) +dmar_fault_intr(void *arg) { struct dmar_unit *unit; uint64_t fault_rec[2]; @@ -128,7 +128,7 @@ dmar_intr(void *arg) unit = arg; enqueue = false; fsts = dmar_read4(unit, DMAR_FSTS_REG); - dmar_intr_clear(unit, fsts); + dmar_fault_intr_clear(unit, fsts); if ((fsts & DMAR_FSTS_PPF) == 0) goto done; @@ -215,7 +215,7 @@ dmar_fault_task(void *arg, int pending _ ctx->flags |= DMAR_CTX_FAULTED; ctx->last_fault_rec[0] = fault_rec[0]; ctx->last_fault_rec[1] = fault_rec[1]; - device_printf(ctx->ctx_tag.owner, ""); + device_print_prettyname(ctx->ctx_tag.owner); } DMAR_UNLOCK(unit); printf( @@ -263,9 +263,11 @@ dmar_init_fault_log(struct dmar_unit *un taskqueue_start_threads(&unit->fault_taskqueue, 1, PI_AV, "dmar%d fault taskq", unit->unit); - dmar_disable_intr(unit); + DMAR_LOCK(unit); + dmar_disable_fault_intr(unit); dmar_clear_faults(unit); - dmar_enable_intr(unit); + dmar_enable_fault_intr(unit); + DMAR_UNLOCK(unit); return (0); } @@ -274,16 +276,40 @@ void dmar_fini_fault_log(struct dmar_unit *unit) { - dmar_disable_intr(unit); + DMAR_LOCK(unit); + dmar_disable_fault_intr(unit); + DMAR_UNLOCK(unit); if (unit->fault_taskqueue == NULL) return; taskqueue_drain(unit->fault_taskqueue, &unit->fault_task); taskqueue_free(unit->fault_taskqueue); + unit->fault_taskqueue = NULL; mtx_destroy(&unit->fault_lock); free(unit->fault_log, M_DEVBUF); unit->fault_log = NULL; unit->fault_log_head = unit->fault_log_tail = 0; } + +void +dmar_enable_fault_intr(struct dmar_unit *unit) +{ + uint32_t fectl; + + DMAR_ASSERT_LOCKED(unit); + fectl = dmar_read4(unit, DMAR_FECTL_REG); + fectl &= ~DMAR_FECTL_IM; + dmar_write4(unit, DMAR_FECTL_REG, fectl); +} + +void +dmar_disable_fault_intr(struct dmar_unit *unit) +{ + uint32_t fectl; + + DMAR_ASSERT_LOCKED(unit); + fectl = dmar_read4(unit, DMAR_FECTL_REG); + dmar_write4(unit, DMAR_FECTL_REG, fectl | DMAR_FECTL_IM); +} Modified: stable/10/sys/x86/iommu/intel_gas.c ============================================================================== --- head/sys/x86/iommu/intel_gas.c Mon Oct 28 13:33:29 2013 (r257251) +++ stable/10/sys/x86/iommu/intel_gas.c Tue Dec 17 13:49:35 2013 (r259512) @@ -92,8 +92,10 @@ dmar_gas_alloc_entry(struct dmar_ctx *ct res = uma_zalloc(dmar_map_entry_zone, ((flags & DMAR_PGF_WAITOK) != 0 ? M_WAITOK : M_NOWAIT) | M_ZERO); - if (res != NULL) + if (res != NULL) { + res->ctx = ctx; atomic_add_int(&ctx->entries_cnt, 1); + } return (res); } @@ -101,6 +103,9 @@ void dmar_gas_free_entry(struct dmar_ctx *ctx, struct dmar_map_entry *entry) { + KASSERT(ctx == entry->ctx, + ("mismatched free ctx %p entry %p entry->ctx %p", ctx, + entry, entry->ctx)); atomic_subtract_int(&ctx->entries_cnt, 1); uma_zfree(dmar_map_entry_zone, entry); } @@ -170,6 +175,9 @@ dmar_gas_check_free(struct dmar_ctx *ctx dmar_gaddr_t v; RB_FOREACH(entry, dmar_gas_entries_tree, &ctx->rb_root) { + KASSERT(ctx == entry->ctx, + ("mismatched free ctx %p entry %p entry->ctx %p", ctx, + entry, entry->ctx)); next = RB_NEXT(dmar_gas_entries_tree, &ctx->rb_root, entry); if (next == NULL) { MPASS(entry->free_after == ctx->end - entry->end); @@ -583,7 +591,7 @@ dmar_gas_free_space(struct dmar_ctx *ctx #endif } -static void +void dmar_gas_free_region(struct dmar_ctx *ctx, struct dmar_map_entry *entry) { struct dmar_map_entry *next, *prev; @@ -644,10 +652,7 @@ dmar_gas_map(struct dmar_ctx *ctx, const ((eflags & DMAR_MAP_ENTRY_TM) != 0 ? DMAR_PTE_TM : 0), (flags & DMAR_GM_CANWAIT) != 0 ? DMAR_PGF_WAITOK : 0); if (error == ENOMEM) { - DMAR_CTX_LOCK(ctx); - dmar_gas_free_space(ctx, entry); - DMAR_CTX_UNLOCK(ctx); - dmar_gas_free_entry(ctx, entry); + dmar_ctx_unload_entry(entry, true); return (error); } KASSERT(error == 0, @@ -689,10 +694,7 @@ dmar_gas_map_region(struct dmar_ctx *ctx ((eflags & DMAR_MAP_ENTRY_TM) != 0 ? DMAR_PTE_TM : 0), (flags & DMAR_GM_CANWAIT) != 0 ? DMAR_PGF_WAITOK : 0); if (error == ENOMEM) { - DMAR_CTX_LOCK(ctx); - dmar_gas_free_region(ctx, entry); - DMAR_CTX_UNLOCK(ctx); - entry->flags = 0; + dmar_ctx_unload_entry(entry, false); return (error); } KASSERT(error == 0, Modified: stable/10/sys/x86/iommu/intel_idpgtbl.c ============================================================================== --- head/sys/x86/iommu/intel_idpgtbl.c Mon Oct 28 13:33:29 2013 (r257251) +++ stable/10/sys/x86/iommu/intel_idpgtbl.c Tue Dec 17 13:49:35 2013 (r259512) @@ -67,8 +67,6 @@ __FBSDID("$FreeBSD$"); static int ctx_unmap_buf_locked(struct dmar_ctx *ctx, dmar_gaddr_t base, dmar_gaddr_t size, int flags); -static void ctx_flush_iotlb(struct dmar_ctx *ctx, dmar_gaddr_t base, - dmar_gaddr_t size, int flags); /* * The cache of the identity mapping page tables for the DMARs. Using @@ -169,6 +167,8 @@ ctx_get_idmap_pgtbl(struct dmar_ctx *ctx vm_page_t m; int leaf, i; + leaf = 0; /* silence gcc */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-10@FreeBSD.ORG Wed Dec 18 01:14:27 2013 Return-Path: Delivered-To: svn-src-stable-10@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 ESMTPS id 12CB5BE1; Wed, 18 Dec 2013 01:14:27 +0000 (UTC) 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 E7628107A; Wed, 18 Dec 2013 01:14:26 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBI1EQ4s039434; Wed, 18 Dec 2013 01:14:26 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBI1EQiY039431; Wed, 18 Dec 2013 01:14:26 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201312180114.rBI1EQiY039431@svn.freebsd.org> From: Glen Barber Date: Wed, 18 Dec 2013 01:14:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259533 - in stable/10: release release/scripts usr.sbin/bsdconfig/share/packages X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Dec 2013 01:14:27 -0000 Author: gjb Date: Wed Dec 18 01:14:25 2013 New Revision: 259533 URL: http://svnweb.freebsd.org/changeset/base/259533 Log: MFC r259426, r259427: r259426: Add a pkg(8) repository configuration file for cdrom-based package installation. As part of the 'pkg-stage' target, copy the configuration file to the 'packages/repos/' directory on the DVD filesystem. r259427: Export 'REPOS_DIR' when the selected source medium for package installation is cdrom. This enables bsdconfig(8) to make use of the on-disc pkg(8) repository configuration, which fixes package selection and installation from the dvd installer. Sponsored by: The FreeBSD Foundation Added: stable/10/release/scripts/FreeBSD_install_cdrom.conf - copied unchanged from r259426, head/release/scripts/FreeBSD_install_cdrom.conf Modified: stable/10/release/Makefile stable/10/usr.sbin/bsdconfig/share/packages/index.subr Directory Properties: stable/10/ (props changed) Modified: stable/10/release/Makefile ============================================================================== --- stable/10/release/Makefile Wed Dec 18 00:14:58 2013 (r259532) +++ stable/10/release/Makefile Wed Dec 18 01:14:25 2013 (r259533) @@ -225,7 +225,11 @@ pkg-stage: .if !defined(NOPKG) && exists(${.CURDIR}/${TARGET}/pkg-stage.conf) sh ${.CURDIR}/scripts/pkg-stage.sh ${.CURDIR}/${TARGET}/pkg-stage.conf \ ${REVISION} + mkdir -p ${.OBJDIR}/dvd/packages/repos/ + cp ${.CURDIR}/scripts/FreeBSD_install_cdrom.conf \ + ${.OBJDIR}/dvd/packages/repos/ .endif + touch ${.TARGET} cdrom: disc1.iso bootonly.iso dvdrom: dvd1.iso Copied: stable/10/release/scripts/FreeBSD_install_cdrom.conf (from r259426, head/release/scripts/FreeBSD_install_cdrom.conf) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/release/scripts/FreeBSD_install_cdrom.conf Wed Dec 18 01:14:25 2013 (r259533, copy of r259426, head/release/scripts/FreeBSD_install_cdrom.conf) @@ -0,0 +1,12 @@ +# +# $FreeBSD$ +# +# The pkg(8) repository configuration file for the installation DVD. +# + +FreeBSD_install_cdrom: { + url: "file:///dist/packages/${ABI}", + mirror_type: "none", + enabled: yes +} + Modified: stable/10/usr.sbin/bsdconfig/share/packages/index.subr ============================================================================== --- stable/10/usr.sbin/bsdconfig/share/packages/index.subr Wed Dec 18 00:14:58 2013 (r259532) +++ stable/10/usr.sbin/bsdconfig/share/packages/index.subr Wed Dec 18 01:14:25 2013 (r259533) @@ -119,6 +119,9 @@ f_index_initialize() $DEVICE_TYPE_HTTP_PROXY) f_getvar $VAR_HTTP_PROXY_PATH __site __site="$__site/packages/$PKG_ABI" ;; + $DEVICE_TYPE_CDROM) + __site="file://$MOUNTPOINT/packages/$PKG_ABI" + export REPOS_DIR="$MOUNTPOINT/packages/repos" ;; *) # UFS, DISK, CDROM, USB, DOS, NFS, etc. __site="file://$MOUNTPOINT/packages/$PKG_ABI" esac From owner-svn-src-stable-10@FreeBSD.ORG Wed Dec 18 03:51:05 2013 Return-Path: Delivered-To: svn-src-stable-10@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 ESMTPS id 7C4F1266; Wed, 18 Dec 2013 03:51:05 +0000 (UTC) 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 68EEC1E67; Wed, 18 Dec 2013 03:51:05 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBI3p5Qh097399; Wed, 18 Dec 2013 03:51:05 GMT (envelope-from grehan@svn.freebsd.org) Received: (from grehan@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBI3p5Eb097397; Wed, 18 Dec 2013 03:51:05 GMT (envelope-from grehan@svn.freebsd.org) Message-Id: <201312180351.rBI3p5Eb097397@svn.freebsd.org> From: Peter Grehan Date: Wed, 18 Dec 2013 03:51:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259536 - stable/10/usr.sbin/bhyve X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Dec 2013 03:51:05 -0000 Author: grehan Date: Wed Dec 18 03:51:04 2013 New Revision: 259536 URL: http://svnweb.freebsd.org/changeset/base/259536 Log: MFC r259302,r259413 r259302 bhyve(8) man page r259413 mdoc: sort SEE ALSO Added: stable/10/usr.sbin/bhyve/bhyve.8 - copied, changed from r259302, head/usr.sbin/bhyve/bhyve.8 Modified: stable/10/usr.sbin/bhyve/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/bhyve/Makefile ============================================================================== --- stable/10/usr.sbin/bhyve/Makefile Wed Dec 18 01:41:52 2013 (r259535) +++ stable/10/usr.sbin/bhyve/Makefile Wed Dec 18 03:51:04 2013 (r259536) @@ -6,6 +6,7 @@ PROG= bhyve DEBUG_FLAGS= -g -O0 +MAN= bhyve.8 SRCS= acpi.c atpic.c bhyverun.c block_if.c consport.c dbgport.c elcr.c SRCS+= inout.c ioapic.c legacy_irq.c mem.c mevent.c mptbl.c pci_ahci.c SRCS+= pci_emul.c pci_hostbridge.c pci_lpc.c pci_passthru.c pci_virtio_block.c @@ -15,8 +16,6 @@ SRCS+= uart_emul.c virtio.c xmsr.c spinu .PATH: ${.CURDIR}/../../sys/amd64/vmm SRCS+= vmm_instruction_emul.c -NO_MAN= - DPADD= ${LIBVMMAPI} ${LIBMD} ${LIBUTIL} ${LIBPTHREAD} LDADD= -lvmmapi -lmd -lutil -lpthread Copied and modified: stable/10/usr.sbin/bhyve/bhyve.8 (from r259302, head/usr.sbin/bhyve/bhyve.8) ============================================================================== --- head/usr.sbin/bhyve/bhyve.8 Fri Dec 13 08:31:13 2013 (r259302, copy source) +++ stable/10/usr.sbin/bhyve/bhyve.8 Wed Dec 18 03:51:04 2013 (r259536) @@ -288,8 +288,8 @@ bhyve -c 4 \e\ .Xr nmdm 4 , .Xr vmm 4 , .Xr ethers 5 , -.Xr bhyveload 8 , -.Xr bhyvectl 8 +.Xr bhyvectl 8 , +.Xr bhyveload 8 .Sh HISTORY .Nm first appeared in From owner-svn-src-stable-10@FreeBSD.ORG Wed Dec 18 05:20:55 2013 Return-Path: Delivered-To: svn-src-stable-10@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 ESMTPS id 322BF8CB; Wed, 18 Dec 2013 05:20:55 +0000 (UTC) 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 1D3481445; Wed, 18 Dec 2013 05:20:55 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBI5KsEN029781; Wed, 18 Dec 2013 05:20:54 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBI5KsPE029776; Wed, 18 Dec 2013 05:20:54 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201312180520.rBI5KsPE029776@svn.freebsd.org> From: Gleb Smirnoff Date: Wed, 18 Dec 2013 05:20:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259541 - in stable/10/sys: amd64/conf dev/xen/netback dev/xen/netfront X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Dec 2013 05:20:55 -0000 Author: glebius Date: Wed Dec 18 05:20:53 2013 New Revision: 259541 URL: http://svnweb.freebsd.org/changeset/base/259541 Log: Merge r256868,257276-257277,257515,257913 from head. These are fixes required to make Xen buтldable w/o INET. Sponsored by: Nginx, Inc. Modified: stable/10/sys/amd64/conf/NOTES stable/10/sys/dev/xen/netback/netback.c stable/10/sys/dev/xen/netback/netback_unit_tests.c stable/10/sys/dev/xen/netfront/netfront.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/amd64/conf/NOTES ============================================================================== --- stable/10/sys/amd64/conf/NOTES Wed Dec 18 04:52:30 2013 (r259540) +++ stable/10/sys/amd64/conf/NOTES Wed Dec 18 05:20:53 2013 (r259541) @@ -473,6 +473,12 @@ device virtio_blk # VirtIO Block device device virtio_scsi # VirtIO SCSI device device virtio_balloon # VirtIO Memory Balloon device +device hyperv # HyperV drivers + +# Xen HVM Guest Optimizations +options XENHVM # Xen HVM kernel infrastructure +device xenpci # Xen HVM Hypervisor services driver + ##################################################################### # Modified: stable/10/sys/dev/xen/netback/netback.c ============================================================================== --- stable/10/sys/dev/xen/netback/netback.c Wed Dec 18 04:52:30 2013 (r259540) +++ stable/10/sys/dev/xen/netback/netback.c Wed Dec 18 05:20:53 2013 (r259541) @@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$"); * from this FreeBSD domain to other domains. */ #include "opt_inet.h" +#include "opt_inet6.h" #include "opt_global.h" #include "opt_sctp.h" @@ -183,7 +184,6 @@ static int xnb_rxpkt2gnttab(const struct static int xnb_rxpkt2rsp(const struct xnb_pkt *pkt, const gnttab_copy_table gnttab, int n_entries, netif_rx_back_ring_t *ring); -static void xnb_add_mbuf_cksum(struct mbuf *mbufc); static void xnb_stop(struct xnb_softc*); static int xnb_ioctl(struct ifnet*, u_long, caddr_t); static void xnb_start_locked(struct ifnet*); @@ -194,6 +194,9 @@ static void xnb_ifinit(void*); static int xnb_unit_test_main(SYSCTL_HANDLER_ARGS); static int xnb_dump_rings(SYSCTL_HANDLER_ARGS); #endif +#if defined(INET) || defined(INET6) +static void xnb_add_mbuf_cksum(struct mbuf *mbufc); +#endif /*------------------------------ Data Structures -----------------------------*/ @@ -1778,7 +1781,9 @@ xnb_update_mbufc(struct mbuf *mbufc, con } mbufc->m_pkthdr.len = total_size; +#if defined(INET) || defined(INET6) xnb_add_mbuf_cksum(mbufc); +#endif } /** @@ -2121,6 +2126,7 @@ xnb_rxpkt2rsp(const struct xnb_pkt *pkt, return n_responses; } +#if defined(INET) || defined(INET6) /** * Add IP, TCP, and/or UDP checksums to every mbuf in a chain. The first mbuf * in the chain must start with a struct ether_header. @@ -2175,6 +2181,7 @@ xnb_add_mbuf_cksum(struct mbuf *mbufc) break; } } +#endif /* INET || INET6 */ static void xnb_stop(struct xnb_softc *xnb) @@ -2191,8 +2198,8 @@ static int xnb_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) { struct xnb_softc *xnb = ifp->if_softc; -#ifdef INET struct ifreq *ifr = (struct ifreq*) data; +#ifdef INET struct ifaddr *ifa = (struct ifaddr*)data; #endif int error = 0; Modified: stable/10/sys/dev/xen/netback/netback_unit_tests.c ============================================================================== --- stable/10/sys/dev/xen/netback/netback_unit_tests.c Wed Dec 18 04:52:30 2013 (r259540) +++ stable/10/sys/dev/xen/netback/netback_unit_tests.c Wed Dec 18 05:20:53 2013 (r259541) @@ -104,10 +104,6 @@ struct test_fixture { typedef struct test_fixture test_fixture_t; -static void xnb_fill_eh_and_ip(struct mbuf *m, uint16_t ip_len, - uint16_t ip_id, uint16_t ip_p, - uint16_t ip_off, uint16_t ip_sum); -static void xnb_fill_tcp(struct mbuf *m); static int xnb_get1pkt(struct xnb_pkt *pkt, size_t size, uint16_t flags); static int xnb_unit_test_runner(test_fixture_t const tests[], int ntests, char *buffer, size_t buflen); @@ -163,17 +159,24 @@ static testcase_t xnb_rxpkt2rsp_extra; static testcase_t xnb_rxpkt2rsp_2short; static testcase_t xnb_rxpkt2rsp_2slots; static testcase_t xnb_rxpkt2rsp_copyerror; +static testcase_t xnb_sscanf_llu; +static testcase_t xnb_sscanf_lld; +static testcase_t xnb_sscanf_hhu; +static testcase_t xnb_sscanf_hhd; +static testcase_t xnb_sscanf_hhn; + +#if defined(INET) || defined(INET6) /* TODO: add test cases for xnb_add_mbuf_cksum for IPV6 tcp and udp */ static testcase_t xnb_add_mbuf_cksum_arp; static testcase_t xnb_add_mbuf_cksum_tcp; static testcase_t xnb_add_mbuf_cksum_udp; static testcase_t xnb_add_mbuf_cksum_icmp; static testcase_t xnb_add_mbuf_cksum_tcp_swcksum; -static testcase_t xnb_sscanf_llu; -static testcase_t xnb_sscanf_lld; -static testcase_t xnb_sscanf_hhu; -static testcase_t xnb_sscanf_hhd; -static testcase_t xnb_sscanf_hhn; +static void xnb_fill_eh_and_ip(struct mbuf *m, uint16_t ip_len, + uint16_t ip_id, uint16_t ip_p, + uint16_t ip_off, uint16_t ip_sum); +static void xnb_fill_tcp(struct mbuf *m); +#endif /* INET || INET6 */ /** Private data used by unit tests */ static struct { @@ -307,11 +310,13 @@ xnb_unit_test_main(SYSCTL_HANDLER_ARGS) {setup_pvt_data, xnb_rxpkt2rsp_2short, teardown_pvt_data}, {setup_pvt_data, xnb_rxpkt2rsp_2slots, teardown_pvt_data}, {setup_pvt_data, xnb_rxpkt2rsp_copyerror, teardown_pvt_data}, +#if defined(INET) || defined(INET6) {null_setup, xnb_add_mbuf_cksum_arp, null_teardown}, {null_setup, xnb_add_mbuf_cksum_icmp, null_teardown}, {null_setup, xnb_add_mbuf_cksum_tcp, null_teardown}, {null_setup, xnb_add_mbuf_cksum_tcp_swcksum, null_teardown}, {null_setup, xnb_add_mbuf_cksum_udp, null_teardown}, +#endif {null_setup, xnb_sscanf_hhd, null_teardown}, {null_setup, xnb_sscanf_hhu, null_teardown}, {null_setup, xnb_sscanf_lld, null_teardown}, @@ -2066,6 +2071,7 @@ xnb_rxpkt2rsp_copyerror(char *buffer, si safe_m_freem(&mbuf); } +#if defined(INET) || defined(INET6) /** * xnb_add_mbuf_cksum on an ARP request packet */ @@ -2430,6 +2436,7 @@ xnb_add_mbuf_cksum_tcp_swcksum(char *buf m_freem(mbufc); } +#endif /* INET || INET6 */ /** * sscanf on unsigned chars Modified: stable/10/sys/dev/xen/netfront/netfront.c ============================================================================== --- stable/10/sys/dev/xen/netfront/netfront.c Wed Dec 18 04:52:30 2013 (r259540) +++ stable/10/sys/dev/xen/netfront/netfront.c Wed Dec 18 05:20:53 2013 (r259541) @@ -28,6 +28,7 @@ __FBSDID("$FreeBSD$"); #include "opt_inet.h" +#include "opt_inet6.h" #include #include @@ -165,7 +166,6 @@ static int xn_configure_features(struct static void xn_watchdog(struct ifnet *); #endif -static void show_device(struct netfront_info *sc); #ifdef notyet static void netfront_closing(device_t dev); #endif @@ -644,8 +644,6 @@ setup_device(device_t dev, struct netfro goto fail; } - show_device(info); - return (0); fail: @@ -967,7 +965,7 @@ static void xn_rxeof(struct netfront_info *np) { struct ifnet *ifp; -#if __FreeBSD_version >= 700000 +#if __FreeBSD_version >= 700000 && (defined(INET) || defined(INET6)) struct lro_ctrl *lro = &np->xn_lro; struct lro_entry *queued; #endif @@ -1064,7 +1062,7 @@ xn_rxeof(struct netfront_info *np) * Do we really need to drop the rx lock? */ XN_RX_UNLOCK(np); -#if __FreeBSD_version >= 700000 +#if __FreeBSD_version >= 700000 && (defined(INET) || defined(INET6)) /* Use LRO if possible */ if ((ifp->if_capenable & IFCAP_LRO) == 0 || lro->lro_cnt == 0 || tcp_lro_rx(lro, m, 0)) { @@ -1082,7 +1080,7 @@ xn_rxeof(struct netfront_info *np) np->rx.rsp_cons = i; -#if __FreeBSD_version >= 700000 +#if __FreeBSD_version >= 700000 && (defined(INET) || defined(INET6)) /* * Flush any outstanding LRO work */ @@ -1969,25 +1967,6 @@ network_connect(struct netfront_info *np return (0); } -static void -show_device(struct netfront_info *sc) -{ -#ifdef DEBUG - if (sc) { - IPRINTK("\n", - sc->xn_ifno, - be_state_name[sc->xn_backend_state], - sc->xn_user_state ? "open" : "closed", - sc->xn_evtchn, - sc->xn_irq, - sc->xn_tx_if, - sc->xn_rx_if); - } else { - IPRINTK("\n"); - } -#endif -} - static void xn_query_features(struct netfront_info *np) { @@ -2024,14 +2003,14 @@ xn_configure_features(struct netfront_in int err; err = 0; -#if __FreeBSD_version >= 700000 +#if __FreeBSD_version >= 700000 && (defined(INET) || defined(INET6)) if ((np->xn_ifp->if_capenable & IFCAP_LRO) != 0) tcp_lro_free(&np->xn_lro); #endif np->xn_ifp->if_capenable = np->xn_ifp->if_capabilities & ~(IFCAP_LRO|IFCAP_TSO4); np->xn_ifp->if_hwassist &= ~CSUM_TSO; -#if __FreeBSD_version >= 700000 +#if __FreeBSD_version >= 700000 && (defined(INET) || defined(INET6)) if (xn_enable_lro && (np->xn_ifp->if_capabilities & IFCAP_LRO) != 0) { err = tcp_lro_init(&np->xn_lro); if (err) { From owner-svn-src-stable-10@FreeBSD.ORG Wed Dec 18 19:07:32 2013 Return-Path: Delivered-To: svn-src-stable-10@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 ESMTPS id C368887E; Wed, 18 Dec 2013 19:07:32 +0000 (UTC) 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 AB12419D0; Wed, 18 Dec 2013 19:07:32 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBIJ7WT1029409; Wed, 18 Dec 2013 19:07:32 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBIJ7ULB029390; Wed, 18 Dec 2013 19:07:30 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201312181907.rBIJ7ULB029390@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Wed, 18 Dec 2013 19:07:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259563 - in stable/10: contrib/gcc contrib/gcc/config contrib/gcc/config/i386 contrib/gcc/config/rs6000 contrib/gcc/cp contrib/gcc/doc gnu/usr.bin/cc gnu/usr.bin/cc/cc_tools X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Dec 2013 19:07:32 -0000 Author: pfg Date: Wed Dec 18 19:07:29 2013 New Revision: 259563 URL: http://svnweb.freebsd.org/changeset/base/259563 Log: MFC r258428, r258445 gcc: another round of merges from the gcc pre-43 branch. Bring The following revisions from the gcc43 branch[1]: 118360, 118361, 118363, 118576, 119820, 123906, 125246, and 125721. They all have in common that the were merged long ago into Apple's gcc and should help improve the general quality of the compiler and make it easier to bring new features from Apple's gcc42. For details please review the additions to the files: gcc/ChangeLog.gcc43 gcc/cp/ChangeLog.gcc43 (new, adds previous revisions) Fix crosscompilation (r258445 by andreast) Reference: [1] http://gcc.gnu.org/viewcvs/gcc/trunk/?pathrev=126700 Obtained from: gcc pre4.3 (GPLv2) branch MFC after: 3 weeks Added: stable/10/contrib/gcc/cp/ChangeLog.gcc43 - copied unchanged from r258428, head/contrib/gcc/cp/ChangeLog.gcc43 Modified: stable/10/contrib/gcc/ChangeLog.gcc43 stable/10/contrib/gcc/Makefile.in stable/10/contrib/gcc/builtin-types.def stable/10/contrib/gcc/builtins.c stable/10/contrib/gcc/builtins.def stable/10/contrib/gcc/cgraphunit.c stable/10/contrib/gcc/collect2.c stable/10/contrib/gcc/config/i386/beos-elf.h stable/10/contrib/gcc/config/i386/cygwin.h stable/10/contrib/gcc/config/i386/i386.c stable/10/contrib/gcc/config/i386/i386.h stable/10/contrib/gcc/config/i386/i386.md stable/10/contrib/gcc/config/i386/nto.h stable/10/contrib/gcc/config/rs6000/aix.h stable/10/contrib/gcc/config/rs6000/sysv4.h stable/10/contrib/gcc/config/svr4.h stable/10/contrib/gcc/configure stable/10/contrib/gcc/configure.ac stable/10/contrib/gcc/coverage.c stable/10/contrib/gcc/cp/decl2.c stable/10/contrib/gcc/cp/name-lookup.c stable/10/contrib/gcc/cppdefault.c stable/10/contrib/gcc/doc/extend.texi stable/10/contrib/gcc/doc/libgcc.texi stable/10/contrib/gcc/doc/rtl.texi stable/10/contrib/gcc/dwarf2out.c stable/10/contrib/gcc/expr.c stable/10/contrib/gcc/fold-const.c stable/10/contrib/gcc/gcc.c stable/10/contrib/gcc/genattrtab.c stable/10/contrib/gcc/genopinit.c stable/10/contrib/gcc/libgcc-std.ver stable/10/contrib/gcc/libgcc2.c stable/10/contrib/gcc/libgcc2.h stable/10/contrib/gcc/mips-tdump.c stable/10/contrib/gcc/mips-tfile.c stable/10/contrib/gcc/mklibgcc.in stable/10/contrib/gcc/optabs.c stable/10/contrib/gcc/optabs.h stable/10/contrib/gcc/reload1.c stable/10/contrib/gcc/rtl.def stable/10/contrib/gcc/simplify-rtx.c stable/10/contrib/gcc/tree-ssa-propagate.c stable/10/contrib/gcc/tree.c stable/10/contrib/gcc/tree.h stable/10/gnu/usr.bin/cc/Makefile.inc stable/10/gnu/usr.bin/cc/cc_tools/freebsd-native.h Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/gcc/ChangeLog.gcc43 ============================================================================== --- stable/10/contrib/gcc/ChangeLog.gcc43 Wed Dec 18 18:25:27 2013 (r259562) +++ stable/10/contrib/gcc/ChangeLog.gcc43 Wed Dec 18 19:07:29 2013 (r259563) @@ -10,6 +10,12 @@ * doc/extend.texi: Document the 0b-prefixed binary integer constant extension. +2007-05-31 Eric Christopher + + * expr.c (convert_move): Assert that we don't have a BLKmode + operand. + (store_expr): Handle BLKmode moves by calling emit_block_move. + 2007-05-24 Richard Sandiford (r125037) * postreload-gcse.c (reg_changed_after_insn_p): New function. @@ -99,6 +105,12 @@ (dwarf2out_imported_module_or_decl): Suppress struct debug information using should_emit_struct_debug when appropriate. +2007-04-16 Ian Lance Taylor (r123906) + + * tree-ssa-propagate.c (cfg_blocks_add): Insert blocks with fewer + predecessors at head rather than tail. + + 2007-04-12 Richard Guenther (r123736) PR tree-optimization/24689 @@ -333,6 +345,28 @@ * doc/invoke.texi (Warning Options): Update -Wparentheses description. +2006-12-12 Geoffrey Keating (r119820) + + * mips-tdump.c: Replace CROSS_COMPILE with + CROSS_DIRECTORY_STRUCTURE. + * mips-tfile.c: Likewise. + * gcc.c: Likewise. + * configure.ac: Likewise. + * cppdefault.c: Likewise. + * Makefile.in: Likewise. + * config/alpha/osf.h: Likewise. + * config/i386/cygwin.h: Likewise. + * config/i386/beos-elf.h: Likewise. + * config/i386/nto.h: Likewise. + * config/svr4.h: Likewise. + * config/rs6000/aix.h: Likewise. + * config/rs6000/sysv4.h: Likewise. + * collect2.c: Likewise. + * configure: Regenerate. + + * doc/tm.texi (Alignment Output): Document that ASM_OUTPUT_SKIP + actually takes an unsigned HOST_WIDE_INT for its second parameter. + 2006-12-02 H.J. Lu (r119454 - partial) PR target/30040 @@ -371,6 +405,30 @@ (override_options): Add entries for Core2. (ix86_issue_rate): Add case for Core2. +2006-11-07 Eric Christopher (r118576) + + * libgcc2.c (__bswapdi2): Rename from bswapDI2. + (__bswapsi2): Ditto. + * libgcc2.h: Remove transformation of bswap routines. + * config/i386/i386.md (bswapsi2): New. + (bswapdi2): Ditto. + +2006-10-31 Geoffrey Keating (r118360) + + * coverage.c (coverage_checksum_string): Update comment. + * dwarf2out.c (switch_to_eh_frame_section): Update for removal + of get_file_function_name. + * cgraphunit.c (cgraph_build_static_cdtor): Update for rename + of get_file_function_name_long. + * tree.c (get_file_function_name): Rename from + get_file_function_name_long; improve comment; handle 'I' and 'D' + specially when the target has ctor/dtor support; remove special + handling for 'F'. + (get_file_function_name): Remove. + * tree.h (get_file_function_name): Rename from + get_file_function_name_long. + (get_file_function_name): Remove prototype. + 2006-10-31 Geoffrey Keating (r118356) * c-decl.c (grokdeclarator): Don't set DECL_EXTERNAL on @@ -521,3 +579,51 @@ * builtins.c (fold_builtin_classify): Fix typo. +2006-09-07 Eric Christopher (r118361) + Falk Hueffner + + * doc/extend.texi (__builtin_bswap32): Document. + (__builtin_bswap64): Ditto. + * doc/libgcc.texi (bswapsi2): Document. + (bswapdi2): Ditto. + * doc/rtl.texi (bswap): Document. + * optabs.c (expand_unop): Don't widen a bswap. + (init_optabs): Init bswap. Set libfuncs explicitly + for bswapsi2 and bswapdi2. + * optabs.h (OTI_bswap): New. + (bswap_optab): Ditto. + * genopinit.c (optabs): Handle bswap_optab. + * tree.h (tree_index): Add TI_UINT32_TYPE and + TI_UINT64_TYPE. + (uint32_type_node): New. + (uint64_type_node): Ditto. + * tree.c (build_common_tree_nodes_2): Initialize + uint32_type_node and uint64_type_node. + * builtins.c (expand_builtin_bswap): New. + (expand_builtin): Call. + (fold_builtin_bswap): New. + (fold_builtin_1): Call. + * fold-const.c (tree_expr_nonnegative_p): Return true + for bswap. + * builtin-types.def (BT_UINT32): New. + (BT_UINT64): Ditto. + (BT_FN_UINT32_UINT32): Ditto. + (BT_FN_UINT64_UINT64): Ditto. + * builtins.def (BUILT_IN_BSWAP32): New. + (BUILT_IN_BSWAP64): Ditto. + * rtl.def (BSWAP): New. + * genattrtab.c (check_attr_value): New. + * libgcc2.c (__bswapSI2): New. + (__bswapDI2): Ditto. + * libgcc2.h (__bswapSI2): Declare. + (__bswapDI2): Ditto. + * mklibgcc.in (lib2funcs): Add _bswapsi2 and _bswapdi2. + * simplify-rtx.c (simplify_const_unary_operation): Return + 0 for BSWAP. + * libgcc-std.ver (__bwapsi2): Add. + (__bswapdi2): Ditto. + * reload1.c (eliminate_regs_1): Add bswap. + (elimination_effects): Ditto. + * config/i386/i386.h (x86_bswap): New. + (TARGET_BSWAP): Use. + * config/i386/i386.c (x86_bswap): Set. Modified: stable/10/contrib/gcc/Makefile.in ============================================================================== --- stable/10/contrib/gcc/Makefile.in Wed Dec 18 18:25:27 2013 (r259562) +++ stable/10/contrib/gcc/Makefile.in Wed Dec 18 19:07:29 2013 (r259563) @@ -822,7 +822,8 @@ REAL_H = real.h $(MACHMODE_H) # IN_GCC distinguishes between code compiled into GCC itself and other # programs built during a bootstrap. -# autoconf inserts -DCROSS_COMPILE if we are building a cross compiler. +# autoconf inserts -DCROSS_DIRECTORY_STRUCTURE if we are building a +# cross compiler which does not use the native headers and libraries. INTERNAL_CFLAGS = -DIN_GCC @CROSS@ # This is the variable actually used when we compile. If you change this, Modified: stable/10/contrib/gcc/builtin-types.def ============================================================================== --- stable/10/contrib/gcc/builtin-types.def Wed Dec 18 18:25:27 2013 (r259562) +++ stable/10/contrib/gcc/builtin-types.def Wed Dec 18 19:07:29 2013 (r259563) @@ -75,6 +75,8 @@ DEF_PRIMITIVE_TYPE (BT_LONGLONG, long_lo DEF_PRIMITIVE_TYPE (BT_ULONGLONG, long_long_unsigned_type_node) DEF_PRIMITIVE_TYPE (BT_INTMAX, intmax_type_node) DEF_PRIMITIVE_TYPE (BT_UINTMAX, uintmax_type_node) +DEF_PRIMITIVE_TYPE (BT_UINT32, uint32_type_node) +DEF_PRIMITIVE_TYPE (BT_UINT64, uint64_type_node) DEF_PRIMITIVE_TYPE (BT_WORD, (*lang_hooks.types.type_for_mode) (word_mode, 0)) DEF_PRIMITIVE_TYPE (BT_FLOAT, float_type_node) DEF_PRIMITIVE_TYPE (BT_DOUBLE, double_type_node) @@ -204,6 +206,10 @@ DEF_FUNCTION_TYPE_1 (BT_FN_DFLOAT128_DFL DEF_FUNCTION_TYPE_1 (BT_FN_VOID_VPTR, BT_VOID, BT_VOLATILE_PTR) DEF_FUNCTION_TYPE_1 (BT_FN_VOID_PTRPTR, BT_VOID, BT_PTR_PTR) DEF_FUNCTION_TYPE_1 (BT_FN_UINT_UINT, BT_UINT, BT_UINT) +DEF_FUNCTION_TYPE_1 (BT_FN_ULONG_ULONG, BT_ULONG, BT_ULONG) +DEF_FUNCTION_TYPE_1 (BT_FN_ULONGLONG_ULONGLONG, BT_ULONGLONG, BT_ULONGLONG) +DEF_FUNCTION_TYPE_1 (BT_FN_UINT32_UINT32, BT_UINT32, BT_UINT32) +DEF_FUNCTION_TYPE_1 (BT_FN_UINT64_UINT64, BT_UINT64, BT_UINT64) DEF_POINTER_TYPE (BT_PTR_FN_VOID_PTR, BT_FN_VOID_PTR) @@ -435,4 +441,3 @@ DEF_FUNCTION_TYPE_VAR_5 (BT_FN_INT_STRIN DEF_POINTER_TYPE (BT_PTR_FN_VOID_VAR, BT_FN_VOID_VAR) DEF_FUNCTION_TYPE_3 (BT_FN_PTR_PTR_FN_VOID_VAR_PTR_SIZE, BT_PTR, BT_PTR_FN_VOID_VAR, BT_PTR, BT_SIZE) - Modified: stable/10/contrib/gcc/builtins.c ============================================================================== --- stable/10/contrib/gcc/builtins.c Wed Dec 18 18:25:27 2013 (r259562) +++ stable/10/contrib/gcc/builtins.c Wed Dec 18 19:07:29 2013 (r259563) @@ -4589,6 +4589,30 @@ expand_builtin_alloca (tree arglist, rtx return result; } +/* Expand a call to a bswap builtin. The arguments are in ARGLIST. MODE + is the mode to expand with. */ + +static rtx +expand_builtin_bswap (tree arglist, rtx target, rtx subtarget) +{ + enum machine_mode mode; + tree arg; + rtx op0; + + if (!validate_arglist (arglist, INTEGER_TYPE, VOID_TYPE)) + return 0; + + arg = TREE_VALUE (arglist); + mode = TYPE_MODE (TREE_TYPE (arg)); + op0 = expand_expr (arg, subtarget, VOIDmode, 0); + + target = expand_unop (mode, bswap_optab, op0, target, 1); + + gcc_assert (target); + + return convert_to_mode (mode, target, 0); +} + /* Expand a call to a unary builtin. The arguments are in ARGLIST. Return 0 if a normal call should be emitted rather than expanding the function in-line. If convenient, the result should be placed in TARGET. @@ -5877,6 +5901,14 @@ expand_builtin (tree exp, rtx target, rt expand_stack_restore (TREE_VALUE (arglist)); return const0_rtx; + case BUILT_IN_BSWAP32: + case BUILT_IN_BSWAP64: + target = expand_builtin_bswap (arglist, target, subtarget); + + if (target) + return target; + break; + CASE_INT_FN (BUILT_IN_FFS): case BUILT_IN_FFSIMAX: target = expand_builtin_unop (target_mode, arglist, target, @@ -7539,6 +7571,67 @@ fold_builtin_bitop (tree fndecl, tree ar return NULL_TREE; } +/* Fold function call to builtin_bswap and the long and long long + variants. Return NULL_TREE if no simplification can be made. */ +static tree +fold_builtin_bswap (tree fndecl, tree arglist) +{ + tree arg; + + if (! validate_arglist (arglist, INTEGER_TYPE, VOID_TYPE)) + return 0; + + /* Optimize constant value. */ + arg = TREE_VALUE (arglist); + if (TREE_CODE (arg) == INTEGER_CST && ! TREE_CONSTANT_OVERFLOW (arg)) + { + HOST_WIDE_INT hi, width, r_hi = 0; + unsigned HOST_WIDE_INT lo, r_lo = 0; + tree type; + + type = TREE_TYPE (arg); + width = TYPE_PRECISION (type); + lo = TREE_INT_CST_LOW (arg); + hi = TREE_INT_CST_HIGH (arg); + + switch (DECL_FUNCTION_CODE (fndecl)) + { + case BUILT_IN_BSWAP32: + case BUILT_IN_BSWAP64: + { + int s; + + for (s = 0; s < width; s += 8) + { + int d = width - s - 8; + unsigned HOST_WIDE_INT byte; + + if (s < HOST_BITS_PER_WIDE_INT) + byte = (lo >> s) & 0xff; + else + byte = (hi >> (s - HOST_BITS_PER_WIDE_INT)) & 0xff; + + if (d < HOST_BITS_PER_WIDE_INT) + r_lo |= byte << d; + else + r_hi |= byte << (d - HOST_BITS_PER_WIDE_INT); + } + } + + break; + + default: + gcc_unreachable (); + } + + if (width < HOST_BITS_PER_WIDE_INT) + return build_int_cst (TREE_TYPE (TREE_TYPE (fndecl)), r_lo); + else + return build_int_cst_wide (TREE_TYPE (TREE_TYPE (fndecl)), r_lo, r_hi); + } + + return NULL_TREE; +} /* Return true if EXPR is the real constant contained in VALUE. */ static bool @@ -9053,6 +9146,10 @@ fold_builtin_1 (tree fndecl, tree arglis CASE_FLT_FN (BUILT_IN_LLRINT): return fold_fixed_mathfn (fndecl, arglist); + case BUILT_IN_BSWAP32: + case BUILT_IN_BSWAP64: + return fold_builtin_bswap (fndecl, arglist); + CASE_INT_FN (BUILT_IN_FFS): CASE_INT_FN (BUILT_IN_CLZ): CASE_INT_FN (BUILT_IN_CTZ): Modified: stable/10/contrib/gcc/builtins.def ============================================================================== --- stable/10/contrib/gcc/builtins.def Wed Dec 18 18:25:27 2013 (r259562) +++ stable/10/contrib/gcc/builtins.def Wed Dec 18 19:07:29 2013 (r259563) @@ -594,6 +594,8 @@ DEF_EXT_LIB_BUILTIN (BUILT_IN_ALLOCA, DEF_GCC_BUILTIN (BUILT_IN_APPLY, "apply", BT_FN_PTR_PTR_FN_VOID_VAR_PTR_SIZE, ATTR_NULL) DEF_GCC_BUILTIN (BUILT_IN_APPLY_ARGS, "apply_args", BT_FN_PTR_VAR, ATTR_NULL) DEF_GCC_BUILTIN (BUILT_IN_ARGS_INFO, "args_info", BT_FN_INT_INT, ATTR_NULL) +DEF_GCC_BUILTIN (BUILT_IN_BSWAP32, "bswap32", BT_FN_UINT32_UINT32, ATTR_CONST_NOTHROW_LIST) +DEF_GCC_BUILTIN (BUILT_IN_BSWAP64, "bswap64", BT_FN_UINT64_UINT64, ATTR_CONST_NOTHROW_LIST) DEF_LIB_BUILTIN (BUILT_IN_CALLOC, "calloc", BT_FN_PTR_SIZE_SIZE, ATTR_MALLOC_NOTHROW_LIST) DEF_GCC_BUILTIN (BUILT_IN_CLASSIFY_TYPE, "classify_type", BT_FN_INT_VAR, ATTR_NULL) DEF_GCC_BUILTIN (BUILT_IN_CLZ, "clz", BT_FN_INT_UINT, ATTR_CONST_NOTHROW_LIST) Modified: stable/10/contrib/gcc/cgraphunit.c ============================================================================== --- stable/10/contrib/gcc/cgraphunit.c Wed Dec 18 18:25:27 2013 (r259562) +++ stable/10/contrib/gcc/cgraphunit.c Wed Dec 18 19:07:29 2013 (r259563) @@ -1676,7 +1676,7 @@ cgraph_build_static_cdtor (char which, t tree decl, name, resdecl; sprintf (which_buf, "%c_%d", which, counter++); - name = get_file_function_name_long (which_buf); + name = get_file_function_name (which_buf); decl = build_decl (FUNCTION_DECL, name, build_function_type (void_type_node, void_list_node)); Modified: stable/10/contrib/gcc/collect2.c ============================================================================== --- stable/10/contrib/gcc/collect2.c Wed Dec 18 18:25:27 2013 (r259562) +++ stable/10/contrib/gcc/collect2.c Wed Dec 18 19:07:29 2013 (r259563) @@ -53,7 +53,7 @@ Software Foundation, 51 Franklin Street, the utilities are not correct for a cross-compiler; we have to hope that cross-versions are in the proper directories. */ -#ifdef CROSS_COMPILE +#ifdef CROSS_DIRECTORY_STRUCTURE #undef OBJECT_FORMAT_COFF #undef MD_EXEC_PREFIX #undef REAL_LD_FILE_NAME @@ -553,7 +553,7 @@ is_ctor_dtor (const char *s) static struct path_prefix cpath, path; -#ifdef CROSS_COMPILE +#ifdef CROSS_DIRECTORY_STRUCTURE /* This is the name of the target machine. We use it to form the name of the files to execute. */ @@ -746,7 +746,7 @@ main (int argc, char **argv) static const char *const strip_suffix = "strip"; static const char *const gstrip_suffix = "gstrip"; -#ifdef CROSS_COMPILE +#ifdef CROSS_DIRECTORY_STRUCTURE /* If we look for a program in the compiler directories, we just use the short name, since these directories are already system-specific. But it we look for a program in the system directories, we need to @@ -775,7 +775,7 @@ main (int argc, char **argv) #endif const char *const full_strip_suffix = strip_suffix; const char *const full_gstrip_suffix = gstrip_suffix; -#endif /* CROSS_COMPILE */ +#endif /* CROSS_DIRECTORY_STRUCTURE */ const char *arg; FILE *outf; @@ -957,7 +957,7 @@ main (int argc, char **argv) c_file_name = getenv ("COLLECT_GCC"); if (c_file_name == 0) { -#ifdef CROSS_COMPILE +#ifdef CROSS_DIRECTORY_STRUCTURE c_file_name = concat (target_machine, "-gcc", NULL); #else c_file_name = "gcc"; Modified: stable/10/contrib/gcc/config/i386/beos-elf.h ============================================================================== --- stable/10/contrib/gcc/config/i386/beos-elf.h Wed Dec 18 18:25:27 2013 (r259562) +++ stable/10/contrib/gcc/config/i386/beos-elf.h Wed Dec 18 19:07:29 2013 (r259563) @@ -135,7 +135,7 @@ Boston, MA 02110-1301, USA. */ for the BeOS include files relative to TOOL_INCLUDE_DIR. Yes, we use ANSI string concatenation here (FIXME) */ -#ifndef CROSS_COMPILE +#ifndef CROSS_DIRECTORY_STRUCTURE #undef INCLUDE_DEFAULTS #define INCLUDE_DEFAULTS \ { \ @@ -177,7 +177,7 @@ Boston, MA 02110-1301, USA. */ { "/boot/develop/headers", 0, 0, 0 }, \ { 0, 0, 0, 0 } \ } -#else /* CROSS_COMPILE */ +#else /* CROSS_DIRECTORY_STRUCTURE */ #undef INCLUDE_DEFAULTS #define INCLUDE_DEFAULTS \ { \ Modified: stable/10/contrib/gcc/config/i386/cygwin.h ============================================================================== --- stable/10/contrib/gcc/config/i386/cygwin.h Wed Dec 18 18:25:27 2013 (r259562) +++ stable/10/contrib/gcc/config/i386/cygwin.h Wed Dec 18 19:07:29 2013 (r259563) @@ -146,7 +146,7 @@ char cygwin_tool_include_dir[sizeof (TOO #undef TOOL_INCLUDE_DIR #define TOOL_INCLUDE_DIR ((const char *) cygwin_tool_include_dir) -#ifndef CROSS_COMPILE +#ifndef CROSS_DIRECTORY_STRUCTURE #undef STANDARD_INCLUDE_DIR #define STANDARD_INCLUDE_DIR "/usr/include" char cygwin_standard_include_dir[sizeof (STANDARD_INCLUDE_DIR) + 1 Modified: stable/10/contrib/gcc/config/i386/i386.c ============================================================================== --- stable/10/contrib/gcc/config/i386/i386.c Wed Dec 18 18:25:27 2013 (r259562) +++ stable/10/contrib/gcc/config/i386/i386.c Wed Dec 18 19:07:29 2013 (r259563) @@ -1089,6 +1089,8 @@ const int x86_cmpxchg = ~m_386; const int x86_cmpxchg8b = ~(m_386 | m_486); /* Exchange and add was added for 80486. */ const int x86_xadd = ~m_386; +/* Byteswap was added for 80486. */ +const int x86_bswap = ~m_386; const int x86_pad_returns = m_ATHLON_K8_AMDFAM10 | m_CORE2 | m_GENERIC; /* In case the average insn count for single function invocation is Modified: stable/10/contrib/gcc/config/i386/i386.h ============================================================================== --- stable/10/contrib/gcc/config/i386/i386.h Wed Dec 18 18:25:27 2013 (r259562) +++ stable/10/contrib/gcc/config/i386/i386.h Wed Dec 18 19:07:29 2013 (r259563) @@ -168,6 +168,7 @@ extern const int x86_use_bt; extern const int x86_cmpxchg, x86_cmpxchg8b, x86_xadd; extern const int x86_use_incdec; extern const int x86_pad_returns; +extern const int x86_bswap; extern const int x86_partial_flag_reg_stall; extern int x86_prefetch_sse, x86_cmpxchg16b; @@ -243,6 +244,7 @@ extern int x86_prefetch_sse, x86_cmpxchg #define TARGET_CMPXCHG8B (x86_cmpxchg8b & (1 << ix86_arch)) #define TARGET_CMPXCHG16B (x86_cmpxchg16b) #define TARGET_XADD (x86_xadd & (1 << ix86_arch)) +#define TARGET_BSWAP (x86_bswap & (1 << ix86_arch)) #ifndef TARGET_64BIT_DEFAULT #define TARGET_64BIT_DEFAULT 0 Modified: stable/10/contrib/gcc/config/i386/i386.md ============================================================================== --- stable/10/contrib/gcc/config/i386/i386.md Wed Dec 18 18:25:27 2013 (r259562) +++ stable/10/contrib/gcc/config/i386/i386.md Wed Dec 18 19:07:29 2013 (r259563) @@ -284,14 +284,14 @@ (const_int 0))) ;; Set when string REP prefix is used. -(define_attr "prefix_rep" "" +(define_attr "prefix_rep" "" (if_then_else (and (eq_attr "unit" "sse") (eq_attr "mode" "SF,DF")) (const_int 1) (const_int 0))) ;; Set when 0f opcode prefix is used. (define_attr "prefix_0f" "" - (if_then_else + (if_then_else (ior (eq_attr "type" "imovx,setcc,icmov,bitmanip") (eq_attr "unit" "sse,mmx")) (const_int 1) @@ -466,7 +466,7 @@ ;; All x87 floating point modes (define_mode_macro X87MODEF [SF DF XF]) - + ;; All integer modes handled by x87 fisttp operator. (define_mode_macro X87MODEI [HI SI DI]) @@ -475,7 +475,7 @@ ;; All SSE floating point modes (define_mode_macro SSEMODEF [SF DF]) - + ;; All integer modes handled by SSE cvtts?2si* operators. (define_mode_macro SSEMODEI24 [SI DI]) @@ -1098,7 +1098,7 @@ ;; Push/pop instructions. They are separate since autoinc/dec is not a ;; general_operand. ;; -;; %%% We don't use a post-inc memory reference because x86 is not a +;; %%% We don't use a post-inc memory reference because x86 is not a ;; general AUTO_INC_DEC host, which impacts how it is treated in flow. ;; Changing this impacts compiler performance on other non-AUTO_INC_DEC ;; targets without our curiosities, and it is just as easy to represent @@ -1160,7 +1160,7 @@ [(set_attr "type" "alu1") (set_attr "mode" "SI") (set_attr "length_immediate" "0")]) - + (define_insn "*movsi_or" [(set (match_operand:SI 0 "register_operand" "=r") (match_operand:SI 1 "immediate_operand" "i")) @@ -2308,7 +2308,7 @@ && (reload_in_progress || reload_completed || (ix86_cmodel == CM_MEDIUM || ix86_cmodel == CM_LARGE) || GET_CODE (operands[1]) != CONST_DOUBLE - || memory_operand (operands[0], SFmode))" + || memory_operand (operands[0], SFmode))" { switch (which_alternative) { @@ -2368,7 +2368,7 @@ (const_string "V4SF")) /* For architectures resolving dependencies on whole SSE registers use APS move to break dependency - chains, otherwise use short move to avoid extra work. + chains, otherwise use short move to avoid extra work. Do the same for architectures resolving dependencies on the parts. While in DF mode it is better to always handle @@ -2476,7 +2476,7 @@ && (reload_in_progress || reload_completed || (ix86_cmodel == CM_MEDIUM || ix86_cmodel == CM_LARGE) || GET_CODE (operands[1]) != CONST_DOUBLE - || memory_operand (operands[0], DFmode))" + || memory_operand (operands[0], DFmode))" { switch (which_alternative) { @@ -2596,7 +2596,7 @@ && (reload_in_progress || reload_completed || (ix86_cmodel == CM_MEDIUM || ix86_cmodel == CM_LARGE) || GET_CODE (operands[1]) != CONST_DOUBLE - || memory_operand (operands[0], DFmode))" + || memory_operand (operands[0], DFmode))" { switch (which_alternative) { @@ -2712,10 +2712,10 @@ (match_operand:DF 1 "general_operand" ""))] "reload_completed && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM) - && ! (ANY_FP_REG_P (operands[0]) || + && ! (ANY_FP_REG_P (operands[0]) || (GET_CODE (operands[0]) == SUBREG && ANY_FP_REG_P (SUBREG_REG (operands[0])))) - && ! (ANY_FP_REG_P (operands[1]) || + && ! (ANY_FP_REG_P (operands[1]) || (GET_CODE (operands[1]) == SUBREG && ANY_FP_REG_P (SUBREG_REG (operands[1]))))" [(const_int 0)] @@ -2807,7 +2807,7 @@ && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM) && (reload_in_progress || reload_completed || GET_CODE (operands[1]) != CONST_DOUBLE - || memory_operand (operands[0], XFmode))" + || memory_operand (operands[0], XFmode))" { switch (which_alternative) { @@ -2841,7 +2841,7 @@ && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM) && (reload_in_progress || reload_completed || GET_CODE (operands[1]) != CONST_DOUBLE - || memory_operand (operands[0], XFmode))" + || memory_operand (operands[0], XFmode))" { switch (which_alternative) { @@ -2875,10 +2875,10 @@ "reload_completed && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM) && GET_MODE (operands[0]) == XFmode - && ! (ANY_FP_REG_P (operands[0]) || + && ! (ANY_FP_REG_P (operands[0]) || (GET_CODE (operands[0]) == SUBREG && ANY_FP_REG_P (SUBREG_REG (operands[0])))) - && ! (ANY_FP_REG_P (operands[1]) || + && ! (ANY_FP_REG_P (operands[1]) || (GET_CODE (operands[1]) == SUBREG && ANY_FP_REG_P (SUBREG_REG (operands[1]))))" [(const_int 0)] @@ -3073,7 +3073,7 @@ [(set (match_operand:HI 0 "register_operand" "") (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" ""))) (clobber (reg:CC FLAGS_REG))] - "reload_completed + "reload_completed && (!TARGET_ZERO_EXTEND_WITH_AND || optimize_size) && (!REG_P (operands[1]) || ANY_QI_REG_P (operands[1]))" [(set (match_operand:HI 0 "register_operand" "") @@ -3143,7 +3143,7 @@ [(set (match_operand:SI 0 "register_operand" "") (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" ""))) (clobber (reg:CC FLAGS_REG))] - "reload_completed + "reload_completed && (!TARGET_ZERO_EXTEND_WITH_AND || optimize_size) && (!REG_P (operands[1]) || ANY_QI_REG_P (operands[1]))" [(set (match_dup 0) @@ -3220,7 +3220,7 @@ [(set (match_dup 4) (const_int 0))] "split_di (&operands[0], 1, &operands[3], &operands[4]);") -(define_split +(define_split [(set (match_operand:DI 0 "register_operand" "") (zero_extend:DI (match_operand:SI 1 "register_operand" ""))) (clobber (reg:CC FLAGS_REG))] @@ -3229,7 +3229,7 @@ [(set (match_dup 4) (const_int 0))] "split_di (&operands[0], 1, &operands[3], &operands[4]);") -(define_split +(define_split [(set (match_operand:DI 0 "nonimmediate_operand" "") (zero_extend:DI (match_operand:SI 1 "general_operand" ""))) (clobber (reg:CC FLAGS_REG))] @@ -3308,7 +3308,7 @@ (set_attr "mode" "DI")]) ;; Extend to memory case when source register does die. -(define_split +(define_split [(set (match_operand:DI 0 "memory_operand" "") (sign_extend:DI (match_operand:SI 1 "register_operand" ""))) (clobber (reg:CC FLAGS_REG)) @@ -3323,7 +3323,7 @@ "split_di (&operands[0], 1, &operands[3], &operands[4]);") ;; Extend to memory case when source register does not die. -(define_split +(define_split [(set (match_operand:DI 0 "memory_operand" "") (sign_extend:DI (match_operand:SI 1 "register_operand" ""))) (clobber (reg:CC FLAGS_REG)) @@ -3353,7 +3353,7 @@ ;; Extend to register case. Optimize case where source and destination ;; registers match and cases where we can use cltd. -(define_split +(define_split [(set (match_operand:DI 0 "register_operand" "") (sign_extend:DI (match_operand:SI 1 "register_operand" ""))) (clobber (reg:CC FLAGS_REG)) @@ -3482,7 +3482,7 @@ ;; These are all no-ops in the model used for the 80387. So just ;; emit moves. -;; %%% Kill these when call knows how to work out a DFmode push earlier. +;; %%% Kill these when call knows how to work out a DFmode push earlier. (define_insn "*dummy_extendsfdf2" [(set (match_operand:DF 0 "push_operand" "=<") (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "fY")))] @@ -4365,7 +4365,7 @@ (set_attr "i387_cw" "trunc") (set_attr "mode" "DI")]) -(define_split +(define_split [(set (match_operand:DI 0 "register_operand" "") (fix:DI (match_operand 1 "register_operand" ""))) (use (match_operand:HI 2 "memory_operand" "")) @@ -4380,7 +4380,7 @@ (set (match_dup 0) (match_dup 4))] "") -(define_split +(define_split [(set (match_operand:DI 0 "memory_operand" "") (fix:DI (match_operand 1 "register_operand" ""))) (use (match_operand:HI 2 "memory_operand" "")) @@ -4421,7 +4421,7 @@ (set_attr "i387_cw" "trunc") (set_attr "mode" "")]) -(define_split +(define_split [(set (match_operand:X87MODEI12 0 "register_operand" "") (fix:X87MODEI12 (match_operand 1 "register_operand" ""))) (use (match_operand:HI 2 "memory_operand" "")) @@ -4434,7 +4434,7 @@ (set (match_dup 0) (match_dup 4))] "") -(define_split +(define_split [(set (match_operand:X87MODEI12 0 "memory_operand" "") (fix:X87MODEI12 (match_operand 1 "register_operand" ""))) (use (match_operand:HI 2 "memory_operand" "")) @@ -4913,7 +4913,7 @@ (define_insn "*addsi3_carry_zext" [(set (match_operand:DI 0 "register_operand" "=r") - (zero_extend:DI + (zero_extend:DI (plus:SI (plus:SI (match_operand:SI 3 "ix86_carry_flag_operator" "") (match_operand:SI 1 "nonimmediate_operand" "%0")) (match_operand:SI 2 "general_operand" "rim")))) @@ -5222,7 +5222,7 @@ (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0") (match_operand:DI 2 "x86_64_general_operand" "rme,re")) - (const_int 0))) + (const_int 0))) (set (match_operand:DI 0 "nonimmediate_operand" "=r,rm") (plus:DI (match_dup 1) (match_dup 2)))] "TARGET_64BIT && ix86_match_ccmode (insn, CCGOCmode) @@ -5369,7 +5369,7 @@ (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0") (match_operand:DI 2 "x86_64_general_operand" "rme")) - (const_int 0))) + (const_int 0))) (clobber (match_scratch:DI 0 "=r"))] "TARGET_64BIT && ix86_match_ccmode (insn, CCGOCmode) @@ -5568,7 +5568,7 @@ (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0") (match_operand:SI 2 "general_operand" "rmni,rni")) - (const_int 0))) + (const_int 0))) (set (match_operand:SI 0 "nonimmediate_operand" "=r,rm") (plus:SI (match_dup 1) (match_dup 2)))] "ix86_match_ccmode (insn, CCGOCmode) @@ -5616,7 +5616,7 @@ (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0") (match_operand:SI 2 "general_operand" "rmni")) - (const_int 0))) + (const_int 0))) (set (match_operand:DI 0 "register_operand" "=r") (zero_extend:DI (plus:SI (match_dup 1) (match_dup 2))))] "TARGET_64BIT && ix86_match_ccmode (insn, CCGOCmode) @@ -5794,7 +5794,7 @@ (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0") (match_operand:SI 2 "general_operand" "rmni")) - (const_int 0))) + (const_int 0))) (clobber (match_scratch:SI 0 "=r"))] "ix86_match_ccmode (insn, CCGOCmode) && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM) @@ -5934,7 +5934,7 @@ (compare (plus:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0") (match_operand:HI 2 "general_operand" "rmni,rni")) - (const_int 0))) + (const_int 0))) (set (match_operand:HI 0 "nonimmediate_operand" "=r,rm") (plus:HI (match_dup 1) (match_dup 2)))] "ix86_match_ccmode (insn, CCGOCmode) @@ -6054,7 +6054,7 @@ (compare (plus:HI (match_operand:HI 1 "nonimmediate_operand" "%0") (match_operand:HI 2 "general_operand" "rmni")) - (const_int 0))) + (const_int 0))) (clobber (match_scratch:HI 0 "=r"))] "ix86_match_ccmode (insn, CCGOCmode) && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)" @@ -7483,7 +7483,7 @@ (match_operand:DF 2 "nonimmediate_operand" "")))] "TARGET_80387 || (TARGET_SSE2 && TARGET_SSE_MATH)" "") - + (define_expand "divsf3" [(set (match_operand:SF 0 "register_operand" "") (div:SF (match_operand:SF 1 "register_operand" "") @@ -8161,7 +8161,7 @@ gcc_assert (INTVAL (operands[2]) == 0xffff); mode = HImode; } - + operands[1] = gen_lowpart (mode, operands[1]); if (mode == QImode) return "movz{bq|x}\t{%1,%0|%0, %1}"; @@ -8226,7 +8226,7 @@ gcc_assert (INTVAL (operands[2]) == 0xffff); mode = HImode; } - + operands[1] = gen_lowpart (mode, operands[1]); if (mode == QImode) return "movz{bl|x}\t{%1,%0|%0, %1}"; @@ -8270,7 +8270,7 @@ [(parallel [(set (zero_extract:SI (match_dup 0) (const_int 8) (const_int 8)) - (xor:SI + (xor:SI (zero_extract:SI (match_dup 0) (const_int 8) (const_int 8)) @@ -8458,7 +8458,7 @@ [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "=Q") (const_int 8) (const_int 8)) - (and:SI + (and:SI (zero_extract:SI (match_operand 1 "ext_register_operand" "0") (const_int 8) @@ -8487,7 +8487,7 @@ (set (zero_extract:SI (match_operand 0 "ext_register_operand" "=Q") (const_int 8) (const_int 8)) - (and:SI + (and:SI (zero_extract:SI (match_dup 1) (const_int 8) @@ -8503,7 +8503,7 @@ [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "=Q") (const_int 8) (const_int 8)) - (and:SI + (and:SI (zero_extract:SI (match_operand 1 "ext_register_operand" "0") (const_int 8) @@ -8521,7 +8521,7 @@ [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "=Q") (const_int 8) (const_int 8)) - (and:SI + (and:SI (zero_extract:SI (match_operand 1 "ext_register_operand" "0") (const_int 8) @@ -8864,7 +8864,7 @@ [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "=Q") (const_int 8) (const_int 8)) - (ior:SI + (ior:SI (zero_extract:SI (match_operand 1 "ext_register_operand" "0") (const_int 8) @@ -8881,7 +8881,7 @@ [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "=Q") (const_int 8) (const_int 8)) - (ior:SI + (ior:SI (zero_extract:SI (match_operand 1 "ext_register_operand" "0") (const_int 8) @@ -8900,7 +8900,7 @@ [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "=Q") (const_int 8) (const_int 8)) - (ior:SI + (ior:SI (zero_extract:SI (match_operand 1 "ext_register_operand" "0") (const_int 8) @@ -8919,7 +8919,7 @@ [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "=Q") (const_int 8) (const_int 8)) - (ior:SI + (ior:SI (zero_extract:SI (match_operand 1 "ext_register_operand" "0") (const_int 8) (const_int 8)) @@ -9202,7 +9202,7 @@ [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "=Q") (const_int 8) (const_int 8)) - (xor:SI + (xor:SI (zero_extract:SI (match_operand 1 "ext_register_operand" "0") (const_int 8) @@ -9219,7 +9219,7 @@ [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "=Q") (const_int 8) (const_int 8)) - (xor:SI + (xor:SI (zero_extract:SI (match_operand 1 "ext_register_operand" "0") (const_int 8) @@ -9238,7 +9238,7 @@ [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "=Q") (const_int 8) (const_int 8)) - (xor:SI + (xor:SI (zero_extract:SI (match_operand 1 "ext_register_operand" "0") (const_int 8) @@ -9257,7 +9257,7 @@ [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "=Q") (const_int 8) (const_int 8)) - (xor:SI + (xor:SI (zero_extract:SI (match_operand 1 "ext_register_operand" "0") (const_int 8) (const_int 8)) @@ -9325,7 +9325,7 @@ (set (zero_extract:SI (match_operand 0 "ext_register_operand" "=q") (const_int 8) (const_int 8)) - (xor:SI + (xor:SI (zero_extract:SI (match_dup 1) (const_int 8) (const_int 8)) (match_dup 2)))] "!TARGET_64BIT && ix86_match_ccmode (insn, CCNOmode)" @@ -9346,7 +9346,7 @@ (set (zero_extract:SI (match_operand 0 "ext_register_operand" "=Q") (const_int 8) (const_int 8)) - (xor:SI + (xor:SI (zero_extract:SI (match_dup 1) (const_int 8) (const_int 8)) (match_dup 2)))] "TARGET_64BIT && ix86_match_ccmode (insn, CCNOmode)" @@ -9368,7 +9368,7 @@ (set (zero_extract:SI (match_operand 0 "ext_register_operand" "") (const_int 8) (const_int 8)) - (xor:SI + (xor:SI (zero_extract:SI (match_dup 1) (const_int 8) (const_int 8)) (match_dup 2)))])] "" @@ -9867,7 +9867,7 @@ enum machine_mode mode = GET_MODE (operands[0]); enum machine_mode vmode = GET_MODE (operands[2]); rtx tmp; - + operands[0] = simplify_gen_subreg (vmode, operands[0], mode, 0); operands[1] = simplify_gen_subreg (vmode, operands[1], mode, 0); if (operands_match_p (operands[0], operands[2])) @@ -9891,7 +9891,7 @@ "reload_completed" [(parallel [(set (match_dup 0) (match_dup 1)) (clobber (reg:CC FLAGS_REG))])] -{ +{ rtx tmp; operands[0] = gen_lowpart (SImode, operands[0]); if (GET_CODE (operands[1]) == ABS) @@ -9998,7 +9998,7 @@ operands[1] = tmp; }) -;; Conditionalize these after reload. If they match before reload, we +;; Conditionalize these after reload. If they match before reload, we ;; lose the clobber and ability to use integer instructions. (define_insn "*negsf2_1" @@ -11415,8 +11415,8 @@ && (TARGET_SHIFT1 || optimize_size)" "sar{q}\t%0" [(set_attr "type" "ishift") - (set (attr "length") - (if_then_else (match_operand:DI 0 "register_operand" "") + (set (attr "length") + (if_then_else (match_operand:DI 0 "register_operand" "") (const_string "2") (const_string "*")))]) @@ -11448,8 +11448,8 @@ && ix86_binary_operator_ok (ASHIFTRT, DImode, operands)" "sar{q}\t%0" [(set_attr "type" "ishift") - (set (attr "length") - (if_then_else (match_operand:DI 0 "register_operand" "") + (set (attr "length") + (if_then_else (match_operand:DI 0 "register_operand" "") (const_string "2") (const_string "*")))]) @@ -11628,8 +11628,8 @@ && (TARGET_SHIFT1 || optimize_size)" "sar{l}\t%0" [(set_attr "type" "ishift") - (set (attr "length") - (if_then_else (match_operand:SI 0 "register_operand" "") + (set (attr "length") + (if_then_else (match_operand:SI 0 "register_operand" "") (const_string "2") (const_string "*")))]) @@ -11684,8 +11684,8 @@ && ix86_binary_operator_ok (ASHIFTRT, SImode, operands)" "sar{l}\t%0" [(set_attr "type" "ishift") - (set (attr "length") - (if_then_else (match_operand:SI 0 "register_operand" "") + (set (attr "length") + (if_then_else (match_operand:SI 0 "register_operand" "") (const_string "2") (const_string "*")))]) @@ -11785,8 +11785,8 @@ && (TARGET_SHIFT1 || optimize_size)" "sar{w}\t%0" [(set_attr "type" "ishift") - (set (attr "length") - (if_then_else (match_operand 0 "register_operand" "") + (set (attr "length") + (if_then_else (match_operand 0 "register_operand" "") *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-10@FreeBSD.ORG Wed Dec 18 21:49:18 2013 Return-Path: Delivered-To: svn-src-stable-10@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 ESMTPS id A42F5169; Wed, 18 Dec 2013 21:49:18 +0000 (UTC) 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 7549F18AB; Wed, 18 Dec 2013 21:49:18 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBILnIbd087377; Wed, 18 Dec 2013 21:49:18 GMT (envelope-from rodrigc@svn.freebsd.org) Received: (from rodrigc@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBILnILo087376; Wed, 18 Dec 2013 21:49:18 GMT (envelope-from rodrigc@svn.freebsd.org) Message-Id: <201312182149.rBILnILo087376@svn.freebsd.org> From: Craig Rodrigues Date: Wed, 18 Dec 2013 21:49:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259577 - stable/10/release/doc/en_US.ISO8859-1/relnotes X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Dec 2013 21:49:18 -0000 Author: rodrigc Date: Wed Dec 18 21:49:17 2013 New Revision: 259577 URL: http://svnweb.freebsd.org/changeset/base/259577 Log: MFC r259571: Add SVN revision numbers for Mellanox updates. MFC r259573: Add SVN revision numbers for Chelsio updates. MFC r259574: Indent. Modified: stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml Directory Properties: stable/10/ (props changed) Modified: stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml ============================================================================== --- stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml Wed Dec 18 21:45:46 2013 (r259576) +++ stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml Wed Dec 18 21:49:17 2013 (r259577) @@ -248,16 +248,18 @@ The &man.wpi.4; driver has been updated to include a number of stability fixes. - The &man.cxgbe.4; driver has been updated to support + The &man.cxgbe.4; driver has been updated to support 40G/10G Ethernet NICs based on Chelsio's Terminator 5 (T5) ASIC. - The iw_cxgbe driver has been added. This is an experimental iWARP/RDMA driver + The iw_cxgbe driver has been added. This is an + experimental iWARP/RDMA driver (kernel verbs only) for Chelsio's T4 and T5 based cards. - The Open Fabrics Enterprise Distribution (OFED) and OFED Infiniband core has been + The Open Fabrics Enterprise Distribution (OFED) and + OFED Infiniband core has been updated to the same version as supplied by Linux version 3.7 - The Mellanox Infiniband driver has been updated to firmware + The Mellanox Infiniband driver has been updated to firmware version 2.30.3200 for ConnectX3 NICs. Support has been added for ConnectX3 VPI NICs, where each port can be used as Infiniband 56 GB/s or Ethernet 40 GB/s. Support has been added for dynamically loading kernel modules for Infiniband core (ibcore) and From owner-svn-src-stable-10@FreeBSD.ORG Thu Dec 19 02:32:09 2013 Return-Path: Delivered-To: svn-src-stable-10@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 ESMTPS id 5EF996B3; Thu, 19 Dec 2013 02:32:09 +0000 (UTC) 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 3EFBD1F53; Thu, 19 Dec 2013 02:32:09 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBJ2W8wk091456; Thu, 19 Dec 2013 02:32:08 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBJ2W8jn091454; Thu, 19 Dec 2013 02:32:08 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201312190232.rBJ2W8jn091454@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Thu, 19 Dec 2013 02:32:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259583 - in stable/10/contrib/gcc: . config/rs6000 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Dec 2013 02:32:09 -0000 Author: pfg Date: Thu Dec 19 02:32:07 2013 New Revision: 259583 URL: http://svnweb.freebsd.org/changeset/base/259583 Log: MFC r258651, r258943: gcc: Altivec register adjustments from Apple. gcc: On rs6000 update sp_offset depending only on size. Tested by: Justin Hibbits Obtained from: gcc pre-4.3 (rev. 124763, 125116; GPLv2) Modified: stable/10/contrib/gcc/ChangeLog.gcc43 stable/10/contrib/gcc/config/rs6000/rs6000.c Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/gcc/ChangeLog.gcc43 ============================================================================== --- stable/10/contrib/gcc/ChangeLog.gcc43 Thu Dec 19 01:38:25 2013 (r259582) +++ stable/10/contrib/gcc/ChangeLog.gcc43 Thu Dec 19 02:32:07 2013 (r259583) @@ -10,12 +10,20 @@ * doc/extend.texi: Document the 0b-prefixed binary integer constant extension. -2007-05-31 Eric Christopher +2007-05-31 Eric Christopher (r125246) * expr.c (convert_move): Assert that we don't have a BLKmode operand. (store_expr): Handle BLKmode moves by calling emit_block_move. +2007-05-27 Eric Christopher (r125116) + + * config/rs6000/rs6000.c (rs6000_emit_prologue): Update + sp_offset depending on stack size. Save r12 depending + on registers we're saving later. + (rs6000_emit_epilogue): Update sp_offset depending only + on stack size. + 2007-05-24 Richard Sandiford (r125037) * postreload-gcse.c (reg_changed_after_insn_p): New function. @@ -31,6 +39,12 @@ regs_invalidated_by_call, rather than just checking the membership of REGNO (REG). +2007-05-16 Eric Christopher (r124763) + + * config/rs6000/rs6000.c (rs6000_emit_prologue): Move altivec register + saving after stack push. Set sp_offset whenever we push. + (rs6000_emit_epilogue): Move altivec register restore before stack push. + 2007-05-03 Ian Lance Taylor (r124381) * config/rs6000/rs6000.c (rs6000_override_options): Don't set Modified: stable/10/contrib/gcc/config/rs6000/rs6000.c ============================================================================== --- stable/10/contrib/gcc/config/rs6000/rs6000.c Thu Dec 19 01:38:25 2013 (r259582) +++ stable/10/contrib/gcc/config/rs6000/rs6000.c Thu Dec 19 02:32:07 2013 (r259583) @@ -14466,77 +14466,6 @@ rs6000_emit_prologue (void) sp_offset = info->total_size; } - /* Save AltiVec registers if needed. */ - if (!WORLD_SAVE_P (info) && TARGET_ALTIVEC_ABI && info->altivec_size != 0) - { - int i; - - /* There should be a non inline version of this, for when we - are saving lots of vector registers. */ - for (i = info->first_altivec_reg_save; i <= LAST_ALTIVEC_REGNO; ++i) - if (info->vrsave_mask & ALTIVEC_REG_BIT (i)) - { - rtx areg, savereg, mem; - int offset; - - offset = info->altivec_save_offset + sp_offset - + 16 * (i - info->first_altivec_reg_save); - - savereg = gen_rtx_REG (V4SImode, i); - - areg = gen_rtx_REG (Pmode, 0); - emit_move_insn (areg, GEN_INT (offset)); - - /* AltiVec addressing mode is [reg+reg]. */ - mem = gen_frame_mem (V4SImode, - gen_rtx_PLUS (Pmode, frame_reg_rtx, areg)); - - insn = emit_move_insn (mem, savereg); - - rs6000_frame_related (insn, frame_ptr_rtx, info->total_size, - areg, GEN_INT (offset)); - } - } - - /* VRSAVE is a bit vector representing which AltiVec registers - are used. The OS uses this to determine which vector - registers to save on a context switch. We need to save - VRSAVE on the stack frame, add whatever AltiVec registers we - used in this function, and do the corresponding magic in the - epilogue. */ - - if (TARGET_ALTIVEC && TARGET_ALTIVEC_VRSAVE - && info->vrsave_mask != 0) - { - rtx reg, mem, vrsave; - int offset; - - /* Get VRSAVE onto a GPR. Note that ABI_V4 might be using r12 - as frame_reg_rtx and r11 as the static chain pointer for - nested functions. */ - reg = gen_rtx_REG (SImode, 0); - vrsave = gen_rtx_REG (SImode, VRSAVE_REGNO); - if (TARGET_MACHO) - emit_insn (gen_get_vrsave_internal (reg)); - else - emit_insn (gen_rtx_SET (VOIDmode, reg, vrsave)); - - if (!WORLD_SAVE_P (info)) - { - /* Save VRSAVE. */ - offset = info->vrsave_save_offset + sp_offset; - mem = gen_frame_mem (SImode, - gen_rtx_PLUS (Pmode, frame_reg_rtx, - GEN_INT (offset))); - insn = emit_move_insn (mem, reg); - } - - /* Include the registers in the mask. */ - emit_insn (gen_iorsi3 (reg, reg, GEN_INT ((int) info->vrsave_mask))); - - insn = emit_insn (generate_set_vrsave (reg, info, 0)); - } - /* If we use the link register, get it into r0. */ if (!WORLD_SAVE_P (info) && info->lr_save_p) { @@ -14774,7 +14703,19 @@ rs6000_emit_prologue (void) for which it was done previously. */ if (!WORLD_SAVE_P (info) && info->push_p && !(DEFAULT_ABI == ABI_V4 || current_function_calls_eh_return)) - rs6000_emit_allocate_stack (info->total_size, FALSE); + { + if (info->total_size < 32767) + sp_offset = info->total_size; + else + frame_reg_rtx = frame_ptr_rtx; + rs6000_emit_allocate_stack (info->total_size, + (frame_reg_rtx != sp_reg_rtx + && ((info->altivec_size != 0) + || (info->vrsave_mask != 0) + ))); + if (frame_reg_rtx != sp_reg_rtx) + rs6000_emit_stack_tie (); + } /* Set frame pointer, if needed. */ if (frame_pointer_needed) @@ -14784,6 +14725,78 @@ rs6000_emit_prologue (void) RTX_FRAME_RELATED_P (insn) = 1; } + /* Save AltiVec registers if needed. Save here because the red zone does + not include AltiVec registers. */ + if (!WORLD_SAVE_P (info) && TARGET_ALTIVEC_ABI && info->altivec_size != 0) + { + int i; + + /* There should be a non inline version of this, for when we + are saving lots of vector registers. */ + for (i = info->first_altivec_reg_save; i <= LAST_ALTIVEC_REGNO; ++i) + if (info->vrsave_mask & ALTIVEC_REG_BIT (i)) + { + rtx areg, savereg, mem; + int offset; + + offset = info->altivec_save_offset + sp_offset + + 16 * (i - info->first_altivec_reg_save); + + savereg = gen_rtx_REG (V4SImode, i); + + areg = gen_rtx_REG (Pmode, 0); + emit_move_insn (areg, GEN_INT (offset)); + + /* AltiVec addressing mode is [reg+reg]. */ + mem = gen_frame_mem (V4SImode, + gen_rtx_PLUS (Pmode, frame_reg_rtx, areg)); + + insn = emit_move_insn (mem, savereg); + + rs6000_frame_related (insn, frame_ptr_rtx, info->total_size, + areg, GEN_INT (offset)); + } + } + + /* VRSAVE is a bit vector representing which AltiVec registers + are used. The OS uses this to determine which vector + registers to save on a context switch. We need to save + VRSAVE on the stack frame, add whatever AltiVec registers we + used in this function, and do the corresponding magic in the + epilogue. */ + + if (TARGET_ALTIVEC && TARGET_ALTIVEC_VRSAVE + && info->vrsave_mask != 0) + { + rtx reg, mem, vrsave; + int offset; + + /* Get VRSAVE onto a GPR. Note that ABI_V4 might be using r12 + as frame_reg_rtx and r11 as the static chain pointer for + nested functions. */ + reg = gen_rtx_REG (SImode, 0); + vrsave = gen_rtx_REG (SImode, VRSAVE_REGNO); + if (TARGET_MACHO) + emit_insn (gen_get_vrsave_internal (reg)); + else + emit_insn (gen_rtx_SET (VOIDmode, reg, vrsave)); + + if (!WORLD_SAVE_P (info)) + { + /* Save VRSAVE. */ + offset = info->vrsave_save_offset + sp_offset; + mem = gen_frame_mem (SImode, + gen_rtx_PLUS (Pmode, frame_reg_rtx, + GEN_INT (offset))); + insn = emit_move_insn (mem, reg); + } + + /* Include the registers in the mask. */ + emit_insn (gen_iorsi3 (reg, reg, GEN_INT ((int) info->vrsave_mask))); + + insn = emit_insn (generate_set_vrsave (reg, info, 0)); + } + /* If we are using RS6000_PIC_OFFSET_TABLE_REGNUM, we need to set it up. */ if ((TARGET_TOC && TARGET_MINIMAL_TOC && get_pool_size () != 0) || (DEFAULT_ABI == ABI_V4 @@ -15041,33 +15054,9 @@ rs6000_emit_epilogue (int sibcall) return; } - /* If we have a frame pointer, a call to alloca, or a large stack - frame, restore the old stack pointer using the backchain. Otherwise, - we know what size to update it with. */ - if (use_backchain_to_restore_sp) - { - /* Under V.4, don't reset the stack pointer until after we're done - loading the saved registers. */ - if (DEFAULT_ABI == ABI_V4) - frame_reg_rtx = gen_rtx_REG (Pmode, 11); - - emit_move_insn (frame_reg_rtx, - gen_rtx_MEM (Pmode, sp_reg_rtx)); - } - else if (info->push_p) - { - if (DEFAULT_ABI == ABI_V4 - || current_function_calls_eh_return) - sp_offset = info->total_size; - else - { - emit_insn (TARGET_32BIT - ? gen_addsi3 (sp_reg_rtx, sp_reg_rtx, - GEN_INT (info->total_size)) - : gen_adddi3 (sp_reg_rtx, sp_reg_rtx, - GEN_INT (info->total_size))); - } - } + /* Set sp_offset based on the stack push from the prologue. */ + if (info->total_size < 32767) + sp_offset = info->total_size; /* Restore AltiVec registers if needed. */ if (TARGET_ALTIVEC_ABI && info->altivec_size != 0) @@ -15108,6 +15097,36 @@ rs6000_emit_epilogue (int sibcall) emit_insn (generate_set_vrsave (reg, info, 1)); } + sp_offset = 0; + + /* If we have a frame pointer, a call to alloca, or a large stack + frame, restore the old stack pointer using the backchain. Otherwise, + we know what size to update it with. */ + if (use_backchain_to_restore_sp) + { + /* Under V.4, don't reset the stack pointer until after we're done + loading the saved registers. */ + if (DEFAULT_ABI == ABI_V4) + frame_reg_rtx = gen_rtx_REG (Pmode, 11); + + emit_move_insn (frame_reg_rtx, + gen_rtx_MEM (Pmode, sp_reg_rtx)); + } + else if (info->push_p) + { + if (DEFAULT_ABI == ABI_V4 + || current_function_calls_eh_return) + sp_offset = info->total_size; + else + { + emit_insn (TARGET_32BIT + ? gen_addsi3 (sp_reg_rtx, sp_reg_rtx, + GEN_INT (info->total_size)) + : gen_adddi3 (sp_reg_rtx, sp_reg_rtx, + GEN_INT (info->total_size))); + } + } + /* Get the old lr if we saved it. */ if (info->lr_save_p) { From owner-svn-src-stable-10@FreeBSD.ORG Thu Dec 19 02:39:13 2013 Return-Path: Delivered-To: svn-src-stable-10@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 ESMTPS id 0E0DF85E; Thu, 19 Dec 2013 02:39:13 +0000 (UTC) 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 ED2961F86; Thu, 19 Dec 2013 02:39:12 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBJ2dCX0092316; Thu, 19 Dec 2013 02:39:12 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBJ2dBnN092307; Thu, 19 Dec 2013 02:39:11 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201312190239.rBJ2dBnN092307@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Thu, 19 Dec 2013 02:39:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259584 - in stable/10/contrib/gcc: . cp X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Dec 2013 02:39:13 -0000 Author: pfg Date: Thu Dec 19 02:39:11 2013 New Revision: 259584 URL: http://svnweb.freebsd.org/changeset/base/259584 Log: MFC r258731: gcc: Make use of TREE_OVERFLOW_P. While it was brought in r258179 only to fix a build issue, bringing the rest of the change has the advantage of fixing GCC/19978. Obtained from: gcc 4.3 (rev. 120505; GPLv2) Modified: stable/10/contrib/gcc/ChangeLog.gcc43 stable/10/contrib/gcc/c-common.c stable/10/contrib/gcc/c-typeck.c stable/10/contrib/gcc/cp/ChangeLog.gcc43 stable/10/contrib/gcc/cp/semantics.c Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/gcc/ChangeLog.gcc43 ============================================================================== --- stable/10/contrib/gcc/ChangeLog.gcc43 Thu Dec 19 02:32:07 2013 (r259583) +++ stable/10/contrib/gcc/ChangeLog.gcc43 Thu Dec 19 02:39:11 2013 (r259584) @@ -348,6 +348,16 @@ * config.gcc: Support core2 processor. +2007-01-05 Manuel Lopez-Ibanez + + PR c/19978 + * tree.h (TREE_OVERFLOW_P): New. + * c-typeck.c (parser_build_unary_op): Warn only if result + overflowed and operands did not. + (parser_build_binary_op): Likewise. + (convert_for_assignment): Remove redundant overflow_warning. + * c-common.c (overflow_warning): Don't check or set TREE_OVERFLOW. + 2006-12-13 Ian Lance Taylor (r119855) PR c++/19564 Modified: stable/10/contrib/gcc/c-common.c ============================================================================== --- stable/10/contrib/gcc/c-common.c Thu Dec 19 02:32:07 2013 (r259583) +++ stable/10/contrib/gcc/c-common.c Thu Dec 19 02:39:11 2013 (r259584) @@ -916,39 +916,45 @@ constant_expression_warning (tree value) pedwarn ("overflow in constant expression"); } -/* Print a warning if an expression had overflow in folding. +/* Print a warning if an expression had overflow in folding and its + operands hadn't. + Invoke this function on every expression that (1) appears in the source code, and - (2) might be a constant expression that overflowed, and + (2) is a constant expression that overflowed, and (3) is not already checked by convert_and_check; - however, do not invoke this function on operands of explicit casts. */ + however, do not invoke this function on operands of explicit casts + or when the expression is the result of an operator and any operand + already overflowed. */ void overflow_warning (tree value) { - if ((TREE_CODE (value) == INTEGER_CST - || (TREE_CODE (value) == COMPLEX_CST - && TREE_CODE (TREE_REALPART (value)) == INTEGER_CST)) - && TREE_OVERFLOW (value)) - { - TREE_OVERFLOW (value) = 0; - if (skip_evaluation == 0) - warning (OPT_Woverflow, "integer overflow in expression"); - } - else if ((TREE_CODE (value) == REAL_CST - || (TREE_CODE (value) == COMPLEX_CST - && TREE_CODE (TREE_REALPART (value)) == REAL_CST)) - && TREE_OVERFLOW (value)) - { - TREE_OVERFLOW (value) = 0; - if (skip_evaluation == 0) - warning (OPT_Woverflow, "floating point overflow in expression"); - } - else if (TREE_CODE (value) == VECTOR_CST && TREE_OVERFLOW (value)) - { - TREE_OVERFLOW (value) = 0; - if (skip_evaluation == 0) - warning (OPT_Woverflow, "vector overflow in expression"); + if (skip_evaluation) return; + + switch (TREE_CODE (value)) + { + case INTEGER_CST: + warning (OPT_Woverflow, "integer overflow in expression"); + break; + + case REAL_CST: + warning (OPT_Woverflow, "floating point overflow in expression"); + break; + + case VECTOR_CST: + warning (OPT_Woverflow, "vector overflow in expression"); + break; + + case COMPLEX_CST: + if (TREE_CODE (TREE_REALPART (value)) == INTEGER_CST) + warning (OPT_Woverflow, "complex integer overflow in expression"); + else if (TREE_CODE (TREE_REALPART (value)) == REAL_CST) + warning (OPT_Woverflow, "complex floating point overflow in expression"); + break; + + default: + break; } } Modified: stable/10/contrib/gcc/c-typeck.c ============================================================================== --- stable/10/contrib/gcc/c-typeck.c Thu Dec 19 02:32:07 2013 (r259583) +++ stable/10/contrib/gcc/c-typeck.c Thu Dec 19 02:39:11 2013 (r259584) @@ -2616,7 +2616,10 @@ parser_build_unary_op (enum tree_code co result.original_code = ERROR_MARK; result.value = build_unary_op (code, arg.value, 0); - overflow_warning (result.value); + + if (TREE_OVERFLOW_P (result.value) && !TREE_OVERFLOW_P (arg.value)) + overflow_warning (result.value); + return result; } @@ -2660,7 +2663,10 @@ parser_build_binary_op (enum tree_code c warning (OPT_Waddress, "comparison with string literal results in unspecified behaviour"); - overflow_warning (result.value); + if (TREE_OVERFLOW_P (result.value) + && !TREE_OVERFLOW_P (arg1.value) + && !TREE_OVERFLOW_P (arg2.value)) + overflow_warning (result.value); return result; } @@ -3847,10 +3853,7 @@ convert_for_assignment (tree type, tree } if (TYPE_MAIN_VARIANT (type) == TYPE_MAIN_VARIANT (rhstype)) - { - overflow_warning (rhs); - return rhs; - } + return rhs; if (coder == VOID_TYPE) { Modified: stable/10/contrib/gcc/cp/ChangeLog.gcc43 ============================================================================== --- stable/10/contrib/gcc/cp/ChangeLog.gcc43 Thu Dec 19 02:32:07 2013 (r259583) +++ stable/10/contrib/gcc/cp/ChangeLog.gcc43 Thu Dec 19 02:39:11 2013 (r259584) @@ -20,6 +20,12 @@ TREE_OVERFLOW_P is true for the result and not for any of the operands. +2007-01-05 Manuel Lopez-Ibanez + + PR c/19978 + * semantics.c (finish_unary_op_expr): Warn only if result + overflowed and operands did not. + 2006-10-31 Geoffrey Keating (r118360) * name-lookup.c (get_anonymous_namespace_name): New. Modified: stable/10/contrib/gcc/cp/semantics.c ============================================================================== --- stable/10/contrib/gcc/cp/semantics.c Thu Dec 19 02:32:07 2013 (r259583) +++ stable/10/contrib/gcc/cp/semantics.c Thu Dec 19 02:39:11 2013 (r259584) @@ -2012,7 +2012,9 @@ finish_unary_op_expr (enum tree_code cod result = copy_node (result); TREE_NEGATED_INT (result) = 1; } - overflow_warning (result); + if (TREE_OVERFLOW_P (result) && !TREE_OVERFLOW_P (expr)) + overflow_warning (result); + return result; } From owner-svn-src-stable-10@FreeBSD.ORG Thu Dec 19 05:36:07 2013 Return-Path: Delivered-To: svn-src-stable-10@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 ESMTPS id A7E50A42; Thu, 19 Dec 2013 05:36:07 +0000 (UTC) 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 941AC1AF5; Thu, 19 Dec 2013 05:36: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 rBJ5a7q5059738; Thu, 19 Dec 2013 05:36:07 GMT (envelope-from truckman@svn.freebsd.org) Received: (from truckman@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBJ5a708059733; Thu, 19 Dec 2013 05:36:07 GMT (envelope-from truckman@svn.freebsd.org) Message-Id: <201312190536.rBJ5a708059733@svn.freebsd.org> From: Don Lewis Date: Thu, 19 Dec 2013 05:36:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259592 - in stable/10/sys/dev/usb: . serial X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Dec 2013 05:36:07 -0000 Author: truckman Date: Thu Dec 19 05:36:06 2013 New Revision: 259592 URL: http://svnweb.freebsd.org/changeset/base/259592 Log: MFC r258363: Add alternate ID for Novatel MiFi 2200 CDMA, which is used by my Virgin Mobile branded device. It needs the U3GINIT_SCSIEJECT quirk. Modified: stable/10/sys/dev/usb/serial/u3g.c stable/10/sys/dev/usb/usbdevs Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/usb/serial/u3g.c ============================================================================== --- stable/10/sys/dev/usb/serial/u3g.c Thu Dec 19 05:28:43 2013 (r259591) +++ stable/10/sys/dev/usb/serial/u3g.c Thu Dec 19 05:36:06 2013 (r259592) @@ -345,6 +345,7 @@ static const STRUCT_USB_HOST_ID u3g_devs U3G_DEV(NOVATEL, MC547, 0), U3G_DEV(NOVATEL, MC950D, 0), U3G_DEV(NOVATEL, MIFI2200, U3GINIT_SCSIEJECT), + U3G_DEV(NOVATEL, MIFI2200V, U3GINIT_SCSIEJECT), U3G_DEV(NOVATEL, U720, 0), U3G_DEV(NOVATEL, U727, 0), U3G_DEV(NOVATEL, U727_2, 0), Modified: stable/10/sys/dev/usb/usbdevs ============================================================================== --- stable/10/sys/dev/usb/usbdevs Thu Dec 19 05:28:43 2013 (r259591) +++ stable/10/sys/dev/usb/usbdevs Thu Dec 19 05:36:06 2013 (r259592) @@ -3147,6 +3147,7 @@ product NOVATEL EU870D 0x2420 Expedite product NOVATEL U727 0x4100 Merlin U727 CDMA product NOVATEL MC950D 0x4400 Novatel MC950D HSUPA product NOVATEL ZEROCD 0x5010 Novatel ZeroCD +product NOVATEL MIFI2200V 0x5020 Novatel MiFi 2200 CDMA Virgin Mobile product NOVATEL ZEROCD2 0x5030 Novatel ZeroCD product NOVATEL MIFI2200 0x5041 Novatel MiFi 2200 CDMA product NOVATEL U727_2 0x5100 Merlin U727 CDMA From owner-svn-src-stable-10@FreeBSD.ORG Thu Dec 19 06:39:48 2013 Return-Path: Delivered-To: svn-src-stable-10@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 ESMTPS id B2D69909; Thu, 19 Dec 2013 06:39:48 +0000 (UTC) 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 8599D1FDF; Thu, 19 Dec 2013 06:39:48 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBJ6dmur081527; Thu, 19 Dec 2013 06:39:48 GMT (envelope-from truckman@svn.freebsd.org) Received: (from truckman@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBJ6dmKv081526; Thu, 19 Dec 2013 06:39:48 GMT (envelope-from truckman@svn.freebsd.org) Message-Id: <201312190639.rBJ6dmKv081526@svn.freebsd.org> From: Don Lewis Date: Thu, 19 Dec 2013 06:39:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259596 - stable/10/etc/devd X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Dec 2013 06:39:48 -0000 Author: truckman Date: Thu Dec 19 06:39:48 2013 New Revision: 259596 URL: http://svnweb.freebsd.org/changeset/base/259596 Log: Regenerate after r255238, r257044, r259453 (if_run) r255128 (ng_ubt) r259592 (u3g) Modified: stable/10/etc/devd/usb.conf Modified: stable/10/etc/devd/usb.conf ============================================================================== --- stable/10/etc/devd/usb.conf Thu Dec 19 05:51:39 2013 (r259595) +++ stable/10/etc/devd/usb.conf Thu Dec 19 06:39:48 2013 (r259596) @@ -833,7 +833,7 @@ nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; match "vendor" "0x050d"; - match "product" "0x935a"; + match "product" "(0x935a|0x935b)"; action "kldload -n if_run"; }; @@ -2289,7 +2289,7 @@ nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; match "vendor" "0x0b05"; - match "product" "0x17b5"; + match "product" "(0x17b5|0x17cb)"; action "kldload -n ng_ubt"; }; @@ -3665,7 +3665,7 @@ nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; match "vendor" "0x1410"; - match "product" "(0x1100|0x1110|0x1120|0x1130|0x1400|0x1410|0x1420|0x1430|0x1450|0x2100|0x2110|0x2120|0x2130|0x2400|0x2410|0x2420|0x4100|0x4400|0x5010|0x5041|0x5100|0x6000|0x6002|0x7042)"; + match "product" "(0x1100|0x1110|0x1120|0x1130|0x1400|0x1410|0x1420|0x1430|0x1450|0x2100|0x2110|0x2120|0x2130|0x2400|0x2410|0x2420|0x4100|0x4400|0x5010|0x5020|0x5041|0x5100|0x6000|0x6002|0x7042)"; action "kldload -n u3g"; }; @@ -3777,7 +3777,7 @@ nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; match "vendor" "0x148f"; - match "product" "(0x2770|0x2870|0x3070|0x3071|0x3072|0x3370|0x3572|0x8070)"; + match "product" "(0x2770|0x2870|0x3070|0x3071|0x3072|0x3370|0x3572|0x5370|0x5572|0x8070)"; action "kldload -n if_run"; }; @@ -4561,7 +4561,7 @@ nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; match "vendor" "0x2001"; - match "product" "(0x3c09|0x3c0a)"; + match "product" "(0x3c09|0x3c0a|0x3c15|0x3c1a|0x3c1b)"; action "kldload -n if_run"; }; @@ -5260,5 +5260,5 @@ nomatch 32 { action "kldload -n umass"; }; -# 2537 USB entries processed +# 2545 USB entries processed From owner-svn-src-stable-10@FreeBSD.ORG Thu Dec 19 07:12:35 2013 Return-Path: Delivered-To: svn-src-stable-10@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 ESMTPS id 8742741F; Thu, 19 Dec 2013 07:12:35 +0000 (UTC) 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 72C041212; Thu, 19 Dec 2013 07:12:35 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBJ7CZ1g095560; Thu, 19 Dec 2013 07:12:35 GMT (envelope-from truckman@svn.freebsd.org) Received: (from truckman@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBJ7CZRe095559; Thu, 19 Dec 2013 07:12:35 GMT (envelope-from truckman@svn.freebsd.org) Message-Id: <201312190712.rBJ7CZRe095559@svn.freebsd.org> From: Don Lewis Date: Thu, 19 Dec 2013 07:12:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259601 - stable/10/share/man/man4 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Dec 2013 07:12:35 -0000 Author: truckman Date: Thu Dec 19 07:12:34 2013 New Revision: 259601 URL: http://svnweb.freebsd.org/changeset/base/259601 Log: MFC r258629, 258662: r258629: Mention that devd will kldload the driver when the device is connected. Mention that the automatic mode switch from umass to u3g needed by some devices does not work unless the driver is loaded before the device is connected. r258662 (by joel): mdoc: sort sections. Modified: stable/10/share/man/man4/u3g.4 Directory Properties: stable/10/ (props changed) Modified: stable/10/share/man/man4/u3g.4 ============================================================================== --- stable/10/share/man/man4/u3g.4 Thu Dec 19 07:09:28 2013 (r259600) +++ stable/10/share/man/man4/u3g.4 Thu Dec 19 07:12:34 2013 (r259601) @@ -18,7 +18,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 8, 2012 +.Dd November 26, 2013 .Dt U3G 4 .Os .Sh NAME @@ -40,6 +40,9 @@ module at boot time, place the following .Bd -literal -offset indent u3g_load="YES" .Ed +.Pp +If neither of the above is done, the driver will automatically be loaded +by devd(8) when the device is connected. .Sh DESCRIPTION The .Nm @@ -98,6 +101,7 @@ and .Xr ucom 4 , .Xr usb 4 , .Xr usb_quirk 4 , +.Xr devd 8 , .Xr usbconfig 8 .Sh HISTORY The @@ -117,3 +121,7 @@ driver was written by and .An Nick Hibma Aq n_hibma@FreeBSD.org . Hardware for testing was provided by AnyWi Technologies, Leiden, NL. +.Sh BUGS +The automatic mode switch from disk mode to modem mode does not work unless +the driver is either built into the kernel or loaded before the device is +connected. From owner-svn-src-stable-10@FreeBSD.ORG Thu Dec 19 07:14:00 2013 Return-Path: Delivered-To: svn-src-stable-10@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 ESMTPS id C245F6A9; Thu, 19 Dec 2013 07:14:00 +0000 (UTC) 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 AC9F61222; Thu, 19 Dec 2013 07:14:00 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBJ7E01b095815; Thu, 19 Dec 2013 07:14:00 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBJ7DxDm095803; Thu, 19 Dec 2013 07:13:59 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201312190713.rBJ7DxDm095803@svn.freebsd.org> From: Hans Petter Selasky Date: Thu, 19 Dec 2013 07:13:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259603 - in stable/10/sys/dev/usb: . controller X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Dec 2013 07:14:00 -0000 Author: hselasky Date: Thu Dec 19 07:13:59 2013 New Revision: 259603 URL: http://svnweb.freebsd.org/changeset/base/259603 Log: MFC r259023 and r259095: Improve the XHCI command timeout recovery handling code. Fix some typos while at it. Modified: stable/10/sys/dev/usb/controller/usb_controller.c stable/10/sys/dev/usb/controller/xhci.c stable/10/sys/dev/usb/usb_bus.h stable/10/sys/dev/usb/usb_controller.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/usb/controller/usb_controller.c ============================================================================== --- stable/10/sys/dev/usb/controller/usb_controller.c Thu Dec 19 07:12:40 2013 (r259602) +++ stable/10/sys/dev/usb/controller/usb_controller.c Thu Dec 19 07:13:59 2013 (r259603) @@ -296,6 +296,28 @@ usb_resume(device_t dev) } /*------------------------------------------------------------------------* + * usb_bus_reset_async_locked + *------------------------------------------------------------------------*/ +void +usb_bus_reset_async_locked(struct usb_bus *bus) +{ + USB_BUS_LOCK_ASSERT(bus, MA_OWNED); + + DPRINTF("\n"); + + if (bus->reset_msg[0].hdr.pm_qentry.tqe_prev != NULL || + bus->reset_msg[1].hdr.pm_qentry.tqe_prev != NULL) { + DPRINTF("Reset already pending\n"); + return; + } + + device_printf(bus->parent, "Resetting controller\n"); + + usb_proc_msignal(USB_BUS_EXPLORE_PROC(bus), + &bus->reset_msg[0], &bus->reset_msg[1]); +} + +/*------------------------------------------------------------------------* * usb_shutdown *------------------------------------------------------------------------*/ static int @@ -419,7 +441,7 @@ usb_bus_detach(struct usb_proc_msg *pm) /*------------------------------------------------------------------------* * usb_bus_suspend * - * This function is used to suspend the USB contoller. + * This function is used to suspend the USB controller. *------------------------------------------------------------------------*/ static void usb_bus_suspend(struct usb_proc_msg *pm) @@ -429,6 +451,8 @@ usb_bus_suspend(struct usb_proc_msg *pm) usb_error_t err; uint8_t do_unlock; + DPRINTF("\n"); + bus = ((struct usb_bus_msg *)pm)->bus; udev = bus->devices[USB_ROOT_HUB_ADDR]; @@ -474,7 +498,7 @@ usb_bus_suspend(struct usb_proc_msg *pm) /*------------------------------------------------------------------------* * usb_bus_resume * - * This function is used to resume the USB contoller. + * This function is used to resume the USB controller. *------------------------------------------------------------------------*/ static void usb_bus_resume(struct usb_proc_msg *pm) @@ -484,6 +508,8 @@ usb_bus_resume(struct usb_proc_msg *pm) usb_error_t err; uint8_t do_unlock; + DPRINTF("\n"); + bus = ((struct usb_bus_msg *)pm)->bus; udev = bus->devices[USB_ROOT_HUB_ADDR]; @@ -533,9 +559,31 @@ usb_bus_resume(struct usb_proc_msg *pm) } /*------------------------------------------------------------------------* + * usb_bus_reset + * + * This function is used to reset the USB controller. + *------------------------------------------------------------------------*/ +static void +usb_bus_reset(struct usb_proc_msg *pm) +{ + struct usb_bus *bus; + + DPRINTF("\n"); + + bus = ((struct usb_bus_msg *)pm)->bus; + + if (bus->bdev == NULL || bus->no_explore != 0) + return; + + /* a suspend and resume will reset the USB controller */ + usb_bus_suspend(pm); + usb_bus_resume(pm); +} + +/*------------------------------------------------------------------------* * usb_bus_shutdown * - * This function is used to shutdown the USB contoller. + * This function is used to shutdown the USB controller. *------------------------------------------------------------------------*/ static void usb_bus_shutdown(struct usb_proc_msg *pm) @@ -750,6 +798,11 @@ usb_attach_sub(device_t dev, struct usb_ bus->resume_msg[1].hdr.pm_callback = &usb_bus_resume; bus->resume_msg[1].bus = bus; + bus->reset_msg[0].hdr.pm_callback = &usb_bus_reset; + bus->reset_msg[0].bus = bus; + bus->reset_msg[1].hdr.pm_callback = &usb_bus_reset; + bus->reset_msg[1].bus = bus; + bus->shutdown_msg[0].hdr.pm_callback = &usb_bus_shutdown; bus->shutdown_msg[0].bus = bus; bus->shutdown_msg[1].hdr.pm_callback = &usb_bus_shutdown; Modified: stable/10/sys/dev/usb/controller/xhci.c ============================================================================== --- stable/10/sys/dev/usb/controller/xhci.c Thu Dec 19 07:12:40 2013 (r259602) +++ stable/10/sys/dev/usb/controller/xhci.c Thu Dec 19 07:13:59 2013 (r259603) @@ -278,6 +278,69 @@ xhci_ctx_get_le64(struct xhci_softc *sc, } #endif +static int +xhci_reset_command_queue_locked(struct xhci_softc *sc) +{ + struct usb_page_search buf_res; + struct xhci_hw_root *phwr; + uint64_t addr; + uint32_t temp; + + DPRINTF("\n"); + + temp = XREAD4(sc, oper, XHCI_CRCR_LO); + if (temp & XHCI_CRCR_LO_CRR) { + DPRINTF("Command ring running\n"); + temp &= ~(XHCI_CRCR_LO_CS | XHCI_CRCR_LO_CA); + + /* + * Try to abort the last command as per section + * 4.6.1.2 "Aborting a Command" of the XHCI + * specification: + */ + + /* stop and cancel */ + XWRITE4(sc, oper, XHCI_CRCR_LO, temp | XHCI_CRCR_LO_CS); + XWRITE4(sc, oper, XHCI_CRCR_HI, 0); + + XWRITE4(sc, oper, XHCI_CRCR_LO, temp | XHCI_CRCR_LO_CA); + XWRITE4(sc, oper, XHCI_CRCR_HI, 0); + + /* wait 250ms */ + usb_pause_mtx(&sc->sc_bus.bus_mtx, hz / 4); + + /* check if command ring is still running */ + temp = XREAD4(sc, oper, XHCI_CRCR_LO); + if (temp & XHCI_CRCR_LO_CRR) { + DPRINTF("Comand ring still running\n"); + return (USB_ERR_IOERROR); + } + } + + /* reset command ring */ + sc->sc_command_ccs = 1; + sc->sc_command_idx = 0; + + usbd_get_page(&sc->sc_hw.root_pc, 0, &buf_res); + + /* setup command ring control base address */ + addr = buf_res.physaddr; + phwr = buf_res.buffer; + addr += (uintptr_t)&((struct xhci_hw_root *)0)->hwr_commands[0]; + + DPRINTF("CRCR=0x%016llx\n", (unsigned long long)addr); + + memset(phwr->hwr_commands, 0, sizeof(phwr->hwr_commands)); + phwr->hwr_commands[XHCI_MAX_COMMANDS - 1].qwTrb0 = htole64(addr); + + usb_pc_cpu_flush(&sc->sc_hw.root_pc); + + XWRITE4(sc, oper, XHCI_CRCR_LO, ((uint32_t)addr) | XHCI_CRCR_LO_RCS); + XWRITE4(sc, oper, XHCI_CRCR_HI, (uint32_t)(addr >> 32)); + + return (0); +} + usb_error_t xhci_start_controller(struct xhci_softc *sc) { @@ -1059,6 +1122,7 @@ xhci_do_command(struct xhci_softc *sc, s uint32_t temp; uint8_t i; uint8_t j; + uint8_t timeout = 0; int err; XHCI_CMD_ASSERT_LOCKED(sc); @@ -1072,7 +1136,7 @@ xhci_do_command(struct xhci_softc *sc, s /* Queue command */ USB_BUS_LOCK(&sc->sc_bus); - +retry: i = sc->sc_command_idx; j = sc->sc_command_ccs; @@ -1143,25 +1207,22 @@ xhci_do_command(struct xhci_softc *sc, s err = 0; } if (err != 0) { - DPRINTFN(0, "Command timeout!\n"); - + DPRINTF("Command timeout!\n"); /* - * Try to abort the last command as per section - * 4.6.1.2 "Aborting a Command" of the XHCI - * specification: + * After some weeks of continuous operation, it has + * been observed that the ASMedia Technology, ASM1042 + * SuperSpeed USB Host Controller can suddenly stop + * accepting commands via the command queue. Try to + * first reset the command queue. If that fails do a + * host controller reset. */ - 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"); + if (timeout == 0 && + xhci_reset_command_queue_locked(sc) == 0) { + timeout = 1; + goto retry; + } else { + DPRINTF("Controller reset!\n"); + usb_bus_reset_async_locked(&sc->sc_bus); } err = USB_ERR_TIMEOUT; trb->dwTrb2 = 0; Modified: stable/10/sys/dev/usb/usb_bus.h ============================================================================== --- stable/10/sys/dev/usb/usb_bus.h Thu Dec 19 07:12:40 2013 (r259602) +++ stable/10/sys/dev/usb/usb_bus.h Thu Dec 19 07:13:59 2013 (r259603) @@ -81,6 +81,7 @@ struct usb_bus { struct usb_bus_msg attach_msg[2]; struct usb_bus_msg suspend_msg[2]; struct usb_bus_msg resume_msg[2]; + struct usb_bus_msg reset_msg[2]; struct usb_bus_msg shutdown_msg[2]; /* * This mutex protects the USB hardware: Modified: stable/10/sys/dev/usb/usb_controller.h ============================================================================== --- stable/10/sys/dev/usb/usb_controller.h Thu Dec 19 07:12:40 2013 (r259602) +++ stable/10/sys/dev/usb/usb_controller.h Thu Dec 19 07:13:59 2013 (r259603) @@ -191,6 +191,7 @@ void usb_bus_mem_flush_all(struct usb_bu uint8_t usb_bus_mem_alloc_all(struct usb_bus *bus, bus_dma_tag_t dmat, usb_bus_mem_cb_t *cb); void usb_bus_mem_free_all(struct usb_bus *bus, usb_bus_mem_cb_t *cb); uint16_t usb_isoc_time_expand(struct usb_bus *bus, uint16_t isoc_time_curr); +void usb_bus_reset_async_locked(struct usb_bus *bus); #if USB_HAVE_TT_SUPPORT uint8_t usbd_fs_isoc_schedule_alloc_slot(struct usb_xfer *isoc_xfer, uint16_t isoc_time); #endif From owner-svn-src-stable-10@FreeBSD.ORG Thu Dec 19 07:20:37 2013 Return-Path: Delivered-To: svn-src-stable-10@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 ESMTPS id DA841D60; Thu, 19 Dec 2013 07:20:37 +0000 (UTC) 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 C65FC12E0; Thu, 19 Dec 2013 07:20: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 rBJ7Kb6a097249; Thu, 19 Dec 2013 07:20:37 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBJ7KbJ1097248; Thu, 19 Dec 2013 07:20:37 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201312190720.rBJ7KbJ1097248@svn.freebsd.org> From: Hans Petter Selasky Date: Thu, 19 Dec 2013 07:20:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259607 - stable/10/sys/dev/usb/controller X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Dec 2013 07:20:37 -0000 Author: hselasky Date: Thu Dec 19 07:20:37 2013 New Revision: 259607 URL: http://svnweb.freebsd.org/changeset/base/259607 Log: MFC r259248 and r259462: Set chain bit correctly. This will fix some problems sending and receiving Zero Length Packets, ZLPs. See comment in code for more information. Modified: stable/10/sys/dev/usb/controller/xhci.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/usb/controller/xhci.c ============================================================================== --- stable/10/sys/dev/usb/controller/xhci.c Thu Dec 19 07:18:31 2013 (r259606) +++ stable/10/sys/dev/usb/controller/xhci.c Thu Dec 19 07:20:37 2013 (r259607) @@ -1892,7 +1892,16 @@ restart: td->td_trb[x].dwTrb2 = htole32(dword); dword = XHCI_TRB_3_TYPE_SET(XHCI_TRB_TYPE_LINK) | - XHCI_TRB_3_CYCLE_BIT | XHCI_TRB_3_IOC_BIT; + XHCI_TRB_3_CYCLE_BIT | XHCI_TRB_3_IOC_BIT | + /* + * CHAIN-BIT: Ensure that a multi-TRB IN-endpoint + * frame only receives a single short packet event + * by setting the CHAIN bit in the LINK field. In + * addition some XHCI controllers have problems + * sending a ZLP unless the CHAIN-BIT is set in + * the LINK TRB. + */ + XHCI_TRB_3_CHAIN_BIT; td->td_trb[x].dwTrb3 = htole32(dword); @@ -1930,9 +1939,11 @@ restart: } /* clear TD SIZE to zero, hence this is the last TRB */ - /* remove chain bit because this is the last TRB in the chain */ + /* remove chain bit because this is the last data TRB in the chain */ td->td_trb[td->ntrb - 1].dwTrb2 &= ~htole32(XHCI_TRB_2_TDSZ_SET(15)); td->td_trb[td->ntrb - 1].dwTrb3 &= ~htole32(XHCI_TRB_3_CHAIN_BIT); + /* remove CHAIN-BIT from last LINK TRB */ + td->td_trb[td->ntrb].dwTrb3 &= ~htole32(XHCI_TRB_3_CHAIN_BIT); usb_pc_cpu_flush(td->page_cache); From owner-svn-src-stable-10@FreeBSD.ORG Thu Dec 19 07:33:07 2013 Return-Path: Delivered-To: svn-src-stable-10@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 ESMTPS id D8AC5B67; Thu, 19 Dec 2013 07:33:07 +0000 (UTC) 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 C417713DF; Thu, 19 Dec 2013 07:33: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 rBJ7X7Wu004341; Thu, 19 Dec 2013 07:33:07 GMT (envelope-from alfred@svn.freebsd.org) Received: (from alfred@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBJ7X7dg004339; Thu, 19 Dec 2013 07:33:07 GMT (envelope-from alfred@svn.freebsd.org) Message-Id: <201312190733.rBJ7X7dg004339@svn.freebsd.org> From: Alfred Perlstein Date: Thu, 19 Dec 2013 07:33:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259608 - stable/10/sys/ofed/drivers/net/mlx4 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Dec 2013 07:33:07 -0000 Author: alfred Date: Thu Dec 19 07:33:07 2013 New Revision: 259608 URL: http://svnweb.freebsd.org/changeset/base/259608 Log: Defer start/stop port to workqueues. MFC: 259411 Modified: stable/10/sys/ofed/drivers/net/mlx4/en_netdev.c stable/10/sys/ofed/drivers/net/mlx4/mlx4_en.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/ofed/drivers/net/mlx4/en_netdev.c ============================================================================== --- stable/10/sys/ofed/drivers/net/mlx4/en_netdev.c Thu Dec 19 07:20:37 2013 (r259607) +++ stable/10/sys/ofed/drivers/net/mlx4/en_netdev.c Thu Dec 19 07:33:07 2013 (r259608) @@ -153,6 +153,19 @@ restart: return (i); } +static void mlx4_en_stop_port(struct net_device *dev) +{ + struct mlx4_en_priv *priv = netdev_priv(dev); + + queue_work(priv->mdev->workqueue, &priv->stop_port_task); +} + +static void mlx4_en_start_port(struct net_device *dev) +{ + struct mlx4_en_priv *priv = netdev_priv(dev); + + queue_work(priv->mdev->workqueue, &priv->start_port_task); +} static void mlx4_en_set_multicast(struct net_device *dev) { @@ -473,6 +486,7 @@ static void mlx4_en_do_get_stats(struct queue_delayed_work(mdev->workqueue, &priv->stats_task, STATS_DELAY); } + mlx4_en_QUERY_PORT(priv->mdev, priv->port); mutex_unlock(&mdev->state_lock); } @@ -498,8 +512,31 @@ static void mlx4_en_linkstate(struct wor mutex_unlock(&mdev->state_lock); } +static void mlx4_en_lock_and_stop_port(struct work_struct *work) +{ + struct mlx4_en_priv *priv = container_of(work, struct mlx4_en_priv, + stop_port_task); + struct net_device *dev = priv->dev; + struct mlx4_en_dev *mdev = priv->mdev; + + mutex_lock(&mdev->state_lock); + mlx4_en_do_stop_port(dev); + mutex_unlock(&mdev->state_lock); +} + +static void mlx4_en_lock_and_start_port(struct work_struct *work) +{ + struct mlx4_en_priv *priv = container_of(work, struct mlx4_en_priv, + start_port_task); + struct net_device *dev = priv->dev; + struct mlx4_en_dev *mdev = priv->mdev; + + mutex_lock(&mdev->state_lock); + mlx4_en_do_start_port(dev); + mutex_unlock(&mdev->state_lock); +} -int mlx4_en_start_port(struct net_device *dev) +int mlx4_en_do_start_port(struct net_device *dev) { struct mlx4_en_priv *priv = netdev_priv(dev); struct mlx4_en_dev *mdev = priv->mdev; @@ -691,7 +728,7 @@ cq_err: } -void mlx4_en_stop_port(struct net_device *dev) +void mlx4_en_do_stop_port(struct net_device *dev) { struct mlx4_en_priv *priv = netdev_priv(dev); struct mlx4_en_dev *mdev = priv->mdev; @@ -761,8 +798,8 @@ reset: mutex_lock(&mdev->state_lock); if (priv->port_up) { - mlx4_en_stop_port(dev); - if (mlx4_en_start_port(dev)) + mlx4_en_do_stop_port(dev); + if (mlx4_en_do_start_port(dev)) en_err(priv, "Failed restarting port %d\n", priv->port); } mutex_unlock(&mdev->state_lock); @@ -793,7 +830,7 @@ mlx4_en_init_locked(struct mlx4_en_priv dev = priv->dev; mdev = priv->mdev; if (dev->if_drv_flags & IFF_DRV_RUNNING) - mlx4_en_stop_port(dev); + mlx4_en_do_stop_port(dev); if (!mdev->device_up) { en_err(priv, "Cannot open - device down/disabled\n"); @@ -816,7 +853,7 @@ mlx4_en_init_locked(struct mlx4_en_priv } mlx4_en_set_default_moderation(priv); - if (mlx4_en_start_port(dev)) + if (mlx4_en_do_start_port(dev)) en_err(priv, "Failed starting port:%d\n", priv->port); } @@ -905,7 +942,7 @@ void mlx4_en_destroy_netdev(struct net_d mlx4_free_hwq_res(mdev->dev, &priv->res, MLX4_EN_PAGE_SIZE); mutex_lock(&mdev->state_lock); - mlx4_en_stop_port(dev); + mlx4_en_do_stop_port(dev); mutex_unlock(&mdev->state_lock); cancel_delayed_work(&priv->stats_task); @@ -925,7 +962,6 @@ void mlx4_en_destroy_netdev(struct net_d mtx_destroy(&priv->stats_lock.m); mtx_destroy(&priv->vlan_lock.m); - mtx_destroy(&priv->ioctl_lock.m); kfree(priv); if_free(dev); } @@ -951,9 +987,9 @@ static int mlx4_en_change_mtu(struct net * the port */ en_dbg(DRV, priv, "Change MTU called with card down!?\n"); } else { - mlx4_en_stop_port(dev); + mlx4_en_do_stop_port(dev); mlx4_en_set_default_moderation(priv); - err = mlx4_en_start_port(dev); + err = mlx4_en_do_start_port(dev); if (err) { en_err(priv, "Failed restarting port:%d\n", priv->port); @@ -973,8 +1009,13 @@ static int mlx4_en_calc_media(struct mlx active = IFM_ETHER; if (priv->last_link_state == MLX4_DEV_EVENT_PORT_DOWN) return (active); - if (mlx4_en_QUERY_PORT(priv->mdev, priv->port)) - return (active); + /* + * [ShaharK] mlx4_en_QUERY_PORT sleeps and cannot be called under a + * non-sleepable lock. + * I moved it to the periodic mlx4_en_do_get_stats. + if (mlx4_en_QUERY_PORT(priv->mdev, priv->port)) + return (active); + */ active |= IFM_FDX; trans_type = priv->port_state.transciver; /* XXX I don't know all of the transceiver values. */ @@ -1078,7 +1119,6 @@ static int mlx4_en_ioctl(struct ifnet *d error = -mlx4_en_change_mtu(dev, ifr->ifr_mtu); break; case SIOCSIFFLAGS: - mutex_lock(&mdev->state_lock); if (dev->if_flags & IFF_UP) { if ((dev->if_drv_flags & IFF_DRV_RUNNING) == 0) mlx4_en_start_port(dev); @@ -1087,16 +1127,24 @@ static int mlx4_en_ioctl(struct ifnet *d } else { if (dev->if_drv_flags & IFF_DRV_RUNNING) { mlx4_en_stop_port(dev); - if_link_state_change(dev, LINK_STATE_DOWN); + if_link_state_change(dev, LINK_STATE_DOWN); + /* + * Since mlx4_en_stop_port is defered we + * have to wait till it's finished. + */ + for (int count=0; count<10; count++) { + if (dev->if_drv_flags & IFF_DRV_RUNNING) { + DELAY(20000); + } else { + break; + } + } } } - mutex_unlock(&mdev->state_lock); break; case SIOCADDMULTI: case SIOCDELMULTI: - spin_lock(&priv->ioctl_lock); mlx4_en_set_multicast(dev); - spin_unlock(&priv->ioctl_lock); break; case SIOCSIFMEDIA: case SIOCGIFMEDIA: @@ -1153,7 +1201,7 @@ static int mlx4_en_set_ring_size(struct mutex_lock(&mdev->state_lock); if (priv->port_up) { port_up = 1; - mlx4_en_stop_port(dev); + mlx4_en_do_stop_port(dev); } mlx4_en_free_resources(priv); priv->prof->tx_ring_size = tx_size; @@ -1164,7 +1212,7 @@ static int mlx4_en_set_ring_size(struct goto out; } if (port_up) { - err = mlx4_en_start_port(dev); + err = mlx4_en_do_start_port(dev); if (err) en_err(priv, "Failed starting port\n"); } @@ -1256,7 +1304,7 @@ static int mlx4_en_set_rx_ppp(SYSCTL_HAN mutex_lock(&mdev->state_lock); if (priv->port_up) { port_up = 1; - mlx4_en_stop_port(priv->dev); + mlx4_en_do_stop_port(priv->dev); } mlx4_en_free_resources(priv); priv->tx_ring_num = tx_ring_num; @@ -1265,7 +1313,7 @@ static int mlx4_en_set_rx_ppp(SYSCTL_HAN if (error) en_err(priv, "Failed reallocating port resources\n"); if (error == 0 && port_up) { - error = -mlx4_en_start_port(priv->dev); + error = -mlx4_en_do_start_port(priv->dev); if (error) en_err(priv, "Failed starting port\n"); } @@ -1517,8 +1565,9 @@ int mlx4_en_init_netdev(struct mlx4_en_d priv->msg_enable = MLX4_EN_MSG_LEVEL; priv->ip_reasm = priv->mdev->profile.ip_reasm; mtx_init(&priv->stats_lock.m, "mlx4 stats", NULL, MTX_DEF); - mtx_init(&priv->ioctl_lock.m, "mlx4 ioctl", NULL, MTX_DEF); mtx_init(&priv->vlan_lock.m, "mlx4 vlan", NULL, MTX_DEF); + INIT_WORK(&priv->start_port_task, mlx4_en_lock_and_start_port); + INIT_WORK(&priv->stop_port_task, mlx4_en_lock_and_stop_port); INIT_WORK(&priv->mcast_task, mlx4_en_do_set_multicast); INIT_WORK(&priv->watchdog_task, mlx4_en_restart); INIT_WORK(&priv->linkstate_task, mlx4_en_linkstate); Modified: stable/10/sys/ofed/drivers/net/mlx4/mlx4_en.h ============================================================================== --- stable/10/sys/ofed/drivers/net/mlx4/mlx4_en.h Thu Dec 19 07:20:37 2013 (r259607) +++ stable/10/sys/ofed/drivers/net/mlx4/mlx4_en.h Thu Dec 19 07:33:07 2013 (r259608) @@ -493,7 +493,6 @@ struct mlx4_en_priv { spinlock_t vlan_lock; struct mlx4_en_port_state port_state; spinlock_t stats_lock; - spinlock_t ioctl_lock; unsigned long last_moder_packets[MAX_RX_RINGS]; unsigned long last_moder_tx_packets; @@ -546,6 +545,8 @@ struct mlx4_en_priv { struct mlx4_en_cq rx_cq[MAX_RX_RINGS]; struct mlx4_en_tx_hash_entry tx_hash[MLX4_EN_TX_HASH_SIZE]; struct work_struct mcast_task; + struct work_struct start_port_task; + struct work_struct stop_port_task; struct work_struct watchdog_task; struct work_struct linkstate_task; struct delayed_work stats_task; @@ -580,8 +581,8 @@ void mlx4_en_destroy_netdev(struct net_d int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port, struct mlx4_en_port_profile *prof); -int mlx4_en_start_port(struct net_device *dev); -void mlx4_en_stop_port(struct net_device *dev); +int mlx4_en_do_start_port(struct net_device *dev); +void mlx4_en_do_stop_port(struct net_device *dev); void mlx4_en_free_resources(struct mlx4_en_priv *priv); int mlx4_en_alloc_resources(struct mlx4_en_priv *priv); From owner-svn-src-stable-10@FreeBSD.ORG Thu Dec 19 08:06:43 2013 Return-Path: Delivered-To: svn-src-stable-10@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 ESMTPS id 25BD4A59; Thu, 19 Dec 2013 08:06:43 +0000 (UTC) Received: from lath.rinet.ru (lath.rinet.ru [195.54.192.90]) by mx1.freebsd.org (Postfix) with ESMTP id D3E4A16B7; Thu, 19 Dec 2013 08:06:42 +0000 (UTC) Received: by lath.rinet.ru (Postfix, from userid 222) id EB59388C2; Thu, 19 Dec 2013 11:56:47 +0400 (MSK) Date: Thu, 19 Dec 2013 11:56:47 +0400 From: Oleg Bulyzhin To: "Andrey V. Elsukov" Subject: Re: svn commit: r258346 - stable/10/sys/dev/ixgbe Message-ID: <20131219075647.GA39816@lath.rinet.ru> References: <201311191424.rAJEOQ8U037410@svn.freebsd.org> <52AF3001.2000208@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <52AF3001.2000208@FreeBSD.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Oleg Bulyzhin , svn-src-stable-10@freebsd.org X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Dec 2013 08:06:43 -0000 On Mon, Dec 16, 2013 at 08:53:21PM +0400, Andrey V. Elsukov wrote: > On 19.11.2013 18:24, Oleg Bulyzhin wrote: > > Author: oleg > > Date: Tue Nov 19 14:24:25 2013 > > New Revision: 258346 > > URL: http://svnweb.freebsd.org/changeset/base/258346 > > > > Log: > > MFC: 257695 > > > > - Fix link loss on vlan reconfiguration. > > - Fix issues with 'vlanhwfilter'. > > Hi, Oleg, > > do you plan to merge this in stable/9 too? > > -- > WBR, Andrey V. Elsukov I didn't plan it (i'm still hoping jfv@ will fix it). -- Oleg. ================================================================ === Oleg Bulyzhin -- OBUL-RIPN -- OBUL-RIPE -- oleg@rinet.ru === ================================================================ From owner-svn-src-stable-10@FreeBSD.ORG Thu Dec 19 12:33:25 2013 Return-Path: Delivered-To: svn-src-stable-10@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 ESMTPS id A8EF1256; Thu, 19 Dec 2013 12:33:25 +0000 (UTC) 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 88D601B32; Thu, 19 Dec 2013 12:33:25 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBJCXPkv012804; Thu, 19 Dec 2013 12:33:25 GMT (envelope-from bdrewery@svn.freebsd.org) Received: (from bdrewery@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBJCXOkX012801; Thu, 19 Dec 2013 12:33:24 GMT (envelope-from bdrewery@svn.freebsd.org) Message-Id: <201312191233.rBJCXOkX012801@svn.freebsd.org> From: Bryan Drewery Date: Thu, 19 Dec 2013 12:33:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259613 - stable/10/usr.sbin/pkg X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Dec 2013 12:33:25 -0000 Author: bdrewery Date: Thu Dec 19 12:33:24 2013 New Revision: 259613 URL: http://svnweb.freebsd.org/changeset/base/259613 Log: MFC r259266: Fix multi-repository support by properly respecting 'enabled' flag. This will read the REPOS_DIR env/config setting (default is /etc/pkg and /usr/local/etc/pkg/repos) and use the last enabled repository. This can be changed in the environment using a comma-separated list, or in /usr/local/etc/pkg.conf with JSON array syntax of: REPOS_DIR: ["/etc/pkg", "/usr/local/etc/pkg/repos"] Approved by: bapt (mentor) Modified: stable/10/usr.sbin/pkg/config.c stable/10/usr.sbin/pkg/config.h stable/10/usr.sbin/pkg/pkg.7 Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/pkg/config.c ============================================================================== --- stable/10/usr.sbin/pkg/config.c Thu Dec 19 12:00:48 2013 (r259612) +++ stable/10/usr.sbin/pkg/config.c Thu Dec 19 12:33:24 2013 (r259613) @@ -32,8 +32,10 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include +#include #include #include #include @@ -51,11 +53,17 @@ __FBSDID("$FreeBSD$"); #define roundup2(x, y) (((x)+((y)-1))&(~((y)-1))) /* if y is powers of two */ +struct config_value { + char *value; + STAILQ_ENTRY(config_value) next; +}; + struct config_entry { uint8_t type; const char *key; const char *val; char *value; + STAILQ_HEAD(, config_value) *list; bool envset; }; @@ -65,6 +73,7 @@ static struct config_entry c[] = { "PACKAGESITE", URL_SCHEME_PREFIX "http://pkg.FreeBSD.org/${ABI}/latest", NULL, + NULL, false, }, [ABI] = { @@ -72,6 +81,7 @@ static struct config_entry c[] = { "ABI", NULL, NULL, + NULL, false, }, [MIRROR_TYPE] = { @@ -79,6 +89,7 @@ static struct config_entry c[] = { "MIRROR_TYPE", "SRV", NULL, + NULL, false, }, [ASSUME_ALWAYS_YES] = { @@ -86,6 +97,7 @@ static struct config_entry c[] = { "ASSUME_ALWAYS_YES", "NO", NULL, + NULL, false, }, [SIGNATURE_TYPE] = { @@ -93,6 +105,7 @@ static struct config_entry c[] = { "SIGNATURE_TYPE", NULL, NULL, + NULL, false, }, [FINGERPRINTS] = { @@ -100,6 +113,15 @@ static struct config_entry c[] = { "FINGERPRINTS", NULL, NULL, + NULL, + false, + }, + [REPOS_DIR] = { + PKG_CONFIG_LIST, + "REPOS_DIR", + NULL, + NULL, + NULL, false, }, }; @@ -474,17 +496,34 @@ subst_packagesite(const char *abi) c[PACKAGESITE].value = strdup(sbuf_data(newval)); } +static int +boolstr_to_bool(const char *str) +{ + if (str != NULL && (strcasecmp(str, "true") == 0 || + strcasecmp(str, "yes") == 0 || strcasecmp(str, "on") == 0 || + str[0] == '1')) + return (true); + + return (false); +} + static void config_parse(yaml_document_t *doc, yaml_node_t *node, pkg_conf_file_t conftype) { + yaml_node_item_t *item; yaml_node_pair_t *pair; - yaml_node_t *key, *val; + yaml_node_t *key, *val, *item_val; struct sbuf *buf = sbuf_new_auto(); + struct config_entry *temp_config; + struct config_value *cv; int i; size_t j; pair = node->data.mapping.pairs.start; + /* Temporary config for configs that may be disabled. */ + temp_config = calloc(CONFIG_SIZE, sizeof(struct config_entry)); + while (pair < node->data.mapping.pairs.top) { key = yaml_document_get_node(doc, pair->key); val = yaml_document_get_node(doc, pair->value); @@ -530,7 +569,12 @@ config_parse(yaml_document_t *doc, yaml_ else if (strcasecmp(key->data.scalar.value, "fingerprints") == 0) sbuf_cpy(buf, "FINGERPRINTS"); - else { /* Skip unknown entries for future use. */ + else if (strcasecmp(key->data.scalar.value, + "enabled") == 0) { + /* Skip disabled repos. */ + if (!boolstr_to_bool(val->data.scalar.value)) + goto cleanup; + } else { /* Skip unknown entries for future use. */ ++pair; continue; } @@ -554,10 +598,58 @@ config_parse(yaml_document_t *doc, yaml_ continue; } - c[i].value = strdup(val->data.scalar.value); + /* Parse sequence value ["item1", "item2"] */ + switch (c[i].type) { + case PKG_CONFIG_LIST: + if (val->type != YAML_SEQUENCE_NODE) { + fprintf(stderr, "Skipping invalid array " + "value for %s.\n", c[i].key); + ++pair; + continue; + } + item = val->data.sequence.items.start; + temp_config[i].list = + malloc(sizeof(*temp_config[i].list)); + STAILQ_INIT(temp_config[i].list); + + while (item < val->data.sequence.items.top) { + item_val = yaml_document_get_node(doc, *item); + if (item_val->type != YAML_SCALAR_NODE) { + ++item; + continue; + } + cv = malloc(sizeof(struct config_value)); + cv->value = + strdup(item_val->data.scalar.value); + STAILQ_INSERT_TAIL(temp_config[i].list, cv, + next); + ++item; + } + break; + default: + /* Normal string value. */ + temp_config[i].value = strdup(val->data.scalar.value); + break; + } ++pair; } + /* Repo is enabled, copy over all settings from temp_config. */ + for (i = 0; i < CONFIG_SIZE; i++) { + if (c[i].envset) + continue; + switch (c[i].type) { + case PKG_CONFIG_LIST: + c[i].list = temp_config[i].list; + break; + default: + c[i].value = temp_config[i].value; + break; + } + } + +cleanup: + free(temp_config); sbuf_delete(buf); } @@ -632,23 +724,84 @@ read_conf_file(const char *confpath, pkg return (0); } +static int +load_repositories(const char *repodir) +{ + struct dirent *ent; + DIR *d; + char *p; + size_t n; + char path[MAXPATHLEN]; + int ret; + + ret = 0; + + if ((d = opendir(repodir)) == NULL) + return (1); + + while ((ent = readdir(d))) { + /* Trim out 'repos'. */ + if ((n = strlen(ent->d_name)) <= 5) + continue; + p = &ent->d_name[n - 5]; + if (strcmp(p, ".conf") == 0) { + snprintf(path, sizeof(path), "%s%s%s", + repodir, + repodir[strlen(repodir) - 1] == '/' ? "" : "/", + ent->d_name); + if (access(path, F_OK) == 0 && + read_conf_file(path, CONFFILE_REPO)) { + ret = 1; + goto cleanup; + } + } + } + +cleanup: + closedir(d); + + return (ret); +} + int config_init(void) { - const char *val; + char *val; int i; const char *localbase; + char *env_list_item; char confpath[MAXPATHLEN]; + struct config_value *cv; char abi[BUFSIZ]; for (i = 0; i < CONFIG_SIZE; i++) { val = getenv(c[i].key); if (val != NULL) { - c[i].val = val; c[i].envset = true; + switch (c[i].type) { + case PKG_CONFIG_LIST: + /* Split up comma-separated items from env. */ + c[i].list = malloc(sizeof(*c[i].list)); + STAILQ_INIT(c[i].list); + for (env_list_item = strtok(val, ","); + env_list_item != NULL; + env_list_item = strtok(NULL, ",")) { + cv = + malloc(sizeof(struct config_value)); + cv->value = + strdup(env_list_item); + STAILQ_INSERT_TAIL(c[i].list, cv, + next); + } + break; + default: + c[i].val = val; + break; + } } } + /* Read LOCALBASE/etc/pkg.conf first. */ localbase = getenv("LOCALBASE") ? getenv("LOCALBASE") : _LOCALBASE; snprintf(confpath, sizeof(confpath), "%s/etc/pkg.conf", localbase); @@ -657,10 +810,22 @@ config_init(void) CONFFILE_PKG)) goto finalize; - snprintf(confpath, sizeof(confpath), "/etc/pkg/FreeBSD.conf"); - if (access(confpath, F_OK) == 0 && read_conf_file(confpath, - CONFFILE_REPO)) - goto finalize; + /* Then read in all repos from REPOS_DIR list of directories. */ + if (c[REPOS_DIR].list == NULL) { + c[REPOS_DIR].list = malloc(sizeof(*c[REPOS_DIR].list)); + STAILQ_INIT(c[REPOS_DIR].list); + cv = malloc(sizeof(struct config_value)); + cv->value = strdup("/etc/pkg"); + STAILQ_INSERT_TAIL(c[REPOS_DIR].list, cv, next); + cv = malloc(sizeof(struct config_value)); + if (asprintf(&cv->value, "%s/etc/pkg/repos", localbase) < 0) + goto finalize; + STAILQ_INSERT_TAIL(c[REPOS_DIR].list, cv, next); + } + + STAILQ_FOREACH(cv, c[REPOS_DIR].list, next) + if (load_repositories(cv->value)) + goto finalize; finalize: if (c[ABI].val == NULL && c[ABI].value == NULL) { @@ -704,10 +869,7 @@ config_bool(pkg_config_key k, bool *val) else value = c[k].val; - if (strcasecmp(value, "true") == 0 || - strcasecmp(value, "yes") == 0 || - strcasecmp(value, "on") == 0 || - *value == '1') + if (boolstr_to_bool(value)) *val = true; return (0); Modified: stable/10/usr.sbin/pkg/config.h ============================================================================== --- stable/10/usr.sbin/pkg/config.h Thu Dec 19 12:00:48 2013 (r259612) +++ stable/10/usr.sbin/pkg/config.h Thu Dec 19 12:33:24 2013 (r259613) @@ -39,12 +39,14 @@ typedef enum { ASSUME_ALWAYS_YES, SIGNATURE_TYPE, FINGERPRINTS, + REPOS_DIR, CONFIG_SIZE } pkg_config_key; typedef enum { PKG_CONFIG_STRING=0, PKG_CONFIG_BOOL, + PKG_CONFIG_LIST, } pkg_config_t; typedef enum { Modified: stable/10/usr.sbin/pkg/pkg.7 ============================================================================== --- stable/10/usr.sbin/pkg/pkg.7 Thu Dec 19 12:00:48 2013 (r259612) +++ stable/10/usr.sbin/pkg/pkg.7 Thu Dec 19 12:33:24 2013 (r259613) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 19, 2013 +.Dd December 12, 2013 .Dt PKG 7 .Os .Sh NAME @@ -152,6 +152,7 @@ MIRROR_TYPE: "srv", SIGNATURE_TYPE: "none", FINGERPRINTS: "/usr/share/keys/pkg", ASSUME_ALWAYS_YES: "yes" +REPOS_DIR: ["/etc/pkg", "/usr/local/etc/pkg/repos"] .Ed .Pp Reference @@ -194,14 +195,20 @@ The URL that .Xr pkg 8 and other packages will be fetched from. +.It Ev REPOS_DIR +Comma-separated list of directories that should be searched for repository +configuration files. .El .Sh FILES Configuration is read from the files in the listed order. -The first enabled repository is the one used for bootstrapping +This path can be changed by setting +.Sy REPOS_DIR . +The last enabled repository is the one used for bootstrapping .Xr pkg 8 . .Bl -tag -width "/usr/local/etc/pkg/repos/*.conf" .It Pa /usr/local/etc/pkg.conf .It Pa /etc/pkg/FreeBSD.conf +.It Pa /usr/local/etc/pkg/repos/*.conf .El .Sh EXAMPLES Some examples are listed here. From owner-svn-src-stable-10@FreeBSD.ORG Thu Dec 19 18:52:42 2013 Return-Path: Delivered-To: svn-src-stable-10@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 ESMTPS id 95D0EC98; Thu, 19 Dec 2013 18:52:42 +0000 (UTC) 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 809E31D48; Thu, 19 Dec 2013 18:52:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBJIqgoD057788; Thu, 19 Dec 2013 18:52:42 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBJIqfTS057784; Thu, 19 Dec 2013 18:52:41 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201312191852.rBJIqfTS057784@svn.freebsd.org> From: Devin Teske Date: Thu, 19 Dec 2013 18:52:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259621 - stable/10/usr.sbin/bsdinstall/scripts X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Dec 2013 18:52:42 -0000 Author: dteske Date: Thu Dec 19 18:52:41 2013 New Revision: 259621 URL: http://svnweb.freebsd.org/changeset/base/259621 Log: MFC r259276,259468-259470,259472,259474,259476-259478,259480-259481,259570, 259572, and 259597-259598... r259276: Fix bug in `services' script in adding dumpdev comment to rc.conf r259468: Ignore spurious escape generated by VMware's Ctrl-Cmd combination r259469: Mask errors in `config' script from newaliases(1) about non-FQHN r259470: Set atime=on for /var/mail zfsboot dataset to support mail server r259472: Accept NULL input for zfsboot SWAP to indicate SWAP of zero bytes r259474: Multiple changes, including bug-fixes and debugging improvements r259476: Change default ZFS disk layout, making it easier to resize r259477: fletcher4 is now the default (zfsboot related) r259478: De-uglify the geli(8)-setup infobox (zfsboot related) r259480: Fix ghosted zroot issue by always performing labelclear on swap r259481: Auto-enable 4k sector alignmet when geli(8) is enabled (zfsboot) r259570: Fix numerical comparison error (zfsboot) r259572: Mask spurious rm error in bsdinstall_log from `auto' script r259597: Fix zfsboot regression when installing to 3+ disks r259598: Set cachefile property of bootpool so it imports to new system Modified: stable/10/usr.sbin/bsdinstall/scripts/auto stable/10/usr.sbin/bsdinstall/scripts/config stable/10/usr.sbin/bsdinstall/scripts/services stable/10/usr.sbin/bsdinstall/scripts/zfsboot Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/bsdinstall/scripts/auto ============================================================================== --- stable/10/usr.sbin/bsdinstall/scripts/auto Thu Dec 19 18:52:27 2013 (r259620) +++ stable/10/usr.sbin/bsdinstall/scripts/auto Thu Dec 19 18:52:41 2013 (r259621) @@ -49,6 +49,10 @@ error() { ############################################################ MAIN +# Don't send ESC on function-key 62/63 (left/right command key) +f_quietly kbdcontrol -f 62 '' +f_quietly kbdcontrol -f 63 '' + f_dprintf "Began Installation at %s" "$( date )" rm -rf $BSDINSTALL_TMPETC @@ -99,7 +103,7 @@ if [ -n "$FETCH_DISTRIBUTIONS" ]; then export BSDINSTALL_DISTSITE fi -rm $PATH_FSTAB +rm -f $PATH_FSTAB touch $PATH_FSTAB PMODES="\ @@ -120,8 +124,7 @@ exec 3>&1 PARTMODE=`echo $PMODES | xargs dialog --backtitle "FreeBSD Installer" \ --title "Partitioning" \ --menu "How would you like to partition your disk?" \ - 0 0 0 2>&1 1>&3` -if [ $? -eq $DIALOG_CANCEL ]; then exit 1; fi + 0 0 0 2>&1 1>&3` || exit 1 exec 3>&- case "$PARTMODE" in Modified: stable/10/usr.sbin/bsdinstall/scripts/config ============================================================================== --- stable/10/usr.sbin/bsdinstall/scripts/config Thu Dec 19 18:52:27 2013 (r259620) +++ stable/10/usr.sbin/bsdinstall/scripts/config Thu Dec 19 18:52:41 2013 (r259621) @@ -42,7 +42,7 @@ cp $BSDINSTALL_TMPBOOT/* $BSDINSTALL_CHR [ "${debugFile#+}" ] && cp "${debugFile#+}" $BSDINSTALL_CHROOT/var/log/ # Set up other things from installed config -chroot $BSDINSTALL_CHROOT /usr/bin/newaliases +chroot $BSDINSTALL_CHROOT /usr/bin/newaliases > /dev/null 2>&1 ################################################################################ # END Modified: stable/10/usr.sbin/bsdinstall/scripts/services ============================================================================== --- stable/10/usr.sbin/bsdinstall/scripts/services Thu Dec 19 18:52:27 2013 (r259620) +++ stable/10/usr.sbin/bsdinstall/scripts/services Thu Dec 19 18:52:41 2013 (r259621) @@ -50,13 +50,12 @@ DAEMONS=$(dialog --backtitle "FreeBSD In 2>&1 1>&3) exec 3>&- -local havedump= +havedump= for daemon in $DAEMONS; do if [ "$daemon" == "dumpdev" ]; then havedump=1 - echo \# Set dumpdev to \"AUTO\" to enable crash dumps, \ - \"NO\" to disable >> \ - $BSDINSTALL_TMPETC/rc.conf.services + echo '# Set dumpdev to "AUTO" to enable crash dumps, "NO"' \ + 'to disable' >> $BSDINSTALL_TMPETC/rc.conf.services echo dumpdev=\"AUTO\" >> $BSDINSTALL_TMPETC/rc.conf.services continue fi Modified: stable/10/usr.sbin/bsdinstall/scripts/zfsboot ============================================================================== --- stable/10/usr.sbin/bsdinstall/scripts/zfsboot Thu Dec 19 18:52:27 2013 (r259620) +++ stable/10/usr.sbin/bsdinstall/scripts/zfsboot Thu Dec 19 18:52:41 2013 (r259621) @@ -66,23 +66,30 @@ f_include $BSDCFG_SHARE/variable.subr # # Should we use geli(8) to encrypt the drives? +# NB: Automatically enables ZFSBOOT_BOOT_POOL # : ${ZFSBOOT_GELI_ENCRYPTION=} # -# Default name the unencrypted pool when using geli(8) to encrypt the drives +# Default path to the geli(8) keyfile used in drive encryption # -: ${ZFSBOOT_GELI_POOL_NAME:=bootpool} +: ${ZFSBOOT_GELI_KEY_FILE:=/boot/encryption.key} # -# Default size for the unencrypted boot pool when using geli(8) +# Create a separate boot pool? +# NB: Automatically set when using geli(8) or MBR # -: ${ZFSBOOT_GELI_BOOT_SIZE:=2g} +: ${ZFSBOOT_BOOT_POOL=} # -# Default path to the geli(8) keyfile used in drive encryption +# Default name for boot pool when enabled (e.g., geli(8) or MBR) # -: ${ZFSBOOT_GELI_KEY_FILE:=/boot/encryption.key} +: ${ZFSBOOT_BOOT_POOL_NAME:=bootpool} + +# +# Default size for boot pool when enabled (e.g., geli(8) or MBR) +# +: ${ZFSBOOT_BOOT_POOL_SIZE:=2g} # # Default disks to use (always empty unless being scripted) @@ -132,6 +139,7 @@ f_isset ZFSBOOT_DATASETS || ZFSBOOT_DATA /var mountpoint=/var /var/crash compression=lz4,exec=off,setuid=off /var/log compression=lz4,exec=off,setuid=off + /var/mail compression=lz4,atime=on /var/tmp compression=lz4,exec=on,setuid=off " # END-QUOTE @@ -155,8 +163,10 @@ CHMOD_MODE='chmod %s "%s"' DD_WITH_OPTIONS='dd if="%s" of="%s" %s' ECHO_APPEND='echo "%s" >> "%s"' GELI_ATTACH='geli attach -j - -k "%s" "%s"' +GELI_DETACH_F='geli detach -f "%s"' GELI_PASSWORD_INIT='geli init -b -B "%s" -e %s -J - -K "%s" -l 256 -s 4096 "%s"' GNOP_CREATE='gnop create -S 4096 "%s"' +GNOP_DESTROY='gnop destroy "%s"' GPART_ADD='gpart add -t %s "%s"' GPART_ADD_INDEX='gpart add -i %s -t %s "%s"' GPART_ADD_INDEX_WITH_SIZE='gpart add -i %s -t %s -s %s "%s"' @@ -165,19 +175,23 @@ GPART_ADD_LABEL_WITH_SIZE='gpart add -l GPART_BOOTCODE='gpart bootcode -b "%s" "%s"' GPART_BOOTCODE_PART='gpart bootcode -b "%s" -p "%s" -i %s "%s"' GPART_CREATE='gpart create -s %s "%s"' +GPART_DESTROY_F='gpart destroy -F "%s"' GPART_SET_ACTIVE='gpart set -a active -i %s "%s"' +GRAID_DELETE='graid delete "%s"' LN_SF='ln -sf "%s" "%s"' MKDIR_P='mkdir -p "%s"' MOUNT_TYPE='mount -t %s "%s" "%s"' PRINTF_CONF="printf '%s=\"%%s\"\\\n' %s >> \"%s\"" PRINTF_FSTAB='printf "$FSTAB_FMT" "%s" "%s" "%s" "%s" "%s" "%s" >> "%s"' SHELL_TRUNCATE=':> "%s"' +UMOUNT='umount "%s"' ZFS_CREATE_WITH_OPTIONS='zfs create %s "%s"' ZFS_SET='zfs set "%s" "%s"' ZFS_UNMOUNT='zfs unmount "%s"' ZPOOL_CREATE_WITH_OPTIONS='zpool create %s "%s" %s %s' ZPOOL_EXPORT='zpool export "%s"' ZPOOL_IMPORT_WITH_OPTIONS='zpool import %s "%s"' +ZPOOL_LABELCLEAR_F='zpool labelclear -f "%s"' ZPOOL_SET='zpool set %s "%s"' # @@ -201,12 +215,12 @@ msg_force_4k_sectors="Force 4K Sectors?" msg_force_4k_sectors_help="Use gnop(8) to configure forced 4K sector alignment" msg_freebsd_installer="FreeBSD Installer" msg_geli_password="Enter a strong passphrase, used to protect your encryption keys. You will be required to enter this passphrase each time the system is booted" -msg_geli_setup="Initializing encryption on the selected disks, this will take several seconds per disk" +msg_geli_setup="Initializing encryption on selected disks,\n this will take several seconds per disk" msg_install="Install" msg_install_desc="Proceed with Installation" msg_install_help="Create ZFS boot pool with displayed options" +msg_invalid_boot_pool_size="Invalid boot pool size \`%s'" msg_invalid_disk_argument="Invalid disk argument \`%s'" -msg_invalid_geli_boot_size="Invalid geli(8) boot size \`%s'" msg_invalid_index_argument="Invalid index argument \`%s'" msg_invalid_swap_size="Invalid swap size \`%s'" msg_invalid_virtual_device_type="Invalid Virtual Device type \`%s'" @@ -610,13 +624,13 @@ dialog_menu_layout() # so we can have some real swap. This also provides wiggle room incase your # replacement drivers do not have the exact same sector counts. # -# NOTE: The MBR layout is more complicated (GPT is preferred). +# NOTE: $swapsize and $bootsize should be defined by the calling function. +# NOTE: Sets $bootpart and $targetpart for the calling function. # zfs_create_diskpart() { local funcname=zfs_create_diskpart local disk="$1" index="$2" - local disksize partsize # Check arguments if [ ! "$disk" ]; then @@ -663,26 +677,18 @@ zfs_create_diskpart() # NOTE: Failure is ok here, blank disk will have nothing to destroy. # f_dprintf "$funcname: Destroying all data/layouts on \`%s'..." "$disk" - f_quietly gpart destroy -F $disk - f_quietly graid destroy $disk - f_quietly zpool labelclear -f /dev/$disk # Kill it with fire + f_eval_catch -d $funcname gpart "$GPART_DESTROY_F" $disk + f_eval_catch -d $funcname graid "$GRAID_DELETE" $disk + f_eval_catch -d $funcname zpool "$ZPOOL_LABELCLEAR_F" /dev/$disk # Make doubly-sure backup GPT is destroyed - f_quietly gpart create -s gpt $disk - f_quietly gpart destroy -F $disk + f_eval_catch -d $funcname gpart "$GPART_CREATE" gpt $disk + f_eval_catch -d $funcname gpart "$GPART_DESTROY_F" $disk - # Calculate partition size given desired amount of swap - f_dprintf "$funcname: Getting disk capactiy for \`%s'" "$disk" - if ! device_$disk get capacity disksize; then - f_dprintf "$funcname: Unable to get disk capacity of \`%s'" \ - "$disk" - msg_error="$msg_error: $funcname" \ - f_show_err "$msg_unable_to_get_disk_capacity" "$disk" - return $FAILURE - fi - partsize=$(( $disksize - $swapsize )) - f_dprintf "$funcname: disksize=[%s] partsize=[%s]" \ - "$disksize" "$partsize" + # + # Enable boot pool if encryption is desired + # + [ "$ZFSBOOT_GELI_ENCRYPTION" ] && ZFSBOOT_BOOT_POOL=1 # # Lay down the desired type of partition scheme @@ -693,147 +699,148 @@ zfs_create_diskpart() # # 1. Create GPT layout using labels # - f_eval_catch $funcname gpart "$GPART_CREATE" gpt \$disk || + f_eval_catch $funcname gpart "$GPART_CREATE" gpt $disk || return $FAILURE # # 2. Add small freebsd-boot partition labeled `boot#' # f_eval_catch $funcname gpart "$GPART_ADD_LABEL_WITH_SIZE" \ - gptboot\$index freebsd-boot 512k \$disk || + gptboot$index freebsd-boot 512k $disk || return $FAILURE f_eval_catch $funcname gpart "$GPART_BOOTCODE_PART" \ - /boot/pmbr /boot/gptzfsboot 1 \$disk || + /boot/pmbr /boot/gptzfsboot 1 $disk || return $FAILURE - # zpool will use the `zfs#' GPT labels + # NB: zpool will use the `zfs#' GPT labels bootpart=p2 targetpart=p2 + [ ${swapsize:-0} -gt 0 ] && targetpart=p3 - # Change things around if we are using geli(8) - if [ "$ZFSBOOT_GELI_ENCRYPTION" ]; then + # + # Prepare boot pool if enabled (e.g., for geli(8)) + # + if [ "$ZFSBOOT_BOOT_POOL" ]; then bootpart=p2 targetpart=p3 - partsize=$(( $partsize - $gelisize )) - f_dprintf "$funcname: gelisize=[%s]" \ - "gelisize=[$gelisize]" + [ ${swapsize:-0} -gt 0 ] && targetpart=p4 f_eval_catch $funcname gpart \ - "$GPART_ADD_LABEL_WITH_SIZE" boot\$index \ - freebsd-zfs \${gelisize}b \$disk || + "$GPART_ADD_LABEL_WITH_SIZE" boot$index \ + freebsd-zfs ${bootsize}b $disk || return $FAILURE - - # Pedantically nuke any old labels, stop geli - f_quietly zpool labelclear -f "/dev/$disk$bootpart" - f_quietly geli detach -f "/dev/$disk$targetpart" + # Pedantically nuke any old labels + f_eval_catch -d $funcname zpool "$ZPOOL_LABELCLEAR_F" \ + /dev/$disk$bootpart + if [ "$ZFSBOOT_GELI_ENCRYPTION" ]; then + # Pedantically detach targetpart for later + f_eval_catch -d $funcname geli \ + "$GELI_DETACH_F" \ + /dev/$disk$targetpart + fi fi # - # 3. Add freebsd-zfs partition labeled `zfs#' for zpool - # NOTE: Using above calculated partsize to leave room for swap. + # 3. Add freebsd-swap partition labeled `swap#' # if [ ${swapsize:-0} -gt 0 ]; then - f_dprintf "$funcname: partsize=[%s]" \ - "partsize=[$partsize]" f_eval_catch $funcname gpart \ - "$GPART_ADD_LABEL_WITH_SIZE" zfs\$index \ - freebsd-zfs \${partsize}b \$disk || + "$GPART_ADD_LABEL_WITH_SIZE" swap$index \ + freebsd-swap ${swapsize}b $disk || return $FAILURE - else - f_eval_catch $funcname gpart "$GPART_ADD_LABEL" \ - zfs\$index freebsd-zfs \$disk || + # Pedantically nuke any old labels on the swap + f_eval_catch -d $funcname zpool "$ZPOOL_LABELCLEAR_F" \ + /dev/gpt/swap$index + # Update fstab(5) + f_eval_catch $funcname printf "$PRINTF_FSTAB" \ + /dev/gpt/swap$index none swap sw 0 0 \ + $BSDINSTALL_TMPETC/fstab || return $FAILURE fi - f_quietly zpool labelclear -f "/dev/$disk$targetpart" # - # 4. Add freebsd-swap partition labeled `swap#' + # 4. Add freebsd-zfs partition labeled `zfs#' for zroot # - if [ $swapsize -gt 0 ]; then - f_eval_catch $funcname gpart "$GPART_ADD_LABEL" \ - swap\$index freebsd-swap \$disk || - return $FAILURE - # Update fstab(5) - f_eval_catch $funcname printf "$PRINTF_FSTAB" \ - /dev/gpt/swap\$index none swap sw 0 0 \ - \$BSDINSTALL_TMPETC/fstab || - return $FAILURE - fi + f_eval_catch $funcname gpart "$GPART_ADD_LABEL" \ + zfs$index freebsd-zfs $disk || return $FAILURE + f_eval_catch -d $funcname zpool "$ZPOOL_LABELCLEAR_F" \ + /dev/$disk$targetpart ;; MBR) f_dprintf "$funcname: Creating MBR layout..." # # 1. Create MBR layout (no labels) # - f_eval_catch $funcname gpart "$GPART_CREATE" mbr \$disk || + f_eval_catch $funcname gpart "$GPART_CREATE" mbr $disk || return $FAILURE f_eval_catch $funcname gpart "$GPART_BOOTCODE" /boot/mbr \ - \$disk || return $FAILURE + $disk || return $FAILURE # # 2. Add freebsd slice with all available space # - f_eval_catch $funcname gpart "$GPART_ADD" freebsd \$disk || + f_eval_catch $funcname gpart "$GPART_ADD" freebsd $disk || return $FAILURE - f_eval_catch $funcname gpart "$GPART_SET_ACTIVE" 1 \$disk || + f_eval_catch $funcname gpart "$GPART_SET_ACTIVE" 1 $disk || return $FAILURE - f_quietly zpool labelclear -f /dev/${disk}s1 # Pedantic - f_quietly gpart destroy -F ${disk}s1 # Pedantic + # Pedantically nuke any old labels + f_eval_catch -d $funcname zpool "$ZPOOL_LABELCLEAR_F" \ + /dev/${disk}s1 + # Pedantically nuke any old scheme + f_eval_catch -d $funcname gpart "$GPART_DESTROY_F" ${disk}s1 # # 3. Write BSD scheme to the freebsd slice # - f_eval_catch $funcname gpart "$GPART_CREATE" BSD \${disk}s1 || + f_eval_catch $funcname gpart "$GPART_CREATE" BSD ${disk}s1 || return $FAILURE - # zpool will use s1a (no labels) - bootpart=s1a targetpart=s1a mbrindex=1 + # NB: zpool will use s1a (no labels) + bootpart=s1a targetpart=s1d mbrindex=4 - # Change things around if we are using geli(8) + # + # Always prepare a boot pool on MBR + # + ZFSBOOT_BOOT_POOL=1 + f_eval_catch $funcname gpart \ + "$GPART_ADD_INDEX_WITH_SIZE" \ + 1 freebsd-zfs ${bootsize}b ${disk}s1 || + return $FAILURE + # Pedantically nuke any old labels + f_eval_catch -d $funcname zpool "$ZPOOL_LABELCLEAR_F" \ + /dev/$disk$bootpart if [ "$ZFSBOOT_GELI_ENCRYPTION" ]; then - bootpart=s1a targetpart=s1d - partsize=$(( $partsize - $gelisize )) - mbrindex=4 # If this is s1a then make the zpool s1d - f_dprintf "$funcname: mbrindex=[%s] gelisize=[%s]" \ - "$mbrindex" "$gelisize" - f_eval_catch $funcname gpart \ - "$GPART_ADD_INDEX_WITH_SIZE" \ - 1 freebsd-zfs \${gelisize}b \${disk}s1 || - return $FAILURE - # Pedantically nuke any old labels, stop geli - f_quietly zpool labelclear -f "/dev/$disk$bootpart" - f_quietly geli detach -f "/dev/$disk$targetpart" + # Pedantically detach targetpart for later + f_eval_catch -d $funcname geli \ + "$GELI_DETACH_F" \ + /dev/$disk$targetpart fi # - # 4. Partition the BSD slice for ZFS - # NOTE: Using above calculated partsize to leave room for swap. + # 4. Add freebsd-swap partition # if [ ${swapsize:-0} -gt 0 ]; then - f_dprintf "$funcname: mbrindex=[%s] partsize=[%s]" \ - "$mbrindex" "$partsize" f_eval_catch $funcname gpart \ - "$GPART_ADD_INDEX_WITH_SIZE" \ - \$mbrindex freebsd-zfs \${partsize}b \ - \${disk}s1 || return $FAILURE - else - f_dprintf "$funcname: mbrindex=[%s]" "$mbrindex" - f_eval_catch $funcname gpart "$GPART_ADD_INDEX" \ - \$mbrindex freebsd-zfs \${disk}s1 || - return $FAILURE - fi - f_quietly zpool labelclear -f /dev/$disk$targetpart # Pedantic - - # - # 5. Add freebsd-swap partition - # - if [ $swapsize -gt 0 ]; then - f_eval_catch $funcname gpart "$GPART_ADD_INDEX" \ - 2 freebsd-swap \${disk}s1 || + "$GPART_ADD_INDEX_WITH_SIZE" 2 \ + freebsd-swap ${swapsize}b ${disk}s1 || return $FAILURE + # Pedantically nuke any old labels on the swap + f_eval_catch -d $funcname zpool "$ZPOOL_LABELCLEAR_F" \ + /dev/${disk}s1b # Update fstab(5) f_eval_catch $funcname printf "$PRINTF_FSTAB" \ - /dev/\${disk}s1b none swap sw 0 0 \ - \$BSDINSTALL_TMPETC/fstab || + /dev/${disk}s1b none swap sw 0 0 \ + $BSDINSTALL_TMPETC/fstab || return $FAILURE fi + + # + # 5. Add freebsd-zfs partition for zroot + # + f_eval_catch $funcname gpart "$GPART_ADD_INDEX" \ + $mbrindex freebsd-zfs ${disk}s1 || return $FAILURE + f_eval_catch -d $funcname zpool "$ZPOOL_LABELCLEAR_F" \ + /dev/$disk$targetpart # Pedantic + f_eval_catch $funcname dd "$DD_WITH_OPTIONS" \ + /boot/zfsboot /dev/${disk}s1 count=1 || + return $FAILURE ;; esac # $ZFSBOOT_PARTITION_SCHEME @@ -849,16 +856,18 @@ zfs_create_diskpart() zfs_create_boot() { local funcname=zfs_create_boot - local poolname="$1" vdev_type="$2" - local bootpart targetpart - - shift 2 # name vdev_type - - # We may need this later - local disks="$*" + local zroot_name="$1" + local zroot_vdevtype="$2" + local zroot_vdevs= # Calculated below + local boot_vdevs= # Used for geli(8) and/or MBR layouts + shift 2 # poolname vdev_type + local disks="$*" disk + local bootpart targetpart # Set by zfs_create_diskpart() below + # # Pedantic checks; should never be seen - if [ ! "$poolname" ]; then + # + if [ ! "$zroot_name" ]; then f_dprintf "$funcname: NULL poolname" msg_error="$msg_error: $funcname" \ f_show_err "$msg_null_poolname" @@ -871,132 +880,130 @@ zfs_create_boot() return $FAILURE fi f_dprintf "$funcname: poolname=[%s] vdev_type=[%s]" \ - "$poolname" "$vdev_type" + "$zroot_name" "$zroot_vdevtype" + # # Initialize fstab(5) + # f_dprintf "$funcname: Initializing temporary fstab(5) file..." - f_eval_catch $funcname sh \ - "$SHELL_TRUNCATE" \$BSDINSTALL_TMPETC/fstab || + f_eval_catch $funcname sh "$SHELL_TRUNCATE" $BSDINSTALL_TMPETC/fstab || return $FAILURE f_eval_catch $funcname printf "$PRINTF_FSTAB" \ "# Device" Mountpoint FStype Options Dump "Pass#" \ - \$BSDINSTALL_TMPETC/fstab || return $FAILURE + $BSDINSTALL_TMPETC/fstab || return $FAILURE + # # Expand SI units in desired sizes - f_dprintf "$funcname: Expanding supplied swapsize/gelisize values..." - local swapsize gelisize + # + f_dprintf "$funcname: Expanding supplied size values..." + local swapsize bootsize if ! f_expand_number "$ZFSBOOT_SWAP_SIZE" swapsize; then f_dprintf "$funcname: Invalid swap size \`%s'" \ "$ZFSBOOT_SWAP_SIZE" f_show_err "$msg_invalid_swap_size" "$ZFSBOOT_SWAP_SIZE" return $FAILURE fi - if ! f_expand_number "$ZFSBOOT_GELI_BOOT_SIZE" gelisize; then - f_dprintf "$funcname: Invalid geli(8) boot size \`%s'" \ - "$ZFSBOOT_GELI_BOOT_SIZE" - f_show_err "$msg_invalid_geli_boot_size" \ - "$ZFSBOOT_GELI_BOOT_SIZE" + if ! f_expand_number "$ZFSBOOT_BOOT_POOL_SIZE" bootsize; then + f_dprintf "$funcname: Invalid boot pool size \`%s'" \ + "$ZFSBOOT_BOOT_POOL_SIZE" + f_show_err "$msg_invalid_boot_pool_size" \ + "$ZFSBOOT_BOOT_POOL_SIZE" return $FAILURE fi f_dprintf "$funcname: ZFSBOOT_SWAP_SIZE=[%s] swapsize=[%s]" \ "$ZFSBOOT_SWAP_SIZE" "$swapsize" - f_dprintf "$funcname: ZFSBOOT_GELI_BOOT_SIZE=[%s] gelisize=[%s]" \ - "$ZFSBOOT_GELI_BOOT_SIZE" "$gelisize" + f_dprintf "$funcname: ZFSBOOT_BOOT_POOL_SIZE=[%s] bootsize=[%s]" \ + "$ZFSBOOT_BOOT_POOL_SIZE" "$bootsize" - # Prepare the disks + # + # Prepare the disks and build pool device list(s) + # f_dprintf "$funcname: Preparing disk partitions for ZFS pool..." + [ "$ZFSBOOT_GNOP_4K_FORCE_ALIGN" ] && + f_dprintf "$funcname: With 4k alignment using gnop(8)..." local n=0 - for disk in $*; do + for disk in $disks; do zfs_create_diskpart $disk $n || return $FAILURE - n=$(( $n + 1 )) - done - - # MBR boot loader hack part 1 - # We have to do this early because geli gets in the way later - if [ "$ZFSBOOT_PARTITION_SCHEME" = "MBR" ]; then - f_dprintf "$funcname: Copying MBR boot loader to disks..." - f_dprintf "$funcname: disks=[%s]" "$disks" - for disk in $disks; do - f_dprintf "$funcname: disk=[%s]" "$disk" - f_eval_catch $funcname dd "$DD_WITH_OPTIONS" \ - /boot/zfsboot /dev/\${disk}s1 count=1 || - return $FAILURE - done - fi - - # Forced 4k alignment support provided by Geom NOP (see gnop(8)) - local unenc_list= - if [ "$ZFSBOOT_GNOP_4K_FORCE_ALIGN" ]; then - local part="$targetpart" new_list= - - # We don't gnop the encrypted partition because geli will do - # this for us gnop the unencrypted disk - [ "$ZFSBOOT_GELI_ENCRYPTION" ] && part="$bootpart" - - f_dprintf "$funcname: Applying 4k alignment with gnop(8)..." - f_dprintf "$funcname: *=[%s]" "$*" - for disk in $*; do - f_dprintf "$funcname: disk=[%s] part=[%s]" \ - "$disk" "$part" - f_eval_catch $funcname gnop "$GNOP_CREATE" \ - \$disk\$part || return $FAILURE + # Now $bootpart and $targetpart are set (suffix for $disk) + + # Forced 4k alignment support using Geom NOP (see gnop(8)) + if [ "$ZFSBOOT_GNOP_4K_FORCE_ALIGN" ]; then + if [ "$ZFSBOOT_BOOT_POOL" ]; then + boot_vdevs="$boot_vdevs $disk$bootpart.nop" + f_eval_catch $funcname gnop "$GNOP_CREATE" \ + $disk$bootpart || return $FAILURE + fi + # Don't gnop encrypted partition if [ "$ZFSBOOT_GELI_ENCRYPTION" ]; then - unenc_list="$unenc_list $disk$part.nop" + zroot_vdevs="$zroot_vdevs $disk$targetpart.eli" else - new_list="$new_list $disk$targetpart.nop" + zroot_vdevs="$zroot_vdevs $disk$targetpart.nop" + f_eval_catch $funcname gnop "$GNOP_CREATE" \ + $disk$targetpart || + return $FAILURE fi - done - set -- $new_list - else - local new_list= - for disk in $*; do - new_list="$new_list $disk$targetpart" - [ "$ZFSBOOT_GELI_ENCRYPTION" ] && - unenc_list="$unenc_list $disk$bootpart" - done - set -- $new_list - fi + else + if [ "$ZFSBOOT_BOOT_POOL" ]; then + boot_vdevs="$boot_vdevs $disk$bootpart" + fi + zroot_vdevs="$zroot_vdevs $disk$targetpart" + fi + + n=$(( $n + 1 )) + done # disks # - # If encryption is enabled, we need to create the GEOMs + # If we need/want a boot pool, create it # - if [ "$ZFSBOOT_GELI_ENCRYPTION" ]; then - local bootvdev= options= - local geli_pool="$BSDINSTALL_CHROOT/$ZFSBOOT_GELI_POOL_NAME" - local key="$ZFSBOOT_GELI_KEY_FILE" - - f_dprintf "$funcname: Setting up disk encryption..." + if [ "$ZFSBOOT_BOOT_POOL" ]; then + local bootpool_vdevtype= # Calculated below + local bootpool_options= # Calculated below + local bootpool_name="$ZFSBOOT_BOOT_POOL_NAME" + local bootpool="$BSDINSTALL_CHROOT/$bootpool_name" + local zroot_key="${ZFSBOOT_GELI_KEY_FILE#/}" + + f_dprintf "$funcname: Setting up boot pool..." + [ "$ZFSBOOT_GELI_ENCRYPTION" ] && + f_dprintf "$funcname: For encrypted root disk..." - # Create the parent directories for our unencrypted pool - f_quietly umount /mnt + # Create parent directory for boot pool + f_eval_catch -d $funcname umount "$UMOUNT" /mnt f_eval_catch $funcname mount "$MOUNT_TYPE" tmpfs none \ - \$BSDINSTALL_CHROOT || return $FAILURE + $BSDINSTALL_CHROOT || return $FAILURE - # Create mirror across the unencrypted partition on all disks - [ $( set -- $unenc_list; echo $# ) -gt 1 ] && bootvdev=mirror + # Create mirror across the boot partition on all disks + [ $( set -- $boot_vdevs; echo $# ) -gt 1 ] && + bootpool_vdevtype=mirror - f_dprintf "$funcname: %s %s %s" \ - "ZFSBOOT_GELI_POOL_NAME=[$ZFSBOOT_GELI_POOL_NAME]" \ - "bootvdev=[$bootvdev]" "unenc_list=[$unenc_list]" - options="-o altroot=\"\$BSDINSTALL_CHROOT\"" - options="$options -m \"/\$ZFSBOOT_GELI_POOL_NAME\"" - options="$options -f" + bootpool_options="-o altroot=$BSDINSTALL_CHROOT" + bootpool_options="$bootpool_options -m \"/$bootpool_name\" -f" f_eval_catch $funcname zpool "$ZPOOL_CREATE_WITH_OPTIONS" \ - "$options" \$ZFSBOOT_GELI_POOL_NAME \$bootvdev \ - \$unenc_list || return $FAILURE - - f_dprintf "$funcname: geli_pool=[%s]" "$geli_pool" - f_eval_catch $funcname mkdir "$MKDIR_P" \$geli_pool/boot || + "$bootpool_options" "$bootpool_name" \ + "$bootpool_vdevtype" "$boot_vdevs" || return $FAILURE - # Generate an encryption key using random(4) - f_dprintf "$funcname: key=[%s]" "$key" - f_eval_catch $funcname dd "$DD_WITH_OPTIONS" \ - /dev/random \$geli_pool/\$key "bs=4096 count=1" || + f_eval_catch $funcname mkdir "$MKDIR_P" "$bootpool/boot" || return $FAILURE - # Create the geli(8) GEOMS - local geli_list + if [ "$ZFSBOOT_GELI_ENCRYPTION" ]; then + # Generate an encryption key using random(4) + f_eval_catch $funcname dd "$DD_WITH_OPTIONS" \ + /dev/random "$bootpool/$zroot_key" \ + "bs=4096 count=1" || return $FAILURE + else + # Clean up + f_eval_catch $funcname zfs "$ZFS_UNMOUNT" \ + "$bootpool_name" || return $FAILURE + f_eval_catch -d $funcname umount "$UMOUNT" /mnt # tmpfs + fi + + fi + + # + # Create the geli(8) GEOMS + # + if [ "$ZFSBOOT_GELI_ENCRYPTION" ]; then + # Prompt user for password (twice) if ! msg_enter_new_password="$msg_geli_password" \ f_dialog_input_password then @@ -1004,57 +1011,57 @@ zfs_create_boot() f_show_err "$msg_user_cancelled" return $FAILURE fi - f_dprintf "$funcname: disks=[%s]" "$disks" + + # Initialize geli(8) on each of the target partitions for disk in $disks; do - f_dprintf "$funcname: disk=[%s] targetpart=[%s]" \ - "$disk" "$targetpart" f_dialog_info "$msg_geli_setup" \ 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD - if ! echo "$pw_password" | f_eval_catch $funcname \ - geli "$GELI_PASSWORD_INIT" \ - \$geli_pool/boot/\$disk\$targetpart.eli \ - AES-XTS \$geli_pool/\$key \$disk\$targetpart + if ! echo "$pw_password" | f_eval_catch \ + $funcname geli "$GELI_PASSWORD_INIT" \ + "$bootpool/boot/$disk$targetpart.eli" \ + AES-XTS "$bootpool/$zroot_key" \ + $disk$targetpart then f_interactive || f_die + unset pw_password # Sensitive info return $FAILURE fi - if ! echo "$pw_password" | f_eval_catch $funcname \ - geli "$GELI_ATTACH" \$geli_pool/\$key \ - \$disk\$targetpart + if ! echo "$pw_password" | f_eval_catch \ + $funcname geli "$GELI_ATTACH" \ + "$bootpool/$zroot_key" $disk$targetpart then f_interactive || f_die + unset pw_password # Sensitive info return $FAILURE fi - geli_list="$geli_list $disk$targetpart.eli" done - set -- $geli_list - f_eval_catch $funcname zfs "$ZFS_UNMOUNT" \ - \$ZFSBOOT_GELI_POOL_NAME || return $FAILURE - f_quietly umount /mnt # done with tmpfs + unset pw_password # Sensitive info + + # Clean up + f_eval_catch $funcname zfs "$ZFS_UNMOUNT" "$bootpool_name" || + return $FAILURE + f_eval_catch -d $funcname umount "$UMOUNT" /mnt # tmpfs fi # - # Create the ZFS pool with desired type and disk devices + # Create the ZFS root pool with desired type and disk devices # - local vdevs="$*" - f_dprintf "$funcname: Creating boot pool..." - f_dprintf "poolname=[%s] vdev_type=[%s] vdevs=[%s]" \ - "$poolname" "$vdev_type" "$vdevs" + f_dprintf "$funcname: Creating root pool..." f_eval_catch $funcname zpool "$ZPOOL_CREATE_WITH_OPTIONS" \ - "-o altroot=\"\$BSDINSTALL_CHROOT\" -m none -f" \ - \$poolname \$vdev_type \$vdevs + "-o altroot=$BSDINSTALL_CHROOT -m none -f" \ + "$zroot_name" "$zroot_vdevtype" "$zroot_vdevs" || + return $FAILURE - # Customize the zpool a bit... + # Customize the zroot a bit... local option - f_dprintf "$funcname: Setting miscellaneous options on boot pool..." - for option in checksum=fletcher4 atime=off; do - f_dprintf "$funcname: option=[%s]" "$option" - f_eval_catch $funcname zfs "$ZFS_SET" \$option \$poolname || - return $FAILURE + f_dprintf "$funcname: Setting miscellaneous options on root pool..." + for option in atime=off; do + f_eval_catch $funcname zfs "$ZFS_SET" $option "$zroot_name" || + return $FAILURE done # - # Create ZFS dataset layout within the new boot pool + # Create ZFS dataset layout within the new root pool # f_dprintf "$funcname: Creating ZFS datasets..." echo "$ZFSBOOT_DATASETS" | while read dataset options; do @@ -1073,10 +1080,8 @@ zfs_create_boot() # Replace both commas and spaces with ` -o ' f_replaceall "$options" "[ ,]" " -o " options # Create the dataset with desired options - f_dprintf "$funcname: dataset=[%s] options=[%s]" \ - "$dataset" "$options" f_eval_catch $funcname zfs "$ZFS_CREATE_WITH_OPTIONS" \ - "\${options:+-o \$options}" \$poolname\$dataset || + "${options:+-o $options}" "$zroot_name$dataset" || return $FAILURE done @@ -1084,57 +1089,53 @@ zfs_create_boot() f_dprintf "$funcname: Modifying directory permissions..." local dir for dir in /tmp /var/tmp; do - f_dprintf "$funcname: dir=[%s]" "$dir" f_eval_catch $funcname chmod "$CHMOD_MODE" 1777 \ - \$BSDINSTALL_CHROOTDIR\$dir || return $FAILURE + $BSDINSTALL_CHROOTDIR$dir || return $FAILURE done # Create symlink(s) - if [ "$ZFSBOOT_GELI_ENCRYPTION" ]; then - f_dprintf "$funcname: Creating /boot symlink for GELI..." - f_eval_catch $funcname ln "$LN_SF" \ - \$ZFSBOOT_GELI_POOL_NAME/boot \ - \$BSDINSTALL_CHROOT/boot || return $FAILURE + if [ "$ZFSBOOT_BOOT_POOL" ]; then + f_dprintf "$funcname: Creating /boot symlink for boot pool..." + f_eval_catch $funcname ln "$LN_SF" "$bootpool_name/boot" \ + $BSDINSTALL_CHROOT/boot || return $FAILURE fi # Set bootfs property + local zroot_bootfs="$ZFSBOOT_BEROOT_NAME/$ZFSBOOT_BOOTFS_NAME" f_dprintf "$funcname: Setting bootfs property..." - f_dprintf "$funcname: %s %s" \ - "ZFSBOOT_BEROOT_NAME=[$ZFSBOOT_BEROOT_NAME]" \ - "ZFSBOOT_BOOTFS_NAME=[$ZFSBOOT_BOOTFS_NAME]" f_eval_catch $funcname zpool "$ZPOOL_SET" \ - bootfs=\"\$poolname/\$ZFSBOOT_BEROOT_NAME/\$ZFSBOOT_BOOTFS_NAME\" \ - \$poolname || return $FAILURE + "bootfs=\"$zroot_name/$zroot_bootfs\"" "$zroot_name" || + return $FAILURE # Export the pool(s) f_dprintf "$funcname: Temporarily exporting ZFS pool(s)..." - f_eval_catch $funcname zpool "$ZPOOL_EXPORT" \$poolname || + f_eval_catch $funcname zpool "$ZPOOL_EXPORT" "$zroot_name" || return $FAILURE - if [ "$ZFSBOOT_GELI_ENCRYPTION" ]; then + if [ "$ZFSBOOT_BOOT_POOL" ]; then f_eval_catch $funcname zpool "$ZPOOL_EXPORT" \ - \$ZFSBOOT_GELI_POOL_NAME || return $FAILURE + "$bootpool_name" || return $FAILURE fi # Destroy the gnop devices (if enabled) for disk in ${ZFSBOOT_GNOP_4K_FORCE_ALIGN:+$disks}; do - if [ "$ZFSBOOT_GELI_ENCRYPTION" ]; then - f_quietly gnop destroy $disk$bootpart.nop - else - f_quietly gnop destroy $disk$targetpart.nop + if [ "$ZFSBOOT_BOOT_POOL" ]; then + f_eval_catch -d $funcname gnop "$GNOP_DESTROY" \ + $disk$bootpart.nop + fi + if [ ! "$ZFSBOOT_GELI_ENCRYPTION" ]; then + f_eval_catch -d $funcname gnop "$GNOP_DESTROY" \ + $disk$targetpart.nop fi done - # MBR boot loader hack part 2 + # MBR boot loader touch-up if [ "$ZFSBOOT_PARTITION_SCHEME" = "MBR" ]; then f_dprintf "$funcname: Updating MBR boot loader on disks..." - f_dprintf "$funcname: disks=[%s]" # Stick the ZFS boot loader in the "convienient hole" after # the ZFS internal metadata for disk in $disks; do - f_dprintf "$funcname: disk=[%s] bootpart=[%s]" \ - "$disk" "$bootpart" f_eval_catch $funcname dd "$DD_WITH_OPTIONS" \ - /boot/zfsboot /dev/\$disk\$bootpart \ + /boot/zfsboot /dev/$disk$bootpart \ "skip=1 seek=1024" || return $FAILURE done fi @@ -1142,74 +1143,79 @@ zfs_create_boot() # Re-import the ZFS pool(s) f_dprintf "$funcname: Re-importing ZFS pool(s)..." f_eval_catch $funcname zpool "$ZPOOL_IMPORT_WITH_OPTIONS" \ - "-o altroot=\"\$BSDINSTALL_CHROOT\"" \$poolname || + "-o altroot=\"$BSDINSTALL_CHROOT\"" "$zroot_name" || return $FAILURE - if [ "$ZFSBOOT_GELI_ENCRYPTION" ]; then + if [ "$ZFSBOOT_BOOT_POOL" ]; then f_eval_catch $funcname zpool "$ZPOOL_IMPORT_WITH_OPTIONS" \ - "-o altroot=\"\$BSDINSTALL_CHROOT\"" \ - \$ZFSBOOT_GELI_POOL_NAME || return $FAILURE + "-o altroot=\"$BSDINSTALL_CHROOT\"" \ + "$bootpool_name" || return $FAILURE fi # While this is apparently not needed, it seems to help MBR - f_dprintf "$funcname: Configuring zpool.cache..." - f_eval_catch $funcname mkdir "$MKDIR_P" \$BSDINSTALL_CHROOT/boot/zfs || + f_dprintf "$funcname: Configuring zpool.cache for zroot..." + f_eval_catch $funcname mkdir "$MKDIR_P" $BSDINSTALL_CHROOT/boot/zfs || return $FAILURE f_eval_catch $funcname zpool "$ZPOOL_SET" \ - cachefile=\"\$BSDINSTALL_CHROOT/boot/zfs/zpool.cache\" \ - \$poolname || return $FAILURE + "cachefile=\"$BSDINSTALL_CHROOT/boot/zfs/zpool.cache\"" \ + "$zroot_name" || return $FAILURE # Last, but not least... required lines for rc.conf(5)/loader.conf(5) # NOTE: We later concatenate these into their destination f_dprintf "%s: Configuring rc.conf(5)/loader.conf(5) additions..." \ "$funcname" f_eval_catch $funcname echo "$ECHO_APPEND" 'zfs_enable=\"YES\"' \ - \$BSDINSTALL_TMPETC/rc.conf.zfs || return $FAILURE + $BSDINSTALL_TMPETC/rc.conf.zfs || return $FAILURE f_eval_catch $funcname echo "$ECHO_APPEND" 'zfs_load=\"YES\"' \ - \$BSDINSTALL_TMPBOOT/loader.conf.zfs || return $FAILURE + $BSDINSTALL_TMPBOOT/loader.conf.zfs || return $FAILURE - # We're all done unless we should go on to do encryption - [ "$ZFSBOOT_GELI_ENCRYPTION" ] || return $SUCCESS + # We're all done unless we should go on for boot pool + [ "$ZFSBOOT_BOOT_POOL" ] || return $SUCCESS + + # Set cachefile for boot pool so it auto-imports at system start + f_dprintf "$funcname: Configuring zpool.cache for boot pool..." + f_eval_catch $funcname zpool "$ZPOOL_SET" \ + "cachefile=\"$BSDINSTALL_CHROOT/boot/zfs/zpool.cache\"" \ + "$bootpool_name" || return $FAILURE # Some additional geli(8) requirements for loader.conf(5) for option in \ - zpool_cache_load=\"YES\" \ - zpool_cache_type=\"/boot/zfs/zpool.cache\" \ - zpool_cache_name=\"/boot/zfs/zpool.cache\" \ + 'zpool_cache_load=\"YES\"' \ + 'zpool_cache_type=\"/boot/zfs/zpool.cache\"' \ + 'zpool_cache_name=\"/boot/zfs/zpool.cache\"' \ ; do - f_eval_catch $funcname echo "$ECHO_APPEND" \$option \ - \$BSDINSTALL_TMPBOOT/loader.conf.zfs || + f_eval_catch $funcname echo "$ECHO_APPEND" "$option" \ + $BSDINSTALL_TMPBOOT/loader.conf.zfs || return $FAILURE done + f_eval_catch $funcname printf "$PRINTF_CONF" vfs.root.mountfrom \ + "\"zfs:$zroot_name/$zroot_bootfs\"" \ + $BSDINSTALL_TMPBOOT/loader.conf.root || return $FAILURE + + # We're all done unless we should go on to do encryption + [ "$ZFSBOOT_GELI_ENCRYPTION" ] || return $SUCCESS # # Configure geli(8)-based encryption # f_dprintf "$funcname: Configuring disk encryption..." f_eval_catch $funcname echo "$ECHO_APPEND" 'aesni_load=\"YES\"' \ - \$BSDINSTALL_TMPBOOT/loader.conf.aesni || return $FAILURE + $BSDINSTALL_TMPBOOT/loader.conf.aesni || return $FAILURE f_eval_catch $funcname echo "$ECHO_APPEND" 'geom_eli_load=\"YES\"' \ - \$BSDINSTALL_TMPBOOT/loader.conf.geli || return $FAILURE - f_eval_catch $funcname printf "$PRINTF_CONF" vfs.root.mountfrom \ - '"zfs:$poolname/$ZFSBOOT_BEROOT_NAME/$ZFSBOOT_BOOTFS_NAME"' \ - \$BSDINSTALL_TMPBOOT/loader.conf.root || return $FAILURE - f_dprintf "$funcname: disks=[%s]" "$disks" + $BSDINSTALL_TMPBOOT/loader.conf.geli || return $FAILURE for disk in $disks; do - f_dprintf "$funcname: %s %s %s" \ - "disk=[$disk]" "targetpart=[$targetpart]" \ - "ZFSBOOT_GELI_KEY_FILE=[$ZFSBOOT_GELI_KEY_FILE]" f_eval_catch $funcname printf "$PRINTF_CONF" \ - geli_%s_keyfile0_load '"$disk$targetpart" YES' \ - \$BSDINSTALL_TMPBOOT/loader.conf.\$disk\$targetpart || + geli_%s_keyfile0_load "$disk$targetpart YES" \ + $BSDINSTALL_TMPBOOT/loader.conf.$disk$targetpart || return $FAILURE f_eval_catch $funcname printf "$PRINTF_CONF" \ geli_%s_keyfile0_type \ - '"$disk$targetpart" "$disk$targetpart:geli_keyfile0"' \ - \$BSDINSTALL_TMPBOOT/loader.conf.\$disk\$targetpart || + "$disk$targetpart $disk$targetpart:geli_keyfile0" \ + $BSDINSTALL_TMPBOOT/loader.conf.$disk$targetpart || return $FAILURE f_eval_catch $funcname printf "$PRINTF_CONF" \ geli_%s_keyfile0_name \ - '"$disk$targetpart" "$ZFSBOOT_GELI_KEY_FILE"' \ - \$BSDINSTALL_TMPBOOT/loader.conf.\$disk\$targetpart || + "$disk$targetpart \"$ZFSBOOT_GELI_KEY_FILE\"" \ + $BSDINSTALL_TMPBOOT/loader.conf.$disk$targetpart || return $FAILURE done @@ -1258,7 +1264,7 @@ f_dialog_backtitle "$msg_freebsd_install # f_dprintf "BSDINSTALL_CHROOT=[%s]" "$BSDINSTALL_CHROOT" f_dprintf "BSDINSTALL_TMPETC=[%s]" "$BSDINSTALL_TMPETC" -f_dprintf "PRINTF_FSTAB=[%s]" "$PRINTF_FSTAB" +f_dprintf "FSTAB_FMT=[%s]" "$FSTAB_FMT" # # Loop over the main menu until we've accomplished what we came here to do @@ -1296,11 +1302,11 @@ while :; do # Make sure each disk will be at least 50% ZFS if f_expand_number "$ZFSBOOT_SWAP_SIZE" swapsize && - f_expand_number "$ZFSBOOT_GELI_BOOT_SIZE" gelisize + f_expand_number "$ZFSBOOT_BOOT_POOL_SIZE" bootsize then minsize=$swapsize teeny_disks= - [ "$ZFSBOOT_GELI_ENCRYPTION" ] && - minsize=$(( $minsize + $gelisize )) + [ "$ZFSBOOT_BOOT_POOL" ] && + minsize=$(( $minsize + $bootsize )) for disk in $ZFSBOOT_DISKS; do device_$disk get capacity disksize || continue *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-10@FreeBSD.ORG Thu Dec 19 19:15:24 2013 Return-Path: Delivered-To: svn-src-stable-10@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 ESMTPS id D6D2161D; Thu, 19 Dec 2013 19:15:24 +0000 (UTC) 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 B677A1F56; Thu, 19 Dec 2013 19:15:24 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBJJFOSC065839; Thu, 19 Dec 2013 19:15:24 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBJJFOsK065838; Thu, 19 Dec 2013 19:15:24 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201312191915.rBJJFOsK065838@svn.freebsd.org> From: Navdeep Parhar Date: Thu, 19 Dec 2013 19:15:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259622 - stable/10/share/man/man4 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Dec 2013 19:15:24 -0000 Author: np Date: Thu Dec 19 19:15:24 2013 New Revision: 259622 URL: http://svnweb.freebsd.org/changeset/base/259622 Log: MFC r259569: cxgbe.4: Belated update to the man page to reflect T5 support. Modified: stable/10/share/man/man4/cxgbe.4 Directory Properties: stable/10/ (props changed) Modified: stable/10/share/man/man4/cxgbe.4 ============================================================================== --- stable/10/share/man/man4/cxgbe.4 Thu Dec 19 18:52:41 2013 (r259621) +++ stable/10/share/man/man4/cxgbe.4 Thu Dec 19 19:15:24 2013 (r259622) @@ -1,4 +1,4 @@ -.\" Copyright (c) 2011-2012, Chelsio Inc +.\" Copyright (c) 2011-2013, Chelsio Inc .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without @@ -31,12 +31,12 @@ .\" .\" $FreeBSD$ .\" -.Dd February 25, 2012 +.Dd December 18, 2013 .Dt CXGBE 4 .Os .Sh NAME .Nm cxgbe -.Nd "Chelsio T4 10Gb and 1Gb Ethernet adapter driver" +.Nd "Chelsio T4 and T5 based 40Gb, 10Gb, and 1Gb Ethernet adapter driver" .Sh SYNOPSIS To compile this driver into the kernel, place the following lines in your @@ -50,13 +50,14 @@ module at boot time, place the following .Xr loader.conf 5 : .Bd -literal -offset indent t4fw_cfg_load="YES" +t5fw_cfg_load="YES" if_cxgbe_load="YES" .Ed .Sh DESCRIPTION The .Nm driver provides support for PCI Express Ethernet adapters based on -the Chelsio Terminator 4 (T4) ASIC. +the Chelsio Terminator 4 and Terminator 5 ASICs (T4 and T5). The driver supports Jumbo Frames, Transmit/Receive checksum offload, TCP segmentation offload (TSO), Large Receive Offload (LRO), VLAN tag insertion/extraction, VLAN checksum offload, VLAN TSO, and @@ -65,11 +66,50 @@ For further hardware information and que requirements, see .Pa http://www.chelsio.com/ . .Pp +Note that ports of T5 cards are named cxl and attach to a t5nex parent device +(in contrast to ports named cxgbe that attach to a t4nex parent for a T4 card). +Loader tunables with the hw.cxgbe prefix apply to both T4 and T5 cards. +The sysctl MIBs are at dev.t5nex and dev.cxl for T5 cards and at dev.t4nex and +dev.cxgbe for T4 cards. + +.Pp For more information on configuring this device, see .Xr ifconfig 8 . .Sh HARDWARE The .Nm +driver supports 40Gb, 10Gb and 1Gb Ethernet adapters based on the T5 ASIC +(ports will be named cxl): +.Pp +.Bl -bullet -compact +.It +Chelsio T580-CR +.It +Chelsio T580-LP-CR +.It +Chelsio T580-LP-SO-CR +.It +Chelsio T560-CR +.It +Chelsio T540-CR +.It +Chelsio T540-LP-CR +.It +Chelsio T522-CR +.It +Chelsio T520-LL-CR +.It +Chelsio T520-CR +.It +Chelsio T520-SO +.It +Chelsio T520-BT +.It +Chelsio T504-BT +.El +.Pp +The +.Nm driver supports 10Gb and 1Gb Ethernet adapters based on the T4 ASIC: .Pp .Bl -bullet -compact @@ -139,8 +179,8 @@ by default (all values are in microsecon value from this list. The default value is 1 for both 10Gb and 1Gb ports, which means the timer value is 5us. -Different cxgbe interfaces can be assigned different values at any time via the -dev.cxgbe.X.holdoff_tmr_idx sysctl. +Different interfaces can be assigned different values at any time via the +dev.cxgbe.X.holdoff_tmr_idx or dev.cxl.X.holdoff_tmr_idx sysctl. .It Va hw.cxgbe.holdoff_pktc_idx_10G .It Va hw.cxgbe.holdoff_pktc_idx_1G The packet-count index value to use to delay interrupts. @@ -149,8 +189,8 @@ and the index selects a value from this The default value is -1 for both 10Gb and 1Gb ports, which means packet counting is disabled and interrupts are generated based solely on the holdoff timer value. -Different cxgbe interfaces can be assigned different values via the -dev.cxgbe.X.holdoff_pktc_idx sysctl. +Different interfaces can be assigned different values via the +dev.cxgbe.X.holdoff_pktc_idx or dev.cxl.X.holdoff_pktc_idx sysctl. This sysctl works only when the interface has never been marked up (as done by ifconfig up). .It Va hw.cxgbe.qsize_txq @@ -161,16 +201,16 @@ software queuing. See .Xr ifnet 9 . The default value is 1024. -Different cxgbe interfaces can be assigned different values via the -dev.cxgbe.X.qsize_txq sysctl. +Different interfaces can be assigned different values via the +dev.cxgbe.X.qsize_txq sysctl or dev.cxl.X.qsize_txq sysctl. This sysctl works only when the interface has never been marked up (as done by ifconfig up). .It Va hw.cxgbe.qsize_rxq The size, in number of entries, of the descriptor ring used for an rx queue. The default value is 1024. -Different cxgbe interfaces can be assigned different values via the -dev.cxgbe.X.qsize_rxq sysctl. +Different interfaces can be assigned different values via the +dev.cxgbe.X.qsize_rxq or dev.cxl.X.qsize_rxq sysctl. This sysctl works only when the interface has never been marked up (as done by ifconfig up). .It Va hw.cxgbe.interrupt_types @@ -231,6 +271,10 @@ The .Nm device driver first appeared in .Fx 9.0 . +Support for T5 cards first appeared in +.Fx 9.2 +and +.Fx 10.0 . .Sh AUTHORS .An -nosplit The From owner-svn-src-stable-10@FreeBSD.ORG Thu Dec 19 21:03:09 2013 Return-Path: Delivered-To: svn-src-stable-10@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 ESMTPS id 3F1B71A4; Thu, 19 Dec 2013 21:03:09 +0000 (UTC) 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 2A7BF18D9; Thu, 19 Dec 2013 21:03:09 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBJL396Z006403; Thu, 19 Dec 2013 21:03:09 GMT (envelope-from peter@svn.freebsd.org) Received: (from peter@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBJL39fS006402; Thu, 19 Dec 2013 21:03:09 GMT (envelope-from peter@svn.freebsd.org) Message-Id: <201312192103.rBJL39fS006402@svn.freebsd.org> From: Peter Wemm Date: Thu, 19 Dec 2013 21:03:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259631 - stable/10/contrib/jemalloc/include/jemalloc X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Dec 2013 21:03:09 -0000 Author: peter Date: Thu Dec 19 21:03:08 2013 New Revision: 259631 URL: http://svnweb.freebsd.org/changeset/base/259631 Log: MF9: Don't fail to build if MALLOC_PRODUCTION is defined in make.conf Modified: stable/10/contrib/jemalloc/include/jemalloc/jemalloc_FreeBSD.h Modified: stable/10/contrib/jemalloc/include/jemalloc/jemalloc_FreeBSD.h ============================================================================== --- stable/10/contrib/jemalloc/include/jemalloc/jemalloc_FreeBSD.h Thu Dec 19 20:26:06 2013 (r259630) +++ stable/10/contrib/jemalloc/include/jemalloc/jemalloc_FreeBSD.h Thu Dec 19 21:03:08 2013 (r259631) @@ -4,7 +4,9 @@ #undef JEMALLOC_OVERRIDE_VALLOC +#ifndef MALLOC_PRODUCTION #define MALLOC_PRODUCTION +#endif #ifndef MALLOC_PRODUCTION #define JEMALLOC_DEBUG From owner-svn-src-stable-10@FreeBSD.ORG Thu Dec 19 23:29:35 2013 Return-Path: Delivered-To: svn-src-stable-10@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 ESMTPS id ED4ECB0E; Thu, 19 Dec 2013 23:29:34 +0000 (UTC) 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 D70701354; Thu, 19 Dec 2013 23:29:34 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBJNTY15058975; Thu, 19 Dec 2013 23:29:34 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBJNTYwP058973; Thu, 19 Dec 2013 23:29:34 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <201312192329.rBJNTYwP058973@svn.freebsd.org> From: Edwin Groothuis Date: Thu, 19 Dec 2013 23:29:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259636 - stable/10/contrib/tzdata X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Dec 2013 23:29:35 -0000 Author: edwin Date: Thu Dec 19 23:29:34 2013 New Revision: 259636 URL: http://svnweb.freebsd.org/changeset/base/259636 Log: MFC of 259626, tzdata2013i Removed support for solar-time-based time zones Jordan stays at summer time this year. Fix historical data for Cuba Modified: stable/10/contrib/tzdata/asia stable/10/contrib/tzdata/northamerica Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/tzdata/asia ============================================================================== --- stable/10/contrib/tzdata/asia Thu Dec 19 22:27:28 2013 (r259635) +++ stable/10/contrib/tzdata/asia Thu Dec 19 23:29:34 2013 (r259636) @@ -1380,12 +1380,22 @@ Zone Asia/Tokyo 9:18:59 - LMT 1887 Dec 3 # switch back to standard time this winter, so the will stay on DST # until about the same time next year (at least). # http://www.petra.gov.jo/Public_News/Nws_NewsDetails.aspx?NewsID=88950 -# -# From Paul Eggert (2013-09-21): -# It's looking like this change will be permanent; see -# Petra News Agency, Cancelling winter saved Jordan $7 million (2013-02-20) -# . -# So move Jordan to UTC+3 as of the abovementioned date. + +# From Steffen Thorsen (2013-12-11): +# Jordan Times and other sources say that Jordan is going back to +# UTC+2 on 2013-12-19 at midnight: +# http://jordantimes.com/govt-decides-to-switch-back-to-wintertime +# Official, in Arabic: +# http://www.petra.gov.jo/public_news/Nws_NewsDetails.aspx?Menu_ID=&Site_Id=2&lang=1&NewsID=133230&CatID=14 +# ... Our background/permalink about it +# http://www.timeanddate.com/news/time/jordan-reverses-dst-decision.html +# ... +# http://www.petra.gov.jo/Public_News/Nws_NewsDetails.aspx?lang=2&site_id=1&NewsID=133313&Type=P +# ... says midnight for the coming one and 1:00 for the ones in the future +# (and they will use DST again next year, using the normal schedule). + +# From Paul Eggert (2013-12-11): +# As Steffen suggested, consider the past 21-month experiment to be DST. # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S Rule Jordan 1973 only - Jun 6 0:00 1:00 S @@ -1415,11 +1425,13 @@ Rule Jordan 2002 2012 - Mar lastThu 24:0 Rule Jordan 2003 only - Oct 24 0:00s 0 - Rule Jordan 2004 only - Oct 15 0:00s 0 - Rule Jordan 2005 only - Sep lastFri 0:00s 0 - -Rule Jordan 2006 2012 - Oct lastFri 0:00s 0 - +Rule Jordan 2006 2011 - Oct lastFri 0:00s 0 - +Rule Jordan 2013 only - Dec 20 0:00 0 - +Rule Jordan 2014 max - Mar lastThu 24:00 1:00 S +Rule Jordan 2014 max - Oct lastFri 0:00s 0 - # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Asia/Amman 2:23:44 - LMT 1931 - 2:00 Jordan EE%sT 2012 Oct 26 0:00s - 3:00 - AST + 2:00 Jordan EE%sT # Kazakhstan Modified: stable/10/contrib/tzdata/northamerica ============================================================================== --- stable/10/contrib/tzdata/northamerica Thu Dec 19 22:27:28 2013 (r259635) +++ stable/10/contrib/tzdata/northamerica Thu Dec 19 23:29:34 2013 (r259636) @@ -2665,6 +2665,11 @@ Zone America/Costa_Rica -5:36:13 - LMT 1 # to DST--and one more hour on 1999-04-04--when the announcers will have # returned to Baltimore, which switches on that date.) +# From Steffen Thorsen (2013-11-11): +# DST start in Cuba in 2004 ... does not follow the same rules as the +# years before. The correct date should be Sunday 2004-03-28 00:00 ... +# https://web.archive.org/web/20040402060750/http://www.granma.cu/espanol/2004/marzo/sab27/reloj.html + # From Evert van der Veer via Steffen Thorsen (2004-10-28): # Cuba is not going back to standard time this year. # From Paul Eggert (2006-03-22): @@ -2854,7 +2859,8 @@ Rule Cuba 1996 only - Oct 6 0:00s 0 S Rule Cuba 1997 only - Oct 12 0:00s 0 S Rule Cuba 1998 1999 - Mar lastSun 0:00s 1:00 D Rule Cuba 1998 2003 - Oct lastSun 0:00s 0 S -Rule Cuba 2000 2004 - Apr Sun>=1 0:00s 1:00 D +Rule Cuba 2000 2003 - Apr Sun>=1 0:00s 1:00 D +Rule Cuba 2004 only - Mar lastSun 0:00s 1:00 D Rule Cuba 2006 2010 - Oct lastSun 0:00s 0 S Rule Cuba 2007 only - Mar Sun>=8 0:00s 1:00 D Rule Cuba 2008 only - Mar Sun>=15 0:00s 1:00 D From owner-svn-src-stable-10@FreeBSD.ORG Fri Dec 20 20:14:55 2013 Return-Path: Delivered-To: svn-src-stable-10@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 ESMTPS id 29479409; Fri, 20 Dec 2013 20:14:55 +0000 (UTC) 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 149CB16A8; Fri, 20 Dec 2013 20:14:55 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBKKEso2022822; Fri, 20 Dec 2013 20:14:54 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBKKEs6O022821; Fri, 20 Dec 2013 20:14:54 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201312202014.rBKKEs6O022821@svn.freebsd.org> From: Dimitry Andric Date: Fri, 20 Dec 2013 20:14:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259664 - in stable: 10/contrib/llvm/tools/clang/lib/Headers 9/contrib/llvm/tools/clang/lib/Headers X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Dec 2013 20:14:55 -0000 Author: dim Date: Fri Dec 20 20:14:54 2013 New Revision: 259664 URL: http://svnweb.freebsd.org/changeset/base/259664 Log: MFC r259498: Pull in r197399 from upstream clang trunk: Add bit_FXSAVE as an alias for bit_FXSR, for gcc compat. Modified: stable/10/contrib/llvm/tools/clang/lib/Headers/cpuid.h Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/9/contrib/llvm/tools/clang/lib/Headers/cpuid.h Directory Properties: stable/9/contrib/llvm/ (props changed) stable/9/contrib/llvm/tools/clang/ (props changed) Modified: stable/10/contrib/llvm/tools/clang/lib/Headers/cpuid.h ============================================================================== --- stable/10/contrib/llvm/tools/clang/lib/Headers/cpuid.h Fri Dec 20 19:45:51 2013 (r259663) +++ stable/10/contrib/llvm/tools/clang/lib/Headers/cpuid.h Fri Dec 20 20:14:54 2013 (r259664) @@ -79,6 +79,7 @@ #define bit_ACPI 0x00400000 #define bit_MMX 0x00800000 #define bit_FXSR 0x01000000 +#define bit_FXSAVE bit_FXSR /* for gcc compat */ #define bit_SSE 0x02000000 #define bit_SSE2 0x04000000 #define bit_SS 0x08000000 From owner-svn-src-stable-10@FreeBSD.ORG Sat Dec 21 18:47:05 2013 Return-Path: Delivered-To: svn-src-stable-10@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 ESMTPS id A4560EDE; Sat, 21 Dec 2013 18:47:05 +0000 (UTC) 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 8AFCE19EA; Sat, 21 Dec 2013 18:47:05 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBLIl5mO059225; Sat, 21 Dec 2013 18:47:05 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBLIl1an059190; Sat, 21 Dec 2013 18:47:01 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201312211847.rBLIl1an059190@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Sat, 21 Dec 2013 18:47:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259694 - in stable/10/contrib: binutils/binutils gcc gcc/cp gcc/doc gcclibs/libiberty gcclibs/libiberty/testsuite libstdc++/include/bits libstdc++/include/ext libstdc++/libsupc++ libst... X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 21 Dec 2013 18:47:05 -0000 Author: pfg Date: Sat Dec 21 18:47:00 2013 New Revision: 259694 URL: http://svnweb.freebsd.org/changeset/base/259694 Log: MFC r258017, r258429, r258748, r258817: Merge updates from FSF pre4.3 GCC inspired on Apple's gcc: Updates to libiberty and mangling. New align attribute. Merge Apple updates to libstdc++. Added: stable/10/contrib/gcclibs/libiberty/ChangeLog.gcc43 - copied unchanged from r258817, head/contrib/gcclibs/libiberty/ChangeLog.gcc43 Modified: stable/10/contrib/binutils/binutils/cxxfilt.c stable/10/contrib/gcc/ChangeLog.gcc43 stable/10/contrib/gcc/builtins.c stable/10/contrib/gcc/c-common.c stable/10/contrib/gcc/c-decl.c stable/10/contrib/gcc/cp/ChangeLog.gcc43 stable/10/contrib/gcc/cp/decl.c stable/10/contrib/gcc/cp/mangle.c stable/10/contrib/gcc/cp/typeck.c stable/10/contrib/gcc/doc/extend.texi stable/10/contrib/gcc/flags.h stable/10/contrib/gcc/print-tree.c stable/10/contrib/gcc/toplev.c stable/10/contrib/gcc/tree.c stable/10/contrib/gcc/tree.h stable/10/contrib/gcc/varasm.c stable/10/contrib/gcclibs/libiberty/choose-temp.c stable/10/contrib/gcclibs/libiberty/cp-demangle.c stable/10/contrib/gcclibs/libiberty/cp-demangle.h stable/10/contrib/gcclibs/libiberty/floatformat.c stable/10/contrib/gcclibs/libiberty/functions.texi stable/10/contrib/gcclibs/libiberty/pex-unix.c stable/10/contrib/gcclibs/libiberty/strsignal.c stable/10/contrib/gcclibs/libiberty/testsuite/demangle-expected stable/10/contrib/gcclibs/libiberty/testsuite/test-demangle.c stable/10/contrib/libstdc++/include/bits/basic_string.h stable/10/contrib/libstdc++/include/bits/basic_string.tcc stable/10/contrib/libstdc++/include/bits/stl_algobase.h stable/10/contrib/libstdc++/include/bits/stl_tree.h stable/10/contrib/libstdc++/include/bits/stl_vector.h stable/10/contrib/libstdc++/include/ext/mt_allocator.h stable/10/contrib/libstdc++/include/ext/throw_allocator.h stable/10/contrib/libstdc++/libsupc++/eh_alloc.cc stable/10/contrib/libstdc++/src/mt_allocator.cc Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/binutils/binutils/cxxfilt.c ============================================================================== --- stable/10/contrib/binutils/binutils/cxxfilt.c Sat Dec 21 18:17:41 2013 (r259693) +++ stable/10/contrib/binutils/binutils/cxxfilt.c Sat Dec 21 18:47:00 2013 (r259694) @@ -63,12 +63,12 @@ demangle_it (char *mangled_name) result = cplus_demangle (mangled_name + skip_first, flags); if (result == NULL) - printf (mangled_name); + printf ("%s",mangled_name); else { if (mangled_name[0] == '.') putchar ('.'); - printf (result); + printf ("%s",result); free (result); } } Modified: stable/10/contrib/gcc/ChangeLog.gcc43 ============================================================================== --- stable/10/contrib/gcc/ChangeLog.gcc43 Sat Dec 21 18:17:41 2013 (r259693) +++ stable/10/contrib/gcc/ChangeLog.gcc43 Sat Dec 21 18:47:00 2013 (r259694) @@ -4,6 +4,47 @@ * config/arm/unwind-arm.h (__gnu_Unwind_Backtrace): New. * config/arm/unwind-arm.c (__gnu_Unwind_Backtrace): New. +2007-07-12 Geoffrey Keating (r126588) + + * builtins.c (get_pointer_alignment): Honor DECL_ALIGN on a + FUNCTION_DECL. + * tree.c (build_decl_stat): Move code from here... + (make_node_stat): ... to here. Don't uselessly clear DECL_USER_ALIGN. + (expr_align): Honor DECL_ALIGN on a FUNCTION_DECL. Add comment + about using DECL_ALIGN of LABEL_DECL and CONST_DECL. + * tree.h (DECL_USER_ALIGN): Fix misplaced comment. + * varasm.c (assemble_start_function): Use DECL_ALIGN instead of + FUNCTION_BOUNDARY. + +2007-07-09 Geoffrey Keating (r126529) + + PR 32617 + * c-common.c (c_alignof_expr): Look at DECL_ALIGN of + FUNCTION_DECLs. + (handle_aligned_attribute): Allow use on FUNCTION_DECLs. + * varasm.c (assemble_start_function): Honor DECL_ALIGN + for FUNCTION_DECLs. Don't use align_functions_log if + DECL_USER_ALIGN. + * print-tree.c (print_node): Print DECL_ALIGN and DECL_USER_ALIGN + even for FUNCTION_DECLs. + * c-decl.c (merge_decls): Propagate DECL_ALIGN even for + FUNCTION_DECLs. + * tree.h (DECL_ALIGN): Update for new location of 'align'. + (DECL_FUNCTION_CODE): Update for new location and name of + 'function_code'. + (DECL_OFFSET_ALIGN): Update for new location of 'off_align'. + (struct tree_decl_common): Move 'align' and 'off_align' out + of union, ensure they're still on a 32-bit boundary. Remove + other fields in union 'u1'. + (struct tree_function_decl): Add field 'function_code' replacing + 'u1.f' in tree_decl_common. + * tree.c (build_decl_stat): Set initial value of DECL_ALIGN. + * doc/extend.texi (Function Attributes): Add 'aligned' attribute. + (Variable Attributes): Cross-reference 'aligned' attribute + to Function Attributes. + * flags.h (force_align_functions_log): Delete. + * toplev.c (force_align_functions_log): Delete. + 2007-06-05 Joerg Wunsch (r125346) PR preprocessor/23479 @@ -68,7 +109,7 @@ alignment for amdfam10 architecture. Increasing the max loop alignment to 24 bytes. -2007-04-16 Lawrence Crowl +2007-04-16 Lawrence Crowl (r123909) * doc/invoke.texi (Debugging Options): Add documentation for the -femit-struct-debug options -femit-struct-debug-baseonly, @@ -147,7 +188,7 @@ * config/i386/i386.c (override_options): Likewise. * doc/invoke.texi: Likewise. -2007-03-12 Seongbae Park +2007-03-12 Seongbae Park (r122851) * c-decl.c (warn_variable_length_array): New function. Refactored from grokdeclarator to handle warn_vla @@ -348,7 +389,7 @@ * config.gcc: Support core2 processor. -2007-01-05 Manuel Lopez-Ibanez +2007-01-05 Manuel Lopez-Ibanez (r120505) PR c/19978 * tree.h (TREE_OVERFLOW_P): New. Modified: stable/10/contrib/gcc/builtins.c ============================================================================== --- stable/10/contrib/gcc/builtins.c Sat Dec 21 18:17:41 2013 (r259693) +++ stable/10/contrib/gcc/builtins.c Sat Dec 21 18:47:00 2013 (r259694) @@ -315,9 +315,7 @@ get_pointer_alignment (tree exp, unsigne else if (offset) inner = MIN (inner, BITS_PER_UNIT); } - if (TREE_CODE (exp) == FUNCTION_DECL) - align = FUNCTION_BOUNDARY; - else if (DECL_P (exp)) + if (DECL_P (exp)) align = MIN (inner, DECL_ALIGN (exp)); #ifdef CONSTANT_ALIGNMENT else if (CONSTANT_CLASS_P (exp)) Modified: stable/10/contrib/gcc/c-common.c ============================================================================== --- stable/10/contrib/gcc/c-common.c Sat Dec 21 18:17:41 2013 (r259693) +++ stable/10/contrib/gcc/c-common.c Sat Dec 21 18:47:00 2013 (r259694) @@ -2995,16 +2995,16 @@ c_sizeof_or_alignof_type (tree type, boo } /* Implement the __alignof keyword: Return the minimum required - alignment of EXPR, measured in bytes. For VAR_DECL's and - FIELD_DECL's return DECL_ALIGN (which can be set from an - "aligned" __attribute__ specification). */ + alignment of EXPR, measured in bytes. For VAR_DECLs, + FUNCTION_DECLs and FIELD_DECLs return DECL_ALIGN (which can be set + from an "aligned" __attribute__ specification). */ tree c_alignof_expr (tree expr) { tree t; - if (TREE_CODE (expr) == VAR_DECL) + if (VAR_OR_FUNCTION_DECL_P (expr)) t = size_int (DECL_ALIGN_UNIT (expr)); else if (TREE_CODE (expr) == COMPONENT_REF @@ -4809,12 +4809,24 @@ handle_aligned_attribute (tree *node, tr TYPE_ALIGN (*type) = (1 << i) * BITS_PER_UNIT; TYPE_USER_ALIGN (*type) = 1; } - else if (TREE_CODE (decl) != VAR_DECL + else if (! VAR_OR_FUNCTION_DECL_P (decl) && TREE_CODE (decl) != FIELD_DECL) { error ("alignment may not be specified for %q+D", decl); *no_add_attrs = true; } + else if (TREE_CODE (decl) == FUNCTION_DECL + && DECL_ALIGN (decl) > (1 << i) * BITS_PER_UNIT) + { + if (DECL_USER_ALIGN (decl)) + error ("alignment for %q+D was previously specified as %d " + "and may not be decreased", decl, + DECL_ALIGN (decl) / BITS_PER_UNIT); + else + error ("alignment for %q+D must be at least %d", decl, + DECL_ALIGN (decl) / BITS_PER_UNIT); + *no_add_attrs = true; + } else { DECL_ALIGN (decl) = (1 << i) * BITS_PER_UNIT; Modified: stable/10/contrib/gcc/c-decl.c ============================================================================== --- stable/10/contrib/gcc/c-decl.c Sat Dec 21 18:17:41 2013 (r259693) +++ stable/10/contrib/gcc/c-decl.c Sat Dec 21 18:47:00 2013 (r259694) @@ -1690,12 +1690,11 @@ merge_decls (tree newdecl, tree olddecl, DECL_SIZE (newdecl) = DECL_SIZE (olddecl); DECL_SIZE_UNIT (newdecl) = DECL_SIZE_UNIT (olddecl); DECL_MODE (newdecl) = DECL_MODE (olddecl); - if (TREE_CODE (olddecl) != FUNCTION_DECL) - if (DECL_ALIGN (olddecl) > DECL_ALIGN (newdecl)) - { - DECL_ALIGN (newdecl) = DECL_ALIGN (olddecl); - DECL_USER_ALIGN (newdecl) |= DECL_ALIGN (olddecl); - } + if (DECL_ALIGN (olddecl) > DECL_ALIGN (newdecl)) + { + DECL_ALIGN (newdecl) = DECL_ALIGN (olddecl); + DECL_USER_ALIGN (newdecl) |= DECL_ALIGN (olddecl); + } } Modified: stable/10/contrib/gcc/cp/ChangeLog.gcc43 ============================================================================== --- stable/10/contrib/gcc/cp/ChangeLog.gcc43 Sat Dec 21 18:17:41 2013 (r259693) +++ stable/10/contrib/gcc/cp/ChangeLog.gcc43 Sat Dec 21 18:47:00 2013 (r259694) @@ -1,3 +1,12 @@ +2007-07-09 Geoffrey Keating (r126529) + + PR 32617 + * decl.c (cxx_init_decl_processing): Don't set + force_align_functions_log. + (grokfndecl): Honour ptrmemfunc_vbit_in_pfn. + * typeck.c (cxx_alignof_expr): When alignof is used on a plain + FUNCTION_DECL, return its alignment. + 2007-06-28 Geoffrey Keating (r126080) * decl2.c (start_objects): Mark constructor-runnning function @@ -9,6 +18,13 @@ * decl2.c (determine_visibility): Remove duplicate code for handling type info. +2007-05-05 Geoffrey Keating (r124467) + + PR 31775 + * mangle.c (write_mangled_name): Mangle static variable names. + (write_unqualified_name): Use local-source-name for + namespace-scope static variables. + 2007-03-12 Seongbae Park (r122851) * decl.c (compute_array_index_type): New warning flag warn_vla. Modified: stable/10/contrib/gcc/cp/decl.c ============================================================================== --- stable/10/contrib/gcc/cp/decl.c Sat Dec 21 18:17:41 2013 (r259693) +++ stable/10/contrib/gcc/cp/decl.c Sat Dec 21 18:47:00 2013 (r259694) @@ -3158,12 +3158,6 @@ cxx_init_decl_processing (void) if (flag_inline_functions) flag_inline_trees = 2; - /* Force minimum function alignment if using the least significant - bit of function pointers to store the virtual bit. */ - if (TARGET_PTRMEMFUNC_VBIT_LOCATION == ptrmemfunc_vbit_in_pfn - && force_align_functions_log < 1) - force_align_functions_log = 1; - /* Initially, C. */ current_lang_name = lang_name_c; @@ -6065,6 +6059,14 @@ grokfndecl (tree ctype, if (TYPE_VOLATILE (type)) TREE_THIS_VOLATILE (decl) = 1; + /* If pointers to member functions use the least significant bit to + indicate whether a function is virtual, ensure a pointer + to this function will have that bit clear. */ + if (TARGET_PTRMEMFUNC_VBIT_LOCATION == ptrmemfunc_vbit_in_pfn + && TREE_CODE (type) == METHOD_TYPE + && DECL_ALIGN (decl) < 2 * BITS_PER_UNIT) + DECL_ALIGN (decl) = 2 * BITS_PER_UNIT; + if (friendp && TREE_CODE (orig_declarator) == TEMPLATE_ID_EXPR) { Modified: stable/10/contrib/gcc/cp/mangle.c ============================================================================== --- stable/10/contrib/gcc/cp/mangle.c Sat Dec 21 18:17:41 2013 (r259693) +++ stable/10/contrib/gcc/cp/mangle.c Sat Dec 21 18:47:00 2013 (r259694) @@ -688,7 +688,8 @@ write_mangled_name (const tree decl, boo } } else if (TREE_CODE (decl) == VAR_DECL - /* The names of global variables aren't mangled. */ + /* The names of non-static global variables aren't mangled. */ + && DECL_EXTERNAL_LINKAGE_P (decl) && (CP_DECL_CONTEXT (decl) == global_namespace /* And neither are `extern "C"' variables. */ || DECL_EXTERN_C_P (decl))) @@ -1086,7 +1087,10 @@ write_template_prefix (const tree node) ::= ::= - ::= */ + ::= + ::= + + ::= L */ static void write_unqualified_name (const tree decl) @@ -1126,6 +1130,16 @@ write_unqualified_name (const tree decl) write_string (oni[DECL_OVERLOADED_OPERATOR_P (decl)].mangled_name); } + else if (VAR_OR_FUNCTION_DECL_P (decl) && ! TREE_PUBLIC (decl) + && DECL_NAMESPACE_SCOPE_P (decl) + && decl_linkage (decl) == lk_internal) + { + MANGLE_TRACE_TREE ("local-source-name", decl); + write_char ('L'); + write_source_name (DECL_NAME (decl)); + /* The default discriminator is 1, and that's all we ever use, + so there's no code to output one here. */ + } else write_source_name (DECL_NAME (decl)); } Modified: stable/10/contrib/gcc/cp/typeck.c ============================================================================== --- stable/10/contrib/gcc/cp/typeck.c Sat Dec 21 18:17:41 2013 (r259693) +++ stable/10/contrib/gcc/cp/typeck.c Sat Dec 21 18:47:00 2013 (r259694) @@ -1358,7 +1358,10 @@ cxx_alignof_expr (tree e) { pedwarn ("ISO C++ forbids applying %<__alignof%> to an expression of " "function type"); - t = size_one_node; + if (TREE_CODE (e) == FUNCTION_DECL) + t = size_int (DECL_ALIGN_UNIT (e)); + else + t = size_one_node; } else if (type_unknown_p (e)) { Modified: stable/10/contrib/gcc/doc/extend.texi ============================================================================== --- stable/10/contrib/gcc/doc/extend.texi Sat Dec 21 18:17:41 2013 (r259693) +++ stable/10/contrib/gcc/doc/extend.texi Sat Dec 21 18:47:00 2013 (r259694) @@ -1577,6 +1577,7 @@ The keyword @code{__attribute__} allows attributes when making a declaration. This keyword is followed by an attribute specification inside double parentheses. The following attributes are currently defined for functions on all targets: +@code{aligned}, @code{noreturn}, @code{returns_twice}, @code{noinline}, @code{always_inline}, @code{flatten}, @code{pure}, @code{const}, @code{nothrow}, @code{sentinel}, @code{format}, @code{format_arg}, @code{no_instrument_function}, @@ -1615,6 +1616,27 @@ is not defined in the same translation u Not all target machines support this attribute. +@item aligned (@var{alignment}) +@cindex @code{aligned} attribute +This attribute specifies a minimum alignment for the function, +measured in bytes. + +You cannot use this attribute to decrease the alignment of a function, +only to increase it. However, when you explicitly specify a function +alignment this will override the effect of the +@option{-falign-functions} (@pxref{Optimize Options}) option for this +function. + +Note that the effectiveness of @code{aligned} attributes may be +limited by inherent limitations in your linker. On many systems, the +linker is only able to arrange for functions to be aligned up to a +certain maximum alignment. (For some linkers, the maximum supported +alignment may be very very small.) See your linker documentation for +further information. + +The @code{aligned} attribute can also be used for variables and fields +(@pxref{Variable Attributes}.) + @item always_inline @cindex @code{always_inline} function attribute Generally, functions are not inlined unless optimization is specified. @@ -3044,6 +3066,9 @@ up to a maximum of 8 byte alignment, the in an @code{__attribute__} will still only provide you with 8 byte alignment. See your linker documentation for further information. +The @code{aligned} attribute can also be used for functions +(@pxref{Function Attributes}.) + @item cleanup (@var{cleanup_function}) @cindex @code{cleanup} attribute The @code{cleanup} attribute runs a function when the variable goes Modified: stable/10/contrib/gcc/flags.h ============================================================================== --- stable/10/contrib/gcc/flags.h Sat Dec 21 18:17:41 2013 (r259693) +++ stable/10/contrib/gcc/flags.h Sat Dec 21 18:47:00 2013 (r259694) @@ -261,10 +261,6 @@ extern int align_labels_log; extern int align_labels_max_skip; extern int align_functions_log; -/* Like align_functions_log above, but used by front-ends to force the - minimum function alignment. Zero means no alignment is forced. */ -extern int force_align_functions_log; - /* Nonzero if we dump in VCG format, not plain text. */ extern int dump_for_graph; Modified: stable/10/contrib/gcc/print-tree.c ============================================================================== --- stable/10/contrib/gcc/print-tree.c Sat Dec 21 18:17:41 2013 (r259693) +++ stable/10/contrib/gcc/print-tree.c Sat Dec 21 18:47:00 2013 (r259694) @@ -439,17 +439,15 @@ print_node (FILE *file, const char *pref || DECL_INLINE (node) || DECL_BUILT_IN (node)) indent_to (file, indent + 3); - if (TREE_CODE (node) != FUNCTION_DECL) - { - if (DECL_USER_ALIGN (node)) - fprintf (file, " user"); - - fprintf (file, " align %d", DECL_ALIGN (node)); - if (TREE_CODE (node) == FIELD_DECL) - fprintf (file, " offset_align " HOST_WIDE_INT_PRINT_UNSIGNED, - DECL_OFFSET_ALIGN (node)); - } - else if (DECL_BUILT_IN (node)) + if (DECL_USER_ALIGN (node)) + fprintf (file, " user"); + + fprintf (file, " align %d", DECL_ALIGN (node)); + if (TREE_CODE (node) == FIELD_DECL) + fprintf (file, " offset_align " HOST_WIDE_INT_PRINT_UNSIGNED, + DECL_OFFSET_ALIGN (node)); + + if (TREE_CODE (node) == FUNCTION_DECL && DECL_BUILT_IN (node)) { if (DECL_BUILT_IN_CLASS (node) == BUILT_IN_MD) fprintf (file, " built-in BUILT_IN_MD %d", DECL_FUNCTION_CODE (node)); Modified: stable/10/contrib/gcc/toplev.c ============================================================================== --- stable/10/contrib/gcc/toplev.c Sat Dec 21 18:17:41 2013 (r259693) +++ stable/10/contrib/gcc/toplev.c Sat Dec 21 18:47:00 2013 (r259694) @@ -369,10 +369,6 @@ int align_labels_log; int align_labels_max_skip; int align_functions_log; -/* Like align_functions_log above, but used by front-ends to force the - minimum function alignment. Zero means no alignment is forced. */ -int force_align_functions_log; - typedef struct { const char *const string; Modified: stable/10/contrib/gcc/tree.c ============================================================================== --- stable/10/contrib/gcc/tree.c Sat Dec 21 18:17:41 2013 (r259693) +++ stable/10/contrib/gcc/tree.c Sat Dec 21 18:47:00 2013 (r259694) @@ -541,9 +541,13 @@ make_node_stat (enum tree_code code MEM_ DECL_IN_SYSTEM_HEADER (t) = in_system_header; if (CODE_CONTAINS_STRUCT (code, TS_DECL_COMMON)) { - if (code != FUNCTION_DECL) + if (code == FUNCTION_DECL) + { + DECL_ALIGN (t) = FUNCTION_BOUNDARY; + DECL_MODE (t) = FUNCTION_MODE; + } + else DECL_ALIGN (t) = 1; - DECL_USER_ALIGN (t) = 0; /* We have not yet computed the alias set for this declaration. */ DECL_POINTER_ALIAS_SET (t) = -1; } @@ -1881,14 +1885,13 @@ expr_align (tree t) align1 = expr_align (TREE_OPERAND (t, 2)); return MIN (align0, align1); + /* FIXME: LABEL_DECL and CONST_DECL never have DECL_ALIGN set + meaningfully, it's always 1. */ case LABEL_DECL: case CONST_DECL: case VAR_DECL: case PARM_DECL: case RESULT_DECL: - if (DECL_ALIGN (t) != 0) - return DECL_ALIGN (t); - break; - case FUNCTION_DECL: - return FUNCTION_BOUNDARY; + gcc_assert (DECL_ALIGN (t) != 0); + return DECL_ALIGN (t); default: break; @@ -3174,8 +3177,6 @@ build_decl_stat (enum tree_code code, tr if (code == VAR_DECL || code == PARM_DECL || code == RESULT_DECL) layout_decl (t, 0); - else if (code == FUNCTION_DECL) - DECL_MODE (t) = FUNCTION_MODE; return t; } Modified: stable/10/contrib/gcc/tree.h ============================================================================== --- stable/10/contrib/gcc/tree.h Sat Dec 21 18:17:41 2013 (r259693) +++ stable/10/contrib/gcc/tree.h Sat Dec 21 18:47:00 2013 (r259694) @@ -2426,13 +2426,11 @@ struct tree_struct_field_tag GTY(()) /* Likewise for the size in bytes. */ #define DECL_SIZE_UNIT(NODE) (DECL_COMMON_CHECK (NODE)->decl_common.size_unit) /* Holds the alignment required for the datum, in bits. */ -#define DECL_ALIGN(NODE) (DECL_COMMON_CHECK (NODE)->decl_common.u1.a.align) +#define DECL_ALIGN(NODE) (DECL_COMMON_CHECK (NODE)->decl_common.align) /* The alignment of NODE, in bytes. */ #define DECL_ALIGN_UNIT(NODE) (DECL_ALIGN (NODE) / BITS_PER_UNIT) -/* For FIELD_DECLs, off_align holds the number of low-order bits of - DECL_FIELD_OFFSET which are known to be always zero. - DECL_OFFSET_ALIGN thus returns the alignment that DECL_FIELD_OFFSET - has. */ +/* Set if the alignment of this DECL has been set by the user, for + example with an 'aligned' attribute. */ #define DECL_USER_ALIGN(NODE) (DECL_COMMON_CHECK (NODE)->decl_common.user_align) /* Holds the machine mode corresponding to the declaration of a variable or field. Always equal to TYPE_MODE (TREE_TYPE (decl)) except for a @@ -2443,7 +2441,8 @@ struct tree_struct_field_tag GTY(()) operation it is. Note, however, that this field is overloaded, with DECL_BUILT_IN_CLASS as the discriminant, so the latter must always be checked before any access to the former. */ -#define DECL_FUNCTION_CODE(NODE) (FUNCTION_DECL_CHECK (NODE)->decl_common.u1.f) +#define DECL_FUNCTION_CODE(NODE) \ + (FUNCTION_DECL_CHECK (NODE)->function_decl.function_code) #define DECL_DEBUG_EXPR_IS_FROM(NODE) \ (DECL_COMMON_CHECK (NODE)->decl_common.debug_expr_is_from) @@ -2581,20 +2580,9 @@ struct tree_decl_common GTY(()) unsigned gimple_reg_flag : 1; unsigned call_clobbered_flag : 1; - union tree_decl_u1 { - /* In a FUNCTION_DECL for which DECL_BUILT_IN holds, this is - DECL_FUNCTION_CODE. */ - enum built_in_function f; - /* In a FUNCTION_DECL for which DECL_BUILT_IN does not hold, this - is used by language-dependent code. */ - HOST_WIDE_INT i; - /* DECL_ALIGN and DECL_OFFSET_ALIGN. (These are not used for - FUNCTION_DECLs). */ - struct tree_decl_u1_a { - unsigned int align : 24; - unsigned int off_align : 8; - } a; - } GTY ((skip)) u1; + unsigned int align : 24; + /* DECL_OFFSET_ALIGN, used only for FIELD_DECLs. */ + unsigned int off_align : 8; tree size_unit; tree initial; @@ -2679,11 +2667,11 @@ struct tree_decl_with_rtl GTY(()) DECL_OFFSET_ALIGN thus returns the alignment that DECL_FIELD_OFFSET has. */ #define DECL_OFFSET_ALIGN(NODE) \ - (((unsigned HOST_WIDE_INT)1) << FIELD_DECL_CHECK (NODE)->decl_common.u1.a.off_align) + (((unsigned HOST_WIDE_INT)1) << FIELD_DECL_CHECK (NODE)->decl_common.off_align) /* Specify that DECL_ALIGN(NODE) is a multiple of X. */ #define SET_DECL_OFFSET_ALIGN(NODE, X) \ - (FIELD_DECL_CHECK (NODE)->decl_common.u1.a.off_align = exact_log2 ((X) & -(X))) + (FIELD_DECL_CHECK (NODE)->decl_common.off_align = exact_log2 ((X) & -(X))) /* 1 if the alignment for this type was requested by "aligned" attribute, 0 if it is the default for this type. */ @@ -3096,6 +3084,10 @@ struct tree_function_decl GTY(()) { struct tree_decl_non_common common; + /* In a FUNCTION_DECL for which DECL_BUILT_IN holds, this is + DECL_FUNCTION_CODE. Otherwise unused. */ + enum built_in_function function_code; + unsigned static_ctor_flag : 1; unsigned static_dtor_flag : 1; unsigned uninlinable : 1; Modified: stable/10/contrib/gcc/varasm.c ============================================================================== --- stable/10/contrib/gcc/varasm.c Sat Dec 21 18:17:41 2013 (r259693) +++ stable/10/contrib/gcc/varasm.c Sat Dec 21 18:47:00 2013 (r259694) @@ -1383,7 +1383,7 @@ assemble_start_function (tree decl, cons if (flag_reorder_blocks_and_partition) { switch_to_section (unlikely_text_section ()); - assemble_align (FUNCTION_BOUNDARY); + assemble_align (DECL_ALIGN (decl)); ASM_OUTPUT_LABEL (asm_out_file, cfun->cold_section_label); /* When the function starts with a cold section, we need to explicitly @@ -1393,7 +1393,7 @@ assemble_start_function (tree decl, cons && BB_PARTITION (ENTRY_BLOCK_PTR->next_bb) == BB_COLD_PARTITION) { switch_to_section (text_section); - assemble_align (FUNCTION_BOUNDARY); + assemble_align (DECL_ALIGN (decl)); ASM_OUTPUT_LABEL (asm_out_file, cfun->hot_section_label); hot_label_written = true; first_function_block_is_cold = true; @@ -1424,18 +1424,17 @@ assemble_start_function (tree decl, cons ASM_OUTPUT_LABEL (asm_out_file, cfun->hot_section_label); /* Tell assembler to move to target machine's alignment for functions. */ - align = floor_log2 (FUNCTION_BOUNDARY / BITS_PER_UNIT); - if (align < force_align_functions_log) - align = force_align_functions_log; + align = floor_log2 (DECL_ALIGN (decl) / BITS_PER_UNIT); if (align > 0) { ASM_OUTPUT_ALIGN (asm_out_file, align); } /* Handle a user-specified function alignment. - Note that we still need to align to FUNCTION_BOUNDARY, as above, + Note that we still need to align to DECL_ALIGN, as above, because ASM_OUTPUT_MAX_SKIP_ALIGN might not do any alignment at all. */ - if (align_functions_log > align + if (! DECL_USER_ALIGN (decl) + && align_functions_log > align && cfun->function_frequency != FUNCTION_FREQUENCY_UNLIKELY_EXECUTED) { #ifdef ASM_OUTPUT_MAX_SKIP_ALIGN Copied: stable/10/contrib/gcclibs/libiberty/ChangeLog.gcc43 (from r258817, head/contrib/gcclibs/libiberty/ChangeLog.gcc43) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/contrib/gcclibs/libiberty/ChangeLog.gcc43 Sat Dec 21 18:47:00 2013 (r259694, copy of r258817, head/contrib/gcclibs/libiberty/ChangeLog.gcc43) @@ -0,0 +1,60 @@ +2007-05-05 Geoffrey Keating (r124467) + + PR 31775 + * mangle.c (write_mangled_name): Mangle static variable names. + (write_unqualified_name): Use local-source-name for + namespace-scope static variables. + +2007-03-15 Geoffrey Keating (r122972) + + * cp-demangle.c (d_encoding): Exit early on error. + (d_pointer_to_member_type): Exit early if cplus_demangle_type + returns NULL. + (cplus_demangle_type): Likewise. + * testsuite/demangle-expected: New testcase. + +2007-01-31 Ben Elliston (r121364) + + * strsignal.c (psignal): Change type of signo to int. + * functions.texi: Regenerate. + +2007-01-12 Ben Elliston (r120702) + + * pex-unix.c (writeerr): Cast write result to void. + + * choose-temp.c (choose_temp_base): Check the result of the call + to mktemp rather than testing the length of the modified string. + +2006-12-20 Geoffrey Keating (r120097) + + * cp-demangle.h: Add comment explaining what to do to avoid + overrunning string. + (d_check_char): New. + (d_next_char): Don't advance past trailing '\0'. + * cp-demangle.c (cplus_demangle_mangled_name): Use d_check_char. + (d_nested_name): Likewise. + (d_special_name): Likewise. + (d_call_offset): Likewise. + (d_function_type): Likewise. + (d_array_type): Likewise. + (d_pointer_to_member_type): Likewise. + (d_template_param): Likewise. + (d_template_args): Likewise. + (d_template_arg): Likewise. + (d_expr_primary): Likewise. + (d_local_name): Likewise. + (d_substitution): Likewise. + (d_ctor_dtor_name): Use d_advance rather than d_next_char. + * testsuite/test-demangle.c: Include sys/mman.h. + (MAP_ANONYMOUS): Define. + (protect_end): New. + (main): Use protect_end. + * testsuite/demangle-expected: Add testcases for overrunning + the end of the string. + +2006-11-07 Julian Brown (r118552) + + * floatformat.c (get_field): Fix segfault with little-endian word + order on 64-bit hosts. + (put_field): Likewise. + (min): Move definition. Modified: stable/10/contrib/gcclibs/libiberty/choose-temp.c ============================================================================== --- stable/10/contrib/gcclibs/libiberty/choose-temp.c Sat Dec 21 18:17:41 2013 (r259693) +++ stable/10/contrib/gcclibs/libiberty/choose-temp.c Sat Dec 21 18:47:00 2013 (r259694) @@ -65,8 +65,7 @@ choose_temp_base (void) strcpy (temp_filename, base); strcpy (temp_filename + len, TEMP_FILE); - mktemp (temp_filename); - if (strlen (temp_filename) == 0) + if (mktemp (temp_filename) == 0) abort (); return temp_filename; } Modified: stable/10/contrib/gcclibs/libiberty/cp-demangle.c ============================================================================== --- stable/10/contrib/gcclibs/libiberty/cp-demangle.c Sat Dec 21 18:17:41 2013 (r259693) +++ stable/10/contrib/gcclibs/libiberty/cp-demangle.c Sat Dec 21 18:47:00 2013 (r259694) @@ -913,9 +913,9 @@ CP_STATIC_IF_GLIBCPP_V3 struct demangle_component * cplus_demangle_mangled_name (struct d_info *di, int top_level) { - if (d_next_char (di) != '_') + if (! d_check_char (di, '_')) return NULL; - if (d_next_char (di) != 'Z') + if (! d_check_char (di, 'Z')) return NULL; return d_encoding (di, top_level); } @@ -1021,7 +1021,7 @@ d_encoding (struct d_info *di, int top_l } peek = d_peek_char (di); - if (peek == '\0' || peek == 'E') + if (dc == NULL || peek == '\0' || peek == 'E') return dc; return d_make_comp (di, DEMANGLE_COMPONENT_TYPED_NAME, dc, d_bare_function_type (di, has_return_type (dc))); @@ -1054,6 +1054,9 @@ d_name (struct d_info *di) case 'Z': return d_local_name (di); + case 'L': + return d_unqualified_name (di); + case 'S': { int subst; @@ -1123,7 +1126,7 @@ d_nested_name (struct d_info *di) struct demangle_component *ret; struct demangle_component **pret; - if (d_next_char (di) != 'N') + if (! d_check_char (di, 'N')) return NULL; pret = d_cv_qualifiers (di, &ret, 1); @@ -1134,7 +1137,7 @@ d_nested_name (struct d_info *di) if (*pret == NULL) return NULL; - if (d_next_char (di) != 'E') + if (! d_check_char (di, 'E')) return NULL; return ret; @@ -1174,7 +1177,8 @@ d_prefix (struct d_info *di) if (IS_DIGIT (peek) || IS_LOWER (peek) || peek == 'C' - || peek == 'D') + || peek == 'D' + || peek == 'L') dc = d_unqualified_name (di); else if (peek == 'S') dc = d_substitution (di, 1); @@ -1208,6 +1212,9 @@ d_prefix (struct d_info *di) /* ::= ::= ::= + ::= + + ::= L */ static struct demangle_component * @@ -1229,6 +1236,19 @@ d_unqualified_name (struct d_info *di) } else if (peek == 'C' || peek == 'D') return d_ctor_dtor_name (di); + else if (peek == 'L') + { + struct demangle_component * ret; + + d_advance (di, 1); + + ret = d_source_name (di); + if (ret == NULL) + return NULL; + if (! d_discriminator (di)) + return NULL; + return ret; + } else return NULL; } @@ -1449,11 +1469,8 @@ d_operator_name (struct d_info *di) static struct demangle_component * d_special_name (struct d_info *di) { - char c; - di->expansion += 20; - c = d_next_char (di); - if (c == 'T') + if (d_check_char (di, 'T')) { switch (d_next_char (di)) { @@ -1502,7 +1519,7 @@ d_special_name (struct d_info *di) offset = d_number (di); if (offset < 0) return NULL; - if (d_next_char (di) != '_') + if (! d_check_char (di, '_')) return NULL; base_type = cplus_demangle_type (di); /* We don't display the offset. FIXME: We should display @@ -1523,7 +1540,7 @@ d_special_name (struct d_info *di) return NULL; } } - else if (c == 'G') + else if (d_check_char (di, 'G')) { switch (d_next_char (di)) { @@ -1570,14 +1587,14 @@ d_call_offset (struct d_info *di, int c) else if (c == 'v') { d_number (di); - if (d_next_char (di) != '_') + if (! d_check_char (di, '_')) return 0; d_number (di); } else return 0; - if (d_next_char (di) != '_') + if (! d_check_char (di, '_')) return 0; return 1; @@ -1601,13 +1618,13 @@ d_ctor_dtor_name (struct d_info *di) else if (di->last_name->type == DEMANGLE_COMPONENT_SUB_STD) di->expansion += di->last_name->u.s_string.len; } - switch (d_next_char (di)) + switch (d_peek_char (di)) { case 'C': { enum gnu_v3_ctor_kinds kind; - switch (d_next_char (di)) + switch (d_peek_next_char (di)) { case '1': kind = gnu_v3_complete_object_ctor; @@ -1621,6 +1638,7 @@ d_ctor_dtor_name (struct d_info *di) default: return NULL; } + d_advance (di, 2); return d_make_ctor (di, kind, di->last_name); } @@ -1628,7 +1646,7 @@ d_ctor_dtor_name (struct d_info *di) { enum gnu_v3_dtor_kinds kind; - switch (d_next_char (di)) + switch (d_peek_next_char (di)) { case '0': kind = gnu_v3_deleting_dtor; @@ -1642,6 +1660,7 @@ d_ctor_dtor_name (struct d_info *di) default: return NULL; } + d_advance (di, 2); return d_make_dtor (di, kind, di->last_name); } @@ -1735,7 +1754,7 @@ cplus_demangle_type (struct d_info *di) if (pret == NULL) return NULL; *pret = cplus_demangle_type (di); - if (! d_add_substitution (di, ret)) + if (! *pret || ! d_add_substitution (di, ret)) return NULL; return ret; } @@ -1925,7 +1944,7 @@ d_function_type (struct d_info *di) { struct demangle_component *ret; - if (d_next_char (di) != 'F') + if (! d_check_char (di, 'F')) return NULL; if (d_peek_char (di) == 'Y') { @@ -1934,7 +1953,7 @@ d_function_type (struct d_info *di) d_advance (di, 1); } ret = d_bare_function_type (di, 1); - if (d_next_char (di) != 'E') + if (! d_check_char (di, 'E')) return NULL; return ret; } @@ -2021,7 +2040,7 @@ d_array_type (struct d_info *di) char peek; struct demangle_component *dim; - if (d_next_char (di) != 'A') + if (! d_check_char (di, 'A')) return NULL; peek = d_peek_char (di); @@ -2049,7 +2068,7 @@ d_array_type (struct d_info *di) return NULL; } - if (d_next_char (di) != '_') + if (! d_check_char (di, '_')) return NULL; return d_make_comp (di, DEMANGLE_COMPONENT_ARRAY_TYPE, dim, @@ -2065,7 +2084,7 @@ d_pointer_to_member_type (struct d_info struct demangle_component *mem; struct demangle_component **pmem; - if (d_next_char (di) != 'M') + if (! d_check_char (di, 'M')) return NULL; cl = cplus_demangle_type (di); @@ -2090,6 +2109,8 @@ d_pointer_to_member_type (struct d_info if (pmem == NULL) return NULL; *pmem = cplus_demangle_type (di); + if (*pmem == NULL) + return NULL; if (pmem != &mem && (*pmem)->type != DEMANGLE_COMPONENT_FUNCTION_TYPE) { @@ -2109,7 +2130,7 @@ d_template_param (struct d_info *di) { long param; - if (d_next_char (di) != 'T') + if (! d_check_char (di, 'T')) return NULL; if (d_peek_char (di) == '_') @@ -2122,7 +2143,7 @@ d_template_param (struct d_info *di) param += 1; } - if (d_next_char (di) != '_') + if (! d_check_char (di, '_')) return NULL; ++di->did_subs; @@ -2144,7 +2165,7 @@ d_template_args (struct d_info *di) constructor or destructor. */ hold_last_name = di->last_name; - if (d_next_char (di) != 'I') + if (! d_check_char (di, 'I')) return NULL; al = NULL; @@ -2189,7 +2210,7 @@ d_template_arg (struct d_info *di) case 'X': d_advance (di, 1); ret = d_expression (di); - if (d_next_char (di) != 'E') + if (! d_check_char (di, 'E')) return NULL; return ret; @@ -2316,7 +2337,7 @@ d_expr_primary (struct d_info *di) { struct demangle_component *ret; - if (d_next_char (di) != 'L') + if (! d_check_char (di, 'L')) return NULL; if (d_peek_char (di) == '_') ret = cplus_demangle_mangled_name (di, 0); @@ -2362,7 +2383,7 @@ d_expr_primary (struct d_info *di) } ret = d_make_comp (di, t, type, d_make_name (di, s, d_str (di) - s)); } - if (d_next_char (di) != 'E') + if (! d_check_char (di, 'E')) return NULL; return ret; } @@ -2376,12 +2397,12 @@ d_local_name (struct d_info *di) { struct demangle_component *function; - if (d_next_char (di) != 'Z') + if (! d_check_char (di, 'Z')) return NULL; function = d_encoding (di, 0); - if (d_next_char (di) != 'E') + if (! d_check_char (di, 'E')) return NULL; if (d_peek_char (di) == 's') @@ -2486,7 +2507,7 @@ d_substitution (struct d_info *di, int p { char c; - if (d_next_char (di) != 'S') + if (! d_check_char (di, 'S')) return NULL; c = d_next_char (di); Modified: stable/10/contrib/gcclibs/libiberty/cp-demangle.h ============================================================================== --- stable/10/contrib/gcclibs/libiberty/cp-demangle.h Sat Dec 21 18:17:41 2013 (r259693) +++ stable/10/contrib/gcclibs/libiberty/cp-demangle.h Sat Dec 21 18:47:00 2013 (r259694) @@ -123,10 +123,16 @@ struct d_info int expansion; }; +/* To avoid running past the ending '\0', don't: + - call d_peek_next_char if d_peek_char returned '\0' + - call d_advance with an 'i' that is too large + - call d_check_char(di, '\0') + Everything else is safe. */ #define d_peek_char(di) (*((di)->n)) #define d_peek_next_char(di) ((di)->n[1]) #define d_advance(di, i) ((di)->n += (i)) -#define d_next_char(di) (*((di)->n++)) +#define d_check_char(di, c) (d_peek_char(di) == c ? ((di)->n++, 1) : 0) +#define d_next_char(di) (d_peek_char(di) == '\0' ? '\0' : *((di)->n++)) #define d_str(di) ((di)->n) /* Functions and arrays in cp-demangle.c which are referenced by Modified: stable/10/contrib/gcclibs/libiberty/floatformat.c ============================================================================== --- stable/10/contrib/gcclibs/libiberty/floatformat.c Sat Dec 21 18:17:41 2013 (r259693) +++ stable/10/contrib/gcclibs/libiberty/floatformat.c Sat Dec 21 18:47:00 2013 (r259694) @@ -249,53 +249,51 @@ const struct floatformat floatformat_ia6 floatformat_always_valid }; + +#ifndef min +#define min(a, b) ((a) < (b) ? (a) : (b)) +#endif + /* Extract a field which starts at START and is LEN bits long. DATA and TOTAL_LEN are the thing we are extracting it from, in byteorder ORDER. */ static unsigned long get_field (const unsigned char *data, enum floatformat_byteorders order, unsigned int total_len, unsigned int start, unsigned int len) { - unsigned long result; + unsigned long result = 0; unsigned int cur_byte; - int cur_bitshift; + int lo_bit, hi_bit, cur_bitshift = 0; + int nextbyte = (order == floatformat_little) ? 1 : -1; + *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***