From owner-svn-src-stable-10@FreeBSD.ORG Sun May 17 20:38:03 2015 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3507AD29; Sun, 17 May 2015 20:38:03 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 15CC61B04; Sun, 17 May 2015 20:38:03 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4HKc2QK096805; Sun, 17 May 2015 20:38:02 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4HKc2pp096801; Sun, 17 May 2015 20:38:02 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201505172038.t4HKc2pp096801@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sun, 17 May 2015 20:38:02 +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: r283036 - in stable/10/contrib/llvm: patches tools/clang/lib/Sema 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.20 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, 17 May 2015 20:38:03 -0000 Author: dim Date: Sun May 17 20:38:01 2015 New Revision: 283036 URL: https://svnweb.freebsd.org/changeset/base/283036 Log: For clang 3.4.1, when using -fformat-extensions, and warning about the FreeBSD-specific %D and %b printf format specifiers, avoid possible argument overruns. Also reduce the differences with the version added in r280031 (which has been sent upstream). Direct commit to stable/10, since head already has clang 3.6.0. Modified: stable/10/contrib/llvm/patches/patch-r208987-format-extensions.diff stable/10/contrib/llvm/tools/clang/lib/Sema/SemaChecking.cpp Modified: stable/10/contrib/llvm/patches/patch-r208987-format-extensions.diff ============================================================================== --- stable/10/contrib/llvm/patches/patch-r208987-format-extensions.diff Sun May 17 19:59:05 2015 (r283035) +++ stable/10/contrib/llvm/patches/patch-r208987-format-extensions.diff Sun May 17 20:38:01 2015 (r283036) @@ -118,22 +118,25 @@ Index: tools/clang/lib/Sema/SemaChecking =================================================================== --- tools/clang/lib/Sema/SemaChecking.cpp +++ tools/clang/lib/Sema/SemaChecking.cpp -@@ -2980,6 +2980,40 @@ CheckPrintfHandler::HandlePrintfSpecifier(const an +@@ -2980,6 +2980,42 @@ CheckPrintfHandler::HandlePrintfSpecifier(const an CoveredArgs.set(argIndex); } -+ // FreeBSD extensions ++ // FreeBSD kernel extensions. + if (CS.getKind() == ConversionSpecifier::FreeBSDbArg || + CS.getKind() == ConversionSpecifier::FreeBSDDArg) { -+ // claim the second argument ++ // We need at least two arguments. ++ if (!CheckNumArgs(FS, CS, startSpecifier, specifierLen, argIndex + 1)) ++ return false; ++ ++ // Claim the second argument. + CoveredArgs.set(argIndex + 1); + -+ // Now type check the data expression that matches the -+ // format specifier. ++ // Type check the first argument (int for %b, pointer for %D) + const Expr *Ex = getDataArg(argIndex); -+ const analyze_printf::ArgType &AT = ++ const analyze_printf::ArgType &AT = + (CS.getKind() == ConversionSpecifier::FreeBSDbArg) ? -+ ArgType(S.Context.IntTy) : ArgType::CStrTy; ++ ArgType(S.Context.IntTy) : ArgType::CPointerTy; + if (AT.isValid() && !AT.matchesType(S.Context, Ex->getType())) + S.Diag(getLocationOfByte(CS.getStart()), + diag::warn_printf_conversion_argument_type_mismatch) @@ -141,8 +144,7 @@ Index: tools/clang/lib/Sema/SemaChecking + << getSpecifierRange(startSpecifier, specifierLen) + << Ex->getSourceRange(); + -+ // Now type check the data expression that matches the -+ // format specifier. ++ // Type check the second argument (char * for both %b and %D) + Ex = getDataArg(argIndex + 1); + const analyze_printf::ArgType &AT2 = ArgType::CStrTy; + if (AT2.isValid() && !AT2.matchesType(S.Context, Ex->getType())) @@ -163,7 +165,7 @@ Index: tools/clang/lib/Driver/Tools.cpp =================================================================== --- tools/clang/lib/Driver/Tools.cpp +++ tools/clang/lib/Driver/Tools.cpp -@@ -2991,6 +2991,7 @@ void Clang::ConstructJob(Compilation &C, const Job +@@ -2984,6 +2984,7 @@ void Clang::ConstructJob(Compilation &C, const Job // Forward -f (flag) options which we can pass directly. Args.AddLastArg(CmdArgs, options::OPT_femit_all_decls); Modified: stable/10/contrib/llvm/tools/clang/lib/Sema/SemaChecking.cpp ============================================================================== --- stable/10/contrib/llvm/tools/clang/lib/Sema/SemaChecking.cpp Sun May 17 19:59:05 2015 (r283035) +++ stable/10/contrib/llvm/tools/clang/lib/Sema/SemaChecking.cpp Sun May 17 20:38:01 2015 (r283036) @@ -2980,18 +2980,21 @@ CheckPrintfHandler::HandlePrintfSpecifie CoveredArgs.set(argIndex); } - // FreeBSD extensions + // FreeBSD kernel extensions. if (CS.getKind() == ConversionSpecifier::FreeBSDbArg || CS.getKind() == ConversionSpecifier::FreeBSDDArg) { - // claim the second argument + // We need at least two arguments. + if (!CheckNumArgs(FS, CS, startSpecifier, specifierLen, argIndex + 1)) + return false; + + // Claim the second argument. CoveredArgs.set(argIndex + 1); - // Now type check the data expression that matches the - // format specifier. + // Type check the first argument (int for %b, pointer for %D) const Expr *Ex = getDataArg(argIndex); - const analyze_printf::ArgType &AT = + const analyze_printf::ArgType &AT = (CS.getKind() == ConversionSpecifier::FreeBSDbArg) ? - ArgType(S.Context.IntTy) : ArgType::CStrTy; + ArgType(S.Context.IntTy) : ArgType::CPointerTy; if (AT.isValid() && !AT.matchesType(S.Context, Ex->getType())) S.Diag(getLocationOfByte(CS.getStart()), diag::warn_printf_conversion_argument_type_mismatch) @@ -2999,8 +3002,7 @@ CheckPrintfHandler::HandlePrintfSpecifie << getSpecifierRange(startSpecifier, specifierLen) << Ex->getSourceRange(); - // Now type check the data expression that matches the - // format specifier. + // Type check the second argument (char * for both %b and %D) Ex = getDataArg(argIndex + 1); const analyze_printf::ArgType &AT2 = ArgType::CStrTy; if (AT2.isValid() && !AT2.matchesType(S.Context, Ex->getType())) From owner-svn-src-stable-10@FreeBSD.ORG Mon May 18 02:05:58 2015 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.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D09A5485; Mon, 18 May 2015 02:05:58 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BE10C1B41; Mon, 18 May 2015 02:05:58 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4I25wNp060834; Mon, 18 May 2015 02:05:58 GMT (envelope-from edwin@FreeBSD.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4I25vZc060825; Mon, 18 May 2015 02:05:57 GMT (envelope-from edwin@FreeBSD.org) Message-Id: <201505180205.t4I25vZc060825@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: edwin set sender to edwin@FreeBSD.org using -f From: Edwin Groothuis Date: Mon, 18 May 2015 02:05:57 +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: r283043 - 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.20 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, 18 May 2015 02:05:58 -0000 Author: edwin Date: Mon May 18 02:05:56 2015 New Revision: 283043 URL: https://svnweb.freebsd.org/changeset/base/283043 Log: MFC of 283042,tzdata10: Update to tzdata2015c: Release 2015c - 2015-04-11 08:55:55 -0700 Changes affecting future time stamps Egypt's spring-forward transition is at 24:00 on April's last Thursday, not 00:00 on April's last Friday. 2015's transition will therefore be on Thursday, April 30 at 24:00, not Friday, April 24 at 00:00. Similar fixes apply to 2026, 2037, 2043, etc. (Thanks to Steffen Thorsen.) Modified: stable/10/contrib/tzdata/africa stable/10/contrib/tzdata/antarctica stable/10/contrib/tzdata/backward stable/10/contrib/tzdata/europe stable/10/contrib/tzdata/northamerica stable/10/contrib/tzdata/southamerica Modified: stable/10/contrib/tzdata/africa ============================================================================== --- stable/10/contrib/tzdata/africa Mon May 18 01:59:02 2015 (r283042) +++ stable/10/contrib/tzdata/africa Mon May 18 02:05:56 2015 (r283043) @@ -319,13 +319,22 @@ Rule Egypt 2007 only - Sep Thu>=1 24:00 # above) says DST had no affect on electricity consumption. There is # no information about when DST will end this fall. See: # http://abcnews.go.com/International/wireStory/el-sissi-pushes-egyptians-line-23614833 -# + +# From Steffen Thorsen (2015-04-08): +# Egypt will start DST on midnight after Thursday, April 30, 2015. +# This is based on a law (no 35) from May 15, 2014 saying it starts the last +# Thursday of April.... Clocks will still be turned back for Ramadan, but +# dates not yet announced.... +# http://almogaz.com/news/weird-news/2015/04/05/1947105 ... +# http://www.timeanddate.com/news/time/egypt-starts-dst-2015.html + +# From Paul Eggert (2015-04-08): # For now, guess that later spring and fall transitions will use -# 2010's rules, and guess that Egypt will switch to standard time at +# 2014's rules, and guess that Egypt will switch to standard time at # 24:00 the last Thursday before Ramadan, and back to DST at 00:00 the # first Friday after Ramadan. To implement this, # transition dates for 2015 through 2037 were determined by running -# the following program under GNU Emacs 24.3, with the results integrated +# the following program under GNU Emacs 24.4, with the results integrated # by hand into the table below. Ramadan again intrudes on the guessed # DST starting in 2038, but that's beyond our somewhat-arbitrary cutoff. # (let ((islamic-year 1436)) @@ -357,7 +366,7 @@ Rule Egypt 2014 only - May 15 24:00 1:00 Rule Egypt 2014 only - Jun 26 24:00 0 - Rule Egypt 2014 only - Jul 31 24:00 1:00 S Rule Egypt 2014 max - Sep lastThu 24:00 0 - -Rule Egypt 2015 2019 - Apr lastFri 0:00s 1:00 S +Rule Egypt 2015 2019 - Apr lastThu 24:00 1:00 S Rule Egypt 2015 only - Jun 11 24:00 0 - Rule Egypt 2015 only - Jul 23 24:00 1:00 S Rule Egypt 2016 only - Jun 2 24:00 0 - @@ -371,7 +380,7 @@ Rule Egypt 2019 only - Jun 6 24:00 1:00 Rule Egypt 2020 only - May 28 24:00 1:00 S Rule Egypt 2021 only - May 13 24:00 1:00 S Rule Egypt 2022 only - May 5 24:00 1:00 S -Rule Egypt 2023 max - Apr lastFri 0:00s 1:00 S +Rule Egypt 2023 max - Apr lastThu 24:00 1:00 S # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Africa/Cairo 2:05:09 - LMT 1900 Oct Modified: stable/10/contrib/tzdata/antarctica ============================================================================== --- stable/10/contrib/tzdata/antarctica Mon May 18 01:59:02 2015 (r283042) +++ stable/10/contrib/tzdata/antarctica Mon May 18 02:05:56 2015 (r283043) @@ -15,41 +15,6 @@ # I made up all time zone abbreviations mentioned here; corrections welcome! # FORMAT is 'zzz' and GMTOFF is 0 for locations while uninhabited. -# These rules are stolen from the 'southamerica' file. -# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S -Rule ArgAQ 1964 1966 - Mar 1 0:00 0 - -Rule ArgAQ 1964 1966 - Oct 15 0:00 1:00 S -Rule ArgAQ 1967 only - Apr 2 0:00 0 - -Rule ArgAQ 1967 1968 - Oct Sun>=1 0:00 1:00 S -Rule ArgAQ 1968 1969 - Apr Sun>=1 0:00 0 - -Rule ArgAQ 1974 only - Jan 23 0:00 1:00 S -Rule ArgAQ 1974 only - May 1 0:00 0 - -Rule ChileAQ 1972 1986 - Mar Sun>=9 3:00u 0 - -Rule ChileAQ 1974 1987 - Oct Sun>=9 4:00u 1:00 S -Rule ChileAQ 1987 only - Apr 12 3:00u 0 - -Rule ChileAQ 1988 1989 - Mar Sun>=9 3:00u 0 - -Rule ChileAQ 1988 only - Oct Sun>=1 4:00u 1:00 S -Rule ChileAQ 1989 only - Oct Sun>=9 4:00u 1:00 S -Rule ChileAQ 1990 only - Mar 18 3:00u 0 - -Rule ChileAQ 1990 only - Sep 16 4:00u 1:00 S -Rule ChileAQ 1991 1996 - Mar Sun>=9 3:00u 0 - -Rule ChileAQ 1991 1997 - Oct Sun>=9 4:00u 1:00 S -Rule ChileAQ 1997 only - Mar 30 3:00u 0 - -Rule ChileAQ 1998 only - Mar Sun>=9 3:00u 0 - -Rule ChileAQ 1998 only - Sep 27 4:00u 1:00 S -Rule ChileAQ 1999 only - Apr 4 3:00u 0 - -Rule ChileAQ 1999 2010 - Oct Sun>=9 4:00u 1:00 S -Rule ChileAQ 2000 2007 - Mar Sun>=9 3:00u 0 - -# N.B.: the end of March 29 in Chile is March 30 in Universal time, -# which is used below in specifying the transition. -Rule ChileAQ 2008 only - Mar 30 3:00u 0 - -Rule ChileAQ 2009 only - Mar Sun>=9 3:00u 0 - -Rule ChileAQ 2010 only - Apr Sun>=1 3:00u 0 - -Rule ChileAQ 2011 only - May Sun>=2 3:00u 0 - -Rule ChileAQ 2011 only - Aug Sun>=16 4:00u 1:00 S -Rule ChileAQ 2012 2015 - Apr Sun>=23 3:00u 0 - -Rule ChileAQ 2012 2014 - Sep Sun>=2 4:00u 1:00 S - # Argentina - year-round bases # Belgrano II, Confin Coast, -770227-0343737, since 1972-02-05 # Carlini, Potter Cove, King George Island, -6414-0602320, since 1982-01 @@ -344,21 +309,7 @@ Zone Antarctica/Rothera 0 - zzz 1976 Dec # USA - year-round bases # # Palmer, Anvers Island, since 1965 (moved 2 miles in 1968) -# -# From Ethan Dicks (1996-10-06): -# It keeps the same time as Punta Arenas, Chile, because, just like us -# and the South Pole, that's the other end of their supply line.... -# I verified with someone who was there that since 1980, -# Palmer has followed Chile. Prior to that, before the Falklands War, -# Palmer used to be supplied from Argentina. -# -# Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Antarctica/Palmer 0 - zzz 1965 - -4:00 ArgAQ AR%sT 1969 Oct 5 - -3:00 ArgAQ AR%sT 1982 May - -4:00 ChileAQ CL%sT 2015 Apr 26 3:00u - -3:00 - CLT -# +# See 'southamerica' for Antarctica/Palmer, since it uses South American DST. # # McMurdo Station, Ross Island, since 1955-12 # Amundsen-Scott South Pole Station, continuously occupied since 1956-11-20 Modified: stable/10/contrib/tzdata/backward ============================================================================== --- stable/10/contrib/tzdata/backward Mon May 18 01:59:02 2015 (r283042) +++ stable/10/contrib/tzdata/backward Mon May 18 02:05:56 2015 (r283043) @@ -20,6 +20,7 @@ Link America/Argentina/Jujuy America/Juj Link America/Indiana/Knox America/Knox_IN Link America/Kentucky/Louisville America/Louisville Link America/Argentina/Mendoza America/Mendoza +Link America/Toronto America/Montreal Link America/Rio_Branco America/Porto_Acre Link America/Argentina/Cordoba America/Rosario Link America/Denver America/Shiprock Modified: stable/10/contrib/tzdata/europe ============================================================================== --- stable/10/contrib/tzdata/europe Mon May 18 01:59:02 2015 (r283042) +++ stable/10/contrib/tzdata/europe Mon May 18 02:05:56 2015 (r283043) @@ -76,7 +76,7 @@ # 1:00:14 SET Swedish (1879-1899)* # 2:00 EET EEST Eastern Europe # 3:00 FET Further-eastern Europe (2011-2014)* -# 3:00 MSK MSD MSM* Moscow +# 3:00 MSK MSD MSM* Minsk, Moscow # From Peter Ilieve (1994-12-04), # The original six [EU members]: Belgium, France, (West) Germany, Italy, Modified: stable/10/contrib/tzdata/northamerica ============================================================================== --- stable/10/contrib/tzdata/northamerica Mon May 18 01:59:02 2015 (r283042) +++ stable/10/contrib/tzdata/northamerica Mon May 18 02:05:56 2015 (r283043) @@ -1331,14 +1331,9 @@ Zone America/Moncton -4:19:08 - LMT 1883 # Quebec -# From Paul Eggert (2013-08-30): -# Since 1970 most of Quebec has been like Toronto. -# However, because earlier versions of the tz database mistakenly relied on data -# from Shanks & Pottenger saying that Quebec differed from Ontario after 1970, -# a separate entry was created for most of Quebec. We're loath to lose -# its pre-1970 info, even though the tz database is normally limited to -# zones that differ after 1970, so keep this otherwise out-of-scope entry. - +# From Paul Eggert (2015-03-24): +# See America/Toronto for most of Quebec, including Montreal. +# # Matthews and Vincent (1998) also write that Quebec east of the -63 # meridian is supposed to observe AST, but residents as far east as # Natashquan use EST/EDT, and residents east of Natashquan use AST. @@ -1352,39 +1347,10 @@ Zone America/Moncton -4:19:08 - LMT 1883 # For lack of better info, guess this practice began around 1970, contra to # Shanks & Pottenger who have this region observing AST/ADT. -# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S -Rule Mont 1917 only - Mar 25 2:00 1:00 D -Rule Mont 1917 only - Apr 24 0:00 0 S -Rule Mont 1919 only - Mar 31 2:30 1:00 D -Rule Mont 1919 only - Oct 25 2:30 0 S -Rule Mont 1920 only - May 2 2:30 1:00 D -Rule Mont 1920 1922 - Oct Sun>=1 2:30 0 S -Rule Mont 1921 only - May 1 2:00 1:00 D -Rule Mont 1922 only - Apr 30 2:00 1:00 D -Rule Mont 1924 only - May 17 2:00 1:00 D -Rule Mont 1924 1926 - Sep lastSun 2:30 0 S -Rule Mont 1925 1926 - May Sun>=1 2:00 1:00 D -Rule Mont 1927 1937 - Apr lastSat 24:00 1:00 D -Rule Mont 1927 1937 - Sep lastSat 24:00 0 S -Rule Mont 1938 1940 - Apr lastSun 0:00 1:00 D -Rule Mont 1938 1939 - Sep lastSun 0:00 0 S -Rule Mont 1946 1973 - Apr lastSun 2:00 1:00 D -Rule Mont 1945 1948 - Sep lastSun 2:00 0 S -Rule Mont 1949 1950 - Oct lastSun 2:00 0 S -Rule Mont 1951 1956 - Sep lastSun 2:00 0 S -Rule Mont 1957 1973 - Oct lastSun 2:00 0 S - # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone America/Blanc-Sablon -3:48:28 - LMT 1884 -4:00 Canada A%sT 1970 -4:00 - AST -Zone America/Montreal -4:54:16 - LMT 1884 - -5:00 Mont E%sT 1918 - -5:00 Canada E%sT 1919 - -5:00 Mont E%sT 1942 Feb 9 2:00s - -5:00 Canada E%sT 1946 - -5:00 Mont E%sT 1974 - -5:00 Canada E%sT # Ontario Modified: stable/10/contrib/tzdata/southamerica ============================================================================== --- stable/10/contrib/tzdata/southamerica Mon May 18 01:59:02 2015 (r283042) +++ stable/10/contrib/tzdata/southamerica Mon May 18 02:05:56 2015 (r283043) @@ -1098,6 +1098,60 @@ Zone America/Rio_Branco -4:31:12 - LMT 1 # Chile +# From Paul Eggert (2015-04-03): +# Shanks & Pottenger says America/Santiago introduced standard time in +# 1890 and rounds its UTC offset to 70W40; guess that in practice this +# was the same offset as in 1916-1919. It also says Pacific/Easter +# standardized on 109W22 in 1890; assume this didn't change the clocks. +# +# Dates for America/Santiago from 1910 to 2004 are primarily from +# the following source, cited by Oscar van Vlijmen (2006-10-08): +# [1] Chile Law +# http://www.webexhibits.org/daylightsaving/chile.html +# This contains a copy of a this official table: +# Cambios en la hora oficial de Chile desde 1900 (retrieved 2008-03-30) +# http://web.archive.org/web/20080330200901/http://www.horaoficial.cl/cambio.htm +# [1] needs several corrections, though. +# +# The first set of corrections is from: +# [2] History of the Official Time of Chile +# http://www.horaoficial.cl/ing/horaof_ing.html (retrieved 2012-03-06). See: +# http://web.archive.org/web/20120306042032/http://www.horaoficial.cl/ing/horaof_ing.html +# This is an English translation of: +# Historia de la hora oficial de Chile (retrieved 2012-10-24). See: +# http://web.archive.org/web/20121024234627/http://www.horaoficial.cl/horaof.htm +# A fancier Spanish version (requiring mouse-clicking) is at: +# http://www.horaoficial.cl/historia_hora.html +# Conflicts between [1] and [2] were resolved as follows: +# +# - [1] says the 1910 transition was Jan 1, [2] says Jan 10 and cites +# Boletín Nº 1, Aviso Nº 1 (1910). Go with [2]. +# +# - [1] says SMT was -4:42:45, [2] says Chile's official time from +# 1916 to 1919 was -4:42:46.3, the meridian of Chile's National +# Astronomical Observatory (OAN), then located in what is now +# Quinta Normal in Santiago. Go with [2], rounding it to -4:42:46. +# +# - [1] says the 1918 transition was Sep 1, [2] says Sep 10 and cites +# Boletín Nº 22, Aviso Nº 129/1918 (1918-08-23). Go with [2]. +# +# - [1] does not give times for transitions; assume they occur +# at midnight mainland time, the current common practice. However, +# go with [2]'s specification of 23:00 for the 1947-05-21 transition. +# +# Another correction to [1] is from Jesper Nørgaard Welen, who +# wrote (2006-10-08), "I think that there are some obvious mistakes in +# the suggested link from Oscar van Vlijmen,... for instance entry 66 +# says that GMT-4 ended 1990-09-12 while entry 67 only begins GMT-3 at +# 1990-09-15 (they should have been 1990-09-15 and 1990-09-16 +# respectively), but anyhow it clears up some doubts too." +# +# Data for Pacific/Easter from 1910 through 1967 come from Shanks & +# Pottenger. After that, for lack of better info assume +# Pacific/Easter is always two hours behind America/Santiago; +# this is known to work for DST transitions starting in 2008 and +# may well be true for earlier transitions. + # From Eduardo Krell (1995-10-19): # The law says to switch to DST at midnight [24:00] on the second SATURDAY # of October.... The law is the same for March and October. @@ -1110,78 +1164,35 @@ Zone America/Rio_Branco -4:31:12 - LMT 1 # Because of the same drought, the government decided to end DST later, # on April 3, (one-time change). -# From Oscar van Vlijmen (2006-10-08): -# http://www.horaoficial.cl/cambio.htm - -# From Jesper Nørgaard Welen (2006-10-08): -# I think that there are some obvious mistakes in the suggested link -# from Oscar van Vlijmen,... for instance entry 66 says that GMT-4 -# ended 1990-09-12 while entry 67 only begins GMT-3 at 1990-09-15 -# (they should have been 1990-09-15 and 1990-09-16 respectively), but -# anyhow it clears up some doubts too. - -# From Paul Eggert (2014-08-12): -# The following data entries for Chile and America/Santiago are from -# (2006-09-20), transcribed by -# Jesper Nørgaard Welen. The data entries for Pacific/Easter are from Shanks -# & Pottenger, except with DST transitions after 1932 cloned from -# America/Santiago. The pre-1980 Pacific/Easter data entries are dubious, -# but we have no other source. - # From Germán Poo-Caamaño (2008-03-03): # Due to drought, Chile extends Daylight Time in three weeks. This # is one-time change (Saturday 3/29 at 24:00 for America/Santiago # and Saturday 3/29 at 22:00 for Pacific/Easter) # The Supreme Decree is located at # http://www.shoa.cl/servicios/supremo316.pdf -# and the instructions for 2008 are located in: -# http://www.horaoficial.cl/cambio.htm - +# # From José Miguel Garrido (2008-03-05): -# ... -# You could see the announces of the change on # http://www.shoa.cl/noticias/2008/04hora/hora.htm # From Angel Chiang (2010-03-04): # Subject: DST in Chile exceptionally extended to 3 April due to earthquake # http://www.gobiernodechile.cl/viewNoticia.aspx?idArticulo=30098 -# (in Spanish, last paragraph). # -# This is breaking news. There should be more information available later. - # From Arthur David Olson (2010-03-06): # Angel Chiang's message confirmed by Julio Pacheco; Julio provided a patch. -# From Glenn Eychaner (2011-03-02): -# It appears that the Chilean government has decided to postpone the -# change from summer time to winter time again, by three weeks to April -# 2nd: -# http://www.emol.com/noticias/nacional/detalle/detallenoticias.asp?idnoticia=467651 -# -# This is not yet reflected in the official "cambio de hora" site, but -# probably will be soon: -# http://www.horaoficial.cl/cambio.htm - -# From Arthur David Olson (2011-03-02): -# The emol.com article mentions a water shortage as the cause of the -# postponement, which may mean that it's not a permanent change. - # From Glenn Eychaner (2011-03-28): -# The article: # http://diario.elmercurio.com/2011/03/28/_portada/_portada/noticias/7565897A-CA86-49E6-9E03-660B21A4883E.htm?id=3D{7565897A-CA86-49E6-9E03-660B21A4883E} -# # In English: # Chile's clocks will go back an hour this year on the 7th of May instead # of this Saturday. They will go forward again the 3rd Saturday in -# August, not in October as they have since 1968. This is a pilot plan -# which will be reevaluated in 2012. +# August, not in October as they have since 1968. # From Mauricio Parada (2012-02-22), translated by Glenn Eychaner (2012-02-23): # As stated in the website of the Chilean Energy Ministry # http://www.minenergia.cl/ministerio/noticias/generales/gobierno-anuncia-fechas-de-cambio-de.html # The Chilean Government has decided to postpone the entrance into winter time -# (to leave DST) from March 11 2012 to April 28th 2012. The decision has not -# been yet formalized but it will within the next days. +# (to leave DST) from March 11 2012 to April 28th 2012.... # Quote from the website communication: # # 6. For the year 2012, the dates of entry into winter time will be as follows: @@ -1214,17 +1225,9 @@ Zone America/Rio_Branco -4:31:12 - LMT 1 # From Paul Eggert (2015-03-03): # For now, assume that the extension will persist indefinitely. -# NOTE: ChileAQ rules for Antarctic bases are stored separately in the -# 'antarctica' file. - # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S -Rule Chile 1927 1932 - Sep 1 0:00 1:00 S +Rule Chile 1927 1931 - Sep 1 0:00 1:00 S Rule Chile 1928 1932 - Apr 1 0:00 0 - -Rule Chile 1942 only - Jun 1 4:00u 0 - -Rule Chile 1942 only - Aug 1 5:00u 1:00 S -Rule Chile 1946 only - Jul 15 4:00u 1:00 S -Rule Chile 1946 only - Sep 1 3:00u 0:00 - -Rule Chile 1947 only - Apr 1 4:00u 0 - Rule Chile 1968 only - Nov 3 4:00u 1:00 S Rule Chile 1969 only - Mar 30 3:00u 0 - Rule Chile 1969 only - Nov 23 4:00u 1:00 S @@ -1235,10 +1238,8 @@ Rule Chile 1972 1986 - Mar Sun>=9 3:00u Rule Chile 1973 only - Sep 30 4:00u 1:00 S Rule Chile 1974 1987 - Oct Sun>=9 4:00u 1:00 S Rule Chile 1987 only - Apr 12 3:00u 0 - -Rule Chile 1988 1989 - Mar Sun>=9 3:00u 0 - -Rule Chile 1988 only - Oct Sun>=1 4:00u 1:00 S -Rule Chile 1989 only - Oct Sun>=9 4:00u 1:00 S -Rule Chile 1990 only - Mar 18 3:00u 0 - +Rule Chile 1988 1990 - Mar Sun>=9 3:00u 0 - +Rule Chile 1988 1989 - Oct Sun>=9 4:00u 1:00 S Rule Chile 1990 only - Sep 16 4:00u 1:00 S Rule Chile 1991 1996 - Mar Sun>=9 3:00u 0 - Rule Chile 1991 1997 - Oct Sun>=9 4:00u 1:00 S @@ -1261,15 +1262,21 @@ Rule Chile 2012 2014 - Sep Sun>=2 4:00u # (1996-09) says 1998-03-08. Ignore these. # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone America/Santiago -4:42:46 - LMT 1890 - -4:42:46 - SMT 1910 # Santiago Mean Time + -4:42:46 - SMT 1910 Jan 10 # Santiago Mean Time -5:00 - CLT 1916 Jul 1 # Chile Time - -4:42:46 - SMT 1918 Sep 1 # Santiago Mean Time - -4:00 - CLT 1919 Jul 1 # Chile Time - -4:42:46 - SMT 1927 Sep 1 # Santiago Mean Time - -5:00 Chile CL%sT 1947 May 22 # Chile Time + -4:42:46 - SMT 1918 Sep 10 + -4:00 - CLT 1919 Jul 1 + -4:42:46 - SMT 1927 Sep 1 + -5:00 Chile CL%sT 1932 Sep 1 + -4:00 - CLT 1942 Jun 1 + -5:00 - CLT 1942 Aug 1 + -4:00 - CLT 1946 Jul 15 + -4:00 1:00 CLST 1946 Sep 1 # central Chile + -4:00 - CLT 1947 Apr 1 + -5:00 - CLT 1947 May 21 23:00 -4:00 Chile CL%sT 2015 Apr 26 3:00u -3:00 - CLT -Zone Pacific/Easter -7:17:44 - LMT 1890 +Zone Pacific/Easter -7:17:28 - LMT 1890 -7:17:28 - EMT 1932 Sep # Easter Mean Time -7:00 Chile EAS%sT 1982 Mar 14 3:00u # Easter Time -6:00 Chile EAS%sT 2015 Apr 26 3:00u @@ -1279,6 +1286,25 @@ Zone Pacific/Easter -7:17:44 - LMT 1890 # Other Chilean locations, including Juan Fernández Is, Desventuradas Is, # and Antarctic bases, are like America/Santiago. +# Antarctic base using South American rules +# (See the file 'antarctica' for more.) +# +# Palmer, Anvers Island, since 1965 (moved 2 miles in 1968) +# +# From Ethan Dicks (1996-10-06): +# It keeps the same time as Punta Arenas, Chile, because, just like us +# and the South Pole, that's the other end of their supply line.... +# I verified with someone who was there that since 1980, +# Palmer has followed Chile. Prior to that, before the Falklands War, +# Palmer used to be supplied from Argentina. +# +# Zone NAME GMTOFF RULES FORMAT [UNTIL] +Zone Antarctica/Palmer 0 - zzz 1965 + -4:00 Arg AR%sT 1969 Oct 5 + -3:00 Arg AR%sT 1982 May + -4:00 Chile CL%sT 2015 Apr 26 3:00u + -3:00 - CLT + # Colombia # Milne gives 4:56:16.4 for Bogotá time in 1899; round to nearest. He writes, From owner-svn-src-stable-10@FreeBSD.ORG Mon May 18 10:45:19 2015 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.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2DC148D1; Mon, 18 May 2015 10:45: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1C0C512DF; Mon, 18 May 2015 10:45:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4IAjIlY018596; Mon, 18 May 2015 10:45:18 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4IAjIZg018594; Mon, 18 May 2015 10:45:18 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201505181045.t4IAjIZg018594@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Mon, 18 May 2015 10:45: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: r283054 - stable/10/lib/libmd 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.20 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, 18 May 2015 10:45:19 -0000 Author: ngie Date: Mon May 18 10:45:18 2015 New Revision: 283054 URL: https://svnweb.freebsd.org/changeset/base/283054 Log: MFC r281928: Avoid an infinite loop by ensuring that the amount of bytes read is greater than 0 in MDXFileChunk when calculating the checksum This edgecase can be triggered if the file is truncated while the checksum is being calculated (i.e. the EOF is reached) Differential Revision: https://reviews.freebsd.org/D2351 (patch by darius) PR: 196694 Reviewed by: delphij, ngie Submitted by: Daniel O'Connor Sponsored by: EMC / Isilon Storage Division Modified: stable/10/lib/libmd/mdXhl.c Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libmd/mdXhl.c ============================================================================== --- stable/10/lib/libmd/mdXhl.c Mon May 18 10:31:23 2015 (r283053) +++ stable/10/lib/libmd/mdXhl.c Mon May 18 10:45:18 2015 (r283054) @@ -74,7 +74,7 @@ MDXFileChunk(const char *filename, char i = read(f, buffer, sizeof(buffer)); else i = read(f, buffer, n); - if (i < 0) + if (i <= 0) break; MDXUpdate(&ctx, buffer, i); n -= i; From owner-svn-src-stable-10@FreeBSD.ORG Mon May 18 19:48:42 2015 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B16EA9AA; Mon, 18 May 2015 19:48: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9F2B41B7A; Mon, 18 May 2015 19:48:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4IJmgI6093224; Mon, 18 May 2015 19:48:42 GMT (envelope-from jimharris@FreeBSD.org) Received: (from jimharris@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4IJmgBJ093222; Mon, 18 May 2015 19:48:42 GMT (envelope-from jimharris@FreeBSD.org) Message-Id: <201505181948.t4IJmgBJ093222@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: jimharris set sender to jimharris@FreeBSD.org using -f From: Jim Harris Date: Mon, 18 May 2015 19:48:42 +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: r283076 - in stable/10/sys: amd64/conf 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.20 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, 18 May 2015 19:48:42 -0000 Author: jimharris Date: Mon May 18 19:48:41 2015 New Revision: 283076 URL: https://svnweb.freebsd.org/changeset/base/283076 Log: MFC r282921: Add nvme and nvd drivers to GENERIC for amd64 and i386. Sponsored by: Intel Modified: stable/10/sys/amd64/conf/GENERIC stable/10/sys/i386/conf/GENERIC Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/amd64/conf/GENERIC ============================================================================== --- stable/10/sys/amd64/conf/GENERIC Mon May 18 19:45:46 2015 (r283075) +++ stable/10/sys/amd64/conf/GENERIC Mon May 18 19:48:41 2015 (r283076) @@ -161,6 +161,10 @@ device mrsas # LSI/Avago MegaRAID SAS #device pst # Promise Supertrak SX6000 device twe # 3ware ATA RAID +# NVM Express (NVMe) support +device nvme # base NVMe driver +device nvd # expose NVMe namespaces as disks, depends on nvme + # atkbdc0 controls both the keyboard and the PS/2 mouse device atkbdc # AT keyboard controller device atkbd # AT keyboard Modified: stable/10/sys/i386/conf/GENERIC ============================================================================== --- stable/10/sys/i386/conf/GENERIC Mon May 18 19:45:46 2015 (r283075) +++ stable/10/sys/i386/conf/GENERIC Mon May 18 19:48:41 2015 (r283076) @@ -166,6 +166,10 @@ device mrsas # LSI/Avago MegaRAID SAS device pst # Promise Supertrak SX6000 device twe # 3ware ATA RAID +# NVM Express (NVMe) support +device nvme # base NVMe driver +device nvd # expose NVMe namespace as disks, depends on nvme + # atkbdc0 controls both the keyboard and the PS/2 mouse device atkbdc # AT keyboard controller device atkbd # AT keyboard From owner-svn-src-stable-10@FreeBSD.ORG Mon May 18 21:07:45 2015 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E13874CD; Mon, 18 May 2015 21:07: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CE9301596; Mon, 18 May 2015 21:07:45 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4IL7jXp036914; Mon, 18 May 2015 21:07:45 GMT (envelope-from edwin@FreeBSD.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4IL7j2Q036912; Mon, 18 May 2015 21:07:45 GMT (envelope-from edwin@FreeBSD.org) Message-Id: <201505182107.t4IL7j2Q036912@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: edwin set sender to edwin@FreeBSD.org using -f From: Edwin Groothuis Date: Mon, 18 May 2015 21:07:45 +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: r283080 - 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.20 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, 18 May 2015 21:07:46 -0000 Author: edwin Date: Mon May 18 21:07:44 2015 New Revision: 283080 URL: https://svnweb.freebsd.org/changeset/base/283080 Log: MFC of 283079,tzdata10: Update to tzdata2015d: Release 2015d - 2015-04-24 08:09:46 -0700 Changes affecting future time stamps Egypt will not observe DST in 2015 and will consider canceling it permanently. For now, assume no DST indefinitely. (Thanks to Ahmed Nazmy and Tim Parenti.) Change affecting past and future time zone abbreviations The abbreviations for Hawaii-Aleutian standard and daylight times have been changed from HAST/HADT to HST/HDT, as per US Government Printing Office style. This affects only America/Adak since 1983, as America/Honolulu was already using the new style. Modified: stable/10/contrib/tzdata/africa stable/10/contrib/tzdata/northamerica Modified: stable/10/contrib/tzdata/africa ============================================================================== --- stable/10/contrib/tzdata/africa Mon May 18 21:05:11 2015 (r283079) +++ stable/10/contrib/tzdata/africa Mon May 18 21:07:44 2015 (r283080) @@ -328,35 +328,20 @@ Rule Egypt 2007 only - Sep Thu>=1 24:00 # http://almogaz.com/news/weird-news/2015/04/05/1947105 ... # http://www.timeanddate.com/news/time/egypt-starts-dst-2015.html -# From Paul Eggert (2015-04-08): -# For now, guess that later spring and fall transitions will use -# 2014's rules, and guess that Egypt will switch to standard time at -# 24:00 the last Thursday before Ramadan, and back to DST at 00:00 the -# first Friday after Ramadan. To implement this, -# transition dates for 2015 through 2037 were determined by running -# the following program under GNU Emacs 24.4, with the results integrated -# by hand into the table below. Ramadan again intrudes on the guessed -# DST starting in 2038, but that's beyond our somewhat-arbitrary cutoff. -# (let ((islamic-year 1436)) -# (while (< islamic-year 1460) -# (let ((a (calendar-islamic-to-absolute (list 9 1 islamic-year))) -# (b (calendar-islamic-to-absolute (list 10 1 islamic-year))) -# (friday 5)) -# (while (/= friday (mod a 7)) -# (setq a (1- a))) -# (while (/= friday (mod b 7)) -# (setq b (1+ b))) -# (setq a (1- a)) -# (setq b (1- b)) -# (setq a (calendar-gregorian-from-absolute a)) -# (setq b (calendar-gregorian-from-absolute b)) -# (insert -# (format -# (concat "Rule\tEgypt\t%d\tonly\t-\t%s\t%2d\t24:00\t0\t-\n" -# "Rule\tEgypt\t%d\tonly\t-\t%s\t%2d\t24:00\t1:00\tS\n") -# (car (cdr (cdr a))) (calendar-month-name (car a) t) (car (cdr a)) -# (car (cdr (cdr b))) (calendar-month-name (car b) t) (car (cdr b))))) -# (setq islamic-year (+ 1 islamic-year)))) +# From Ahmed Nazmy (2015-04-20): +# Egypt's ministers cabinet just announced ... that it will cancel DST at +# least for 2015. +# +# From Tim Parenti (2015-04-20): +# http://english.ahram.org.eg/WriterArticles/NewsContentP/1/128195/Egypt/No-daylight-saving-this-summer-Egypts-prime-minist.aspx +# "Egypt's cabinet agreed on Monday not to switch clocks for daylight saving +# time this summer, and carry out studies on the possibility of canceling the +# practice altogether in future years." +# +# From Paul Eggert (2015-04-20): +# For now, assume DST will be canceled. Any resumption would likely +# use different rules anyway. + Rule Egypt 2008 only - Aug lastThu 24:00 0 - Rule Egypt 2009 only - Aug 20 24:00 0 - Rule Egypt 2010 only - Aug 10 24:00 0 - @@ -365,22 +350,7 @@ Rule Egypt 2010 only - Sep lastThu 24:00 Rule Egypt 2014 only - May 15 24:00 1:00 S Rule Egypt 2014 only - Jun 26 24:00 0 - Rule Egypt 2014 only - Jul 31 24:00 1:00 S -Rule Egypt 2014 max - Sep lastThu 24:00 0 - -Rule Egypt 2015 2019 - Apr lastThu 24:00 1:00 S -Rule Egypt 2015 only - Jun 11 24:00 0 - -Rule Egypt 2015 only - Jul 23 24:00 1:00 S -Rule Egypt 2016 only - Jun 2 24:00 0 - -Rule Egypt 2016 only - Jul 7 24:00 1:00 S -Rule Egypt 2017 only - May 25 24:00 0 - -Rule Egypt 2017 only - Jun 29 24:00 1:00 S -Rule Egypt 2018 only - May 10 24:00 0 - -Rule Egypt 2018 only - Jun 14 24:00 1:00 S -Rule Egypt 2019 only - May 2 24:00 0 - -Rule Egypt 2019 only - Jun 6 24:00 1:00 S -Rule Egypt 2020 only - May 28 24:00 1:00 S -Rule Egypt 2021 only - May 13 24:00 1:00 S -Rule Egypt 2022 only - May 5 24:00 1:00 S -Rule Egypt 2023 max - Apr lastThu 24:00 1:00 S +Rule Egypt 2014 only - Sep lastThu 24:00 0 - # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Africa/Cairo 2:05:09 - LMT 1900 Oct Modified: stable/10/contrib/tzdata/northamerica ============================================================================== --- stable/10/contrib/tzdata/northamerica Mon May 18 21:05:11 2015 (r283079) +++ stable/10/contrib/tzdata/northamerica Mon May 18 21:07:44 2015 (r283080) @@ -227,9 +227,14 @@ Zone PST8PDT -8:00 US P%sT # The law doesn't give abbreviations. # # From Paul Eggert (2000-01-08), following a heads-up from Rives McDow: -# Public law 106-564 (2000-12-23) introduced the abbreviation -# "Chamorro Standard Time" for time in Guam and the Northern Marianas. -# See the file "australasia". +# Public law 106-564 (2000-12-23) introduced ... "Chamorro Standard Time" +# for time in Guam and the Northern Marianas. See the file "australasia". +# +# From Paul Eggert (2015-04-17): +# HST and HDT are standardized abbreviations for Hawaii-Aleutian +# standard and daylight times. See section 9.47 (p 234) of the +# U.S. Government Printing Office Style Manual (2008) +# http://www.gpo.gov/fdsys/pkg/GPO-STYLEMANUAL-2008/pdf/GPO-STYLEMANUAL-2008.pdf # From Arthur David Olson, 2005-08-09 # The following was signed into law on 2005-08-08. @@ -536,7 +541,7 @@ Zone America/Adak 12:13:21 - LMT 1867 O -11:00 - BST 1969 -11:00 US B%sT 1983 Oct 30 2:00 -10:00 US AH%sT 1983 Nov 30 - -10:00 US HA%sT + -10:00 US H%sT # The following switches don't quite make our 1970 cutoff. # # Shanks writes that part of southwest Alaska (e.g. Aniak) @@ -1841,17 +1846,115 @@ Zone America/Creston -7:46:04 - LMT 1884 # Dawson switched to PST in 1973. Inuvik switched to MST in 1979. # Mathew Englander (1996-10-07) gives the following refs: # * 1967. Paragraph 28(34)(g) of the Interpretation Act, S.C. 1967-68, -# c. 7 defines Yukon standard time as UTC-9. This is still valid; +# c. 7 defines Yukon standard time as UTC-9.... # see Interpretation Act, R.S.C. 1985, c. I-21, s. 35(1). +# [http://canlii.ca/t/7vhg] # * C.O. 1973/214 switched Yukon to PST on 1973-10-28 00:00. # * O.I.C. 1980/02 established DST. # * O.I.C. 1987/056 changed DST to Apr firstSun 2:00 to Oct lastSun 2:00. -# Shanks & Pottenger say Yukon's 1973-10-28 switch was at 2:00; go -# with Englander. -# From Chris Walton (2006-06-26): -# Here is a link to the old daylight saving portion of the interpretation -# act which was last updated in 1987: -# http://www.gov.yk.ca/legislation/regs/oic1987_056.pdf + +# From Brian Inglis (2015-04-14): +# +# I tried to trace the history of Yukon time and found the following +# regulations, giving the reference title and URL if found, regulation name, +# and relevant quote if available. Each regulation specifically revokes its +# predecessor. The final reference is to the current Interpretation Act +# authorizing and resulting from these regulatory changes. +# +# Only recent regulations were retrievable via Yukon government site search or +# index, and only some via Canadian legal sources. Other sources used include +# articles titled "Standard Time and Time Zones in Canada" from JRASC via ADS +# Abstracts, cited by ADO for 1932 ..., and updated versions from 1958 and +# 1970 quoted below; each article includes current extracts from provincial +# and territorial ST and DST regulations at the end, summaries and details of +# standard times and daylight saving time at many locations across Canada, +# with time zone maps, tables and calculations for Canadian Sunrise, Sunset, +# and LMST; they also cover many countries and global locations, with a chart +# and table showing current Universal Time offsets, and may be useful as +# another source of information for 1970 and earlier. +# +# * Standard Time and Time Zones in Canada; Smith, C.C.; JRASC, Vol. 26, +# pp.49-77; February 1932; SAO/NASA Astrophysics Data System (ADS) +# http://adsabs.harvard.edu/abs/1932JRASC..26...49S from p.75: +# Yukon Interpretation Ordinance +# Yukon standard time is the local mean time at the one hundred and +# thirty-fifth meridian. +# +# * Standard Time and Time Zones in Canada; Smith, C.C.; Thomson, Malcolm M.; +# JRASC, Vol. 52, pp.193-223; October 1958; SAO/NASA Astrophysics Data System +# (ADS) http://adsabs.harvard.edu/abs/1958JRASC..52..193S from pp.220-1: +# Yukon Interpretation Ordinance, 1955, Chap. 16. +# +# (1) Subject to this section, standard time shall be reckoned as nine +# hours behind Greenwich Time and called Yukon Standard Time. +# +# (2) Notwithstanding subsection (1), the Commissioner may make regulations +# varying the manner of reckoning standard time. +# +# * Yukon Territory Commissioner's Order 1966-20 Interpretation Ordinance +# http://? - no online source found +# +# * Standard Time and Time Zones in Canada; Thomson, Malcolm M.; JRASC, +# Vol. 64, pp.129-162; June 1970; SAO/NASA Astrophysics Data System (ADS) +# http://adsabs.harvard.edu/abs/1970JRASC..64..129T from p.156: Yukon +# Territory Commissioner's Order 1967-59 Interpretation Ordinance ... +# +# 1. Commissioner's Order 1966-20 dated at Whitehorse in the Yukon +# Territory on 27th January, 1966, is hereby revoked. +# +# 2. Yukon (East) Standard Time as defined by section 36 of the +# Interpretation Ordinance from and after mid-night on the 28th day of May, +# 1967 shall be reckoned in the same manner as Pacific Standard Time, that +# is to say, eight hours behind Greenwich Time in the area of the Yukon +# Territory lying east of the 138th degree longitude west. +# +# 3. In the remainder of the Territory, lying west of the 138th degree +# longitude west, Yukon (West) Standard Time shall be reckoned as nine +# hours behind Greenwich Time. +# +# * Yukon Standard Time defined as Pacific Standard Time, YCO 1973/214 +# http://www.canlii.org/en/yk/laws/regu/yco-1973-214/latest/yco-1973-214.html +# C.O. 1973/214 INTERPRETATION ACT ... +# +# 1. Effective October 28, 1973 Commissioner's Order 1967/59 is hereby +# revoked. +# +# 2. Yukon Standard Time as defined by section 36 of the Interpretation +# Act from and after midnight on the twenty-eighth day of October, 1973 +# shall be reckoned in the same manner as Pacific Standard Time, that is +# to say eight hours behind Greenwich Time. +# +# * O.I.C. 1980/02 INTERPRETATION ACT +# http://? - no online source found +# +# * Yukon Daylight Saving Time, YOIC 1987/56 +# http://www.canlii.org/en/yk/laws/regu/yoic-1987-56/latest/yoic-1987-56.html +# O.I.C. 1987/056 INTERPRETATION ACT ... +# +# In every year between +# (a) two o'clock in the morning in the first Sunday in April, and +# (b) two o'clock in the morning in the last Sunday in October, +# Standard Time shall be reckoned as seven hours behind Greenwich Time and +# called Yukon Daylight Saving Time. +# ... +# Dated ... 9th day of March, A.D., 1987. +# +# * Yukon Daylight Saving Time 2006, YOIC 2006/127 +# http://www.canlii.org/en/yk/laws/regu/yoic-2006-127/latest/yoic-2006-127.html +# O.I.C. 2006/127 INTERPRETATION ACT ... +# +# 1. In Yukon each year the time for general purposes shall be 7 hours +# behind Greenwich mean time during the period commencing at two o'clock +# in the forenoon on the second Sunday of March and ending at two o'clock +# in the forenoon on the first Sunday of November and shall be called +# Yukon Daylight Saving Time. +# +# 2. Order-in-Council 1987/56 is revoked. +# +# 3. This order comes into force January 1, 2007. +# +# * Interpretation Act, RSY 2002, c 125 +# http://www.canlii.org/en/yk/laws/stat/rsy-2002-c-125/latest/rsy-2002-c-125.html # From Rives McDow (1999-09-04): # Nunavut ... moved ... to incorporate the whole territory into one time zone. @@ -2077,7 +2180,7 @@ Zone America/Inuvik 0 - zzz 1953 # Inuvi -7:00 NT_YK M%sT 1980 -7:00 Canada M%sT Zone America/Whitehorse -9:00:12 - LMT 1900 Aug 20 - -9:00 NT_YK Y%sT 1966 Jul 1 2:00 + -9:00 NT_YK Y%sT 1967 May 28 0:00 -8:00 NT_YK P%sT 1980 -8:00 Canada P%sT Zone America/Dawson -9:17:40 - LMT 1900 Aug 20 From owner-svn-src-stable-10@FreeBSD.ORG Mon May 18 21:27:47 2015 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.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id AC1A4BC6; Mon, 18 May 2015 21:27:47 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8DDCC17B4; Mon, 18 May 2015 21:27:47 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4ILRlNc047743; Mon, 18 May 2015 21:27:47 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4ILRlmI047742; Mon, 18 May 2015 21:27:47 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201505182127.t4ILRlmI047742@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Mon, 18 May 2015 21:27:47 +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: r283083 - stable/10/usr.bin/whois 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.20 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, 18 May 2015 21:27:47 -0000 Author: delphij Date: Mon May 18 21:27:46 2015 New Revision: 283083 URL: https://svnweb.freebsd.org/changeset/base/283083 Log: MFC r281959,282885 (fanf, partial),282888 (fanf): Try alternate addresses more agressively. PR: 158125 Submitted by: Mark Andrews (with changes from me) whois: code cleanup Use pedantically correct types. whois: do not clobber command-line flags when tweaking O_NONBLOCK This can make whois fail to follow referrals when it should. The bug was introduced in r281959. Modified: stable/10/usr.bin/whois/whois.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.bin/whois/whois.c ============================================================================== --- stable/10/usr.bin/whois/whois.c Mon May 18 21:18:44 2015 (r283082) +++ stable/10/usr.bin/whois/whois.c Mon May 18 21:27:46 2015 (r283083) @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1980, 1993 * The Regents of the University of California. All rights reserved. * @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -55,6 +56,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #define ABUSEHOST "whois.abuse.net" #define NICHOST "whois.crsnic.net" @@ -280,21 +283,137 @@ whois(const char *query, const char *hos FILE *sfi, *sfo; struct addrinfo *hostres, *res; char *buf, *host, *nhost, *p; - int i, s; - size_t c, len; + int s = -1, f; + nfds_t i, j; + size_t c, len, count; + struct pollfd *fds; + int timeout = 180; - s = -1; hostres = gethostinfo(hostname, 1); - for (res = hostres; res; res = res->ai_next) { - s = socket(res->ai_family, res->ai_socktype, res->ai_protocol); + for (res = hostres, count = 0; res; res = res->ai_next) + count++; + + fds = calloc(count, sizeof(*fds)); + if (fds == NULL) + err(EX_OSERR, "calloc()"); + + /* + * Traverse the result list elements and make non-block + * connection attempts. + */ + count = i = 0; + for (res = hostres; res != NULL; res = res->ai_next) { + s = socket(res->ai_family, res->ai_socktype | SOCK_NONBLOCK, + res->ai_protocol); if (s < 0) continue; - if (connect(s, res->ai_addr, res->ai_addrlen) == 0) - break; - close(s); + if (connect(s, res->ai_addr, res->ai_addrlen) < 0) { + if (errno == EINPROGRESS) { + /* Add the socket to poll list */ + fds[i].fd = s; + fds[i].events = POLLERR | POLLHUP | + POLLIN | POLLOUT; + count++; + i++; + } else { + close(s); + s = -1; + + /* + * Poll only if we have something to poll, + * otherwise just go ahead and try next + * address + */ + if (count == 0) + continue; + } + } else + goto done; + + /* + * If we are at the last address, poll until a connection is + * established or we failed all connection attempts. + */ + if (res->ai_next == NULL) + timeout = INFTIM; + + /* + * Poll the watched descriptors for successful connections: + * if we still have more untried resolved addresses, poll only + * once; otherwise, poll until all descriptors have errors, + * which will be considered as ETIMEDOUT later. + */ + do { + int n; + + n = poll(fds, i, timeout); + if (n == 0) { + /* + * No event reported in time. Try with a + * smaller timeout (but cap at 2-3ms) + * after a new host have been added. + */ + if (timeout >= 3) + timeout <<= 1; + + break; + } else if (n < 0) { + /* + * errno here can only be EINTR which we would want + * to clean up and bail out. + */ + s = -1; + goto done; + } + + /* + * Check for the event(s) we have seen. + */ + for (j = 0; j < i; j++) { + if (fds[j].fd == -1 || fds[j].events == 0 || + fds[j].revents == 0) + continue; + if (fds[j].revents & ~(POLLIN | POLLOUT)) { + close(s); + fds[j].fd = -1; + fds[j].events = 0; + count--; + continue; + } else if (fds[j].revents & (POLLIN | POLLOUT)) { + /* Connect succeeded. */ + s = fds[j].fd; + + goto done; + } + + } + } while (timeout == INFTIM && count != 0); } + + /* All attempts were failed */ + s = -1; + if (count == 0) + errno = ETIMEDOUT; + +done: + /* Close all watched fds except the succeeded one */ + for (j = 0; j < i; j++) + if (fds[j].fd != s && fds[j].fd != -1) + close(fds[j].fd); + + if (s != -1) { + /* Restore default blocking behavior. */ + if ((f = fcntl(s, F_GETFL)) != -1) { + f &= ~O_NONBLOCK; + if (fcntl(s, F_SETFL, f) == -1) + err(EX_OSERR, "fcntl()"); + } else + err(EX_OSERR, "fcntl()"); + } + + free(fds); freeaddrinfo(hostres); - if (res == NULL) + if (s == -1) err(EX_OSERR, "connect()"); sfi = fdopen(s, "r"); From owner-svn-src-stable-10@FreeBSD.ORG Tue May 19 08:00:40 2015 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.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8A1AC405; Tue, 19 May 2015 08:00: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 77AA81CF2; Tue, 19 May 2015 08:00:40 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4J80eSi083922; Tue, 19 May 2015 08:00:40 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4J80eXe083921; Tue, 19 May 2015 08:00:40 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201505190800.t4J80eXe083921@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Tue, 19 May 2015 08:00:40 +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: r283100 - stable/10/sys/dev/hyperv/netvsc 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.20 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, 19 May 2015 08:00:40 -0000 Author: delphij Date: Tue May 19 08:00:39 2015 New Revision: 283100 URL: https://svnweb.freebsd.org/changeset/base/283100 Log: MFC r279819: Fix CARP when in use in a HyperV environment: - Bump link state when stopping or starting the interface; - Don't handle SIOCGIFADDR specially, similar to r277103. This change is based on a previous revision from Andy Zhang (Microsoft) who did the diagnostic work and many thanks to them for their help in supporting the HyperV work. PR: kern/187203 Modified: stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Tue May 19 06:45:56 2015 (r283099) +++ stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Tue May 19 08:00:39 2015 (r283100) @@ -738,7 +738,14 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, switch(cmd) { case SIOCSIFADDR: - case SIOCGIFADDR: +#ifdef INET + if (ifa->ifa_addr->sa_family == AF_INET) { + ifp->if_flags |= IFF_UP; + if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) + hn_ifinit(sc); + arp_ifinit(ifp, ifa); + } else +#endif error = ether_ioctl(ifp, cmd, data); break; case SIOCSIFMTU: @@ -902,6 +909,7 @@ hn_stop(hn_softc_t *sc) printf(" Closing Device ...\n"); ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); + if_link_state_change(ifp, LINK_STATE_DOWN); sc->hn_initdone = 0; ret = hv_rf_on_close(device_ctx); @@ -951,6 +959,7 @@ hn_ifinit_locked(hn_softc_t *sc) } ifp->if_drv_flags |= IFF_DRV_RUNNING; ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; + if_link_state_change(ifp, LINK_STATE_UP); } /* From owner-svn-src-stable-10@FreeBSD.ORG Tue May 19 19:01:53 2015 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CCA5A99D; Tue, 19 May 2015 19:01:53 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BA59B174C; Tue, 19 May 2015 19:01:53 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4JJ1rdr020936; Tue, 19 May 2015 19:01:53 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4JJ1rf2020935; Tue, 19 May 2015 19:01:53 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201505191901.t4JJ1rf2020935@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Tue, 19 May 2015 19:01:53 +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: r283122 - stable/10/contrib/tcpdump 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.20 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, 19 May 2015 19:01:53 -0000 Author: brooks Date: Tue May 19 19:01:52 2015 New Revision: 283122 URL: https://svnweb.freebsd.org/changeset/base/283122 Log: MFC r282436 (the portion that makes sense): Remove "capability mode sandbox enabled" messages. These messages serve little purpose and break some consumers. PR: 199855 Differential Revision: https://reviews.freebsd.org/D2440 Reviewed by: rwatson Approved by: pjd Sponsored by: DARPA, AFRL Modified: stable/10/contrib/tcpdump/tcpdump.c Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/tcpdump/tcpdump.c ============================================================================== --- stable/10/contrib/tcpdump/tcpdump.c Tue May 19 19:01:22 2015 (r283121) +++ stable/10/contrib/tcpdump/tcpdump.c Tue May 19 19:01:52 2015 (r283122) @@ -1618,8 +1618,6 @@ main(int argc, char **argv) cansandbox = (nflag && VFileName == NULL && zflag == NULL); if (cansandbox && cap_enter() < 0 && errno != ENOSYS) error("unable to enter the capability mode"); - if (cap_sandboxed()) - fprintf(stderr, "capability mode sandbox enabled\n"); #endif /* __FreeBSD__ */ do { From owner-svn-src-stable-10@FreeBSD.ORG Wed May 20 17:02:31 2015 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.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B08A3593; Wed, 20 May 2015 17:02:31 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 871E4154A; Wed, 20 May 2015 17:02:31 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4KH2VEM081266; Wed, 20 May 2015 17:02:31 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4KH2Vxb081265; Wed, 20 May 2015 17:02:31 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201505201702.t4KH2Vxb081265@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Wed, 20 May 2015 17:02:31 +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: r283154 - 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.20 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, 20 May 2015 17:02:31 -0000 Author: gjb Date: Wed May 20 17:02:30 2015 New Revision: 283154 URL: https://svnweb.freebsd.org/changeset/base/283154 Log: Record mergeinfo for r282772, missed in r282877. Sponsored by: The FreeBSD Foundation Modified: Directory Properties: stable/10/ (props changed) From owner-svn-src-stable-10@FreeBSD.ORG Wed May 20 19:33:00 2015 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id BC95C72A; Wed, 20 May 2015 19:33: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A910D1BED; Wed, 20 May 2015 19:33:00 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4KJX0CR058358; Wed, 20 May 2015 19:33:00 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4KJWwB9058320; Wed, 20 May 2015 19:32:58 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201505201932.t4KJWwB9058320@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Wed, 20 May 2015 19:32:58 +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: r283161 - in stable/10: etc/etc.arm release release/arm release/tools release/tools/arm sys/arm/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.20 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, 20 May 2015 19:33:01 -0000 Author: gjb Date: Wed May 20 19:32:57 2015 New Revision: 283161 URL: https://svnweb.freebsd.org/changeset/base/283161 Log: MFC r282500, r282693: r282500: Add initial support for building RPI2 images. In release.sh, allow overriding buildenv_setup() before the handoff to arm/release.sh. Copy arm/RPI-B.conf -> arm/RPI2.conf, set UBOOT_PORT and the correct KERNEL, and add the buildenv_setup() override to install the sysutils/u-boot-rpi2 port/package. Copy tools/arm/crochet-RPI-B.conf -> tools/arm/crochet-RPI2.conf, and set the correct entries for the RaspberryPi2 board. r282693: Merge ^/projects/release-arm-redux into ^/head. Of note: - This commit adds native FreeBSD/arm release build support without requiring out-of-tree utilities. - Part of this merge removes the WANDBOARD-{SOLO,DUAL,QUAD} kernel configuration files, for which the IMX6 kernel configuration file should be used instead. - The resulting images have a 'freebsd' user (password 'freebsd'), to allow ssh(1) access when console access is not available (VGA or serial). The default 'root' user password is set to 'root'. - The /etc/ttys file for arm images now enable both ttyv0 and ttyu0 by default. Note: The RPI2 kernel configuration does not yet exist in stable/10, however the merge conflicts needed to be properly resolved. Additionally, SRCBRANCH has been set to base/stable/10 in the updated arm configuration files as part of this commit. Sponsored by: The FreeBSD Foundation Added: stable/10/release/arm/RPI2.conf - copied, changed from r282500, head/release/arm/RPI2.conf stable/10/release/arm/WANDBOARD.conf - copied, changed from r282693, head/release/arm/WANDBOARD.conf stable/10/release/tools/arm.subr - copied unchanged from r282693, head/release/tools/arm.subr Deleted: stable/10/release/arm/WANDBOARD-QUAD.conf stable/10/release/arm/ZEDBOARD.conf stable/10/release/arm/release.sh stable/10/release/tools/arm/ stable/10/sys/arm/conf/WANDBOARD-DUAL stable/10/sys/arm/conf/WANDBOARD-QUAD stable/10/sys/arm/conf/WANDBOARD-SOLO Modified: stable/10/etc/etc.arm/ttys stable/10/release/arm/BEAGLEBONE.conf stable/10/release/arm/PANDABOARD.conf stable/10/release/arm/RPI-B.conf stable/10/release/release.sh Directory Properties: stable/10/ (props changed) Modified: stable/10/etc/etc.arm/ttys ============================================================================== --- stable/10/etc/etc.arm/ttys Wed May 20 18:56:29 2015 (r283160) +++ stable/10/etc/etc.arm/ttys Wed May 20 19:32:57 2015 (r283161) @@ -29,7 +29,7 @@ # when going to single-user mode. console none unknown off secure # -ttyv0 "/usr/libexec/getty Pc" xterm off secure +ttyv0 "/usr/libexec/getty Pc" xterm onifconsole secure # Virtual terminals ttyv1 "/usr/libexec/getty Pc" xterm off secure ttyv2 "/usr/libexec/getty Pc" xterm off secure @@ -41,7 +41,7 @@ ttyv7 "/usr/libexec/getty Pc" xterm off #ttyv8 "/usr/local/bin/xdm -nodaemon" xterm off secure # Serial terminals # The 'dialup' keyword identifies dialin lines to login, fingerd etc. -ttyu0 "/usr/libexec/getty std.9600" vt100 on secure +ttyu0 "/usr/libexec/getty 3wire" vt100 onifconsole secure ttyu1 "/usr/libexec/getty std.9600" dialup off secure ttyu2 "/usr/libexec/getty std.9600" dialup off secure ttyu3 "/usr/libexec/getty std.9600" dialup off secure Modified: stable/10/release/arm/BEAGLEBONE.conf ============================================================================== --- stable/10/release/arm/BEAGLEBONE.conf Wed May 20 18:56:29 2015 (r283160) +++ stable/10/release/arm/BEAGLEBONE.conf Wed May 20 19:32:57 2015 (r283161) @@ -2,29 +2,36 @@ # $FreeBSD$ # -# Build chroot configuration -TARGET="amd64" -TARGET_ARCH="amd64" -SVNROOT="svn://svn.FreeBSD.org/" SRCBRANCH="base/stable/10@rHEAD" -DOCBRANCH="doc/head@rHEAD" -PORTBRANCH="ports/head@rHEAD" -NODOC=yes - -# Build target configuration -# Since this file is sourced by a script that runs another -# script, these must be exported. -set -a -WORLD_FLAGS="-j $(sysctl -n hw.ncpu)" -KERNEL_FLAGS="-j $(( $(( $(sysctl -n hw.ncpu) + 1 )) / 2 ))" -CHROOTDIR="/scratch" EMBEDDEDBUILD=1 -EMBEDDEDPORTS="lang/python textproc/gsed" -XDEV="arm" -XDEV_ARCH="armv6" -XDEV_FLAGS="WITH_GCC=1 WITH_GNUCXX=1 WITHOUT_CLANG_IS_CC=1" +EMBEDDED_TARGET="arm" +EMBEDDED_TARGET_ARCH="armv6" +EMBEDDEDPORTS="sysutils/u-boot-beaglebone" KERNEL="BEAGLEBONE" -CROCHETSRC="https://github.com/freebsd/crochet" -CROCHETBRANCH="trunk@rHEAD" -set +a +WORLD_FLAGS="${WORLD_FLAGS} UBLDR_LOADADDR=0x88000000" +IMAGE_SIZE="1G" +PART_SCHEME="MBR" +FAT_SIZE="2m" +FAT_TYPE="12" +MD_ARGS="-x 63 -y 255" +NODOC=1 +arm_install_uboot() { + UBOOT_DIR="/usr/local/share/u-boot/u-boot-beaglebone" + FATMOUNT="${DESTDIR%${KERNEL}}/fat" + UFSMOUNT="${DESTDIR%${KERNEL}}/ufs" + chroot ${CHROOTDIR} mkdir -p "${FATMOUNT}" "${UFSMOUNT}" + chroot ${CHROOTDIR} mount_msdosfs /dev/${mddev}s1 ${FATMOUNT} + chroot ${CHROOTDIR} mount /dev/${mddev}s2a ${UFSMOUNT} + chroot ${CHROOTDIR} cp -p ${UBOOT_DIR}/MLO ${FATMOUNT}/MLO + chroot ${CHROOTDIR} cp -p ${UBOOT_DIR}/u-boot.img ${FATMOUNT}/u-boot.img + chroot ${CHROOTDIR} cp -p ${UFSMOUNT}/boot/ubldr ${FATMOUNT}/ubldr + chroot ${CHROOTDIR} touch ${UFSMOUNT}/firstboot + sync + umount_loop ${CHROOTDIR}/${FATMOUNT} + umount_loop ${CHROOTDIR}/${UFSMOUNT} + chroot ${CHROOTDIR} rmdir ${FATMOUNT} + chroot ${CHROOTDIR} rmdir ${UFSMOUNT} + + return 0 +} Modified: stable/10/release/arm/PANDABOARD.conf ============================================================================== --- stable/10/release/arm/PANDABOARD.conf Wed May 20 18:56:29 2015 (r283160) +++ stable/10/release/arm/PANDABOARD.conf Wed May 20 19:32:57 2015 (r283161) @@ -2,29 +2,36 @@ # $FreeBSD$ # -# Build chroot configuration -TARGET="amd64" -TARGET_ARCH="amd64" -SVNROOT="svn://svn.FreeBSD.org/" SRCBRANCH="base/stable/10@rHEAD" -DOCBRANCH="doc/head@rHEAD" -PORTBRANCH="ports/head@rHEAD" -NODOC=yes - -# Build target configuration -# Since this file is sourced by a script that runs another -# script, these must be exported. -set -a -WORLD_FLAGS="-j $(sysctl -n hw.ncpu)" -KERNEL_FLAGS="-j $(( $(( $(sysctl -n hw.ncpu) + 1 )) / 2 ))" -CHROOTDIR="/scratch" EMBEDDEDBUILD=1 -EMBEDDEDPORTS="lang/python textproc/gsed" -XDEV="arm" -XDEV_ARCH="armv6" -XDEV_FLAGS="WITH_GCC=1 WITH_GNUCXX=1 WITHOUT_CLANG_IS_CC=1" +EMBEDDED_TARGET="arm" +EMBEDDED_TARGET_ARCH="armv6" +EMBEDDEDPORTS="sysutils/u-boot-pandaboard" KERNEL="PANDABOARD" -CROCHETSRC="https://github.com/freebsd/crochet" -CROCHETBRANCH="trunk@rHEAD" -set +a +NODOC=1 +WORLD_FLAGS="${WORLD_FLAGS} UBLDR_LOADADDR=0x88000000" +IMAGE_SIZE="1G" +PART_SCHEME="MBR" +FAT_SIZE="2m" +FAT_TYPE="12" +MD_ARGS="-x 63 -y 255" +arm_install_uboot() { + UBOOT_DIR="/usr/local/share/u-boot/u-boot-pandaboard" + FATMOUNT="${DESTDIR%${KERNEL}}/fat" + UFSMOUNT="${DESTDIR%${KERNEL}}/ufs" + chroot ${CHROOTDIR} mkdir -p "${FATMOUNT}" "${UFSMOUNT}" + chroot ${CHROOTDIR} mount_msdosfs /dev/${mddev}s1 ${FATMOUNT} + chroot ${CHROOTDIR} mount /dev/${mddev}s2a ${UFSMOUNT} + chroot ${CHROOTDIR} cp -p ${UBOOT_DIR}/MLO ${FATMOUNT}/MLO + chroot ${CHROOTDIR} cp -p ${UBOOT_DIR}/u-boot.img ${FATMOUNT}/u-boot.img + chroot ${CHROOTDIR} cp -p ${UFSMOUNT}/boot/ubldr ${FATMOUNT}/ubldr + chroot ${CHROOTDIR} touch ${UFSMOUNT}/firstboot + sync + umount_loop ${CHROOTDIR}/${FATMOUNT} + umount_loop ${CHROOTDIR}/${UFSMOUNT} + chroot ${CHROOTDIR} rmdir ${FATMOUNT} + chroot ${CHROOTDIR} rmdir ${UFSMOUNT} + + return 0 +} Modified: stable/10/release/arm/RPI-B.conf ============================================================================== --- stable/10/release/arm/RPI-B.conf Wed May 20 18:56:29 2015 (r283160) +++ stable/10/release/arm/RPI-B.conf Wed May 20 19:32:57 2015 (r283161) @@ -2,31 +2,42 @@ # $FreeBSD$ # -# Build chroot configuration -TARGET="amd64" -TARGET_ARCH="amd64" -SVNROOT="svn://svn.FreeBSD.org/" SRCBRANCH="base/stable/10@rHEAD" -DOCBRANCH="doc/head@rHEAD" -PORTBRANCH="ports/head@rHEAD" -NODOC=yes - -# Build target configuration -# Since this file is sourced by a script that runs another -# script, these must be exported. -set -a -WORLD_FLAGS="-j $(sysctl -n hw.ncpu)" -KERNEL_FLAGS="-j $(( $(( $(sysctl -n hw.ncpu) + 1 )) / 2 ))" -CHROOTDIR="/scratch" EMBEDDEDBUILD=1 -EMBEDDEDPORTS="lang/python textproc/gsed" -XDEV="arm" -XDEV_ARCH="armv6" -XDEV_FLAGS="WITH_GCC=1 WITH_GNUCXX=1 WITHOUT_CLANG_IS_CC=1" +EMBEDDED_TARGET="arm" +EMBEDDED_TARGET_ARCH="armv6" +EMBEDDEDPORTS="sysutils/u-boot-rpi" KERNEL="RPI-B" -CROCHETSRC="https://github.com/freebsd/crochet" -CROCHETBRANCH="trunk@rHEAD" -UBOOTSRC="https://github.com/gonzoua/u-boot-pi" -UBOOTBRANCH="trunk" -UBOOTDIR="/tmp/crochet/u-boot-rpi" -set +a +WORLD_FLAGS="${WORLD_FLAGS} UBLDR_LOADADDR=0x2000000" +IMAGE_SIZE="1G" +PART_SCHEME="MBR" +FAT_SIZE="17m" +FAT_TYPE="16" +MD_ARGS="-x 63 -y 255" +NODOC=1 + +arm_install_uboot() { + UBOOT_DIR="/usr/local/share/u-boot/u-boot-rpi" + UBOOT_FILES="bootcode.bin config.txt fixup.dat fixup_cd.dat \ + start.elf start_cd.elf u-boot.img" + FATMOUNT="${DESTDIR%${KERNEL}}/fat" + UFSMOUNT="${DESTDIR%${KERNEL}}/ufs" + chroot ${CHROOTDIR} mkdir -p "${FATMOUNT}" "${UFSMOUNT}" + chroot ${CHROOTDIR} mount_msdosfs /dev/${mddev}s1 ${FATMOUNT} + chroot ${CHROOTDIR} mount /dev/${mddev}s2a ${UFSMOUNT} + for _UF in ${UBOOT_FILES}; do + chroot ${CHROOTDIR} cp -p ${UBOOT_DIR}/${_UF} \ + ${FATMOUNT}/${_UF} + done + chroot ${CHROOTDIR} cp -p ${UFSMOUNT}/boot/ubldr ${FATMOUNT}/ubldr + chroot ${CHROOTDIR} cp -p ${UFSMOUNT}/boot/dtb/rpi.dtb \ + ${FATMOUNT}/rpi.dtb + chroot ${CHROOTDIR} touch ${UFSMOUNT}/firstboot + sync + umount_loop ${CHROOTDIR}/${FATMOUNT} + umount_loop ${CHROOTDIR}/${UFSMOUNT} + chroot ${CHROOTDIR} rmdir ${FATMOUNT} + chroot ${CHROOTDIR} rmdir ${UFSMOUNT} + + return 0 +} Copied and modified: stable/10/release/arm/RPI2.conf (from r282500, head/release/arm/RPI2.conf) ============================================================================== --- head/release/arm/RPI2.conf Tue May 5 16:28:04 2015 (r282500, copy source) +++ stable/10/release/arm/RPI2.conf Wed May 20 19:32:57 2015 (r283161) @@ -3,51 +3,42 @@ # $FreeBSD$ # -# Global variables. -export SVNROOT="svn://svn.FreeBSD.org/" -export SRCBRANCH="base/head@rHEAD" -export DOCBRANCH="doc/head@rHEAD" -export PORTBRANCH="ports/head@rHEAD" -export NODOC=yes -export WORLD_FLAGS="-j $(sysctl -n hw.ncpu)" -export KERNEL_FLAGS="-j $(( $(( $(sysctl -n hw.ncpu) + 1 )) / 2 ))" -export CHROOTDIR="/scratch" -export EMBEDDEDBUILD=1 -export UBOOT_PORT="sysutils/u-boot-rpi2" +SRCBRANCH="base/stable/10@rHEAD" +EMBEDDEDBUILD=1 +EMBEDDED_TARGET="arm" +EMBEDDED_TARGET_ARCH="armv6" +EMBEDDEDPORTS="sysutils/u-boot-rpi2" +KERNEL="RPI2" +NODOC=1 +WORLD_FLAGS="${WORLD_FLAGS} UBLDR_LOADADDR=0x2000000" +IMAGE_SIZE="1G" +PART_SCHEME="MBR" +FAT_SIZE="50m" +FAT_TYPE="16" +MD_ARGS="-x 63 -y 255" -# Build chroot configuration -load_chroot_env() { - # Avoid collision with TARGET and XDEV. - unset XDEV XDEV_ARCH KERNEL - export TARGET="amd64" - export TARGET_ARCH="amd64" -} - -# Build target configuration -load_target_env() { - # Avoid collision with TARGET and XDEV. - unset TARGET TARGET_ARCH - export XDEV="arm" - export XDEV_ARCH="armv6" - export XDEV_FLAGS="WITH_GCC=1 WITH_GCC_BOOTSTRAP=1 WITHOUT_CLANG_IS_CC=1" - export XDEV_FLAGS="${XDEV_FLAGS} MK_TESTS=no" - export KERNEL="RPI2" - export CROCHETSRC="https://github.com/freebsd/crochet" - export CROCHETBRANCH="trunk@rHEAD" -} - -# Build environment setup -buildenv_setup() { - if [ ! -d ${CHROOTDIR}/usr/ports/${UBOOT_PORT} ]; then - chroot ${CHROOTDIR} env ASSUME_ALWAYS_YES=yes \ - /usr/sbin/pkg bootstrap -y - chroot ${CHROOTDIR} env ASSUME_ALWAYS_YES=yes \ - /usr/sbin/pkg install -y ${UBOOT_PORT} - else - chroot ${CHROOTDIR} env BATCH=1 \ - make -C /usr/ports/${UBOOT_PORT} \ - all install clean - fi +arm_install_uboot() { + UBOOT_DIR="/usr/local/share/u-boot/u-boot-rpi2" + UBOOT_FILES="bootcode.bin config.txt fixup.dat fixup_cd.dat \ + fixup_x.dat start.elf start_cd.elf start_x.elf u-boot.bin" + FATMOUNT="${DESTDIR%${KERNEL}}/fat" + UFSMOUNT="${DESTDIR%${KERNEL}}/ufs" + chroot ${CHROOTDIR} mkdir -p "${FATMOUNT}" "${UFSMOUNT}" + chroot ${CHROOTDIR} mount_msdosfs /dev/${mddev}s1 ${FATMOUNT} + chroot ${CHROOTDIR} mount /dev/${mddev}s2a ${UFSMOUNT} + for _UF in ${UBOOT_FILES}; do + chroot ${CHROOTDIR} cp -p ${UBOOT_DIR}/${_UF} \ + ${FATMOUNT}/${_UF} + done + chroot ${CHROOTDIR} cp -p ${UFSMOUNT}/boot/ubldr ${FATMOUNT}/ubldr + chroot ${CHROOTDIR} cp -p ${UFSMOUNT}/boot/dtb/rpi2.dtb \ + ${FATMOUNT}/rpi2.dtb + chroot ${CHROOTDIR} touch ${UFSMOUNT}/firstboot + sync + umount_loop ${CHROOTDIR}/${FATMOUNT} + umount_loop ${CHROOTDIR}/${UFSMOUNT} + chroot ${CHROOTDIR} rmdir ${FATMOUNT} + chroot ${CHROOTDIR} rmdir ${UFSMOUNT} + return 0 } - Copied and modified: stable/10/release/arm/WANDBOARD.conf (from r282693, head/release/arm/WANDBOARD.conf) ============================================================================== --- head/release/arm/WANDBOARD.conf Sat May 9 21:08:12 2015 (r282693, copy source) +++ stable/10/release/arm/WANDBOARD.conf Wed May 20 19:32:57 2015 (r283161) @@ -3,6 +3,7 @@ # $FreeBSD$ # +SRCBRANCH="base/stable/10@rHEAD" EMBEDDEDBUILD=1 EMBEDDED_TARGET="arm" EMBEDDED_TARGET_ARCH="armv6" Modified: stable/10/release/release.sh ============================================================================== --- stable/10/release/release.sh Wed May 20 18:56:29 2015 (r283160) +++ stable/10/release/release.sh Wed May 20 19:32:57 2015 (r283161) @@ -36,250 +36,359 @@ # $FreeBSD$ # -PATH="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin" -export PATH +export PATH="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin" -# The directory within which the release will be built. -CHROOTDIR="/scratch" -RELENGDIR="$(realpath $(dirname $(basename ${0})))" - -# The default version control system command to obtain the sources. -VCSCMD="svn checkout" - -# The default svn checkout server, and svn branches for src/, doc/, -# and ports/. -SVNROOT="svn://svn.FreeBSD.org/" -SRCBRANCH="base/head@rHEAD" -DOCBRANCH="doc/head@rHEAD" -PORTBRANCH="ports/head@rHEAD" - -# Set for embedded device builds. -EMBEDDEDBUILD= - -# Sometimes one needs to checkout src with --force svn option. -# If custom kernel configs copied to src tree before checkout, e.g. -SRC_FORCE_CHECKOUT= - -# The default make.conf and src.conf to use. Set to /dev/null -# by default to avoid polluting the chroot(8) environment with -# non-default settings. -MAKE_CONF="/dev/null" -SRC_CONF="/dev/null" - -# The number of make(1) jobs, defaults to the number of CPUs available for -# buildworld, and half of number of CPUs available for buildkernel. -WORLD_FLAGS="-j$(sysctl -n hw.ncpu)" -KERNEL_FLAGS="-j$(( $(( $(sysctl -n hw.ncpu) + 1 )) / 2))" - -MAKE_FLAGS="-s" - -# The name of the kernel to build, defaults to GENERIC. -KERNEL="GENERIC" - -# Set to non-empty value to disable checkout of doc/ and/or ports/. Disabling -# ports/ checkout also forces NODOC to be set. -NODOC= -NOPORTS= - -# Set to non-empty value to build dvd1.iso as part of the release. -WITH_DVD= -WITH_COMPRESSED_IMAGES= - -# Set to non-empty value to build virtual machine images as part of -# the release. -WITH_VMIMAGES= -WITH_COMPRESSED_VMIMAGES= - -# Set to non-empty value to build virtual machine images for various -# cloud providers as part of the release. -WITH_CLOUDWARE= +VERSION=2 + +# Prototypes that can be redefined per-chroot or per-target. +load_chroot_env() { } +load_target_env() { } +buildenv_setup() { } usage() { echo "Usage: $0 [-c release.conf]" exit 1 } -while getopts c: opt; do - case ${opt} in - c) - RELEASECONF="${OPTARG}" - if [ ! -e "${RELEASECONF}" ]; then - echo "ERROR: Configuration file ${RELEASECONF} does not exist." - exit 1 - fi - # Source the specified configuration file for overrides - . ${RELEASECONF} - ;; - \?) - usage - ;; - esac -done -shift $(($OPTIND - 1)) +# env_setup(): Set up the default build environment variables, such as the +# CHROOTDIR, VCSCMD, SVNROOT, etc. This is called before the release.conf +# file is sourced, if '-c ' is specified. +env_setup() { + # The directory within which the release will be built. + CHROOTDIR="/scratch" + RELENGDIR="$(dirname $(realpath ${0}))" + + # The default version control system command to obtain the sources. + for _dir in /usr/bin /usr/local/bin; do + for _svn in svn svnlite; do + [ -x "${_dir}/${_svn}" ] && VCSCMD="${_dir}/${_svn}" + [ ! -z "${VCSCMD}" ] && break 2 + done + done + VCSCMD="${VCSCMD} checkout" + + # The default svn checkout server, and svn branches for src/, doc/, + # and ports/. + SVNROOT="svn://svn.FreeBSD.org/" + SRCBRANCH="base/head@rHEAD" + DOCBRANCH="doc/head@rHEAD" + PORTBRANCH="ports/head@rHEAD" + + # Set for embedded device builds. + EMBEDDEDBUILD= + + # Sometimes one needs to checkout src with --force svn option. + # If custom kernel configs copied to src tree before checkout, e.g. + SRC_FORCE_CHECKOUT= + + # The default make.conf and src.conf to use. Set to /dev/null + # by default to avoid polluting the chroot(8) environment with + # non-default settings. + MAKE_CONF="/dev/null" + SRC_CONF="/dev/null" + + # The number of make(1) jobs, defaults to the number of CPUs available + # for buildworld, and half of number of CPUs available for buildkernel. + WORLD_FLAGS="-j$(sysctl -n hw.ncpu)" + KERNEL_FLAGS="-j$(( $(( $(sysctl -n hw.ncpu) + 1 )) / 2))" + + MAKE_FLAGS="-s" + + # The name of the kernel to build, defaults to GENERIC. + KERNEL="GENERIC" + + # Set to non-empty value to disable checkout of doc/ and/or ports/. + # Disabling ports/ checkout also forces NODOC to be set. + NODOC= + NOPORTS= -# Fix for backwards-compatibility with release.conf that does not have the -# trailing '/'. -case ${SVNROOT} in - *svn*) - SVNROOT="${SVNROOT}/" - ;; - *) - ;; -esac - -# Prefix the branches with the SVNROOT for the full checkout URL. -SRCBRANCH="${SVNROOT}${SRCBRANCH}" -DOCBRANCH="${SVNROOT}${DOCBRANCH}" -PORTBRANCH="${SVNROOT}${PORTBRANCH}" - -if [ -n "${EMBEDDEDBUILD}" ]; then - if [ -z "${XDEV}" ] || [ -z "${XDEV_ARCH}" ]; then - echo "ERROR: XDEV and XDEV_ARCH must be set in ${RELEASECONF}." - exit 1 - fi + # Set to non-empty value to build dvd1.iso as part of the release. WITH_DVD= WITH_COMPRESSED_IMAGES= - NODOC=yes -fi -# If PORTS is set and NODOC is unset, force NODOC=yes because the ports tree -# is required to build the documentation set. -if [ -n "${NOPORTS}" ] && [ -z "${NODOC}" ]; then - echo "*** NOTICE: Setting NODOC=1 since ports tree is required" - echo " and NOPORTS is set." - NODOC=yes -fi - -# If NOPORTS and/or NODOC are unset, they must not pass to make as variables. -# The release makefile verifies definedness of NOPORTS/NODOC variables -# instead of their values. -DOCPORTS= -if [ -n "${NOPORTS}" ]; then - DOCPORTS="NOPORTS=yes " -fi -if [ -n "${NODOC}" ]; then - DOCPORTS="${DOCPORTS}NODOC=yes" -fi - -# The aggregated build-time flags based upon variables defined within -# this file, unless overridden by release.conf. In most cases, these -# will not need to be changed. -CONF_FILES="__MAKE_CONF=${MAKE_CONF} SRCCONF=${SRC_CONF}" -if [ -n "${TARGET}" ] && [ -n "${TARGET_ARCH}" ]; then - ARCH_FLAGS="TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH}" -else - ARCH_FLAGS= -fi -CHROOT_MAKEENV="${CHROOT_MAKEENV} MAKEOBJDIRPREFIX=${CHROOTDIR}/tmp/obj" -CHROOT_WMAKEFLAGS="${MAKE_FLAGS} ${WORLD_FLAGS} ${CONF_FILES}" -CHROOT_IMAKEFLAGS="${CONF_FILES}" -CHROOT_DMAKEFLAGS="${CONF_FILES}" -RELEASE_WMAKEFLAGS="${MAKE_FLAGS} ${WORLD_FLAGS} ${ARCH_FLAGS} ${CONF_FILES}" -RELEASE_KMAKEFLAGS="${MAKE_FLAGS} ${KERNEL_FLAGS} KERNCONF=\"${KERNEL}\" ${ARCH_FLAGS} ${CONF_FILES}" -RELEASE_RMAKEFLAGS="${ARCH_FLAGS} KERNCONF=\"${KERNEL}\" ${CONF_FILES} \ - ${DOCPORTS} WITH_DVD=${WITH_DVD} WITH_VMIMAGES=${WITH_VMIMAGES} \ - WITH_CLOUDWARE=${WITH_CLOUDWARE}" - -# Force src checkout if configured -FORCE_SRC_KEY= -if [ -n "${SRC_FORCE_CHECKOUT}" ]; then - FORCE_SRC_KEY="--force" -fi + # Set to non-empty value to build virtual machine images as part of + # the release. + WITH_VMIMAGES= + WITH_COMPRESSED_VMIMAGES= + XZ_THREADS=0 + + # Set to non-empty value to build virtual machine images for various + # cloud providers as part of the release. + WITH_CLOUDWARE= + + return 0 +} # env_setup() + +# env_check(): Perform sanity tests on the build environment, such as ensuring +# files/directories exist, as well as adding backwards-compatibility hacks if +# necessary. This is called unconditionally, and overrides the defaults set +# in env_setup() if '-c ' is specified. +env_check() { + chroot_build_release_cmd="chroot_build_release" + # Fix for backwards-compatibility with release.conf that does not have + # the trailing '/'. + case ${SVNROOT} in + *svn*) + SVNROOT="${SVNROOT}/" + ;; + *) + ;; + esac -if [ -z "${CHROOTDIR}" ]; then - echo "Please set CHROOTDIR." - exit 1 -fi + # Prefix the branches with the SVNROOT for the full checkout URL. + SRCBRANCH="${SVNROOT}${SRCBRANCH}" + DOCBRANCH="${SVNROOT}${DOCBRANCH}" + PORTBRANCH="${SVNROOT}${PORTBRANCH}" + + if [ -n "${EMBEDDEDBUILD}" ]; then + WITH_DVD= + WITH_COMPRESSED_IMAGES= + NODOC=yes + case ${EMBEDDED_TARGET}:${EMBEDDED_TARGET_ARCH} in + arm:armv6) + chroot_build_release_cmd="chroot_arm_armv6_build_release" + ;; + *) + esac + fi -if [ $(id -u) -ne 0 ]; then - echo "Needs to be run as root." - exit 1 -fi + # If PORTS is set and NODOC is unset, force NODOC=yes because the ports + # tree is required to build the documentation set. + if [ -n "${NOPORTS}" ] && [ -z "${NODOC}" ]; then + echo "*** NOTICE: Setting NODOC=1 since ports tree is required" + echo " and NOPORTS is set." + NODOC=yes + fi -set -e # Everything must succeed + # If NOPORTS and/or NODOC are unset, they must not pass to make as + # variables. The release makefile verifies definedness of the + # NOPORTS/NODOC variables instead of their values. + DOCPORTS= + if [ -n "${NOPORTS}" ]; then + DOCPORTS="NOPORTS=yes " + fi + if [ -n "${NODOC}" ]; then + DOCPORTS="${DOCPORTS}NODOC=yes" + fi -mkdir -p ${CHROOTDIR}/usr + # The aggregated build-time flags based upon variables defined within + # this file, unless overridden by release.conf. In most cases, these + # will not need to be changed. + CONF_FILES="__MAKE_CONF=${MAKE_CONF} SRCCONF=${SRC_CONF}" + if [ -n "${TARGET}" ] && [ -n "${TARGET_ARCH}" ]; then + ARCH_FLAGS="TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH}" + else + ARCH_FLAGS= + fi + # Force src checkout if configured + FORCE_SRC_KEY= + if [ -n "${SRC_FORCE_CHECKOUT}" ]; then + FORCE_SRC_KEY="--force" + fi -if [ -z "${SRC_UPDATE_SKIP}" ]; then - ${VCSCMD} ${FORCE_SRC_KEY} ${SRCBRANCH} ${CHROOTDIR}/usr/src -fi -if [ -z "${NODOC}" ] && [ -z "${DOC_UPDATE_SKIP}" ]; then - ${VCSCMD} ${DOCBRANCH} ${CHROOTDIR}/usr/doc -fi -if [ -z "${NOPORTS}" ] && [ -z "${PORTS_UPDATE_SKIP}" ]; then - ${VCSCMD} ${PORTBRANCH} ${CHROOTDIR}/usr/ports -fi - -if [ -z "${CHROOTBUILD_SKIP}" ]; then - cd ${CHROOTDIR}/usr/src - env ${CHROOT_MAKEENV} make ${CHROOT_WMAKEFLAGS} buildworld - env ${CHROOT_MAKEENV} make ${CHROOT_IMAKEFLAGS} installworld \ - DESTDIR=${CHROOTDIR} - env ${CHROOT_MAKEENV} make ${CHROOT_DMAKEFLAGS} distribution \ - DESTDIR=${CHROOTDIR} -fi -mount -t devfs devfs ${CHROOTDIR}/dev -cp /etc/resolv.conf ${CHROOTDIR}/etc/resolv.conf -trap "umount ${CHROOTDIR}/dev" EXIT # Clean up devfs mount on exit - -# If MAKE_CONF and/or SRC_CONF are set and not character devices (/dev/null), -# copy them to the chroot. -if [ -e ${MAKE_CONF} ] && [ ! -c ${MAKE_CONF} ]; then - mkdir -p ${CHROOTDIR}/$(dirname ${MAKE_CONF}) - cp ${MAKE_CONF} ${CHROOTDIR}/${MAKE_CONF} -fi -if [ -e ${SRC_CONF} ] && [ ! -c ${SRC_CONF} ]; then - mkdir -p ${CHROOTDIR}/$(dirname ${SRC_CONF}) - cp ${SRC_CONF} ${CHROOTDIR}/${SRC_CONF} -fi - -# Embedded builds do not use the 'make release' target. -if [ -n "${EMBEDDEDBUILD}" ]; then - # If a crochet configuration file exists in *this* checkout of - # release/, copy it to the /tmp/external directory within the chroot. - # This allows building embedded releases without relying on updated - # scripts and/or configurations to exist in the branch being built. - if [ -e ${RELENGDIR}/tools/${XDEV}/crochet-${KERNEL}.conf ] && \ - [ -e ${RELENGDIR}/${XDEV}/release.sh ]; then - mkdir -p ${CHROOTDIR}/tmp/external/${XDEV}/ - cp ${RELENGDIR}/tools/${XDEV}/crochet-${KERNEL}.conf \ - ${CHROOTDIR}/tmp/external/${XDEV}/crochet-${KERNEL}.conf - /bin/sh ${RELENGDIR}/${XDEV}/release.sh - fi - # If the script does not exist for this architecture, exit. - # This probably should be checked earlier, but allowing the rest - # of the build process to get this far will at least set up the - # chroot environment for testing. - exit 0 -else - # Not embedded. - continue -fi + if [ -z "${CHROOTDIR}" ]; then + echo "Please set CHROOTDIR." + exit 1 + fi -if [ -d ${CHROOTDIR}/usr/ports ]; then + if [ $(id -u) -ne 0 ]; then + echo "Needs to be run as root." + exit 1 + fi + + CHROOT_MAKEENV="${CHROOT_MAKEENV} \ + MAKEOBJDIRPREFIX=${CHROOTDIR}/tmp/obj" + CHROOT_WMAKEFLAGS="${MAKE_FLAGS} ${WORLD_FLAGS} ${CONF_FILES}" + CHROOT_IMAKEFLAGS="${CONF_FILES}" + CHROOT_DMAKEFLAGS="${CONF_FILES}" + RELEASE_WMAKEFLAGS="${MAKE_FLAGS} ${WORLD_FLAGS} ${ARCH_FLAGS} \ + ${CONF_FILES}" + RELEASE_KMAKEFLAGS="${MAKE_FLAGS} ${KERNEL_FLAGS} \ + KERNCONF=\"${KERNEL}\" ${ARCH_FLAGS} ${CONF_FILES}" + RELEASE_RMAKEFLAGS="${ARCH_FLAGS} \ + KERNCONF=\"${KERNEL}\" ${CONF_FILES} ${DOCPORTS} \ + WITH_DVD=${WITH_DVD} WITH_VMIMAGES=${WITH_VMIMAGES} \ + WITH_CLOUDWARE=${WITH_CLOUDWARE} XZ_THREADS=${XZ_THREADS}" + + return 0 +} # env_check() + +# chroot_setup(): Prepare the build chroot environment for the release build. +chroot_setup() { + load_chroot_env + mkdir -p ${CHROOTDIR}/usr + + if [ -z "${SRC_UPDATE_SKIP}" ]; then + ${VCSCMD} ${FORCE_SRC_KEY} ${SRCBRANCH} ${CHROOTDIR}/usr/src + fi + if [ -z "${NODOC}" ] && [ -z "${DOC_UPDATE_SKIP}" ]; then + ${VCSCMD} ${DOCBRANCH} ${CHROOTDIR}/usr/doc + fi + if [ -z "${NOPORTS}" ] && [ -z "${PORTS_UPDATE_SKIP}" ]; then + ${VCSCMD} ${PORTBRANCH} ${CHROOTDIR}/usr/ports + fi + + if [ -z "${CHROOTBUILD_SKIP}" ]; then + cd ${CHROOTDIR}/usr/src + env ${CHROOT_MAKEENV} make ${CHROOT_WMAKEFLAGS} buildworld + env ${CHROOT_MAKEENV} make ${CHROOT_IMAKEFLAGS} installworld \ + DESTDIR=${CHROOTDIR} + env ${CHROOT_MAKEENV} make ${CHROOT_DMAKEFLAGS} distribution \ + DESTDIR=${CHROOTDIR} + fi + + return 0 +} # chroot_setup() + +# extra_chroot_setup(): Prepare anything additional within the build +# necessary for the release build. +extra_chroot_setup() { + mkdir -p ${CHROOTDIR}/dev + mount -t devfs devfs ${CHROOTDIR}/dev + [ -e /etc/resolv.conf ] && cp /etc/resolv.conf \ + ${CHROOTDIR}/etc/resolv.conf # Run ldconfig(8) in the chroot directory so /var/run/ld-elf*.so.hints # is created. This is needed by ports-mgmt/pkg. - chroot ${CHROOTDIR} /etc/rc.d/ldconfig forcerestart + eval chroot ${CHROOTDIR} /etc/rc.d/ldconfig forcerestart + + # If MAKE_CONF and/or SRC_CONF are set and not character devices + # (/dev/null), copy them to the chroot. + if [ -e ${MAKE_CONF} ] && [ ! -c ${MAKE_CONF} ]; then + mkdir -p ${CHROOTDIR}/$(dirname ${MAKE_CONF}) + cp ${MAKE_CONF} ${CHROOTDIR}/${MAKE_CONF} + fi + if [ -e ${SRC_CONF} ] && [ ! -c ${SRC_CONF} ]; then + mkdir -p ${CHROOTDIR}/$(dirname ${SRC_CONF}) + cp ${SRC_CONF} ${CHROOTDIR}/${SRC_CONF} + fi + + if [ -d ${CHROOTDIR}/usr/ports ]; then + # Trick the ports 'run-autotools-fixup' target to do the right + # thing. + _OSVERSION=$(chroot ${CHROOTDIR} /usr/bin/uname -U) + REVISION=$(chroot ${CHROOTDIR} make -C /usr/src/release -V REVISION) + BRANCH=$(chroot ${CHROOTDIR} make -C /usr/src/release -V BRANCH) + UNAME_r=${REVISION}-${BRANCH} + if [ -d ${CHROOTDIR}/usr/doc ] && [ -z "${NODOC}" ]; then + PBUILD_FLAGS="OSVERSION=${_OSVERSION} BATCH=yes" + PBUILD_FLAGS="${PBUILD_FLAGS} UNAME_r=${UNAME_r}" + PBUILD_FLAGS="${PBUILD_FLAGS} OSREL=${REVISION}" + chroot ${CHROOTDIR} make -C /usr/ports/textproc/docproj \ + ${PBUILD_FLAGS} OPTIONS_UNSET="FOP IGOR" \ + install clean distclean + fi + fi + + if [ ! -z "${EMBEDDEDPORTS}" ]; then + for _PORT in ${EMBEDDEDPORTS}; do + eval chroot ${CHROOTDIR} make -C /usr/ports/${_PORT} \ + BATCH=1 FORCE_PKG_REGISTER=1 install clean distclean + done + fi + + buildenv_setup + + return 0 +} # extra_chroot_setup() + +# chroot_build_target(): Build the userland and kernel for the build target. +chroot_build_target() { + load_target_env + if [ ! -z "${EMBEDDEDBUILD}" ]; then + RELEASE_WMAKEFLAGS="${RELEASE_WMAKEFLAGS} \ + TARGET=${EMBEDDED_TARGET} \ + TARGET_ARCH=${EMBEDDED_TARGET_ARCH}" + RELEASE_KMAKEFLAGS="${RELEASE_KMAKEFLAGS} \ + TARGET=${EMBEDDED_TARGET} \ + TARGET_ARCH=${EMBEDDED_TARGET_ARCH}" + fi + eval chroot ${CHROOTDIR} make -C /usr/src ${RELEASE_WMAKEFLAGS} buildworld + eval chroot ${CHROOTDIR} make -C /usr/src ${RELEASE_KMAKEFLAGS} buildkernel + + return 0 +} # chroot_build_target + +# chroot_build_release(): Invoke the 'make release' target. +chroot_build_release() { + load_target_env + eval chroot ${CHROOTDIR} make -C /usr/src/release \ + ${RELEASE_RMAKEFLAGS} release + eval chroot ${CHROOTDIR} make -C /usr/src/release \ + ${RELEASE_RMAKEFLAGS} install DESTDIR=/R \ + WITH_COMPRESSED_IMAGES=${WITH_COMPRESSED_IMAGES} \ + WITH_COMPRESSED_VMIMAGES=${WITH_COMPRESSED_VMIMAGES} + + return 0 +} # chroot_build_release() + +# chroot_arm_armv6_build_release(): Create arm/armv6 SD card image. +chroot_arm_armv6_build_release() { + load_target_env + eval chroot ${CHROOTDIR} make -C /usr/src/release obj + if [ -e "${RELENGDIR}/tools/${EMBEDDED_TARGET}.subr" ]; then + . "${RELENGDIR}/tools/${EMBEDDED_TARGET}.subr" + fi + [ ! -z "${RELEASECONF}" ] && . "${RELEASECONF}" + WORLDDIR="$(eval chroot ${CHROOTDIR} make -C /usr/src/release -V WORLDDIR)" + OBJDIR="$(eval chroot ${CHROOTDIR} make -C /usr/src/release -V .OBJDIR)" + DESTDIR="${OBJDIR}/${KERNEL}" + IMGBASE="${CHROOTDIR}/${OBJDIR}/${KERNEL}.img" + OSRELEASE="$(eval chroot ${CHROOTDIR} make -C /usr/src/release \ + TARGET=${EMBEDDED_TARGET} TARGET_ARCH=${EMBEDDED_TARGET_ARCH} \ + -V OSRELEASE)" + chroot ${CHROOTDIR} mkdir -p ${DESTDIR} + chroot ${CHROOTDIR} truncate -s ${IMAGE_SIZE} ${IMGBASE##${CHROOTDIR}} + export mddev=$(chroot ${CHROOTDIR} \ + mdconfig -f ${IMGBASE##${CHROOTDIR}} ${MD_ARGS}) + arm_create_disk + arm_install_base + arm_install_uboot + mdconfig -d -u ${mddev} + chroot ${CHROOTDIR} rmdir ${DESTDIR} + mv ${IMGBASE} ${CHROOTDIR}/${OBJDIR}/${OSRELEASE}-${KERNEL}.img + chroot ${CHROOTDIR} mkdir -p /R + chroot ${CHROOTDIR} cp -p ${OBJDIR}/${OSRELEASE}-${KERNEL}.img \ + /R/${OSRELEASE}-${KERNEL}.img + chroot ${CHROOTDIR} xz -T ${XZ_THREADS} /R/${OSRELEASE}-${KERNEL}.img + cd ${CHROOTDIR}/R && sha256 ${OSRELEASE}* \ + > CHECKSUM.SHA256 + cd ${CHROOTDIR}/R && md5 ${OSRELEASE}* \ + > CHECKSUM.MD5 + + return 0 +} # chroot_arm_armv6_build_release() + +# main(): Start here. +main() { + set -e # Everything must succeed + env_setup + while getopts c: opt; do + case ${opt} in + c) + RELEASECONF="${OPTARG}" + ;; + \?) + usage + ;; + esac + done + shift $(($OPTIND - 1)) + if [ ! -z "${RELEASECONF}" ]; then + if [ -e "${RELEASECONF}" ]; then + . ${RELEASECONF} + else + echo "Nonexistent configuration file: ${RELEASECONF}" + echo "Using default build environment." + fi + fi + env_check + trap "umount ${CHROOTDIR}/dev" EXIT # Clean up devfs mount on exit + chroot_setup + extra_chroot_setup + chroot_build_target + ${chroot_build_release_cmd} + + return 0 +} # main() - ## Trick the ports 'run-autotools-fixup' target to do the right thing. - _OSVERSION=$(sysctl -n kern.osreldate) - REVISION=$(chroot ${CHROOTDIR} make -C /usr/src/release -V REVISION) - BRANCH=$(chroot ${CHROOTDIR} make -C /usr/src/release -V BRANCH) - UNAME_r=${REVISION}-${BRANCH} - if [ -d ${CHROOTDIR}/usr/doc ] && [ -z "${NODOC}" ]; then - PBUILD_FLAGS="OSVERSION=${_OSVERSION} BATCH=yes" - PBUILD_FLAGS="${PBUILD_FLAGS} UNAME_r=${UNAME_r}" - PBUILD_FLAGS="${PBUILD_FLAGS} OSREL=${REVISION}" - chroot ${CHROOTDIR} make -C /usr/ports/textproc/docproj \ - ${PBUILD_FLAGS} OPTIONS_UNSET="FOP IGOR" \ - install clean distclean - fi -fi - -eval chroot ${CHROOTDIR} make -C /usr/src ${RELEASE_WMAKEFLAGS} buildworld -eval chroot ${CHROOTDIR} make -C /usr/src ${RELEASE_KMAKEFLAGS} buildkernel -eval chroot ${CHROOTDIR} make -C /usr/src/release ${RELEASE_RMAKEFLAGS} \ - release -eval chroot ${CHROOTDIR} make -C /usr/src/release ${RELEASE_RMAKEFLAGS} \ - install DESTDIR=/R WITH_COMPRESSED_IMAGES=${WITH_COMPRESSED_IMAGES} \ - WITH_COMPRESSED_VMIMAGES=${WITH_COMPRESSED_VMIMAGES} +main "${@}" Copied: stable/10/release/tools/arm.subr (from r282693, head/release/tools/arm.subr) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/release/tools/arm.subr Wed May 20 19:32:57 2015 (r283161, copy of r282693, head/release/tools/arm.subr) @@ -0,0 +1,137 @@ +#!/bin/sh +#- +# Copyright (c) 2015 The FreeBSD Foundation +# All rights reserved. +# +# Portions of this software were developed by Glen Barber +# 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. +# +# Common subroutines used to build arm/armv6 images. +# +# $FreeBSD$ +# + +cleanup() { + if [ -c "${DESTDIR}/dev/null" ]; then + umount_loop ${DESTDIR}/dev 2>/dev/null + fi + umount_loop ${DESTDIR} + if [ ! -z "${mddev}" ]; then + mdconfig -d -u ${mddev} + fi + + return 0 +} + +umount_loop() { + DIR=$1 + i=0 + sync + while ! umount ${DIR}; do + i=$(( $i + 1 )) + if [ $i -ge 10 ]; then + # This should never happen. But, it has happened. + echo "Cannot umount(8) ${DIR}" + echo "Something has gone horribly wrong." + return 1 + fi + sleep 1 + done + + return 0 +} + +arm_create_disk() { + # Create the target raw file and temporary work directory. + chroot ${CHROOTDIR} gpart create -s ${PART_SCHEME} ${mddev} + chroot ${CHROOTDIR} gpart add -t '!12' -a 63 -s ${FAT_SIZE} ${mddev} + chroot ${CHROOTDIR} gpart set -a active -i 1 ${mddev} + chroot ${CHROOTDIR} newfs_msdos -L msdosboot -F ${FAT_TYPE} /dev/${mddev}s1 + chroot ${CHROOTDIR} gpart add -t freebsd ${mddev} + chroot ${CHROOTDIR} gpart create -s bsd ${mddev}s2 + chroot ${CHROOTDIR} gpart add -t freebsd-ufs -a 64k /dev/${mddev}s2 + chroot ${CHROOTDIR} newfs -U -L rootfs /dev/${mddev}s2a + chroot ${CHROOTDIR} tunefs -j enable -N enable /dev/${mddev}s2a + + return 0 +} + +arm_create_user() { + # Create a default user account 'freebsd' with the password 'freebsd', + # and set the default password for the 'root' user to 'root'. + chroot ${CHROOTDIR} /usr/sbin/pw groupadd freebsd -g 1001 + chroot ${CHROOTDIR} /usr/sbin/pw useradd freebsd \ + -m -M 0755 -w yes -n freebsd -u 1001 -g 1001 -G 0 \ + -c 'FreeBSD User' -d '/home/freebsd' -s '/bin/csh' + chroot ${CHROOTDIR} /usr/sbin/pw usermod root -w yes + + return 0 +} + +arm_install_base() { + chroot ${CHROOTDIR} mount /dev/${mddev}s2a ${DESTDIR} + eval chroot ${CHROOTDIR} make -C ${WORLDDIR} \ + TARGET=${EMBEDDED_TARGET} \ + TARGET_ARCH=${EMBEDDED_TARGET_ARCH} \ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-10@FreeBSD.ORG Thu May 21 01:47:13 2015 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 64717C7D; Thu, 21 May 2015 01:47: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 52088165D; Thu, 21 May 2015 01:47:13 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4L1lDVP045220; Thu, 21 May 2015 01:47:13 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4L1lCwZ045217; Thu, 21 May 2015 01:47:12 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201505210147.t4L1lCwZ045217@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 21 May 2015 01:47:12 +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: r283164 - in stable/10/share: syscons/keymaps vt/keymaps 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.20 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, 21 May 2015 01:47:13 -0000 Author: emaste Date: Thu May 21 01:47:12 2015 New Revision: 283164 URL: https://svnweb.freebsd.org/changeset/base/283164 Log: MFC INDEX.keymaps fixes r282898: Correct UTF-8 encoding in Británico One á was ISO 8859-1 0xE1 instead of UTF-8 0xC3 0xA1. r282902: Correct language code -- "Danish" is English The menu entry "Danish ISO-8859-1 (macbook)" was first added to the syscons(4) INDEX.keymaps in r241851 with no language code, and then in r256367 incorrectly tagged with "da". It is a Danish keyboard map, but the description is in English and therefore must be "en". This error subsequently propagated into the vt(4) INDEX.keymaps. r282905: Restore 'he' language code for Hebrew kbdmap(1) menu title r282914: kbdmap(1): Correct menu title: keyboards have a layout, not a language PR: 146793, 193656 Modified: stable/10/share/syscons/keymaps/INDEX.keymaps stable/10/share/vt/keymaps/INDEX.keymaps Directory Properties: stable/10/ (props changed) Modified: stable/10/share/syscons/keymaps/INDEX.keymaps ============================================================================== --- stable/10/share/syscons/keymaps/INDEX.keymaps Wed May 20 23:15:56 2015 (r283163) +++ stable/10/share/syscons/keymaps/INDEX.keymaps Thu May 21 01:47:12 2015 (r283164) @@ -123,7 +123,7 @@ danish.cp865.kbd:fr:Danois Code page 865 danish.cp865.kbd:pt:Dinamarqus Codepage 865 danish.cp865.kbd:es:Dans Codepage 865 -danish.iso.macbook.kbd:da:Danish ISO-8859-1 (macbook) +danish.iso.macbook.kbd:en:Danish ISO-8859-1 (macbook) danish.iso.macbook.kbd:da:Dansk ISO-8859-1 (macbook) danish.iso.macbook.kbd:de:Dnisch ISO-8859-1 (Macbook) danish.iso.macbook.kbd:fr:Danois ISO-8859-1 (macbook) Modified: stable/10/share/vt/keymaps/INDEX.keymaps ============================================================================== --- stable/10/share/vt/keymaps/INDEX.keymaps Wed May 20 23:15:56 2015 (r283163) +++ stable/10/share/vt/keymaps/INDEX.keymaps Thu May 21 01:47:12 2015 (r283164) @@ -20,15 +20,15 @@ # # Language support: MENU, FONT # -MENU:en:Choose your keyboard language +MENU:en:Choose your keyboard layout MENU:da,no,sv:Vælg dit keyboard layout MENU:de:Wählen Sie Ihre Tastaturbelegung -MENU:fr:Choisissez la nationalité de votre clavier +MENU:fr:Choisissez la disposition de votre clavier MENU:pl:Wybierz układ klawiatury MENU:pt:Escolha o layout do teclado -MENU:es:Seleccione el idioma de su teclado -MENU::ךלש תדלקמה תפש תא רחב -MENU:uk:Bиберіть розкладку клавіатури +MENU:es:Seleccione la disposición de su teclado +MENU:he:ךלש תדלקמה תפש תא רחב +MENU:uk:Оберiть розкладку клавіатури MENU:el:Επιλέξτε το πληκτρολόγιο της κονσόλας MENU:hy:Ընտրեք ստեղնաշարի դասավորությունը @@ -121,7 +121,7 @@ dk.kbd.from-cp865:fr:Danois dk.kbd.from-cp865:pt:Dinamarquês dk.kbd.from-cp865:es:Danés -dk.macbook.kbd:da:Danish (macbook) +dk.macbook.kbd:en:Danish (macbook) dk.macbook.kbd:da:Dansk (macbook) dk.macbook.kbd:de:Dänisch (Macbook) dk.macbook.kbd:fr:Danois (macbook) @@ -517,7 +517,7 @@ uk.capsctrl.kbd:en:United Kingdom (Caps uk.capsctrl.kbd:de:Vereinigtes Königreich (Caps Lock als linke Strg) #uk.iso-ctrl.kbd:fr:Royaume Uni (caps lock acts as Left Ctrl) #uk.iso-ctrl.kbd:pt:Reino Unido (caps lock acts as Left Ctrl) -#uk.iso-ctrl.kbd:es:Britnico (caps lock acts as Left Ctrl) +#uk.iso-ctrl.kbd:es:Británico (caps lock acts as Left Ctrl) uk.dvorak.kbd:en:United Kingdom Dvorak uk.dvorak.kbd:de:Vereinigtes Königreich Dvorak From owner-svn-src-stable-10@FreeBSD.ORG Thu May 21 01:50:07 2015 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9934CEAD; Thu, 21 May 2015 01:50: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 873671689; Thu, 21 May 2015 01:50:07 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4L1o7Q0045736; Thu, 21 May 2015 01:50:07 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4L1o7fr045735; Thu, 21 May 2015 01:50:07 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201505210150.t4L1o7fr045735@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 21 May 2015 01:50: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: r283165 - stable/10/usr.sbin/kbdmap 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.20 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, 21 May 2015 01:50:07 -0000 Author: emaste Date: Thu May 21 01:50:06 2015 New Revision: 283165 URL: https://svnweb.freebsd.org/changeset/base/283165 Log: MFC r282904: kbdmap(1): increase description size to 256 bytes After conversion to UTF-8 some INDEX.keymaps descriptions are longer than the previous limit of 64 bytes. PR: 193656 Modified: stable/10/usr.sbin/kbdmap/kbdmap.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/kbdmap/kbdmap.c ============================================================================== --- stable/10/usr.sbin/kbdmap/kbdmap.c Thu May 21 01:47:12 2015 (r283164) +++ stable/10/usr.sbin/kbdmap/kbdmap.c Thu May 21 01:50:06 2015 (r283165) @@ -571,7 +571,7 @@ menu_read(void) char *p; int mark, num_keymaps, items, i; char buffer[256], filename[PATH_MAX]; - char keym[64], lng[64], desc[64]; + char keym[64], lng[64], desc[256]; char dialect[64], lang_abk[64]; struct keymap *km; struct keymap **km_sorted; @@ -616,7 +616,7 @@ menu_read(void) continue; /* Parse input, removing newline */ - matches = sscanf(p, "%64[^:]:%64[^:]:%64[^:\n]", + matches = sscanf(p, "%64[^:]:%64[^:]:%256[^:\n]", keym, lng, desc); if (matches == 3) { if (strcmp(keym, "FONT") From owner-svn-src-stable-10@FreeBSD.ORG Thu May 21 06:30:45 2015 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.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D885DFDE; Thu, 21 May 2015 06:30:44 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C66911607; Thu, 21 May 2015 06:30:44 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4L6UiZa086827; Thu, 21 May 2015 06:30:44 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4L6UiF9086826; Thu, 21 May 2015 06:30:44 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201505210630.t4L6UiF9086826@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 21 May 2015 06:30: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: r283171 - 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.20 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, 21 May 2015 06:30:45 -0000 Author: hselasky Date: Thu May 21 06:30:44 2015 New Revision: 283171 URL: https://svnweb.freebsd.org/changeset/base/283171 Log: MFC r280495: Implement a simple OID number garbage collector. Given the increasing number of dynamically created and destroyed SYSCTLs during runtime it is very likely that the current new OID number limit of 0x7fffffff can be reached. Especially if dynamic OID creation and destruction results from automatic tests. Additional changes: - Optimize the typical use case by decrementing the next automatic OID sequence number instead of incrementing it. This saves searching time when inserting new OIDs into a fresh parent OID node. - Add simple check for duplicate non-automatic OID numbers. Modified: stable/10/sys/kern/kern_sysctl.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/kern_sysctl.c ============================================================================== --- stable/10/sys/kern/kern_sysctl.c Thu May 21 05:06:08 2015 (r283170) +++ stable/10/sys/kern/kern_sysctl.c Thu May 21 06:30:44 2015 (r283171) @@ -142,6 +142,8 @@ sysctl_register_oid(struct sysctl_oid *o struct sysctl_oid_list *parent = oidp->oid_parent; struct sysctl_oid *p; struct sysctl_oid *q; + int oid_number; + int timeout = 2; /* * First check if another oid with the same name already @@ -158,37 +160,66 @@ sysctl_register_oid(struct sysctl_oid *o return; } } + /* get current OID number */ + oid_number = oidp->oid_number; + +#if (OID_AUTO >= 0) +#error "OID_AUTO is expected to be a negative value" +#endif /* - * If this oid has a number OID_AUTO, give it a number which - * is greater than any current oid. + * Any negative OID number qualifies as OID_AUTO. Valid OID + * numbers should always be positive. + * * NOTE: DO NOT change the starting value here, change it in * , and make sure it is at least 256 to * accomodate e.g. net.inet.raw as a static sysctl node. */ - if (oidp->oid_number == OID_AUTO) { - static int newoid = CTL_AUTO_START; + if (oid_number < 0) { + static int newoid; + + /* + * By decrementing the next OID number we spend less + * time inserting the OIDs into a sorted list. + */ + if (--newoid < CTL_AUTO_START) + newoid = 0x7fffffff; - oidp->oid_number = newoid++; - if (newoid == 0x7fffffff) - panic("out of oids"); - } -#if 0 - else if (oidp->oid_number >= CTL_AUTO_START) { - /* do not panic; this happens when unregistering sysctl sets */ - printf("static sysctl oid too high: %d", oidp->oid_number); + oid_number = newoid; } -#endif /* - * Insert the oid into the parent's list in order. + * Insert the OID into the parent's list sorted by OID number. */ +retry: q = NULL; SLIST_FOREACH(p, parent, oid_link) { - if (oidp->oid_number < p->oid_number) + /* check if the current OID number is in use */ + if (oid_number == p->oid_number) { + /* get the next valid OID number */ + if (oid_number < CTL_AUTO_START || + oid_number == 0x7fffffff) { + /* wraparound - restart */ + oid_number = CTL_AUTO_START; + /* don't loop forever */ + if (!timeout--) + panic("sysctl: Out of OID numbers\n"); + goto retry; + } else { + oid_number++; + } + } else if (oid_number < p->oid_number) break; q = p; } - if (q) + /* check for non-auto OID number collision */ + if (oidp->oid_number >= 0 && oidp->oid_number < CTL_AUTO_START && + oid_number >= CTL_AUTO_START) { + printf("sysctl: OID number(%d) is already in use for '%s'\n", + oidp->oid_number, oidp->oid_name); + } + /* update the OID number, if any */ + oidp->oid_number = oid_number; + if (q != NULL) SLIST_INSERT_AFTER(q, oidp, oid_link); else SLIST_INSERT_HEAD(parent, oidp, oid_link); From owner-svn-src-stable-10@FreeBSD.ORG Thu May 21 06:47:22 2015 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E7BC75E3; Thu, 21 May 2015 06:47:22 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D386E17F6; Thu, 21 May 2015 06:47:22 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4L6lMji094091; Thu, 21 May 2015 06:47:22 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4L6lKKR094082; Thu, 21 May 2015 06:47:20 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201505210647.t4L6lKKR094082@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 21 May 2015 06:47: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: r283173 - in stable/10: share/man/man4 sys/dev/usb sys/dev/usb/quirk 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.20 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, 21 May 2015 06:47:23 -0000 Author: hselasky Date: Thu May 21 06:47:20 2015 New Revision: 283173 URL: https://svnweb.freebsd.org/changeset/base/283173 Log: MFC r282577: Add support for DYMO LabelWriter PnP. Modified: stable/10/share/man/man4/usb_quirk.4 stable/10/sys/dev/usb/quirk/usb_quirk.c stable/10/sys/dev/usb/quirk/usb_quirk.h stable/10/sys/dev/usb/usb_device.c stable/10/sys/dev/usb/usb_msctest.c stable/10/sys/dev/usb/usb_msctest.h stable/10/sys/dev/usb/usbdevs Directory Properties: stable/10/ (props changed) Modified: stable/10/share/man/man4/usb_quirk.4 ============================================================================== --- stable/10/share/man/man4/usb_quirk.4 Thu May 21 06:34:06 2015 (r283172) +++ stable/10/share/man/man4/usb_quirk.4 Thu May 21 06:47:20 2015 (r283173) @@ -16,7 +16,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 21, 2013 +.Dd May 7, 2015 .Dt USB_QUIRK 4 .Os .Sh NAME @@ -170,6 +170,9 @@ ejects after Huawei SCSI command .It UQ_MSC_EJECT_TCT ejects after TCT SCSI command .Dv 0x06f504025270 +.It UQ_MSC_DYMO_EJECT +ejects after HID command +.Dv 0x1b5a01 .El .Pp See Modified: stable/10/sys/dev/usb/quirk/usb_quirk.c ============================================================================== --- stable/10/sys/dev/usb/quirk/usb_quirk.c Thu May 21 06:34:06 2015 (r283172) +++ stable/10/sys/dev/usb/quirk/usb_quirk.c Thu May 21 06:47:20 2015 (r283173) @@ -523,6 +523,9 @@ static struct usb_quirk_entry usb_quirks USB_QUIRK(FEIYA, DUMMY, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE, UQ_MATCH_VENDOR_ONLY), USB_QUIRK(REALTEK, DUMMY, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE, UQ_MATCH_VENDOR_ONLY), USB_QUIRK(INITIO, DUMMY, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE, UQ_MATCH_VENDOR_ONLY), + + /* DYMO LabelManager Pnp */ + USB_QUIRK(DYMO, LABELMANAGERPNP, 0x0000, 0xffff, UQ_MSC_DYMO_EJECT), }; #undef USB_QUIRK_VP #undef USB_QUIRK @@ -592,6 +595,7 @@ static const char *usb_quirk_str[USB_QUI [UQ_BAD_MIDI] = "UQ_BAD_MIDI", [UQ_AU_VENDOR_CLASS] = "UQ_AU_VENDOR_CLASS", [UQ_SINGLE_CMD_MIDI] = "UQ_SINGLE_CMD_MIDI", + [UQ_MSC_DYMO_EJECT] = "UQ_MSC_DYMO_EJECT", }; /*------------------------------------------------------------------------* Modified: stable/10/sys/dev/usb/quirk/usb_quirk.h ============================================================================== --- stable/10/sys/dev/usb/quirk/usb_quirk.h Thu May 21 06:34:06 2015 (r283172) +++ stable/10/sys/dev/usb/quirk/usb_quirk.h Thu May 21 06:47:20 2015 (r283173) @@ -108,6 +108,7 @@ enum { UQ_BAD_MIDI, /* device claims MIDI class, but isn't */ UQ_AU_VENDOR_CLASS, /* audio device uses vendor and not audio class */ UQ_SINGLE_CMD_MIDI, /* at most one command per USB packet */ + UQ_MSC_DYMO_EJECT, /* ejects Dymo MSC device */ USB_QUIRK_MAX }; Modified: stable/10/sys/dev/usb/usb_device.c ============================================================================== --- stable/10/sys/dev/usb/usb_device.c Thu May 21 06:34:06 2015 (r283172) +++ stable/10/sys/dev/usb/usb_device.c Thu May 21 06:47:20 2015 (r283173) @@ -1346,6 +1346,12 @@ usb_probe_and_attach(struct usb_device * */ if (iface_index == USB_IFACE_INDEX_ANY) { + if (usb_test_quirk(&uaa, UQ_MSC_DYMO_EJECT) != 0 && + usb_dymo_eject(udev, 0) == 0) { + /* success, mark the udev as disappearing */ + uaa.dev_state = UAA_DEV_EJECTING; + } + EVENTHANDLER_INVOKE(usb_dev_configured, udev, &uaa); if (uaa.dev_state != UAA_DEV_READY) { Modified: stable/10/sys/dev/usb/usb_msctest.c ============================================================================== --- stable/10/sys/dev/usb/usb_msctest.c Thu May 21 06:34:06 2015 (r283172) +++ stable/10/sys/dev/usb/usb_msctest.c Thu May 21 06:47:20 2015 (r283173) @@ -177,6 +177,7 @@ static usb_callback_t bbb_data_rd_cs_cal static usb_callback_t bbb_data_write_callback; static usb_callback_t bbb_data_wr_cs_callback; static usb_callback_t bbb_status_callback; +static usb_callback_t bbb_raw_write_callback; static void bbb_done(struct bbb_transfer *, int); static void bbb_transfer_start(struct bbb_transfer *, uint8_t); @@ -184,7 +185,7 @@ static void bbb_data_clear_stall_callbac uint8_t); static int bbb_command_start(struct bbb_transfer *, uint8_t, uint8_t, void *, size_t, void *, size_t, usb_timeout_t); -static struct bbb_transfer *bbb_attach(struct usb_device *, uint8_t); +static struct bbb_transfer *bbb_attach(struct usb_device *, uint8_t, uint8_t); static void bbb_detach(struct bbb_transfer *); static const struct usb_config bbb_config[ST_MAX] = { @@ -247,6 +248,19 @@ static const struct usb_config bbb_confi }, }; +static const struct usb_config bbb_raw_config[1] = { + + [0] = { + .type = UE_BULK_INTR, + .endpoint = UE_ADDR_ANY, + .direction = UE_DIR_OUT, + .bufsize = SCSI_MAX_LEN, + .flags = {.ext_buffer = 1,.proxy_buffer = 1,}, + .callback = &bbb_raw_write_callback, + .timeout = 1 * USB_MS_HZ, /* 1 second */ + }, +}; + static void bbb_done(struct bbb_transfer *sc, int error) { @@ -467,6 +481,47 @@ bbb_status_callback(struct usb_xfer *xfe } } +static void +bbb_raw_write_callback(struct usb_xfer *xfer, usb_error_t error) +{ + struct bbb_transfer *sc = usbd_xfer_softc(xfer); + usb_frlength_t max_bulk = usbd_xfer_max_len(xfer); + int actlen, sumlen; + + usbd_xfer_status(xfer, &actlen, &sumlen, NULL, NULL); + + switch (USB_GET_STATE(xfer)) { + case USB_ST_TRANSFERRED: + sc->data_rem -= actlen; + sc->data_ptr += actlen; + sc->actlen += actlen; + + if (actlen < sumlen) { + /* short transfer */ + sc->data_rem = 0; + } + case USB_ST_SETUP: + DPRINTF("max_bulk=%d, data_rem=%d\n", + max_bulk, sc->data_rem); + + if (sc->data_rem == 0) { + bbb_done(sc, 0); + break; + } + if (max_bulk > sc->data_rem) { + max_bulk = sc->data_rem; + } + usbd_xfer_set_timeout(xfer, sc->data_timeout); + usbd_xfer_set_frame_data(xfer, 0, sc->data_ptr, max_bulk); + usbd_transfer_submit(xfer); + break; + + default: /* Error */ + bbb_done(sc, error); + break; + } +} + /*------------------------------------------------------------------------* * bbb_command_start - execute a SCSI command synchronously * @@ -502,13 +557,45 @@ bbb_command_start(struct bbb_transfer *s return (sc->error); } +/*------------------------------------------------------------------------* + * bbb_raw_write - write a raw BULK message synchronously + * + * Return values + * 0: Success + * Else: Failure + *------------------------------------------------------------------------*/ +static int +bbb_raw_write(struct bbb_transfer *sc, const void *data_ptr, size_t data_len, + usb_timeout_t data_timeout) +{ + sc->data_ptr = __DECONST(void *, data_ptr); + sc->data_len = data_len; + sc->data_rem = data_len; + sc->data_timeout = (data_timeout + USB_MS_HZ); + sc->actlen = 0; + sc->error = 0; + + DPRINTFN(1, "BULK DATA = %*D\n", (int)data_len, + (const char *)data_ptr, ":"); + + mtx_lock(&sc->mtx); + usbd_transfer_start(sc->xfer[0]); + while (usbd_transfer_pending(sc->xfer[0])) + cv_wait(&sc->cv, &sc->mtx); + mtx_unlock(&sc->mtx); + return (sc->error); +} + static struct bbb_transfer * -bbb_attach(struct usb_device *udev, uint8_t iface_index) +bbb_attach(struct usb_device *udev, uint8_t iface_index, + uint8_t bInterfaceClass) { struct usb_interface *iface; struct usb_interface_descriptor *id; + const struct usb_config *pconfig; struct bbb_transfer *sc; usb_error_t err; + int nconfig; uint8_t do_unlock; /* Prevent re-enumeration */ @@ -528,22 +615,39 @@ bbb_attach(struct usb_device *udev, uint return (NULL); id = iface->idesc; - if (id == NULL || id->bInterfaceClass != UICLASS_MASS) + if (id == NULL || id->bInterfaceClass != bInterfaceClass) return (NULL); - switch (id->bInterfaceSubClass) { - case UISUBCLASS_SCSI: - case UISUBCLASS_UFI: - case UISUBCLASS_SFF8020I: - case UISUBCLASS_SFF8070I: + switch (id->bInterfaceClass) { + case UICLASS_MASS: + switch (id->bInterfaceSubClass) { + case UISUBCLASS_SCSI: + case UISUBCLASS_UFI: + case UISUBCLASS_SFF8020I: + case UISUBCLASS_SFF8070I: + break; + default: + return (NULL); + } + switch (id->bInterfaceProtocol) { + case UIPROTO_MASS_BBB_OLD: + case UIPROTO_MASS_BBB: + break; + default: + return (NULL); + } + pconfig = bbb_config; + nconfig = ST_MAX; break; - default: - return (NULL); - } - - switch (id->bInterfaceProtocol) { - case UIPROTO_MASS_BBB_OLD: - case UIPROTO_MASS_BBB: + case UICLASS_HID: + switch (id->bInterfaceSubClass) { + case 0: + break; + default: + return (NULL); + } + pconfig = bbb_raw_config; + nconfig = 1; break; default: return (NULL); @@ -553,22 +657,27 @@ bbb_attach(struct usb_device *udev, uint mtx_init(&sc->mtx, "USB autoinstall", NULL, MTX_DEF); cv_init(&sc->cv, "WBBB"); - err = usbd_transfer_setup(udev, &iface_index, sc->xfer, bbb_config, - ST_MAX, sc, &sc->mtx); + err = usbd_transfer_setup(udev, &iface_index, sc->xfer, pconfig, + nconfig, sc, &sc->mtx); if (err) { bbb_detach(sc); return (NULL); } - /* store pointer to DMA buffers */ - sc->buffer = usbd_xfer_get_frame_buffer( - sc->xfer[ST_DATA_RD], 0); - sc->buffer_size = - usbd_xfer_max_len(sc->xfer[ST_DATA_RD]); - sc->cbw = usbd_xfer_get_frame_buffer( - sc->xfer[ST_COMMAND], 0); - sc->csw = usbd_xfer_get_frame_buffer( - sc->xfer[ST_STATUS], 0); - + switch (id->bInterfaceClass) { + case UICLASS_MASS: + /* store pointer to DMA buffers */ + sc->buffer = usbd_xfer_get_frame_buffer( + sc->xfer[ST_DATA_RD], 0); + sc->buffer_size = + usbd_xfer_max_len(sc->xfer[ST_DATA_RD]); + sc->cbw = usbd_xfer_get_frame_buffer( + sc->xfer[ST_COMMAND], 0); + sc->csw = usbd_xfer_get_frame_buffer( + sc->xfer[ST_STATUS], 0); + break; + default: + break; + } return (sc); } @@ -597,7 +706,7 @@ usb_iface_is_cdrom(struct usb_device *ud uint8_t sid_type; int err; - sc = bbb_attach(udev, iface_index); + sc = bbb_attach(udev, iface_index, UICLASS_MASS); if (sc == NULL) return (0); @@ -653,7 +762,7 @@ usb_msc_auto_quirk(struct usb_device *ud uint8_t sid_type; int err; - sc = bbb_attach(udev, iface_index); + sc = bbb_attach(udev, iface_index, UICLASS_MASS); if (sc == NULL) return (0); @@ -822,7 +931,7 @@ usb_msc_eject(struct usb_device *udev, u struct bbb_transfer *sc; usb_error_t err; - sc = bbb_attach(udev, iface_index); + sc = bbb_attach(udev, iface_index, UICLASS_MASS); if (sc == NULL) return (USB_ERR_INVAL); @@ -881,3 +990,19 @@ usb_msc_eject(struct usb_device *udev, u bbb_detach(sc); return (0); } + +usb_error_t +usb_dymo_eject(struct usb_device *udev, uint8_t iface_index) +{ + static const uint8_t data[3] = { 0x1b, 0x5a, 0x01 }; + struct bbb_transfer *sc; + usb_error_t err; + + sc = bbb_attach(udev, iface_index, UICLASS_HID); + if (sc == NULL) + return (USB_ERR_INVAL); + err = bbb_raw_write(sc, data, sizeof(data), USB_MS_HZ); + bbb_detach(sc); + return (err); +} + Modified: stable/10/sys/dev/usb/usb_msctest.h ============================================================================== --- stable/10/sys/dev/usb/usb_msctest.h Thu May 21 06:34:06 2015 (r283172) +++ stable/10/sys/dev/usb/usb_msctest.h Thu May 21 06:47:20 2015 (r283173) @@ -43,5 +43,7 @@ usb_error_t usb_msc_eject(struct usb_dev uint8_t iface_index, int method); usb_error_t usb_msc_auto_quirk(struct usb_device *udev, uint8_t iface_index); +usb_error_t usb_dymo_eject(struct usb_device *udev, + uint8_t iface_index); #endif /* _USB_MSCTEST_H_ */ Modified: stable/10/sys/dev/usb/usbdevs ============================================================================== --- stable/10/sys/dev/usb/usbdevs Thu May 21 06:34:06 2015 (r283172) +++ stable/10/sys/dev/usb/usbdevs Thu May 21 06:47:20 2015 (r283173) @@ -452,6 +452,7 @@ vendor GLOBESPAN 0x0915 Globespan vendor CONCORDCAMERA 0x0919 Concord Camera vendor GARMIN 0x091e Garmin International vendor GOHUBS 0x0921 GoHubs +vendor DYMO 0x0922 DYMO vendor XEROX 0x0924 Xerox vendor BIOMETRIC 0x0929 American Biometric Company vendor TOSHIBA 0x0930 Toshiba @@ -1670,6 +1671,9 @@ product DRESDENELEKTRONIK WIRELESSHANDHE product DRESDENELEKTRONIK DE_RFNODE 0x001c deRFnode product DRESDENELEKTRONIK LEVELSHIFTERSTICKLOWCOST 0x0022 Levelshifter Stick Low Cost +/* DYMO */ +product DYMO LABELMANAGERPNP 0x1001 DYMO LabelManager PnP + /* Dynastream Innovations */ product DYNASTREAM ANTDEVBOARD 0x1003 ANT dev board product DYNASTREAM ANT2USB 0x1004 ANT2USB From owner-svn-src-stable-10@FreeBSD.ORG Thu May 21 06:56:35 2015 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E91C624B; Thu, 21 May 2015 06:56: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D65D11980; Thu, 21 May 2015 06:56:35 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4L6uZsL000165; Thu, 21 May 2015 06:56:35 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4L6uZtE000164; Thu, 21 May 2015 06:56:35 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201505210656.t4L6uZtE000164@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 21 May 2015 06:56: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: r283175 - 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.20 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, 21 May 2015 06:56:36 -0000 Author: hselasky Date: Thu May 21 06:56:35 2015 New Revision: 283175 URL: https://svnweb.freebsd.org/changeset/base/283175 Log: MFC r282817: Apply proper locking when iterating the multicast addresses and add a missing check for NULL from a non-blocking "kzalloc()" function call. Sponsored by: Mellanox Technologies Modified: stable/10/sys/ofed/drivers/net/mlx4/en_netdev.c 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 May 21 06:53:55 2015 (r283174) +++ stable/10/sys/ofed/drivers/net/mlx4/en_netdev.c Thu May 21 06:56:35 2015 (r283175) @@ -650,6 +650,7 @@ static void mlx4_en_cache_mclist(struct struct mlx4_en_mc_list *tmp; struct mlx4_en_priv *priv = netdev_priv(dev); + if_maddr_rlock(dev); TAILQ_FOREACH(ifma, &dev->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; @@ -658,10 +659,13 @@ static void mlx4_en_cache_mclist(struct continue; /* Make sure the list didn't grow. */ tmp = kzalloc(sizeof(struct mlx4_en_mc_list), GFP_ATOMIC); + if (tmp == NULL) + break; memcpy(tmp->addr, LLADDR((struct sockaddr_dl *)ifma->ifma_addr), ETH_ALEN); list_add_tail(&tmp->list, &priv->mc_list); } + if_maddr_runlock(dev); } static void update_mclist_flags(struct mlx4_en_priv *priv, From owner-svn-src-stable-10@FreeBSD.ORG Thu May 21 07:10:50 2015 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1E8AC360; Thu, 21 May 2015 07:10:50 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0C0561B52; Thu, 21 May 2015 07:10:50 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4L7An9d009404; Thu, 21 May 2015 07:10:49 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4L7AnO0009403; Thu, 21 May 2015 07:10:49 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201505210710.t4L7AnO0009403@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 21 May 2015 07:10: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: r283185 - stable/10/sys/dev/sound/usb 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.20 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, 21 May 2015 07:10:50 -0000 Author: hselasky Date: Thu May 21 07:10:49 2015 New Revision: 283185 URL: https://svnweb.freebsd.org/changeset/base/283185 Log: MFC r282652: Ensure the USB audio driver doesn't attach twice on the same USB device by grabbing all the USB audio device interfaces. Modified: stable/10/sys/dev/sound/usb/uaudio.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/sound/usb/uaudio.c ============================================================================== --- stable/10/sys/dev/sound/usb/uaudio.c Thu May 21 07:09:19 2015 (r283184) +++ stable/10/sys/dev/sound/usb/uaudio.c Thu May 21 07:10:49 2015 (r283185) @@ -1574,6 +1574,19 @@ uaudio_chan_fill_info_sub(struct uaudio_ asf1d.v1 = NULL; ed1 = NULL; sed.v1 = NULL; + + /* + * There can only be one USB audio instance + * per USB device. Grab all USB audio + * interfaces on this USB device so that we + * don't attach USB audio twice: + */ + if (alt_index == 0 && curidx != sc->sc_mixer_iface_index && + (id->bInterfaceClass == UICLASS_AUDIO || audio_if != 0 || + midi_if != 0)) { + usbd_set_parent_iface(sc->sc_udev, curidx, + sc->sc_mixer_iface_index); + } } if (audio_if == 0) { @@ -1809,9 +1822,6 @@ uaudio_chan_fill_info_sub(struct uaudio_ chan_alt->iface_index = curidx; chan_alt->iface_alt_index = alt_index; - usbd_set_parent_iface(sc->sc_udev, curidx, - sc->sc_mixer_iface_index); - if (ep_dir == UE_DIR_IN) chan_alt->usb_cfg = uaudio_cfg_record; else From owner-svn-src-stable-10@FreeBSD.ORG Thu May 21 07:34:10 2015 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 27F15856; Thu, 21 May 2015 07:34:10 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 14F831E53; Thu, 21 May 2015 07:34:10 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4L7Y9h8020716; Thu, 21 May 2015 07:34:09 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4L7Y9id020714; Thu, 21 May 2015 07:34:09 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201505210734.t4L7Y9id020714@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 21 May 2015 07:34: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: r283187 - stable/10/sys/dev/vt 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.20 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, 21 May 2015 07:34:10 -0000 Author: hselasky Date: Thu May 21 07:34:08 2015 New Revision: 283187 URL: https://svnweb.freebsd.org/changeset/base/283187 Log: MFC r282645, r282646 and r282730: * Prevent switching to NULL or own window in the "vt_proc_window_switch" function. This fixes an issue where X11 keyboard input can appear stuck. The cause of the problem is a duplicate TTY device window switch IOCTL during boot, which leaves the "vt_switch_timer" running, because the current window is already selected. While at it factor out some NULL checks. * The "SYSCTL_INT()" default value is only used for read only SYSCTLs and is not applicable unless the integer pointer is NULL. Set it to zero to avoid confusion. While at it remove extra semicolon at the end of the "VT_SYSCTL_INT()" macro. * Ensure the result from signed subtraction under modulus does not become negative. PR: 200032 Modified: stable/10/sys/dev/vt/vt.h stable/10/sys/dev/vt/vt_core.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/vt/vt.h ============================================================================== --- stable/10/sys/dev/vt/vt.h Thu May 21 07:23:50 2015 (r283186) +++ stable/10/sys/dev/vt/vt.h Thu May 21 07:34:08 2015 (r283187) @@ -83,10 +83,10 @@ #define ISSIGVALID(sig) ((sig) > 0 && (sig) < NSIG) #define VT_SYSCTL_INT(_name, _default, _descr) \ -static int vt_##_name = _default; \ -SYSCTL_INT(_kern_vt, OID_AUTO, _name, CTLFLAG_RW, &vt_##_name, _default,\ +static int vt_##_name = (_default); \ +SYSCTL_INT(_kern_vt, OID_AUTO, _name, CTLFLAG_RWTUN, &vt_##_name, 0, \ _descr); \ -TUNABLE_INT("kern.vt." #_name, &vt_##_name); +TUNABLE_INT("kern.vt." #_name, &vt_##_name) struct vt_driver; Modified: stable/10/sys/dev/vt/vt_core.c ============================================================================== --- stable/10/sys/dev/vt/vt_core.c Thu May 21 07:23:50 2015 (r283186) +++ stable/10/sys/dev/vt/vt_core.c Thu May 21 07:34:08 2015 (r283187) @@ -448,12 +448,35 @@ vt_proc_window_switch(struct vt_window * struct vt_device *vd; int ret; + /* Prevent switching to NULL */ + if (vw == NULL) { + DPRINTF(30, "%s: Cannot switch: vw is NULL.", __func__); + return (EINVAL); + } vd = vw->vw_device; curvw = vd->vd_curwindow; + /* Check if virtual terminal is locked */ if (curvw->vw_flags & VWF_VTYLOCK) return (EBUSY); + /* Check if switch already in progress */ + if (curvw->vw_flags & VWF_SWWAIT_REL) { + /* Check if switching to same window */ + if (curvw->vw_switch_to == vw) { + DPRINTF(30, "%s: Switch in progress to same vw.", __func__); + return (0); /* success */ + } + DPRINTF(30, "%s: Switch in progress to different vw.", __func__); + return (EBUSY); + } + + /* Avoid switching to already selected window */ + if (vw == curvw) { + DPRINTF(30, "%s: Cannot switch: vw == curvw.", __func__); + return (0); /* success */ + } + /* Ask current process permission to switch away. */ if (curvw->vw_smode.mode == VT_PROCESS) { DPRINTF(30, "%s: VT_PROCESS ", __func__); @@ -661,8 +684,7 @@ vt_scrollmode_kbdevent(struct vt_window if (console == 0) { if (c >= F_SCR && c <= MIN(L_SCR, F_SCR + VT_MAXWINDOWS - 1)) { vw = vd->vd_windows[c - F_SCR]; - if (vw != NULL) - vt_proc_window_switch(vw); + vt_proc_window_switch(vw); return; } VT_LOCK(vd); @@ -747,8 +769,7 @@ vt_processkey(keyboard_t *kbd, struct vt if (c >= F_SCR && c <= MIN(L_SCR, F_SCR + VT_MAXWINDOWS - 1)) { vw = vd->vd_windows[c - F_SCR]; - if (vw != NULL) - vt_proc_window_switch(vw); + vt_proc_window_switch(vw); return (0); } @@ -757,15 +778,13 @@ vt_processkey(keyboard_t *kbd, struct vt /* Switch to next VT. */ c = (vw->vw_number + 1) % VT_MAXWINDOWS; vw = vd->vd_windows[c]; - if (vw != NULL) - vt_proc_window_switch(vw); + vt_proc_window_switch(vw); return (0); case PREV: /* Switch to previous VT. */ - c = (vw->vw_number - 1) % VT_MAXWINDOWS; + c = (vw->vw_number + VT_MAXWINDOWS - 1) % VT_MAXWINDOWS; vw = vd->vd_windows[c]; - if (vw != NULL) - vt_proc_window_switch(vw); + vt_proc_window_switch(vw); return (0); case SLK: { vt_save_kbd_state(vw, kbd); @@ -2702,8 +2721,7 @@ vt_resume(struct vt_device *vd) if (vt_suspendswitch == 0) return; - /* Switch back to saved window */ - if (vd->vd_savedwindow != NULL) - vt_proc_window_switch(vd->vd_savedwindow); + /* Switch back to saved window, if any */ + vt_proc_window_switch(vd->vd_savedwindow); vd->vd_savedwindow = NULL; } From owner-svn-src-stable-10@FreeBSD.ORG Thu May 21 07:41:04 2015 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B3B9AD15; Thu, 21 May 2015 07:41:04 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A11261F67; Thu, 21 May 2015 07:41:04 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4L7f4D7024799; Thu, 21 May 2015 07:41:04 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4L7f47m024773; Thu, 21 May 2015 07:41:04 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201505210741.t4L7f47m024773@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 21 May 2015 07:41:04 +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: r283189 - stable/10/sys/cam/scsi 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.20 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, 21 May 2015 07:41:04 -0000 Author: hselasky Date: Thu May 21 07:41:03 2015 New Revision: 283189 URL: https://svnweb.freebsd.org/changeset/base/283189 Log: MFC r279726: Add DA_Q_NO_RC16 quirk for USB mass storage device. PR: 194062 Modified: stable/10/sys/cam/scsi/scsi_da.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/scsi/scsi_da.c ============================================================================== --- stable/10/sys/cam/scsi/scsi_da.c Thu May 21 07:35:20 2015 (r283188) +++ stable/10/sys/cam/scsi/scsi_da.c Thu May 21 07:41:03 2015 (r283189) @@ -1177,6 +1177,13 @@ static struct da_quirk_entry da_quirk_ta }, { /* + * Hama Innostor USB-Stick + */ + { T_DIRECT, SIP_MEDIA_REMOVABLE, "Innostor", "Innostor*", "*" }, + /*quirks*/DA_Q_NO_RC16 + }, + { + /* * MX-ES USB Drive by Mach Xtreme */ { T_DIRECT, SIP_MEDIA_REMOVABLE, "MX", "MXUB3*", "*"}, From owner-svn-src-stable-10@FreeBSD.ORG Thu May 21 07:48:07 2015 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6D0BB296; Thu, 21 May 2015 07:48: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5A9DE1FD5; Thu, 21 May 2015 07:48:07 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4L7m7Yf026496; Thu, 21 May 2015 07:48:07 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4L7m7eQ026495; Thu, 21 May 2015 07:48:07 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201505210748.t4L7m7eQ026495@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 21 May 2015 07:48: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: r283192 - stable/10/sys/dev/sound/pcm 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.20 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, 21 May 2015 07:48:07 -0000 Author: hselasky Date: Thu May 21 07:48:06 2015 New Revision: 283192 URL: https://svnweb.freebsd.org/changeset/base/283192 Log: MFC r282017: Allow DSP basename cloning to be disabled or enabled at boot and runtime. This is useful when implementing OSS sound stacks in userspace via libcuse for example. Modified: stable/10/sys/dev/sound/pcm/dsp.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/sound/pcm/dsp.c ============================================================================== --- stable/10/sys/dev/sound/pcm/dsp.c Thu May 21 07:46:01 2015 (r283191) +++ stable/10/sys/dev/sound/pcm/dsp.c Thu May 21 07:48:06 2015 (r283192) @@ -48,6 +48,12 @@ SYSCTL_INT(_hw_snd, OID_AUTO, compat_lin &dsp_mmap_allow_prot_exec, 0, "linux mmap compatibility (-1=force disable 0=auto 1=force enable)"); +static int dsp_basename_clone = 1; +SYSCTL_INT(_hw_snd, OID_AUTO, basename_clone, CTLFLAG_RWTUN, + &dsp_basename_clone, 0, + "DSP basename cloning (0: Disable; 1: Enabled)"); +TUNABLE_INT("hw.snd.basename_clone", &dsp_basename_clone); + struct dsp_cdevinfo { struct pcm_channel *rdch, *wrch; struct pcm_channel *volch; @@ -2359,9 +2365,10 @@ dsp_clone(void *arg, devname = devcmp; devhw = dsp_cdevs[i].hw; devcmax = dsp_cdevs[i].max - 1; - if (strcmp(name, devcmp) == 0) - unit = snd_unit; - else if (dsp_stdclone(name, devcmp, devsep, + if (strcmp(name, devcmp) == 0) { + if (dsp_basename_clone != 0) + unit = snd_unit; + } else if (dsp_stdclone(name, devcmp, devsep, dsp_cdevs[i].use_sep, &unit, &cunit) != 0) { unit = -1; cunit = -1; From owner-svn-src-stable-10@FreeBSD.ORG Thu May 21 07:49:46 2015 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.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 059315D8; Thu, 21 May 2015 07:49:46 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E70241FFB; Thu, 21 May 2015 07:49:45 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4L7njQX027044; Thu, 21 May 2015 07:49:45 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4L7njm9027040; Thu, 21 May 2015 07:49:45 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201505210749.t4L7njm9027040@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 21 May 2015 07:49:45 +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: r283193 - 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.20 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, 21 May 2015 07:49:46 -0000 Author: hselasky Date: Thu May 21 07:49:44 2015 New Revision: 283193 URL: https://svnweb.freebsd.org/changeset/base/283193 Log: MFC r282505: Add new USB ID. PR: 199843 Modified: stable/10/sys/dev/usb/serial/uftdi.c stable/10/sys/dev/usb/usbdevs Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/usb/serial/uftdi.c ============================================================================== --- stable/10/sys/dev/usb/serial/uftdi.c Thu May 21 07:48:06 2015 (r283192) +++ stable/10/sys/dev/usb/serial/uftdi.c Thu May 21 07:49:44 2015 (r283193) @@ -497,6 +497,7 @@ static const STRUCT_USB_HOST_ID uftdi_de UFTDI_DEV(FTDI, SCS_DEVICE_5, 0), UFTDI_DEV(FTDI, SCS_DEVICE_6, 0), UFTDI_DEV(FTDI, SCS_DEVICE_7, 0), + UFTDI_DEV(FTDI, SCX8_USB_PHOENIX, 0), UFTDI_DEV(FTDI, SDMUSBQSS, 0), UFTDI_DEV(FTDI, SEMC_DSS20, 0), UFTDI_DEV(FTDI, SERIAL_2232C, UFTDI_JTAG_CHECK_STRING), Modified: stable/10/sys/dev/usb/usbdevs ============================================================================== --- stable/10/sys/dev/usb/usbdevs Thu May 21 07:48:06 2015 (r283192) +++ stable/10/sys/dev/usb/usbdevs Thu May 21 07:49:44 2015 (r283193) @@ -1851,6 +1851,7 @@ product FREECOM HDD 0xfc05 Classic SL H product FSC E5400 0x1009 PrismGT USB 2.0 WLAN /* Future Technology Devices products */ +product FTDI SCX8_USB_PHOENIX 0x5259 SCx8 USB Phoenix interface product FTDI SERIAL_8U100AX 0x8372 8U100AX Serial product FTDI SERIAL_8U232AM 0x6001 8U232AM Serial product FTDI SERIAL_8U232AM4 0x6004 8U232AM Serial From owner-svn-src-stable-10@FreeBSD.ORG Thu May 21 08:28:36 2015 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.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 883C084B; Thu, 21 May 2015 08:28:36 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 75E9216F4; Thu, 21 May 2015 08:28:36 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4L8SaCR046941; Thu, 21 May 2015 08:28:36 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4L8Sa4m046940; Thu, 21 May 2015 08:28:36 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201505210828.t4L8Sa4m046940@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Thu, 21 May 2015 08:28: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: r283198 - 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.20 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, 21 May 2015 08:28:36 -0000 Author: ae Date: Thu May 21 08:28:35 2015 New Revision: 283198 URL: https://svnweb.freebsd.org/changeset/base/283198 Log: MFC r282594: m_dup() is supposed to give a writable copy of an mbuf chain. It uses m_dup_pkthdr(), that uses M_COPYFLAGS mask to copy m_flags field. If original mbuf chain has M_RDONLY flag, its copy also will have it. Reset this flag explicitly. Modified: stable/10/sys/kern/uipc_mbuf.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/uipc_mbuf.c ============================================================================== --- stable/10/sys/kern/uipc_mbuf.c Thu May 21 08:26:24 2015 (r283197) +++ stable/10/sys/kern/uipc_mbuf.c Thu May 21 08:28:35 2015 (r283198) @@ -934,6 +934,7 @@ m_dup(struct mbuf *m, int how) } if ((n->m_flags & M_EXT) == 0) nsize = MHLEN; + n->m_flags &= ~M_RDONLY; } n->m_len = 0; From owner-svn-src-stable-10@FreeBSD.ORG Thu May 21 08:55:07 2015 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C679F5B4; Thu, 21 May 2015 08:55: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B44B61AFE; Thu, 21 May 2015 08:55:07 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4L8t7fL061557; Thu, 21 May 2015 08:55:07 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4L8t7hw061556; Thu, 21 May 2015 08:55:07 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201505210855.t4L8t7hw061556@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Thu, 21 May 2015 08:55: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: r283202 - stable/10/sys/dev/sfxge 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.20 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, 21 May 2015 08:55:07 -0000 Author: arybchik Date: Thu May 21 08:55:06 2015 New Revision: 283202 URL: https://svnweb.freebsd.org/changeset/base/283202 Log: MFC: r282897 sfxge: add missing const qualifier to sfxge_link_mode Sponsored by: Solarflare Communications, Inc. Modified: stable/10/sys/dev/sfxge/sfxge_port.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/sfxge/sfxge_port.c ============================================================================== --- stable/10/sys/dev/sfxge/sfxge_port.c Thu May 21 08:38:25 2015 (r283201) +++ stable/10/sys/dev/sfxge/sfxge_port.c Thu May 21 08:55:06 2015 (r283202) @@ -624,7 +624,7 @@ fail: return (rc); } -static int sfxge_link_mode[EFX_PHY_MEDIA_NTYPES][EFX_LINK_NMODES] = { +static const int sfxge_link_mode[EFX_PHY_MEDIA_NTYPES][EFX_LINK_NMODES] = { [EFX_PHY_MEDIA_CX4] = { [EFX_LINK_10000FDX] = IFM_ETHER | IFM_FDX | IFM_10G_CX4, }, From owner-svn-src-stable-10@FreeBSD.ORG Thu May 21 08:59:04 2015 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id F3F5F774; Thu, 21 May 2015 08:59:03 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E23D71B32; Thu, 21 May 2015 08:59:03 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4L8x363062092; Thu, 21 May 2015 08:59:03 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4L8x33W062091; Thu, 21 May 2015 08:59:03 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201505210859.t4L8x33W062091@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Thu, 21 May 2015 08:59:03 +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: r283203 - stable/10/sys/dev/sfxge 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.20 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, 21 May 2015 08:59:04 -0000 Author: arybchik Date: Thu May 21 08:59:03 2015 New Revision: 283203 URL: https://svnweb.freebsd.org/changeset/base/283203 Log: MFC: r282899 sfxge: add local variable with Rx descriptor flags Sponsored by: Solarflare Communications, Inc. Modified: stable/10/sys/dev/sfxge/sfxge_rx.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/sfxge/sfxge_rx.c ============================================================================== --- stable/10/sys/dev/sfxge/sfxge_rx.c Thu May 21 08:55:06 2015 (r283202) +++ stable/10/sys/dev/sfxge/sfxge_rx.c Thu May 21 08:59:03 2015 (r283203) @@ -322,16 +322,17 @@ static void sfxge_rx_deliver(struct sfxge_softc *sc, struct sfxge_rx_sw_desc *rx_desc) { struct mbuf *m = rx_desc->mbuf; + int flags = rx_desc->flags; int csum_flags; /* Convert checksum flags */ - csum_flags = (rx_desc->flags & EFX_CKSUM_IPV4) ? + csum_flags = (flags & EFX_CKSUM_IPV4) ? (CSUM_IP_CHECKED | CSUM_IP_VALID) : 0; - if (rx_desc->flags & EFX_CKSUM_TCPUDP) + if (flags & EFX_CKSUM_TCPUDP) csum_flags |= CSUM_DATA_VALID | CSUM_PSEUDO_HDR; /* The hash covers a 4-tuple for TCP only */ - if (rx_desc->flags & EFX_PKT_TCP) { + if (flags & EFX_PKT_TCP) { m->m_pkthdr.flowid = EFX_RX_HASH_VALUE(EFX_RX_HASHALG_TOEPLITZ, mtod(m, uint8_t *)); M_HASHTYPE_SET(m, M_HASHTYPE_OPAQUE); From owner-svn-src-stable-10@FreeBSD.ORG Thu May 21 09:00:46 2015 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 45FB4A3A; Thu, 21 May 2015 09:00:46 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 349AF1B6C; Thu, 21 May 2015 09:00:46 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4L90krA065575; Thu, 21 May 2015 09:00:46 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4L90kjr065574; Thu, 21 May 2015 09:00:46 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201505210900.t4L90kjr065574@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Thu, 21 May 2015 09:00:46 +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: r283204 - stable/10/sys/dev/sfxge 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.20 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, 21 May 2015 09:00:46 -0000 Author: arybchik Date: Thu May 21 09:00:45 2015 New Revision: 283204 URL: https://svnweb.freebsd.org/changeset/base/283204 Log: MFC: r282900 sfxge: IPv4 Tx checksum offload may be disabled in fact Split IFCAP_HWCSUM to IFCAP_RXCSUM and IFCAP_TXCSUM to highlight Tx and Rx. Sponsored by: Solarflare Communications, Inc. Modified: stable/10/sys/dev/sfxge/sfxge.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/sfxge/sfxge.c ============================================================================== --- stable/10/sys/dev/sfxge/sfxge.c Thu May 21 08:59:03 2015 (r283203) +++ stable/10/sys/dev/sfxge/sfxge.c Thu May 21 09:00:45 2015 (r283204) @@ -58,12 +58,12 @@ __FBSDID("$FreeBSD$"); #include "sfxge_rx.h" #include "sfxge_version.h" -#define SFXGE_CAP (IFCAP_VLAN_MTU | \ - IFCAP_HWCSUM | IFCAP_VLAN_HWCSUM | IFCAP_TSO | \ +#define SFXGE_CAP (IFCAP_VLAN_MTU | IFCAP_VLAN_HWCSUM | \ + IFCAP_RXCSUM | IFCAP_TXCSUM | IFCAP_TSO | \ IFCAP_JUMBO_MTU | IFCAP_LRO | \ IFCAP_VLAN_HWTSO | IFCAP_LINKSTATE) #define SFXGE_CAP_ENABLE SFXGE_CAP -#define SFXGE_CAP_FIXED (IFCAP_VLAN_MTU | IFCAP_HWCSUM | IFCAP_VLAN_HWCSUM | \ +#define SFXGE_CAP_FIXED (IFCAP_VLAN_MTU | IFCAP_RXCSUM | IFCAP_VLAN_HWCSUM | \ IFCAP_JUMBO_MTU | IFCAP_LINKSTATE) MALLOC_DEFINE(M_SFXGE, "sfxge", "Solarflare 10GigE driver"); From owner-svn-src-stable-10@FreeBSD.ORG Thu May 21 09:03:19 2015 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6D7CFBB1; Thu, 21 May 2015 09:03: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 41D5C1C3E; Thu, 21 May 2015 09:03:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4L93Jm6066464; Thu, 21 May 2015 09:03:19 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4L93Ivw066462; Thu, 21 May 2015 09:03:18 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201505210903.t4L93Ivw066462@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Thu, 21 May 2015 09:03: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: r283205 - stable/10/sys/dev/sfxge 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.20 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, 21 May 2015 09:03:19 -0000 Author: arybchik Date: Thu May 21 09:03:18 2015 New Revision: 283205 URL: https://svnweb.freebsd.org/changeset/base/283205 Log: MFC: r282903 sfxge: advertise IPv6 Rx and Tx checksum offload support Tx checksum offload may be enabled/disabled. Sponsored by: Solarflare Communications, Inc. Modified: stable/10/sys/dev/sfxge/sfxge.c stable/10/sys/dev/sfxge/sfxge_tx.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/sfxge/sfxge.c ============================================================================== --- stable/10/sys/dev/sfxge/sfxge.c Thu May 21 09:00:45 2015 (r283204) +++ stable/10/sys/dev/sfxge/sfxge.c Thu May 21 09:03:18 2015 (r283205) @@ -60,10 +60,12 @@ __FBSDID("$FreeBSD$"); #define SFXGE_CAP (IFCAP_VLAN_MTU | IFCAP_VLAN_HWCSUM | \ IFCAP_RXCSUM | IFCAP_TXCSUM | IFCAP_TSO | \ + IFCAP_RXCSUM_IPV6 | IFCAP_TXCSUM_IPV6 | \ IFCAP_JUMBO_MTU | IFCAP_LRO | \ IFCAP_VLAN_HWTSO | IFCAP_LINKSTATE) #define SFXGE_CAP_ENABLE SFXGE_CAP #define SFXGE_CAP_FIXED (IFCAP_VLAN_MTU | IFCAP_RXCSUM | IFCAP_VLAN_HWCSUM | \ + IFCAP_RXCSUM_IPV6 | \ IFCAP_JUMBO_MTU | IFCAP_LINKSTATE) MALLOC_DEFINE(M_SFXGE, "sfxge", "Solarflare 10GigE driver"); @@ -275,6 +277,10 @@ sfxge_if_ioctl(struct ifnet *ifp, unsign ifp->if_hwassist |= (CSUM_IP | CSUM_TCP | CSUM_UDP); else ifp->if_hwassist &= ~(CSUM_IP | CSUM_TCP | CSUM_UDP); + if (ifp->if_capenable & IFCAP_TXCSUM_IPV6) + ifp->if_hwassist |= (CSUM_TCP_IPV6 | CSUM_UDP_IPV6); + else + ifp->if_hwassist &= ~(CSUM_TCP_IPV6 | CSUM_UDP_IPV6); if (ifp->if_capenable & IFCAP_TSO) ifp->if_hwassist |= CSUM_TSO; else @@ -325,7 +331,8 @@ sfxge_ifnet_init(struct ifnet *ifp, stru ifp->if_capabilities = SFXGE_CAP; ifp->if_capenable = SFXGE_CAP_ENABLE; - ifp->if_hwassist = CSUM_TCP | CSUM_UDP | CSUM_IP | CSUM_TSO; + ifp->if_hwassist = CSUM_TCP | CSUM_UDP | CSUM_IP | CSUM_TSO | + CSUM_TCP_IPV6 | CSUM_UDP_IPV6; ether_ifattach(ifp, encp->enc_mac_addr); Modified: stable/10/sys/dev/sfxge/sfxge_tx.c ============================================================================== --- stable/10/sys/dev/sfxge/sfxge_tx.c Thu May 21 09:00:45 2015 (r283204) +++ stable/10/sys/dev/sfxge/sfxge_tx.c Thu May 21 09:03:18 2015 (r283205) @@ -699,7 +699,8 @@ sfxge_if_transmit(struct ifnet *ifp, str ("interface not up")); /* Pick the desired transmit queue. */ - if (m->m_pkthdr.csum_flags & (CSUM_DELAY_DATA | CSUM_TSO)) { + if (m->m_pkthdr.csum_flags & + (CSUM_DELAY_DATA | CSUM_TCP_IPV6 | CSUM_UDP_IPV6 | CSUM_TSO)) { int index = 0; /* check if flowid is set */ From owner-svn-src-stable-10@FreeBSD.ORG Thu May 21 09:05:14 2015 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id AE0ABD1E; Thu, 21 May 2015 09:05:14 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 81FB11C54; Thu, 21 May 2015 09:05:14 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4L95EFg066804; Thu, 21 May 2015 09:05:14 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4L95Eiq066803; Thu, 21 May 2015 09:05:14 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201505210905.t4L95Eiq066803@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Thu, 21 May 2015 09:05:14 +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: r283206 - stable/10/sys/dev/sfxge 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.20 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, 21 May 2015 09:05:14 -0000 Author: arybchik Date: Thu May 21 09:05:13 2015 New Revision: 283206 URL: https://svnweb.freebsd.org/changeset/base/283206 Log: MFC: r282940 sfxge: LRO may be done only if checksums are OK Also it is cheaper to check Rx descriptor flags than TCP protocol in IP header. Sponsored by: Solarflare Communications, Inc. Modified: stable/10/sys/dev/sfxge/sfxge_rx.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/sfxge/sfxge_rx.c ============================================================================== --- stable/10/sys/dev/sfxge/sfxge_rx.c Thu May 21 09:03:18 2015 (r283205) +++ stable/10/sys/dev/sfxge/sfxge_rx.c Thu May 21 09:05:13 2015 (r283206) @@ -681,15 +681,18 @@ sfxge_lro(struct sfxge_rxq *rxq, struct */ if (l3_proto == htons(ETHERTYPE_IP)) { struct ip *iph = nh; - if ((iph->ip_p - IPPROTO_TCP) | - (iph->ip_hl - (sizeof(*iph) >> 2u)) | + + KASSERT(iph->ip_p == IPPROTO_TCP, + ("IPv4 protocol is not TCP, but packet marker is set")); + if ((iph->ip_hl - (sizeof(*iph) >> 2u)) | (iph->ip_off & htons(IP_MF | IP_OFFMASK))) goto deliver_now; th = (struct tcphdr *)(iph + 1); } else if (l3_proto == htons(ETHERTYPE_IPV6)) { struct ip6_hdr *iph = nh; - if (iph->ip6_nxt != IPPROTO_TCP) - goto deliver_now; + + KASSERT(iph->ip6_nxt == IPPROTO_TCP, + ("IPv6 next header is not TCP, but packet marker is set")); l2_id |= SFXGE_LRO_L2_ID_IPV6; th = (struct tcphdr *)(iph + 1); } else { @@ -834,7 +837,9 @@ sfxge_rx_qcomplete(struct sfxge_rxq *rxq /* Pass packet up the stack or into LRO (pipelined) */ if (prev != NULL) { - if (lro_enabled) + if (lro_enabled && + ((prev->flags & (EFX_PKT_TCP | EFX_CKSUM_TCPUDP)) == + (EFX_PKT_TCP | EFX_CKSUM_TCPUDP))) sfxge_lro(rxq, prev); else sfxge_rx_deliver(sc, prev); @@ -853,7 +858,9 @@ discard: /* Pass last packet up the stack or into LRO */ if (prev != NULL) { - if (lro_enabled) + if (lro_enabled && + ((prev->flags & (EFX_PKT_TCP | EFX_CKSUM_TCPUDP)) == + (EFX_PKT_TCP | EFX_CKSUM_TCPUDP))) sfxge_lro(rxq, prev); else sfxge_rx_deliver(sc, prev); From owner-svn-src-stable-10@FreeBSD.ORG Thu May 21 09:06:42 2015 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.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A738EEB6; Thu, 21 May 2015 09:06: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 94D941C6A; Thu, 21 May 2015 09:06:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4L96gOq067049; Thu, 21 May 2015 09:06:42 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4L96gWE067048; Thu, 21 May 2015 09:06:42 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201505210906.t4L96gWE067048@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Thu, 21 May 2015 09:06:42 +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: r283207 - stable/10/sys/dev/sfxge 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.20 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, 21 May 2015 09:06:42 -0000 Author: arybchik Date: Thu May 21 09:06:41 2015 New Revision: 283207 URL: https://svnweb.freebsd.org/changeset/base/283207 Log: MFC: r282941 sfxge: do not change CSUM_TSO when IFCAP_TSOx is changed It is simply not required since the kernel checks corresponding IFCAP_TSOx capability and CSUM_TSO in hw-assisted offloads. Note that CSUM_TSO is two bits (CSUM_IP_TSO|CSUM_IP6_TSO) and both bits are set in IPv4 and IPv6 mbufs. Sponsored by: Solarflare Communications, Inc. Modified: stable/10/sys/dev/sfxge/sfxge.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/sfxge/sfxge.c ============================================================================== --- stable/10/sys/dev/sfxge/sfxge.c Thu May 21 09:05:13 2015 (r283206) +++ stable/10/sys/dev/sfxge/sfxge.c Thu May 21 09:06:41 2015 (r283207) @@ -281,10 +281,14 @@ sfxge_if_ioctl(struct ifnet *ifp, unsign ifp->if_hwassist |= (CSUM_TCP_IPV6 | CSUM_UDP_IPV6); else ifp->if_hwassist &= ~(CSUM_TCP_IPV6 | CSUM_UDP_IPV6); - if (ifp->if_capenable & IFCAP_TSO) - ifp->if_hwassist |= CSUM_TSO; - else - ifp->if_hwassist &= ~CSUM_TSO; + + /* + * The kernel takes both IFCAP_TSOx and CSUM_TSO into + * account before using TSO. So, we do not touch + * checksum flags when IFCAP_TSOx is modified. + * Note that CSUM_TSO is (CSUM_IP_TSO|CSUM_IP6_TSO), + * but both bits are set in IPv4 and IPv6 mbufs. + */ SFXGE_ADAPTER_UNLOCK(sc); break; From owner-svn-src-stable-10@FreeBSD.ORG Thu May 21 09:08:12 2015 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.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DC90C10E; Thu, 21 May 2015 09:08:11 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BEEF71C93; Thu, 21 May 2015 09:08:11 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4L98BH6067314; Thu, 21 May 2015 09:08:11 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4L98BP6067311; Thu, 21 May 2015 09:08:11 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201505210908.t4L98BP6067311@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Thu, 21 May 2015 09:08: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: r283208 - stable/10/sys/dev/sfxge 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.20 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, 21 May 2015 09:08:12 -0000 Author: arybchik Date: Thu May 21 09:08:10 2015 New Revision: 283208 URL: https://svnweb.freebsd.org/changeset/base/283208 Log: MFC: r282942 sfxge: split sfxge_tx_qdpl_put() into *_locked() and *_unlocked() It simplifies understanding of the sfxge_tx_packet_add() logic and avoids passing of 'locked' to called function. Sponsored by: Solarflare Communications, Inc. Modified: stable/10/sys/dev/sfxge/sfxge_tx.c stable/10/sys/dev/sfxge/sfxge_tx.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/sfxge/sfxge_tx.c ============================================================================== --- stable/10/sys/dev/sfxge/sfxge_tx.c Thu May 21 09:06:41 2015 (r283207) +++ stable/10/sys/dev/sfxge/sfxge_tx.c Thu May 21 09:08:10 2015 (r283208) @@ -521,18 +521,10 @@ sfxge_tx_qdpl_service(struct sfxge_txq * } /* - * Put a packet on the deferred packet list. - * - * If we are called with the txq lock held, we put the packet on the "get - * list", otherwise we atomically push it on the "put list". The swizzle - * function takes care of ordering. - * - * The length of the put list is bounded by SFXGE_TX_MAX_DEFERRED. We - * overload the csum_data field in the mbuf to keep track of this length - * because there is no cheap alternative to avoid races. + * Put a packet on the deferred packet get-list. */ static int -sfxge_tx_qdpl_put(struct sfxge_txq *txq, struct mbuf *mbuf, int locked) +sfxge_tx_qdpl_put_locked(struct sfxge_txq *txq, struct mbuf *mbuf) { struct sfxge_tx_dpl *stdp; @@ -540,52 +532,66 @@ sfxge_tx_qdpl_put(struct sfxge_txq *txq, KASSERT(mbuf->m_nextpkt == NULL, ("mbuf->m_nextpkt != NULL")); - if (locked) { - SFXGE_TXQ_LOCK_ASSERT_OWNED(txq); - - sfxge_tx_qdpl_swizzle(txq); + SFXGE_TXQ_LOCK_ASSERT_OWNED(txq); - if (stdp->std_get_count >= stdp->std_get_max) { - txq->get_overflow++; + if (stdp->std_get_count >= stdp->std_get_max) { + txq->get_overflow++; + return (ENOBUFS); + } + if (sfxge_is_mbuf_non_tcp(mbuf)) { + if (stdp->std_get_non_tcp_count >= + stdp->std_get_non_tcp_max) { + txq->get_non_tcp_overflow++; return (ENOBUFS); } - if (sfxge_is_mbuf_non_tcp(mbuf)) { - if (stdp->std_get_non_tcp_count >= - stdp->std_get_non_tcp_max) { - txq->get_non_tcp_overflow++; - return (ENOBUFS); - } - stdp->std_get_non_tcp_count++; - } - - *(stdp->std_getp) = mbuf; - stdp->std_getp = &mbuf->m_nextpkt; - stdp->std_get_count++; - } else { - volatile uintptr_t *putp; - uintptr_t old; - uintptr_t new; - unsigned old_len; - - putp = &stdp->std_put; - new = (uintptr_t)mbuf; - - do { - old = *putp; - if (old != 0) { - struct mbuf *mp = (struct mbuf *)old; - old_len = mp->m_pkthdr.csum_data; - } else - old_len = 0; - if (old_len >= stdp->std_put_max) { - atomic_add_long(&txq->put_overflow, 1); - return (ENOBUFS); - } - mbuf->m_pkthdr.csum_data = old_len + 1; - mbuf->m_nextpkt = (void *)old; - } while (atomic_cmpset_ptr(putp, old, new) == 0); + stdp->std_get_non_tcp_count++; } + *(stdp->std_getp) = mbuf; + stdp->std_getp = &mbuf->m_nextpkt; + stdp->std_get_count++; + + return (0); +} + +/* + * Put a packet on the deferred packet put-list. + * + * We overload the csum_data field in the mbuf to keep track of this length + * because there is no cheap alternative to avoid races. + */ +static int +sfxge_tx_qdpl_put_unlocked(struct sfxge_txq *txq, struct mbuf *mbuf) +{ + struct sfxge_tx_dpl *stdp; + volatile uintptr_t *putp; + uintptr_t old; + uintptr_t new; + unsigned old_len; + + KASSERT(mbuf->m_nextpkt == NULL, ("mbuf->m_nextpkt != NULL")); + + SFXGE_TXQ_LOCK_ASSERT_NOTOWNED(txq); + + stdp = &txq->dpl; + putp = &stdp->std_put; + new = (uintptr_t)mbuf; + + do { + old = *putp; + if (old != 0) { + struct mbuf *mp = (struct mbuf *)old; + old_len = mp->m_pkthdr.csum_data; + } else + old_len = 0; + if (old_len >= stdp->std_put_max) { + atomic_add_long(&txq->put_overflow, 1); + return (ENOBUFS); + } + mbuf->m_pkthdr.csum_data = old_len + 1; + mbuf->m_nextpkt = (void *)old; + } while (atomic_cmpset_ptr(putp, old, new) == 0); + return (0); } @@ -612,22 +618,29 @@ sfxge_tx_packet_add(struct sfxge_txq *tx */ locked = SFXGE_TXQ_TRYLOCK(txq); - if (sfxge_tx_qdpl_put(txq, m, locked) != 0) { - if (locked) + if (locked) { + /* First swizzle put-list to get-list to keep order */ + sfxge_tx_qdpl_swizzle(txq); + + rc = sfxge_tx_qdpl_put_locked(txq, m); + if (rc != 0) { SFXGE_TXQ_UNLOCK(txq); - rc = ENOBUFS; - goto fail; - } + goto fail; + } + } else { + rc = sfxge_tx_qdpl_put_unlocked(txq, m); + if (rc != 0) + goto fail; - /* - * Try to grab the lock again. - * - * If we are able to get the lock, we need to process the deferred - * packet list. If we are not able to get the lock, another thread - * is processing the list. - */ - if (!locked) + /* + * Try to grab the lock again. + * + * If we are able to get the lock, we need to process + * the deferred packet list. If we are not able to get + * the lock, another thread is processing the list. + */ locked = SFXGE_TXQ_TRYLOCK(txq); + } if (locked) { /* Try to service the list. */ Modified: stable/10/sys/dev/sfxge/sfxge_tx.h ============================================================================== --- stable/10/sys/dev/sfxge/sfxge_tx.h Thu May 21 09:06:41 2015 (r283207) +++ stable/10/sys/dev/sfxge/sfxge_tx.h Thu May 21 09:08:10 2015 (r283208) @@ -148,6 +148,8 @@ enum sfxge_txq_type { mtx_unlock(&(_txq)->lock) #define SFXGE_TXQ_LOCK_ASSERT_OWNED(_txq) \ mtx_assert(&(_txq)->lock, MA_OWNED) +#define SFXGE_TXQ_LOCK_ASSERT_NOTOWNED(_txq) \ + mtx_assert(&(_txq)->lock, MA_NOTOWNED) struct sfxge_txq { From owner-svn-src-stable-10@FreeBSD.ORG Thu May 21 09:09:53 2015 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id EA73C26F; Thu, 21 May 2015 09:09: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CBDB91CAA; Thu, 21 May 2015 09:09:52 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4L99qBp067584; Thu, 21 May 2015 09:09:52 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4L99qdK067582; Thu, 21 May 2015 09:09:52 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201505210909.t4L99qdK067582@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Thu, 21 May 2015 09:09: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: r283209 - stable/10/sys/dev/sfxge 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.20 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, 21 May 2015 09:09:53 -0000 Author: arybchik Date: Thu May 21 09:09:51 2015 New Revision: 283209 URL: https://svnweb.freebsd.org/changeset/base/283209 Log: MFC: r282996 sfxge: support Rx checksum offloads disabling We can't disable it in HW, but we can ignore result. Discard Rx descriptor checksum flags if Rx checksum offload is off. Sponsored by: Solarflare Communications, Inc. Modified: stable/10/sys/dev/sfxge/sfxge.c stable/10/sys/dev/sfxge/sfxge_rx.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/sfxge/sfxge.c ============================================================================== --- stable/10/sys/dev/sfxge/sfxge.c Thu May 21 09:08:10 2015 (r283208) +++ stable/10/sys/dev/sfxge/sfxge.c Thu May 21 09:09:51 2015 (r283209) @@ -64,8 +64,7 @@ __FBSDID("$FreeBSD$"); IFCAP_JUMBO_MTU | IFCAP_LRO | \ IFCAP_VLAN_HWTSO | IFCAP_LINKSTATE) #define SFXGE_CAP_ENABLE SFXGE_CAP -#define SFXGE_CAP_FIXED (IFCAP_VLAN_MTU | IFCAP_RXCSUM | IFCAP_VLAN_HWCSUM | \ - IFCAP_RXCSUM_IPV6 | \ +#define SFXGE_CAP_FIXED (IFCAP_VLAN_MTU | IFCAP_VLAN_HWCSUM | \ IFCAP_JUMBO_MTU | IFCAP_LINKSTATE) MALLOC_DEFINE(M_SFXGE, "sfxge", "Solarflare 10GigE driver"); Modified: stable/10/sys/dev/sfxge/sfxge_rx.c ============================================================================== --- stable/10/sys/dev/sfxge/sfxge_rx.c Thu May 21 09:08:10 2015 (r283208) +++ stable/10/sys/dev/sfxge/sfxge_rx.c Thu May 21 09:09:51 2015 (r283209) @@ -788,7 +788,8 @@ void sfxge_rx_qcomplete(struct sfxge_rxq *rxq, boolean_t eop) { struct sfxge_softc *sc = rxq->sc; - int lro_enabled = sc->ifnet->if_capenable & IFCAP_LRO; + int if_capenable = sc->ifnet->if_capenable; + int lro_enabled = if_capenable & IFCAP_LRO; unsigned int index; struct sfxge_evq *evq; unsigned int completed; @@ -818,21 +819,37 @@ sfxge_rx_qcomplete(struct sfxge_rxq *rxq prefetch_read_many(mtod(m, caddr_t)); - /* Check for loopback packets */ - if (!(rx_desc->flags & EFX_PKT_IPV4) && - !(rx_desc->flags & EFX_PKT_IPV6)) { - struct ether_header *etherhp; - - /*LINTED*/ - etherhp = mtod(m, struct ether_header *); - - if (etherhp->ether_type == - htons(SFXGE_ETHERTYPE_LOOPBACK)) { - EFSYS_PROBE(loopback); - - rxq->loopback++; - goto discard; + switch (rx_desc->flags & (EFX_PKT_IPV4 | EFX_PKT_IPV6)) { + case EFX_PKT_IPV4: + if (~if_capenable & IFCAP_RXCSUM) + rx_desc->flags &= + ~(EFX_CKSUM_IPV4 | EFX_CKSUM_TCPUDP); + break; + case EFX_PKT_IPV6: + if (~if_capenable & IFCAP_RXCSUM_IPV6) + rx_desc->flags &= ~EFX_CKSUM_TCPUDP; + break; + case 0: + /* Check for loopback packets */ + { + struct ether_header *etherhp; + + /*LINTED*/ + etherhp = mtod(m, struct ether_header *); + + if (etherhp->ether_type == + htons(SFXGE_ETHERTYPE_LOOPBACK)) { + EFSYS_PROBE(loopback); + + rxq->loopback++; + goto discard; + } } + break; + default: + KASSERT(B_FALSE, + ("Rx descriptor with both IPv4 and IPv6 flags")); + goto discard; } /* Pass packet up the stack or into LRO (pipelined) */ From owner-svn-src-stable-10@FreeBSD.ORG Thu May 21 09:11:04 2015 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9376D3C6; Thu, 21 May 2015 09:11:04 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 681781CBC; Thu, 21 May 2015 09:11:04 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4L9B4qs071446; Thu, 21 May 2015 09:11:04 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4L9B43P071445; Thu, 21 May 2015 09:11:04 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201505210911.t4L9B43P071445@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Thu, 21 May 2015 09:11:04 +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: r283210 - stable/10/sys/dev/sfxge 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.20 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, 21 May 2015 09:11:04 -0000 Author: arybchik Date: Thu May 21 09:11:03 2015 New Revision: 283210 URL: https://svnweb.freebsd.org/changeset/base/283210 Log: MFC: r282997 sfxge: get rid of locked variable in sfxge_tx_packet_add() Now each branch has one and only one possible TxQ lock state. It simplifies understanding of the code. Sponsored by: Solarflare Communications, Inc. Modified: stable/10/sys/dev/sfxge/sfxge_tx.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/sfxge/sfxge_tx.c ============================================================================== --- stable/10/sys/dev/sfxge/sfxge_tx.c Thu May 21 09:09:51 2015 (r283209) +++ stable/10/sys/dev/sfxge/sfxge_tx.c Thu May 21 09:11:03 2015 (r283210) @@ -602,7 +602,6 @@ sfxge_tx_qdpl_put_unlocked(struct sfxge_ int sfxge_tx_packet_add(struct sfxge_txq *txq, struct mbuf *m) { - int locked; int rc; if (!SFXGE_LINK_UP(txq->sc)) { @@ -616,9 +615,7 @@ sfxge_tx_packet_add(struct sfxge_txq *tx * the packet will be appended to the "get list" of the deferred * packet list. Otherwise, it will be pushed on the "put list". */ - locked = SFXGE_TXQ_TRYLOCK(txq); - - if (locked) { + if (SFXGE_TXQ_TRYLOCK(txq)) { /* First swizzle put-list to get-list to keep order */ sfxge_tx_qdpl_swizzle(txq); @@ -627,6 +624,10 @@ sfxge_tx_packet_add(struct sfxge_txq *tx SFXGE_TXQ_UNLOCK(txq); goto fail; } + + /* Try to service the list. */ + sfxge_tx_qdpl_service(txq); + /* Lock has been dropped. */ } else { rc = sfxge_tx_qdpl_put_unlocked(txq, m); if (rc != 0) @@ -639,14 +640,13 @@ sfxge_tx_packet_add(struct sfxge_txq *tx * the deferred packet list. If we are not able to get * the lock, another thread is processing the list. */ - locked = SFXGE_TXQ_TRYLOCK(txq); + if (SFXGE_TXQ_TRYLOCK(txq)) { + sfxge_tx_qdpl_service(txq); + /* Lock has been dropped. */ + } } - if (locked) { - /* Try to service the list. */ - sfxge_tx_qdpl_service(txq); - /* Lock has been dropped. */ - } + SFXGE_TXQ_LOCK_ASSERT_NOTOWNED(txq); return (0); From owner-svn-src-stable-10@FreeBSD.ORG Thu May 21 09:12:26 2015 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.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C16FF52F; Thu, 21 May 2015 09:12:26 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AF39E1D7C; Thu, 21 May 2015 09:12:26 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4L9CQUD071697; Thu, 21 May 2015 09:12:26 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4L9CQGF071696; Thu, 21 May 2015 09:12:26 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201505210912.t4L9CQGF071696@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Thu, 21 May 2015 09:12: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: r283211 - stable/10/sys/dev/sfxge 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.20 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, 21 May 2015 09:12:26 -0000 Author: arybchik Date: Thu May 21 09:12:25 2015 New Revision: 283211 URL: https://svnweb.freebsd.org/changeset/base/283211 Log: MFC: r282998 sfxge: move mbuf free to sfxge_if_transmit() It is a preparation to the next patch which will service packet queue even if packet addtion fails. Sponsored by: Solarflare Communications, Inc. Modified: stable/10/sys/dev/sfxge/sfxge_tx.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/sfxge/sfxge_tx.c ============================================================================== --- stable/10/sys/dev/sfxge/sfxge_tx.c Thu May 21 09:11:03 2015 (r283210) +++ stable/10/sys/dev/sfxge/sfxge_tx.c Thu May 21 09:12:25 2015 (r283211) @@ -605,9 +605,8 @@ sfxge_tx_packet_add(struct sfxge_txq *tx int rc; if (!SFXGE_LINK_UP(txq->sc)) { - rc = ENETDOWN; atomic_add_long(&txq->netdown_drops, 1); - goto fail; + return (ENETDOWN); } /* @@ -622,7 +621,7 @@ sfxge_tx_packet_add(struct sfxge_txq *tx rc = sfxge_tx_qdpl_put_locked(txq, m); if (rc != 0) { SFXGE_TXQ_UNLOCK(txq); - goto fail; + return (rc); } /* Try to service the list. */ @@ -631,7 +630,7 @@ sfxge_tx_packet_add(struct sfxge_txq *tx } else { rc = sfxge_tx_qdpl_put_unlocked(txq, m); if (rc != 0) - goto fail; + return (rc); /* * Try to grab the lock again. @@ -649,10 +648,6 @@ sfxge_tx_packet_add(struct sfxge_txq *tx SFXGE_TXQ_LOCK_ASSERT_NOTOWNED(txq); return (0); - -fail: - m_freem(m); - return (rc); } static void @@ -730,6 +725,8 @@ sfxge_if_transmit(struct ifnet *ifp, str } rc = sfxge_tx_packet_add(txq, m); + if (rc != 0) + m_freem(m); return (rc); } From owner-svn-src-stable-10@FreeBSD.ORG Thu May 21 09:13:48 2015 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 187FB6BB; Thu, 21 May 2015 09:13: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E0A7F1D8C; Thu, 21 May 2015 09:13:47 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4L9Dlxr071916; Thu, 21 May 2015 09:13:47 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4L9DlHZ071915; Thu, 21 May 2015 09:13:47 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201505210913.t4L9DlHZ071915@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Thu, 21 May 2015 09:13:47 +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: r283212 - stable/10/sys/dev/sfxge 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.20 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, 21 May 2015 09:13:48 -0000 Author: arybchik Date: Thu May 21 09:13:47 2015 New Revision: 283212 URL: https://svnweb.freebsd.org/changeset/base/283212 Log: MFC: r283000 sfxge: add local variable with changed capabilities mask It is required for the next patch which adds dependency of TSO capabilities from Tx checksum offloads. Sponsored by: Solarflare Communications, Inc. Modified: stable/10/sys/dev/sfxge/sfxge.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/sfxge/sfxge.c ============================================================================== --- stable/10/sys/dev/sfxge/sfxge.c Thu May 21 09:12:25 2015 (r283211) +++ stable/10/sys/dev/sfxge/sfxge.c Thu May 21 09:13:47 2015 (r283212) @@ -257,26 +257,36 @@ sfxge_if_ioctl(struct ifnet *ifp, unsign sfxge_mac_filter_set(sc); break; case SIOCSIFCAP: + { + int reqcap = ifr->ifr_reqcap; + int capchg_mask; + SFXGE_ADAPTER_LOCK(sc); + /* Capabilities to be changed in accordance with request */ + capchg_mask = ifp->if_capenable ^ reqcap; + /* * The networking core already rejects attempts to * enable capabilities we don't have. We still have * to reject attempts to disable capabilities that we * can't (yet) disable. */ - if (~ifr->ifr_reqcap & SFXGE_CAP_FIXED) { + KASSERT((reqcap & ~ifp->if_capabilities) == 0, + ("Unsupported capabilities %x requested %x vs %x", + reqcap & ~ifp->if_capabilities, + reqcap , ifp->if_capabilities)); + if (capchg_mask & SFXGE_CAP_FIXED) { error = EINVAL; SFXGE_ADAPTER_UNLOCK(sc); break; } - ifp->if_capenable = ifr->ifr_reqcap; - if (ifp->if_capenable & IFCAP_TXCSUM) + if (reqcap & IFCAP_TXCSUM) ifp->if_hwassist |= (CSUM_IP | CSUM_TCP | CSUM_UDP); else ifp->if_hwassist &= ~(CSUM_IP | CSUM_TCP | CSUM_UDP); - if (ifp->if_capenable & IFCAP_TXCSUM_IPV6) + if (reqcap & IFCAP_TXCSUM_IPV6) ifp->if_hwassist |= (CSUM_TCP_IPV6 | CSUM_UDP_IPV6); else ifp->if_hwassist &= ~(CSUM_TCP_IPV6 | CSUM_UDP_IPV6); @@ -289,8 +299,11 @@ sfxge_if_ioctl(struct ifnet *ifp, unsign * but both bits are set in IPv4 and IPv6 mbufs. */ + ifp->if_capenable = reqcap; + SFXGE_ADAPTER_UNLOCK(sc); break; + } case SIOCSIFMEDIA: case SIOCGIFMEDIA: error = ifmedia_ioctl(ifp, ifr, &sc->media, command); From owner-svn-src-stable-10@FreeBSD.ORG Thu May 21 09:15:19 2015 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CBD26847; Thu, 21 May 2015 09:15: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B9BB41DA2; Thu, 21 May 2015 09:15:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4L9FJ7E072229; Thu, 21 May 2015 09:15:19 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4L9FJau072228; Thu, 21 May 2015 09:15:19 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201505210915.t4L9FJau072228@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Thu, 21 May 2015 09:15:19 +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: r283213 - stable/10/sys/dev/sfxge 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.20 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, 21 May 2015 09:15:19 -0000 Author: arybchik Date: Thu May 21 09:15:19 2015 New Revision: 283213 URL: https://svnweb.freebsd.org/changeset/base/283213 Log: MFC: r283007 sfxge: avoid usage of ifm_data The driver uses ifm_data to save capabilities mask calculated during initialization when supported phy modes are discovered. The patch simply calculates it when either media or options are changed. Sponsored by: Solarflare Communications, Inc. Modified: stable/10/sys/dev/sfxge/sfxge_port.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/sfxge/sfxge_port.c ============================================================================== --- stable/10/sys/dev/sfxge/sfxge_port.c Thu May 21 09:13:47 2015 (r283212) +++ stable/10/sys/dev/sfxge/sfxge_port.c Thu May 21 09:15:19 2015 (r283213) @@ -39,6 +39,8 @@ __FBSDID("$FreeBSD$"); #include "sfxge.h" +static int sfxge_phy_cap_mask(struct sfxge_softc *, int, uint32_t *); + static int sfxge_mac_stat_update(struct sfxge_softc *sc) { @@ -381,6 +383,7 @@ sfxge_port_start(struct sfxge_softc *sc) efx_nic_t *enp; size_t pdu; int rc; + uint32_t phy_cap_mask; port = &sc->port; enp = sc->enp; @@ -421,10 +424,13 @@ sfxge_port_start(struct sfxge_softc *sc) if ((rc = efx_mac_drain(enp, B_FALSE)) != 0) goto fail3; - if ((rc = efx_phy_adv_cap_set(sc->enp, sc->media.ifm_cur->ifm_data)) - != 0) + if ((rc = sfxge_phy_cap_mask(sc, sc->media.ifm_cur->ifm_media, + &phy_cap_mask)) != 0) goto fail4; + if ((rc = efx_phy_adv_cap_set(sc->enp, phy_cap_mask)) != 0) + goto fail5; + port->init_state = SFXGE_PORT_STARTED; /* Single poll in case there were missing initial events */ @@ -433,6 +439,7 @@ sfxge_port_start(struct sfxge_softc *sc) return (0); +fail5: fail4: (void)efx_mac_drain(enp, B_TRUE); fail3: @@ -676,12 +683,95 @@ sfxge_media_status(struct ifnet *ifp, st SFXGE_ADAPTER_UNLOCK(sc); } +static efx_phy_cap_type_t +sfxge_link_mode_to_phy_cap(efx_link_mode_t mode) +{ + switch (mode) { + case EFX_LINK_10HDX: + return (EFX_PHY_CAP_10HDX); + case EFX_LINK_10FDX: + return (EFX_PHY_CAP_10FDX); + case EFX_LINK_100HDX: + return (EFX_PHY_CAP_100HDX); + case EFX_LINK_100FDX: + return (EFX_PHY_CAP_100FDX); + case EFX_LINK_1000HDX: + return (EFX_PHY_CAP_1000HDX); + case EFX_LINK_1000FDX: + return (EFX_PHY_CAP_1000FDX); + case EFX_LINK_10000FDX: + return (EFX_PHY_CAP_10000FDX); + default: + EFSYS_ASSERT(B_FALSE); + return (EFX_PHY_CAP_INVALID); + } +} + +static int +sfxge_phy_cap_mask(struct sfxge_softc *sc, int ifmedia, uint32_t *phy_cap_mask) +{ + efx_phy_media_type_t medium_type; + boolean_t mode_found = B_FALSE; + uint32_t cap_mask, mode_cap_mask; + efx_link_mode_t mode; + efx_phy_cap_type_t phy_cap; + + efx_phy_media_type_get(sc->enp, &medium_type); + if (medium_type >= nitems(sfxge_link_mode)) { + if_printf(sc->ifnet, "unexpected media type %d\n", medium_type); + return (EINVAL); + } + + efx_phy_adv_cap_get(sc->enp, EFX_PHY_CAP_PERM, &cap_mask); + + for (mode = EFX_LINK_10HDX; mode < EFX_LINK_NMODES; mode++) { + if (ifmedia == sfxge_link_mode[medium_type][mode]) { + mode_found = B_TRUE; + break; + } + } + + if (!mode_found) { + /* + * If media is not in the table, it must be IFM_AUTO. + */ + KASSERT((cap_mask & (1 << EFX_PHY_CAP_AN)) && + ifmedia == (IFM_ETHER | IFM_AUTO), + ("%s: no mode for media %d", __func__, ifmedia)); + *phy_cap_mask = (cap_mask & ~(1 << EFX_PHY_CAP_ASYM)); + return (0); + } + + phy_cap = sfxge_link_mode_to_phy_cap(mode); + if (phy_cap == EFX_PHY_CAP_INVALID) { + if_printf(sc->ifnet, + "cannot map link mode %d to phy capability\n", + mode); + return (EINVAL); + } + + mode_cap_mask = (1 << phy_cap); + mode_cap_mask |= cap_mask & (1 << EFX_PHY_CAP_AN); +#ifdef SFXGE_HAVE_PAUSE_MEDIAOPTS + if (ifmedia & IFM_ETH_RXPAUSE) + mode_cap_mask |= cap_mask & (1 << EFX_PHY_CAP_PAUSE); + if (!(ifmedia & IFM_ETH_TXPAUSE)) + mode_cap_mask |= cap_mask & (1 << EFX_PHY_CAP_ASYM); +#else + mode_cap_mask |= cap_mask & (1 << EFX_PHY_CAP_PAUSE); +#endif + + *phy_cap_mask = mode_cap_mask; + return (0); +} + static int sfxge_media_change(struct ifnet *ifp) { struct sfxge_softc *sc; struct ifmedia_entry *ifm; int rc; + uint32_t phy_cap_mask; sc = ifp->if_softc; ifm = sc->media.ifm_cur; @@ -697,7 +787,10 @@ sfxge_media_change(struct ifnet *ifp) if (rc != 0) goto out; - rc = efx_phy_adv_cap_set(sc->enp, ifm->ifm_data); + if ((rc = sfxge_phy_cap_mask(sc, ifm->ifm_media, &phy_cap_mask)) != 0) + goto out; + + rc = efx_phy_adv_cap_set(sc->enp, phy_cap_mask); out: SFXGE_ADAPTER_UNLOCK(sc); @@ -709,6 +802,7 @@ int sfxge_port_ifmedia_init(struct sfxge efx_phy_media_type_t medium_type; uint32_t cap_mask, mode_cap_mask; efx_link_mode_t mode; + efx_phy_cap_type_t phy_cap; int mode_ifm, best_mode_ifm = 0; int rc; @@ -739,41 +833,30 @@ int sfxge_port_ifmedia_init(struct sfxge efx_phy_media_type_get(sc->enp, &medium_type); efx_phy_adv_cap_get(sc->enp, EFX_PHY_CAP_PERM, &cap_mask); - EFX_STATIC_ASSERT(EFX_LINK_10HDX == EFX_PHY_CAP_10HDX + 1); - EFX_STATIC_ASSERT(EFX_LINK_10FDX == EFX_PHY_CAP_10FDX + 1); - EFX_STATIC_ASSERT(EFX_LINK_100HDX == EFX_PHY_CAP_100HDX + 1); - EFX_STATIC_ASSERT(EFX_LINK_100FDX == EFX_PHY_CAP_100FDX + 1); - EFX_STATIC_ASSERT(EFX_LINK_1000HDX == EFX_PHY_CAP_1000HDX + 1); - EFX_STATIC_ASSERT(EFX_LINK_1000FDX == EFX_PHY_CAP_1000FDX + 1); - EFX_STATIC_ASSERT(EFX_LINK_10000FDX == EFX_PHY_CAP_10000FDX + 1); + for (mode = EFX_LINK_10HDX; mode < EFX_LINK_NMODES; mode++) { + phy_cap = sfxge_link_mode_to_phy_cap(mode); + if (phy_cap == EFX_PHY_CAP_INVALID) + continue; - for (mode = EFX_LINK_10HDX; mode <= EFX_LINK_10000FDX; mode++) { - mode_cap_mask = 1 << (mode - 1); + mode_cap_mask = (1 << phy_cap); mode_ifm = sfxge_link_mode[medium_type][mode]; if ((cap_mask & mode_cap_mask) && mode_ifm) { - mode_cap_mask |= cap_mask & (1 << EFX_PHY_CAP_AN); - -#ifdef SFXGE_HAVE_PAUSE_MEDIAOPTS /* No flow-control */ - ifmedia_add(&sc->media, mode_ifm, mode_cap_mask, NULL); + ifmedia_add(&sc->media, mode_ifm, 0, NULL); +#ifdef SFXGE_HAVE_PAUSE_MEDIAOPTS /* Respond-only. If using AN, we implicitly * offer symmetric as well, but that doesn't * mean we *have* to generate pause frames. */ - mode_cap_mask |= cap_mask & ((1 << EFX_PHY_CAP_PAUSE) | - (1 << EFX_PHY_CAP_ASYM)); mode_ifm |= IFM_ETH_RXPAUSE; - ifmedia_add(&sc->media, mode_ifm, mode_cap_mask, NULL); + ifmedia_add(&sc->media, mode_ifm, 0, NULL); /* Symmetric */ - mode_cap_mask &= ~(1 << EFX_PHY_CAP_ASYM); mode_ifm |= IFM_ETH_TXPAUSE; -#else /* !SFXGE_HAVE_PAUSE_MEDIAOPTS */ - mode_cap_mask |= cap_mask & (1 << EFX_PHY_CAP_PAUSE); + ifmedia_add(&sc->media, mode_ifm, 0, NULL); #endif - ifmedia_add(&sc->media, mode_ifm, mode_cap_mask, NULL); /* Link modes are numbered in order of speed, * so assume the last one available is the best. @@ -785,8 +868,7 @@ int sfxge_port_ifmedia_init(struct sfxge if (cap_mask & (1 << EFX_PHY_CAP_AN)) { /* Add autoselect mode. */ mode_ifm = IFM_ETHER | IFM_AUTO; - ifmedia_add(&sc->media, mode_ifm, - cap_mask & ~(1 << EFX_PHY_CAP_ASYM), NULL); + ifmedia_add(&sc->media, mode_ifm, 0, NULL); best_mode_ifm = mode_ifm; } From owner-svn-src-stable-10@FreeBSD.ORG Thu May 21 09:21:06 2015 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8FA72B63; Thu, 21 May 2015 09:21: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 637391E98; Thu, 21 May 2015 09:21:06 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4L9L6fu075592; Thu, 21 May 2015 09:21:06 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4L9L6P8075591; Thu, 21 May 2015 09:21:06 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201505210921.t4L9L6P8075591@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Thu, 21 May 2015 09:21: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: r283214 - stable/10/sys/dev/sfxge 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.20 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, 21 May 2015 09:21:06 -0000 Author: arybchik Date: Thu May 21 09:21:05 2015 New Revision: 283214 URL: https://svnweb.freebsd.org/changeset/base/283214 Log: MFC: r283048 sfxge: fix overflow queue freeze If TxQ lock is obtained, deferred packet list shold be serviced even if the packet addition fails because of overflow. Without the patch freeze happens if: - queue is not blocked (i.e. completion does not trigger unblock and service) - put-list overflow (1024 entries) - sfxge_tx_packet_add() acquires TxQ lock just as it is released it in sfxge_tx_qdpl_service() on the second CPU but before pending check - sfxge_tx_packet_add() swizzles put-list to get-list, fails because of non-tcp get-list overflow and returns without packet list service - sfxge_tx_qdpl_service() on the second CPU checks that there are no pending packets in the put-list and returns Other possible solution is to guaranee that maximum length of the put-list is less than maximum length of any get-list. Sponsored by: Solarflare Communications, Inc. Modified: stable/10/sys/dev/sfxge/sfxge_tx.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/sfxge/sfxge_tx.c ============================================================================== --- stable/10/sys/dev/sfxge/sfxge_tx.c Thu May 21 09:15:19 2015 (r283213) +++ stable/10/sys/dev/sfxge/sfxge_tx.c Thu May 21 09:21:05 2015 (r283214) @@ -619,18 +619,12 @@ sfxge_tx_packet_add(struct sfxge_txq *tx sfxge_tx_qdpl_swizzle(txq); rc = sfxge_tx_qdpl_put_locked(txq, m); - if (rc != 0) { - SFXGE_TXQ_UNLOCK(txq); - return (rc); - } /* Try to service the list. */ sfxge_tx_qdpl_service(txq); /* Lock has been dropped. */ } else { rc = sfxge_tx_qdpl_put_unlocked(txq, m); - if (rc != 0) - return (rc); /* * Try to grab the lock again. @@ -639,7 +633,7 @@ sfxge_tx_packet_add(struct sfxge_txq *tx * the deferred packet list. If we are not able to get * the lock, another thread is processing the list. */ - if (SFXGE_TXQ_TRYLOCK(txq)) { + if ((rc == 0) && SFXGE_TXQ_TRYLOCK(txq)) { sfxge_tx_qdpl_service(txq); /* Lock has been dropped. */ } @@ -647,7 +641,7 @@ sfxge_tx_packet_add(struct sfxge_txq *tx SFXGE_TXQ_LOCK_ASSERT_NOTOWNED(txq); - return (0); + return (rc); } static void From owner-svn-src-stable-10@FreeBSD.ORG Thu May 21 09:22:16 2015 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.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D48F2CAF; Thu, 21 May 2015 09:22:16 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C27951EB2; Thu, 21 May 2015 09:22:16 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4L9MGUA076984; Thu, 21 May 2015 09:22:16 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4L9MGtk076983; Thu, 21 May 2015 09:22:16 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201505210922.t4L9MGtk076983@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Thu, 21 May 2015 09:22:16 +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: r283215 - stable/10/sys/dev/sfxge 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.20 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, 21 May 2015 09:22:17 -0000 Author: arybchik Date: Thu May 21 09:22:15 2015 New Revision: 283215 URL: https://svnweb.freebsd.org/changeset/base/283215 Log: MFC: r283049 sfxge: allow to disable checksum offloads over VLAN It just affects capabilities of the created VLAN interface. Sponsored by: Solarflare Communications, Inc. Modified: stable/10/sys/dev/sfxge/sfxge.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/sfxge/sfxge.c ============================================================================== --- stable/10/sys/dev/sfxge/sfxge.c Thu May 21 09:21:05 2015 (r283214) +++ stable/10/sys/dev/sfxge/sfxge.c Thu May 21 09:22:15 2015 (r283215) @@ -64,7 +64,7 @@ __FBSDID("$FreeBSD$"); IFCAP_JUMBO_MTU | IFCAP_LRO | \ IFCAP_VLAN_HWTSO | IFCAP_LINKSTATE) #define SFXGE_CAP_ENABLE SFXGE_CAP -#define SFXGE_CAP_FIXED (IFCAP_VLAN_MTU | IFCAP_VLAN_HWCSUM | \ +#define SFXGE_CAP_FIXED (IFCAP_VLAN_MTU | \ IFCAP_JUMBO_MTU | IFCAP_LINKSTATE) MALLOC_DEFINE(M_SFXGE, "sfxge", "Solarflare 10GigE driver"); From owner-svn-src-stable-10@FreeBSD.ORG Thu May 21 09:23:29 2015 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.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3EEA1E04; Thu, 21 May 2015 09:23: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 134311EC3; Thu, 21 May 2015 09:23:29 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4L9NSFa077198; Thu, 21 May 2015 09:23:28 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4L9NSZY077197; Thu, 21 May 2015 09:23:28 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201505210923.t4L9NSZY077197@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Thu, 21 May 2015 09:23: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: r283216 - stable/10/sys/dev/sfxge 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.20 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, 21 May 2015 09:23:29 -0000 Author: arybchik Date: Thu May 21 09:23:28 2015 New Revision: 283216 URL: https://svnweb.freebsd.org/changeset/base/283216 Log: MFC: r283050 sfxge: automatically turn off TSO when Tx checksum offload is disabled Also return error if TSO is requested without Tx checksum offload. Sponsored by: Solarflare Communications, Inc. Modified: stable/10/sys/dev/sfxge/sfxge.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/sfxge/sfxge.c ============================================================================== --- stable/10/sys/dev/sfxge/sfxge.c Thu May 21 09:22:15 2015 (r283215) +++ stable/10/sys/dev/sfxge/sfxge.c Thu May 21 09:23:28 2015 (r283216) @@ -59,8 +59,9 @@ __FBSDID("$FreeBSD$"); #include "sfxge_version.h" #define SFXGE_CAP (IFCAP_VLAN_MTU | IFCAP_VLAN_HWCSUM | \ - IFCAP_RXCSUM | IFCAP_TXCSUM | IFCAP_TSO | \ + IFCAP_RXCSUM | IFCAP_TXCSUM | \ IFCAP_RXCSUM_IPV6 | IFCAP_TXCSUM_IPV6 | \ + IFCAP_TSO4 | IFCAP_TSO6 | \ IFCAP_JUMBO_MTU | IFCAP_LRO | \ IFCAP_VLAN_HWTSO | IFCAP_LINKSTATE) #define SFXGE_CAP_ENABLE SFXGE_CAP @@ -282,14 +283,42 @@ sfxge_if_ioctl(struct ifnet *ifp, unsign break; } - if (reqcap & IFCAP_TXCSUM) + /* Check request before any changes */ + if ((capchg_mask & IFCAP_TSO4) && + (reqcap & (IFCAP_TSO4 | IFCAP_TXCSUM)) == IFCAP_TSO4) { + error = EAGAIN; + SFXGE_ADAPTER_UNLOCK(sc); + if_printf(ifp, "enable txcsum before tso4\n"); + break; + } + if ((capchg_mask & IFCAP_TSO6) && + (reqcap & (IFCAP_TSO6 | IFCAP_TXCSUM_IPV6)) == IFCAP_TSO6) { + error = EAGAIN; + SFXGE_ADAPTER_UNLOCK(sc); + if_printf(ifp, "enable txcsum6 before tso6\n"); + break; + } + + if (reqcap & IFCAP_TXCSUM) { ifp->if_hwassist |= (CSUM_IP | CSUM_TCP | CSUM_UDP); - else + } else { ifp->if_hwassist &= ~(CSUM_IP | CSUM_TCP | CSUM_UDP); - if (reqcap & IFCAP_TXCSUM_IPV6) + if (reqcap & IFCAP_TSO4) { + reqcap &= ~IFCAP_TSO4; + if_printf(ifp, + "tso4 disabled due to -txcsum\n"); + } + } + if (reqcap & IFCAP_TXCSUM_IPV6) { ifp->if_hwassist |= (CSUM_TCP_IPV6 | CSUM_UDP_IPV6); - else + } else { ifp->if_hwassist &= ~(CSUM_TCP_IPV6 | CSUM_UDP_IPV6); + if (reqcap & IFCAP_TSO6) { + reqcap &= ~IFCAP_TSO6; + if_printf(ifp, + "tso6 disabled due to -txcsum6\n"); + } + } /* * The kernel takes both IFCAP_TSOx and CSUM_TSO into From owner-svn-src-stable-10@FreeBSD.ORG Thu May 21 09:24:36 2015 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.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3B3F0F64; Thu, 21 May 2015 09:24:36 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 299C01ECF; Thu, 21 May 2015 09:24:36 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4L9OZq8077411; Thu, 21 May 2015 09:24:35 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4L9OZK6077410; Thu, 21 May 2015 09:24:35 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201505210924.t4L9OZK6077410@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Thu, 21 May 2015 09:24: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: r283217 - stable/10/sys/dev/sfxge 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.20 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, 21 May 2015 09:24:36 -0000 Author: arybchik Date: Thu May 21 09:24:35 2015 New Revision: 283217 URL: https://svnweb.freebsd.org/changeset/base/283217 Log: MFC: r283051 sfxge: do not advertise LRO capability if LRO is compiled out Sponsored by: Solarflare Communications, Inc. Modified: stable/10/sys/dev/sfxge/sfxge.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/sfxge/sfxge.c ============================================================================== --- stable/10/sys/dev/sfxge/sfxge.c Thu May 21 09:23:28 2015 (r283216) +++ stable/10/sys/dev/sfxge/sfxge.c Thu May 21 09:24:35 2015 (r283217) @@ -62,7 +62,7 @@ __FBSDID("$FreeBSD$"); IFCAP_RXCSUM | IFCAP_TXCSUM | \ IFCAP_RXCSUM_IPV6 | IFCAP_TXCSUM_IPV6 | \ IFCAP_TSO4 | IFCAP_TSO6 | \ - IFCAP_JUMBO_MTU | IFCAP_LRO | \ + IFCAP_JUMBO_MTU | \ IFCAP_VLAN_HWTSO | IFCAP_LINKSTATE) #define SFXGE_CAP_ENABLE SFXGE_CAP #define SFXGE_CAP_FIXED (IFCAP_VLAN_MTU | \ @@ -88,7 +88,6 @@ SYSCTL_INT(_hw_sfxge, OID_AUTO, tx_ring, &sfxge_tx_ring_entries, 0, "Maximum number of descriptors in a transmit ring"); - static void sfxge_reset(void *arg, int npending); @@ -376,6 +375,12 @@ sfxge_ifnet_init(struct ifnet *ifp, stru ifp->if_capabilities = SFXGE_CAP; ifp->if_capenable = SFXGE_CAP_ENABLE; + +#ifdef SFXGE_LRO + ifp->if_capabilities |= IFCAP_LRO; + ifp->if_capenable |= IFCAP_LRO; +#endif + ifp->if_hwassist = CSUM_TCP | CSUM_UDP | CSUM_IP | CSUM_TSO | CSUM_TCP_IPV6 | CSUM_UDP_IPV6; From owner-svn-src-stable-10@FreeBSD.ORG Thu May 21 10:28:34 2015 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.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1A392549; Thu, 21 May 2015 10:28: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 08C0B16AD; Thu, 21 May 2015 10:28:34 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4LASX1r007491; Thu, 21 May 2015 10:28:33 GMT (envelope-from royger@FreeBSD.org) Received: (from royger@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4LASXQ5007490; Thu, 21 May 2015 10:28:33 GMT (envelope-from royger@FreeBSD.org) Message-Id: <201505211028.t4LASXQ5007490@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: royger set sender to royger@FreeBSD.org using -f From: Roger Pau Monné Date: Thu, 21 May 2015 10:28:33 +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: r283218 - stable/10/sys/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.20 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, 21 May 2015 10:28:34 -0000 Author: royger Date: Thu May 21 10:28:33 2015 New Revision: 283218 URL: https://svnweb.freebsd.org/changeset/base/283218 Log: MFC: r282908 netfront: wait for backend to connect before sending ARP Sponsored by: Citrix Systems R&D Modified: stable/10/sys/dev/xen/netfront/netfront.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/xen/netfront/netfront.c ============================================================================== --- stable/10/sys/dev/xen/netfront/netfront.c Thu May 21 09:24:35 2015 (r283217) +++ stable/10/sys/dev/xen/netfront/netfront.c Thu May 21 10:28:33 2015 (r283218) @@ -683,7 +683,6 @@ netfront_backend_changed(device_t dev, X switch (newstate) { case XenbusStateInitialising: case XenbusStateInitialised: - case XenbusStateConnected: case XenbusStateUnknown: case XenbusStateClosed: case XenbusStateReconfigured: @@ -695,13 +694,15 @@ netfront_backend_changed(device_t dev, X if (network_connect(sc) != 0) break; xenbus_set_state(dev, XenbusStateConnected); -#ifdef INET - netfront_send_fake_arp(dev, sc); -#endif break; case XenbusStateClosing: xenbus_set_state(dev, XenbusStateClosed); break; + case XenbusStateConnected: +#ifdef INET + netfront_send_fake_arp(dev, sc); +#endif + break; } } From owner-svn-src-stable-10@FreeBSD.ORG Thu May 21 10:40:20 2015 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.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 108AE7D4; Thu, 21 May 2015 10:40:20 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E585617AB; Thu, 21 May 2015 10:40:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4LAeJE5012812; Thu, 21 May 2015 10:40:19 GMT (envelope-from royger@FreeBSD.org) Received: (from royger@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4LAeJJm012808; Thu, 21 May 2015 10:40:19 GMT (envelope-from royger@FreeBSD.org) Message-Id: <201505211040.t4LAeJJm012808@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: royger set sender to royger@FreeBSD.org using -f From: Roger Pau Monné Date: Thu, 21 May 2015 10:40:19 +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: r283219 - in stable/10/sys: conf dev/atkbdc 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.20 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, 21 May 2015 10:40:20 -0000 Author: royger Date: Thu May 21 10:40:18 2015 New Revision: 283219 URL: https://svnweb.freebsd.org/changeset/base/283219 Log: MFC: r282269, r282277 atkbd: remove usage of x86bios Remove leftover from r282269. Modified: stable/10/sys/conf/files.amd64 stable/10/sys/conf/files.i386 stable/10/sys/dev/atkbdc/atkbd.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/conf/files.amd64 ============================================================================== --- stable/10/sys/conf/files.amd64 Thu May 21 10:28:33 2015 (r283218) +++ stable/10/sys/conf/files.amd64 Thu May 21 10:40:18 2015 (r283219) @@ -531,10 +531,10 @@ compat/ndis/winx64_wrap.S optional ndisa libkern/memmove.c standard libkern/memset.c standard # -# x86 real mode BIOS emulator, required by atkbdc/dpms/vesa +# x86 real mode BIOS emulator, required by dpms/vesa # -compat/x86bios/x86bios.c optional x86bios | atkbd | dpms | vesa -contrib/x86emu/x86emu.c optional x86bios | atkbd | dpms | vesa +compat/x86bios/x86bios.c optional x86bios | dpms | vesa +contrib/x86emu/x86emu.c optional x86bios | dpms | vesa # # bvm console # Modified: stable/10/sys/conf/files.i386 ============================================================================== --- stable/10/sys/conf/files.i386 Thu May 21 10:28:33 2015 (r283218) +++ stable/10/sys/conf/files.i386 Thu May 21 10:40:18 2015 (r283219) @@ -552,9 +552,9 @@ i386/xbox/xboxfb.c optional xboxfb dev/fb/boot_font.c optional xboxfb i386/xbox/pic16l.s optional xbox # -# x86 real mode BIOS support, required by atkbdc/dpms/vesa +# x86 real mode BIOS support, required by dpms/vesa # -compat/x86bios/x86bios.c optional x86bios | atkbd | dpms | vesa +compat/x86bios/x86bios.c optional x86bios | dpms | vesa # # x86 shared code between IA32, AMD64 and PC98 architectures # Modified: stable/10/sys/dev/atkbdc/atkbd.c ============================================================================== --- stable/10/sys/dev/atkbdc/atkbd.c Thu May 21 10:28:33 2015 (r283218) +++ stable/10/sys/dev/atkbdc/atkbd.c Thu May 21 10:40:18 2015 (r283219) @@ -44,19 +44,6 @@ __FBSDID("$FreeBSD$"); #include #include -#if defined(__i386__) || defined(__amd64__) -#include -#include -#include -#include - -#include -#include -#include - -#include -#endif /* __i386__ || __amd64__ */ - #include #include #include @@ -65,6 +52,9 @@ __FBSDID("$FreeBSD$"); static timeout_t atkbd_timeout; static void atkbd_shutdown_final(void *v); +#define DEFAULT_DELAY 0x1 /* 500ms */ +#define DEFAULT_RATE 0x10 /* 14Hz */ + int atkbd_probe_unit(device_t dev, int irq, int flags) { @@ -239,7 +229,7 @@ static keyboard_switch_t atkbdsw = { KEYBOARD_DRIVER(atkbd, atkbdsw, atkbd_configure); /* local functions */ -static int get_typematic(keyboard_t *kbd); +static int set_typematic(keyboard_t *kbd); static int setup_kbd_port(KBDC kbdc, int port, int intr); static int get_kbd_echo(KBDC kbdc); static int probe_keyboard(KBDC kbdc, int flags); @@ -433,7 +423,7 @@ atkbd_init(int unit, keyboard_t **kbdp, goto bad; } atkbd_ioctl(kbd, KDSETLED, (caddr_t)&state->ks_state); - get_typematic(kbd); + set_typematic(kbd); delay[0] = kbd->kb_delay1; delay[1] = kbd->kb_delay2; atkbd_ioctl(kbd, KDSETREPEAT, (caddr_t)delay); @@ -490,7 +480,7 @@ atkbd_intr(keyboard_t *kbd, void *arg) init_keyboard(state->kbdc, &kbd->kb_type, kbd->kb_config); KBD_FOUND_DEVICE(kbd); atkbd_ioctl(kbd, KDSETLED, (caddr_t)&state->ks_state); - get_typematic(kbd); + set_typematic(kbd); delay[0] = kbd->kb_delay1; delay[1] = kbd->kb_delay2; atkbd_ioctl(kbd, KDSETREPEAT, (caddr_t)delay); @@ -1089,57 +1079,19 @@ atkbd_shutdown_final(void *v) /* local functions */ static int -get_typematic(keyboard_t *kbd) +set_typematic(keyboard_t *kbd) { -#if defined(__i386__) || defined(__amd64__) - /* - * Only some systems allow us to retrieve the keyboard repeat - * rate previously set via the BIOS... - */ - x86regs_t regs; - uint8_t *p; + int val, error; + atkbd_state_t *state = kbd->kb_data; - /* - * Traditional entry points of int 0x15 and 0x16 are fixed - * and later BIOSes follow them. (U)EFI CSM specification - * also mandates these fixed entry points. - * - * Validate the entry points here before we proceed further. - * It's known that some recent laptops does not have the - * same entry point and hang on boot if we call it. - */ - if (x86bios_get_intr(0x15) != 0xf000f859 || - x86bios_get_intr(0x16) != 0xf000e82e) - return (ENODEV); - - /* Is BIOS system configuration table supported? */ - x86bios_init_regs(®s); - regs.R_AH = 0xc0; - x86bios_intr(®s, 0x15); - if ((regs.R_FLG & PSL_C) != 0 || regs.R_AH != 0) - return (ENODEV); - - /* Is int 0x16, function 0x09 supported? */ - p = x86bios_offset((regs.R_ES << 4) + regs.R_BX); - if (readw(p) < 5 || (readb(p + 6) & 0x40) == 0) - return (ENODEV); - - /* Is int 0x16, function 0x0306 supported? */ - x86bios_init_regs(®s); - regs.R_AH = 0x09; - x86bios_intr(®s, 0x16); - if ((regs.R_AL & 0x08) == 0) - return (ENODEV); - - x86bios_init_regs(®s); - regs.R_AX = 0x0306; - x86bios_intr(®s, 0x16); - kbd->kb_delay1 = typematic_delay(regs.R_BH << 5); - kbd->kb_delay2 = typematic_rate(regs.R_BL); - return (0); -#else - return (ENODEV); -#endif /* __i386__ || __amd64__ */ + val = typematic(DEFAULT_DELAY, DEFAULT_RATE); + error = write_kbd(state->kbdc, KBDC_SET_TYPEMATIC, val); + if (error == 0) { + kbd->kb_delay1 = typematic_delay(val); + kbd->kb_delay2 = typematic_rate(val); + } + + return (error); } static int From owner-svn-src-stable-10@FreeBSD.ORG Thu May 21 13:08:32 2015 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.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4F89B837; Thu, 21 May 2015 13:08: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3BFB61A3B; Thu, 21 May 2015 13:08:32 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4LD8WCQ088328; Thu, 21 May 2015 13:08:32 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4LD8UCl088320; Thu, 21 May 2015 13:08:30 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201505211308.t4LD8UCl088320@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Thu, 21 May 2015 13:08: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: r283223 - in stable/10: etc etc/autofs usr.sbin/autofs 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.20 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, 21 May 2015 13:08:32 -0000 Author: trasz Date: Thu May 21 13:08:30 2015 New Revision: 283223 URL: https://svnweb.freebsd.org/changeset/base/283223 Log: MFC r275681: Add "-media" autofs map, to access data on removable media, such as CD drives or flash keys. It can be enabled by uncommenting a single entry in default /etc/auto_master. It can also be easily modified to use fuse-based filesystems instead of in-kernel ones. There is still one deficiency - the mountpoints are permanent, they don't disappear when user removes the media. Fixing it needs some autofs changes. Relnotes: yes Sponsored by: The FreeBSD Foundation Added: stable/10/etc/autofs/special_media - copied unchanged from r275681, head/etc/autofs/special_media Modified: stable/10/etc/auto_master stable/10/etc/autofs/Makefile stable/10/etc/devd.conf stable/10/usr.sbin/autofs/auto_master.5 Directory Properties: stable/10/ (props changed) Modified: stable/10/etc/auto_master ============================================================================== --- stable/10/etc/auto_master Thu May 21 13:04:14 2015 (r283222) +++ stable/10/etc/auto_master Thu May 21 13:08:30 2015 (r283223) @@ -3,3 +3,6 @@ # Automounter master map, see auto_master(5) for details. # /net -hosts -nobrowse,nosuid +# When using the -media special map, make sure to edit devd.conf(5) +# to move the call to "automount -c" out of the comments section. +#/media -media -nosuid Modified: stable/10/etc/autofs/Makefile ============================================================================== --- stable/10/etc/autofs/Makefile Thu May 21 13:04:14 2015 (r283222) +++ stable/10/etc/autofs/Makefile Thu May 21 13:08:30 2015 (r283223) @@ -1,6 +1,6 @@ # $FreeBSD$ -FILES= include_ldap special_hosts special_null +FILES= include_ldap special_hosts special_media special_null NO_OBJ= FILESDIR= /etc/autofs Copied: stable/10/etc/autofs/special_media (from r275681, head/etc/autofs/special_media) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/etc/autofs/special_media Thu May 21 13:08:30 2015 (r283223, copy of r275681, head/etc/autofs/special_media) @@ -0,0 +1,93 @@ +#!/bin/sh +# +# $FreeBSD$ +# + +# Print newline-separated list of devices available for mounting. +# If there is a filesystem label - use it, otherwise use device name. +print_available() { + local _fstype _fstype_and_label _label _p + + for _p in ${providers}; do + _fstype_and_label="$(fstyp -l "/dev/${_p}" 2> /dev/null)" + if [ $? -ne 0 ]; then + # Ignore devices for which we were unable + # to determine filesystem type. + continue + fi + + _fstype="${_fstype_and_label%% *}" + if [ "${_fstype}" != "${_fstype_and_label}" ]; then + _label="${_fstype_and_label#* }" + echo "${_label}" + continue + fi + + echo "${_p}" + done +} + +# Print a single map entry. +print_one() { + local _fstype _fstype_and_label _label _key _p + + _key="$1" + + _fstype="$(fstyp "/dev/${_key}" 2> /dev/null)" + if [ $? -eq 0 ]; then + echo "-fstype=${_fstype},nosuid :/dev/${_key}" + return + fi + + for _p in ${providers}; do + _fstype_and_label="$(fstyp -l "/dev/${_p}" 2> /dev/null)" + if [ $? -ne 0 ]; then + # Ignore devices for which we were unable + # to determine filesystem type. + continue + fi + + _fstype="${_fstype_and_label%% *}" + if [ "${_fstype}" = "${_fstype_and_label}" ]; then + # No label, try another device. + continue + fi + + _label="${_fstype_and_label#* }" + if [ "${_label}" != "${_key}" ]; then + # Labels don't match, try another device. + continue + fi + + echo "-fstype=${_fstype},nosuid :/dev/${_p}" + done + + # No matching device - don't print anything, autofs will handle it. +} + +# Obtain a list of (geom-provider-name, access-count) pairs, turning this: +# +# z0xfffff80005085d00 [shape=hexagon,label="ada0\nr2w2e3\nerr#0\nsector=512\nstripe=0"]; +# +# Into this: +# +# ada0 r2w2e3 +# +# XXX: It would be easier to use kern.geom.conftxt instead, but it lacks +# access counts. +pairs=$(sysctl kern.geom.confdot | sed -n 's/^.*hexagon,label="\([^\]*\)\\n\([^\]*\).*/\1 \2/p') + +# Obtain a list of GEOM providers that are not already open - not mounted, +# and without other GEOM class, such as gpart, attached. In other words, +# grep for "r0w0e0". Skip providers with names containing slashes; we're +# not interested in geom_label(4) creations. +providers=$(echo "$pairs" | awk '$2 == "r0w0e0" && $1 !~ /\// { print $1 }') + +if [ $# -eq 0 ]; then + print_available + exit 0 +fi + +print_one "$1" +exit 0 + Modified: stable/10/etc/devd.conf ============================================================================== --- stable/10/etc/devd.conf Thu May 21 13:04:14 2015 (r283222) +++ stable/10/etc/devd.conf Thu May 21 13:08:30 2015 (r283223) @@ -318,4 +318,16 @@ notify 0 { action "/usr/local/etc/rc.d/postgresql restart"; }; +# Discard autofs caches, useful for the -media special map. The one +# second delay is for GEOM to finish tasting. +# +# XXX: We should probably have a devctl(4) event that fires after GEOM +# tasting. +# +notify 100 { + match "system" "DEVFS"; + match "cdev" "(da|mmcsd)[0-9]+"; + action "sleep 1 && /usr/sbin/automount -c"; +}; + */ Modified: stable/10/usr.sbin/autofs/auto_master.5 ============================================================================== --- stable/10/usr.sbin/autofs/auto_master.5 Thu May 21 13:04:14 2015 (r283222) +++ stable/10/usr.sbin/autofs/auto_master.5 Thu May 21 13:08:30 2015 (r283223) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 21, 2014 +.Dd November 22, 2014 .Dt AUTO_MASTER 5 .Os .Sh NAME @@ -213,14 +213,17 @@ Supported special maps are: .Pp .Bl -tag -width "-hosts" -compact .It Li -hosts -This map queries the remote NFS server and maps exported volumes. -It is traditionally mounted on +Query the remote NFS server and map exported shares. +This map is traditionally mounted on .Pa /net . -It enables access to files on a remote NFS server by accessing +Access to files on a remote NFS server is provided through the .Pa /net/nfs-server-ip/share-name/ -directory, without the need for any further configuration. +directory without any additional configuration. +.It Li -media +Query devices that are not yet mounted, but contain valid filesystems. +Generally used to access files on removable media. .It Li -null -This map prevents the +Prevent .Xr automountd 8 from mounting anything on the mountpoint. .El From owner-svn-src-stable-10@FreeBSD.ORG Thu May 21 13:10:09 2015 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.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2E2BDA43; Thu, 21 May 2015 13:10: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1BB631A6E; Thu, 21 May 2015 13:10:09 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4LDA83g088668; Thu, 21 May 2015 13:10:08 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4LDA8iK088667; Thu, 21 May 2015 13:10:08 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201505211310.t4LDA8iK088667@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Thu, 21 May 2015 13:10: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: r283224 - stable/10/etc 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.20 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, 21 May 2015 13:10:09 -0000 Author: trasz Date: Thu May 21 13:10:08 2015 New Revision: 283224 URL: https://svnweb.freebsd.org/changeset/base/283224 Log: MFC r276833: Make /net use -intr by default. Linux does that, and it seems a good idea. Sponsored by: The FreeBSD Foundation Modified: stable/10/etc/auto_master Directory Properties: stable/10/ (props changed) Modified: stable/10/etc/auto_master ============================================================================== --- stable/10/etc/auto_master Thu May 21 13:08:30 2015 (r283223) +++ stable/10/etc/auto_master Thu May 21 13:10:08 2015 (r283224) @@ -2,7 +2,7 @@ # # Automounter master map, see auto_master(5) for details. # -/net -hosts -nobrowse,nosuid +/net -hosts -nobrowse,nosuid,intr # When using the -media special map, make sure to edit devd.conf(5) # to move the call to "automount -c" out of the comments section. #/media -media -nosuid From owner-svn-src-stable-10@FreeBSD.ORG Thu May 21 13:11:49 2015 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6FE6DBAF; Thu, 21 May 2015 13:11: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5D6171B32; Thu, 21 May 2015 13:11:49 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4LDBnwA092013; Thu, 21 May 2015 13:11:49 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4LDBnjA092012; Thu, 21 May 2015 13:11:49 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201505211311.t4LDBnjA092012@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Thu, 21 May 2015 13:11: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: r283225 - stable/10/usr.sbin/autofs 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.20 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, 21 May 2015 13:11:49 -0000 Author: trasz Date: Thu May 21 13:11:48 2015 New Revision: 283225 URL: https://svnweb.freebsd.org/changeset/base/283225 Log: MFC r276883: Improve documentation for autofs variables and executable maps; also some markup fixes. Sponsored by: The FreeBSD Foundation Modified: stable/10/usr.sbin/autofs/auto_master.5 Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/autofs/auto_master.5 ============================================================================== --- stable/10/usr.sbin/autofs/auto_master.5 Thu May 21 13:10:08 2015 (r283224) +++ stable/10/usr.sbin/autofs/auto_master.5 Thu May 21 13:11:48 2015 (r283225) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 22, 2014 +.Dd January 9, 2015 .Dt AUTO_MASTER 5 .Os .Sh NAME @@ -172,6 +172,42 @@ This is typically used with wildcards, l .Li * 192.168.1.1:/share/& .Ed .Pp +The +.Ar location +field may contain references to variables, like: +.Bd -literal -offset indent +.Li sys 192.168.1.1:/sys/${OSNAME} +.Ed +.Pp +Defined variables are: +.Pp +.Bl -tag -width "-OSNAME" -compact +.It Li ARCH +Expands to the output of +.Li "uname -p" . +.It Li CPU +Same as ARCH. +.It Li HOST +Expands to the output of +.Li "uname -n" . +.It Li OSNAME +Expands to the output of +.Li "uname -s" . +.It Li OSREL +Expands to the output of +.Li "uname -r" . +.It Li OSVERS +Expands to the output of +.Li "uname -v" . +.El +.Pp +Additional variables can be defined with the +.Fl D +option of +.Xr automount 8 +and +.Xr automountd 8 . +.Pp To pass a location that begins with .Li / , prefix it with a colon. @@ -217,8 +253,10 @@ Query the remote NFS server and map expo This map is traditionally mounted on .Pa /net . Access to files on a remote NFS server is provided through the -.Pa /net/nfs-server-ip/share-name/ +.Pf /net/ Ar nfs-server-ip Ns / Ns Ar share-name Ns/ directory without any additional configuration. +Directories for individual NFS servers are not present until the first access, +when they are automatically created. .It Li -media Query devices that are not yet mounted, but contain valid filesystems. Generally used to access files on removable media. @@ -227,13 +265,27 @@ Prevent .Xr automountd 8 from mounting anything on the mountpoint. .El +.Pp +It is possible to add custom special maps by adding them, as executable +maps named +.Pa special_foo , +to the +.Pa /etc/autofs/ +directory. .Sh EXECUTABLE MAPS If the map file specified in .Nm -has execute bit set, the +has the execute bit set, .Xr automountd 8 will execute it and parse the standard output instead of parsing the file contents. +When called without command line arguments, the executable is +expected to output a list of available map keys separated by +newline characters. +Otherwise, the executable will be called with a key name as +a command line argument. +Output from the executable is expected to be the entry for that key, +not including the key itself. .Sh INDIRECT VERSUS DIRECT MAPS Indirect maps are referred to in .Nm @@ -300,6 +352,9 @@ It can be symlinked to The default location of the .Pa auto_master file. +.It Pa /etc/autofs/ +Directory containing shell scripts to implement special maps and directory +services. .El .Sh SEE ALSO .Xr autofs 5 , From owner-svn-src-stable-10@FreeBSD.ORG Thu May 21 13:13:57 2015 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 891B0D48; Thu, 21 May 2015 13:13: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 76AC41B76; Thu, 21 May 2015 13:13:57 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4LDDvge092831; Thu, 21 May 2015 13:13:57 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4LDDvNK092830; Thu, 21 May 2015 13:13:57 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201505211313.t4LDDvNK092830@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Thu, 21 May 2015 13:13:57 +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: r283226 - stable/10/etc 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.20 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, 21 May 2015 13:13:57 -0000 Author: trasz Date: Thu May 21 13:13:56 2015 New Revision: 283226 URL: https://svnweb.freebsd.org/changeset/base/283226 Log: MFC r277171: Use newly added GEOM notifications to discard autofs caches. Sponsored by: The FreeBSD Foundation Modified: stable/10/etc/devd.conf Directory Properties: stable/10/ (props changed) Modified: stable/10/etc/devd.conf ============================================================================== --- stable/10/etc/devd.conf Thu May 21 13:11:48 2015 (r283225) +++ stable/10/etc/devd.conf Thu May 21 13:13:56 2015 (r283226) @@ -318,16 +318,11 @@ notify 0 { action "/usr/local/etc/rc.d/postgresql restart"; }; -# Discard autofs caches, useful for the -media special map. The one -# second delay is for GEOM to finish tasting. -# -# XXX: We should probably have a devctl(4) event that fires after GEOM -# tasting. -# +# Discard autofs caches, useful for the -media special map. notify 100 { - match "system" "DEVFS"; - match "cdev" "(da|mmcsd)[0-9]+"; - action "sleep 1 && /usr/sbin/automount -c"; + match "system" "GEOM"; + match "subsystem" "DEV"; + action "/usr/sbin/automount -c"; }; */ From owner-svn-src-stable-10@FreeBSD.ORG Thu May 21 13:18:03 2015 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.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CDD4AFA0; Thu, 21 May 2015 13:18:03 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BADCC1BC2; Thu, 21 May 2015 13:18:03 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4LDI3nR093450; Thu, 21 May 2015 13:18:03 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4LDI3GH093449; Thu, 21 May 2015 13:18:03 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201505211318.t4LDI3GH093449@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Thu, 21 May 2015 13:18:03 +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: r283227 - stable/10/usr.sbin/autofs 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.20 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, 21 May 2015 13:18:03 -0000 Author: trasz Date: Thu May 21 13:18:02 2015 New Revision: 283227 URL: https://svnweb.freebsd.org/changeset/base/283227 Log: MFC r279806: Minor optimization/cleanup in node_path(); no functional changes. Modified: stable/10/usr.sbin/autofs/common.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/autofs/common.c ============================================================================== --- stable/10/usr.sbin/autofs/common.c Thu May 21 13:13:56 2015 (r283226) +++ stable/10/usr.sbin/autofs/common.c Thu May 21 13:18:02 2015 (r283227) @@ -561,7 +561,6 @@ static char * node_path_x(const struct node *n, char *x) { char *path; - size_t len; if (n->n_parent == NULL) return (x); @@ -580,14 +579,6 @@ node_path_x(const struct node *n, char * path = separated_concat(n->n_key, x, '/'); free(x); - /* - * Strip trailing slash. - */ - len = strlen(path); - assert(len > 0); - if (path[len - 1] == '/') - path[len - 1] = '\0'; - return (node_path_x(n->n_parent, path)); } @@ -598,8 +589,19 @@ node_path_x(const struct node *n, char * char * node_path(const struct node *n) { + char *path; + size_t len; + + path = node_path_x(n, checked_strdup("")); + + /* + * Strip trailing slash, unless the whole path is "/". + */ + len = strlen(path); + if (len > 1 && path[len - 1] == '/') + path[len - 1] = '\0'; - return (node_path_x(n, checked_strdup(""))); + return (path); } static char * From owner-svn-src-stable-10@FreeBSD.ORG Thu May 21 13:19:44 2015 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DEA2F185; Thu, 21 May 2015 13:19:44 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CBD0D1BD6; Thu, 21 May 2015 13:19:44 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4LDJipG093718; Thu, 21 May 2015 13:19:44 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4LDJitP093717; Thu, 21 May 2015 13:19:44 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201505211319.t4LDJitP093717@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Thu, 21 May 2015 13:19: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: r283228 - stable/10/usr.sbin/autofs 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.20 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, 21 May 2015 13:19:45 -0000 Author: trasz Date: Thu May 21 13:19:44 2015 New Revision: 283228 URL: https://svnweb.freebsd.org/changeset/base/283228 Log: MFC r279807: Improve separated_concat() to properly handle the case of concatenating "/" and "/foo". Modified: stable/10/usr.sbin/autofs/common.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/autofs/common.c ============================================================================== --- stable/10/usr.sbin/autofs/common.c Thu May 21 13:18:02 2015 (r283227) +++ stable/10/usr.sbin/autofs/common.c Thu May 21 13:19:44 2015 (r283228) @@ -136,8 +136,14 @@ separated_concat(const char *s1, const c assert(s1 != NULL); assert(s2 != NULL); - if (s1[0] == '\0' || s2[0] == '\0' || - s1[strlen(s1) - 1] == separator || s2[0] == separator) { + /* + * If s2 starts with separator - skip it; otherwise concatenating + * "/" and "/foo" would end up returning "//foo". + */ + if (s2[0] == separator) + s2++; + + if (s1[0] == '\0' || s2[0] == '\0' || s1[strlen(s1) - 1] == separator) { ret = asprintf(&result, "%s%s", s1, s2); } else { ret = asprintf(&result, "%s%c%s", s1, separator, s2); From owner-svn-src-stable-10@FreeBSD.ORG Thu May 21 13:21:04 2015 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2A22C2F0; Thu, 21 May 2015 13:21:04 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 17B941BEF; Thu, 21 May 2015 13:21:04 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4LDL35q095184; Thu, 21 May 2015 13:21:03 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4LDL35I095183; Thu, 21 May 2015 13:21:03 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201505211321.t4LDL35I095183@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Thu, 21 May 2015 13:21:03 +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: r283229 - stable/10/usr.sbin/autofs 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.20 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, 21 May 2015 13:21:04 -0000 Author: trasz Date: Thu May 21 13:21:03 2015 New Revision: 283229 URL: https://svnweb.freebsd.org/changeset/base/283229 Log: MFC r279808: Fix memory leak. Sponsored by: The FreeBSD Foundation Modified: stable/10/usr.sbin/autofs/common.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/autofs/common.c ============================================================================== --- stable/10/usr.sbin/autofs/common.c Thu May 21 13:19:44 2015 (r283228) +++ stable/10/usr.sbin/autofs/common.c Thu May 21 13:21:03 2015 (r283229) @@ -615,9 +615,11 @@ node_options_x(const struct node *n, cha { char *options; + if (n == NULL) + return (x); + options = separated_concat(x, n->n_options, ','); - if (n->n_parent == NULL) - return (options); + free(x); return (node_options_x(n->n_parent, options)); } From owner-svn-src-stable-10@FreeBSD.ORG Thu May 21 13:23:50 2015 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 88BC249C; Thu, 21 May 2015 13:23:50 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5C2231CD3; Thu, 21 May 2015 13:23:50 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4LDNowo097994; Thu, 21 May 2015 13:23:50 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4LDNoul097993; Thu, 21 May 2015 13:23:50 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201505211323.t4LDNoul097993@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Thu, 21 May 2015 13:23: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: r283230 - stable/10/usr.sbin/autofs 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.20 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, 21 May 2015 13:23:50 -0000 Author: trasz Date: Thu May 21 13:23:49 2015 New Revision: 283230 URL: https://svnweb.freebsd.org/changeset/base/283230 Log: MFC r279812: Remove some particularly bad code; no functional changes. MFC r279815: Erm, revert chunk committed by mistake. Sponsored by: The FreeBSD Foundation Modified: stable/10/usr.sbin/autofs/common.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/autofs/common.c ============================================================================== --- stable/10/usr.sbin/autofs/common.c Thu May 21 13:21:03 2015 (r283229) +++ stable/10/usr.sbin/autofs/common.c Thu May 21 13:23:49 2015 (r283230) @@ -86,46 +86,7 @@ checked_strdup(const char *s) } /* - * Take two pointers to strings, concatenate the contents with "/" in the - * middle, make the first pointer point to the result, the second pointer - * to NULL, and free the old strings. - * - * Concatenate pathnames, basically. - */ -static void -concat(char **p1, char **p2) -{ - int ret; - char *path; - - assert(p1 != NULL); - assert(p2 != NULL); - - if (*p1 == NULL) - *p1 = checked_strdup(""); - - if (*p2 == NULL) - *p2 = checked_strdup(""); - - ret = asprintf(&path, "%s/%s", *p1, *p2); - if (ret < 0) - log_err(1, "asprintf"); - - /* - * XXX - */ - //free(*p1); - //free(*p2); - - *p1 = path; - *p2 = NULL; -} - -/* * Concatenate two strings, inserting separator between them, unless not needed. - * - * This function is very convenient to use when you do not care about freeing - * memory - which is okay here, because we are a short running process. */ char * separated_concat(const char *s1, const char *s2, char separator) @@ -151,7 +112,7 @@ separated_concat(const char *s1, const c if (ret < 0) log_err(1, "asprintf"); - //log_debugx("separated_concat: got %s and %s, returning %s", s1, s2, result); + //log_debugx("%s: got %s and %s, returning %s", __func__, s1, s2, result); return (result); } @@ -159,7 +120,7 @@ separated_concat(const char *s1, const c void create_directory(const char *path) { - char *component, *copy, *tofree, *partial; + char *component, *copy, *tofree, *partial, *tmp; int error; assert(path[0] == '/'); @@ -169,12 +130,14 @@ create_directory(const char *path) */ copy = tofree = checked_strdup(path + 1); - partial = NULL; + partial = checked_strdup(""); for (;;) { component = strsep(©, "/"); if (component == NULL) break; - concat(&partial, &component); + tmp = separated_concat(partial, component, '/'); + free(partial); + partial = tmp; //log_debugx("creating \"%s\"", partial); error = mkdir(partial, 0755); if (error != 0 && errno != EEXIST) { From owner-svn-src-stable-10@FreeBSD.ORG Thu May 21 13:25:30 2015 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A6735600; Thu, 21 May 2015 13:25:30 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 939041CEF; Thu, 21 May 2015 13:25:30 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4LDPUJ4098307; Thu, 21 May 2015 13:25:30 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4LDPTra098302; Thu, 21 May 2015 13:25:29 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201505211325.t4LDPTra098302@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Thu, 21 May 2015 13:25:29 +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: r283231 - stable/10/usr.sbin/autofs 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.20 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, 21 May 2015 13:25:30 -0000 Author: trasz Date: Thu May 21 13:25:28 2015 New Revision: 283231 URL: https://svnweb.freebsd.org/changeset/base/283231 Log: MFC r279813: Make things more readable; no functional changes. Sponsored by: The FreeBSD Foundation Modified: stable/10/usr.sbin/autofs/automount.c stable/10/usr.sbin/autofs/automountd.c stable/10/usr.sbin/autofs/common.c stable/10/usr.sbin/autofs/common.h stable/10/usr.sbin/autofs/popen.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/autofs/automount.c ============================================================================== --- stable/10/usr.sbin/autofs/automount.c Thu May 21 13:23:49 2015 (r283230) +++ stable/10/usr.sbin/autofs/automount.c Thu May 21 13:25:28 2015 (r283231) @@ -349,8 +349,7 @@ main_automount(int argc, char **argv) if (options == NULL) { options = checked_strdup(optarg); } else { - options = - separated_concat(options, optarg, ','); + options = concat(options, ',', optarg); } break; case 'u': @@ -388,8 +387,7 @@ main_automount(int argc, char **argv) if (show_maps) { if (options != NULL) { - root->n_options = separated_concat(options, - root->n_options, ','); + root->n_options = concat(options, ',', root->n_options); } if (show_maps > 1) { node_expand_indirect_maps(root); Modified: stable/10/usr.sbin/autofs/automountd.c ============================================================================== --- stable/10/usr.sbin/autofs/automountd.c Thu May 21 13:23:49 2015 (r283230) +++ stable/10/usr.sbin/autofs/automountd.c Thu May 21 13:25:28 2015 (r283231) @@ -241,8 +241,7 @@ handle_request(const struct autofs_daemo * Prepend options passed via automountd(8) command line. */ if (cmdline_options != NULL) { - options = - separated_concat(cmdline_options, options, ','); + options = concat(cmdline_options, ',', options); } nobrowse = pick_option("nobrowse", &options); @@ -268,8 +267,7 @@ handle_request(const struct autofs_daemo * We still need to create the single subdirectory * user is trying to access. */ - tmp = separated_concat(adr->adr_path, - adr->adr_key, '/'); + tmp = concat(adr->adr_path, '/', adr->adr_key); node = node_find(root, tmp); if (node != NULL) create_subtree(node, false); @@ -301,12 +299,12 @@ handle_request(const struct autofs_daemo * Prepend options passed via automountd(8) command line. */ if (cmdline_options != NULL) - options = separated_concat(cmdline_options, options, ','); + options = concat(cmdline_options, ',', options); /* * Append "automounted". */ - options = separated_concat(options, "automounted", ','); + options = concat(options, ',', "automounted"); /* * Remove "nobrowse", mount(8) doesn't understand it. @@ -334,11 +332,10 @@ handle_request(const struct autofs_daemo if (retrycnt == NULL) { log_debugx("retrycnt not specified in options; " "defaulting to 1"); - options = separated_concat(options, - separated_concat("retrycnt", "1", '='), ','); + options = concat(options, ',', "retrycnt=1"); } else { - options = separated_concat(options, - separated_concat("retrycnt", retrycnt, '='), ','); + options = concat(options, ',', + concat("retrycnt", '=', retrycnt)); } } @@ -465,8 +462,7 @@ main_automountd(int argc, char **argv) if (options == NULL) { options = checked_strdup(optarg); } else { - options = - separated_concat(options, optarg, ','); + options = concat(options, ',', optarg); } break; case 'v': Modified: stable/10/usr.sbin/autofs/common.c ============================================================================== --- stable/10/usr.sbin/autofs/common.c Thu May 21 13:23:49 2015 (r283230) +++ stable/10/usr.sbin/autofs/common.c Thu May 21 13:25:28 2015 (r283231) @@ -89,7 +89,7 @@ checked_strdup(const char *s) * Concatenate two strings, inserting separator between them, unless not needed. */ char * -separated_concat(const char *s1, const char *s2, char separator) +concat(const char *s1, char separator, const char *s2) { char *result; int ret; @@ -135,7 +135,7 @@ create_directory(const char *path) component = strsep(©, "/"); if (component == NULL) break; - tmp = separated_concat(partial, component, '/'); + tmp = concat(partial, '/', component); free(partial); partial = tmp; //log_debugx("creating \"%s\"", partial); @@ -545,7 +545,7 @@ node_path_x(const struct node *n, char * } assert(n->n_key[0] != '\0'); - path = separated_concat(n->n_key, x, '/'); + path = concat(n->n_key, '/', x); free(x); return (node_path_x(n->n_parent, path)); @@ -581,7 +581,7 @@ node_options_x(const struct node *n, cha if (n == NULL) return (x); - options = separated_concat(x, n->n_options, ','); + options = concat(x, ',', n->n_options); free(x); return (node_options_x(n->n_parent, options)); Modified: stable/10/usr.sbin/autofs/common.h ============================================================================== --- stable/10/usr.sbin/autofs/common.h Thu May 21 13:23:49 2015 (r283230) +++ stable/10/usr.sbin/autofs/common.h Thu May 21 13:25:28 2015 (r283231) @@ -70,7 +70,7 @@ void log_warnx(const char *, ...) __prin void log_debugx(const char *, ...) __printf0like(1, 2); char *checked_strdup(const char *); -char *separated_concat(const char *s1, const char *s2, char separator); +char *concat(const char *s1, char separator, const char *s2); void create_directory(const char *path); struct node *node_new_root(void); Modified: stable/10/usr.sbin/autofs/popen.c ============================================================================== --- stable/10/usr.sbin/autofs/popen.c Thu May 21 13:23:49 2015 (r283230) +++ stable/10/usr.sbin/autofs/popen.c Thu May 21 13:25:28 2015 (r283231) @@ -104,7 +104,7 @@ auto_popen(const char *argv0, ...) if (arg == NULL) break; - command = separated_concat(command, arg, ' '); + command = concat(command, ' ', arg); } va_end(ap); From owner-svn-src-stable-10@FreeBSD.ORG Thu May 21 13:26:53 2015 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.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0E4CD756; Thu, 21 May 2015 13:26:53 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EF0941D05; Thu, 21 May 2015 13:26:52 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4LDQqLs098545; Thu, 21 May 2015 13:26:52 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4LDQqIU098544; Thu, 21 May 2015 13:26:52 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201505211326.t4LDQqIU098544@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Thu, 21 May 2015 13:26: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: r283232 - stable/10/usr.sbin/autofs 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.20 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, 21 May 2015 13:26:53 -0000 Author: trasz Date: Thu May 21 13:26:52 2015 New Revision: 283232 URL: https://svnweb.freebsd.org/changeset/base/283232 Log: MFC r279843: Refactor. Sponsored by: The FreeBSD Foundation Modified: stable/10/usr.sbin/autofs/common.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/autofs/common.c ============================================================================== --- stable/10/usr.sbin/autofs/common.c Thu May 21 13:25:28 2015 (r283231) +++ stable/10/usr.sbin/autofs/common.c Thu May 21 13:26:52 2015 (r283232) @@ -449,6 +449,18 @@ node_expand_defined(struct node *n) return (cumulated_error); } +static bool +node_is_direct_key(const struct node *n) +{ + + if (n->n_parent != NULL && n->n_parent->n_parent == NULL && + strcmp(n->n_key, "/-") == 0) { + return (true); + } + + return (false); +} + bool node_is_direct_map(const struct node *n) { @@ -460,11 +472,7 @@ node_is_direct_map(const struct node *n) n = n->n_parent; } - assert(n->n_key != NULL); - if (strcmp(n->n_key, "/-") != 0) - return (false); - - return (true); + return (node_is_direct_key(n)); } bool @@ -538,11 +546,8 @@ node_path_x(const struct node *n, char * * Return "/-" for direct maps only if we were asked for path * to the "/-" node itself, not to any of its subnodes. */ - if (n->n_parent->n_parent == NULL && - strcmp(n->n_key, "/-") == 0 && - x[0] != '\0') { + if (node_is_direct_key(n) && x[0] != '\0') return (x); - } assert(n->n_key[0] != '\0'); path = concat(n->n_key, '/', x); From owner-svn-src-stable-10@FreeBSD.ORG Thu May 21 13:29:35 2015 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 019388DD; Thu, 21 May 2015 13: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C96ED1D28; Thu, 21 May 2015 13:29:34 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4LDTY0J098972; Thu, 21 May 2015 13:29:34 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4LDTYJ5098971; Thu, 21 May 2015 13:29:34 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201505211329.t4LDTYJ5098971@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Thu, 21 May 2015 13: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: r283233 - stable/10/usr.sbin/autofs 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.20 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, 21 May 2015 13:29:35 -0000 Author: trasz Date: Thu May 21 13:29:34 2015 New Revision: 283233 URL: https://svnweb.freebsd.org/changeset/base/283233 Log: MFC r279845: Fix handling of direct maps, broken in r275756. Previously, running automount(8) would unmount direct map trigger nodes every second time. Sponsored by: The FreeBSD Foundation Modified: stable/10/usr.sbin/autofs/common.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/autofs/common.c ============================================================================== --- stable/10/usr.sbin/autofs/common.c Thu May 21 13:26:52 2015 (r283232) +++ stable/10/usr.sbin/autofs/common.c Thu May 21 13:29:34 2015 (r283233) @@ -661,23 +661,25 @@ node_find_x(struct node *node, const cha char *tmp; size_t tmplen; - //log_debugx("looking up %s in %s", path, node->n_key); + //log_debugx("looking up %s in %s", path, node_path(node)); - tmp = node_path(node); - tmplen = strlen(tmp); - if (strncmp(tmp, path, tmplen) != 0) { - free(tmp); - return (NULL); - } - if (path[tmplen] != '/' && path[tmplen] != '\0') { - /* - * If we have two map entries like 'foo' and 'foobar', make - * sure the search for 'foobar' won't match 'foo' instead. - */ + if (!node_is_direct_key(node)) { + tmp = node_path(node); + tmplen = strlen(tmp); + if (strncmp(tmp, path, tmplen) != 0) { + free(tmp); + return (NULL); + } + if (path[tmplen] != '/' && path[tmplen] != '\0') { + /* + * If we have two map entries like 'foo' and 'foobar', make + * sure the search for 'foobar' won't match 'foo' instead. + */ + free(tmp); + return (NULL); + } free(tmp); - return (NULL); } - free(tmp); TAILQ_FOREACH(child, &node->n_children, n_next) { found = node_find_x(child, path); @@ -685,6 +687,9 @@ node_find_x(struct node *node, const cha return (found); } + if (node->n_parent == NULL || node_is_direct_key(node)) + return (NULL); + return (node); } @@ -693,9 +698,12 @@ node_find(struct node *root, const char { struct node *node; + assert(root->n_parent == NULL); + node = node_find_x(root, path); - if (node == root) - return (NULL); + if (node != NULL) + assert(node != root); + return (node); } From owner-svn-src-stable-10@FreeBSD.ORG Thu May 21 13:30:10 2015 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.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id BCC6FA29; Thu, 21 May 2015 13:30:10 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AA5551DDA; Thu, 21 May 2015 13:30:10 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4LDUAv4099220; Thu, 21 May 2015 13:30:10 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4LDUAPl099219; Thu, 21 May 2015 13:30:10 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201505211330.t4LDUAPl099219@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 21 May 2015 13:30:10 +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: r283234 - stable/10/usr.bin/ar 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.20 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, 21 May 2015 13:30:10 -0000 Author: emaste Date: Thu May 21 13:30:10 2015 New Revision: 283234 URL: https://svnweb.freebsd.org/changeset/base/283234 Log: MFC r276774: ar: Avoid null pointer deref while reading corrupt archives ELF Tool Chain ticket #467 Reported by: Alexander Cherepanov Sponsored by: The FreeBSD Foundation Modified: stable/10/usr.bin/ar/read.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.bin/ar/read.c ============================================================================== --- stable/10/usr.bin/ar/read.c Thu May 21 13:29:34 2015 (r283233) +++ stable/10/usr.bin/ar/read.c Thu May 21 13:30:10 2015 (r283234) @@ -102,7 +102,8 @@ read_archive(struct bsdar *bsdar, char m continue; } - name = archive_entry_pathname(entry); + if ((name = archive_entry_pathname(entry)) == NULL) + break; /* Skip pseudo members. */ if (strcmp(name, "/") == 0 || strcmp(name, "//") == 0) From owner-svn-src-stable-10@FreeBSD.ORG Thu May 21 13:31:46 2015 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D450BB9B; Thu, 21 May 2015 13:31: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C0E031DF4; Thu, 21 May 2015 13:31:45 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4LDVj4U000588; Thu, 21 May 2015 13:31:45 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4LDVjaV000586; Thu, 21 May 2015 13:31:45 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201505211331.t4LDVjaV000586@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Thu, 21 May 2015 13:31:45 +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: r283235 - stable/10/usr.sbin/autofs 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.20 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, 21 May 2015 13:31:46 -0000 Author: trasz Date: Thu May 21 13:31:44 2015 New Revision: 283235 URL: https://svnweb.freebsd.org/changeset/base/283235 Log: MFC r279846: Properly pass options for direct maps. Sponsored by: The FreeBSD Foundation Modified: stable/10/usr.sbin/autofs/automount.c stable/10/usr.sbin/autofs/automountd.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/autofs/automount.c ============================================================================== --- stable/10/usr.sbin/autofs/automount.c Thu May 21 13:30:10 2015 (r283234) +++ stable/10/usr.sbin/autofs/automount.c Thu May 21 13:31:44 2015 (r283235) @@ -141,8 +141,8 @@ mount_autofs(const char *from, const cha } static void -mount_if_not_already(const struct node *n, const char *map, - const struct statfs *mntbuf, int nitems) +mount_if_not_already(const struct node *n, const char *map, const char *options, + const char *prefix, const struct statfs *mntbuf, int nitems) { const struct statfs *sb; char *mountpoint; @@ -175,7 +175,7 @@ mount_if_not_already(const struct node * mountpoint); } - mount_autofs(from, mountpoint, n->n_options, n->n_key); + mount_autofs(from, mountpoint, options, prefix); free(from); free(mountpoint); } @@ -184,7 +184,7 @@ static void mount_unmount(struct node *root) { struct statfs *mntbuf; - struct node *n, *n2, *n3; + struct node *n, *n2; int i, nitems; nitems = getmntinfo(&mntbuf, MNT_WAIT); @@ -216,15 +216,14 @@ mount_unmount(struct node *root) TAILQ_FOREACH(n, &root->n_children, n_next) { if (!node_is_direct_map(n)) { - mount_if_not_already(n, n->n_map, mntbuf, nitems); + mount_if_not_already(n, n->n_map, n->n_options, + n->n_key, mntbuf, nitems); continue; } TAILQ_FOREACH(n2, &n->n_children, n_next) { - TAILQ_FOREACH(n3, &n2->n_children, n_next) { - mount_if_not_already(n3, n->n_map, - mntbuf, nitems); - } + mount_if_not_already(n2, n->n_map, n->n_options, + "/", mntbuf, nitems); } } } Modified: stable/10/usr.sbin/autofs/automountd.c ============================================================================== --- stable/10/usr.sbin/autofs/automountd.c Thu May 21 13:30:10 2015 (r283234) +++ stable/10/usr.sbin/autofs/automountd.c Thu May 21 13:31:44 2015 (r283235) @@ -202,7 +202,7 @@ handle_request(const struct autofs_daemo parent = root; } else { parent = node_new_map(root, checked_strdup(adr->adr_prefix), - checked_strdup(adr->adr_options), checked_strdup(map), + NULL, checked_strdup(map), checked_strdup("[kernel request]"), lineno); } @@ -231,19 +231,19 @@ handle_request(const struct autofs_daemo "failing mount", map, adr->adr_path); } + options = node_options(node); + options = concat(adr->adr_options, ',', options); + + /* + * Prepend options passed via automountd(8) command line. + */ + if (cmdline_options != NULL) + options = concat(cmdline_options, ',', options); + if (node->n_location == NULL) { log_debugx("found node defined at %s:%d; not a mountpoint", node->n_config_file, node->n_config_line); - options = node_options(node); - - /* - * Prepend options passed via automountd(8) command line. - */ - if (cmdline_options != NULL) { - options = concat(cmdline_options, ',', options); - } - nobrowse = pick_option("nobrowse", &options); if (nobrowse != NULL && adr->adr_key[0] == '\0') { log_debugx("skipping map %s due to \"nobrowse\" " @@ -293,14 +293,6 @@ handle_request(const struct autofs_daemo "failing mount", adr->adr_path); } - options = node_options(node); - - /* - * Prepend options passed via automountd(8) command line. - */ - if (cmdline_options != NULL) - options = concat(cmdline_options, ',', options); - /* * Append "automounted". */ From owner-svn-src-stable-10@FreeBSD.ORG Thu May 21 13:33:07 2015 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 32D0FDD9; Thu, 21 May 2015 13: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 201B01E0B; Thu, 21 May 2015 13:33:07 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4LDX6I6003535; Thu, 21 May 2015 13:33:06 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4LDX6V6003534; Thu, 21 May 2015 13:33:06 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201505211333.t4LDX6V6003534@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Thu, 21 May 2015 13:33: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: r283236 - stable/10/usr.sbin/autofs 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.20 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, 21 May 2015 13:33:07 -0000 Author: trasz Date: Thu May 21 13:33:06 2015 New Revision: 283236 URL: https://svnweb.freebsd.org/changeset/base/283236 Log: MFC r279851: Fix typo. Sponsored by: The FreeBSD Foundation Modified: stable/10/usr.sbin/autofs/automountd.8 Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/autofs/automountd.8 ============================================================================== --- stable/10/usr.sbin/autofs/automountd.8 Thu May 21 13:31:44 2015 (r283235) +++ stable/10/usr.sbin/autofs/automountd.8 Thu May 21 13:33:06 2015 (r283236) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 20, 2014 +.Dd March 10, 2015 .Dt AUTOMOUNTD 8 .Os .Sh NAME @@ -78,7 +78,7 @@ The default is 30. Debug mode: increase verbosity and do not daemonize. .It Fl o Ar options Specify mount options. -Options specified here ill be overridden by options entered in maps or +Options specified here will be overridden by options entered in maps or .Xr auto_master 5 . .It Fl v Increase verbosity. From owner-svn-src-stable-10@FreeBSD.ORG Thu May 21 13:34:34 2015 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.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3871AFBD; Thu, 21 May 2015 13:34: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 25C1D1E28; Thu, 21 May 2015 13:34:34 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4LDYY6N003769; Thu, 21 May 2015 13:34:34 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4LDYYE1003768; Thu, 21 May 2015 13:34:34 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201505211334.t4LDYYE1003768@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Thu, 21 May 2015 13:34: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: r283237 - stable/10/usr.sbin/autofs 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.20 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, 21 May 2015 13:34:34 -0000 Author: trasz Date: Thu May 21 13:34:33 2015 New Revision: 283237 URL: https://svnweb.freebsd.org/changeset/base/283237 Log: MFC r279914: Options from auto_master must be appended to options from maps, not prepended. Sponsored by: The FreeBSD Foundation Modified: stable/10/usr.sbin/autofs/automountd.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/autofs/automountd.c ============================================================================== --- stable/10/usr.sbin/autofs/automountd.c Thu May 21 13:33:06 2015 (r283236) +++ stable/10/usr.sbin/autofs/automountd.c Thu May 21 13:34:33 2015 (r283237) @@ -232,7 +232,11 @@ handle_request(const struct autofs_daemo } options = node_options(node); - options = concat(adr->adr_options, ',', options); + + /* + * Append options from auto_master. + */ + options = concat(options, ',', adr->adr_options); /* * Prepend options passed via automountd(8) command line. From owner-svn-src-stable-10@FreeBSD.ORG Thu May 21 13:36:02 2015 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.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3F65126B; Thu, 21 May 2015 13:36:02 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1F1D01E37; Thu, 21 May 2015 13:36:02 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4LDa1pL004202; Thu, 21 May 2015 13:36:01 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4LDa1OD004195; Thu, 21 May 2015 13:36:01 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201505211336.t4LDa1OD004195@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Thu, 21 May 2015 13:36: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: r283238 - stable/10/usr.sbin/autofs 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.20 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, 21 May 2015 13:36:02 -0000 Author: trasz Date: Thu May 21 13:36:00 2015 New Revision: 283238 URL: https://svnweb.freebsd.org/changeset/base/283238 Log: MFC r279915: Make concat() accept NULL arguments. Sponsored by: The FreeBSD Foundation Modified: stable/10/usr.sbin/autofs/automount.c stable/10/usr.sbin/autofs/automountd.c stable/10/usr.sbin/autofs/common.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/autofs/automount.c ============================================================================== --- stable/10/usr.sbin/autofs/automount.c Thu May 21 13:34:33 2015 (r283237) +++ stable/10/usr.sbin/autofs/automount.c Thu May 21 13:36:00 2015 (r283238) @@ -345,11 +345,7 @@ main_automount(int argc, char **argv) force_unmount = true; break; case 'o': - if (options == NULL) { - options = checked_strdup(optarg); - } else { - options = concat(options, ',', optarg); - } + options = concat(options, ',', optarg); break; case 'u': do_unmount = true; @@ -385,9 +381,7 @@ main_automount(int argc, char **argv) parse_master(root, AUTO_MASTER_PATH); if (show_maps) { - if (options != NULL) { - root->n_options = concat(options, ',', root->n_options); - } + root->n_options = concat(options, ',', root->n_options); if (show_maps > 1) { node_expand_indirect_maps(root); node_expand_ampersand(root, NULL); Modified: stable/10/usr.sbin/autofs/automountd.c ============================================================================== --- stable/10/usr.sbin/autofs/automountd.c Thu May 21 13:34:33 2015 (r283237) +++ stable/10/usr.sbin/autofs/automountd.c Thu May 21 13:36:00 2015 (r283238) @@ -241,8 +241,7 @@ handle_request(const struct autofs_daemo /* * Prepend options passed via automountd(8) command line. */ - if (cmdline_options != NULL) - options = concat(cmdline_options, ',', options); + options = concat(cmdline_options, ',', options); if (node->n_location == NULL) { log_debugx("found node defined at %s:%d; not a mountpoint", @@ -455,11 +454,7 @@ main_automountd(int argc, char **argv) maxproc = atoi(optarg); break; case 'o': - if (options == NULL) { - options = checked_strdup(optarg); - } else { - options = concat(options, ',', optarg); - } + options = concat(options, ',', optarg); break; case 'v': debug++; Modified: stable/10/usr.sbin/autofs/common.c ============================================================================== --- stable/10/usr.sbin/autofs/common.c Thu May 21 13:34:33 2015 (r283237) +++ stable/10/usr.sbin/autofs/common.c Thu May 21 13:36:00 2015 (r283238) @@ -94,8 +94,10 @@ concat(const char *s1, char separator, c char *result; int ret; - assert(s1 != NULL); - assert(s2 != NULL); + if (s1 == NULL) + s1 = ""; + if (s2 == NULL) + s2 = ""; /* * If s2 starts with separator - skip it; otherwise concatenating From owner-svn-src-stable-10@FreeBSD.ORG Thu May 21 13:37:49 2015 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B79614AA; Thu, 21 May 2015 13:37: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A4B081E5B; Thu, 21 May 2015 13:37:49 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4LDbndp004600; Thu, 21 May 2015 13:37:49 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4LDbmXG004595; Thu, 21 May 2015 13:37:48 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201505211337.t4LDbmXG004595@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Thu, 21 May 2015 13:37: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: r283239 - stable/10/usr.sbin/autofs 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.20 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, 21 May 2015 13:37:49 -0000 Author: trasz Date: Thu May 21 13:37:48 2015 New Revision: 283239 URL: https://svnweb.freebsd.org/changeset/base/283239 Log: MFC r279916: Make "automount -LL -o whatever" present options in the same order as used by automountd(8). Sponsored by: The FreeBSD Foundation Modified: stable/10/usr.sbin/autofs/automount.c stable/10/usr.sbin/autofs/common.c stable/10/usr.sbin/autofs/common.h Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/autofs/automount.c ============================================================================== --- stable/10/usr.sbin/autofs/automount.c Thu May 21 13:36:00 2015 (r283238) +++ stable/10/usr.sbin/autofs/automount.c Thu May 21 13:37:48 2015 (r283239) @@ -381,13 +381,12 @@ main_automount(int argc, char **argv) parse_master(root, AUTO_MASTER_PATH); if (show_maps) { - root->n_options = concat(options, ',', root->n_options); if (show_maps > 1) { node_expand_indirect_maps(root); node_expand_ampersand(root, NULL); } node_expand_defined(root); - node_print(root); + node_print(root, options); return (0); } Modified: stable/10/usr.sbin/autofs/common.c ============================================================================== --- stable/10/usr.sbin/autofs/common.c Thu May 21 13:36:00 2015 (r283238) +++ stable/10/usr.sbin/autofs/common.c Thu May 21 13:37:48 2015 (r283239) @@ -607,13 +607,16 @@ node_options(const struct node *n) } static void -node_print_indent(const struct node *n, int indent) +node_print_indent(const struct node *n, const char *cmdline_options, + int indent) { const struct node *child, *first_child; - char *path, *options; + char *path, *options, *tmp; path = node_path(n); - options = node_options(n); + tmp = node_options(n); + options = concat(cmdline_options, ',', tmp); + free(tmp); /* * Do not show both parent and child node if they have the same @@ -644,16 +647,21 @@ node_print_indent(const struct node *n, free(options); TAILQ_FOREACH(child, &n->n_children, n_next) - node_print_indent(child, indent + 2); + node_print_indent(child, cmdline_options, indent + 2); } +/* + * Recursively print node with all its children. The cmdline_options + * argument is used for additional options to be prepended to all the + * others - usually those are the options passed by command line. + */ void -node_print(const struct node *n) +node_print(const struct node *n, const char *cmdline_options) { const struct node *child; TAILQ_FOREACH(child, &n->n_children, n_next) - node_print_indent(child, 0); + node_print_indent(child, cmdline_options, 0); } static struct node * Modified: stable/10/usr.sbin/autofs/common.h ============================================================================== --- stable/10/usr.sbin/autofs/common.h Thu May 21 13:36:00 2015 (r283238) +++ stable/10/usr.sbin/autofs/common.h Thu May 21 13:37:48 2015 (r283239) @@ -87,7 +87,7 @@ void node_expand_ampersand(struct node * void node_expand_wildcard(struct node *root, const char *key); int node_expand_defined(struct node *root); void node_expand_indirect_maps(struct node *n); -void node_print(const struct node *n); +void node_print(const struct node *n, const char *cmdline_options); void parse_master(struct node *root, const char *path); void parse_map(struct node *parent, const char *map, const char *args, bool *wildcards); From owner-svn-src-stable-10@FreeBSD.ORG Thu May 21 13:39:39 2015 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C99A85FC; Thu, 21 May 2015 13:39: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B72E21E6E; Thu, 21 May 2015 13:39:39 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4LDddb3004888; Thu, 21 May 2015 13:39:39 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4LDddUG004887; Thu, 21 May 2015 13:39:39 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201505211339.t4LDddUG004887@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Thu, 21 May 2015 13:39: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: r283240 - stable/10/usr.sbin/autofs 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.20 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, 21 May 2015 13:39:39 -0000 Author: trasz Date: Thu May 21 13:39:38 2015 New Revision: 283240 URL: https://svnweb.freebsd.org/changeset/base/283240 Log: MFC r279953: Rework the concat() algorithm to be correct in all cases. Sponsored by: The FreeBSD Foundation Modified: stable/10/usr.sbin/autofs/common.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/autofs/common.c ============================================================================== --- stable/10/usr.sbin/autofs/common.c Thu May 21 13:37:48 2015 (r283239) +++ stable/10/usr.sbin/autofs/common.c Thu May 21 13:39:38 2015 (r283240) @@ -92,6 +92,7 @@ char * concat(const char *s1, char separator, const char *s2) { char *result; + char s1last, s2first; int ret; if (s1 == NULL) @@ -99,14 +100,22 @@ concat(const char *s1, char separator, c if (s2 == NULL) s2 = ""; - /* - * If s2 starts with separator - skip it; otherwise concatenating - * "/" and "/foo" would end up returning "//foo". - */ - if (s2[0] == separator) - s2++; + if (s1[0] == '\0') + s1last = '\0'; + else + s1last = s1[strlen(s1) - 1]; - if (s1[0] == '\0' || s2[0] == '\0' || s1[strlen(s1) - 1] == separator) { + s2first = s2[0]; + + if (s1last == separator && s2first == separator) { + /* + * If s1 ends with the separator and s2 begins with + * it - skip the latter; otherwise concatenating "/" + * and "/foo" would end up returning "//foo". + */ + ret = asprintf(&result, "%s%s", s1, s2 + 1); + } else if (s1last == separator || s2first == separator || + s1[0] == '\0' || s2[0] == '\0') { ret = asprintf(&result, "%s%s", s1, s2); } else { ret = asprintf(&result, "%s%c%s", s1, separator, s2); From owner-svn-src-stable-10@FreeBSD.ORG Thu May 21 13:41:09 2015 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.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 04653763; Thu, 21 May 2015 13:41: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E5F081F23; Thu, 21 May 2015 13:41:08 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4LDf8YS006193; Thu, 21 May 2015 13:41:08 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4LDf8hL006192; Thu, 21 May 2015 13:41:08 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201505211341.t4LDf8hL006192@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Thu, 21 May 2015 13:41: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: r283241 - stable/10/usr.sbin/autofs 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.20 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, 21 May 2015 13:41:09 -0000 Author: trasz Date: Thu May 21 13:41:08 2015 New Revision: 283241 URL: https://svnweb.freebsd.org/changeset/base/283241 Log: MFC r279954: Get executable direct maps to work. Sponsored by: The FreeBSD Foundation Modified: stable/10/usr.sbin/autofs/automountd.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/autofs/automountd.c ============================================================================== --- stable/10/usr.sbin/autofs/automountd.c Thu May 21 13:39:38 2015 (r283240) +++ stable/10/usr.sbin/autofs/automountd.c Thu May 21 13:41:08 2015 (r283241) @@ -177,7 +177,7 @@ handle_request(const struct autofs_daemo const char *map; struct node *root, *parent, *node; FILE *f; - char *options, *fstype, *nobrowse, *retrycnt, *tmp; + char *key, *options, *fstype, *nobrowse, *retrycnt, *tmp; int error; bool wildcards; @@ -199,11 +199,25 @@ handle_request(const struct autofs_daemo map = adr->adr_from + 4; /* 4 for strlen("map "); */ root = node_new_root(); if (adr->adr_prefix[0] == '\0' || strcmp(adr->adr_prefix, "/") == 0) { + /* + * Direct map. autofs(4) doesn't have a way to determine + * correct map key, but since it's a direct map, we can just + * use adr_path instead. + */ parent = root; + key = checked_strdup(adr->adr_path); } else { + /* + * Indirect map. + */ parent = node_new_map(root, checked_strdup(adr->adr_prefix), NULL, checked_strdup(map), checked_strdup("[kernel request]"), lineno); + + if (adr->adr_key[0] == '\0') + key = NULL; + else + key = checked_strdup(adr->adr_key); } /* @@ -213,8 +227,7 @@ handle_request(const struct autofs_daemo * needs to be done for maps with wildcard entries, but also * for special and executable maps. */ - parse_map(parent, map, adr->adr_key[0] != '\0' ? adr->adr_key : NULL, - &wildcards); + parse_map(parent, map, key, &wildcards); if (!wildcards) wildcards = node_has_wildcards(parent); if (wildcards) @@ -222,8 +235,8 @@ handle_request(const struct autofs_daemo else log_debugx("map does not contain wildcard entries"); - if (adr->adr_key[0] != '\0') - node_expand_wildcard(root, adr->adr_key); + if (key != NULL) + node_expand_wildcard(root, key); node = node_find(root, adr->adr_path); if (node == NULL) { @@ -248,7 +261,7 @@ handle_request(const struct autofs_daemo node->n_config_file, node->n_config_line); nobrowse = pick_option("nobrowse", &options); - if (nobrowse != NULL && adr->adr_key[0] == '\0') { + if (nobrowse != NULL && key == NULL) { log_debugx("skipping map %s due to \"nobrowse\" " "option; exiting", map); done(0, true); @@ -265,12 +278,12 @@ handle_request(const struct autofs_daemo */ create_subtree(node, incomplete_hierarchy); - if (incomplete_hierarchy && adr->adr_key[0] != '\0') { + if (incomplete_hierarchy && key != NULL) { /* * We still need to create the single subdirectory * user is trying to access. */ - tmp = concat(adr->adr_path, '/', adr->adr_key); + tmp = concat(adr->adr_path, '/', key); node = node_find(root, tmp); if (node != NULL) create_subtree(node, false); @@ -288,8 +301,8 @@ handle_request(const struct autofs_daemo log_debugx("found node defined at %s:%d; it is a mountpoint", node->n_config_file, node->n_config_line); - node_expand_ampersand(node, - adr->adr_key[0] != '\0' ? adr->adr_key : NULL); + if (key != NULL) + node_expand_ampersand(node, key); error = node_expand_defined(node); if (error != 0) { log_errx(1, "variable expansion failed for %s; " From owner-svn-src-stable-10@FreeBSD.ORG Thu May 21 13:42:39 2015 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.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 28AFE93B; Thu, 21 May 2015 13:42: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 092931F43; Thu, 21 May 2015 13:42:39 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4LDgcXx008995; Thu, 21 May 2015 13:42:38 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4LDgcTb008991; Thu, 21 May 2015 13:42:38 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201505211342.t4LDgcTb008991@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Thu, 21 May 2015 13:42:38 +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: r283242 - in stable/10: etc etc/autofs usr.sbin/autofs 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.20 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, 21 May 2015 13:42:39 -0000 Author: trasz Date: Thu May 21 13:42:37 2015 New Revision: 283242 URL: https://svnweb.freebsd.org/changeset/base/283242 Log: MFC r279955: Add -noauto autofs map, for automatic handling of fstab entries marked "noauto". Relnotes: yes Sponsored by: The FreeBSD Foundation Added: stable/10/etc/autofs/special_noauto - copied unchanged from r279955, head/etc/autofs/special_noauto Modified: stable/10/etc/auto_master stable/10/etc/autofs/Makefile stable/10/usr.sbin/autofs/auto_master.5 Directory Properties: stable/10/ (props changed) Modified: stable/10/etc/auto_master ============================================================================== --- stable/10/etc/auto_master Thu May 21 13:41:08 2015 (r283241) +++ stable/10/etc/auto_master Thu May 21 13:42:37 2015 (r283242) @@ -6,3 +6,4 @@ # When using the -media special map, make sure to edit devd.conf(5) # to move the call to "automount -c" out of the comments section. #/media -media -nosuid +#/- -noauto Modified: stable/10/etc/autofs/Makefile ============================================================================== --- stable/10/etc/autofs/Makefile Thu May 21 13:41:08 2015 (r283241) +++ stable/10/etc/autofs/Makefile Thu May 21 13:42:37 2015 (r283242) @@ -1,6 +1,6 @@ # $FreeBSD$ -FILES= include_ldap special_hosts special_media special_null +FILES= include_ldap special_hosts special_media special_noauto special_null NO_OBJ= FILESDIR= /etc/autofs Copied: stable/10/etc/autofs/special_noauto (from r279955, head/etc/autofs/special_noauto) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/etc/autofs/special_noauto Thu May 21 13:42:37 2015 (r283242, copy of r279955, head/etc/autofs/special_noauto) @@ -0,0 +1,29 @@ +#!/bin/sh +# +# $FreeBSD$ +# + +print_available() { + sed 's/#.*//' /etc/fstab | awk '$4 ~ /noauto/ { print $2 }' +} + +print_one() { + local _mntpoint + + _mntpoint="${1%/}" + + sed 's/#.*//' /etc/fstab | awk ' + $2 == "'"${_mntpoint}"'" && $4 ~ /noauto/ { + if ($1 ~ /:/) { dev=$1 } else { dev=":"$1 } + print "-fstype=" $3 "," $4, dev + }' +} + +if [ $# -eq 0 ]; then + print_available + exit 0 +fi + +print_one "$1" +exit 0 + Modified: stable/10/usr.sbin/autofs/auto_master.5 ============================================================================== --- stable/10/usr.sbin/autofs/auto_master.5 Thu May 21 13:41:08 2015 (r283241) +++ stable/10/usr.sbin/autofs/auto_master.5 Thu May 21 13:42:37 2015 (r283242) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 9, 2015 +.Dd March 13, 2015 .Dt AUTO_MASTER 5 .Os .Sh NAME @@ -260,6 +260,11 @@ when they are automatically created. .It Li -media Query devices that are not yet mounted, but contain valid filesystems. Generally used to access files on removable media. +.It Li -noauto +Mount filesystems configured in +.Xr fstab 5 +as "noauto". +This needs to be set up as a direct map. .It Li -null Prevent .Xr automountd 8 From owner-svn-src-stable-10@FreeBSD.ORG Thu May 21 16:44:33 2015 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2892C95E; Thu, 21 May 2015 16:44:33 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F0A111686; Thu, 21 May 2015 16:44:32 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4LGiW8G001503; Thu, 21 May 2015 16:44:32 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4LGiWa6001498; Thu, 21 May 2015 16:44:32 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201505211644.t4LGiWa6001498@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Thu, 21 May 2015 16:44: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: r283251 - in stable/10: . share/man/man9 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.20 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, 21 May 2015 16:44:33 -0000 Author: bdrewery Date: Thu May 21 16:44:31 2015 New Revision: 283251 URL: https://svnweb.freebsd.org/changeset/base/283251 Log: MFC r282574: Remove references to Giant in namei(9). This was removed in r241896. Modified: stable/10/ObsoleteFiles.inc stable/10/share/man/man9/Makefile stable/10/share/man/man9/namei.9 Directory Properties: stable/10/ (props changed) Modified: stable/10/ObsoleteFiles.inc ============================================================================== --- stable/10/ObsoleteFiles.inc Thu May 21 16:43:26 2015 (r283250) +++ stable/10/ObsoleteFiles.inc Thu May 21 16:44:31 2015 (r283251) @@ -38,6 +38,8 @@ # xargs -n1 | sort | uniq -d; # done +# 20150506 +OLD_FILES+=usr/share/man/man9/NDHASGIANT.9.gz # 20141205: convert sbin/mdconfig/tests to ATF format tests OLD_FILES+=usr/tests/sbin/mdconfig/legacy_test OLD_FILES+=usr/tests/sbin/mdconfig/mdconfig.test Modified: stable/10/share/man/man9/Makefile ============================================================================== --- stable/10/share/man/man9/Makefile Thu May 21 16:43:26 2015 (r283250) +++ stable/10/share/man/man9/Makefile Thu May 21 16:44:31 2015 (r283251) @@ -1001,7 +1001,6 @@ MLINKS+=mutex.9 mtx_assert.9 \ mutex.9 mtx_unlock_spin.9 \ mutex.9 mtx_unlock_spin_flags.9 MLINKS+=namei.9 NDFREE.9 \ - namei.9 NDHASGIANT.9 \ namei.9 NDINIT.9 MLINKS+=pbuf.9 getpbuf.9 \ pbuf.9 relpbuf.9 \ Modified: stable/10/share/man/man9/namei.9 ============================================================================== --- stable/10/share/man/man9/namei.9 Thu May 21 16:43:26 2015 (r283250) +++ stable/10/share/man/man9/namei.9 Thu May 21 16:44:31 2015 (r283251) @@ -33,14 +33,13 @@ .\" .\" $FreeBSD$ .\" -.Dd March 1, 2012 +.Dd May 6, 2015 .Dt NAMEI 9 .Os .Sh NAME .Nm namei , .Nm NDINIT , .Nm NDFREE , -.Nm NDHASGIANT .Nd pathname translation and lookup operations .Sh SYNOPSIS .In sys/param.h @@ -55,8 +54,6 @@ .Fc .Ft void .Fn NDFREE "struct nameidata *ndp" "const uint flags" -.Ft int -.Fn NDHASGIANT "struct nameidata *ndp" .Sh DESCRIPTION The .Nm @@ -73,16 +70,6 @@ or depending on whether the .Dv LOCKLEAF flag was specified or not. -If the -.Va Giant -lock is required, -.Nm -will acquire it if the caller indicates it is -.Dv MPSAFE , -in which case the caller must later release -.Va Giant -based on the results of -.Fn NDHASGIANT . .Pp The .Fn NDINIT @@ -362,6 +349,3 @@ In order to solve this for the cases whe and .Dv LOCKLEAF are used, it is necessary to resort to recursive locking. -.Pp -Non-MPSAFE file systems exist, requiring callers to conditionally unlock -.Va Giant . From owner-svn-src-stable-10@FreeBSD.ORG Thu May 21 18:59:12 2015 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.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9DD5A796; Thu, 21 May 2015 18:59:12 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 72C661867; Thu, 21 May 2015 18:59:12 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4LIxCkE070121; Thu, 21 May 2015 18:59:12 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4LIxCFx070119; Thu, 21 May 2015 18:59:12 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201505211859.t4LIxCFx070119@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Thu, 21 May 2015 18:59: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: r283258 - stable/10/bin/date 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.20 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, 21 May 2015 18:59:12 -0000 Author: delphij Date: Thu May 21 18:59:11 2015 New Revision: 283258 URL: https://svnweb.freebsd.org/changeset/base/283258 Log: MFC r282608: date(1): Make -r behave like GNU's version when the option can not be interpreted as a number, which checks the file's modification time and use that as the date/time value. This improves compatibility with GNU coreutils's version of date(1). Modified: stable/10/bin/date/date.1 stable/10/bin/date/date.c Directory Properties: stable/10/ (props changed) Modified: stable/10/bin/date/date.1 ============================================================================== --- stable/10/bin/date/date.1 Thu May 21 18:29:36 2015 (r283257) +++ stable/10/bin/date/date.1 Thu May 21 18:59:11 2015 (r283258) @@ -32,7 +32,7 @@ .\" @(#)date.1 8.3 (Berkeley) 4/28/95 .\" $FreeBSD$ .\" -.Dd April 26, 2014 +.Dd May 7, 2015 .Dt DATE 1 .Os .Sh NAME @@ -41,7 +41,7 @@ .Sh SYNOPSIS .Nm .Op Fl jRu -.Op Fl r Ar seconds +.Op Fl r Ar seconds | Ar filename .Oo .Fl v .Sm off @@ -150,6 +150,9 @@ is the number of seconds since the Epoch see .Xr time 3 ) , and can be specified in decimal, octal, or hex. +.It Fl r Ar filename +Print the date and time of the last modification of +.Ar filename . .It Fl t Ar minutes_west Set the system's value for minutes west of .Tn GMT . Modified: stable/10/bin/date/date.c ============================================================================== --- stable/10/bin/date/date.c Thu May 21 18:29:36 2015 (r283257) +++ stable/10/bin/date/date.c Thu May 21 18:59:11 2015 (r283258) @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -85,6 +86,7 @@ main(int argc, char *argv[]) struct vary *v; const struct vary *badv; struct tm lt; + struct stat sb; v = NULL; fmt = NULL; @@ -116,8 +118,12 @@ main(int argc, char *argv[]) case 'r': /* user specified seconds */ rflag = 1; tval = strtoq(optarg, &tmp, 0); - if (*tmp != 0) - usage(); + if (*tmp != 0) { + if (stat(optarg, &sb) == 0) + tval = sb.st_mtim.tv_sec; + else + usage(); + } break; case 't': /* minutes west of UTC */ /* error check; don't allow "PST" */ From owner-svn-src-stable-10@FreeBSD.ORG Thu May 21 19:05:48 2015 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4562D969; Thu, 21 May 2015 19:05: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 33F051949; Thu, 21 May 2015 19:05:48 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4LJ5mBt075029; Thu, 21 May 2015 19:05:48 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4LJ5lYN075027; Thu, 21 May 2015 19:05:47 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201505211905.t4LJ5lYN075027@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Thu, 21 May 2015 19:05:47 +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: r283259 - stable/10/contrib/libarchive/libarchive 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.20 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, 21 May 2015 19:05:48 -0000 Author: delphij Date: Thu May 21 19:05:47 2015 New Revision: 283259 URL: https://svnweb.freebsd.org/changeset/base/283259 Log: MFC r282932: MFV r282927,r282928,r282930 (kientzle): Don't segfault when reading malformed cpio archives. Modified: stable/10/contrib/libarchive/libarchive/archive_read.c stable/10/contrib/libarchive/libarchive/archive_read_support_format_cpio.c Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/libarchive/libarchive/archive_read.c ============================================================================== --- stable/10/contrib/libarchive/libarchive/archive_read.c Thu May 21 18:59:11 2015 (r283258) +++ stable/10/contrib/libarchive/libarchive/archive_read.c Thu May 21 19:05:47 2015 (r283259) @@ -1395,6 +1395,8 @@ __archive_read_filter_consume(struct arc { int64_t skipped; + if (request < 0) + return ARCHIVE_FATAL; if (request == 0) return 0; Modified: stable/10/contrib/libarchive/libarchive/archive_read_support_format_cpio.c ============================================================================== --- stable/10/contrib/libarchive/libarchive/archive_read_support_format_cpio.c Thu May 21 18:59:11 2015 (r283258) +++ stable/10/contrib/libarchive/libarchive/archive_read_support_format_cpio.c Thu May 21 19:05:47 2015 (r283259) @@ -198,7 +198,7 @@ static int archive_read_format_cpio_read static int archive_read_format_cpio_read_header(struct archive_read *, struct archive_entry *); static int archive_read_format_cpio_skip(struct archive_read *); -static int be4(const unsigned char *); +static int64_t be4(const unsigned char *); static int find_odc_header(struct archive_read *); static int find_newc_header(struct archive_read *); static int header_bin_be(struct archive_read *, struct cpio *, @@ -213,7 +213,7 @@ static int header_afiol(struct archive_r struct archive_entry *, size_t *, size_t *); static int is_octal(const char *, size_t); static int is_hex(const char *, size_t); -static int le4(const unsigned char *); +static int64_t le4(const unsigned char *); static int record_hardlink(struct archive_read *a, struct cpio *cpio, struct archive_entry *entry); @@ -864,8 +864,11 @@ header_bin_le(struct archive_read *a, st /* Read fixed-size portion of header. */ h = __archive_read_ahead(a, bin_header_size, NULL); - if (h == NULL) + if (h == NULL) { + archive_set_error(&a->archive, 0, + "End of file trying to read next cpio header"); return (ARCHIVE_FATAL); + } /* Parse out binary fields. */ header = (const unsigned char *)h; @@ -900,8 +903,11 @@ header_bin_be(struct archive_read *a, st /* Read fixed-size portion of header. */ h = __archive_read_ahead(a, bin_header_size, NULL); - if (h == NULL) + if (h == NULL) { + archive_set_error(&a->archive, 0, + "End of file trying to read next cpio header"); return (ARCHIVE_FATAL); + } /* Parse out binary fields. */ header = (const unsigned char *)h; @@ -944,17 +950,17 @@ archive_read_format_cpio_cleanup(struct return (ARCHIVE_OK); } -static int +static int64_t le4(const unsigned char *p) { - return ((p[0]<<16) + (p[1]<<24) + (p[2]<<0) + (p[3]<<8)); + return ((p[0] << 16) + (((int64_t)p[1]) << 24) + (p[2] << 0) + (p[3] << 8)); } -static int +static int64_t be4(const unsigned char *p) { - return ((p[0]<<24) + (p[1]<<16) + (p[2]<<8) + (p[3])); + return ((((int64_t)p[0]) << 24) + (p[1] << 16) + (p[2] << 8) + (p[3])); } /* From owner-svn-src-stable-10@FreeBSD.ORG Thu May 21 19:16:28 2015 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D255CD9F; Thu, 21 May 2015 19:16: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A67761AAA; Thu, 21 May 2015 19:16:28 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4LJGSxE080218; Thu, 21 May 2015 19:16:28 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4LJGSCj080217; Thu, 21 May 2015 19:16:28 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201505211916.t4LJGSCj080217@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 21 May 2015 19:16: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: r283260 - stable/10/usr.sbin/crunch/crunchide 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.20 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, 21 May 2015 19:16:28 -0000 Author: emaste Date: Thu May 21 19:16:28 2015 New Revision: 283260 URL: https://svnweb.freebsd.org/changeset/base/283260 Log: MFC r282144: crunchide: add basic string table sanity checks Reported by: Coverity Scan CID: 978805, 980919 Sponsored by: The FreeBSD Foundation Modified: stable/10/usr.sbin/crunch/crunchide/exec_elf32.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/crunch/crunchide/exec_elf32.c ============================================================================== --- stable/10/usr.sbin/crunch/crunchide/exec_elf32.c Thu May 21 19:05:47 2015 (r283259) +++ stable/10/usr.sbin/crunch/crunchide/exec_elf32.c Thu May 21 19:16:28 2015 (r283260) @@ -342,11 +342,14 @@ ELFNAMEEND(hide)(int fd, const char *fn) */ /* load section string table for debug use */ - if ((shstrtabp = xmalloc(xewtoh(shstrtabshdr->sh_size), fn, - "section string table")) == NULL) + if ((size = xewtoh(shstrtabshdr->sh_size)) == 0) + goto bad; + if ((shstrtabp = xmalloc(size, fn, "section string table")) == NULL) goto bad; if ((size_t)xreadatoff(fd, shstrtabp, xewtoh(shstrtabshdr->sh_offset), - xewtoh(shstrtabshdr->sh_size), fn) != xewtoh(shstrtabshdr->sh_size)) + size, fn) != size) + goto bad; + if (shstrtabp[size - 1] != '\0') goto bad; /* we need symtab, strtab, and everything behind strtab */ @@ -367,7 +370,8 @@ ELFNAMEEND(hide)(int fd, const char *fn) strtabidx = i; if (layoutp[i].shdr == symtabshdr || i >= strtabidx) { off = xewtoh(layoutp[i].shdr->sh_offset); - size = xewtoh(layoutp[i].shdr->sh_size); + if ((size = xewtoh(layoutp[i].shdr->sh_size)) == 0) + goto bad; layoutp[i].bufp = xmalloc(size, fn, shstrtabp + xewtoh(layoutp[i].shdr->sh_name)); if (layoutp[i].bufp == NULL) @@ -377,10 +381,13 @@ ELFNAMEEND(hide)(int fd, const char *fn) goto bad; /* set symbol table and string table */ - if (layoutp[i].shdr == symtabshdr) + if (layoutp[i].shdr == symtabshdr) { symtabp = layoutp[i].bufp; - else if (layoutp[i].shdr == strtabshdr) + } else if (layoutp[i].shdr == strtabshdr) { strtabp = layoutp[i].bufp; + if (strtabp[size - 1] != '\0') + goto bad; + } } } From owner-svn-src-stable-10@FreeBSD.ORG Thu May 21 19:40:32 2015 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A072C394; Thu, 21 May 2015 19:40: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8F22B1D2E; Thu, 21 May 2015 19:40:32 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4LJeWqd090642; Thu, 21 May 2015 19:40:32 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4LJeW3M090641; Thu, 21 May 2015 19:40:32 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201505211940.t4LJeW3M090641@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 21 May 2015 19:40: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: r283262 - stable/10/sys/amd64/amd64 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.20 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, 21 May 2015 19:40:32 -0000 Author: emaste Date: Thu May 21 19:40:31 2015 New Revision: 283262 URL: https://svnweb.freebsd.org/changeset/base/283262 Log: MFC r258431: Disable amd64 boot time memory test by default The page presence memory test takes a long time on large memory systems and has little value on contemporary amd64 hardware. Relnotes: Yes Reviewed by: jhb, kib Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D1544 Modified: stable/10/sys/amd64/amd64/machdep.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/amd64/amd64/machdep.c ============================================================================== --- stable/10/sys/amd64/amd64/machdep.c Thu May 21 19:31:10 2015 (r283261) +++ stable/10/sys/amd64/amd64/machdep.c Thu May 21 19:40:31 2015 (r283262) @@ -1590,13 +1590,15 @@ getmemsize(caddr_t kmdp, u_int64_t first Maxmem = atop(physmem_tunable); /* - * By default enable the memory test on real hardware, and disable - * it if we appear to be running in a VM. This avoids touching all - * pages unnecessarily, which doesn't matter on real hardware but is - * bad for shared VM hosts. Use a general name so that - * one could eventually do more with the code than just disable it. + * The boot memory test is disabled by default, as it takes a + * significant amount of time on large-memory systems, and is + * unfriendly to virtual machines as it unnecessarily touches all + * pages. + * + * A general name is used as the code may be extended to support + * additional tests beyond the current "page present" test. */ - memtest = (vm_guest > VM_GUEST_NO) ? 0 : 1; + memtest = 0; TUNABLE_ULONG_FETCH("hw.memtest.tests", &memtest); /* From owner-svn-src-stable-10@FreeBSD.ORG Thu May 21 20:39:39 2015 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.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DB6DA70D; Thu, 21 May 2015 20:39: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C8D6E1448; Thu, 21 May 2015 20:39:39 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4LKddcd020652; Thu, 21 May 2015 20:39:39 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4LKddQh020651; Thu, 21 May 2015 20:39:39 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201505212039.t4LKddQh020651@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Thu, 21 May 2015 20:39: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: r283267 - stable/10/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.20 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, 21 May 2015 20:39:40 -0000 Author: pfg Date: Thu May 21 20:39:39 2015 New Revision: 283267 URL: https://svnweb.freebsd.org/changeset/base/283267 Log: MFC r282863: Adjust visibility macros. The GCC visibility attributes were introduced in GCC 4.0. Apparently the "protected" attribute was introduced only until GCC 4.2, but we are not currently using it. Modified: stable/10/sys/sys/cdefs.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/sys/cdefs.h ============================================================================== --- stable/10/sys/sys/cdefs.h Thu May 21 20:22:55 2015 (r283266) +++ stable/10/sys/sys/cdefs.h Thu May 21 20:39:39 2015 (r283267) @@ -439,7 +439,7 @@ #define __predict_false(exp) (exp) #endif -#if __GNUC_PREREQ__(4, 2) +#if __GNUC_PREREQ__(4, 0) #define __hidden __attribute__((__visibility__("hidden"))) #define __exported __attribute__((__visibility__("default"))) #else From owner-svn-src-stable-10@FreeBSD.ORG Thu May 21 21:45:38 2015 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.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C4650D48; Thu, 21 May 2015 21:45:38 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A4A101C58; Thu, 21 May 2015 21:45:38 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4LLjcte058423; Thu, 21 May 2015 21:45:38 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4LLjcvn058422; Thu, 21 May 2015 21:45:38 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201505212145.t4LLjcvn058422@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Thu, 21 May 2015 21:45:38 +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: r283270 - stable/10/contrib/netcat 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.20 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, 21 May 2015 21:45:38 -0000 Author: delphij Date: Thu May 21 21:45:37 2015 New Revision: 283270 URL: https://svnweb.freebsd.org/changeset/base/283270 Log: MFC r282613: MFV r282611: netcat from OpenBSD 5.7. Modified: stable/10/contrib/netcat/netcat.c Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/netcat/netcat.c ============================================================================== --- stable/10/contrib/netcat/netcat.c Thu May 21 20:47:19 2015 (r283269) +++ stable/10/contrib/netcat/netcat.c Thu May 21 21:45:37 2015 (r283270) @@ -1,4 +1,4 @@ -/* $OpenBSD: netcat.c,v 1.122 2014/07/20 01:38:40 guenther Exp $ */ +/* $OpenBSD: netcat.c,v 1.127 2015/02/14 22:40:22 jca Exp $ */ /* * Copyright (c) 2001 Eric Jackson * @@ -42,7 +42,6 @@ #include #include -#include #ifdef IPSEC #include #endif @@ -73,6 +72,12 @@ #define PORT_MAX_LEN 6 #define UNIX_DG_TMP_SOCKET_SIZE 19 +#define POLL_STDIN 0 +#define POLL_NETOUT 1 +#define POLL_NETIN 2 +#define POLL_STDOUT 3 +#define BUFSIZE 16384 + /* Command Line Options */ int dflag; /* detached, no stdin */ int Fflag; /* fdpass sock to stdout */ @@ -117,10 +122,12 @@ int udptest(int); int unix_bind(char *); int unix_connect(char *); int unix_listen(char *); -void set_common_sockopts(int); +void set_common_sockopts(int, int); int map_tos(char *, int *); void report_connect(const struct sockaddr *, socklen_t); void usage(int); +ssize_t drainbuf(int, unsigned char *, size_t *); +ssize_t fillbuf(int, unsigned char *, size_t *); #ifdef IPSEC void add_ipsec_policy(int, char *); @@ -436,7 +443,7 @@ main(int argc, char *argv[]) &len); if (connfd == -1) { /* For now, all errnos are fatal */ - err(1, "accept"); + err(1, "accept"); } if (vflag) report_connect((struct sockaddr *)&cliaddr, len); @@ -663,7 +670,7 @@ remote_connect(const char *host, const c freeaddrinfo(ares); } - set_common_sockopts(s); + set_common_sockopts(s, res0->ai_family); if (timeout_connect(s, res0->ai_addr, res0->ai_addrlen) == 0) break; @@ -767,6 +774,8 @@ local_listen(char *host, char *port, str err(1, "disable TCP options"); } + set_common_sockopts(s, res0->ai_family); + if (bind(s, (struct sockaddr *)res0->ai_addr, res0->ai_addrlen) == 0) break; @@ -790,68 +799,224 @@ local_listen(char *host, char *port, str * Loop that polls on the network file descriptor and stdin. */ void -readwrite(int nfd) +readwrite(int net_fd) { - struct pollfd pfd[2]; - unsigned char buf[16 * 1024]; - int n, wfd = fileno(stdin); - int lfd = fileno(stdout); - int plen; - - plen = sizeof(buf); - - /* Setup Network FD */ - pfd[0].fd = nfd; - pfd[0].events = POLLIN; - - /* Set up STDIN FD. */ - pfd[1].fd = wfd; - pfd[1].events = POLLIN; + struct pollfd pfd[4]; + int stdin_fd = STDIN_FILENO; + int stdout_fd = STDOUT_FILENO; + unsigned char netinbuf[BUFSIZE]; + size_t netinbufpos = 0; + unsigned char stdinbuf[BUFSIZE]; + size_t stdinbufpos = 0; + int n, num_fds; + ssize_t ret; + + /* don't read from stdin if requested */ + if (dflag) + stdin_fd = -1; + + /* stdin */ + pfd[POLL_STDIN].fd = stdin_fd; + pfd[POLL_STDIN].events = POLLIN; + + /* network out */ + pfd[POLL_NETOUT].fd = net_fd; + pfd[POLL_NETOUT].events = 0; + + /* network in */ + pfd[POLL_NETIN].fd = net_fd; + pfd[POLL_NETIN].events = POLLIN; + + /* stdout */ + pfd[POLL_STDOUT].fd = stdout_fd; + pfd[POLL_STDOUT].events = 0; + + while (1) { + /* both inputs are gone, buffers are empty, we are done */ + if (pfd[POLL_STDIN].fd == -1 && pfd[POLL_NETIN].fd == -1 + && stdinbufpos == 0 && netinbufpos == 0) { + close(net_fd); + return; + } + /* both outputs are gone, we can't continue */ + if (pfd[POLL_NETOUT].fd == -1 && pfd[POLL_STDOUT].fd == -1) { + close(net_fd); + return; + } + /* listen and net in gone, queues empty, done */ + if (lflag && pfd[POLL_NETIN].fd == -1 + && stdinbufpos == 0 && netinbufpos == 0) { + close(net_fd); + return; + } - while (pfd[0].fd != -1) { + /* help says -i is for "wait between lines sent". We read and + * write arbitrary amounts of data, and we don't want to start + * scanning for newlines, so this is as good as it gets */ if (iflag) sleep(iflag); - if ((n = poll(pfd, 2 - dflag, timeout)) < 0) { - int saved_errno = errno; - close(nfd); - errc(1, saved_errno, "Polling Error"); + /* poll */ + num_fds = poll(pfd, 4, timeout); + + /* treat poll errors */ + if (num_fds == -1) { + close(net_fd); + err(1, "polling error"); } - if (n == 0) + /* timeout happened */ + if (num_fds == 0) return; - if (pfd[0].revents & POLLIN) { - if ((n = read(nfd, buf, plen)) < 0) - return; - else if (n == 0) { - shutdown(nfd, SHUT_RD); - pfd[0].fd = -1; - pfd[0].events = 0; - } else { - if (tflag) - atelnet(nfd, buf, n); - if (atomicio(vwrite, lfd, buf, n) != n) - return; + /* treat socket error conditions */ + for (n = 0; n < 4; n++) { + if (pfd[n].revents & (POLLERR|POLLNVAL)) { + pfd[n].fd = -1; } } + /* reading is possible after HUP */ + if (pfd[POLL_STDIN].events & POLLIN && + pfd[POLL_STDIN].revents & POLLHUP && + ! (pfd[POLL_STDIN].revents & POLLIN)) + pfd[POLL_STDIN].fd = -1; + + if (pfd[POLL_NETIN].events & POLLIN && + pfd[POLL_NETIN].revents & POLLHUP && + ! (pfd[POLL_NETIN].revents & POLLIN)) + pfd[POLL_NETIN].fd = -1; + + if (pfd[POLL_NETOUT].revents & POLLHUP) { + if (Nflag) + shutdown(pfd[POLL_NETOUT].fd, SHUT_WR); + pfd[POLL_NETOUT].fd = -1; + } + /* if HUP, stop watching stdout */ + if (pfd[POLL_STDOUT].revents & POLLHUP) + pfd[POLL_STDOUT].fd = -1; + /* if no net out, stop watching stdin */ + if (pfd[POLL_NETOUT].fd == -1) + pfd[POLL_STDIN].fd = -1; + /* if no stdout, stop watching net in */ + if (pfd[POLL_STDOUT].fd == -1) { + if (pfd[POLL_NETIN].fd != -1) + shutdown(pfd[POLL_NETIN].fd, SHUT_RD); + pfd[POLL_NETIN].fd = -1; + } - if (!dflag && pfd[1].revents & POLLIN) { - if ((n = read(wfd, buf, plen)) < 0) - return; - else if (n == 0) { - if (Nflag) - shutdown(nfd, SHUT_WR); - pfd[1].fd = -1; - pfd[1].events = 0; - } else { - if (atomicio(vwrite, nfd, buf, n) != n) - return; + /* try to read from stdin */ + if (pfd[POLL_STDIN].revents & POLLIN && stdinbufpos < BUFSIZE) { + ret = fillbuf(pfd[POLL_STDIN].fd, stdinbuf, + &stdinbufpos); + /* error or eof on stdin - remove from pfd */ + if (ret == 0 || ret == -1) + pfd[POLL_STDIN].fd = -1; + /* read something - poll net out */ + if (stdinbufpos > 0) + pfd[POLL_NETOUT].events = POLLOUT; + /* filled buffer - remove self from polling */ + if (stdinbufpos == BUFSIZE) + pfd[POLL_STDIN].events = 0; + } + /* try to write to network */ + if (pfd[POLL_NETOUT].revents & POLLOUT && stdinbufpos > 0) { + ret = drainbuf(pfd[POLL_NETOUT].fd, stdinbuf, + &stdinbufpos); + if (ret == -1) + pfd[POLL_NETOUT].fd = -1; + /* buffer empty - remove self from polling */ + if (stdinbufpos == 0) + pfd[POLL_NETOUT].events = 0; + /* buffer no longer full - poll stdin again */ + if (stdinbufpos < BUFSIZE) + pfd[POLL_STDIN].events = POLLIN; + } + /* try to read from network */ + if (pfd[POLL_NETIN].revents & POLLIN && netinbufpos < BUFSIZE) { + ret = fillbuf(pfd[POLL_NETIN].fd, netinbuf, + &netinbufpos); + if (ret == -1) + pfd[POLL_NETIN].fd = -1; + /* eof on net in - remove from pfd */ + if (ret == 0) { + shutdown(pfd[POLL_NETIN].fd, SHUT_RD); + pfd[POLL_NETIN].fd = -1; } + /* read something - poll stdout */ + if (netinbufpos > 0) + pfd[POLL_STDOUT].events = POLLOUT; + /* filled buffer - remove self from polling */ + if (netinbufpos == BUFSIZE) + pfd[POLL_NETIN].events = 0; + /* handle telnet */ + if (tflag) + atelnet(pfd[POLL_NETIN].fd, netinbuf, + netinbufpos); + } + /* try to write to stdout */ + if (pfd[POLL_STDOUT].revents & POLLOUT && netinbufpos > 0) { + ret = drainbuf(pfd[POLL_STDOUT].fd, netinbuf, + &netinbufpos); + if (ret == -1) + pfd[POLL_STDOUT].fd = -1; + /* buffer empty - remove self from polling */ + if (netinbufpos == 0) + pfd[POLL_STDOUT].events = 0; + /* buffer no longer full - poll net in again */ + if (netinbufpos < BUFSIZE) + pfd[POLL_NETIN].events = POLLIN; + } + + /* stdin gone and queue empty? */ + if (pfd[POLL_STDIN].fd == -1 && stdinbufpos == 0) { + if (pfd[POLL_NETOUT].fd != -1 && Nflag) + shutdown(pfd[POLL_NETOUT].fd, SHUT_WR); + pfd[POLL_NETOUT].fd = -1; + } + /* net in gone and queue empty? */ + if (pfd[POLL_NETIN].fd == -1 && netinbufpos == 0) { + pfd[POLL_STDOUT].fd = -1; } } } +ssize_t +drainbuf(int fd, unsigned char *buf, size_t *bufpos) +{ + ssize_t n; + ssize_t adjust; + + n = write(fd, buf, *bufpos); + /* don't treat EAGAIN, EINTR as error */ + if (n == -1 && (errno == EAGAIN || errno == EINTR)) + n = -2; + if (n <= 0) + return n; + /* adjust buffer */ + adjust = *bufpos - n; + if (adjust > 0) + memmove(buf, buf + n, adjust); + *bufpos -= n; + return n; +} + + +ssize_t +fillbuf(int fd, unsigned char *buf, size_t *bufpos) +{ + size_t num = BUFSIZE - *bufpos; + ssize_t n; + + n = read(fd, buf + *bufpos, num); + /* don't treat EAGAIN, EINTR as error */ + if (n == -1 && (errno == EAGAIN || errno == EINTR)) + n = -2; + if (n <= 0) + return n; + *bufpos += n; + return n; +} + /* * fdpass() * Pass the connected file descriptor to stdout and exit. @@ -1025,7 +1190,7 @@ udptest(int s) } void -set_common_sockopts(int s) +set_common_sockopts(int s, int af) { int x = 1; @@ -1040,8 +1205,17 @@ set_common_sockopts(int s) err(1, NULL); } if (Tflag != -1) { - if (setsockopt(s, IPPROTO_IP, IP_TOS, - &Tflag, sizeof(Tflag)) == -1) + int proto, option; + + if (af == AF_INET6) { + proto = IPPROTO_IPV6; + option = IPV6_TCLASS; + } else { + proto = IPPROTO_IP; + option = IP_TOS; + } + + if (setsockopt(s, proto, option, &Tflag, sizeof(Tflag)) == -1) err(1, "set IP ToS"); } if (Iflag) { From owner-svn-src-stable-10@FreeBSD.ORG Fri May 22 04:27:20 2015 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.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A4BED472 for ; Fri, 22 May 2015 04:27:20 +0000 (UTC) Received: from mail-la0-f41.google.com (mail-la0-f41.google.com [209.85.215.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 310621629 for ; Fri, 22 May 2015 04:27:19 +0000 (UTC) Received: by laat2 with SMTP id t2so4578312laa.1 for ; Thu, 21 May 2015 21:27:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :subject:references:in-reply-to:content-type :content-transfer-encoding; bh=JkVdDLIiAD958ftCtOTUos0kWUXqFzM3uhHWPgos7F0=; b=HsfoiOqqo0eD2pvJn3DR1WHr92OKeEGQTF4sSoAV7IVTyV2QbLTfNsjdNyIRupkrDA j8AVffSEGB1KefuIMCCFGTIqtTIYuOZnQKeXb3NO+I56sB6l8AK6auhquxRgTYqPRkIX KHEk9TGJqaub2tJmmNXTC3qEX+R0WPeawhez5r4dYiIuS+WtMJv7DjcTHNHaaRaMjxGU tOaqhnJCA0vagHCXAZdtRFnA9nOyRtBZjJGuNF9oIwFgLHEOS2szaWmWVkdpua6fnbAM ULynNws9wMvN5WVkejHJbYNSkS+MI2HW/ypHulmBScvN4p0E5xy714NfylsVKWEG72r5 Kxig== X-Gm-Message-State: ALoCoQn0xt24pdIKQZZODhiVprpTeMECaufu6Sqe8Rg0/ZCPm4tM2Tuev1R/UykYzft8frnebbGT X-Received: by 10.153.6.36 with SMTP id cr4mr4948449lad.56.1432268832124; Thu, 21 May 2015 21:27:12 -0700 (PDT) Received: from [192.168.1.2] ([89.169.173.68]) by mx.google.com with ESMTPSA id kb5sm211229lbc.16.2015.05.21.21.27.10 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 21 May 2015 21:27:11 -0700 (PDT) Message-ID: <555EB01C.6020805@freebsd.org> Date: Fri, 22 May 2015 07:27:08 +0300 From: Andrey Chernov User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Xin LI , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: Re: svn commit: r283258 - stable/10/bin/date References: <201505211859.t4LIxCFx070119@svn.freebsd.org> In-Reply-To: <201505211859.t4LIxCFx070119@svn.freebsd.org> Content-Type: text/plain; charset=koi8-r Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 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, 22 May 2015 04:27:20 -0000 On 21.05.2015 21:59, Xin LI wrote: > Author: delphij > Date: Thu May 21 18:59:11 2015 > New Revision: 283258 > URL: https://svnweb.freebsd.org/changeset/base/283258 > > Log: > MFC r282608: > > date(1): Make -r behave like GNU's version when the option can not be > interpreted as a number, which checks the file's modification time and > use that as the date/time value. > > This improves compatibility with GNU coreutils's version of date(1). This is ambiguous. What about, say, file '222'? Doing strtoq() first makes such files not handled and doing stat() first (if the file exists by chance) makes such dates not handled. GNU date always uses -r/--reference for files only. Perhaps it will be better to just add long option --reference for files. > > Modified: > stable/10/bin/date/date.1 > stable/10/bin/date/date.c > Directory Properties: > stable/10/ (props changed) > > Modified: stable/10/bin/date/date.1 > ============================================================================== > --- stable/10/bin/date/date.1 Thu May 21 18:29:36 2015 (r283257) > +++ stable/10/bin/date/date.1 Thu May 21 18:59:11 2015 (r283258) > @@ -32,7 +32,7 @@ > .\" @(#)date.1 8.3 (Berkeley) 4/28/95 > .\" $FreeBSD$ > .\" > -.Dd April 26, 2014 > +.Dd May 7, 2015 > .Dt DATE 1 > .Os > .Sh NAME > @@ -41,7 +41,7 @@ > .Sh SYNOPSIS > .Nm > .Op Fl jRu > -.Op Fl r Ar seconds > +.Op Fl r Ar seconds | Ar filename > .Oo > .Fl v > .Sm off > @@ -150,6 +150,9 @@ is the number of seconds since the Epoch > see > .Xr time 3 ) , > and can be specified in decimal, octal, or hex. > +.It Fl r Ar filename > +Print the date and time of the last modification of > +.Ar filename . > .It Fl t Ar minutes_west > Set the system's value for minutes west of > .Tn GMT . > > Modified: stable/10/bin/date/date.c > ============================================================================== > --- stable/10/bin/date/date.c Thu May 21 18:29:36 2015 (r283257) > +++ stable/10/bin/date/date.c Thu May 21 18:59:11 2015 (r283258) > @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); > > #include > #include > +#include > > #include > #include > @@ -85,6 +86,7 @@ main(int argc, char *argv[]) > struct vary *v; > const struct vary *badv; > struct tm lt; > + struct stat sb; > > v = NULL; > fmt = NULL; > @@ -116,8 +118,12 @@ main(int argc, char *argv[]) > case 'r': /* user specified seconds */ > rflag = 1; > tval = strtoq(optarg, &tmp, 0); > - if (*tmp != 0) > - usage(); > + if (*tmp != 0) { > + if (stat(optarg, &sb) == 0) > + tval = sb.st_mtim.tv_sec; > + else > + usage(); > + } > break; > case 't': /* minutes west of UTC */ > /* error check; don't allow "PST" */ > -- http://ache.vniz.net/ From owner-svn-src-stable-10@FreeBSD.ORG Fri May 22 08:11:32 2015 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 55783C9F; Fri, 22 May 2015 08:11: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 437661ED2; Fri, 22 May 2015 08:11:32 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4M8BWSx067680; Fri, 22 May 2015 08:11:32 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4M8BVrQ067677; Fri, 22 May 2015 08:11:31 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201505220811.t4M8BVrQ067677@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 22 May 2015 08:11:31 +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: r283279 - in stable/10/sys: kern 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.20 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, 22 May 2015 08:11:32 -0000 Author: kib Date: Fri May 22 08:11:31 2015 New Revision: 283279 URL: https://svnweb.freebsd.org/changeset/base/283279 Log: MFC r282944: Decrement p_boundary_count in the single-threading thread, during making other thread runnable. This guarantees that upon return from the thread_single_end(), p_boundary_count is zero. Modified: stable/10/sys/kern/kern_thread.c stable/10/sys/sys/proc.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/kern_thread.c ============================================================================== --- stable/10/sys/kern/kern_thread.c Fri May 22 07:39:21 2015 (r283278) +++ stable/10/sys/kern/kern_thread.c Fri May 22 08:11:31 2015 (r283279) @@ -75,6 +75,8 @@ static struct mtx zombie_lock; MTX_SYSINIT(zombie_lock, &zombie_lock, "zombie lock", MTX_SPIN); static void thread_zombie(struct thread *); +static int thread_unsuspend_one(struct thread *td, struct proc *p, + bool boundary); #define TID_BUFFER_SIZE 1024 @@ -446,7 +448,7 @@ thread_exit(void) if (p->p_numthreads == p->p_suspcount) { thread_lock(p->p_singlethread); wakeup_swapper = thread_unsuspend_one( - p->p_singlethread, p); + p->p_singlethread, p, false); thread_unlock(p->p_singlethread); if (wakeup_swapper) kick_proc0(); @@ -602,19 +604,19 @@ weed_inhib(int mode, struct thread *td2, switch (mode) { case SINGLE_EXIT: if (TD_IS_SUSPENDED(td2)) - wakeup_swapper |= thread_unsuspend_one(td2, p); + wakeup_swapper |= thread_unsuspend_one(td2, p, true); if (TD_ON_SLEEPQ(td2) && (td2->td_flags & TDF_SINTR) != 0) wakeup_swapper |= sleepq_abort(td2, EINTR); break; case SINGLE_BOUNDARY: if (TD_IS_SUSPENDED(td2) && (td2->td_flags & TDF_BOUNDARY) == 0) - wakeup_swapper |= thread_unsuspend_one(td2, p); + wakeup_swapper |= thread_unsuspend_one(td2, p, false); if (TD_ON_SLEEPQ(td2) && (td2->td_flags & TDF_SINTR) != 0) wakeup_swapper |= sleepq_abort(td2, ERESTART); break; case SINGLE_NO_EXIT: if (TD_IS_SUSPENDED(td2) && (td2->td_flags & TDF_BOUNDARY) == 0) - wakeup_swapper |= thread_unsuspend_one(td2, p); + wakeup_swapper |= thread_unsuspend_one(td2, p, false); if (TD_ON_SLEEPQ(td2) && (td2->td_flags & TDF_SINTR) != 0) wakeup_swapper |= sleepq_abort(td2, ERESTART); break; @@ -629,7 +631,7 @@ weed_inhib(int mode, struct thread *td2, */ if (TD_IS_SUSPENDED(td2) && (td2->td_flags & (TDF_BOUNDARY | TDF_ALLPROCSUSP)) == 0) - wakeup_swapper |= thread_unsuspend_one(td2, p); + wakeup_swapper |= thread_unsuspend_one(td2, p, false); if (TD_ON_SLEEPQ(td2) && (td2->td_flags & TDF_SINTR) != 0) { if ((td2->td_flags & TDF_SBDRY) == 0) { thread_suspend_one(td2); @@ -897,8 +899,8 @@ thread_suspend_check(int return_instead) if (P_SHOULDSTOP(p) == P_STOPPED_SINGLE) { if (p->p_numthreads == p->p_suspcount + 1) { thread_lock(p->p_singlethread); - wakeup_swapper = - thread_unsuspend_one(p->p_singlethread, p); + wakeup_swapper = thread_unsuspend_one( + p->p_singlethread, p, false); thread_unlock(p->p_singlethread); if (wakeup_swapper) kick_proc0(); @@ -917,15 +919,8 @@ thread_suspend_check(int return_instead) } PROC_SUNLOCK(p); mi_switch(SW_INVOL | SWT_SUSPEND, NULL); - if (return_instead == 0) - td->td_flags &= ~TDF_BOUNDARY; thread_unlock(td); PROC_LOCK(p); - if (return_instead == 0) { - PROC_SLOCK(p); - p->p_boundary_count--; - PROC_SUNLOCK(p); - } } return (0); } @@ -974,8 +969,8 @@ thread_suspend_one(struct thread *td) sched_sleep(td, 0); } -int -thread_unsuspend_one(struct thread *td, struct proc *p) +static int +thread_unsuspend_one(struct thread *td, struct proc *p, bool boundary) { THREAD_LOCK_ASSERT(td, MA_OWNED); @@ -985,6 +980,10 @@ thread_unsuspend_one(struct thread *td, if (td->td_proc == p) { PROC_SLOCK_ASSERT(p, MA_OWNED); p->p_suspcount--; + if (boundary && (td->td_flags & TDF_BOUNDARY) != 0) { + td->td_flags &= ~TDF_BOUNDARY; + p->p_boundary_count--; + } } return (setrunnable(td)); } @@ -1005,12 +1004,13 @@ thread_unsuspend(struct proc *p) FOREACH_THREAD_IN_PROC(p, td) { thread_lock(td); if (TD_IS_SUSPENDED(td)) { - wakeup_swapper |= thread_unsuspend_one(td, p); + wakeup_swapper |= thread_unsuspend_one(td, p, + true); } thread_unlock(td); } - } else if ((P_SHOULDSTOP(p) == P_STOPPED_SINGLE) && - (p->p_numthreads == p->p_suspcount)) { + } else if (P_SHOULDSTOP(p) == P_STOPPED_SINGLE && + p->p_numthreads == p->p_suspcount) { /* * Stopping everything also did the job for the single * threading request. Now we've downgraded to single-threaded, @@ -1019,7 +1019,7 @@ thread_unsuspend(struct proc *p) if (p->p_singlethread->td_proc == p) { thread_lock(p->p_singlethread); wakeup_swapper = thread_unsuspend_one( - p->p_singlethread, p); + p->p_singlethread, p, false); thread_unlock(p->p_singlethread); } } @@ -1043,6 +1043,12 @@ thread_single_end(struct proc *p, int mo KASSERT((mode == SINGLE_ALLPROC && (p->p_flag & P_TOTAL_STOP) != 0) || (mode != SINGLE_ALLPROC && (p->p_flag & P_TOTAL_STOP) == 0), ("mode %d does not match P_TOTAL_STOP", mode)); + KASSERT(mode == SINGLE_ALLPROC || p->p_singlethread == curthread, + ("thread_single_end from other thread %p %p", + curthread, p->p_singlethread)); + KASSERT(mode != SINGLE_BOUNDARY || + (p->p_flag & P_SINGLE_BOUNDARY) != 0, + ("mis-matched SINGLE_BOUNDARY flags %x", p->p_flag)); p->p_flag &= ~(P_STOPPED_SINGLE | P_SINGLE_EXIT | P_SINGLE_BOUNDARY | P_TOTAL_STOP); PROC_SLOCK(p); @@ -1058,11 +1064,14 @@ thread_single_end(struct proc *p, int mo FOREACH_THREAD_IN_PROC(p, td) { thread_lock(td); if (TD_IS_SUSPENDED(td)) { - wakeup_swapper |= thread_unsuspend_one(td, p); + wakeup_swapper |= thread_unsuspend_one(td, p, + mode == SINGLE_BOUNDARY); } thread_unlock(td); } } + KASSERT(mode != SINGLE_BOUNDARY || p->p_boundary_count == 0, + ("inconsistent boundary count %d", p->p_boundary_count)); PROC_SUNLOCK(p); if (wakeup_swapper) kick_proc0(); Modified: stable/10/sys/sys/proc.h ============================================================================== --- stable/10/sys/sys/proc.h Fri May 22 07:39:21 2015 (r283278) +++ stable/10/sys/sys/proc.h Fri May 22 08:11:31 2015 (r283279) @@ -966,7 +966,6 @@ void thread_suspend_switch(struct thread void thread_suspend_one(struct thread *td); void thread_unlink(struct thread *td); void thread_unsuspend(struct proc *p); -int thread_unsuspend_one(struct thread *td, struct proc *p); void thread_wait(struct proc *p); struct thread *thread_find(struct proc *p, lwpid_t tid); From owner-svn-src-stable-10@FreeBSD.ORG Fri May 22 09:03:58 2015 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.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5909D2EB; Fri, 22 May 2015 09:03:58 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 441041564; Fri, 22 May 2015 09:03:58 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4M93wgh093618; Fri, 22 May 2015 09:03:58 GMT (envelope-from whu@FreeBSD.org) Received: (from whu@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4M93uHI093604; Fri, 22 May 2015 09:03:56 GMT (envelope-from whu@FreeBSD.org) Message-Id: <201505220903.t4M93uHI093604@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: whu set sender to whu@FreeBSD.org using -f From: Wei Hu Date: Fri, 22 May 2015 09:03: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: r283280 - in stable/10/sys: amd64/amd64 amd64/conf amd64/include conf dev/hyperv/include dev/hyperv/storvsc dev/hyperv/utilities dev/hyperv/vmbus i386/conf i386/i386 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.20 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, 22 May 2015 09:03:58 -0000 Author: whu Date: Fri May 22 09:03:55 2015 New Revision: 283280 URL: https://svnweb.freebsd.org/changeset/base/283280 Log: MFC r282212: Microsoft vmbus, storage and other related driver enhancements for HyperV. - Vmbus multi channel support. - Vector interrupt support. - Signal optimization. - Storvsc driver performance improvement. - Scatter and gather support for storvsc driver. - Minor bug fix for KVP driver. Thanks royger, jhb and delphij from FreeBSD community for the reviews and comments. Also thanks Hovy Xu from NetApp for the contributions to the storvsc driver. PR: 195238 Submitted by: whu Reviewed by: royger Approved by: royger Relnotes: yes Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D2575 Modified: stable/10/sys/amd64/amd64/apic_vector.S stable/10/sys/amd64/conf/GENERIC stable/10/sys/amd64/conf/NOTES stable/10/sys/amd64/include/apicvar.h stable/10/sys/conf/options.amd64 stable/10/sys/conf/options.i386 stable/10/sys/dev/hyperv/include/hyperv.h stable/10/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c stable/10/sys/dev/hyperv/storvsc/hv_vstorage.h stable/10/sys/dev/hyperv/utilities/hv_kvp.c stable/10/sys/dev/hyperv/utilities/hv_util.c stable/10/sys/dev/hyperv/vmbus/hv_channel.c stable/10/sys/dev/hyperv/vmbus/hv_channel_mgmt.c stable/10/sys/dev/hyperv/vmbus/hv_connection.c stable/10/sys/dev/hyperv/vmbus/hv_hv.c stable/10/sys/dev/hyperv/vmbus/hv_ring_buffer.c stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c stable/10/sys/dev/hyperv/vmbus/hv_vmbus_priv.h stable/10/sys/i386/conf/GENERIC stable/10/sys/i386/i386/apic_vector.s Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/amd64/amd64/apic_vector.S ============================================================================== --- stable/10/sys/amd64/amd64/apic_vector.S Fri May 22 08:11:31 2015 (r283279) +++ stable/10/sys/amd64/amd64/apic_vector.S Fri May 22 09:03:55 2015 (r283280) @@ -150,6 +150,22 @@ IDTVEC(xen_intr_upcall) jmp doreti #endif +#ifdef HYPERV +/* + * This is the Hyper-V vmbus channel direct callback interrupt. + * Only used when it is running on Hyper-V. + */ + .text + SUPERALIGN_TEXT +IDTVEC(hv_vmbus_callback) + PUSH_FRAME + FAKE_MCOUNT(TF_RIP(%rsp)) + movq %rsp, %rdi + call hv_vector_handler + MEXITCOUNT + jmp doreti +#endif + #ifdef SMP /* * Global address space TLB shootdown. Modified: stable/10/sys/amd64/conf/GENERIC ============================================================================== --- stable/10/sys/amd64/conf/GENERIC Fri May 22 08:11:31 2015 (r283279) +++ stable/10/sys/amd64/conf/GENERIC Fri May 22 09:03:55 2015 (r283280) @@ -346,7 +346,9 @@ device virtio_blk # VirtIO Block devic device virtio_scsi # VirtIO SCSI device device virtio_balloon # VirtIO Memory Balloon device -# HyperV drivers +# HyperV drivers and enchancement support +# NOTE: HYPERV depends on hyperv. They must be added or removed together. +options HYPERV # Hyper-V kernel infrastructure device hyperv # HyperV drivers # Xen HVM Guest Optimizations Modified: stable/10/sys/amd64/conf/NOTES ============================================================================== --- stable/10/sys/amd64/conf/NOTES Fri May 22 08:11:31 2015 (r283279) +++ stable/10/sys/amd64/conf/NOTES Fri May 22 09:03:55 2015 (r283280) @@ -479,6 +479,8 @@ device virtio_balloon # VirtIO Memory B device virtio_random # VirtIO Entropy device device virtio_console # VirtIO Console device +# Microsoft Hyper-V enchancement support +options HYPERV # Hyper-V kernel infrastructure device hyperv # HyperV drivers # Xen HVM Guest Optimizations Modified: stable/10/sys/amd64/include/apicvar.h ============================================================================== --- stable/10/sys/amd64/include/apicvar.h Fri May 22 08:11:31 2015 (r283279) +++ stable/10/sys/amd64/include/apicvar.h Fri May 22 09:03:55 2015 (r283280) @@ -216,6 +216,7 @@ int lapic_set_lvt_triggermode(u_int apic void lapic_set_tpr(u_int vector); void lapic_setup(int boot); void xen_intr_handle_upcall(struct trapframe *frame); +void hv_vector_handler(struct trapframe *frame); #endif /* !LOCORE */ #endif /* _MACHINE_APICVAR_H_ */ Modified: stable/10/sys/conf/options.amd64 ============================================================================== --- stable/10/sys/conf/options.amd64 Fri May 22 08:11:31 2015 (r283279) +++ stable/10/sys/conf/options.amd64 Fri May 22 09:03:55 2015 (r283280) @@ -67,5 +67,7 @@ BPF_JITTER opt_bpf.h XENHVM opt_global.h +HYPERV opt_global.h + # options for the Intel C600 SAS driver (isci) ISCI_LOGGING opt_isci.h Modified: stable/10/sys/conf/options.i386 ============================================================================== --- stable/10/sys/conf/options.i386 Fri May 22 08:11:31 2015 (r283279) +++ stable/10/sys/conf/options.i386 Fri May 22 09:03:55 2015 (r283280) @@ -127,5 +127,7 @@ NATIVE opt_global.h XEN opt_global.h XENHVM opt_global.h +HYPERV opt_global.h + # options for the Intel C600 SAS driver (isci) ISCI_LOGGING opt_isci.h Modified: stable/10/sys/dev/hyperv/include/hyperv.h ============================================================================== --- stable/10/sys/dev/hyperv/include/hyperv.h Fri May 22 08:11:31 2015 (r283279) +++ stable/10/sys/dev/hyperv/include/hyperv.h Fri May 22 09:03:55 2015 (r283280) @@ -46,6 +46,7 @@ #include #include #include +#include #include #include #include @@ -63,11 +64,22 @@ typedef uint8_t hv_bool_uint8_t; #define HV_ERROR_MACHINE_LOCKED 0x800704F7 /* - * A revision number of vmbus that is used for ensuring both ends on a - * partition are using compatible versions. - */ + * VMBUS version is 32 bit, upper 16 bit for major_number and lower + * 16 bit for minor_number. + * + * 0.13 -- Windows Server 2008 + * 1.1 -- Windows 7 + * 2.4 -- Windows 8 + * 3.0 -- Windows 8.1 + */ +#define HV_VMBUS_VERSION_WS2008 ((0 << 16) | (13)) +#define HV_VMBUS_VERSION_WIN7 ((1 << 16) | (1)) +#define HV_VMBUS_VERSION_WIN8 ((2 << 16) | (4)) +#define HV_VMBUS_VERSION_WIN8_1 ((3 << 16) | (0)) -#define HV_VMBUS_REVISION_NUMBER 13 +#define HV_VMBUS_VERSION_INVALID -1 + +#define HV_VMBUS_VERSION_CURRENT HV_VMBUS_VERSION_WIN8_1 /* * Make maximum size of pipe payload of 16K @@ -112,6 +124,18 @@ typedef struct hv_guid { unsigned char data[16]; } __packed hv_guid; +#define HV_NIC_GUID \ + .data = {0x63, 0x51, 0x61, 0xF8, 0x3E, 0xDF, 0xc5, 0x46, \ + 0x91, 0x3F, 0xF2, 0xD2, 0xF9, 0x65, 0xED, 0x0E} + +#define HV_IDE_GUID \ + .data = {0x32, 0x26, 0x41, 0x32, 0xcb, 0x86, 0xa2, 0x44, \ + 0x9b, 0x5c, 0x50, 0xd1, 0x41, 0x73, 0x54, 0xf5} + +#define HV_SCSI_GUID \ + .data = {0xd9, 0x63, 0x61, 0xba, 0xa1, 0x04, 0x29, 0x4d, \ + 0xb6, 0x05, 0x72, 0xe2, 0xff, 0xb1, 0xdc, 0x7f} + /* * At the center of the Channel Management library is * the Channel Offer. This struct contains the @@ -147,7 +171,11 @@ typedef struct hv_vmbus_channel_offer { } __packed pipe; } u; - uint32_t padding; + /* + * Sub_channel_index, newly added in Win8. + */ + uint16_t sub_channel_index; + uint16_t padding; } __packed hv_vmbus_channel_offer; @@ -344,7 +372,25 @@ typedef struct { hv_vmbus_channel_offer offer; uint32_t child_rel_id; uint8_t monitor_id; - hv_bool_uint8_t monitor_allocated; + /* + * This field has been split into a bit field on Win7 + * and higher. + */ + uint8_t monitor_allocated:1; + uint8_t reserved:7; + /* + * Following fields were added in win7 and higher. + * Make sure to check the version before accessing these fields. + * + * If "is_dedicated_interrupt" is set, we must not set the + * associated bit in the channel bitmap while sending the + * interrupt to the host. + * + * connection_id is used in signaling the host. + */ + uint16_t is_dedicated_interrupt:1; + uint16_t reserved1:15; + uint32_t connection_id; } __packed hv_vmbus_channel_offer_channel; /* @@ -394,9 +440,11 @@ typedef struct hv_gpadl_handle ring_buffer_gpadl_handle; /* - * GPADL for the channel's server context save area. + * Before win8, all incoming channel interrupts are only + * delivered on cpu 0. Setting this value to 0 would + * preserve the earlier behavior. */ - hv_gpadl_handle server_context_area_gpadl_handle; + uint32_t target_vcpu; /* * The upstream ring buffer begins at offset zero in the memory described @@ -646,14 +694,42 @@ typedef struct { } hv_vmbus_ring_buffer_info; typedef void (*hv_vmbus_pfn_channel_callback)(void *context); +typedef void (*hv_vmbus_sc_creation_callback)(void *context); typedef enum { HV_CHANNEL_OFFER_STATE, HV_CHANNEL_OPENING_STATE, HV_CHANNEL_OPEN_STATE, + HV_CHANNEL_OPENED_STATE, HV_CHANNEL_CLOSING_NONDESTRUCTIVE_STATE, } hv_vmbus_channel_state; +/* + * Connection identifier type + */ +typedef union { + uint32_t as_uint32_t; + struct { + uint32_t id:24; + uint32_t reserved:8; + } u; + +} __packed hv_vmbus_connection_id; + +/* + * Definition of the hv_vmbus_signal_event hypercall input structure + */ +typedef struct { + hv_vmbus_connection_id connection_id; + uint16_t flag_number; + uint16_t rsvd_z; +} __packed hv_vmbus_input_signal_event; + +typedef struct { + uint64_t align8; + hv_vmbus_input_signal_event event; +} __packed hv_vmbus_input_signal_event_buffer; + typedef struct hv_vmbus_channel { TAILQ_ENTRY(hv_vmbus_channel) list_entry; struct hv_device* device; @@ -688,8 +764,82 @@ typedef struct hv_vmbus_channel { hv_vmbus_pfn_channel_callback on_channel_callback; void* channel_callback_context; + /* + * If batched_reading is set to "true", mask the interrupt + * and read until the channel is empty. + * If batched_reading is set to "false", the channel is not + * going to perform batched reading. + * + * Batched reading is enabled by default; specific + * drivers that don't want this behavior can turn it off. + */ + boolean_t batched_reading; + + boolean_t is_dedicated_interrupt; + + /* + * Used as an input param for HV_CALL_SIGNAL_EVENT hypercall. + */ + hv_vmbus_input_signal_event_buffer signal_event_buffer; + /* + * 8-bytes aligned of the buffer above + */ + hv_vmbus_input_signal_event *signal_event_param; + + /* + * From Win8, this field specifies the target virtual process + * on which to deliver the interupt from the host to guest. + * Before Win8, all channel interrupts would only be + * delivered on cpu 0. Setting this value to 0 would preserve + * the earlier behavior. + */ + uint32_t target_vcpu; + /* The corresponding CPUID in the guest */ + uint32_t target_cpu; + + /* + * Support for multi-channels. + * The initial offer is considered the primary channel and this + * offer message will indicate if the host supports multi-channels. + * The guest is free to ask for multi-channels to be offerred and can + * open these multi-channels as a normal "primary" channel. However, + * all multi-channels will have the same type and instance guids as the + * primary channel. Requests sent on a given channel will result in a + * response on the same channel. + */ + + /* + * Multi-channel creation callback. This callback will be called in + * process context when a Multi-channel offer is received from the host. + * The guest can open the Multi-channel in the context of this callback. + */ + hv_vmbus_sc_creation_callback sc_creation_callback; + + struct mtx sc_lock; + + /* + * Link list of all the multi-channels if this is a primary channel + */ + TAILQ_HEAD(, hv_vmbus_channel) sc_list_anchor; + TAILQ_ENTRY(hv_vmbus_channel) sc_list_entry; + + /* + * The primary channel this sub-channle belongs to. + * This will be NULL for the primary channel. + */ + struct hv_vmbus_channel *primary_channel; + /* + * Support per channel state for use by vmbus drivers. + */ + void *per_channel_state; } hv_vmbus_channel; +static inline void +hv_set_channel_read_state(hv_vmbus_channel* channel, boolean_t state) +{ + channel->batched_reading = state; +} + typedef struct hv_device { hv_guid class_id; hv_guid device_id; @@ -760,6 +910,8 @@ int hv_vmbus_channel_teardown_gpdal( hv_vmbus_channel* channel, uint32_t gpadl_handle); +struct hv_vmbus_channel* vmbus_select_outgoing_channel(struct hv_vmbus_channel *promary); + /* * Work abstraction defines */ @@ -819,6 +971,7 @@ typedef struct hv_vmbus_service { extern uint8_t* receive_buffer[]; extern hv_vmbus_service service_table[]; +extern uint32_t hv_vmbus_protocal_version; void hv_kvp_callback(void *context); int hv_kvp_init(hv_vmbus_service *serv); Modified: stable/10/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c ============================================================================== --- stable/10/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Fri May 22 08:11:31 2015 (r283279) +++ stable/10/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Fri May 22 09:03:55 2015 (r283280) @@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -53,8 +54,12 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include +#include +#include +#include #include #include @@ -66,7 +71,6 @@ __FBSDID("$FreeBSD$"); #include #include - #include #include "hv_vstorage.h" @@ -77,8 +81,29 @@ __FBSDID("$FreeBSD$"); #define BLKVSC_MAX_IO_REQUESTS STORVSC_MAX_IO_REQUESTS #define STORVSC_MAX_TARGETS (2) +#define STORVSC_WIN7_MAJOR 4 +#define STORVSC_WIN7_MINOR 2 + +#define STORVSC_WIN8_MAJOR 5 +#define STORVSC_WIN8_MINOR 1 + +#define HV_ALIGN(x, a) roundup2(x, a) + struct storvsc_softc; +struct hv_sgl_node { + LIST_ENTRY(hv_sgl_node) link; + struct sglist *sgl_data; +}; + +struct hv_sgl_page_pool{ + LIST_HEAD(, hv_sgl_node) in_use_sgl_list; + LIST_HEAD(, hv_sgl_node) free_sgl_list; + boolean_t is_init; +} g_hv_sgl_page_pool; + +#define STORVSC_MAX_SG_PAGE_CNT STORVSC_MAX_IO_REQUESTS * HV_MAX_MULTIPAGE_BUFFER_COUNT + enum storvsc_request_type { WRITE_TYPE, READ_TYPE, @@ -96,20 +121,24 @@ struct hv_storvsc_request { struct storvsc_softc *softc; struct callout callout; struct sema synch_sema; /*Synchronize the request/response if needed */ + struct sglist *bounce_sgl; + unsigned int bounce_sgl_count; + uint64_t not_aligned_seg_bits; }; struct storvsc_softc { struct hv_device *hs_dev; - LIST_HEAD(, hv_storvsc_request) hs_free_list; - struct mtx hs_lock; - struct storvsc_driver_props *hs_drv_props; - int hs_unit; - uint32_t hs_frozen; - struct cam_sim *hs_sim; - struct cam_path *hs_path; + LIST_HEAD(, hv_storvsc_request) hs_free_list; + struct mtx hs_lock; + struct storvsc_driver_props *hs_drv_props; + int hs_unit; + uint32_t hs_frozen; + struct cam_sim *hs_sim; + struct cam_path *hs_path; uint32_t hs_num_out_reqs; boolean_t hs_destroy; boolean_t hs_drain_notify; + boolean_t hs_open_multi_channel; struct sema hs_drain_sema; struct hv_storvsc_request hs_init_req; struct hv_storvsc_request hs_reset_req; @@ -124,7 +153,7 @@ struct storvsc_softc { * The first can be tested by "sg_senddiag -vv /dev/daX", * and the second and third can be done by * "sg_wr_mode -v -p 08 -c 0,1a -m 0,ff /dev/daX". - */ + */ #define HVS_TIMEOUT_TEST 0 /* @@ -138,7 +167,7 @@ struct storvsc_driver_props { char *drv_name; char *drv_desc; uint8_t drv_max_luns_per_target; - uint8_t drv_max_ios_per_target; + uint8_t drv_max_ios_per_target; uint32_t drv_ringbuffer_size; }; @@ -150,6 +179,8 @@ enum hv_storage_type { #define HS_MAX_ADAPTERS 10 +#define HV_STORAGE_SUPPORTS_MULTI_CHANNEL 0x1 + /* {ba6163d9-04a1-4d29-b605-72e2ffb1dc7f} */ static const hv_guid gStorVscDeviceType={ .data = {0xd9, 0x63, 0x61, 0xba, 0xa1, 0x04, 0x29, 0x4d, @@ -171,13 +202,16 @@ static struct storvsc_driver_props g_drv STORVSC_RINGBUFFER_SIZE} }; +static int storvsc_current_major; +static int storvsc_current_minor; + /* static functions */ static int storvsc_probe(device_t dev); static int storvsc_attach(device_t dev); static int storvsc_detach(device_t dev); static void storvsc_poll(struct cam_sim * sim); static void storvsc_action(struct cam_sim * sim, union ccb * ccb); -static void create_storvsc_request(union ccb *ccb, struct hv_storvsc_request *reqp); +static int create_storvsc_request(union ccb *ccb, struct hv_storvsc_request *reqp); static void storvsc_free_request(struct storvsc_softc *sc, struct hv_storvsc_request *reqp); static enum hv_storage_type storvsc_get_storage_type(device_t dev); static void hv_storvsc_on_channel_callback(void *context); @@ -186,6 +220,14 @@ static void hv_storvsc_on_iocompletion( struct hv_storvsc_request *request); static int hv_storvsc_connect_vsp(struct hv_device *device); static void storvsc_io_done(struct hv_storvsc_request *reqp); +static void storvsc_copy_sgl_to_bounce_buf(struct sglist *bounce_sgl, + bus_dma_segment_t *orig_sgl, + unsigned int orig_sgl_count, + uint64_t seg_bits); +void storvsc_copy_from_bounce_buf_to_sgl(bus_dma_segment_t *dest_sgl, + unsigned int dest_sgl_count, + struct sglist* src_sgl, + uint64_t seg_bits); static device_method_t storvsc_methods[] = { /* Device interface */ @@ -207,7 +249,7 @@ MODULE_DEPEND(storvsc, vmbus, 1, 1, 1); /** - * The host is capable of sending messages to us that are + * The host is capable of sending messages to us that are * completely unsolicited. So, we need to address the race * condition where we may be in the process of unloading the * driver when the host may send us an unsolicited message. @@ -223,7 +265,7 @@ MODULE_DEPEND(storvsc, vmbus, 1, 1, 1); * destroyed. * * 3. Once the device is marked as being destroyed, we only - * permit incoming traffic to properly account for + * permit incoming traffic to properly account for * packets already sent out. */ static inline struct storvsc_softc * @@ -260,6 +302,113 @@ get_stor_device(struct hv_device *device } /** + * @brief Callback handler, will be invoked when receive mutil-channel offer + * + * @param context new multi-channel + */ +static void +storvsc_handle_sc_creation(void *context) +{ + hv_vmbus_channel *new_channel; + struct hv_device *device; + struct storvsc_softc *sc; + struct vmstor_chan_props props; + int ret = 0; + + new_channel = (hv_vmbus_channel *)context; + device = new_channel->primary_channel->device; + sc = get_stor_device(device, TRUE); + if (sc == NULL) + return; + + if (FALSE == sc->hs_open_multi_channel) + return; + + memset(&props, 0, sizeof(props)); + + ret = hv_vmbus_channel_open(new_channel, + sc->hs_drv_props->drv_ringbuffer_size, + sc->hs_drv_props->drv_ringbuffer_size, + (void *)&props, + sizeof(struct vmstor_chan_props), + hv_storvsc_on_channel_callback, + new_channel); + + return; +} + +/** + * @brief Send multi-channel creation request to host + * + * @param device a Hyper-V device pointer + * @param max_chans the max channels supported by vmbus + */ +static void +storvsc_send_multichannel_request(struct hv_device *dev, int max_chans) +{ + struct storvsc_softc *sc; + struct hv_storvsc_request *request; + struct vstor_packet *vstor_packet; + int request_channels_cnt = 0; + int ret; + + /* get multichannels count that need to create */ + request_channels_cnt = MIN(max_chans, mp_ncpus); + + sc = get_stor_device(dev, TRUE); + if (sc == NULL) { + printf("Storvsc_error: get sc failed while send mutilchannel " + "request\n"); + return; + } + + request = &sc->hs_init_req; + + /* Establish a handler for multi-channel */ + dev->channel->sc_creation_callback = storvsc_handle_sc_creation; + + /* request the host to create multi-channel */ + memset(request, 0, sizeof(struct hv_storvsc_request)); + + sema_init(&request->synch_sema, 0, ("stor_synch_sema")); + + vstor_packet = &request->vstor_packet; + + vstor_packet->operation = VSTOR_OPERATION_CREATE_MULTI_CHANNELS; + vstor_packet->flags = REQUEST_COMPLETION_FLAG; + vstor_packet->u.multi_channels_cnt = request_channels_cnt; + + ret = hv_vmbus_channel_send_packet( + dev->channel, + vstor_packet, + sizeof(struct vstor_packet), + (uint64_t)(uintptr_t)request, + HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, + HV_VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED); + + /* wait for 5 seconds */ + ret = sema_timedwait(&request->synch_sema, 5 * hz); + if (ret != 0) { + printf("Storvsc_error: create multi-channel timeout, %d\n", + ret); + return; + } + + if (vstor_packet->operation != VSTOR_OPERATION_COMPLETEIO || + vstor_packet->status != 0) { + printf("Storvsc_error: create multi-channel invalid operation " + "(%d) or statue (%u)\n", + vstor_packet->operation, vstor_packet->status); + return; + } + + sc->hs_open_multi_channel = TRUE; + + if (bootverbose) + printf("Storvsc create multi-channel success!\n"); +} + +/** * @brief initialize channel connection to parent partition * * @param dev a Hyper-V device pointer @@ -272,11 +421,15 @@ hv_storvsc_channel_init(struct hv_device struct hv_storvsc_request *request; struct vstor_packet *vstor_packet; struct storvsc_softc *sc; + uint16_t max_chans = 0; + boolean_t support_multichannel = FALSE; + + max_chans = 0; + support_multichannel = FALSE; sc = get_stor_device(dev, TRUE); - if (sc == NULL) { - return ENODEV; - } + if (sc == NULL) + return (ENODEV); request = &sc->hs_init_req; memset(request, 0, sizeof(struct hv_storvsc_request)); @@ -300,15 +453,13 @@ hv_storvsc_channel_init(struct hv_device HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, HV_VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED); - if (ret != 0) { + if (ret != 0) goto cleanup; - } - ret = sema_timedwait(&request->synch_sema, 500); /* KYS 5 seconds */ - - if (ret != 0) { + /* wait 5 seconds */ + ret = sema_timedwait(&request->synch_sema, 5 * hz); + if (ret != 0) goto cleanup; - } if (vstor_packet->operation != VSTOR_OPERATION_COMPLETEIO || vstor_packet->status != 0) { @@ -321,7 +472,8 @@ hv_storvsc_channel_init(struct hv_device vstor_packet->operation = VSTOR_OPERATION_QUERYPROTOCOLVERSION; vstor_packet->flags = REQUEST_COMPLETION_FLAG; - vstor_packet->u.version.major_minor = VMSTOR_PROTOCOL_VERSION_CURRENT; + vstor_packet->u.version.major_minor = + VMSTOR_PROTOCOL_VERSION(storvsc_current_major, storvsc_current_minor); /* revision is only significant for Windows guests */ vstor_packet->u.version.revision = 0; @@ -334,21 +486,19 @@ hv_storvsc_channel_init(struct hv_device HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, HV_VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED); - if (ret != 0) { + if (ret != 0) goto cleanup; - } - ret = sema_timedwait(&request->synch_sema, 500); /* KYS 5 seconds */ + /* wait 5 seconds */ + ret = sema_timedwait(&request->synch_sema, 5 * hz); - if (ret) { + if (ret) goto cleanup; - } /* TODO: Check returned version */ if (vstor_packet->operation != VSTOR_OPERATION_COMPLETEIO || - vstor_packet->status != 0) { + vstor_packet->status != 0) goto cleanup; - } /** * Query channel properties @@ -365,22 +515,30 @@ hv_storvsc_channel_init(struct hv_device HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, HV_VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED); - if ( ret != 0) { + if ( ret != 0) goto cleanup; - } - ret = sema_timedwait(&request->synch_sema, 500); /* KYS 5 seconds */ + /* wait 5 seconds */ + ret = sema_timedwait(&request->synch_sema, 5 * hz); - if (ret != 0) { + if (ret != 0) goto cleanup; - } /* TODO: Check returned version */ if (vstor_packet->operation != VSTOR_OPERATION_COMPLETEIO || - vstor_packet->status != 0) { + vstor_packet->status != 0) { goto cleanup; } + /* multi-channels feature is supported by WIN8 and above version */ + max_chans = vstor_packet->u.chan_props.max_channel_cnt; + if ((hv_vmbus_protocal_version != HV_VMBUS_VERSION_WIN7) && + (hv_vmbus_protocal_version != HV_VMBUS_VERSION_WS2008) && + (vstor_packet->u.chan_props.flags & + HV_STORAGE_SUPPORTS_MULTI_CHANNEL)) { + support_multichannel = TRUE; + } + memset(vstor_packet, 0, sizeof(struct vstor_packet)); vstor_packet->operation = VSTOR_OPERATION_ENDINITIALIZATION; vstor_packet->flags = REQUEST_COMPLETION_FLAG; @@ -397,16 +555,22 @@ hv_storvsc_channel_init(struct hv_device goto cleanup; } - ret = sema_timedwait(&request->synch_sema, 500); /* KYS 5 seconds */ + /* wait 5 seconds */ + ret = sema_timedwait(&request->synch_sema, 5 * hz); - if (ret != 0) { + if (ret != 0) goto cleanup; - } if (vstor_packet->operation != VSTOR_OPERATION_COMPLETEIO || - vstor_packet->status != 0) { + vstor_packet->status != 0) goto cleanup; - } + + /* + * If multi-channel is supported, send multichannel create + * request to host. + */ + if (support_multichannel) + storvsc_send_multichannel_request(dev, max_chans); cleanup: sema_destroy(&request->synch_sema); @@ -443,8 +607,7 @@ hv_storvsc_connect_vsp(struct hv_device (void *)&props, sizeof(struct vmstor_chan_props), hv_storvsc_on_channel_callback, - dev); - + dev->channel); if (ret != 0) { return ret; @@ -490,7 +653,7 @@ hv_storvsc_host_reset(struct hv_device * goto cleanup; } - ret = sema_timedwait(&request->synch_sema, 500); /* KYS 5 seconds */ + ret = sema_timedwait(&request->synch_sema, 5 * hz); /* KYS 5 seconds */ if (ret) { goto cleanup; @@ -498,7 +661,7 @@ hv_storvsc_host_reset(struct hv_device * /* - * At this point, all outstanding requests in the adapter + * At this point, all outstanding requests in the adapter * should have been flushed out and return to us */ @@ -521,6 +684,7 @@ hv_storvsc_io_request(struct hv_device * { struct storvsc_softc *sc; struct vstor_packet *vstor_packet = &request->vstor_packet; + struct hv_vmbus_channel* outgoing_channel = NULL; int ret = 0; sc = get_stor_device(device, TRUE); @@ -539,19 +703,20 @@ hv_storvsc_io_request(struct hv_device * vstor_packet->operation = VSTOR_OPERATION_EXECUTESRB; + outgoing_channel = vmbus_select_outgoing_channel(device->channel); mtx_unlock(&request->softc->hs_lock); if (request->data_buf.length) { ret = hv_vmbus_channel_send_packet_multipagebuffer( - device->channel, + outgoing_channel, &request->data_buf, - vstor_packet, - sizeof(struct vstor_packet), + vstor_packet, + sizeof(struct vstor_packet), (uint64_t)(uintptr_t)request); } else { ret = hv_vmbus_channel_send_packet( - device->channel, + outgoing_channel, vstor_packet, sizeof(struct vstor_packet), (uint64_t)(uintptr_t)request, @@ -610,7 +775,8 @@ static void hv_storvsc_on_channel_callback(void *context) { int ret = 0; - struct hv_device *device = (struct hv_device *)context; + hv_vmbus_channel *channel = (hv_vmbus_channel *)context; + struct hv_device *device = NULL; struct storvsc_softc *sc; uint32_t bytes_recvd; uint64_t request_id; @@ -618,15 +784,22 @@ hv_storvsc_on_channel_callback(void *con struct hv_storvsc_request *request; struct vstor_packet *vstor_packet; + if (channel->primary_channel != NULL){ + device = channel->primary_channel->device; + } else { + device = channel->device; + } + + KASSERT(device, ("device is NULL")); + sc = get_stor_device(device, FALSE); if (sc == NULL) { + printf("Storvsc_error: get stor device failed.\n"); return; } - KASSERT(device, ("device")); - ret = hv_vmbus_channel_recv_packet( - device->channel, + channel, packet, roundup2(sizeof(struct vstor_packet), 8), &bytes_recvd, @@ -634,21 +807,28 @@ hv_storvsc_on_channel_callback(void *con while ((ret == 0) && (bytes_recvd > 0)) { request = (struct hv_storvsc_request *)(uintptr_t)request_id; - KASSERT(request, ("request")); if ((request == &sc->hs_init_req) || (request == &sc->hs_reset_req)) { memcpy(&request->vstor_packet, packet, sizeof(struct vstor_packet)); - sema_post(&request->synch_sema); + sema_post(&request->synch_sema); } else { vstor_packet = (struct vstor_packet *)packet; switch(vstor_packet->operation) { case VSTOR_OPERATION_COMPLETEIO: + if (request == NULL) + panic("VMBUS: storvsc received a " + "packet with NULL request id in " + "COMPLETEIO operation."); + hv_storvsc_on_iocompletion(sc, vstor_packet, request); break; case VSTOR_OPERATION_REMOVEDEVICE: + case VSTOR_OPERATION_ENUMERATE_BUS: + printf("VMBUS: storvsc operation %d not " + "implemented.\n", vstor_packet->operation); /* TODO: implement */ break; default: @@ -656,7 +836,7 @@ hv_storvsc_on_channel_callback(void *con } } ret = hv_vmbus_channel_recv_packet( - device->channel, + channel, packet, roundup2(sizeof(struct vstor_packet), 8), &bytes_recvd, @@ -680,7 +860,16 @@ storvsc_probe(device_t dev) { int ata_disk_enable = 0; int ret = ENXIO; - + + if ((HV_VMBUS_VERSION_WIN8 == hv_vmbus_protocal_version) || + (HV_VMBUS_VERSION_WIN8_1 == hv_vmbus_protocal_version)){ + storvsc_current_major = STORVSC_WIN8_MAJOR; + storvsc_current_minor = STORVSC_WIN8_MINOR; + } else { + storvsc_current_major = STORVSC_WIN7_MAJOR; + storvsc_current_minor = STORVSC_WIN7_MINOR; + } + switch (storvsc_get_storage_type(dev)) { case DRIVER_BLKVSC: if(bootverbose) @@ -721,9 +910,11 @@ storvsc_attach(device_t dev) enum hv_storage_type stor_type; struct storvsc_softc *sc; struct cam_devq *devq; - int ret, i; + int ret, i, j; struct hv_storvsc_request *reqp; struct root_hold_token *root_mount_token = NULL; + struct hv_sgl_node *sgl_node = NULL; + void *tmp_buff = NULL; /* * We need to serialize storvsc attach calls. @@ -764,8 +955,41 @@ storvsc_attach(device_t dev) LIST_INSERT_HEAD(&sc->hs_free_list, reqp, link); } + /* create sg-list page pool */ + if (FALSE == g_hv_sgl_page_pool.is_init) { + g_hv_sgl_page_pool.is_init = TRUE; + LIST_INIT(&g_hv_sgl_page_pool.in_use_sgl_list); + LIST_INIT(&g_hv_sgl_page_pool.free_sgl_list); + + /* + * Pre-create SG list, each SG list with + * HV_MAX_MULTIPAGE_BUFFER_COUNT segments, each + * segment has one page buffer + */ + for (i = 0; i < STORVSC_MAX_IO_REQUESTS; i++) { + sgl_node = malloc(sizeof(struct hv_sgl_node), + M_DEVBUF, M_WAITOK|M_ZERO); + + sgl_node->sgl_data = + sglist_alloc(HV_MAX_MULTIPAGE_BUFFER_COUNT, + M_WAITOK|M_ZERO); + + for (j = 0; j < HV_MAX_MULTIPAGE_BUFFER_COUNT; j++) { + tmp_buff = malloc(PAGE_SIZE, + M_DEVBUF, M_WAITOK|M_ZERO); + + sgl_node->sgl_data->sg_segs[j].ss_paddr = + (vm_paddr_t)tmp_buff; + } + + LIST_INSERT_HEAD(&g_hv_sgl_page_pool.free_sgl_list, + sgl_node, link); + } + } + sc->hs_destroy = FALSE; sc->hs_drain_notify = FALSE; + sc->hs_open_multi_channel = FALSE; sema_init(&sc->hs_drain_sema, 0, "Store Drain Sema"); ret = hv_storvsc_connect_vsp(hv_dev); @@ -834,6 +1058,20 @@ cleanup: LIST_REMOVE(reqp, link); free(reqp, M_DEVBUF); } + + while (!LIST_EMPTY(&g_hv_sgl_page_pool.free_sgl_list)) { + sgl_node = LIST_FIRST(&g_hv_sgl_page_pool.free_sgl_list); + LIST_REMOVE(sgl_node, link); + for (j = 0; j < HV_MAX_MULTIPAGE_BUFFER_COUNT; j++) { + if (NULL != + (void*)sgl_node->sgl_data->sg_segs[j].ss_paddr) { + free((void*)sgl_node->sgl_data->sg_segs[j].ss_paddr, M_DEVBUF); + } + } + sglist_free(sgl_node->sgl_data); + free(sgl_node, M_DEVBUF); + } + return (ret); } @@ -853,6 +1091,8 @@ storvsc_detach(device_t dev) struct storvsc_softc *sc = device_get_softc(dev); struct hv_storvsc_request *reqp = NULL; struct hv_device *hv_device = vmbus_get_devctx(dev); + struct hv_sgl_node *sgl_node = NULL; + int j = 0; mtx_lock(&hv_device->channel->inbound_lock); sc->hs_destroy = TRUE; @@ -884,6 +1124,20 @@ storvsc_detach(device_t dev) free(reqp, M_DEVBUF); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-10@FreeBSD.ORG Fri May 22 11:21:00 2015 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.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 815C1F45; Fri, 22 May 2015 11:21: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6ECE1167C; Fri, 22 May 2015 11:21:00 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4MBL07i063946; Fri, 22 May 2015 11:21:00 GMT (envelope-from whu@FreeBSD.org) Received: (from whu@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4MBL0jO063945; Fri, 22 May 2015 11:21:00 GMT (envelope-from whu@FreeBSD.org) Message-Id: <201505221121.t4MBL0jO063945@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: whu set sender to whu@FreeBSD.org using -f From: Wei Hu Date: Fri, 22 May 2015 11:21:00 +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: r283284 - stable/10/sys/i386/include 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.20 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, 22 May 2015 11:21:00 -0000 Author: whu Date: Fri May 22 11:20:59 2015 New Revision: 283284 URL: https://svnweb.freebsd.org/changeset/base/283284 Log: Fix a i386 build failure cause by commit r283280. Modified: stable/10/sys/i386/include/apicvar.h Modified: stable/10/sys/i386/include/apicvar.h ============================================================================== --- stable/10/sys/i386/include/apicvar.h Fri May 22 11:09:41 2015 (r283283) +++ stable/10/sys/i386/include/apicvar.h Fri May 22 11:20:59 2015 (r283284) @@ -215,6 +215,7 @@ int lapic_set_lvt_triggermode(u_int apic void lapic_set_tpr(u_int vector); void lapic_setup(int boot); void xen_intr_handle_upcall(struct trapframe *frame); +void hv_vector_handler(struct trapframe *frame); #endif /* !LOCORE */ #endif /* _MACHINE_APICVAR_H_ */ From owner-svn-src-stable-10@FreeBSD.ORG Fri May 22 16:38:56 2015 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6D0FFDC0; Fri, 22 May 2015 16:38:56 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5A9371C97; Fri, 22 May 2015 16:38:56 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4MGcuH1022912; Fri, 22 May 2015 16:38:56 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4MGcuSQ022911; Fri, 22 May 2015 16:38:56 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201505221638.t4MGcuSQ022911@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Fri, 22 May 2015 16:38: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: r283289 - stable/10/sys/boot/powerpc/ps3 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.20 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, 22 May 2015 16:38:56 -0000 Author: gjb Date: Fri May 22 16:38:55 2015 New Revision: 283289 URL: https://svnweb.freebsd.org/changeset/base/283289 Log: MFC r281011 (jkim): Fix powerpc, powerpc64 build. Sponsored by: The FreeBSD Foundation Modified: stable/10/sys/boot/powerpc/ps3/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/boot/powerpc/ps3/Makefile ============================================================================== --- stable/10/sys/boot/powerpc/ps3/Makefile Fri May 22 15:57:42 2015 (r283288) +++ stable/10/sys/boot/powerpc/ps3/Makefile Fri May 22 16:38:55 2015 (r283289) @@ -113,6 +113,7 @@ loader.help: help.common help.ps3 ${.CUR cat ${.ALLSRC} | \ awk -f ${.CURDIR}/../../common/merge_help.awk > ${.TARGET} +.PATH: ${.CURDIR}/../../forth .include "${.CURDIR}/../../forth/Makefile.inc" .if !exists(${DESTDIR}/boot/loader.rc) From owner-svn-src-stable-10@FreeBSD.ORG Fri May 22 21:51:38 2015 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.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id F2CE28F6; Fri, 22 May 2015 21:51: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E0DCC12CE; Fri, 22 May 2015 21:51:37 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4MLpbiN094091; Fri, 22 May 2015 21:51:37 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4MLpb76094089; Fri, 22 May 2015 21:51:37 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201505222151.t4MLpb76094089@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 22 May 2015 21:51: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: r283303 - in stable/10/sys: amd64/include netpfil/pf 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.20 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, 22 May 2015 21:51:38 -0000 Author: jhb Date: Fri May 22 21:51:36 2015 New Revision: 283303 URL: https://svnweb.freebsd.org/changeset/base/283303 Log: MFC 266852,270223: - Fix pf(4) to build with MAXCPU set to 256. MAXCPU is actually a count, not a maximum ID value (so it is a cap on mp_ncpus, not mp_maxid). - Bump MAXCPU on amd64 from 64 to 256. In practice APIC only permits 255 CPUs (IDs 0 through 254). Getting above that limit requires x2APIC. Modified: stable/10/sys/amd64/include/param.h stable/10/sys/netpfil/pf/pf.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/amd64/include/param.h ============================================================================== --- stable/10/sys/amd64/include/param.h Fri May 22 21:38:11 2015 (r283302) +++ stable/10/sys/amd64/include/param.h Fri May 22 21:51:36 2015 (r283303) @@ -65,7 +65,7 @@ #if defined(SMP) || defined(KLD_MODULE) #ifndef MAXCPU -#define MAXCPU 64 +#define MAXCPU 256 #endif #else #define MAXCPU 1 Modified: stable/10/sys/netpfil/pf/pf.c ============================================================================== --- stable/10/sys/netpfil/pf/pf.c Fri May 22 21:38:11 2015 (r283302) +++ stable/10/sys/netpfil/pf/pf.c Fri May 22 21:51:36 2015 (r283303) @@ -195,7 +195,7 @@ VNET_DEFINE(uint64_t, pf_stateid[MAXCPU] #define PFID_CPUSHIFT (sizeof(uint64_t) * NBBY - PFID_CPUBITS) #define PFID_CPUMASK ((uint64_t)((1 << PFID_CPUBITS) - 1) << PFID_CPUSHIFT) #define PFID_MAXID (~PFID_CPUMASK) -CTASSERT((1 << PFID_CPUBITS) > MAXCPU); +CTASSERT((1 << PFID_CPUBITS) >= MAXCPU); static void pf_src_tree_remove_state(struct pf_state *); static void pf_init_threshold(struct pf_threshold *, u_int32_t, From owner-svn-src-stable-10@FreeBSD.ORG Fri May 22 23:54:13 2015 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.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B42362C4; Fri, 22 May 2015 23:54: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A287B1FCA; Fri, 22 May 2015 23:54:13 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4MNsD1e054900; Fri, 22 May 2015 23:54:13 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4MNsDOI054899; Fri, 22 May 2015 23:54:13 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201505222354.t4MNsDOI054899@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 22 May 2015 23:54:13 +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: r283305 - stable/10/sys/dev/pci 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.20 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, 22 May 2015 23:54:13 -0000 Author: jhb Date: Fri May 22 23:54:12 2015 New Revision: 283305 URL: https://svnweb.freebsd.org/changeset/base/283305 Log: MFC 281872: Fix some incorrect #if conditions around older workarounds for bus numbering goofs. Modified: stable/10/sys/dev/pci/pci_pci.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/pci/pci_pci.c ============================================================================== --- stable/10/sys/dev/pci/pci_pci.c Fri May 22 23:07:55 2015 (r283304) +++ stable/10/sys/dev/pci/pci_pci.c Fri May 22 23:54:12 2015 (r283305) @@ -946,7 +946,7 @@ pcib_attach_common(device_t dev) * Quirk handling. */ switch (pci_get_devid(dev)) { -#if !defined(NEW_PCIB) && !defined(PCI_RES_BUS) +#if !(defined(NEW_PCIB) && defined(PCI_RES_BUS)) case 0x12258086: /* Intel 82454KX/GX (Orion) */ { uint8_t supbus; @@ -972,7 +972,7 @@ pcib_attach_common(device_t dev) sc->flags |= PCIB_SUBTRACTIVE; break; -#if !defined(NEW_PCIB) && !defined(PCI_RES_BUS) +#if !(defined(NEW_PCIB) && defined(PCI_RES_BUS)) /* Compaq R3000 BIOS sets wrong subordinate bus number. */ case 0x00dd10de: { From owner-svn-src-stable-10@FreeBSD.ORG Fri May 22 23:56:00 2015 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.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id BC79841A; Fri, 22 May 2015 23:56: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AA8C51FE1; Fri, 22 May 2015 23:56:00 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4MNu0m2055246; Fri, 22 May 2015 23:56:00 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4MNu0Y6055245; Fri, 22 May 2015 23:56:00 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201505222356.t4MNu0Y6055245@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 22 May 2015 23:56:00 +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: r283306 - 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.20 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, 22 May 2015 23:56:00 -0000 Author: jhb Date: Fri May 22 23:55:59 2015 New Revision: 283306 URL: https://svnweb.freebsd.org/changeset/base/283306 Log: MFC 282273: Update this page to note that XENHVM now works on i386. (It shipped enabled in GENERIC in 10.0.) Modified: stable/10/share/man/man4/xen.4 Directory Properties: stable/10/ (props changed) Modified: stable/10/share/man/man4/xen.4 ============================================================================== --- stable/10/share/man/man4/xen.4 Fri May 22 23:54:12 2015 (r283305) +++ stable/10/share/man/man4/xen.4 Fri May 22 23:55:59 2015 (r283306) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 17, 2010 +.Dd April 30, 2015 .Dt XEN 4 .Os .Sh NAME @@ -44,8 +44,8 @@ the following lines in your kernel confi .Ed .Pp To compile hardware-assisted virtualization (HVM) Xen guest support with -para-virtualized drivers into an amd64 kernel, place the following lines in -your kernel configuration file: +para-virtualized drivers into an amd64 or i386 kernel, +place the following lines in your kernel configuration file: .Bd -ragged -offset indent .Cd "options XENHVM" .Cd "device xenpci" @@ -176,9 +176,6 @@ is only able to run as a Xen guest (DomU A fully para-virtualized (PV) kernel is only supported on i386, and not amd64. .Pp -Para-virtualized drivers under hardware-assisted virtualization (HVM) kernel -are only supported on amd64, not i386. -.Pp As of this release, Xen PV DomU support is not heavily tested; instability has been reported during VM migration of PV kernels. .Pp From owner-svn-src-stable-10@FreeBSD.ORG Sat May 23 09:14:31 2015 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 68FB53FD; Sat, 23 May 2015 09:14:31 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 56A6B16DA; Sat, 23 May 2015 09:14:31 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4N9EVfo032549; Sat, 23 May 2015 09:14:31 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4N9EUMX032545; Sat, 23 May 2015 09:14:30 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201505230914.t4N9EUMX032545@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 23 May 2015 09:14: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: r283310 - 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.20 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, 23 May 2015 09:14:31 -0000 Author: kib Date: Sat May 23 09:14:29 2015 New Revision: 283310 URL: https://svnweb.freebsd.org/changeset/base/283310 Log: MFC r282690: Call uma_reclaim() from the additional pagedaemon thread to reclaim kmem arena address space. Modified: stable/10/sys/kern/kern_malloc.c stable/10/sys/vm/uma.h stable/10/sys/vm/uma_core.c stable/10/sys/vm/vm_pageout.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/kern_malloc.c ============================================================================== --- stable/10/sys/kern/kern_malloc.c Sat May 23 08:02:54 2015 (r283309) +++ stable/10/sys/kern/kern_malloc.c Sat May 23 09:14:29 2015 (r283310) @@ -667,13 +667,15 @@ reallocf(void *addr, unsigned long size, } /* - * Wake the page daemon when we exhaust KVA. It will call the lowmem handler - * and uma_reclaim() callbacks in a context that is safe. + * Wake the uma reclamation pagedaemon thread when we exhaust KVA. It + * will call the lowmem handler and uma_reclaim() callbacks in a + * context that is safe. */ static void kmem_reclaim(vmem_t *vm, int flags) { + uma_reclaim_wakeup(); pagedaemon_wakeup(); } Modified: stable/10/sys/vm/uma.h ============================================================================== --- stable/10/sys/vm/uma.h Sat May 23 08:02:54 2015 (r283309) +++ stable/10/sys/vm/uma.h Sat May 23 09:14:29 2015 (r283310) @@ -689,4 +689,7 @@ struct uma_percpu_stat { uint64_t _ups_reserved[5]; /* Reserved. */ }; +void uma_reclaim_wakeup(void); +void uma_reclaim_worker(void *); + #endif /* _VM_UMA_H_ */ Modified: stable/10/sys/vm/uma_core.c ============================================================================== --- stable/10/sys/vm/uma_core.c Sat May 23 08:02:54 2015 (r283309) +++ stable/10/sys/vm/uma_core.c Sat May 23 09:14:29 2015 (r283310) @@ -3192,16 +3192,17 @@ uma_find_refcnt(uma_zone_t zone, void *i } /* See uma.h */ -void -uma_reclaim(void) +static void +uma_reclaim_locked(bool kmem_danger) { + #ifdef UMA_DEBUG printf("UMA: vm asked us to release pages!\n"); #endif - sx_xlock(&uma_drain_lock); + sx_assert(&uma_drain_lock, SA_XLOCKED); bucket_enable(); zone_foreach(zone_drain); - if (vm_page_count_min()) { + if (vm_page_count_min() || kmem_danger) { cache_drain_safe(NULL); zone_foreach(zone_drain); } @@ -3213,9 +3214,42 @@ uma_reclaim(void) zone_drain(slabzone); zone_drain(slabrefzone); bucket_zone_drain(); +} + +void +uma_reclaim(void) +{ + + sx_xlock(&uma_drain_lock); + uma_reclaim_locked(false); sx_xunlock(&uma_drain_lock); } +static int uma_reclaim_needed; + +void +uma_reclaim_wakeup(void) +{ + + uma_reclaim_needed = 1; + wakeup(&uma_reclaim_needed); +} + +void +uma_reclaim_worker(void *arg __unused) +{ + + sx_xlock(&uma_drain_lock); + for (;;) { + sx_sleep(&uma_reclaim_needed, &uma_drain_lock, PVM, + "umarcl", 0); + if (uma_reclaim_needed) { + uma_reclaim_needed = 0; + uma_reclaim_locked(true); + } + } +} + /* See uma.h */ int uma_zone_exhausted(uma_zone_t zone) Modified: stable/10/sys/vm/vm_pageout.c ============================================================================== --- stable/10/sys/vm/vm_pageout.c Sat May 23 08:02:54 2015 (r283309) +++ stable/10/sys/vm/vm_pageout.c Sat May 23 09:14:29 2015 (r283310) @@ -1726,8 +1726,9 @@ vm_pageout_init(void) static void vm_pageout(void) { + int error; #if MAXMEMDOM > 1 - int error, i; + int i; #endif swap_pager_swap_init(); @@ -1741,6 +1742,10 @@ vm_pageout(void) } } #endif + error = kthread_add(uma_reclaim_worker, NULL, curproc, NULL, + 0, 0, "uma"); + if (error != 0) + panic("starting uma_reclaim helper, error %d\n", error); vm_pageout_worker((void *)(uintptr_t)0); } From owner-svn-src-stable-10@FreeBSD.ORG Sat May 23 09:16:36 2015 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2043878E; Sat, 23 May 2015 09:16:36 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0D6C816FC; Sat, 23 May 2015 09:16:36 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4N9GZav033059; Sat, 23 May 2015 09:16:35 GMT (envelope-from rodrigc@FreeBSD.org) Received: (from rodrigc@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4N9GZke033058; Sat, 23 May 2015 09:16:35 GMT (envelope-from rodrigc@FreeBSD.org) Message-Id: <201505230916.t4N9GZke033058@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: rodrigc set sender to rodrigc@FreeBSD.org using -f From: Craig Rodrigues Date: Sat, 23 May 2015 09:16: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: r283311 - stable/10/contrib/netbsd-tests/bin/expr 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.20 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, 23 May 2015 09:16:36 -0000 Author: rodrigc Date: Sat May 23 09:16:35 2015 New Revision: 283311 URL: https://svnweb.freebsd.org/changeset/base/283311 Log: Merge: r277829 Revert r277357 as expr has been enhanced to better detect overflow conditions, and now the tests pass PR: 196867 X-MFC with: r277798 MFC after: 1 week Sponsored by: EMC / Isilon Storage Division Modified: stable/10/contrib/netbsd-tests/bin/expr/t_expr.sh Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/netbsd-tests/bin/expr/t_expr.sh ============================================================================== --- stable/10/contrib/netbsd-tests/bin/expr/t_expr.sh Sat May 23 09:14:29 2015 (r283310) +++ stable/10/contrib/netbsd-tests/bin/expr/t_expr.sh Sat May 23 09:16:35 2015 (r283311) @@ -54,9 +54,6 @@ overflow_head() { atf_set "descr" "Test overflow cases" } overflow_body() { - # Begin FreeBSD - atf_expect_fail "FreeBSD's expr does not check overflow to the same degree NetBSD's expr does; see bug 196867 for more details" - # End FreeBSD test_expr '4611686018427387904 + 4611686018427387903' \ '9223372036854775807' test_expr '4611686018427387904 + 4611686018427387904' \ From owner-svn-src-stable-10@FreeBSD.ORG Sat May 23 09:49:00 2015 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.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 88B11BBA; Sat, 23 May 2015 09:49: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 69A0F1A43; Sat, 23 May 2015 09:49:00 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4N9n0N1048139; Sat, 23 May 2015 09:49:00 GMT (envelope-from rodrigc@FreeBSD.org) Received: (from rodrigc@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4N9n00p048129; Sat, 23 May 2015 09:49:00 GMT (envelope-from rodrigc@FreeBSD.org) Message-Id: <201505230949.t4N9n00p048129@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: rodrigc set sender to rodrigc@FreeBSD.org using -f From: Craig Rodrigues Date: Sat, 23 May 2015 09:48: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: r283312 - stable/10/bin/pkill/tests 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.20 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, 23 May 2015 09:49:00 -0000 Author: rodrigc Date: Sat May 23 09:48:59 2015 New Revision: 283312 URL: https://svnweb.freebsd.org/changeset/base/283312 Log: Merge: 278618 278633 278636 278653 278742 278776 279121 Multiple fixes for pgrep and pkill tests. PR: 19109 Modified: stable/10/bin/pkill/tests/pgrep-j_test.sh stable/10/bin/pkill/tests/pkill-j_test.sh Directory Properties: stable/10/ (props changed) Modified: stable/10/bin/pkill/tests/pgrep-j_test.sh ============================================================================== --- stable/10/bin/pkill/tests/pgrep-j_test.sh Sat May 23 09:16:35 2015 (r283311) +++ stable/10/bin/pkill/tests/pgrep-j_test.sh Sat May 23 09:48:59 2015 (r283312) @@ -4,94 +4,88 @@ jail_name_to_jid() { local check_name="$1" - ( - line="$(jls -n 2> /dev/null | grep name=$check_name )" - for nv in $line; do - local name="${nv%=*}" - if [ "${name}" = "jid" ]; then - eval $nv - echo $jid - break - fi - done - ) + jls -j "$check_name" -s | tr ' ' '\n' | grep jid= | sed -e 's/.*=//g' } base=pgrep_j_test +if [ `id -u` -ne 0 ]; then + echo "1..0 # skip Test needs uid 0." + exit 0 +fi + echo "1..3" +sleep=$(pwd)/sleep.txt +ln -sf /bin/sleep $sleep + name="pgrep -j " -if [ `id -u` -eq 0 ]; then - sleep=$(pwd)/sleep.txt - ln -sf /bin/sleep $sleep - jail -c path=/ name=${base}_1_1 ip4.addr=127.0.0.1 \ - command=daemon -p ${PWD}/${base}_1_1.pid $sleep 5 & +sleep_amount=5 +jail -c path=/ name=${base}_1_1 ip4.addr=127.0.0.1 \ + command=daemon -p ${PWD}/${base}_1_1.pid $sleep $sleep_amount & - jail -c path=/ name=${base}_1_2 ip4.addr=127.0.0.1 \ - command=daemon -p ${PWD}/${base}_1_2.pid $sleep 5 & +jail -c path=/ name=${base}_1_2 ip4.addr=127.0.0.1 \ + command=daemon -p ${PWD}/${base}_1_2.pid $sleep $sleep_amount & +for i in `seq 1 10`; do jid1=$(jail_name_to_jid ${base}_1_1) jid2=$(jail_name_to_jid ${base}_1_2) jid="${jid1},${jid2}" - pid1="$(pgrep -f -x -j $jid "$sleep 5" | sort)" - pid2=$(printf "%s\n%s" "$(cat ${PWD}/${base}_1_1.pid)" \ - $(cat ${PWD}/${base}_1_2.pid) | sort) - if [ "$pid1" = "$pid2" ]; then - echo "ok 1 - $name" - else - echo "not ok 1 - $name" - fi - [ -f ${PWD}/${base}_1_1.pid ] && kill $(cat ${PWD}/${base}_1_1.pid) - [ -f ${PWD}/${base}_1_2.pid ] && kill $(cat ${PWD}/${base}_1_2.pid) - rm -f $sleep + case "$jid" in + [0-9]+,[0-9]+) + break + ;; + esac + sleep 0.1 +done +sleep 0.5 + +pid1="$(pgrep -f -x -j "$jid" "$sleep $sleep_amount" | sort)" +pid2=$(printf "%s\n%s" "$(cat ${PWD}/${base}_1_1.pid)" \ + $(cat ${PWD}/${base}_1_2.pid) | sort) +if [ "$pid1" = "$pid2" ]; then + echo "ok 1 - $name" else - echo "ok 1 - $name # skip Test needs uid 0." + echo "not ok 1 - $name # pgrep output: '$(echo $pid1)', pidfile output: '$(echo $pid2)'" fi +[ -f ${PWD}/${base}_1_1.pid ] && kill $(cat ${PWD}/${base}_1_1.pid) +[ -f ${PWD}/${base}_1_2.pid ] && kill $(cat ${PWD}/${base}_1_2.pid) +wait name="pgrep -j any" -if [ `id -u` -eq 0 ]; then - sleep=$(pwd)/sleep.txt - ln -sf /bin/sleep $sleep - jail -c path=/ name=${base}_2_1 ip4.addr=127.0.0.1 \ - command=daemon -p ${PWD}/${base}_2_1.pid $sleep 5 & - - jail -c path=/ name=${base}_2_2 ip4.addr=127.0.0.1 \ - command=daemon -p ${PWD}/${base}_2_2.pid $sleep 5 & - - sleep 2 - pid1="$(pgrep -f -x -j any "$sleep 5" | sort)" - pid2=$(printf "%s\n%s" "$(cat ${PWD}/${base}_2_1.pid)" \ - $(cat ${PWD}/${base}_2_2.pid) | sort) - if [ "$pid1" = "$pid2" ]; then - echo "ok 2 - $name" - else - echo "not ok 2 - $name" - fi - [ -f ${PWD}/${base}_2_1.pid ] && kill $(cat ${PWD}/${base}_2_1.pid) - [ -f ${PWD}/${base}_2_2.pid ] && kill $(cat ${PWD}/${base}_2_2.pid) - rm -f $sleep +sleep_amount=6 +jail -c path=/ name=${base}_2_1 ip4.addr=127.0.0.1 \ + command=daemon -p ${PWD}/${base}_2_1.pid $sleep $sleep_amount & + +jail -c path=/ name=${base}_2_2 ip4.addr=127.0.0.1 \ + command=daemon -p ${PWD}/${base}_2_2.pid $sleep $sleep_amount & + +sleep 2 +pid1="$(pgrep -f -x -j any "$sleep $sleep_amount" | sort)" +pid2=$(printf "%s\n%s" "$(cat ${PWD}/${base}_2_1.pid)" \ + $(cat ${PWD}/${base}_2_2.pid) | sort) +if [ "$pid1" = "$pid2" ]; then + echo "ok 2 - $name" else - echo "ok 2 - $name # skip Test needs uid 0." + echo "not ok 2 - $name # pgrep output: '$(echo $pid1)', pidfile output: '$(echo $pid2)'" fi +[ -f ${PWD}/${base}_2_1.pid ] && kill $(cat ${PWD}/${base}_2_1.pid) +[ -f ${PWD}/${base}_2_2.pid ] && kill $(cat ${PWD}/${base}_2_2.pid) +wait name="pgrep -j none" -if [ `id -u` -eq 0 ]; then - sleep=$(pwd)/sleep.txt - ln -sf /bin/sleep $sleep - daemon -p ${PWD}/${base}_3_1.pid $sleep 5 & - jail -c path=/ name=${base}_3_2 ip4.addr=127.0.0.1 \ - command=daemon -p ${PWD}/${base}_3_2.pid $sleep 5 & - sleep 2 - pid="$(pgrep -f -x -j none "$sleep 5")" - if [ "$pid" = "$(cat ${PWD}/${base}_3_1.pid)" ]; then - echo "ok 3 - $name" - else - echo "not ok 3 - $name" - fi - rm -f $sleep - [ -f ${PWD}/${base}_3_1.pid ] && kill $(cat $PWD/${base}_3_1.pid) - [ -f ${PWD}/${base}_3_2.pid ] && kill $(cat $PWD/${base}_3_2.pid) +sleep_amount=7 +daemon -p ${PWD}/${base}_3_1.pid $sleep $sleep_amount & +jail -c path=/ name=${base}_3_2 ip4.addr=127.0.0.1 \ + command=daemon -p ${PWD}/${base}_3_2.pid $sleep $sleep_amount & +sleep 2 +pid="$(pgrep -f -x -j none "$sleep $sleep_amount")" +if [ "$pid" = "$(cat ${PWD}/${base}_3_1.pid)" ]; then + echo "ok 3 - $name" else - echo "ok 3 - $name # skip Test needs uid 0." + echo "not ok 3 - $name # pgrep output: '$(echo $pid1)', pidfile output: '$(echo $pid2)'" fi +[ -f ${PWD}/${base}_3_1.pid ] && kill $(cat $PWD/${base}_3_1.pid) +[ -f ${PWD}/${base}_3_2.pid ] && kill $(cat $PWD/${base}_3_2.pid) + +rm -f $sleep Modified: stable/10/bin/pkill/tests/pkill-j_test.sh ============================================================================== --- stable/10/bin/pkill/tests/pkill-j_test.sh Sat May 23 09:16:35 2015 (r283311) +++ stable/10/bin/pkill/tests/pkill-j_test.sh Sat May 23 09:48:59 2015 (r283312) @@ -4,99 +4,91 @@ jail_name_to_jid() { local check_name="$1" - ( - line="$(jls -n 2> /dev/null | grep name=$check_name )" - for nv in $line; do - local name="${nv%=*}" - if [ "${name}" = "jid" ]; then - eval $nv - echo $jid - break - fi - done - ) + jls -j "$check_name" -s | tr ' ' '\n' | grep jid= | sed -e 's/.*=//g' } base=pkill_j_test +if [ `id -u` -ne 0 ]; then + echo "1..0 # skip Test needs uid 0." + exit 0 +fi + echo "1..3" +sleep=$(pwd)/sleep.txt +ln -sf /bin/sleep $sleep + name="pkill -j " -if [ `id -u` -eq 0 ]; then - sleep=$(pwd)/sleep.txt - ln -sf /bin/sleep $sleep - jail -c path=/ name=${base}_1_1 ip4.addr=127.0.0.1 \ - command=daemon -p ${PWD}/${base}_1_1.pid $sleep 5 & +sleep_amount=5 +jail -c path=/ name=${base}_1_1 ip4.addr=127.0.0.1 \ + command=daemon -p ${PWD}/${base}_1_1.pid $sleep $sleep_amount & + +jail -c path=/ name=${base}_1_2 ip4.addr=127.0.0.1 \ + command=daemon -p ${PWD}/${base}_1_2.pid $sleep $sleep_amount & - jail -c path=/ name=${base}_1_2 ip4.addr=127.0.0.1 \ - command=daemon -p ${PWD}/${base}_1_2.pid $sleep 5 & +$sleep $sleep_amount & - $sleep 5 & - sleep 0.5 +for i in `seq 1 10`; do jid1=$(jail_name_to_jid ${base}_1_1) jid2=$(jail_name_to_jid ${base}_1_2) jid="${jid1},${jid2}" - if pkill -f -j "$jid" $sleep && sleep 0.5 && - ! -f ${PWD}/${base}_1_1.pid && - ! -f ${PWD}/${base}_1_2.pid ; then - echo "ok 1 - $name" - else - echo "not ok 1 - $name" - fi 2>/dev/null - rm -f $sleep - [ -f ${PWD}/${base}_1_1.pid ] && kill $(cat ${PWD}/${base}_1_1.pid) - [ -f ${PWD}/${base}_1_2.pid ] && kill $(cat ${PWD}/${base}_1_2.pid) - wait + case "$jid" in + [0-9]+,[0-9]+) + break + ;; + esac + sleep 0.1 +done +sleep 0.5 + +if pkill -f -j "$jid" $sleep && sleep 0.5 && + ! -f ${PWD}/${base}_1_1.pid && + ! -f ${PWD}/${base}_1_2.pid ; then + echo "ok 1 - $name" else - echo "ok 1 - $name # skip Test needs uid 0." -fi + echo "not ok 1 - $name" +fi 2>/dev/null +[ -f ${PWD}/${base}_1_1.pid ] && kill $(cat ${PWD}/${base}_1_1.pid) +[ -f ${PWD}/${base}_1_2.pid ] && kill $(cat ${PWD}/${base}_1_2.pid) +wait name="pkill -j any" -if [ `id -u` -eq 0 ]; then - sleep=$(pwd)/sleep.txt - ln -sf /bin/sleep $sleep - jail -c path=/ name=${base}_2_1 ip4.addr=127.0.0.1 \ - command=daemon -p ${PWD}/${base}_2_1.pid $sleep 5 & - - jail -c path=/ name=${base}_2_2 ip4.addr=127.0.0.1 \ - command=daemon -p ${PWD}/${base}_2_2.pid $sleep 5 & - - $sleep 5 & - sleep 0.5 - chpid3=$! - if pkill -f -j any $sleep && sleep 0.5 && - [ ! -f ${PWD}/${base}_2_1.pid -a - ! -f ${PWD}/${base}_2_2.pid ] && kill $chpid3; then - echo "ok 2 - $name" - else - echo "not ok 2 - $name" - fi 2>/dev/null - rm -f $sleep - [ -f ${PWD}/${base}_2_1.pid ] && kill $(cat ${PWD}/${base}_2_1.pid) - [ -f ${PWD}/${base}_2_2.pid ] && kill $(cat ${PWD}/${base}_2_2.pid) - wait +sleep_amount=6 +jail -c path=/ name=${base}_2_1 ip4.addr=127.0.0.1 \ + command=daemon -p ${PWD}/${base}_2_1.pid $sleep $sleep_amount & + +jail -c path=/ name=${base}_2_2 ip4.addr=127.0.0.1 \ + command=daemon -p ${PWD}/${base}_2_2.pid $sleep $sleep_amount & + +$sleep $sleep_amount & +chpid3=$! +sleep 0.5 +if pkill -f -j any $sleep && sleep 0.5 && + [ ! -f ${PWD}/${base}_2_1.pid -a + ! -f ${PWD}/${base}_2_2.pid ] && kill $chpid3; then + echo "ok 2 - $name" else - echo "ok 2 - $name # skip Test needs uid 0." -fi + echo "not ok 2 - $name" +fi 2>/dev/null +[ -f ${PWD}/${base}_2_1.pid ] && kill $(cat ${PWD}/${base}_2_1.pid) +[ -f ${PWD}/${base}_2_2.pid ] && kill $(cat ${PWD}/${base}_2_2.pid) +wait name="pkill -j none" -if [ `id -u` -eq 0 ]; then - sleep=$(pwd)/sleep.txt - ln -sf /bin/sleep $sleep - daemon -p ${PWD}/${base}_3_1.pid $sleep 5 - jail -c path=/ name=${base}_3_2 ip4.addr=127.0.0.1 \ - command=daemon -p ${PWD}/${base}_3_2.pid $sleep 5 & - sleep 1 - if pkill -f -j none "$sleep 5" && sleep 1 && - [ ! -f ${PWD}/${base}_3_1.pid -a -f ${PWD}/${base}_3_2.pid ] ; then - echo "ok 3 - $name" - else - ls ${PWD}/*.pid - echo "not ok 3 - $name" - fi 2>/dev/null - rm -f $sleep - [ -f ${PWD}/${base}_3_1.pid ] && kill $(cat ${base}_3_1.pid) - [ -f ${PWD}/${base}_3_2.pid ] && kill $(cat ${base}_3_2.pid) +sleep_amount=7 +daemon -p ${PWD}/${base}_3_1.pid $sleep $sleep_amount +jail -c path=/ name=${base}_3_2 ip4.addr=127.0.0.1 \ + command=daemon -p ${PWD}/${base}_3_2.pid $sleep $sleep_amount & +sleep 1 +if pkill -f -j none "$sleep $sleep_amount" && sleep 1 && + [ ! -f ${PWD}/${base}_3_1.pid -a -f ${PWD}/${base}_3_2.pid ] ; then + echo "ok 3 - $name" else - echo "ok 3 - $name # skip Test needs uid 0." -fi + ls ${PWD}/*.pid + echo "not ok 3 - $name" +fi 2>/dev/null +[ -f ${PWD}/${base}_3_1.pid ] && kill $(cat ${base}_3_1.pid) +[ -f ${PWD}/${base}_3_2.pid ] && kill $(cat ${base}_3_2.pid) + +rm -f $sleep From owner-svn-src-stable-10@FreeBSD.ORG Sat May 23 17:30:32 2015 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D517CD85; Sat, 23 May 2015 17:30:31 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B83651852; Sat, 23 May 2015 17:30:31 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4NHUVqo082456; Sat, 23 May 2015 17:30:31 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4NHUVZj082453; Sat, 23 May 2015 17:30:31 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201505231730.t4NHUVZj082453@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 23 May 2015 17:30: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: r283317 - in stable/10/sys/arm: arm include 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.20 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, 23 May 2015 17:30:32 -0000 Author: ian Date: Sat May 23 17:30:30 2015 New Revision: 283317 URL: https://svnweb.freebsd.org/changeset/base/283317 Log: MFC r278770, r279114, r279215, r279338, r279543: Add logic for handling new-style ARM cpu ID info. Correct a comment which was exactly backwards from reality. There is no reason to do i+dcache writeback and invalidate when changing the translation table (this may be left over from armv5 days). It's especially bad to do so using a cache operation that isn't coherent on SMP systems. Add casting to make atomic ops work for pointers. (Apparently nobody has ever done atomic ops on pointers before now on arm). Revert incorrect casting. Modified: stable/10/sys/arm/arm/cpufunc_asm_armv7.S stable/10/sys/arm/arm/cpuinfo.c stable/10/sys/arm/include/atomic.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/arm/arm/cpufunc_asm_armv7.S ============================================================================== --- stable/10/sys/arm/arm/cpufunc_asm_armv7.S Sat May 23 16:54:46 2015 (r283316) +++ stable/10/sys/arm/arm/cpufunc_asm_armv7.S Sat May 23 17:30:30 2015 (r283317) @@ -66,11 +66,7 @@ __FBSDID("$FreeBSD$"); #endif ENTRY(armv7_setttb) - stmdb sp!, {r0, lr} - bl _C_LABEL(armv7_idcache_wbinv_all) /* clean the D cache */ - ldmia sp!, {r0, lr} dsb - orr r0, r0, #PT_ATTR mcr CP15_TTBR0(r0) isb Modified: stable/10/sys/arm/arm/cpuinfo.c ============================================================================== --- stable/10/sys/arm/arm/cpuinfo.c Sat May 23 16:54:46 2015 (r283316) +++ stable/10/sys/arm/arm/cpuinfo.c Sat May 23 17:30:30 2015 (r283317) @@ -58,9 +58,13 @@ cpuinfo_init(void) /* ARMv4T CPU */ cpuinfo.architecture = 1; cpuinfo.revision = (cpuinfo.midr >> 16) & 0x7F; - } + } else { + /* ARM new id scheme */ + cpuinfo.architecture = (cpuinfo.midr >> 16) & 0x0F; + cpuinfo.revision = (cpuinfo.midr >> 20) & 0x0F; + } } else { - /* must be new id scheme */ + /* non ARM -> must be new id scheme */ cpuinfo.architecture = (cpuinfo.midr >> 16) & 0x0F; cpuinfo.revision = (cpuinfo.midr >> 20) & 0x0F; } Modified: stable/10/sys/arm/include/atomic.h ============================================================================== --- stable/10/sys/arm/include/atomic.h Sat May 23 16:54:46 2015 (r283316) +++ stable/10/sys/arm/include/atomic.h Sat May 23 17:30:30 2015 (r283317) @@ -582,8 +582,8 @@ atomic_load_64(volatile uint64_t *p) /* * The only way to atomically load 64 bits is with LDREXD which puts the - * exclusive monitor into the open state, so reset it with CLREX because - * we don't actually need to store anything. + * exclusive monitor into the exclusive state, so reset it to open state + * with CLREX because we don't actually need to store anything. */ __asm __volatile( "1: \n" From owner-svn-src-stable-10@FreeBSD.ORG Sat May 23 17:43:04 2015 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.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id EF22CFAD; Sat, 23 May 2015 17:43:03 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D03351A3B; Sat, 23 May 2015 17:43:03 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4NHh3ZZ090691; Sat, 23 May 2015 17:43:03 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4NHh3QQ090689; Sat, 23 May 2015 17:43:03 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201505231743.t4NHh3QQ090689@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 23 May 2015 17:43:03 +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: r283318 - in stable/10/sys/dev: mmc sdhci 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.20 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, 23 May 2015 17:43:04 -0000 Author: ian Date: Sat May 23 17:43:02 2015 New Revision: 283318 URL: https://svnweb.freebsd.org/changeset/base/283318 Log: MFC r279359, r279360: For new eMMC chips, we must signal controller HC capability in OP_COND command. Detect, report and use 8-bit bus if is available. Modified: stable/10/sys/dev/mmc/mmc.c stable/10/sys/dev/sdhci/sdhci.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/mmc/mmc.c ============================================================================== --- stable/10/sys/dev/mmc/mmc.c Sat May 23 17:30:30 2015 (r283317) +++ stable/10/sys/dev/mmc/mmc.c Sat May 23 17:43:02 2015 (r283318) @@ -1622,7 +1622,7 @@ mmc_go_discovery(struct mmc_softc *sc) mmc_send_app_op_cond(sc, (err ? 0 : MMC_OCR_CCS) | mmcbr_get_ocr(dev), NULL); } else - mmc_send_op_cond(sc, mmcbr_get_ocr(dev), NULL); + mmc_send_op_cond(sc, MMC_OCR_CCS | mmcbr_get_ocr(dev), NULL); mmc_discover_cards(sc); mmc_rescan_cards(sc); Modified: stable/10/sys/dev/sdhci/sdhci.c ============================================================================== --- stable/10/sys/dev/sdhci/sdhci.c Sat May 23 17:30:30 2015 (r283317) +++ stable/10/sys/dev/sdhci/sdhci.c Sat May 23 17:43:02 2015 (r283318) @@ -584,6 +584,8 @@ sdhci_init_slot(device_t dev, struct sdh "support voltages.\n"); } slot->host.caps = MMC_CAP_4_BIT_DATA; + if (caps & SDHCI_CAN_DO_8BITBUS) + slot->host.caps |= MMC_CAP_8_BIT_DATA; if (caps & SDHCI_CAN_DO_HISPD) slot->host.caps |= MMC_CAP_HSPEED; /* Decide if we have usable DMA. */ @@ -603,9 +605,11 @@ sdhci_init_slot(device_t dev, struct sdh slot->opt &= ~SDHCI_HAVE_DMA; if (bootverbose || sdhci_debug) { - slot_printf(slot, "%uMHz%s 4bits%s%s%s %s\n", + slot_printf(slot, "%uMHz%s %s%s%s%s %s\n", slot->max_clk / 1000000, (caps & SDHCI_CAN_DO_HISPD) ? " HS" : "", + (caps & MMC_CAP_8_BIT_DATA) ? "8bits" : + ((caps & MMC_CAP_4_BIT_DATA) ? "4bits" : "1bit"), (caps & SDHCI_CAN_VDD_330) ? " 3.3V" : "", (caps & SDHCI_CAN_VDD_300) ? " 3.0V" : "", (caps & SDHCI_CAN_VDD_180) ? " 1.8V" : "", @@ -692,11 +696,19 @@ sdhci_generic_update_ios(device_t brdev, } /* Configure the bus. */ sdhci_set_clock(slot, ios->clock); - sdhci_set_power(slot, (ios->power_mode == power_off)?0:ios->vdd); - if (ios->bus_width == bus_width_4) + sdhci_set_power(slot, (ios->power_mode == power_off) ? 0 : ios->vdd); + if (ios->bus_width == bus_width_8) { + slot->hostctrl |= SDHCI_CTRL_8BITBUS; + slot->hostctrl &= ~SDHCI_CTRL_4BITBUS; + } else if (ios->bus_width == bus_width_4) { + slot->hostctrl &= ~SDHCI_CTRL_8BITBUS; slot->hostctrl |= SDHCI_CTRL_4BITBUS; - else + } else if (ios->bus_width == bus_width_1) { + slot->hostctrl &= ~SDHCI_CTRL_8BITBUS; slot->hostctrl &= ~SDHCI_CTRL_4BITBUS; + } else { + panic("Invalid bus width: %d", ios->bus_width); + } if (ios->timing == bus_timing_hs && !(slot->quirks & SDHCI_QUIRK_DONT_SET_HISPD_BIT)) slot->hostctrl |= SDHCI_CTRL_HISPD; From owner-svn-src-stable-10@FreeBSD.ORG Sat May 23 17:48:09 2015 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.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CC3F7241; Sat, 23 May 2015 17: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BA81C1A70; Sat, 23 May 2015 17:48:09 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4NHm9gR091439; Sat, 23 May 2015 17:48:09 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4NHm9cs091438; Sat, 23 May 2015 17:48:09 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201505231748.t4NHm9cs091438@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 23 May 2015 17: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: r283319 - stable/10/sys/arm/arm 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.20 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, 23 May 2015 17:48:09 -0000 Author: ian Date: Sat May 23 17:48:09 2015 New Revision: 283319 URL: https://svnweb.freebsd.org/changeset/base/283319 Log: MFC r279702: Update a comment that had drifted out of date. Modified: stable/10/sys/arm/arm/physmem.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/arm/arm/physmem.c ============================================================================== --- stable/10/sys/arm/arm/physmem.c Sat May 23 17:43:02 2015 (r283318) +++ stable/10/sys/arm/arm/physmem.c Sat May 23 17:48:09 2015 (r283319) @@ -153,7 +153,7 @@ arm_physmem_print_tables() * Walk the list of hardware regions, processing it against the list of * exclusions that contain the given exflags, and generating an "avail list". * - * Updates the kernel global 'realmem' with the sum of all pages in hw regions. + * Updates the value at *pavail with the sum of all pages in all hw regions. * * Returns the number of pages of non-excluded memory added to the avail list. */ From owner-svn-src-stable-10@FreeBSD.ORG Sat May 23 19:27:06 2015 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A9194C6; Sat, 23 May 2015 19:27: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 94E9C13CD; Sat, 23 May 2015 19:27:06 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4NJR6JG041654; Sat, 23 May 2015 19:27:06 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4NJR5lE041645; Sat, 23 May 2015 19:27:05 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201505231927.t4NJR5lE041645@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 23 May 2015 19:27: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: r283321 - stable/10/sys/dev/uart 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.20 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, 23 May 2015 19:27:06 -0000 Author: ian Date: Sat May 23 19:27:04 2015 New Revision: 283321 URL: https://svnweb.freebsd.org/changeset/base/283321 Log: MFC r272399, r272602, r274451, r274452: Add uart driver for Qualcomm MSM 7000/8000 series chips. It is working on IFC6410 board which has Qualcomm Snapdragon SoC. Use documented compat string for msm uart. Make PL011 UART to wait on putc only when TX FIFO is full Make uart_bus_fdt a decendant of ofwbus Added: stable/10/sys/dev/uart/uart_dev_msm.c - copied unchanged from r272399, head/sys/dev/uart/uart_dev_msm.c stable/10/sys/dev/uart/uart_dev_msm.h - copied unchanged from r272399, head/sys/dev/uart/uart_dev_msm.h Modified: stable/10/sys/dev/uart/uart.h stable/10/sys/dev/uart/uart_bus_fdt.c stable/10/sys/dev/uart/uart_dev_pl011.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/uart/uart.h ============================================================================== --- stable/10/sys/dev/uart/uart.h Sat May 23 19:09:04 2015 (r283320) +++ stable/10/sys/dev/uart/uart.h Sat May 23 19:27:04 2015 (r283321) @@ -65,6 +65,7 @@ struct uart_bas { struct uart_class; extern struct uart_class uart_imx_class __attribute__((weak)); +extern struct uart_class uart_msm_class __attribute__((weak)); extern struct uart_class uart_ns8250_class __attribute__((weak)); extern struct uart_class uart_quicc_class __attribute__((weak)); extern struct uart_class uart_s3c2410_class __attribute__((weak)); Modified: stable/10/sys/dev/uart/uart_bus_fdt.c ============================================================================== --- stable/10/sys/dev/uart/uart_bus_fdt.c Sat May 23 19:09:04 2015 (r283320) +++ stable/10/sys/dev/uart/uart_bus_fdt.c Sat May 23 19:27:04 2015 (r283321) @@ -84,6 +84,7 @@ static struct ofw_compat_data compat_dat {"fsl,imx21-uart", (uintptr_t)&uart_imx_class}, {"fsl,mvf600-uart", (uintptr_t)&uart_vybrid_class}, {"lpc,uart", (uintptr_t)&uart_lpc_class}, + {"qcom,msm-uartdm", (uintptr_t)&uart_msm_class}, {"ti,ns16550", (uintptr_t)&uart_ti8250_class}, {"ns16550", (uintptr_t)&uart_ns8250_class}, {NULL, (uintptr_t)NULL}, @@ -156,3 +157,4 @@ uart_fdt_probe(device_t dev) } DRIVER_MODULE(uart, simplebus, uart_fdt_driver, uart_devclass, 0, 0); +DRIVER_MODULE(uart, ofwbus, uart_fdt_driver, uart_devclass, 0, 0); Copied: stable/10/sys/dev/uart/uart_dev_msm.c (from r272399, head/sys/dev/uart/uart_dev_msm.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/sys/dev/uart/uart_dev_msm.c Sat May 23 19:27:04 2015 (r283321, copy of r272399, head/sys/dev/uart/uart_dev_msm.c) @@ -0,0 +1,568 @@ +/*- + * Copyright (c) 2014 Ganbold Tsagaankhuu + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* Qualcomm MSM7K/8K uart driver */ + +#include +__FBSDID("$FreeBSD$"); + +#include "opt_ddb.h" + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include "uart_if.h" + +#define DEF_CLK 7372800 + +#define GETREG(bas, reg) \ + bus_space_read_4((bas)->bst, (bas)->bsh, (reg)) +#define SETREG(bas, reg, value) \ + bus_space_write_4((bas)->bst, (bas)->bsh, (reg), (value)) + +static int msm_uart_param(struct uart_bas *, int, int, int, int); + +/* + * Low-level UART interface. + */ +static int msm_probe(struct uart_bas *bas); +static void msm_init(struct uart_bas *bas, int, int, int, int); +static void msm_term(struct uart_bas *bas); +static void msm_putc(struct uart_bas *bas, int); +static int msm_rxready(struct uart_bas *bas); +static int msm_getc(struct uart_bas *bas, struct mtx *mtx); + +extern SLIST_HEAD(uart_devinfo_list, uart_devinfo) uart_sysdevs; + +static int +msm_uart_param(struct uart_bas *bas, int baudrate, int databits, + int stopbits, int parity) +{ + int ulcon; + + ulcon = 0; + + switch (databits) { + case 5: + ulcon |= (UART_DM_5_BPS << 4); + break; + case 6: + ulcon |= (UART_DM_6_BPS << 4); + break; + case 7: + ulcon |= (UART_DM_7_BPS << 4); + break; + case 8: + ulcon |= (UART_DM_8_BPS << 4); + break; + default: + return (EINVAL); + } + + switch (parity) { + case UART_PARITY_NONE: + ulcon |= UART_DM_NO_PARITY; + break; + case UART_PARITY_ODD: + ulcon |= UART_DM_ODD_PARITY; + break; + case UART_PARITY_EVEN: + ulcon |= UART_DM_EVEN_PARITY; + break; + case UART_PARITY_SPACE: + ulcon |= UART_DM_SPACE_PARITY; + break; + case UART_PARITY_MARK: + default: + return (EINVAL); + } + + switch (stopbits) { + case 1: + ulcon |= (UART_DM_SBL_1 << 2); + break; + case 2: + ulcon |= (UART_DM_SBL_2 << 2); + break; + default: + return (EINVAL); + } + uart_setreg(bas, UART_DM_MR2, ulcon); + + /* Set 115200 for both TX and RX. */; + uart_setreg(bas, UART_DM_CSR, UART_DM_CSR_115200); + uart_barrier(bas); + + return (0); +} + +struct uart_ops uart_msm_ops = { + .probe = msm_probe, + .init = msm_init, + .term = msm_term, + .putc = msm_putc, + .rxready = msm_rxready, + .getc = msm_getc, +}; + +static int +msm_probe(struct uart_bas *bas) +{ + + return (0); +} + +static void +msm_init(struct uart_bas *bas, int baudrate, int databits, int stopbits, + int parity) +{ + + if (bas->rclk == 0) + bas->rclk = DEF_CLK; + + KASSERT(bas->rclk != 0, ("msm_init: Invalid rclk")); + + /* Set default parameters */ + msm_uart_param(bas, baudrate, databits, stopbits, parity); + + /* + * Configure UART mode registers MR1 and MR2. + * Hardware flow control isn't supported. + */ + uart_setreg(bas, UART_DM_MR1, 0x0); + + /* Reset interrupt mask register. */ + uart_setreg(bas, UART_DM_IMR, 0); + + /* + * Configure Tx and Rx watermarks configuration registers. + * TX watermark value is set to 0 - interrupt is generated when + * FIFO level is less than or equal to 0. + */ + uart_setreg(bas, UART_DM_TFWR, UART_DM_TFW_VALUE); + + /* Set RX watermark value */ + uart_setreg(bas, UART_DM_RFWR, UART_DM_RFW_VALUE); + + /* + * Configure Interrupt Programming Register. + * Set initial Stale timeout value. + */ + uart_setreg(bas, UART_DM_IPR, UART_DM_STALE_TIMEOUT_LSB); + + /* Disable IRDA mode */ + uart_setreg(bas, UART_DM_IRDA, 0x0); + + /* + * Configure and enable sim interface if required. + * Configure hunt character value in HCR register. + * Keep it in reset state. + */ + uart_setreg(bas, UART_DM_HCR, 0x0); + + /* Issue soft reset command */ + SETREG(bas, UART_DM_CR, UART_DM_RESET_TX); + SETREG(bas, UART_DM_CR, UART_DM_RESET_RX); + SETREG(bas, UART_DM_CR, UART_DM_RESET_ERROR_STATUS); + SETREG(bas, UART_DM_CR, UART_DM_RESET_BREAK_INT); + SETREG(bas, UART_DM_CR, UART_DM_RESET_STALE_INT); + + /* Enable/Disable Rx/Tx DM interfaces */ + /* Disable Data Mover for now. */ + uart_setreg(bas, UART_DM_DMEN, 0x0); + + /* Enable transmitter and receiver */ + uart_setreg(bas, UART_DM_CR, UART_DM_CR_RX_ENABLE); + uart_setreg(bas, UART_DM_CR, UART_DM_CR_TX_ENABLE); + + uart_barrier(bas); +} + +static void +msm_term(struct uart_bas *bas) +{ + + /* XXX */ +} + +static void +msm_putc(struct uart_bas *bas, int c) +{ + int limit; + + /* + * Write to NO_CHARS_FOR_TX register the number of characters + * to be transmitted. However, before writing TX_FIFO must + * be empty as indicated by TX_READY interrupt in IMR register + */ + + /* + * Check if transmit FIFO is empty. + * If not wait for TX_READY interrupt. + */ + limit = 1000; + if (!(uart_getreg(bas, UART_DM_SR) & UART_DM_SR_TXEMT)) { + while ((uart_getreg(bas, UART_DM_ISR) & UART_DM_TX_READY) == 0 + && --limit) + DELAY(4); + } + /* FIFO is ready, write number of characters to be written */ + uart_setreg(bas, UART_DM_NO_CHARS_FOR_TX, 1); + + /* Wait till TX FIFO has space */ + while ((uart_getreg(bas, UART_DM_SR) & UART_DM_SR_TXRDY) == 0) + DELAY(4); + + /* TX FIFO has space. Write char */ + SETREG(bas, UART_DM_TF(0), (c & 0xff)); +} + +static int +msm_rxready(struct uart_bas *bas) +{ + + /* Wait for a character to come ready */ + return ((uart_getreg(bas, UART_DM_SR) & UART_DM_SR_RXRDY) == + UART_DM_SR_RXRDY); +} + +static int +msm_getc(struct uart_bas *bas, struct mtx *mtx) +{ + int c; + + uart_lock(mtx); + + /* Wait for a character to come ready */ + while ((uart_getreg(bas, UART_DM_SR) & UART_DM_SR_RXRDY) != + UART_DM_SR_RXRDY) + DELAY(4); + + /* Check for Overrun error. If so reset Error Status */ + if (uart_getreg(bas, UART_DM_SR) & UART_DM_SR_UART_OVERRUN) + uart_setreg(bas, UART_DM_CR, UART_DM_RESET_ERROR_STATUS); + + /* Read char */ + c = uart_getreg(bas, UART_DM_RF(0)); + + uart_unlock(mtx); + + return (c); +} + +/* + * High-level UART interface. + */ +struct msm_uart_softc { + struct uart_softc base; + uint32_t ier; +}; + +static int msm_bus_probe(struct uart_softc *sc); +static int msm_bus_attach(struct uart_softc *sc); +static int msm_bus_flush(struct uart_softc *, int); +static int msm_bus_getsig(struct uart_softc *); +static int msm_bus_ioctl(struct uart_softc *, int, intptr_t); +static int msm_bus_ipend(struct uart_softc *); +static int msm_bus_param(struct uart_softc *, int, int, int, int); +static int msm_bus_receive(struct uart_softc *); +static int msm_bus_setsig(struct uart_softc *, int); +static int msm_bus_transmit(struct uart_softc *); +static void msm_bus_grab(struct uart_softc *); +static void msm_bus_ungrab(struct uart_softc *); + +static kobj_method_t msm_methods[] = { + KOBJMETHOD(uart_probe, msm_bus_probe), + KOBJMETHOD(uart_attach, msm_bus_attach), + KOBJMETHOD(uart_flush, msm_bus_flush), + KOBJMETHOD(uart_getsig, msm_bus_getsig), + KOBJMETHOD(uart_ioctl, msm_bus_ioctl), + KOBJMETHOD(uart_ipend, msm_bus_ipend), + KOBJMETHOD(uart_param, msm_bus_param), + KOBJMETHOD(uart_receive, msm_bus_receive), + KOBJMETHOD(uart_setsig, msm_bus_setsig), + KOBJMETHOD(uart_transmit, msm_bus_transmit), + KOBJMETHOD(uart_grab, msm_bus_grab), + KOBJMETHOD(uart_ungrab, msm_bus_ungrab), + {0, 0 } +}; + +int +msm_bus_probe(struct uart_softc *sc) +{ + + sc->sc_txfifosz = 64; + sc->sc_rxfifosz = 64; + + device_set_desc(sc->sc_dev, "Qualcomm HSUART"); + + return (0); +} + +static int +msm_bus_attach(struct uart_softc *sc) +{ + struct msm_uart_softc *u = (struct msm_uart_softc *)sc; + struct uart_bas *bas = &sc->sc_bas; + + sc->sc_hwiflow = 0; + sc->sc_hwoflow = 0; + + /* Set TX_READY, TXLEV, RXLEV, RXSTALE */ + u->ier = UART_DM_IMR_ENABLED; + + /* Configure Interrupt Mask register IMR */ + uart_setreg(bas, UART_DM_IMR, u->ier); + + return (0); +} + +/* + * Write the current transmit buffer to the TX FIFO. + */ +static int +msm_bus_transmit(struct uart_softc *sc) +{ + struct msm_uart_softc *u = (struct msm_uart_softc *)sc; + struct uart_bas *bas = &sc->sc_bas; + int i; + + uart_lock(sc->sc_hwmtx); + + /* Write some data */ + for (i = 0; i < sc->sc_txdatasz; i++) { + /* Write TX data */ + msm_putc(bas, sc->sc_txbuf[i]); + uart_barrier(bas); + } + + /* TX FIFO is empty now, enable TX_READY interrupt */ + u->ier |= UART_DM_TX_READY; + SETREG(bas, UART_DM_IMR, u->ier); + uart_barrier(bas); + + /* + * Inform upper layer that it is transmitting data to hardware, + * this will be cleared when TXIDLE interrupt occurs. + */ + sc->sc_txbusy = 1; + uart_unlock(sc->sc_hwmtx); + + return (0); +} + +static int +msm_bus_setsig(struct uart_softc *sc, int sig) +{ + + return (0); +} + +static int +msm_bus_receive(struct uart_softc *sc) +{ + struct msm_uart_softc *u = (struct msm_uart_softc *)sc; + struct uart_bas *bas; + int c; + + bas = &sc->sc_bas; + uart_lock(sc->sc_hwmtx); + + /* Initialize Receive Path and interrupt */ + SETREG(bas, UART_DM_CR, UART_DM_RESET_STALE_INT); + SETREG(bas, UART_DM_CR, UART_DM_STALE_EVENT_ENABLE); + u->ier |= UART_DM_RXLEV; + SETREG(bas, UART_DM_IMR, u->ier); + + /* Loop over until we are full, or no data is available */ + while (uart_getreg(bas, UART_DM_SR) & UART_DM_SR_RXRDY) { + if (uart_rx_full(sc)) { + /* No space left in input buffer */ + sc->sc_rxbuf[sc->sc_rxput] = UART_STAT_OVERRUN; + break; + } + + /* Read RX FIFO */ + c = uart_getreg(bas, UART_DM_RF(0)); + uart_barrier(bas); + + uart_rx_put(sc, c); + } + + uart_unlock(sc->sc_hwmtx); + + return (0); +} + +static int +msm_bus_param(struct uart_softc *sc, int baudrate, int databits, + int stopbits, int parity) +{ + int error; + + if (sc->sc_bas.rclk == 0) + sc->sc_bas.rclk = DEF_CLK; + + KASSERT(sc->sc_bas.rclk != 0, ("msm_init: Invalid rclk")); + + uart_lock(sc->sc_hwmtx); + error = msm_uart_param(&sc->sc_bas, baudrate, databits, stopbits, + parity); + uart_unlock(sc->sc_hwmtx); + + return (error); +} + +static int +msm_bus_ipend(struct uart_softc *sc) +{ + struct msm_uart_softc *u = (struct msm_uart_softc *)sc; + struct uart_bas *bas = &sc->sc_bas; + uint32_t isr; + int ipend; + + uart_lock(sc->sc_hwmtx); + + /* Get ISR status */ + isr = GETREG(bas, UART_DM_MISR); + + ipend = 0; + + /* Uart RX starting, notify upper layer */ + if (isr & UART_DM_RXLEV) { + u->ier &= ~UART_DM_RXLEV; + SETREG(bas, UART_DM_IMR, u->ier); + uart_barrier(bas); + ipend |= SER_INT_RXREADY; + } + + /* Stale RX interrupt */ + if (isr & UART_DM_RXSTALE) { + /* Disable and reset it */ + SETREG(bas, UART_DM_CR, UART_DM_STALE_EVENT_DISABLE); + SETREG(bas, UART_DM_CR, UART_DM_RESET_STALE_INT); + uart_barrier(bas); + ipend |= SER_INT_RXREADY; + } + + /* TX READY interrupt */ + if (isr & UART_DM_TX_READY) { + /* Clear TX Ready */ + SETREG(bas, UART_DM_CR, UART_DM_CLEAR_TX_READY); + + /* Disable TX_READY */ + u->ier &= ~UART_DM_TX_READY; + SETREG(bas, UART_DM_IMR, u->ier); + uart_barrier(bas); + + if (sc->sc_txbusy != 0) + ipend |= SER_INT_TXIDLE; + } + + if (isr & UART_DM_TXLEV) { + /* TX FIFO is empty */ + u->ier &= ~UART_DM_TXLEV; + SETREG(bas, UART_DM_IMR, u->ier); + uart_barrier(bas); + + if (sc->sc_txbusy != 0) + ipend |= SER_INT_TXIDLE; + } + + uart_unlock(sc->sc_hwmtx); + return (ipend); +} + +static int +msm_bus_flush(struct uart_softc *sc, int what) +{ + + return (0); +} + +static int +msm_bus_getsig(struct uart_softc *sc) +{ + + return (0); +} + +static int +msm_bus_ioctl(struct uart_softc *sc, int request, intptr_t data) +{ + + return (EINVAL); +} + +static void +msm_bus_grab(struct uart_softc *sc) +{ + struct uart_bas *bas = &sc->sc_bas; + + /* + * XXX: Turn off all interrupts to enter polling mode. Leave the + * saved mask alone. We'll restore whatever it was in ungrab. + */ + uart_lock(sc->sc_hwmtx); + SETREG(bas, UART_DM_CR, UART_DM_RESET_STALE_INT); + SETREG(bas, UART_DM_IMR, 0); + uart_barrier(bas); + uart_unlock(sc->sc_hwmtx); +} + +static void +msm_bus_ungrab(struct uart_softc *sc) +{ + struct msm_uart_softc *u = (struct msm_uart_softc *)sc; + struct uart_bas *bas = &sc->sc_bas; + + /* + * Restore previous interrupt mask + */ + uart_lock(sc->sc_hwmtx); + SETREG(bas, UART_DM_IMR, u->ier); + uart_barrier(bas); + uart_unlock(sc->sc_hwmtx); +} + +struct uart_class uart_msm_class = { + "msm", + msm_methods, + sizeof(struct msm_uart_softc), + .uc_ops = &uart_msm_ops, + .uc_range = 8, + .uc_rclk = DEF_CLK, +}; Copied: stable/10/sys/dev/uart/uart_dev_msm.h (from r272399, head/sys/dev/uart/uart_dev_msm.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/sys/dev/uart/uart_dev_msm.h Sat May 23 19:27:04 2015 (r283321, copy of r272399, head/sys/dev/uart/uart_dev_msm.h) @@ -0,0 +1,229 @@ +/*- + * Copyright (c) 2014 Ganbold Tsagaankhuu + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _UART_DM_H_ +#define _UART_DM_H_ + +#define UART_DM_EXTR_BITS(value, start_pos, end_pos) \ + ((value << (32 - end_pos)) >> (32 - (end_pos - start_pos))) + +/* UART Parity Mode */ +enum UART_DM_PARITY_MODE { + UART_DM_NO_PARITY, + UART_DM_ODD_PARITY, + UART_DM_EVEN_PARITY, + UART_DM_SPACE_PARITY +}; + +/* UART Stop Bit Length */ +enum UART_DM_STOP_BIT_LEN { + UART_DM_SBL_9_16, + UART_DM_SBL_1, + UART_DM_SBL_1_9_16, + UART_DM_SBL_2 +}; + +/* UART Bits per Char */ +enum UART_DM_BITS_PER_CHAR { + UART_DM_5_BPS, + UART_DM_6_BPS, + UART_DM_7_BPS, + UART_DM_8_BPS +}; + +/* 8-N-1 Configuration */ +#define UART_DM_8_N_1_MODE (UART_DM_NO_PARITY | \ + (UART_DM_SBL_1 << 2) | \ + (UART_DM_8_BPS << 4)) + +/* UART_DM Registers */ + +/* UART Operational Mode Registers (HSUART) */ +#define UART_DM_MR1 0x00 +#define UART_DM_MR1_AUTO_RFR_LEVEL1_BMSK 0xffffff00 +#define UART_DM_MR1_AUTO_RFR_LEVEL0_BMSK 0x3f +#define UART_DM_MR1_CTS_CTL_BMSK 0x40 +#define UART_DM_MR1_RX_RDY_CTL_BMSK 0x80 + +#define UART_DM_MR2 0x04 +#define UART_DM_MR2_ERROR_MODE_BMSK 0x40 +#define UART_DM_MR2_BITS_PER_CHAR_BMSK 0x30 +#define UART_DM_MR2_STOP_BIT_LEN_BMSK 0x0c +#define UART_DM_MR2_PARITY_MODE_BMSK 0x03 +#define UART_DM_RXBRK_ZERO_CHAR_OFF (1 << 8) +#define UART_DM_LOOPBACK (1 << 7) + +/* UART Clock Selection Register, write only */ +#define UART_DM_CSR 0x08 +#define UART_DM_CSR_115200 0xff +#define UART_DM_CSR_57600 0xee +#define UART_DM_CSR_38400 0xdd +#define UART_DM_CSR_28800 0xcc +#define UART_DM_CSR_19200 0xbb +#define UART_DM_CSR_14400 0xaa +#define UART_DM_CSR_9600 0x99 +#define UART_DM_CSR_7200 0x88 +#define UART_DM_CSR_4800 0x77 +#define UART_DM_CSR_3600 0x66 +#define UART_DM_CSR_2400 0x55 +#define UART_DM_CSR_1200 0x44 +#define UART_DM_CSR_600 0x33 +#define UART_DM_CSR_300 0x22 +#define UART_DM_CSR_150 0x11 +#define UART_DM_CSR_75 0x00 + +/* UART DM TX FIFO Registers - 4, write only */ +#define UART_DM_TF(x) (0x70 + (4 * (x))) + +/* UART Command Register, write only */ +#define UART_DM_CR 0x10 +#define UART_DM_CR_RX_ENABLE (1 << 0) +#define UART_DM_CR_RX_DISABLE (1 << 1) +#define UART_DM_CR_TX_ENABLE (1 << 2) +#define UART_DM_CR_TX_DISABLE (1 << 3) + +/* UART_DM_CR channel command bit value (register field is bits 8:4) */ +#define UART_DM_RESET_RX 0x10 +#define UART_DM_RESET_TX 0x20 +#define UART_DM_RESET_ERROR_STATUS 0x30 +#define UART_DM_RESET_BREAK_INT 0x40 +#define UART_DM_START_BREAK 0x50 +#define UART_DM_STOP_BREAK 0x60 +#define UART_DM_RESET_CTS 0x70 +#define UART_DM_RESET_STALE_INT 0x80 +#define UART_DM_RFR_LOW 0xD0 +#define UART_DM_RFR_HIGH 0xE0 +#define UART_DM_CR_PROTECTION_EN 0x100 +#define UART_DM_STALE_EVENT_ENABLE 0x500 +#define UART_DM_STALE_EVENT_DISABLE 0x600 +#define UART_DM_FORCE_STALE_EVENT 0x400 +#define UART_DM_CLEAR_TX_READY 0x300 +#define UART_DM_RESET_TX_ERROR 0x800 +#define UART_DM_RESET_TX_DONE 0x810 + +/* UART Interrupt Mask Register */ +#define UART_DM_IMR 0x14 +/* these can be used for both ISR and IMR registers */ +#define UART_DM_TXLEV (1 << 0) +#define UART_DM_RXHUNT (1 << 1) +#define UART_DM_RXBRK_CHNG (1 << 2) +#define UART_DM_RXSTALE (1 << 3) +#define UART_DM_RXLEV (1 << 4) +#define UART_DM_DELTA_CTS (1 << 5) +#define UART_DM_CURRENT_CTS (1 << 6) +#define UART_DM_TX_READY (1 << 7) +#define UART_DM_TX_ERROR (1 << 8) +#define UART_DM_TX_DONE (1 << 9) +#define UART_DM_RXBREAK_START (1 << 10) +#define UART_DM_RXBREAK_END (1 << 11) +#define UART_DM_PAR_FRAME_ERR_IRQ (1 << 12) + +#define UART_DM_IMR_ENABLED (UART_DM_TX_READY | \ + UART_DM_TXLEV | \ + UART_DM_RXLEV | \ + UART_DM_RXSTALE) + +/* UART Interrupt Programming Register */ +#define UART_DM_IPR 0x18 +#define UART_DM_STALE_TIMEOUT_LSB 0x0f +#define UART_DM_STALE_TIMEOUT_MSB 0x00 +#define UART_DM_IPR_STALE_TIMEOUT_MSB_BMSK 0xffffff80 +#define UART_DM_IPR_STALE_LSB_BMSK 0x1f + +/* UART Transmit/Receive FIFO Watermark Register */ +#define UART_DM_TFWR 0x1c +/* Interrupt is generated when FIFO level is less than or equal to this value */ +#define UART_DM_TFW_VALUE 0 + +#define UART_DM_RFWR 0x20 +/* Interrupt generated when no of words in RX FIFO is greater than this value */ +#define UART_DM_RFW_VALUE 0 + +/* UART Hunt Character Register */ +#define UART_DM_HCR 0x24 + +/* Used for RX transfer initialization */ +#define UART_DM_DMRX 0x34 +/* Default DMRX value - any value bigger than FIFO size would be fine */ +#define UART_DM_DMRX_DEF_VALUE 0x220 + +/* Register to enable IRDA function */ +#define UART_DM_IRDA 0x38 + +/* UART Data Mover Enable Register */ +#define UART_DM_DMEN 0x3c + +/* Number of characters for Transmission */ +#define UART_DM_NO_CHARS_FOR_TX 0x40 + +/* UART RX FIFO Base Address */ +#define UART_DM_BADR 0x44 + +#define UART_DM_SIM_CFG_ADDR 0x80 + +/* Read only registers */ +/* UART Status Register */ +#define UART_DM_SR 0x08 +/* register field mask mapping */ +#define UART_DM_SR_RXRDY (1 << 0) +#define UART_DM_SR_RXFULL (1 << 1) +#define UART_DM_SR_TXRDY (1 << 2) +#define UART_DM_SR_TXEMT (1 << 3) +#define UART_DM_SR_UART_OVERRUN (1 << 4) +#define UART_DM_SR_PAR_FRAME_ERR (1 << 5) +#define UART_DM_RX_BREAK (1 << 6) +#define UART_DM_HUNT_CHAR (1 << 7) +#define UART_DM_RX_BRK_START_LAST (1 << 8) + +/* UART Receive FIFO Registers - 4 in numbers */ +#define UART_DM_RF(x) (0x70 + (4 * (x))) + +/* UART Masked Interrupt Status Register */ +#define UART_DM_MISR 0x10 + +/* UART Interrupt Status Register */ +#define UART_DM_ISR 0x14 + +/* Number of characters received since the end of last RX transfer */ +#define UART_DM_RX_TOTAL_SNAP 0x38 + +/* UART TX FIFO Status Register */ +#define UART_DM_TXFS 0x4c +#define UART_DM_TXFS_STATE_LSB(x) UART_DM_EXTR_BITS(x,0,6) +#define UART_DM_TXFS_STATE_MSB(x) UART_DM_EXTR_BITS(x,14,31) +#define UART_DM_TXFS_BUF_STATE(x) UART_DM_EXTR_BITS(x,7,9) +#define UART_DM_TXFS_ASYNC_STATE(x) UART_DM_EXTR_BITS(x,10,13) + +/* UART RX FIFO Status Register */ +#define UART_DM_RXFS 0x50 +#define UART_DM_RXFS_STATE_LSB(x) UART_DM_EXTR_BITS(x,0,6) +#define UART_DM_RXFS_STATE_MSB(x) UART_DM_EXTR_BITS(x,14,31) +#define UART_DM_RXFS_BUF_STATE(x) UART_DM_EXTR_BITS(x,7,9) +#define UART_DM_RXFS_ASYNC_STATE(x) UART_DM_EXTR_BITS(x,10,13) + +#endif /* _UART_DM_H_ */ Modified: stable/10/sys/dev/uart/uart_dev_pl011.c ============================================================================== --- stable/10/sys/dev/uart/uart_dev_pl011.c Sat May 23 19:09:04 2015 (r283320) +++ stable/10/sys/dev/uart/uart_dev_pl011.c Sat May 23 19:27:04 2015 (r283321) @@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$"); #define DR_OE (1 << 11) /* Overrun error */ #define UART_FR 0x06 /* Flag register */ +#define FR_TXFF (1 << 5) /* Transmit FIFO/reg full */ #define FR_RXFF (1 << 6) /* Receive FIFO/reg full */ #define FR_TXFE (1 << 7) /* Transmit FIFO/reg empty */ @@ -194,7 +195,8 @@ static void uart_pl011_putc(struct uart_bas *bas, int c) { - while (!(__uart_getreg(bas, UART_FR) & FR_TXFE)) + /* Wait when TX FIFO full. Push character otherwise. */ + while (__uart_getreg(bas, UART_FR) & FR_TXFF) ; __uart_setreg(bas, UART_DR, c & 0xff); } From owner-svn-src-stable-10@FreeBSD.ORG Sat May 23 19:50:15 2015 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DAC884BA; Sat, 23 May 2015 19:50:15 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C6A19163B; Sat, 23 May 2015 19:50:15 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4NJoFdZ052648; Sat, 23 May 2015 19:50:15 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4NJoFGF052644; Sat, 23 May 2015 19:50:15 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201505231950.t4NJoFGF052644@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 23 May 2015 19:50:15 +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: r283322 - stable/10/sys/arm/samsung/exynos 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.20 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, 23 May 2015 19:50:16 -0000 Author: ian Date: Sat May 23 19:50:14 2015 New Revision: 283322 URL: https://svnweb.freebsd.org/changeset/base/283322 Log: MFC r266942, r266944: Do only receive chars if there are some data in the buffer. This fixes operation on newer Exynos boards. Rename exynos uart driver filenames. Added: stable/10/sys/arm/samsung/exynos/exynos_uart.c - copied unchanged from r266944, head/sys/arm/samsung/exynos/exynos_uart.c stable/10/sys/arm/samsung/exynos/exynos_uart.h - copied unchanged from r266944, head/sys/arm/samsung/exynos/exynos_uart.h Deleted: stable/10/sys/arm/samsung/exynos/uart.c stable/10/sys/arm/samsung/exynos/uart.h Modified: stable/10/sys/arm/samsung/exynos/files.exynos5 Directory Properties: stable/10/ (props changed) Copied: stable/10/sys/arm/samsung/exynos/exynos_uart.c (from r266944, head/sys/arm/samsung/exynos/exynos_uart.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/sys/arm/samsung/exynos/exynos_uart.c Sat May 23 19:50:14 2015 (r283322, copy of r266944, head/sys/arm/samsung/exynos/exynos_uart.c) @@ -0,0 +1,382 @@ +/* + * Copyright (c) 2003 Marcel Moolenaar + * Copyright (c) 2007-2009 Andrew Turner + * Copyright (c) 2013 Ruslan Bukin + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include + +#include "uart_if.h" + +#define DEF_CLK 100000000 + +static int sscomspeed(long, long); +static int s3c24x0_uart_param(struct uart_bas *, int, int, int, int); + +/* + * Low-level UART interface. + */ +static int s3c2410_probe(struct uart_bas *bas); +static void s3c2410_init(struct uart_bas *bas, int, int, int, int); +static void s3c2410_term(struct uart_bas *bas); +static void s3c2410_putc(struct uart_bas *bas, int); +static int s3c2410_rxready(struct uart_bas *bas); +static int s3c2410_getc(struct uart_bas *bas, struct mtx *mtx); + +extern SLIST_HEAD(uart_devinfo_list, uart_devinfo) uart_sysdevs; + +static int +sscomspeed(long speed, long frequency) +{ + int x; + + if (speed <= 0 || frequency <= 0) + return (-1); + x = (frequency / 16) / speed; + return (x-1); +} + +static int +s3c24x0_uart_param(struct uart_bas *bas, int baudrate, int databits, + int stopbits, int parity) +{ + int brd, ulcon; + + ulcon = 0; + + switch(databits) { + case 5: + ulcon |= ULCON_LENGTH_5; + break; + case 6: + ulcon |= ULCON_LENGTH_6; + break; + case 7: + ulcon |= ULCON_LENGTH_7; + break; + case 8: + ulcon |= ULCON_LENGTH_8; + break; + default: + return (EINVAL); + } + + switch (parity) { + case UART_PARITY_NONE: + ulcon |= ULCON_PARITY_NONE; + break; + case UART_PARITY_ODD: + ulcon |= ULCON_PARITY_ODD; + break; + case UART_PARITY_EVEN: + ulcon |= ULCON_PARITY_EVEN; + break; + case UART_PARITY_MARK: + case UART_PARITY_SPACE: + default: + return (EINVAL); + } + + if (stopbits == 2) + ulcon |= ULCON_STOP; + + uart_setreg(bas, SSCOM_ULCON, ulcon); + + brd = sscomspeed(baudrate, bas->rclk); + uart_setreg(bas, SSCOM_UBRDIV, brd); + + return (0); +} + +struct uart_ops uart_s3c2410_ops = { + .probe = s3c2410_probe, + .init = s3c2410_init, + .term = s3c2410_term, + .putc = s3c2410_putc, + .rxready = s3c2410_rxready, + .getc = s3c2410_getc, +}; + +static int +s3c2410_probe(struct uart_bas *bas) +{ + + return (0); +} + +static void +s3c2410_init(struct uart_bas *bas, int baudrate, int databits, int stopbits, + int parity) +{ + + if (bas->rclk == 0) + bas->rclk = DEF_CLK; + + KASSERT(bas->rclk != 0, ("s3c2410_init: Invalid rclk")); + + uart_setreg(bas, SSCOM_UCON, 0); + uart_setreg(bas, SSCOM_UFCON, + UFCON_TXTRIGGER_8 | UFCON_RXTRIGGER_8 | + UFCON_TXFIFO_RESET | UFCON_RXFIFO_RESET | + UFCON_FIFO_ENABLE); + s3c24x0_uart_param(bas, baudrate, databits, stopbits, parity); + + /* Enable UART. */ + uart_setreg(bas, SSCOM_UCON, UCON_TXMODE_INT | UCON_RXMODE_INT | + UCON_TOINT); + uart_setreg(bas, SSCOM_UMCON, UMCON_RTS); +} + +static void +s3c2410_term(struct uart_bas *bas) +{ + /* XXX */ +} + +static void +s3c2410_putc(struct uart_bas *bas, int c) +{ + + while ((bus_space_read_4(bas->bst, bas->bsh, SSCOM_UFSTAT) & + UFSTAT_TXFULL) == UFSTAT_TXFULL) + continue; + + uart_setreg(bas, SSCOM_UTXH, c); +} + +static int +s3c2410_rxready(struct uart_bas *bas) +{ + + return ((uart_getreg(bas, SSCOM_UTRSTAT) & UTRSTAT_RXREADY) == + UTRSTAT_RXREADY); +} + +static int +s3c2410_getc(struct uart_bas *bas, struct mtx *mtx) +{ + int utrstat; + + utrstat = bus_space_read_1(bas->bst, bas->bsh, SSCOM_UTRSTAT); + while (!(utrstat & UTRSTAT_RXREADY)) { + utrstat = bus_space_read_1(bas->bst, bas->bsh, SSCOM_UTRSTAT); + continue; + } + + return (bus_space_read_1(bas->bst, bas->bsh, SSCOM_URXH)); +} + +static int s3c2410_bus_probe(struct uart_softc *sc); +static int s3c2410_bus_attach(struct uart_softc *sc); +static int s3c2410_bus_flush(struct uart_softc *, int); +static int s3c2410_bus_getsig(struct uart_softc *); +static int s3c2410_bus_ioctl(struct uart_softc *, int, intptr_t); +static int s3c2410_bus_ipend(struct uart_softc *); +static int s3c2410_bus_param(struct uart_softc *, int, int, int, int); +static int s3c2410_bus_receive(struct uart_softc *); +static int s3c2410_bus_setsig(struct uart_softc *, int); +static int s3c2410_bus_transmit(struct uart_softc *); + +static kobj_method_t s3c2410_methods[] = { + KOBJMETHOD(uart_probe, s3c2410_bus_probe), + KOBJMETHOD(uart_attach, s3c2410_bus_attach), + KOBJMETHOD(uart_flush, s3c2410_bus_flush), + KOBJMETHOD(uart_getsig, s3c2410_bus_getsig), + KOBJMETHOD(uart_ioctl, s3c2410_bus_ioctl), + KOBJMETHOD(uart_ipend, s3c2410_bus_ipend), + KOBJMETHOD(uart_param, s3c2410_bus_param), + KOBJMETHOD(uart_receive, s3c2410_bus_receive), + KOBJMETHOD(uart_setsig, s3c2410_bus_setsig), + KOBJMETHOD(uart_transmit, s3c2410_bus_transmit), + + {0, 0 } +}; + +int +s3c2410_bus_probe(struct uart_softc *sc) +{ + + sc->sc_txfifosz = 16; + sc->sc_rxfifosz = 16; + + return (0); +} + +static int +s3c2410_bus_attach(struct uart_softc *sc) +{ + + sc->sc_hwiflow = 0; + sc->sc_hwoflow = 0; + + return (0); +} + +static int +s3c2410_bus_transmit(struct uart_softc *sc) +{ + int i; + int reg; + + uart_lock(sc->sc_hwmtx); + + for (i = 0; i < sc->sc_txdatasz; i++) { + s3c2410_putc(&sc->sc_bas, sc->sc_txbuf[i]); + uart_barrier(&sc->sc_bas); + } + + sc->sc_txbusy = 1; + + uart_unlock(sc->sc_hwmtx); + + /* unmask TX interrupt */ + reg = bus_space_read_4(sc->sc_bas.bst, sc->sc_bas.bsh, SSCOM_UINTM); + reg &= ~(1 << 2); + bus_space_write_4(sc->sc_bas.bst, sc->sc_bas.bsh, SSCOM_UINTM, reg); + + return (0); +} + +static int +s3c2410_bus_setsig(struct uart_softc *sc, int sig) +{ + + return (0); +} + +static int +s3c2410_bus_receive(struct uart_softc *sc) +{ + struct uart_bas *bas; + + bas = &sc->sc_bas; + while (bus_space_read_4(bas->bst, bas->bsh, + SSCOM_UFSTAT) & UFSTAT_RXCOUNT) + uart_rx_put(sc, uart_getreg(&sc->sc_bas, SSCOM_URXH)); + + return (0); +} + +static int +s3c2410_bus_param(struct uart_softc *sc, int baudrate, int databits, + int stopbits, int parity) +{ + int error; + + if (sc->sc_bas.rclk == 0) + sc->sc_bas.rclk = DEF_CLK; + + KASSERT(sc->sc_bas.rclk != 0, ("s3c2410_init: Invalid rclk")); + + uart_lock(sc->sc_hwmtx); + error = s3c24x0_uart_param(&sc->sc_bas, baudrate, databits, stopbits, + parity); + uart_unlock(sc->sc_hwmtx); + + return (error); +} + +static int +s3c2410_bus_ipend(struct uart_softc *sc) +{ + uint32_t ints; + uint32_t txempty, rxready; + int reg; + int ipend; + + uart_lock(sc->sc_hwmtx); + ints = bus_space_read_4(sc->sc_bas.bst, sc->sc_bas.bsh, SSCOM_UINTP); + bus_space_write_4(sc->sc_bas.bst, sc->sc_bas.bsh, SSCOM_UINTP, ints); + + txempty = (1 << 2); + rxready = (1 << 0); + + ipend = 0; + if ((ints & txempty) > 0) { + if (sc->sc_txbusy != 0) + ipend |= SER_INT_TXIDLE; + + /* mask TX interrupt */ + reg = bus_space_read_4(sc->sc_bas.bst, sc->sc_bas.bsh, + SSCOM_UINTM); + reg |= (1 << 2); + bus_space_write_4(sc->sc_bas.bst, sc->sc_bas.bsh, + SSCOM_UINTM, reg); + } + + if ((ints & rxready) > 0) { + ipend |= SER_INT_RXREADY; + } + + uart_unlock(sc->sc_hwmtx); + return (ipend); +} + +static int +s3c2410_bus_flush(struct uart_softc *sc, int what) +{ + + return (0); +} + +static int +s3c2410_bus_getsig(struct uart_softc *sc) +{ + + return (0); +} + +static int +s3c2410_bus_ioctl(struct uart_softc *sc, int request, intptr_t data) +{ + + return (EINVAL); +} + +struct uart_class uart_s3c2410_class = { + "s3c2410 class", + s3c2410_methods, + 1, + .uc_ops = &uart_s3c2410_ops, + .uc_range = 8, + .uc_rclk = 0, +}; Copied: stable/10/sys/arm/samsung/exynos/exynos_uart.h (from r266944, head/sys/arm/samsung/exynos/exynos_uart.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/sys/arm/samsung/exynos/exynos_uart.h Sat May 23 19:50:14 2015 (r283322, copy of r266944, head/sys/arm/samsung/exynos/exynos_uart.h) @@ -0,0 +1,126 @@ +/* $NetBSD: s3c2xx0reg.h,v 1.4 2004/02/12 03:47:29 bsh Exp $ */ + +/*- + * Copyright (c) 2002, 2003 Fujitsu Component Limited + * Copyright (c) 2002, 2003 Genetec Corporation + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of The Fujitsu Component Limited nor the name of + * Genetec corporation may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY FUJITSU COMPONENT LIMITED AND GENETEC + * CORPORATION ``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 FUJITSU COMPONENT LIMITED OR GENETEC + * CORPORATION 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$ + */ + +/* s3c2410-specific registers */ +#define UMCON_AFC (1 << 4) /* auto flow control */ +#define UMSTAT_DCTS (1 << 2) /* CTS change */ +#define ULCON_IR (1 << 6) +#define ULCON_PARITY_SHIFT 3 + +/* + * Exynos-specific + * + * UFSTAT_TXFULL register differs between Exynos and others. + * Others have UFSTAT_TXFULL (1 << 9) + */ +#define UFSTAT_TXFULL (1 << 24) + +#define SSCOM_UINTM 0x038 +#define SSCOM_UINTP 0x030 + +/* common for s3c2800 and s3c24x0 */ +#define SSCOM_ULCON 0x00 /* UART line control */ +#define ULCON_PARITY_NONE (0 << ULCON_PARITY_SHIFT) +#define ULCON_PARITY_ODD (4 << ULCON_PARITY_SHIFT) +#define ULCON_PARITY_EVEN (5 << ULCON_PARITY_SHIFT) +#define ULCON_PARITY_ONE (6 << ULCON_PARITY_SHIFT) +#define ULCON_PARITY_ZERO (7 << ULCON_PARITY_SHIFT) +#define ULCON_STOP (1 << 2) +#define ULCON_LENGTH_5 0 +#define ULCON_LENGTH_6 1 +#define ULCON_LENGTH_7 2 +#define ULCON_LENGTH_8 3 +#define SSCOM_UCON 0x04 /* UART control */ +#define UCON_TXINT_TYPE (1 << 9) /* Tx interrupt. 0=pulse,1=level */ +#define UCON_TXINT_TYPE_LEVEL UCON_TXINT_TYPE +#define UCON_TXINT_TYPE_PULSE 0 +#define UCON_RXINT_TYPE (1 << 8) /* Rx interrupt */ +#define UCON_RXINT_TYPE_LEVEL UCON_RXINT_TYPE +#define UCON_RXINT_TYPE_PULSE 0 +#define UCON_TOINT (1 << 7) /* Rx timeout interrupt */ +#define UCON_ERRINT (1 << 6) /* receive error interrupt */ +#define UCON_LOOP (1 << 5) /* loopback */ +#define UCON_SBREAK (1 << 4) /* send break */ +#define UCON_TXMODE_DISABLE (0 << 2) +#define UCON_TXMODE_INT (1 << 2) +#define UCON_TXMODE_DMA (2 << 2) +#define UCON_TXMODE_MASK (3 << 2) +#define UCON_RXMODE_DISABLE (0 << 0) +#define UCON_RXMODE_INT (1 << 0) +#define UCON_RXMODE_DMA (2 << 0) +#define UCON_RXMODE_MASK (3 << 0) +#define SSCOM_UFCON 0x08 /* FIFO control */ +#define UFCON_TXTRIGGER_0 (0 << 6) +#define UFCON_TXTRIGGER_4 (1 << 6) +#define UFCON_TXTRIGGER_8 (2 << 6) +#define UFCON_TXTRIGGER_16 (3 << 6) +#define UFCON_RXTRIGGER_4 (0 << 4) +#define UFCON_RXTRIGGER_8 (1 << 4) +#define UFCON_RXTRIGGER_12 (2 << 4) +#define UFCON_RXTRIGGER_16 (3 << 4) +#define UFCON_TXFIFO_RESET (1 << 2) +#define UFCON_RXFIFO_RESET (1 << 1) +#define UFCON_FIFO_ENABLE (1 << 0) +#define SSCOM_UMCON 0x0c /* MODEM control */ +#define UMCON_RTS (1 << 0) /* Request to send */ +#define SSCOM_UTRSTAT 0x10 /* Status register */ +#define UTRSTAT_TXSHIFTER_EMPTY ( 1<< 2) +#define UTRSTAT_TXEMPTY (1 << 1) /* TX fifo or buffer empty */ +#define UTRSTAT_RXREADY (1 << 0) /* RX fifo or buffer is not empty */ +#define SSCOM_UERSTAT 0x14 /* Error status register */ +#define UERSTAT_BREAK (1 << 3) /* Break signal, not 2410 */ +#define UERSTAT_FRAME (1 << 2) /* Frame error */ +#define UERSTAT_PARITY (1 << 1) /* Parity error, not 2410 */ +#define UERSTAT_OVERRUN (1 << 0) /* Overrun */ +#define UERSTAT_ALL_ERRORS \ + (UERSTAT_OVERRUN|UERSTAT_BREAK|UERSTAT_FRAME|UERSTAT_PARITY) +#define SSCOM_UFSTAT 0x18 /* Fifo status register */ +#define UFSTAT_RXFULL (1 <<8) /* Rx fifo full */ +#define UFSTAT_TXCOUNT_SHIFT 4 /* TX FIFO count */ +#define UFSTAT_TXCOUNT (0x0f << UFSTAT_TXCOUNT_SHIFT) +#define UFSTAT_RXCOUNT_SHIFT 0 /* RX FIFO count */ +#define UFSTAT_RXCOUNT (0x0f << UFSTAT_RXCOUNT_SHIFT) +#define SSCOM_UMSTAT 0x1c /* Modem status register */ +#define UMSTAT_CTS (1 << 0) /* Clear to send */ +#if _BYTE_ORDER == _LITTLE_ENDIAN +#define SSCOM_UTXH 0x20 /* Transmit data register */ +#define SSCOM_URXH 0x24 /* Receive data register */ +#else +#define SSCOM_UTXH 0x23 /* Transmit data register */ +#define SSCOM_URXH 0x27 /* Receive data register */ +#endif +#define SSCOM_UBRDIV 0x28 /* baud-reate divisor */ +#define SSCOM_SIZE 0x2c Modified: stable/10/sys/arm/samsung/exynos/files.exynos5 ============================================================================== --- stable/10/sys/arm/samsung/exynos/files.exynos5 Sat May 23 19:27:04 2015 (r283321) +++ stable/10/sys/arm/samsung/exynos/files.exynos5 Sat May 23 19:50:14 2015 (r283322) @@ -19,7 +19,7 @@ arm/samsung/exynos/exynos5_common.c sta arm/samsung/exynos/exynos5_machdep.c standard arm/samsung/exynos/exynos5_combiner.c standard arm/samsung/exynos/exynos5_pad.c optional gpio -arm/samsung/exynos/uart.c optional uart +arm/samsung/exynos/exynos_uart.c optional uart arm/samsung/exynos/exynos5_ehci.c optional ehci arm/samsung/exynos/exynos5_fimd.c optional vt arm/samsung/exynos/exynos5_i2c.c optional iicbus From owner-svn-src-stable-10@FreeBSD.ORG Sat May 23 19:57:46 2015 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3E82763B; Sat, 23 May 2015 19:57:46 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1F04F1705; Sat, 23 May 2015 19:57:46 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4NJvjCK056733; Sat, 23 May 2015 19:57:45 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4NJvjhP056729; Sat, 23 May 2015 19:57:45 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201505231957.t4NJvjhP056729@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 23 May 2015 19:57:45 +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: r283323 - in stable/10/sys: arm/samsung/exynos dev/uart 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.20 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, 23 May 2015 19:57:46 -0000 Author: ian Date: Sat May 23 19:57:44 2015 New Revision: 283323 URL: https://svnweb.freebsd.org/changeset/base/283323 Log: MFC r277132: Rename Exynos UART driver functions. No functional change. Modified: stable/10/sys/arm/samsung/exynos/exynos_uart.c stable/10/sys/dev/uart/uart.h stable/10/sys/dev/uart/uart_bus_fdt.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/arm/samsung/exynos/exynos_uart.c ============================================================================== --- stable/10/sys/arm/samsung/exynos/exynos_uart.c Sat May 23 19:50:14 2015 (r283322) +++ stable/10/sys/arm/samsung/exynos/exynos_uart.c Sat May 23 19:57:44 2015 (r283323) @@ -50,17 +50,17 @@ __FBSDID("$FreeBSD$"); #define DEF_CLK 100000000 static int sscomspeed(long, long); -static int s3c24x0_uart_param(struct uart_bas *, int, int, int, int); +static int exynos4210_uart_param(struct uart_bas *, int, int, int, int); /* * Low-level UART interface. */ -static int s3c2410_probe(struct uart_bas *bas); -static void s3c2410_init(struct uart_bas *bas, int, int, int, int); -static void s3c2410_term(struct uart_bas *bas); -static void s3c2410_putc(struct uart_bas *bas, int); -static int s3c2410_rxready(struct uart_bas *bas); -static int s3c2410_getc(struct uart_bas *bas, struct mtx *mtx); +static int exynos4210_probe(struct uart_bas *bas); +static void exynos4210_init(struct uart_bas *bas, int, int, int, int); +static void exynos4210_term(struct uart_bas *bas); +static void exynos4210_putc(struct uart_bas *bas, int); +static int exynos4210_rxready(struct uart_bas *bas); +static int exynos4210_getc(struct uart_bas *bas, struct mtx *mtx); extern SLIST_HEAD(uart_devinfo_list, uart_devinfo) uart_sysdevs; @@ -76,7 +76,7 @@ sscomspeed(long speed, long frequency) } static int -s3c24x0_uart_param(struct uart_bas *bas, int baudrate, int databits, +exynos4210_uart_param(struct uart_bas *bas, int baudrate, int databits, int stopbits, int parity) { int brd, ulcon; @@ -127,38 +127,38 @@ s3c24x0_uart_param(struct uart_bas *bas, return (0); } -struct uart_ops uart_s3c2410_ops = { - .probe = s3c2410_probe, - .init = s3c2410_init, - .term = s3c2410_term, - .putc = s3c2410_putc, - .rxready = s3c2410_rxready, - .getc = s3c2410_getc, +struct uart_ops uart_exynos4210_ops = { + .probe = exynos4210_probe, + .init = exynos4210_init, + .term = exynos4210_term, + .putc = exynos4210_putc, + .rxready = exynos4210_rxready, + .getc = exynos4210_getc, }; static int -s3c2410_probe(struct uart_bas *bas) +exynos4210_probe(struct uart_bas *bas) { return (0); } static void -s3c2410_init(struct uart_bas *bas, int baudrate, int databits, int stopbits, +exynos4210_init(struct uart_bas *bas, int baudrate, int databits, int stopbits, int parity) { if (bas->rclk == 0) bas->rclk = DEF_CLK; - KASSERT(bas->rclk != 0, ("s3c2410_init: Invalid rclk")); + KASSERT(bas->rclk != 0, ("exynos4210_init: Invalid rclk")); uart_setreg(bas, SSCOM_UCON, 0); uart_setreg(bas, SSCOM_UFCON, UFCON_TXTRIGGER_8 | UFCON_RXTRIGGER_8 | UFCON_TXFIFO_RESET | UFCON_RXFIFO_RESET | UFCON_FIFO_ENABLE); - s3c24x0_uart_param(bas, baudrate, databits, stopbits, parity); + exynos4210_uart_param(bas, baudrate, databits, stopbits, parity); /* Enable UART. */ uart_setreg(bas, SSCOM_UCON, UCON_TXMODE_INT | UCON_RXMODE_INT | @@ -167,13 +167,13 @@ s3c2410_init(struct uart_bas *bas, int b } static void -s3c2410_term(struct uart_bas *bas) +exynos4210_term(struct uart_bas *bas) { /* XXX */ } static void -s3c2410_putc(struct uart_bas *bas, int c) +exynos4210_putc(struct uart_bas *bas, int c) { while ((bus_space_read_4(bas->bst, bas->bsh, SSCOM_UFSTAT) & @@ -184,7 +184,7 @@ s3c2410_putc(struct uart_bas *bas, int c } static int -s3c2410_rxready(struct uart_bas *bas) +exynos4210_rxready(struct uart_bas *bas) { return ((uart_getreg(bas, SSCOM_UTRSTAT) & UTRSTAT_RXREADY) == @@ -192,7 +192,7 @@ s3c2410_rxready(struct uart_bas *bas) } static int -s3c2410_getc(struct uart_bas *bas, struct mtx *mtx) +exynos4210_getc(struct uart_bas *bas, struct mtx *mtx) { int utrstat; @@ -205,34 +205,34 @@ s3c2410_getc(struct uart_bas *bas, struc return (bus_space_read_1(bas->bst, bas->bsh, SSCOM_URXH)); } -static int s3c2410_bus_probe(struct uart_softc *sc); -static int s3c2410_bus_attach(struct uart_softc *sc); -static int s3c2410_bus_flush(struct uart_softc *, int); -static int s3c2410_bus_getsig(struct uart_softc *); -static int s3c2410_bus_ioctl(struct uart_softc *, int, intptr_t); -static int s3c2410_bus_ipend(struct uart_softc *); -static int s3c2410_bus_param(struct uart_softc *, int, int, int, int); -static int s3c2410_bus_receive(struct uart_softc *); -static int s3c2410_bus_setsig(struct uart_softc *, int); -static int s3c2410_bus_transmit(struct uart_softc *); - -static kobj_method_t s3c2410_methods[] = { - KOBJMETHOD(uart_probe, s3c2410_bus_probe), - KOBJMETHOD(uart_attach, s3c2410_bus_attach), - KOBJMETHOD(uart_flush, s3c2410_bus_flush), - KOBJMETHOD(uart_getsig, s3c2410_bus_getsig), - KOBJMETHOD(uart_ioctl, s3c2410_bus_ioctl), - KOBJMETHOD(uart_ipend, s3c2410_bus_ipend), - KOBJMETHOD(uart_param, s3c2410_bus_param), - KOBJMETHOD(uart_receive, s3c2410_bus_receive), - KOBJMETHOD(uart_setsig, s3c2410_bus_setsig), - KOBJMETHOD(uart_transmit, s3c2410_bus_transmit), +static int exynos4210_bus_probe(struct uart_softc *sc); +static int exynos4210_bus_attach(struct uart_softc *sc); +static int exynos4210_bus_flush(struct uart_softc *, int); +static int exynos4210_bus_getsig(struct uart_softc *); +static int exynos4210_bus_ioctl(struct uart_softc *, int, intptr_t); +static int exynos4210_bus_ipend(struct uart_softc *); +static int exynos4210_bus_param(struct uart_softc *, int, int, int, int); +static int exynos4210_bus_receive(struct uart_softc *); +static int exynos4210_bus_setsig(struct uart_softc *, int); +static int exynos4210_bus_transmit(struct uart_softc *); + +static kobj_method_t exynos4210_methods[] = { + KOBJMETHOD(uart_probe, exynos4210_bus_probe), + KOBJMETHOD(uart_attach, exynos4210_bus_attach), + KOBJMETHOD(uart_flush, exynos4210_bus_flush), + KOBJMETHOD(uart_getsig, exynos4210_bus_getsig), + KOBJMETHOD(uart_ioctl, exynos4210_bus_ioctl), + KOBJMETHOD(uart_ipend, exynos4210_bus_ipend), + KOBJMETHOD(uart_param, exynos4210_bus_param), + KOBJMETHOD(uart_receive, exynos4210_bus_receive), + KOBJMETHOD(uart_setsig, exynos4210_bus_setsig), + KOBJMETHOD(uart_transmit, exynos4210_bus_transmit), {0, 0 } }; int -s3c2410_bus_probe(struct uart_softc *sc) +exynos4210_bus_probe(struct uart_softc *sc) { sc->sc_txfifosz = 16; @@ -242,7 +242,7 @@ s3c2410_bus_probe(struct uart_softc *sc) } static int -s3c2410_bus_attach(struct uart_softc *sc) +exynos4210_bus_attach(struct uart_softc *sc) { sc->sc_hwiflow = 0; @@ -252,7 +252,7 @@ s3c2410_bus_attach(struct uart_softc *sc } static int -s3c2410_bus_transmit(struct uart_softc *sc) +exynos4210_bus_transmit(struct uart_softc *sc) { int i; int reg; @@ -260,7 +260,7 @@ s3c2410_bus_transmit(struct uart_softc * uart_lock(sc->sc_hwmtx); for (i = 0; i < sc->sc_txdatasz; i++) { - s3c2410_putc(&sc->sc_bas, sc->sc_txbuf[i]); + exynos4210_putc(&sc->sc_bas, sc->sc_txbuf[i]); uart_barrier(&sc->sc_bas); } @@ -277,14 +277,14 @@ s3c2410_bus_transmit(struct uart_softc * } static int -s3c2410_bus_setsig(struct uart_softc *sc, int sig) +exynos4210_bus_setsig(struct uart_softc *sc, int sig) { return (0); } static int -s3c2410_bus_receive(struct uart_softc *sc) +exynos4210_bus_receive(struct uart_softc *sc) { struct uart_bas *bas; @@ -297,7 +297,7 @@ s3c2410_bus_receive(struct uart_softc *s } static int -s3c2410_bus_param(struct uart_softc *sc, int baudrate, int databits, +exynos4210_bus_param(struct uart_softc *sc, int baudrate, int databits, int stopbits, int parity) { int error; @@ -305,10 +305,10 @@ s3c2410_bus_param(struct uart_softc *sc, if (sc->sc_bas.rclk == 0) sc->sc_bas.rclk = DEF_CLK; - KASSERT(sc->sc_bas.rclk != 0, ("s3c2410_init: Invalid rclk")); + KASSERT(sc->sc_bas.rclk != 0, ("exynos4210_init: Invalid rclk")); uart_lock(sc->sc_hwmtx); - error = s3c24x0_uart_param(&sc->sc_bas, baudrate, databits, stopbits, + error = exynos4210_uart_param(&sc->sc_bas, baudrate, databits, stopbits, parity); uart_unlock(sc->sc_hwmtx); @@ -316,7 +316,7 @@ s3c2410_bus_param(struct uart_softc *sc, } static int -s3c2410_bus_ipend(struct uart_softc *sc) +exynos4210_bus_ipend(struct uart_softc *sc) { uint32_t ints; uint32_t txempty, rxready; @@ -352,31 +352,31 @@ s3c2410_bus_ipend(struct uart_softc *sc) } static int -s3c2410_bus_flush(struct uart_softc *sc, int what) +exynos4210_bus_flush(struct uart_softc *sc, int what) { return (0); } static int -s3c2410_bus_getsig(struct uart_softc *sc) +exynos4210_bus_getsig(struct uart_softc *sc) { return (0); } static int -s3c2410_bus_ioctl(struct uart_softc *sc, int request, intptr_t data) +exynos4210_bus_ioctl(struct uart_softc *sc, int request, intptr_t data) { return (EINVAL); } -struct uart_class uart_s3c2410_class = { - "s3c2410 class", - s3c2410_methods, +struct uart_class uart_exynos4210_class = { + "exynos4210 class", + exynos4210_methods, 1, - .uc_ops = &uart_s3c2410_ops, + .uc_ops = &uart_exynos4210_ops, .uc_range = 8, .uc_rclk = 0, }; Modified: stable/10/sys/dev/uart/uart.h ============================================================================== --- stable/10/sys/dev/uart/uart.h Sat May 23 19:50:14 2015 (r283322) +++ stable/10/sys/dev/uart/uart.h Sat May 23 19:57:44 2015 (r283323) @@ -78,6 +78,7 @@ extern struct uart_class uart_cdnc_class extern struct uart_class uart_ti8250_class __attribute__((weak)); extern struct uart_class uart_vybrid_class __attribute__((weak)); extern struct uart_class at91_usart_class __attribute__((weak)); +extern struct uart_class uart_exynos4210_class __attribute__((weak)); #ifdef FDT struct ofw_compat_data; Modified: stable/10/sys/dev/uart/uart_bus_fdt.c ============================================================================== --- stable/10/sys/dev/uart/uart_bus_fdt.c Sat May 23 19:50:14 2015 (r283322) +++ stable/10/sys/dev/uart/uart_bus_fdt.c Sat May 23 19:57:44 2015 (r283323) @@ -74,7 +74,7 @@ static struct ofw_compat_data compat_dat {"atmel,at91rm9200-usart",(uintptr_t)&at91_usart_class}, {"atmel,at91sam9260-usart",(uintptr_t)&at91_usart_class}, {"cadence,uart", (uintptr_t)&uart_cdnc_class}, - {"exynos", (uintptr_t)&uart_s3c2410_class}, + {"exynos", (uintptr_t)&uart_exynos4210_class}, {"fsl,imx6q-uart", (uintptr_t)&uart_imx_class}, {"fsl,imx53-uart", (uintptr_t)&uart_imx_class}, {"fsl,imx51-uart", (uintptr_t)&uart_imx_class}, From owner-svn-src-stable-10@FreeBSD.ORG Sat May 23 20:01:21 2015 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.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6AE21892; Sat, 23 May 2015 20:01: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 57C5917C6; Sat, 23 May 2015 20:01:21 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4NK1LG3061203; Sat, 23 May 2015 20:01:21 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4NK1L0w061202; Sat, 23 May 2015 20:01:21 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201505232001.t4NK1L0w061202@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 23 May 2015 20:01: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: r283324 - stable/10/sys/dev/uart 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.20 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, 23 May 2015 20:01:21 -0000 Author: ian Date: Sat May 23 20:01:20 2015 New Revision: 283324 URL: https://svnweb.freebsd.org/changeset/base/283324 Log: MFC r279239: Enable 'receive timeout' interrupt allowing us to not loose 'rx buffer full' event. Modified: stable/10/sys/dev/uart/uart_dev_pl011.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/uart/uart_dev_pl011.c ============================================================================== --- stable/10/sys/dev/uart/uart_dev_pl011.c Sat May 23 19:57:44 2015 (r283323) +++ stable/10/sys/dev/uart/uart_dev_pl011.c Sat May 23 20:01:20 2015 (r283324) @@ -78,6 +78,7 @@ __FBSDID("$FreeBSD$"); #define UART_RIS 0x0f /* Raw interrupt status register */ #define UART_RXREADY (1 << 4) /* RX buffer full */ #define UART_TXEMPTY (1 << 5) /* TX buffer empty */ +#define RIS_RTIM (1 << 6) /* Receive timeout */ #define RIS_FE (1 << 7) /* Framing error interrupt status */ #define RIS_PE (1 << 8) /* Parity error interrupt status */ #define RIS_BE (1 << 9) /* Break error interrupt status */ @@ -278,11 +279,15 @@ static int uart_pl011_bus_attach(struct uart_softc *sc) { struct uart_bas *bas; + int reg; bas = &sc->sc_bas; - /* Enable RX & TX interrupts */ - __uart_setreg(bas, UART_IMSC, (UART_RXREADY | UART_TXEMPTY)); - /* Clear RX & TX interrupts */ + + /* Enable interrupts */ + reg = (UART_RXREADY | RIS_RTIM | UART_TXEMPTY); + __uart_setreg(bas, UART_IMSC, reg); + + /* Clear interrupts */ __uart_setreg(bas, UART_ICR, IMSC_MASK_ALL); return (0); @@ -337,15 +342,16 @@ static int uart_pl011_bus_ipend(struct uart_softc *sc) { struct uart_bas *bas; - int ipend; uint32_t ints; + int ipend; + int reg; bas = &sc->sc_bas; uart_lock(sc->sc_hwmtx); ints = __uart_getreg(bas, UART_MIS); ipend = 0; - if (ints & UART_RXREADY) + if (ints & (UART_RXREADY | RIS_RTIM)) ipend |= SER_INT_RXREADY; if (ints & RIS_BE) ipend |= SER_INT_BREAK; @@ -355,7 +361,10 @@ uart_pl011_bus_ipend(struct uart_softc * if (sc->sc_txbusy) ipend |= SER_INT_TXIDLE; - __uart_setreg(bas, UART_IMSC, UART_RXREADY); + /* Disable TX interrupt */ + reg = __uart_getreg(bas, UART_IMSC); + reg &= ~(UART_TXEMPTY); + __uart_setreg(bas, UART_IMSC, reg); } uart_unlock(sc->sc_hwmtx); @@ -391,14 +400,14 @@ static int uart_pl011_bus_receive(struct uart_softc *sc) { struct uart_bas *bas; - int rx; uint32_t ints, xc; + int rx; bas = &sc->sc_bas; uart_lock(sc->sc_hwmtx); ints = __uart_getreg(bas, UART_MIS); - while (ints & UART_RXREADY) { + while (ints & (UART_RXREADY | RIS_RTIM)) { if (uart_rx_full(sc)) { sc->sc_rxbuf[sc->sc_rxput] = UART_STAT_OVERRUN; break; @@ -411,7 +420,7 @@ uart_pl011_bus_receive(struct uart_softc if (xc & DR_PE) rx |= UART_STAT_PARERR; - __uart_setreg(bas, UART_ICR, UART_RXREADY); + __uart_setreg(bas, UART_ICR, (UART_RXREADY | RIS_RTIM)); uart_rx_put(sc, rx); ints = __uart_getreg(bas, UART_MIS); @@ -433,6 +442,7 @@ static int uart_pl011_bus_transmit(struct uart_softc *sc) { struct uart_bas *bas; + int reg; int i; bas = &sc->sc_bas; @@ -443,7 +453,12 @@ uart_pl011_bus_transmit(struct uart_soft uart_barrier(bas); } sc->sc_txbusy = 1; - __uart_setreg(bas, UART_IMSC, (UART_RXREADY | UART_TXEMPTY)); + + /* Enable TX interrupt */ + reg = __uart_getreg(bas, UART_IMSC); + reg |= (UART_TXEMPTY); + __uart_setreg(bas, UART_IMSC, reg); + uart_unlock(sc->sc_hwmtx); return (0); From owner-svn-src-stable-10@FreeBSD.ORG Sat May 23 20:53:20 2015 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.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 863B3EA5; Sat, 23 May 2015 20:53:20 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7409B1C89; Sat, 23 May 2015 20:53:20 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4NKrK6s086343; Sat, 23 May 2015 20:53:20 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4NKrKwJ086341; Sat, 23 May 2015 20:53:20 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201505232053.t4NKrKwJ086341@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 23 May 2015 20:53: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: r283326 - stable/10/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.20 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, 23 May 2015 20:53:20 -0000 Author: ian Date: Sat May 23 20:53:19 2015 New Revision: 283326 URL: https://svnweb.freebsd.org/changeset/base/283326 Log: MFC r268137, r268138: Define a "__weak" macro for declaring symbols "weak". Add support for empty data sets. Data set begin and end pointers should resolve to "NULL" when not present. This is done by declaring the data set begin and end symbols as "weak". Modified: stable/10/sys/sys/cdefs.h stable/10/sys/sys/linker_set.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/sys/cdefs.h ============================================================================== --- stable/10/sys/sys/cdefs.h Sat May 23 20:29:06 2015 (r283325) +++ stable/10/sys/sys/cdefs.h Sat May 23 20:53:19 2015 (r283326) @@ -213,7 +213,9 @@ #define __packed #define __aligned(x) #define __section(x) +#define __weak #else +#define __weak __attribute__((__weak__)) #if !__GNUC_PREREQ__(2, 5) && !defined(__INTEL_COMPILER) #define __dead2 #define __pure2 Modified: stable/10/sys/sys/linker_set.h ============================================================================== --- stable/10/sys/sys/linker_set.h Sat May 23 20:29:06 2015 (r283325) +++ stable/10/sys/sys/linker_set.h Sat May 23 20:53:19 2015 (r283326) @@ -68,9 +68,9 @@ /* * Initialize before referring to a given linker set. */ -#define SET_DECLARE(set, ptype) \ - extern ptype *__CONCAT(__start_set_,set); \ - extern ptype *__CONCAT(__stop_set_,set) +#define SET_DECLARE(set, ptype) \ + extern ptype __weak *__CONCAT(__start_set_,set); \ + extern ptype __weak *__CONCAT(__stop_set_,set) #define SET_BEGIN(set) \ (&__CONCAT(__start_set_,set)) From owner-svn-src-stable-10@FreeBSD.ORG Sat May 23 20:54:31 2015 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.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 36413FDE; Sat, 23 May 2015 20:54:31 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 21B0C1C91; Sat, 23 May 2015 20:54:31 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4NKsVks086582; Sat, 23 May 2015 20:54:31 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4NKsP7L086552; Sat, 23 May 2015 20:54:25 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201505232054.t4NKsP7L086552@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 23 May 2015 20:54:25 +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: r283327 - in stable/10/sys: arm/at91 arm/freescale/vybrid arm/samsung/exynos arm/samsung/s3c2xx0 arm/xilinx dev/uart 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.20 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, 23 May 2015 20:54:31 -0000 Author: ian Date: Sat May 23 20:54:25 2015 New Revision: 283327 URL: https://svnweb.freebsd.org/changeset/base/283327 Log: MFC r279723, r279724: Define new linker set, UART_FDT_CLASS_AND_DEVICE, for registering full (class and device) FDT UART. Define second one, UART_FDT_CLASS, for UART class only. Move the uart_class definitions and fdt compat data into the individual uart implementations, and export them using the new linker-set mechanism. Added: stable/10/sys/dev/uart/uart_cpu_fdt.h - copied unchanged from r279723, head/sys/dev/uart/uart_cpu_fdt.h Modified: stable/10/sys/arm/at91/uart_bus_at91usart.c stable/10/sys/arm/at91/uart_cpu_at91usart.c stable/10/sys/arm/at91/uart_dev_at91usart.c stable/10/sys/arm/freescale/vybrid/vf_uart.c stable/10/sys/arm/samsung/exynos/exynos_uart.c stable/10/sys/arm/samsung/s3c2xx0/uart_bus_s3c2410.c stable/10/sys/arm/samsung/s3c2xx0/uart_cpu_s3c2410.c stable/10/sys/arm/xilinx/uart_dev_cdnc.c stable/10/sys/dev/uart/uart.h stable/10/sys/dev/uart/uart_bus_fdt.c stable/10/sys/dev/uart/uart_cpu_fdt.c stable/10/sys/dev/uart/uart_dev_imx.c stable/10/sys/dev/uart/uart_dev_lpc.c stable/10/sys/dev/uart/uart_dev_msm.c stable/10/sys/dev/uart/uart_dev_ns8250.c stable/10/sys/dev/uart/uart_dev_pl011.c stable/10/sys/dev/uart/uart_dev_ti8250.c stable/10/sys/dev/uart/uart_subr.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/arm/at91/uart_bus_at91usart.c ============================================================================== --- stable/10/sys/arm/at91/uart_bus_at91usart.c Sat May 23 20:53:19 2015 (r283326) +++ stable/10/sys/arm/at91/uart_bus_at91usart.c Sat May 23 20:54:25 2015 (r283327) @@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$"); #include "uart_if.h" +extern struct uart_class at91_usart_class; static int usart_at91_probe(device_t dev); static device_method_t usart_at91_methods[] = { Modified: stable/10/sys/arm/at91/uart_cpu_at91usart.c ============================================================================== --- stable/10/sys/arm/at91/uart_cpu_at91usart.c Sat May 23 20:53:19 2015 (r283326) +++ stable/10/sys/arm/at91/uart_cpu_at91usart.c Sat May 23 20:54:25 2015 (r283327) @@ -51,6 +51,7 @@ bus_space_tag_t uart_bus_space_io; bus_space_tag_t uart_bus_space_mem; extern struct bus_space at91_bs_tag; +extern struct uart_class at91_usart_class; int uart_cpu_eqres(struct uart_bas *b1, struct uart_bas *b2) Modified: stable/10/sys/arm/at91/uart_dev_at91usart.c ============================================================================== --- stable/10/sys/arm/at91/uart_dev_at91usart.c Sat May 23 20:53:19 2015 (r283326) +++ stable/10/sys/arm/at91/uart_dev_at91usart.c Sat May 23 20:54:25 2015 (r283327) @@ -40,6 +40,9 @@ __FBSDID("$FreeBSD$"); #include #include +#ifdef FDT +#include +#endif #include #include #include @@ -866,3 +869,12 @@ struct uart_class at91_usart_class = { .uc_ops = &at91_usart_ops, .uc_range = 8 }; + +#ifdef FDT +static struct ofw_compat_data compat_data[] = { + {"atmel,at91rm9200-usart",(uintptr_t)&at91_usart_class}, + {"atmel,at91sam9260-usart",(uintptr_t)&at91_usart_class}, + {NULL, (uintptr_t)NULL}, +}; +UART_FDT_CLASS_AND_DEVICE(compat_data); +#endif Modified: stable/10/sys/arm/freescale/vybrid/vf_uart.c ============================================================================== --- stable/10/sys/arm/freescale/vybrid/vf_uart.c Sat May 23 20:53:19 2015 (r283326) +++ stable/10/sys/arm/freescale/vybrid/vf_uart.c Sat May 23 20:54:25 2015 (r283327) @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include "uart_if.h" @@ -270,7 +271,7 @@ static kobj_method_t vf_uart_methods[] = { 0, 0 } }; -struct uart_class uart_vybrid_class = { +static struct uart_class uart_vybrid_class = { "vybrid", vf_uart_methods, sizeof(struct vf_uart_softc), @@ -279,6 +280,12 @@ struct uart_class uart_vybrid_class = { .uc_rclk = 24000000 /* TODO: get value from CCM */ }; +static struct ofw_compat_data compat_data[] = { + {"fsl,mvf600-uart", (uintptr_t)&uart_vybrid_class}, + {NULL, (uintptr_t)NULL}, +}; +UART_FDT_CLASS_AND_DEVICE(compat_data); + static int vf_uart_bus_attach(struct uart_softc *sc) { Modified: stable/10/sys/arm/samsung/exynos/exynos_uart.c ============================================================================== --- stable/10/sys/arm/samsung/exynos/exynos_uart.c Sat May 23 20:53:19 2015 (r283326) +++ stable/10/sys/arm/samsung/exynos/exynos_uart.c Sat May 23 20:54:25 2015 (r283327) @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -372,7 +373,7 @@ exynos4210_bus_ioctl(struct uart_softc * return (EINVAL); } -struct uart_class uart_exynos4210_class = { +static struct uart_class uart_exynos4210_class = { "exynos4210 class", exynos4210_methods, 1, @@ -380,3 +381,9 @@ struct uart_class uart_exynos4210_class .uc_range = 8, .uc_rclk = 0, }; + +static struct ofw_compat_data compat_data[] = { + {"exynos", (uintptr_t)&uart_exynos4210_class}, + {NULL, (uintptr_t)NULL}, +}; +UART_FDT_CLASS_AND_DEVICE(compat_data); Modified: stable/10/sys/arm/samsung/s3c2xx0/uart_bus_s3c2410.c ============================================================================== --- stable/10/sys/arm/samsung/s3c2xx0/uart_bus_s3c2410.c Sat May 23 20:53:19 2015 (r283326) +++ stable/10/sys/arm/samsung/s3c2xx0/uart_bus_s3c2410.c Sat May 23 20:54:25 2015 (r283327) @@ -19,6 +19,8 @@ __FBSDID("$FreeBSD$"); #include "uart_if.h" +extern struct uart_class uart_s3c2410_class; + static int uart_s3c2410_probe(device_t dev); static device_method_t uart_s3c2410_methods[] = { Modified: stable/10/sys/arm/samsung/s3c2xx0/uart_cpu_s3c2410.c ============================================================================== --- stable/10/sys/arm/samsung/s3c2xx0/uart_cpu_s3c2410.c Sat May 23 20:53:19 2015 (r283326) +++ stable/10/sys/arm/samsung/s3c2xx0/uart_cpu_s3c2410.c Sat May 23 20:54:25 2015 (r283327) @@ -39,11 +39,11 @@ __FBSDID("$FreeBSD$"); #include +extern struct uart_class uart_s3c2410_class; + bus_space_tag_t uart_bus_space_io; bus_space_tag_t uart_bus_space_mem; -extern struct uart_ops uart_s3c2410_ops; - vm_offset_t s3c2410_uart_vaddr; unsigned int s3c2410_pclk; Modified: stable/10/sys/arm/xilinx/uart_dev_cdnc.c ============================================================================== --- stable/10/sys/arm/xilinx/uart_dev_cdnc.c Sat May 23 20:53:19 2015 (r283326) +++ stable/10/sys/arm/xilinx/uart_dev_cdnc.c Sat May 23 20:54:25 2015 (r283327) @@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include "uart_if.h" @@ -700,10 +701,16 @@ cdnc_uart_bus_ungrab(struct uart_softc * CDNC_UART_INT_DMSI); } -struct uart_class uart_cdnc_class = { +static struct uart_class uart_cdnc_class = { "cdnc_uart", cdnc_uart_bus_methods, sizeof(struct uart_softc), .uc_ops = &cdnc_uart_ops, .uc_range = 8 }; + +static struct ofw_compat_data compat_data[] = { + {"cadence,uart", (uintptr_t)&uart_cdnc_class}, + {NULL, (uintptr_t)NULL}, +}; +UART_FDT_CLASS_AND_DEVICE(compat_data); Modified: stable/10/sys/dev/uart/uart.h ============================================================================== --- stable/10/sys/dev/uart/uart.h Sat May 23 20:53:19 2015 (r283326) +++ stable/10/sys/dev/uart/uart.h Sat May 23 20:54:25 2015 (r283327) @@ -64,26 +64,12 @@ struct uart_bas { */ struct uart_class; -extern struct uart_class uart_imx_class __attribute__((weak)); -extern struct uart_class uart_msm_class __attribute__((weak)); extern struct uart_class uart_ns8250_class __attribute__((weak)); extern struct uart_class uart_quicc_class __attribute__((weak)); extern struct uart_class uart_s3c2410_class __attribute__((weak)); extern struct uart_class uart_sab82532_class __attribute__((weak)); extern struct uart_class uart_sbbc_class __attribute__((weak)); extern struct uart_class uart_z8530_class __attribute__((weak)); -extern struct uart_class uart_lpc_class __attribute__((weak)); -extern struct uart_class uart_pl011_class __attribute__((weak)); -extern struct uart_class uart_cdnc_class __attribute__((weak)); -extern struct uart_class uart_ti8250_class __attribute__((weak)); -extern struct uart_class uart_vybrid_class __attribute__((weak)); -extern struct uart_class at91_usart_class __attribute__((weak)); -extern struct uart_class uart_exynos4210_class __attribute__((weak)); - -#ifdef FDT -struct ofw_compat_data; -extern const struct ofw_compat_data *uart_fdt_compat_data; -#endif #ifdef PC98 struct uart_class *uart_pc98_getdev(u_long port); Modified: stable/10/sys/dev/uart/uart_bus_fdt.c ============================================================================== --- stable/10/sys/dev/uart/uart_bus_fdt.c Sat May 23 20:53:19 2015 (r283326) +++ stable/10/sys/dev/uart/uart_bus_fdt.c Sat May 23 20:54:25 2015 (r283327) @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include static int uart_fdt_probe(device_t); @@ -62,37 +63,6 @@ static driver_t uart_fdt_driver = { sizeof(struct uart_softc), }; -/* - * Compatible devices. Keep this sorted in most- to least-specific order first, - * alphabetical second. That is, "zwie,ns16550" should appear before "ns16550" - * on the theory that the zwie driver knows how to make better use of the - * hardware than the generic driver. Likewise with chips within a family, the - * highest-numbers / most recent models should probably appear earlier. - */ -static struct ofw_compat_data compat_data[] = { - {"arm,pl011", (uintptr_t)&uart_pl011_class}, - {"atmel,at91rm9200-usart",(uintptr_t)&at91_usart_class}, - {"atmel,at91sam9260-usart",(uintptr_t)&at91_usart_class}, - {"cadence,uart", (uintptr_t)&uart_cdnc_class}, - {"exynos", (uintptr_t)&uart_exynos4210_class}, - {"fsl,imx6q-uart", (uintptr_t)&uart_imx_class}, - {"fsl,imx53-uart", (uintptr_t)&uart_imx_class}, - {"fsl,imx51-uart", (uintptr_t)&uart_imx_class}, - {"fsl,imx31-uart", (uintptr_t)&uart_imx_class}, - {"fsl,imx27-uart", (uintptr_t)&uart_imx_class}, - {"fsl,imx25-uart", (uintptr_t)&uart_imx_class}, - {"fsl,imx21-uart", (uintptr_t)&uart_imx_class}, - {"fsl,mvf600-uart", (uintptr_t)&uart_vybrid_class}, - {"lpc,uart", (uintptr_t)&uart_lpc_class}, - {"qcom,msm-uartdm", (uintptr_t)&uart_msm_class}, - {"ti,ns16550", (uintptr_t)&uart_ti8250_class}, - {"ns16550", (uintptr_t)&uart_ns8250_class}, - {NULL, (uintptr_t)NULL}, -}; - -/* Export the compat_data table for use by the uart_cpu_fdt.c probe routine. */ -const struct ofw_compat_data *uart_fdt_compat_data = compat_data; - static int uart_fdt_get_clock(phandle_t node, pcell_t *cell) { @@ -127,6 +97,20 @@ uart_fdt_get_shift(phandle_t node, pcell return (0); } +static uintptr_t +uart_fdt_find_device(device_t dev) +{ + struct ofw_compat_data **cd; + const struct ofw_compat_data *ocd; + + SET_FOREACH(cd, uart_fdt_class_and_device_set) { + ocd = ofw_bus_search_compatible(dev, *cd); + if (ocd->ocd_data != 0) + return (ocd->ocd_data); + } + return (0); +} + static int uart_fdt_probe(device_t dev) { @@ -134,19 +118,16 @@ uart_fdt_probe(device_t dev) phandle_t node; pcell_t clock, shift; int err; - const struct ofw_compat_data * cd; sc = device_get_softc(dev); if (!ofw_bus_status_okay(dev)) return (ENXIO); - cd = ofw_bus_search_compatible(dev, compat_data); - if (cd->ocd_data == (uintptr_t)NULL) + sc->sc_class = (struct uart_class *)uart_fdt_find_device(dev); + if (sc->sc_class == NULL) return (ENXIO); - sc->sc_class = (struct uart_class *)cd->ocd_data; - node = ofw_bus_get_node(dev); if ((err = uart_fdt_get_clock(node, &clock)) != 0) Modified: stable/10/sys/dev/uart/uart_cpu_fdt.c ============================================================================== --- stable/10/sys/dev/uart/uart_cpu_fdt.c Sat May 23 20:53:19 2015 (r283326) +++ stable/10/sys/dev/uart/uart_cpu_fdt.c Sat May 23 20:54:25 2015 (r283327) @@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include /* * UART console routines. @@ -115,13 +116,46 @@ phandle_chosen_propdev(phandle_t chosen, return (0); } +static const struct ofw_compat_data * +uart_fdt_find_compatible(phandle_t node, const struct ofw_compat_data *cd) +{ + const struct ofw_compat_data *ocd; + + for (ocd = cd; ocd->ocd_str != NULL; ocd++) { + if (fdt_is_compatible(node, ocd->ocd_str)) + return (ocd); + } + return (NULL); +} + +static uintptr_t +uart_fdt_find_by_node(phandle_t node, int class_list) +{ + struct ofw_compat_data **cd; + const struct ofw_compat_data *ocd; + + if (class_list) { + SET_FOREACH(cd, uart_fdt_class_set) { + ocd = uart_fdt_find_compatible(node, *cd); + if ((ocd != NULL) && (ocd->ocd_data != 0)) + return (ocd->ocd_data); + } + } else { + SET_FOREACH(cd, uart_fdt_class_and_device_set) { + ocd = uart_fdt_find_compatible(node, *cd); + if ((ocd != NULL) && (ocd->ocd_data != 0)) + return (ocd->ocd_data); + } + } + return (0); +} + int uart_cpu_getdev(int devtype, struct uart_devinfo *di) { const char *propnames[] = {"stdout-path", "linux,stdout-path", "stdout", "stdin-path", "stdin", NULL}; const char **name; - const struct ofw_compat_data *cd; struct uart_class *class; phandle_t node, chosen; pcell_t shift, br, rclk; @@ -160,24 +194,32 @@ uart_cpu_getdev(int devtype, struct uart * Retrieve serial attributes. */ uart_fdt_get_shift(node, &shift); - if (OF_getprop(node, "current-speed", &br, sizeof(br)) <= 0) br = 0; - br = fdt32_to_cpu(br); + else + br = fdt32_to_cpu(br); - if ((err = uart_fdt_get_clock(node, &rclk)) != 0) - return (err); /* - * Finalize configuration. + * Check old style of UART definition first. Unfortunately, the common + * FDT processing is not possible if we have clock, power domains and + * pinmux stuff. */ - for (cd = uart_fdt_compat_data; cd->ocd_str != NULL; ++cd) { - if (fdt_is_compatible(node, cd->ocd_str)) - break; + class = (struct uart_class *)uart_fdt_find_by_node(node, 0); + if (class != NULL) { + if ((err = uart_fdt_get_clock(node, &rclk)) != 0) + return (err); + } else { + /* Check class only linker set */ + class = + (struct uart_class *)uart_fdt_find_by_node(node, 1); + if (class == NULL) + return (ENXIO); + rclk = 0; } - if (cd->ocd_str == NULL) - return (ENXIO); - class = (struct uart_class *)cd->ocd_data; + /* + * Finalize configuration. + */ di->bas.chan = 0; di->bas.regshft = (u_int)shift; di->baudrate = br; Copied: stable/10/sys/dev/uart/uart_cpu_fdt.h (from r279723, head/sys/dev/uart/uart_cpu_fdt.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/sys/dev/uart/uart_cpu_fdt.h Sat May 23 20:54:25 2015 (r283327, copy of r279723, head/sys/dev/uart/uart_cpu_fdt.h) @@ -0,0 +1,54 @@ +/*- + * Copyright 2015 Michal Meloun + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _DEV_UART_CPU_FDT_H_ +#define _DEV_UART_CPU_FDT_H_ + +#include + +#include + +/* + * If your UART driver implements only uart_class and uses uart_cpu_fdt.c + * for device instantiation, then use UART_FDT_CLASS_AND_DEVICE for its + * declaration + */ +SET_DECLARE(uart_fdt_class_and_device_set, struct ofw_compat_data ); +#define UART_FDT_CLASS_AND_DEVICE(data) \ + DATA_SET(uart_fdt_class_and_device_set, data) + +/* + * If your UART driver implements uart_class and custom device layer, + * then use UART_FDT_CLASS for its declaration + */ +SET_DECLARE(uart_fdt_class_set, struct ofw_compat_data ); +#define UART_FDT_CLASS(data) \ + DATA_SET(uart_fdt_class_set, data) + + +#endif /* _DEV_UART_CPU_FDT_H_ */ Modified: stable/10/sys/dev/uart/uart_dev_imx.c ============================================================================== --- stable/10/sys/dev/uart/uart_dev_imx.c Sat May 23 20:53:19 2015 (r283326) +++ stable/10/sys/dev/uart/uart_dev_imx.c Sat May 23 20:54:25 2015 (r283327) @@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include "uart_if.h" @@ -291,7 +292,7 @@ static kobj_method_t imx_uart_methods[] { 0, 0 } }; -struct uart_class uart_imx_class = { +static struct uart_class uart_imx_class = { "imx", imx_uart_methods, sizeof(struct imx_uart_softc), @@ -300,6 +301,18 @@ struct uart_class uart_imx_class = { .uc_rclk = 24000000 /* TODO: get value from CCM */ }; +static struct ofw_compat_data compat_data[] = { + {"fsl,imx6q-uart", (uintptr_t)&uart_imx_class}, + {"fsl,imx53-uart", (uintptr_t)&uart_imx_class}, + {"fsl,imx51-uart", (uintptr_t)&uart_imx_class}, + {"fsl,imx31-uart", (uintptr_t)&uart_imx_class}, + {"fsl,imx27-uart", (uintptr_t)&uart_imx_class}, + {"fsl,imx25-uart", (uintptr_t)&uart_imx_class}, + {"fsl,imx21-uart", (uintptr_t)&uart_imx_class}, + {NULL, (uintptr_t)NULL}, +}; +UART_FDT_CLASS_AND_DEVICE(compat_data); + #define SIGCHG(c, i, s, d) \ if (c) { \ i |= (i & s) ? s : s | d; \ Modified: stable/10/sys/dev/uart/uart_dev_lpc.c ============================================================================== --- stable/10/sys/dev/uart/uart_dev_lpc.c Sat May 23 20:53:19 2015 (r283326) +++ stable/10/sys/dev/uart/uart_dev_lpc.c Sat May 23 20:54:25 2015 (r283327) @@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -421,7 +422,7 @@ static kobj_method_t lpc_ns8250_methods[ { 0, 0 } }; -struct uart_class uart_lpc_class = { +static struct uart_class uart_lpc_class = { "lpc_ns8250", lpc_ns8250_methods, sizeof(struct lpc_ns8250_softc), @@ -430,6 +431,12 @@ struct uart_class uart_lpc_class = { .uc_rclk = DEFAULT_RCLK }; +static struct ofw_compat_data compat_data[] = { + {"lpc,uart", (uintptr_t)&uart_lpc_class}, + {NULL, (uintptr_t)NULL}, +}; +UART_FDT_CLASS_AND_DEVICE(compat_data); + #define SIGCHG(c, i, s, d) \ if (c) { \ i |= (i & s) ? s : s | d; \ Modified: stable/10/sys/dev/uart/uart_dev_msm.c ============================================================================== --- stable/10/sys/dev/uart/uart_dev_msm.c Sat May 23 20:53:19 2015 (r283326) +++ stable/10/sys/dev/uart/uart_dev_msm.c Sat May 23 20:54:25 2015 (r283327) @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -558,7 +559,7 @@ msm_bus_ungrab(struct uart_softc *sc) uart_unlock(sc->sc_hwmtx); } -struct uart_class uart_msm_class = { +static struct uart_class uart_msm_class = { "msm", msm_methods, sizeof(struct msm_uart_softc), @@ -566,3 +567,9 @@ struct uart_class uart_msm_class = { .uc_range = 8, .uc_rclk = DEF_CLK, }; + +static struct ofw_compat_data compat_data[] = { + {"qcom,msm-uartdm", (uintptr_t)&uart_msm_class}, + {NULL, (uintptr_t)NULL}, +}; +UART_FDT_CLASS_AND_DEVICE(compat_data); Modified: stable/10/sys/dev/uart/uart_dev_ns8250.c ============================================================================== --- stable/10/sys/dev/uart/uart_dev_ns8250.c Sat May 23 20:53:19 2015 (r283326) +++ stable/10/sys/dev/uart/uart_dev_ns8250.c Sat May 23 20:54:25 2015 (r283327) @@ -45,6 +45,9 @@ __FBSDID("$FreeBSD$"); #include #include +#ifdef FDT +#include +#endif #include #include @@ -379,6 +382,14 @@ struct uart_class uart_ns8250_class = { .uc_rclk = DEFAULT_RCLK }; +#ifdef FDT +static struct ofw_compat_data compat_data[] = { + {"ns16550", (uintptr_t)&uart_ns8250_class}, + {NULL, (uintptr_t)NULL}, +}; +UART_FDT_CLASS_AND_DEVICE(compat_data); +#endif + #define SIGCHG(c, i, s, d) \ if (c) { \ i |= (i & s) ? s : s | d; \ Modified: stable/10/sys/dev/uart/uart_dev_pl011.c ============================================================================== --- stable/10/sys/dev/uart/uart_dev_pl011.c Sat May 23 20:53:19 2015 (r283326) +++ stable/10/sys/dev/uart/uart_dev_pl011.c Sat May 23 20:54:25 2015 (r283327) @@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include "uart_if.h" @@ -266,7 +267,7 @@ static kobj_method_t uart_pl011_methods[ { 0, 0 } }; -struct uart_class uart_pl011_class = { +static struct uart_class uart_pl011_class = { "uart_pl011", uart_pl011_methods, sizeof(struct uart_pl011_softc), @@ -275,6 +276,12 @@ struct uart_class uart_pl011_class = { .uc_rclk = 0 }; +static struct ofw_compat_data compat_data[] = { + {"arm,pl011", (uintptr_t)&uart_pl011_class}, + {NULL, (uintptr_t)NULL}, +}; +UART_FDT_CLASS_AND_DEVICE(compat_data); + static int uart_pl011_bus_attach(struct uart_softc *sc) { Modified: stable/10/sys/dev/uart/uart_dev_ti8250.c ============================================================================== --- stable/10/sys/dev/uart/uart_dev_ti8250.c Sat May 23 20:53:19 2015 (r283326) +++ stable/10/sys/dev/uart/uart_dev_ti8250.c Sat May 23 20:54:25 2015 (r283327) @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -130,7 +131,7 @@ static kobj_method_t ti8250_methods[] = KOBJMETHOD_END }; -struct uart_class uart_ti8250_class = { +static struct uart_class uart_ti8250_class = { "ti8250", ti8250_methods, sizeof(struct ti8250_softc), @@ -138,4 +139,8 @@ struct uart_class uart_ti8250_class = { .uc_range = 0x88, .uc_rclk = 48000000 }; - +static struct ofw_compat_data compat_data[] = { + {"ti,ns16550", (uintptr_t)&uart_ti8250_class}, + {NULL, (uintptr_t)NULL}, +}; +UART_FDT_CLASS_AND_DEVICE(compat_data); Modified: stable/10/sys/dev/uart/uart_subr.c ============================================================================== --- stable/10/sys/dev/uart/uart_subr.c Sat May 23 20:53:19 2015 (r283326) +++ stable/10/sys/dev/uart/uart_subr.c Sat May 23 20:54:25 2015 (r283327) @@ -53,7 +53,6 @@ static struct uart_class *uart_classes[] &uart_sab82532_class, &uart_z8530_class, #if defined(__arm__) - &uart_lpc_class, &uart_s3c2410_class, #endif }; From owner-svn-src-stable-10@FreeBSD.ORG Sat May 23 21:12:52 2015 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A105D4E3; Sat, 23 May 2015 21:12: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8EAD91E76; Sat, 23 May 2015 21:12:52 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4NLCq1x096427; Sat, 23 May 2015 21:12:52 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4NLCqdE096426; Sat, 23 May 2015 21:12:52 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201505232112.t4NLCqdE096426@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 23 May 2015 21:12: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: r283329 - stable/10/sys/arm/ti 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.20 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, 23 May 2015 21:12:52 -0000 Author: ian Date: Sat May 23 21:12:51 2015 New Revision: 283329 URL: https://svnweb.freebsd.org/changeset/base/283329 Log: MFC r276021, r279766: Reduce the diff in the Ti aintc between head and arm_intrng Fix spurious interrupts on arm am335x (beaglebone), by doing the EOI in both the post-filter and post-thread callbacks. Modified: stable/10/sys/arm/ti/aintc.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/arm/ti/aintc.c ============================================================================== --- stable/10/sys/arm/ti/aintc.c Sat May 23 21:04:15 2015 (r283328) +++ stable/10/sys/arm/ti/aintc.c Sat May 23 21:12:51 2015 (r283329) @@ -72,12 +72,20 @@ static struct resource_spec ti_aintc_spe static struct ti_aintc_softc *ti_aintc_sc = NULL; -#define aintc_read_4(reg) \ - bus_space_read_4(ti_aintc_sc->aintc_bst, ti_aintc_sc->aintc_bsh, reg) -#define aintc_write_4(reg, val) \ - bus_space_write_4(ti_aintc_sc->aintc_bst, ti_aintc_sc->aintc_bsh, reg, val) +#define aintc_read_4(_sc, reg) \ + bus_space_read_4((_sc)->aintc_bst, (_sc)->aintc_bsh, (reg)) +#define aintc_write_4(_sc, reg, val) \ + bus_space_write_4((_sc)->aintc_bst, (_sc)->aintc_bsh, (reg), (val)) +static void +aintc_post_filter(void *arg) +{ + + arm_irq_memory_barrier(0); + aintc_write_4(ti_aintc_sc, INTC_CONTROL, 1); /* EOI */ +} + static int ti_aintc_probe(device_t dev) { @@ -112,17 +120,19 @@ ti_aintc_attach(device_t dev) ti_aintc_sc = sc; - x = aintc_read_4(INTC_REVISION); + x = aintc_read_4(sc, INTC_REVISION); device_printf(dev, "Revision %u.%u\n",(x >> 4) & 0xF, x & 0xF); /* SoftReset */ - aintc_write_4(INTC_SYSCONFIG, 2); + aintc_write_4(sc, INTC_SYSCONFIG, 2); /* Wait for reset to complete */ - while(!(aintc_read_4(INTC_SYSSTATUS) & 1)); + while(!(aintc_read_4(sc, INTC_SYSSTATUS) & 1)); /*Set Priority Threshold */ - aintc_write_4(INTC_THRESHOLD, 0xFF); + aintc_write_4(sc, INTC_THRESHOLD, 0xFF); + + arm_post_filter = aintc_post_filter; return (0); } @@ -146,22 +156,17 @@ DRIVER_MODULE(aintc, simplebus, ti_aintc int arm_get_next_irq(int last_irq) { + struct ti_aintc_softc *sc = ti_aintc_sc; uint32_t active_irq; - if (last_irq != -1) { - aintc_write_4(INTC_ISR_CLEAR(last_irq >> 5), - 1UL << (last_irq & 0x1F)); - aintc_write_4(INTC_CONTROL,1); - } - /* Get the next active interrupt */ - active_irq = aintc_read_4(INTC_SIR_IRQ); + active_irq = aintc_read_4(sc, INTC_SIR_IRQ); /* Check for spurious interrupt */ if ((active_irq & 0xffffff80)) { - device_printf(ti_aintc_sc->sc_dev, - "Spurious interrupt detected (0x%08x)\n", active_irq); - aintc_write_4(INTC_SIR_IRQ, 0); + device_printf(sc->sc_dev, + "Spurious interrupt detected (0x%08x)\n", active_irq); + aintc_write_4(sc, INTC_SIR_IRQ, 0); return -1; } @@ -174,13 +179,17 @@ arm_get_next_irq(int last_irq) void arm_mask_irq(uintptr_t nb) { - aintc_write_4(INTC_MIR_SET(nb >> 5), (1UL << (nb & 0x1F))); + struct ti_aintc_softc *sc = ti_aintc_sc; + + aintc_write_4(sc, INTC_MIR_SET(nb >> 5), (1UL << (nb & 0x1F))); + aintc_write_4(sc, INTC_CONTROL, 1); /* EOI */ } void arm_unmask_irq(uintptr_t nb) { + struct ti_aintc_softc *sc = ti_aintc_sc; arm_irq_memory_barrier(nb); - aintc_write_4(INTC_MIR_CLEAR(nb >> 5), (1UL << (nb & 0x1F))); + aintc_write_4(sc, INTC_MIR_CLEAR(nb >> 5), (1UL << (nb & 0x1F))); } From owner-svn-src-stable-10@FreeBSD.ORG Sat May 23 22:33:07 2015 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C28335CC; Sat, 23 May 2015 22: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9673816A3; Sat, 23 May 2015 22:33:07 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4NMX723036593; Sat, 23 May 2015 22:33:07 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4NMX6SH036584; Sat, 23 May 2015 22:33:06 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201505232233.t4NMX6SH036584@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 23 May 2015 22:33: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: r283332 - in stable/10/sys: arm/arm arm/mv dev/ofw 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.20 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, 23 May 2015 22:33:07 -0000 Author: ian Date: Sat May 23 22:33:06 2015 New Revision: 283332 URL: https://svnweb.freebsd.org/changeset/base/283332 Log: MFC r274249, r274484, r275583: Avoid panic in ofwbus caused by not released resource list entry Fix typo in ARM GIC device_printf() Fix buffer overflow in Marvell PCI/PCIe driver Modified: stable/10/sys/arm/arm/gic.c stable/10/sys/arm/mv/mv_pci.c stable/10/sys/dev/ofw/ofwbus.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/arm/arm/gic.c ============================================================================== --- stable/10/sys/arm/arm/gic.c Sat May 23 22:28:59 2015 (r283331) +++ stable/10/sys/arm/arm/gic.c Sat May 23 22:33:06 2015 (r283332) @@ -273,7 +273,7 @@ arm_gic_attach(device_t dev) arm_config_irq = gic_config_irq; icciidr = gic_c_read_4(GICC_IIDR); - device_printf(dev,"pn 0x%x, arch 0x%x, rev 0x%x, implementer 0x%x sc->nirqs %u\n", + device_printf(dev,"pn 0x%x, arch 0x%x, rev 0x%x, implementer 0x%x irqs %u\n", icciidr>>20, (icciidr>>16) & 0xF, (icciidr>>12) & 0xf, (icciidr & 0xfff), sc->nirqs); Modified: stable/10/sys/arm/mv/mv_pci.c ============================================================================== --- stable/10/sys/arm/mv/mv_pci.c Sat May 23 22:28:59 2015 (r283331) +++ stable/10/sys/arm/mv/mv_pci.c Sat May 23 22:33:06 2015 (r283332) @@ -1171,7 +1171,7 @@ mv_pcib_alloc_msi(device_t dev, device_t for (i = start; i < start + count; i++) { setbit(&sc->sc_msi_bitmap, i); - irqs[i] = MSI_IRQ + i; + *irqs++ = MSI_IRQ + i; } debugf("%s: start: %x count: %x\n", __func__, start, count); Modified: stable/10/sys/dev/ofw/ofwbus.c ============================================================================== --- stable/10/sys/dev/ofw/ofwbus.c Sat May 23 22:28:59 2015 (r283331) +++ stable/10/sys/dev/ofw/ofwbus.c Sat May 23 22:33:06 2015 (r283332) @@ -399,11 +399,17 @@ ofwbus_adjust_resource(device_t bus, dev } static int -ofwbus_release_resource(device_t bus __unused, device_t child, int type, +ofwbus_release_resource(device_t bus, device_t child, int type, int rid, struct resource *r) { + struct resource_list_entry *rle; int error; + /* Clean resource list entry */ + rle = resource_list_find(BUS_GET_RESOURCE_LIST(bus, child), type, rid); + if (rle != NULL) + rle->res = NULL; + if ((rman_get_flags(r) & RF_ACTIVE) != 0) { error = bus_deactivate_resource(child, type, rid, r); if (error) From owner-svn-src-stable-10@FreeBSD.ORG Sat May 23 22:34:26 2015 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.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4B7CF730; Sat, 23 May 2015 22:34:26 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 39E0B16AF; Sat, 23 May 2015 22:34:26 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4NMYQls036838; Sat, 23 May 2015 22:34:26 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4NMYQnD036837; Sat, 23 May 2015 22:34:26 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201505232234.t4NMYQnD036837@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 23 May 2015 22:34: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: r283333 - 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.20 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, 23 May 2015 22:34:26 -0000 Author: ian Date: Sat May 23 22:34:25 2015 New Revision: 283333 URL: https://svnweb.freebsd.org/changeset/base/283333 Log: MFC r274711: Stop using early_putc immediately after configuring console with cninit() Modified: stable/10/sys/kern/kern_cons.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/kern_cons.c ============================================================================== --- stable/10/sys/kern/kern_cons.c Sat May 23 22:33:06 2015 (r283332) +++ stable/10/sys/kern/kern_cons.c Sat May 23 22:34:25 2015 (r283333) @@ -156,6 +156,13 @@ cninit(void) * Make the best console the preferred console. */ cnselect(best_cn); + +#ifdef EARLY_PRINTF + /* + * Release early console. + */ + early_putc = NULL; +#endif } void From owner-svn-src-stable-10@FreeBSD.ORG Sat May 23 22:36:43 2015 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id BCB7087B; Sat, 23 May 2015 22:36:43 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AAA7316C1; Sat, 23 May 2015 22:36:43 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4NMahlU037214; Sat, 23 May 2015 22:36:43 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4NMagtZ037207; Sat, 23 May 2015 22:36:42 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201505232236.t4NMagtZ037207@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 23 May 2015 22:36:42 +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: r283334 - in stable/10/sys: arm/arm dev/fdt dev/ofw 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.20 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, 23 May 2015 22:36:43 -0000 Author: ian Date: Sat May 23 22:36:41 2015 New Revision: 283334 URL: https://svnweb.freebsd.org/changeset/base/283334 Log: MFC r277098, r279235: Introduce ofw_bus_reg_to_rl() to replace part of common bus code Fix endianness on FDT read in ARM GIC Modified: stable/10/sys/arm/arm/gic.c stable/10/sys/dev/fdt/simplebus.c stable/10/sys/dev/ofw/ofw_bus_subr.c stable/10/sys/dev/ofw/ofw_bus_subr.h stable/10/sys/dev/ofw/ofwbus.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/arm/arm/gic.c ============================================================================== --- stable/10/sys/arm/arm/gic.c Sat May 23 22:34:25 2015 (r283333) +++ stable/10/sys/arm/arm/gic.c Sat May 23 22:36:41 2015 (r283334) @@ -204,7 +204,7 @@ gic_decode_fdt(uint32_t iparent, uint32_ *trig = INTR_TRIGGER_CONFORM; *pol = INTR_POLARITY_CONFORM; } else { - if (intr[0] == 0) + if (fdt32_to_cpu(intr[0]) == 0) *interrupt = fdt32_to_cpu(intr[1]) + GIC_FIRST_SPI; else *interrupt = fdt32_to_cpu(intr[1]) + GIC_FIRST_PPI; @@ -216,13 +216,13 @@ gic_decode_fdt(uint32_t iparent, uint32_ * 8 = active low level-sensitive * The hardware only supports active-high-level or rising-edge. */ - if (intr[2] & 0x0a) { + if (fdt32_to_cpu(intr[2]) & 0x0a) { printf("unsupported trigger/polarity configuration " - "0x%2x\n", intr[2] & 0x0f); + "0x%2x\n", fdt32_to_cpu(intr[2]) & 0x0f); return (ENOTSUP); } *pol = INTR_POLARITY_CONFORM; - if (intr[2] & 0x01) + if (fdt32_to_cpu(intr[2]) & 0x01) *trig = INTR_TRIGGER_EDGE; else *trig = INTR_TRIGGER_LEVEL; Modified: stable/10/sys/dev/fdt/simplebus.c ============================================================================== --- stable/10/sys/dev/fdt/simplebus.c Sat May 23 22:34:25 2015 (r283333) +++ stable/10/sys/dev/fdt/simplebus.c Sat May 23 22:36:41 2015 (r283334) @@ -253,10 +253,6 @@ simplebus_setup_dinfo(device_t dev, phan { struct simplebus_softc *sc; struct simplebus_devinfo *ndi; - uint32_t *reg; - uint64_t phys, size; - int i, j, k; - int nreg; sc = device_get_softc(dev); @@ -267,32 +263,7 @@ simplebus_setup_dinfo(device_t dev, phan } resource_list_init(&ndi->rl); - nreg = OF_getencprop_alloc(node, "reg", sizeof(*reg), (void **)®); - if (nreg == -1) - nreg = 0; - if (nreg % (sc->acells + sc->scells) != 0) { - if (bootverbose) - device_printf(dev, "Malformed reg property on <%s>\n", - ndi->obdinfo.obd_name); - nreg = 0; - } - - for (i = 0, k = 0; i < nreg; i += sc->acells + sc->scells, k++) { - phys = size = 0; - for (j = 0; j < sc->acells; j++) { - phys <<= 32; - phys |= reg[i + j]; - } - for (j = 0; j < sc->scells; j++) { - size <<= 32; - size |= reg[i + sc->acells + j]; - } - - resource_list_add(&ndi->rl, SYS_RES_MEMORY, k, - phys, phys + size - 1, size); - } - free(reg, M_OFWPROP); - + ofw_bus_reg_to_rl(dev, node, sc->acells, sc->scells, &ndi->rl); ofw_bus_intr_to_rl(dev, node, &ndi->rl); return (ndi); Modified: stable/10/sys/dev/ofw/ofw_bus_subr.c ============================================================================== --- stable/10/sys/dev/ofw/ofw_bus_subr.c Sat May 23 22:34:25 2015 (r283333) +++ stable/10/sys/dev/ofw/ofw_bus_subr.c Sat May 23 22:36:41 2015 (r283334) @@ -370,6 +370,54 @@ ofw_bus_search_intrmap(void *intr, int i } int +ofw_bus_reg_to_rl(device_t dev, phandle_t node, pcell_t acells, pcell_t scells, + struct resource_list *rl) +{ + uint64_t phys, size; + ssize_t i, j, rid, nreg, ret; + uint32_t *reg; + char *name; + + /* + * This may be just redundant when having ofw_bus_devinfo + * but makes this routine independent of it. + */ + ret = OF_getencprop_alloc(node, "name", sizeof(*name), (void **)&name); + if (ret == -1) + name = NULL; + + ret = OF_getencprop_alloc(node, "reg", sizeof(*reg), (void **)®); + nreg = (ret == -1) ? 0 : ret; + + if (nreg % (acells + scells) != 0) { + if (bootverbose) + device_printf(dev, "Malformed reg property on <%s>\n", + (name == NULL) ? "unknown" : name); + nreg = 0; + } + + for (i = 0, rid = 0; i < nreg; i += acells + scells, rid++) { + phys = size = 0; + for (j = 0; j < acells; j++) { + phys <<= 32; + phys |= reg[i + j]; + } + for (j = 0; j < scells; j++) { + size <<= 32; + size |= reg[i + acells + j]; + } + /* Skip the dummy reg property of glue devices like ssm(4). */ + if (size != 0) + resource_list_add(rl, SYS_RES_MEMORY, rid, + phys, phys + size - 1, size); + } + free(name, M_OFWPROP); + free(reg, M_OFWPROP); + + return (0); +} + +int ofw_bus_intr_to_rl(device_t dev, phandle_t node, struct resource_list *rl) { phandle_t iparent; Modified: stable/10/sys/dev/ofw/ofw_bus_subr.h ============================================================================== --- stable/10/sys/dev/ofw/ofw_bus_subr.h Sat May 23 22:34:25 2015 (r283333) +++ stable/10/sys/dev/ofw/ofw_bus_subr.h Sat May 23 22:36:41 2015 (r283334) @@ -73,6 +73,8 @@ int ofw_bus_search_intrmap(void *, int, void *, void *, int, phandle_t *); /* Routines for parsing device-tree data into resource lists. */ +int ofw_bus_reg_to_rl(device_t, phandle_t, pcell_t, pcell_t, + struct resource_list *); int ofw_bus_intr_to_rl(device_t, phandle_t, struct resource_list *); /* Helper to get device status property */ Modified: stable/10/sys/dev/ofw/ofwbus.c ============================================================================== --- stable/10/sys/dev/ofw/ofwbus.c Sat May 23 22:34:25 2015 (r283333) +++ stable/10/sys/dev/ofw/ofwbus.c Sat May 23 22:36:41 2015 (r283334) @@ -442,10 +442,6 @@ ofwbus_setup_dinfo(device_t dev, phandle struct ofwbus_softc *sc; struct ofwbus_devinfo *ndi; const char *nodename; - uint32_t *reg; - uint64_t phys, size; - int i, j, rid; - int nreg; sc = device_get_softc(dev); @@ -462,33 +458,7 @@ ofwbus_setup_dinfo(device_t dev, phandle } resource_list_init(&ndi->ndi_rl); - nreg = OF_getencprop_alloc(node, "reg", sizeof(*reg), (void **)®); - if (nreg == -1) - nreg = 0; - if (nreg % (sc->acells + sc->scells) != 0) { - if (bootverbose) - device_printf(dev, "Malformed reg property on <%s>\n", - nodename); - nreg = 0; - } - - for (i = 0, rid = 0; i < nreg; i += sc->acells + sc->scells, rid++) { - phys = size = 0; - for (j = 0; j < sc->acells; j++) { - phys <<= 32; - phys |= reg[i + j]; - } - for (j = 0; j < sc->scells; j++) { - size <<= 32; - size |= reg[i + sc->acells + j]; - } - /* Skip the dummy reg property of glue devices like ssm(4). */ - if (size != 0) - resource_list_add(&ndi->ndi_rl, SYS_RES_MEMORY, rid, - phys, phys + size - 1, size); - } - free(reg, M_OFWPROP); - + ofw_bus_reg_to_rl(dev, node, sc->acells, sc->scells, &ndi->ndi_rl); ofw_bus_intr_to_rl(dev, node, &ndi->ndi_rl); return (ndi); From owner-svn-src-stable-10@FreeBSD.ORG Sat May 23 22:48:56 2015 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 96877A5E; Sat, 23 May 2015 22:48:56 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 77A5017A5; Sat, 23 May 2015 22:48:56 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4NMmuiU042406; Sat, 23 May 2015 22:48:56 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4NMmtqi042400; Sat, 23 May 2015 22:48:55 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201505232248.t4NMmtqi042400@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 23 May 2015 22:48:55 +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: r283335 - in stable/10/sys/arm: arm include 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.20 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, 23 May 2015 22:48:56 -0000 Author: ian Date: Sat May 23 22:48:54 2015 New Revision: 283335 URL: https://svnweb.freebsd.org/changeset/base/283335 Log: MFC r278518: Resolve cache line size from CP15 instead of hard-coded 32. Modified: stable/10/sys/arm/arm/cpufunc.c stable/10/sys/arm/arm/cpufunc_asm_armv7.S stable/10/sys/arm/arm/elf_trampoline.c stable/10/sys/arm/include/armreg.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/arm/arm/cpufunc.c ============================================================================== --- stable/10/sys/arm/arm/cpufunc.c Sat May 23 22:36:41 2015 (r283334) +++ stable/10/sys/arm/arm/cpufunc.c Sat May 23 22:48:54 2015 (r283335) @@ -837,6 +837,11 @@ u_int cpu_reset_needs_v4_MMU_disable; /* defined(CPU_XSCALE_80219) || defined(CPU_XSCALE_81342) || \ defined(CPU_CORTEXA) || defined(CPU_KRAIT) +/* Global cache line sizes, use 32 as default */ +int arm_dcache_min_line_size = 32; +int arm_icache_min_line_size = 32; +int arm_idcache_min_line_size = 32; + static void get_cachetype_cp15(void); /* Additional cache information local to this file. Log2 of some of the @@ -868,6 +873,12 @@ get_cachetype_cp15() goto out; if (CPU_CT_FORMAT(ctype) == CPU_CT_ARMV7) { + /* Resolve minimal cache line sizes */ + arm_dcache_min_line_size = 1 << (CPU_CT_DMINLINE(ctype) + 2); + arm_icache_min_line_size = 1 << (CPU_CT_IMINLINE(ctype) + 2); + arm_idcache_min_line_size = + min(arm_icache_min_line_size, arm_dcache_min_line_size); + __asm __volatile("mrc p15, 1, %0, c0, c0, 1" : "=r" (clevel)); arm_cache_level = clevel; Modified: stable/10/sys/arm/arm/cpufunc_asm_armv7.S ============================================================================== --- stable/10/sys/arm/arm/cpufunc_asm_armv7.S Sat May 23 22:36:41 2015 (r283334) +++ stable/10/sys/arm/arm/cpufunc_asm_armv7.S Sat May 23 22:48:54 2015 (r283335) @@ -41,6 +41,12 @@ __FBSDID("$FreeBSD$"); .word _C_LABEL(arm_cache_loc) .Lcache_type: .word _C_LABEL(arm_cache_type) +.Larmv7_dcache_line_size: + .word _C_LABEL(arm_dcache_min_line_size) +.Larmv7_icache_line_size: + .word _C_LABEL(arm_icache_min_line_size) +.Larmv7_idcache_line_size: + .word _C_LABEL(arm_idcache_min_line_size) .Lway_mask: .word 0x3ff .Lmax_index: @@ -176,14 +182,9 @@ ENTRY(armv7_idcache_wbinv_all) RET END(armv7_idcache_wbinv_all) -/* XXX Temporary set it to 32 for MV cores, however this value should be - * get from Cache Type register - */ -.Larmv7_line_size: - .word 32 - ENTRY(armv7_dcache_wb_range) - ldr ip, .Larmv7_line_size + ldr ip, .Larmv7_dcache_line_size + ldr ip, [ip] sub r3, ip, #1 and r2, r0, r3 add r1, r1, r2 @@ -198,7 +199,8 @@ ENTRY(armv7_dcache_wb_range) END(armv7_dcache_wb_range) ENTRY(armv7_dcache_wbinv_range) - ldr ip, .Larmv7_line_size + ldr ip, .Larmv7_dcache_line_size + ldr ip, [ip] sub r3, ip, #1 and r2, r0, r3 add r1, r1, r2 @@ -217,7 +219,8 @@ END(armv7_dcache_wbinv_range) * must use wb-inv of the entire cache. */ ENTRY(armv7_dcache_inv_range) - ldr ip, .Larmv7_line_size + ldr ip, .Larmv7_dcache_line_size + ldr ip, [ip] sub r3, ip, #1 and r2, r0, r3 add r1, r1, r2 @@ -232,7 +235,8 @@ ENTRY(armv7_dcache_inv_range) END(armv7_dcache_inv_range) ENTRY(armv7_idcache_wbinv_range) - ldr ip, .Larmv7_line_size + ldr ip, .Larmv7_idcache_line_size + ldr ip, [ip] sub r3, ip, #1 and r2, r0, r3 add r1, r1, r2 @@ -260,7 +264,8 @@ ENTRY_NP(armv7_icache_sync_all) END(armv7_icache_sync_all) ENTRY_NP(armv7_icache_sync_range) - ldr ip, .Larmv7_line_size + ldr ip, .Larmv7_icache_line_size + ldr ip, [ip] .Larmv7_sync_next: mcr CP15_ICIMVAU(r0) mcr CP15_DCCMVAC(r0) Modified: stable/10/sys/arm/arm/elf_trampoline.c ============================================================================== --- stable/10/sys/arm/arm/elf_trampoline.c Sat May 23 22:36:41 2015 (r283334) +++ stable/10/sys/arm/arm/elf_trampoline.c Sat May 23 22:48:54 2015 (r283335) @@ -115,6 +115,10 @@ int arm_pcache_unified; int arm_dcache_align; int arm_dcache_align_mask; +int arm_dcache_min_line_size = 32; +int arm_icache_min_line_size = 32; +int arm_idcache_min_line_size = 32; + u_int arm_cache_level; u_int arm_cache_type[14]; u_int arm_cache_loc; @@ -277,6 +281,13 @@ get_cachetype_cp15() goto out; if (CPU_CT_FORMAT(ctype) == CPU_CT_ARMV7) { + /* Resolve minimal cache line sizes */ + arm_dcache_min_line_size = 1 << (CPU_CT_DMINLINE(ctype) + 2); + arm_icache_min_line_size = 1 << (CPU_CT_IMINLINE(ctype) + 2); + arm_idcache_min_line_size = + (arm_dcache_min_line_size > arm_icache_min_line_size ? + arm_icache_min_line_size : arm_dcache_min_line_size); + __asm __volatile("mrc p15, 1, %0, c0, c0, 1" : "=r" (clevel)); arm_cache_level = clevel; Modified: stable/10/sys/arm/include/armreg.h ============================================================================== --- stable/10/sys/arm/include/armreg.h Sat May 23 22:36:41 2015 (r283334) +++ stable/10/sys/arm/include/armreg.h Sat May 23 22:48:54 2015 (r283335) @@ -318,6 +318,9 @@ #define CPU_CT_S (1U << 24) /* split cache */ #define CPU_CT_CTYPE(x) (((x) >> 25) & 0xf) /* cache type */ #define CPU_CT_FORMAT(x) ((x) >> 29) +/* Cache type register definitions for ARM v7 */ +#define CPU_CT_IMINLINE(x) ((x) & 0xf) /* I$ min line size */ +#define CPU_CT_DMINLINE(x) (((x) >> 16) & 0xf) /* D$ min line size */ #define CPU_CT_CTYPE_WT 0 /* write-through */ #define CPU_CT_CTYPE_WB1 1 /* write-back, clean w/ read */ From owner-svn-src-stable-10@FreeBSD.ORG Sat May 23 23:05:33 2015 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E6B7FE4F; Sat, 23 May 2015 23:05:33 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D484B1968; Sat, 23 May 2015 23:05:33 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4NN5X5U052066; Sat, 23 May 2015 23:05:33 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4NN5WCe052056; Sat, 23 May 2015 23:05:32 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201505232305.t4NN5WCe052056@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 23 May 2015 23:05: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: r283336 - in stable/10/sys/arm: arm include 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.20 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, 23 May 2015 23:05:34 -0000 Author: ian Date: Sat May 23 23:05:31 2015 New Revision: 283336 URL: https://svnweb.freebsd.org/changeset/base/283336 Log: MFC r279810, r279811: Clean data cache before instruction cache in armv7_icache_sync_range(). Add minimum cache line sizes to struct cpuinfo, use them in the new cache maintenance routines. Also add a routine to invalidate the branch cache. Modified: stable/10/sys/arm/arm/cpufunc_asm_armv7.S stable/10/sys/arm/arm/cpuinfo.c stable/10/sys/arm/arm/genassym.c stable/10/sys/arm/include/cpu-v6.h stable/10/sys/arm/include/cpuinfo.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/arm/arm/cpufunc_asm_armv7.S ============================================================================== --- stable/10/sys/arm/arm/cpufunc_asm_armv7.S Sat May 23 22:48:54 2015 (r283335) +++ stable/10/sys/arm/arm/cpufunc_asm_armv7.S Sat May 23 23:05:31 2015 (r283336) @@ -247,8 +247,8 @@ ENTRY(armv7_idcache_wbinv_range) add r0, r0, ip subs r1, r1, ip bhi .Larmv7_id_wbinv_next - isb /* instruction synchronization barrier */ dsb /* data synchronization barrier */ + isb /* instruction synchronization barrier */ RET END(armv7_idcache_wbinv_range) @@ -258,8 +258,8 @@ ENTRY_NP(armv7_icache_sync_all) #else mcr CP15_ICIALLU #endif - isb /* instruction synchronization barrier */ dsb /* data synchronization barrier */ + isb /* instruction synchronization barrier */ RET END(armv7_icache_sync_all) @@ -267,13 +267,13 @@ ENTRY_NP(armv7_icache_sync_range) ldr ip, .Larmv7_icache_line_size ldr ip, [ip] .Larmv7_sync_next: - mcr CP15_ICIMVAU(r0) mcr CP15_DCCMVAC(r0) + mcr CP15_ICIMVAU(r0) add r0, r0, ip subs r1, r1, ip bhi .Larmv7_sync_next - isb /* instruction synchronization barrier */ dsb /* data synchronization barrier */ + isb /* instruction synchronization barrier */ RET END(armv7_icache_sync_range) Modified: stable/10/sys/arm/arm/cpuinfo.c ============================================================================== --- stable/10/sys/arm/arm/cpuinfo.c Sat May 23 22:48:54 2015 (r283335) +++ stable/10/sys/arm/arm/cpuinfo.c Sat May 23 23:05:31 2015 (r283336) @@ -34,7 +34,14 @@ __FBSDID("$FreeBSD$"); #include #include -struct cpuinfo cpuinfo; +struct cpuinfo cpuinfo = +{ + /* Use safe defaults for start */ + .dcache_line_size = 32, + .dcache_line_mask = 31, + .icache_line_size = 32, + .icache_line_mask = 31, +}; /* Read and parse CPU id scheme */ void @@ -122,4 +129,10 @@ cpuinfo_init(void) cpuinfo.generic_timer_ext = (cpuinfo.id_pfr1 >> 16) & 0xF; cpuinfo.virtualization_ext = (cpuinfo.id_pfr1 >> 12) & 0xF; cpuinfo.security_ext = (cpuinfo.id_pfr1 >> 4) & 0xF; + + /* L1 Cache sizes */ + cpuinfo.dcache_line_size = 1 << (CPU_CT_DMINLINE(cpuinfo.ctr ) + 2); + cpuinfo.dcache_line_mask = cpuinfo.dcache_line_size - 1; + cpuinfo.icache_line_size= 1 << (CPU_CT_IMINLINE(cpuinfo.ctr ) + 2); + cpuinfo.icache_line_mask = cpuinfo.icache_line_size - 1; } Modified: stable/10/sys/arm/arm/genassym.c ============================================================================== --- stable/10/sys/arm/arm/genassym.c Sat May 23 22:48:54 2015 (r283335) +++ stable/10/sys/arm/arm/genassym.c Sat May 23 23:05:31 2015 (r283336) @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -146,3 +147,8 @@ ASSYM(MAXCOMLEN, MAXCOMLEN); ASSYM(MAXCPU, MAXCPU); ASSYM(NIRQ, NIRQ); ASSYM(PCPU_SIZE, sizeof(struct pcpu)); + +ASSYM(DCACHE_LINE_SIZE, offsetof(struct cpuinfo, dcache_line_size)); +ASSYM(DCACHE_LINE_MASK, offsetof(struct cpuinfo, dcache_line_mask)); +ASSYM(ICACHE_LINE_SIZE, offsetof(struct cpuinfo, icache_line_size)); +ASSYM(ICACHE_LINE_MASK, offsetof(struct cpuinfo, icache_line_mask)); Modified: stable/10/sys/arm/include/cpu-v6.h ============================================================================== --- stable/10/sys/arm/include/cpu-v6.h Sat May 23 22:48:54 2015 (r283335) +++ stable/10/sys/arm/include/cpu-v6.h Sat May 23 23:05:31 2015 (r283336) @@ -37,6 +37,9 @@ #define CPU_ASID_KERNEL 0 +vm_offset_t dcache_wb_pou_checked(vm_offset_t, vm_size_t); +vm_offset_t icache_inv_pou_checked(vm_offset_t, vm_size_t); + /* * Macros to generate CP15 (system control processor) read/write functions. */ @@ -295,7 +298,7 @@ icache_sync(vm_offset_t sva, vm_size_t s vm_offset_t eva = sva + size; dsb(); - for (va = sva; va < eva; va += arm_dcache_align) { + for (va = sva; va < eva; va += cpuinfo.dcache_line_size) { #if __ARM_ARCH >= 7 && defined SMP _CP15_DCCMVAU(va); #else @@ -325,6 +328,19 @@ icache_inv_all(void) isb(); } +/* Invalidate branch predictor buffer */ +static __inline void +bpb_inv_all(void) +{ +#if __ARM_ARCH >= 7 && defined SMP + _CP15_BPIALLIS(); +#else + _CP15_BPIALL(); +#endif + dsb(); + isb(); +} + /* Write back D-cache to PoU */ static __inline void dcache_wb_pou(vm_offset_t sva, vm_size_t size) @@ -333,7 +349,7 @@ dcache_wb_pou(vm_offset_t sva, vm_size_t vm_offset_t eva = sva + size; dsb(); - for (va = sva; va < eva; va += arm_dcache_align) { + for (va = sva; va < eva; va += cpuinfo.dcache_line_size) { #if __ARM_ARCH >= 7 && defined SMP _CP15_DCCMVAU(va); #else @@ -351,7 +367,7 @@ dcache_inv_poc(vm_offset_t sva, vm_paddr vm_offset_t eva = sva + size; /* invalidate L1 first */ - for (va = sva; va < eva; va += arm_dcache_align) { + for (va = sva; va < eva; va += cpuinfo.dcache_line_size) { _CP15_DCIMVAC(va); } dsb(); @@ -361,7 +377,7 @@ dcache_inv_poc(vm_offset_t sva, vm_paddr dsb(); /* then L1 again */ - for (va = sva; va < eva; va += arm_dcache_align) { + for (va = sva; va < eva; va += cpuinfo.dcache_line_size) { _CP15_DCIMVAC(va); } dsb(); @@ -376,7 +392,7 @@ dcache_wb_poc(vm_offset_t sva, vm_paddr_ dsb(); - for (va = sva; va < eva; va += arm_dcache_align) { + for (va = sva; va < eva; va += cpuinfo.dcache_line_size) { _CP15_DCCMVAC(va); } dsb(); @@ -394,7 +410,7 @@ dcache_wbinv_poc(vm_offset_t sva, vm_pad dsb(); /* write back L1 first */ - for (va = sva; va < eva; va += arm_dcache_align) { + for (va = sva; va < eva; va += cpuinfo.dcache_line_size) { _CP15_DCCMVAC(va); } dsb(); @@ -403,7 +419,7 @@ dcache_wbinv_poc(vm_offset_t sva, vm_pad cpu_l2cache_wbinv_range(pa, size); /* then invalidate L1 */ - for (va = sva; va < eva; va += arm_dcache_align) { + for (va = sva; va < eva; va += cpuinfo.dcache_line_size) { _CP15_DCIMVAC(va); } dsb(); Modified: stable/10/sys/arm/include/cpuinfo.h ============================================================================== --- stable/10/sys/arm/include/cpuinfo.h Sat May 23 22:48:54 2015 (r283335) +++ stable/10/sys/arm/include/cpuinfo.h Sat May 23 23:05:31 2015 (r283336) @@ -82,6 +82,12 @@ struct cpuinfo { int generic_timer_ext; int virtualization_ext; int security_ext; + + /* L1 cache info */ + int dcache_line_size; + int dcache_line_mask; + int icache_line_size; + int icache_line_mask; }; extern struct cpuinfo cpuinfo; From owner-svn-src-stable-10@FreeBSD.ORG Sat May 23 23:08:55 2015 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A117E169; Sat, 23 May 2015 23:08: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8F82F1983; Sat, 23 May 2015 23:08:55 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4NN8tnq052587; Sat, 23 May 2015 23:08:55 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4NN8toV052585; Sat, 23 May 2015 23:08:55 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201505232308.t4NN8toV052585@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 23 May 2015 23:08:55 +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: r283338 - in stable/10/sys/arm/ti: am335x omap4 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.20 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, 23 May 2015 23:08:55 -0000 Author: ian Date: Sat May 23 23:08:54 2015 New Revision: 283338 URL: https://svnweb.freebsd.org/changeset/base/283338 Log: MFC r279816, r279826: Attach the prcm clock driver early, so it can set the mpcore timer frequency. Change the name of the dmtimer pps device from /dev/ppsN to /dev/dmtppsN. Modified: stable/10/sys/arm/ti/am335x/am335x_dmtimer.c stable/10/sys/arm/ti/omap4/omap4_prcm_clks.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/arm/ti/am335x/am335x_dmtimer.c ============================================================================== --- stable/10/sys/arm/ti/am335x/am335x_dmtimer.c Sat May 23 23:08:16 2015 (r283337) +++ stable/10/sys/arm/ti/am335x/am335x_dmtimer.c Sat May 23 23:08:54 2015 (r283338) @@ -200,7 +200,7 @@ am335x_dmtimer_et_write_4(struct am335x_ */ #ifdef PPS_SYNC -#define PPS_CDEV_NAME "pps" +#define PPS_CDEV_NAME "dmtpps" static void am335x_dmtimer_set_capture_mode(struct am335x_dmtimer_softc *sc, bool force_off) Modified: stable/10/sys/arm/ti/omap4/omap4_prcm_clks.c ============================================================================== --- stable/10/sys/arm/ti/omap4/omap4_prcm_clks.c Sat May 23 23:08:16 2015 (r283337) +++ stable/10/sys/arm/ti/omap4/omap4_prcm_clks.c Sat May 23 23:08:54 2015 (r283338) @@ -1423,5 +1423,6 @@ static driver_t omap4_prcm_driver = { static devclass_t omap4_prcm_devclass; -DRIVER_MODULE(omap4_prcm, simplebus, omap4_prcm_driver, omap4_prcm_devclass, 0, 0); +EARLY_DRIVER_MODULE(omap4_prcm, simplebus, omap4_prcm_driver, + omap4_prcm_devclass, 0, 0, BUS_PASS_TIMER + BUS_PASS_ORDER_EARLY); MODULE_VERSION(omap4_prcm, 1); From owner-svn-src-stable-10@FreeBSD.ORG Sat May 23 23:27:02 2015 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.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 61B6B518; Sat, 23 May 2015 23:27:02 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4FD941B93; Sat, 23 May 2015 23:27:02 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4NNR2mw062414; Sat, 23 May 2015 23:27:02 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4NNR1mU062403; Sat, 23 May 2015 23:27:01 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201505232327.t4NNR1mU062403@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 23 May 2015 23:27:00 +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: r283339 - in stable/10/sys: arm/arm arm/include 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.20 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, 23 May 2015 23:27:02 -0000 Author: ian Date: Sat May 23 23:27:00 2015 New Revision: 283339 URL: https://svnweb.freebsd.org/changeset/base/283339 Log: MFC r280278, r280402: Allow to override default kernel virtual address assignment on ARM. Do not save/restore the TLS pointer on context switch for armv6. Modified: stable/10/sys/arm/arm/swtch.S stable/10/sys/arm/arm/sys_machdep.c stable/10/sys/arm/arm/vm_machdep.c stable/10/sys/arm/include/vmparam.h stable/10/sys/conf/options.arm Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/arm/arm/swtch.S ============================================================================== --- stable/10/sys/arm/arm/swtch.S Sat May 23 23:08:54 2015 (r283338) +++ stable/10/sys/arm/arm/swtch.S Sat May 23 23:27:00 2015 (r283339) @@ -255,7 +255,7 @@ ENTRY(cpu_switch) mov r4, r0 /* Save the old thread. */ #ifdef ARM_TP_ADDRESS - /* Store the old tp */ + /* Store the old tp; userland can change it on armv4. */ ldr r3, =ARM_TP_ADDRESS ldr r9, [r3] str r9, [r0, #(TD_MD + MD_TP)] @@ -272,11 +272,10 @@ ENTRY(cpu_switch) ldr r9, [r1, #(TD_MD + MD_RAS_END)] str r9, [r3, #8] #else - /* Store the old tp */ - mrc p15, 0, r9, c13, c0, 3 - str r9, [r0, #(TD_MD + MD_TP)] - - /* Set the new tp */ + /* + * Set new tp. No need to store the old one first, userland can't + * change it directly on armv6. + */ ldr r9, [r1, #(TD_MD + MD_TP)] mcr p15, 0, r9, c13, c0, 3 #endif Modified: stable/10/sys/arm/arm/sys_machdep.c ============================================================================== --- stable/10/sys/arm/arm/sys_machdep.c Sat May 23 23:08:54 2015 (r283338) +++ stable/10/sys/arm/arm/sys_machdep.c Sat May 23 23:27:00 2015 (r283339) @@ -84,13 +84,11 @@ static int arm32_set_tp(struct thread *td, void *args) { - if (td != curthread) - td->td_md.md_tp = (register_t)args; - else + td->td_md.md_tp = (register_t)args; #ifndef ARM_TP_ADDRESS - set_tls(args); + set_tls(args); #else - *(register_t *)ARM_TP_ADDRESS = (register_t)args; + *(register_t *)ARM_TP_ADDRESS = (register_t)args; #endif return (0); } @@ -99,13 +97,10 @@ static int arm32_get_tp(struct thread *td, void *args) { - if (td != curthread) - td->td_retval[0] = td->td_md.md_tp; - else #ifndef ARM_TP_ADDRESS - td->td_retval[0] = (register_t)get_tls(); + td->td_retval[0] = td->td_md.md_tp; #else - td->td_retval[0] = *(register_t *)ARM_TP_ADDRESS; + td->td_retval[0] = *(register_t *)ARM_TP_ADDRESS; #endif return (0); } Modified: stable/10/sys/arm/arm/vm_machdep.c ============================================================================== --- stable/10/sys/arm/arm/vm_machdep.c Sat May 23 23:08:54 2015 (r283338) +++ stable/10/sys/arm/arm/vm_machdep.c Sat May 23 23:27:00 2015 (r283339) @@ -182,7 +182,7 @@ cpu_fork(register struct thread *td1, re #ifdef ARM_TP_ADDRESS td2->td_md.md_tp = *(register_t *)ARM_TP_ADDRESS; #else - td2->td_md.md_tp = (register_t) get_tls(); + td2->td_md.md_tp = td1->td_md.md_tp; #endif } @@ -411,7 +411,7 @@ cpu_set_user_tls(struct thread *td, void #ifdef ARM_TP_ADDRESS *(register_t *)ARM_TP_ADDRESS = (register_t)tls_base; #else - set_tls((void *)tls_base); + set_tls(tls_base); #endif critical_exit(); } Modified: stable/10/sys/arm/include/vmparam.h ============================================================================== --- stable/10/sys/arm/include/vmparam.h Sat May 23 23:08:54 2015 (r283338) +++ stable/10/sys/arm/include/vmparam.h Sat May 23 23:27:00 2015 (r283339) @@ -68,7 +68,9 @@ * The line between user space and kernel space * Mappings >= KERNEL_BASE are constant across all processes */ +#ifndef KERNBASE #define KERNBASE 0xc0000000 +#endif /* * max number of non-contig chunks of physical RAM you can have Modified: stable/10/sys/conf/options.arm ============================================================================== --- stable/10/sys/conf/options.arm Sat May 23 23:08:54 2015 (r283338) +++ stable/10/sys/conf/options.arm Sat May 23 23:27:00 2015 (r283339) @@ -28,6 +28,7 @@ IPI_IRQ_START opt_smp.h IPI_IRQ_END opt_smp.h FREEBSD_BOOT_LOADER opt_global.h IXP4XX_FLASH_SIZE opt_global.h +KERNBASE opt_global.h KERNPHYSADDR opt_global.h KERNVIRTADDR opt_global.h LINUX_BOOT_ABI opt_global.h From owner-svn-src-stable-10@FreeBSD.ORG Sat May 23 23:35:20 2015 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5731C75C; Sat, 23 May 2015 23:35:20 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 38D1E1C52; Sat, 23 May 2015 23:35:20 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4NNZK8E067291; Sat, 23 May 2015 23:35:20 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4NNZJvB067289; Sat, 23 May 2015 23:35:19 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201505232335.t4NNZJvB067289@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 23 May 2015 23:35:19 +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: r283340 - stable/10/sys/arm/mv/armadaxp 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.20 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, 23 May 2015 23:35:20 -0000 Author: ian Date: Sat May 23 23:35:19 2015 New Revision: 283340 URL: https://svnweb.freebsd.org/changeset/base/283340 Log: MFC r262409, r267129, r267130, r280709: Move the declaration for mpentry() into a header file Fix broken SMP startup on Armada XP after r265694 Avoid using hard-coded SoC's register address in mptramp code for Armada XP Use pmap_mapdev()/unmapdev() to temporarily map on-chip sram while copying the startup trampoline code. Modified: stable/10/sys/arm/mv/armadaxp/armadaxp_mp.c stable/10/sys/arm/mv/armadaxp/mptramp.S Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/arm/mv/armadaxp/armadaxp_mp.c ============================================================================== --- stable/10/sys/arm/mv/armadaxp/armadaxp_mp.c Sat May 23 23:27:00 2015 (r283339) +++ stable/10/sys/arm/mv/armadaxp/armadaxp_mp.c Sat May 23 23:35:19 2015 (r283340) @@ -37,6 +37,8 @@ #include #include +#include + #include #include #include @@ -97,14 +99,14 @@ platform_mp_init_secondary(void) } void mptramp(void); - - +void mptramp_end(void); +extern vm_offset_t mptramp_pmu_boot; void platform_mp_start_ap(void) { uint32_t reg, *src, *dst, cpu_num, div_val, cputype; - vm_offset_t smp_boot; + vm_offset_t pmu_boot_off; /* * Initialization procedure depends on core revision, * in this step CHIP ID is checked to choose proper procedure @@ -112,16 +114,18 @@ platform_mp_start_ap(void) cputype = cpufunc_id(); cputype &= CPU_ID_CPU_MASK; - smp_boot = kva_alloc(PAGE_SIZE); - pmap_kenter_nocache(smp_boot, 0xffff0000); - dst = (uint32_t *) smp_boot; - - for (src = (uint32_t *)mptramp; src < (uint32_t *)mpentry; + /* + * Set the PA of CPU0 Boot Address Redirect register used in + * mptramp according to the actual SoC registers' base address. + */ + pmu_boot_off = (CPU_PMU(0) - MV_BASE) + CPU_PMU_BOOT; + mptramp_pmu_boot = fdt_immr_pa + pmu_boot_off; + dst = pmap_mapdev(0xffff0000, PAGE_SIZE); + for (src = (uint32_t *)mptramp; src < (uint32_t *)mptramp_end; src++, dst++) { *dst = *src; } - kva_free(smp_boot, PAGE_SIZE); - + pmap_unmapdev((vm_offset_t)dst, PAGE_SIZE); if (cputype == CPU_ID_MV88SV584X_V7) { /* Core rev A0 */ div_val = read_cpu_clkdiv(CPU_DIVCLK_CTRL2_RATIO_FULL1); Modified: stable/10/sys/arm/mv/armadaxp/mptramp.S ============================================================================== --- stable/10/sys/arm/mv/armadaxp/mptramp.S Sat May 23 23:27:00 2015 (r283339) +++ stable/10/sys/arm/mv/armadaxp/mptramp.S Sat May 23 23:35:19 2015 (r283340) @@ -29,6 +29,8 @@ __FBSDID("$FreeBSD$"); +.global _C_LABEL(mptramp_pmu_boot) + ASENTRY_NP(mptramp) mov r0, #0 mcr p15, 0, r0, c7, c7, 0 @@ -44,13 +46,16 @@ ASENTRY_NP(mptramp) /* Read boot address for CPU */ mov r1, #0x100 mul r2, r0, r1 - ldr r1, Lpmureg + ldr r1, mptramp_pmu_boot add r0, r2, r1 ldr r1, [r0], #0x00 mov pc, r1 -Lpmureg: - .word 0xd0022124 +_C_LABEL(mptramp_pmu_boot): + .word 0x0 + END(mptramp) + .global _C_LABEL(mptramp_end) +_C_LABEL(mptramp_end):