From owner-svn-src-stable-7@FreeBSD.ORG Sun May 13 01:30:34 2012 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AD3C91065786; Sun, 13 May 2012 01:30:28 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 52EB18FC0C; Sun, 13 May 2012 01:30:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q4D1USov060829; Sun, 13 May 2012 01:30:28 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4D1USbY060827; Sun, 13 May 2012 01:30:28 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201205130130.q4D1USbY060827@svn.freebsd.org> From: Eitan Adler Date: Sun, 13 May 2012 01:30:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r235384 - stable/7/games/fortune/datfiles X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 May 2012 01:30:34 -0000 Author: eadler Date: Sun May 13 01:30:27 2012 New Revision: 235384 URL: http://svn.freebsd.org/changeset/base/235384 Log: MFC r235209 r235227: Add a few new tips and update some old ones to more modern commands Approved by: cperciva (implicit) Modified: stable/7/games/fortune/datfiles/freebsd-tips Directory Properties: stable/7/games/fortune/ (props changed) Modified: stable/7/games/fortune/datfiles/freebsd-tips ============================================================================== --- stable/7/games/fortune/datfiles/freebsd-tips Sun May 13 01:30:08 2012 (r235383) +++ stable/7/games/fortune/datfiles/freebsd-tips Sun May 13 01:30:27 2012 (r235384) @@ -73,8 +73,8 @@ If you need to ask a question on the Fre contains lots of useful advice to help you get the best results. % -If you `set filec' (file completion) in tcsh and write a part of the -filename, pressing TAB will show you the available choices when there +If you write part of a filename in tcsh, +pressing TAB will show you the available choices when there is more than one, or complete the filename if there's only one match. % If you `set watch = (0 any any)' in tcsh, you will be notified when @@ -122,9 +122,6 @@ In order to support national characters less without creating other nationalisation aspects, set the environment variable LC_ALL to 'en_US.ISO8859-1'. % -In tcsh, you can `set autolist' to have the shell automatically show -all the possible matches when doing filename/directory expansion. -% "man firewall" will give advice for building a FreeBSD firewall -- David Scheidt % @@ -192,13 +189,6 @@ flag is your gateway. Nice bash prompt: PS1='(\[$(tput md)\]\t <\w>\[$(tput me)\]) $(echo $?) \$ ' -- Mathieu % -Nice tcsh prompts: - set prompt = '[%B%m%b] %B%~%b%# ' - set prompt = '%m %# ' - set prompt = '%n@%m%# ' - set prompt = '%n@%m:%/%# ' - set prompt = '%n@%m:%~%# ' -% Over quota? "du -s * | sort -n " will give you a sorted list of your directory sizes. -- David Scheidt @@ -263,7 +253,7 @@ To quickly create an empty file, use "to -- Dru % To read a compressed file without having to first uncompress it, use -"zcat" or "zmore" to view it. +"zcat" or "zless" to view it. -- Dru % To repeat the last command in the C shell, type "!!". @@ -282,7 +272,7 @@ will search '/', and all subdirectories, % To see all of the directories on your FreeBSD system, type - ls -R / | more + ls -R / | less -- Dru % To see how long it takes a command to run, type the word "time" before the @@ -322,7 +312,7 @@ been replaced with other messages, look Want colour in your directory listings? Use "ls -G". "ls -F" is also useful, and they can be combined as "ls -FG". % -Want to find a specific port, just type the following under /usr/ports, +Want to find a specific port, just type the following under /usr/ports or one its subdirectories: "make search name=" @@ -479,3 +469,9 @@ when you are trying to find where in the Try "whereis firefox" and "whereis whereis". -- Konstantinos Konstantinidis % +Want to run the same command again? +In tcsh you can type "!!" +% +Want to go the directory you were just in? +Type "cd -" +% From owner-svn-src-stable-7@FreeBSD.ORG Wed May 16 00:01:40 2012 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 19C5B106566C; Wed, 16 May 2012 00:01:40 +0000 (UTC) (envelope-from jimharris@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 03F628FC08; Wed, 16 May 2012 00:01:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q4G01dYR012660; Wed, 16 May 2012 00:01:39 GMT (envelope-from jimharris@svn.freebsd.org) Received: (from jimharris@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4G01dHR012658; Wed, 16 May 2012 00:01:39 GMT (envelope-from jimharris@svn.freebsd.org) Message-Id: <201205160001.q4G01dHR012658@svn.freebsd.org> From: Jim Harris Date: Wed, 16 May 2012 00:01:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r235492 - stable/7/sys/dev/isci/scil X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 May 2012 00:01:40 -0000 Author: jimharris Date: Wed May 16 00:01:39 2012 New Revision: 235492 URL: http://svn.freebsd.org/changeset/base/235492 Log: MFC r235043: Fix off-by-one error in sati_inquiry_block_device_translate_data(). Bug would result in INQUIRY VPD 0x81 to SATA devices to return only 63 bytes of data instead of 64 during SCSI/ATA translation. Sponsored by: Intel Modified: stable/7/sys/dev/isci/scil/sati_inquiry.c Directory Properties: stable/7/sys/ (props changed) Modified: stable/7/sys/dev/isci/scil/sati_inquiry.c ============================================================================== --- stable/7/sys/dev/isci/scil/sati_inquiry.c Tue May 15 23:39:37 2012 (r235491) +++ stable/7/sys/dev/isci/scil/sati_inquiry.c Wed May 16 00:01:39 2012 (r235492) @@ -359,7 +359,7 @@ void sati_inquiry_block_device_translate ); //bytes 8-63 are reserved - for(offset = 8; offset < 63; offset++) + for(offset = 8; offset < 64; offset++) { sati_set_data_byte(sequence, scsi_io, offset, 0x00); } From owner-svn-src-stable-7@FreeBSD.ORG Wed May 16 00:36:52 2012 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8A299106564A; Wed, 16 May 2012 00:36:52 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5A5DD8FC08; Wed, 16 May 2012 00:36:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q4G0aqm9014093; Wed, 16 May 2012 00:36:52 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4G0aq0b014090; Wed, 16 May 2012 00:36:52 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201205160036.q4G0aq0b014090@svn.freebsd.org> From: Eitan Adler Date: Wed, 16 May 2012 00:36:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r235496 - in stable/7: sbin/geom/class/eli sys/geom/eli X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 May 2012 00:36:52 -0000 Author: eadler Date: Wed May 16 00:36:51 2012 New Revision: 235496 URL: http://svn.freebsd.org/changeset/base/235496 Log: MFC r235201 r235419: Add missing period at the end of the error message Approved by: cperciva (implicit) Modified: stable/7/sbin/geom/class/eli/geli.8 stable/7/sys/geom/eli/g_eli_integrity.c Directory Properties: stable/7/sbin/geom/ (props changed) stable/7/sys/ (props changed) Modified: stable/7/sbin/geom/class/eli/geli.8 ============================================================================== --- stable/7/sbin/geom/class/eli/geli.8 Wed May 16 00:29:26 2012 (r235495) +++ stable/7/sbin/geom/class/eli/geli.8 Wed May 16 00:36:51 2012 (r235496) @@ -649,6 +649,9 @@ will not protect your data against repla It is recommended to write the whole provider before the first use, in order to make sure that all sectors and their corresponding checksums are properly initialized into a consistent state. +One can safely ignore data authentication errors that occur immediately +after the first time a provider is attached and before it is +initialized in this way. .Sh SEE ALSO .Xr crypto 4 , .Xr gbde 4 , Modified: stable/7/sys/geom/eli/g_eli_integrity.c ============================================================================== --- stable/7/sys/geom/eli/g_eli_integrity.c Wed May 16 00:29:26 2012 (r235495) +++ stable/7/sys/geom/eli/g_eli_integrity.c Wed May 16 00:36:51 2012 (r235496) @@ -204,8 +204,8 @@ g_eli_auth_read_done(struct cryptop *crp * Report previous corruption if there was one. */ if (coroff != -1) { - G_ELI_DEBUG(0, "%s: %jd bytes " - "corrupted at offset %jd.", + G_ELI_DEBUG(0, "%s: Failed to authenticate %jd " + "bytes of data at offset %jd.", sc->sc_name, (intmax_t)corsize, (intmax_t)coroff); coroff = -1; @@ -220,7 +220,8 @@ g_eli_auth_read_done(struct cryptop *crp } /* Report previous corruption if there was one. */ if (coroff != -1) { - G_ELI_DEBUG(0, "%s: %jd bytes corrupted at offset %jd.", + G_ELI_DEBUG(0, "%s: Failed to authenticate %jd " + "bytes of data at offset %jd.", sc->sc_name, (intmax_t)corsize, (intmax_t)coroff); } } From owner-svn-src-stable-7@FreeBSD.ORG Fri May 18 00:03:14 2012 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id BB0C51065672; Fri, 18 May 2012 00:03:14 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A16E68FC22; Fri, 18 May 2012 00:03:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q4I03Epc023431; Fri, 18 May 2012 00:03:14 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4I03Eev023418; Fri, 18 May 2012 00:03:14 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201205180003.q4I03Eev023418@svn.freebsd.org> From: Glen Barber Date: Fri, 18 May 2012 00:03:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r235572 - in stable/7: sbin/md5 usr.bin/calendar usr.bin/fetch usr.bin/gprof usr.bin/ipcrm usr.bin/join usr.bin/limits usr.bin/ncplogin usr.bin/tftp usr.bin/who usr.bin/whois usr.sbin/p... X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 May 2012 00:03:14 -0000 Author: gjb (doc committer) Date: Fri May 18 00:03:13 2012 New Revision: 235572 URL: http://svn.freebsd.org/changeset/base/235572 Log: MFC r235211: General mdoc(7) and typo fixes. PR: 167696 Modified: stable/7/sbin/md5/md5.1 stable/7/usr.bin/calendar/calendar.1 stable/7/usr.bin/fetch/fetch.1 stable/7/usr.bin/gprof/gprof.1 stable/7/usr.bin/ipcrm/ipcrm.1 stable/7/usr.bin/join/join.1 stable/7/usr.bin/limits/limits.1 stable/7/usr.bin/ncplogin/ncplogout.1 stable/7/usr.bin/tftp/tftp.1 stable/7/usr.bin/who/who.1 stable/7/usr.bin/whois/whois.1 stable/7/usr.sbin/pkg_install/updating/pkg_updating.1 Directory Properties: stable/7/sbin/md5/ (props changed) stable/7/usr.bin/calendar/ (props changed) stable/7/usr.bin/fetch/ (props changed) stable/7/usr.bin/gprof/ (props changed) stable/7/usr.bin/ipcrm/ (props changed) stable/7/usr.bin/join/ (props changed) stable/7/usr.bin/limits/ (props changed) stable/7/usr.bin/ncplogin/ (props changed) stable/7/usr.bin/tftp/ (props changed) stable/7/usr.bin/who/ (props changed) stable/7/usr.bin/whois/ (props changed) stable/7/usr.sbin/pkg_install/ (props changed) Modified: stable/7/sbin/md5/md5.1 ============================================================================== --- stable/7/sbin/md5/md5.1 Fri May 18 00:02:11 2012 (r235571) +++ stable/7/sbin/md5/md5.1 Fri May 18 00:03:13 2012 (r235572) @@ -3,7 +3,7 @@ .Dt MD5 1 .Os .Sh NAME -.Nm md5 , sha1 , sha256, rmd160 +.Nm md5 , sha1 , sha256 , rmd160 .Nd calculate a message-digest fingerprint (checksum) for a file .Sh SYNOPSIS .Nm md5 Modified: stable/7/usr.bin/calendar/calendar.1 ============================================================================== --- stable/7/usr.bin/calendar/calendar.1 Fri May 18 00:02:11 2012 (r235571) +++ stable/7/usr.bin/calendar/calendar.1 Fri May 18 00:03:13 2012 (r235572) @@ -180,7 +180,7 @@ Paskha\fB\et\fROrthodox Easter .Sh FILES .Bl -tag -width calendar.christian -compact .It Pa calendar -file in current directory +file in current directory. .It Pa ~/.calendar .Pa calendar HOME directory. Modified: stable/7/usr.bin/fetch/fetch.1 ============================================================================== --- stable/7/usr.bin/fetch/fetch.1 Fri May 18 00:02:11 2012 (r235571) +++ stable/7/usr.bin/fetch/fetch.1 Fri May 18 00:03:13 2012 (r235572) @@ -247,7 +247,7 @@ for a description of additional environm .Ev HTTP_REFERER , .Ev HTTP_USER_AGENT , .Ev NETRC , -.Ev NO_PROXY and +.Ev NO_PROXY No and .Ev no_proxy . .Sh EXIT STATUS The Modified: stable/7/usr.bin/gprof/gprof.1 ============================================================================== --- stable/7/usr.bin/gprof/gprof.1 Fri May 18 00:02:11 2012 (r235571) +++ stable/7/usr.bin/gprof/gprof.1 Fri May 18 00:03:13 2012 (r235572) @@ -77,7 +77,7 @@ compiler or linker you can use instead of .Fl l Ns Ar c . Read the given object file (the default is -.Pa a.out) +.Pa a.out ) and establishes the relation between its symbol table and the call graph profile. The default graph profile file name is the name Modified: stable/7/usr.bin/ipcrm/ipcrm.1 ============================================================================== --- stable/7/usr.bin/ipcrm/ipcrm.1 Fri May 18 00:02:11 2012 (r235571) +++ stable/7/usr.bin/ipcrm/ipcrm.1 Fri May 18 00:03:13 2012 (r235572) @@ -112,7 +112,7 @@ If the identifier or the key is -1, it w .Xr ipcs 1 .Sh HISTORY The wiping of all System V IPC objects was first implemented in -.Fx 6.4 and 7.1. +.Fx 6.4 No and 7.1. .Sh AUTHORS The original author was Adam Glass. The wiping of all System V IPC objects was thought up by Callum Modified: stable/7/usr.bin/join/join.1 ============================================================================== --- stable/7/usr.bin/join/join.1 Fri May 18 00:02:11 2012 (r235571) +++ stable/7/usr.bin/join/join.1 Fri May 18 00:03:13 2012 (r235572) @@ -113,7 +113,7 @@ representing the join field. The elements of list must be either comma .Pq Ql \&, or whitespace separated. -(The latter requires quoting to protect it from the shell, or, a simpler +(The letter requires quoting to protect it from the shell, or, a simpler approach is to use multiple .Fl o options.) Modified: stable/7/usr.bin/limits/limits.1 ============================================================================== --- stable/7/usr.bin/limits/limits.1 Fri May 18 00:02:11 2012 (r235571) +++ stable/7/usr.bin/limits/limits.1 Fri May 18 00:03:13 2012 (r235572) @@ -176,7 +176,7 @@ limits are affected until overridden lat or .Fl H options. -.Fl e +.It Fl e Select .Dq "eval mode" formatting for output. Modified: stable/7/usr.bin/ncplogin/ncplogout.1 ============================================================================== --- stable/7/usr.bin/ncplogin/ncplogout.1 Fri May 18 00:02:11 2012 (r235571) +++ stable/7/usr.bin/ncplogin/ncplogout.1 Fri May 18 00:03:13 2012 (r235572) @@ -30,7 +30,7 @@ The options are: .Bl -tag -width indent .It Fl S Ar server Specify the name of the -.Tn Netware +.Tn NetWare server to which the connection should be terminated. Can be omitted if there is only one connection active. Modified: stable/7/usr.bin/tftp/tftp.1 ============================================================================== --- stable/7/usr.bin/tftp/tftp.1 Fri May 18 00:02:11 2012 (r235571) +++ stable/7/usr.bin/tftp/tftp.1 Fri May 18 00:03:13 2012 (r235572) @@ -112,9 +112,9 @@ commands. Enable or disable debugging levels during verbose output. The value of .Ar level can be one of -.Cm packet, simple, options, +.Cm packet , simple , options , or -.Cm access. +.Cm access . .Pp .It Cm get Oo Ar host : Oc Ns Ar file Op Ar localname .It Cm get Xo Modified: stable/7/usr.bin/who/who.1 ============================================================================== --- stable/7/usr.bin/who/who.1 Fri May 18 00:02:11 2012 (r235571) +++ stable/7/usr.bin/who/who.1 Fri May 18 00:03:13 2012 (r235572) @@ -79,7 +79,7 @@ An error occurred. Show idle time for each user in hours and minutes as .Ar hh Ns : Ns Ar mm , .Ql \&. -if the user has been idle less that a minute, and +if the user has been idle less than a minute, and .Dq Li old if the user has been idle more than 24 hours. .It Cm am I Modified: stable/7/usr.bin/whois/whois.1 ============================================================================== --- stable/7/usr.bin/whois/whois.1 Fri May 18 00:02:11 2012 (r235571) +++ stable/7/usr.bin/whois/whois.1 Fri May 18 00:03:13 2012 (r235572) @@ -207,12 +207,12 @@ This option is deprecated; use the option with an argument of .Qq Li RU instead. +.El .Pp The operands specified to .Nm are treated independently and may be used as queries on different whois servers. -.El .Sh EXIT STATUS .Ex -std .Sh EXAMPLES Modified: stable/7/usr.sbin/pkg_install/updating/pkg_updating.1 ============================================================================== --- stable/7/usr.sbin/pkg_install/updating/pkg_updating.1 Fri May 18 00:02:11 2012 (r235571) +++ stable/7/usr.sbin/pkg_install/updating/pkg_updating.1 Fri May 18 00:03:13 2012 (r235572) @@ -79,7 +79,7 @@ Location of the ports tree. .It Pa /var/db/pkg Default location of the installed package database. .It Pa /usr/ports -The default ports directory and default location of the UPDATING file +The default ports directory and default location of the UPDATING file. .El .Sh SEE ALSO .Xr pkg_add 1 , From owner-svn-src-stable-7@FreeBSD.ORG Fri May 18 01:13:19 2012 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3DD3E106566C; Fri, 18 May 2012 01:13:19 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1DCF48FC12; Fri, 18 May 2012 01:13:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q4I1DItA026914; Fri, 18 May 2012 01:13:18 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4I1DIa8026905; Fri, 18 May 2012 01:13:18 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201205180113.q4I1DIa8026905@svn.freebsd.org> From: Glen Barber Date: Fri, 18 May 2012 01:13:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r235584 - in stable/7/share/man: man4 man9 X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 May 2012 01:13:19 -0000 Author: gjb (doc committer) Date: Fri May 18 01:13:18 2012 New Revision: 235584 URL: http://svn.freebsd.org/changeset/base/235584 Log: MFC r235319: Remove duplicate words in mdoc(7) pages. PR: 167810 Modified: stable/7/share/man/man4/mk48txx.4 stable/7/share/man/man4/ng_patch.4 stable/7/share/man/man4/ste.4 stable/7/share/man/man4/vge.4 stable/7/share/man/man9/VOP_GETACL.9 stable/7/share/man/man9/VOP_GETEXTATTR.9 stable/7/share/man/man9/VOP_SETACL.9 stable/7/share/man/man9/VOP_SETEXTATTR.9 Directory Properties: stable/7/share/man/man4/ (props changed) stable/7/share/man/man9/ (props changed) Modified: stable/7/share/man/man4/mk48txx.4 ============================================================================== --- stable/7/share/man/man4/mk48txx.4 Fri May 18 01:10:34 2012 (r235583) +++ stable/7/share/man/man4/mk48txx.4 Fri May 18 01:13:18 2012 (r235584) @@ -125,7 +125,7 @@ function. The offset into the control registers of the .Tn Mostek chip, -which is set by the the +which is set by the .Fn mk48txx_attach function. .It Fa sc_year0 Modified: stable/7/share/man/man4/ng_patch.4 ============================================================================== --- stable/7/share/man/man4/ng_patch.4 Fri May 18 01:10:34 2012 (r235583) +++ stable/7/share/man/man4/ng_patch.4 Fri May 18 01:13:18 2012 (r235584) @@ -140,7 +140,7 @@ node allows to modify TTL and TOS/DSCP f Suppose you have two adjacent simplex links to remote network (e.g.\& satellite), so that the packets expiring in between will generate unwanted ICMP-replies which have to go forth, not back. -Thus you need to raise TTL of every packet entering link link by 2 +Thus you need to raise TTL of every packet entering link by 2 to ensure the TTL will not reach zero there. So you setup .Xr ipfw 8 Modified: stable/7/share/man/man4/ste.4 ============================================================================== --- stable/7/share/man/man4/ste.4 Fri May 18 01:10:34 2012 (r235583) +++ stable/7/share/man/man4/ste.4 Fri May 18 01:13:18 2012 (r235584) @@ -138,7 +138,7 @@ Maximum number of time to delay RX inter The valid range is 0 to 209712 in units of 1us, the default is 150 (150us). The value 0 effectively disables the RX interrupt moderation. -The resolution of of timer is about 3.2us so finer tuning than +The resolution of timer is about 3.2us so finer tuning than 3.2us wouldn't be available. The interface does not need to be brought down and up again before a change takes effect. Modified: stable/7/share/man/man4/vge.4 ============================================================================== --- stable/7/share/man/man4/vge.4 Fri May 18 01:10:34 2012 (r235583) +++ stable/7/share/man/man4/vge.4 Fri May 18 01:13:18 2012 (r235584) @@ -177,7 +177,7 @@ tunables: Maximum number of time to delay interrupts. The valid range is 0 to 5100 in units of 1us, the default is 150 (150us). -The resolution of of timer is about 20us so finer tuning than +The resolution of timer is about 20us so finer tuning than 20us wouldn't be available. The interface should be brought down and up again before a change takes effect. Modified: stable/7/share/man/man9/VOP_GETACL.9 ============================================================================== --- stable/7/share/man/man9/VOP_GETACL.9 Fri May 18 01:10:34 2012 (r235583) +++ stable/7/share/man/man9/VOP_GETACL.9 Fri May 18 01:13:18 2012 (r235584) @@ -79,7 +79,7 @@ Otherwise, an appropriate error code is .It Bq Er EINVAL The ACL type passed is invalid for this vnode. .It Bq Er EACCES -The the caller does not have the appropriate privilege. +The caller does not have the appropriate privilege. .It Bq Er ENOMEM Sufficient memory is not available to fulfill the request. .It Bq Er EOPNOTSUPP Modified: stable/7/share/man/man9/VOP_GETEXTATTR.9 ============================================================================== --- stable/7/share/man/man9/VOP_GETEXTATTR.9 Fri May 18 01:10:34 2012 (r235583) +++ stable/7/share/man/man9/VOP_GETEXTATTR.9 Fri May 18 01:13:18 2012 (r235584) @@ -102,7 +102,7 @@ Otherwise, an appropriate error code is .It Bq Er ENOATTR The requested attribute was not defined for this vnode. .It Bq Er EACCES -The the caller does not have the appropriate privilege. +The caller does not have the appropriate privilege. .It Bq Er ENXIO The request was not valid in this file system for the specified vnode and attribute name. Modified: stable/7/share/man/man9/VOP_SETACL.9 ============================================================================== --- stable/7/share/man/man9/VOP_SETACL.9 Fri May 18 01:10:34 2012 (r235583) +++ stable/7/share/man/man9/VOP_SETACL.9 Fri May 18 01:13:18 2012 (r235584) @@ -84,7 +84,7 @@ Otherwise, an appropriate error code is .It Bq Er EINVAL The ACL type passed is invalid for this vnode, or the ACL data is invalid. .It Bq Er EACCES -The the caller does not have the appropriate privilege. +The caller does not have the appropriate privilege. .It Bq Er ENOMEM Sufficient memory is not available to fulfill the request. .It Bq Er EOPNOTSUPP Modified: stable/7/share/man/man9/VOP_SETEXTATTR.9 ============================================================================== --- stable/7/share/man/man9/VOP_SETEXTATTR.9 Fri May 18 01:10:34 2012 (r235583) +++ stable/7/share/man/man9/VOP_SETEXTATTR.9 Fri May 18 01:13:18 2012 (r235584) @@ -91,7 +91,7 @@ Otherwise, an appropriate error code is .Sh ERRORS .Bl -tag -width Er .It Bq Er EACCES -The the caller does not have the appropriate privilege. +The caller does not have the appropriate privilege. .It Bq Er ENXIO The request was not valid in this file system for the specified vnode and attribute name. From owner-svn-src-stable-7@FreeBSD.ORG Fri May 18 21:40:18 2012 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C5DEC106564A; Fri, 18 May 2012 21:40:18 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6505B8FC19; Fri, 18 May 2012 21:40:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q4ILeIES081988; Fri, 18 May 2012 21:40:18 GMT (envelope-from sbruno@svn.freebsd.org) Received: (from sbruno@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4ILeHRH081966; Fri, 18 May 2012 21:40:17 GMT (envelope-from sbruno@svn.freebsd.org) Message-Id: <201205182140.q4ILeHRH081966@svn.freebsd.org> From: Sean Bruno Date: Fri, 18 May 2012 21:40:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r235631 - in stable/7/sys/dev: advansys amr an arcmsr asr buslogic ciss cxgb dpt hifn hptiop hptmv ida if_ndis iir ips mfi mlx mly twe X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 May 2012 21:40:18 -0000 Author: sbruno Date: Fri May 18 21:40:17 2012 New Revision: 235631 URL: http://svn.freebsd.org/changeset/base/235631 Log: MFC 232854,232874,232882,232883,232886 for bus_get_dma_tag() Modified: stable/7/sys/dev/advansys/adv_pci.c stable/7/sys/dev/advansys/adw_pci.c stable/7/sys/dev/amr/amr_pci.c stable/7/sys/dev/an/if_an_pci.c stable/7/sys/dev/arcmsr/arcmsr.c stable/7/sys/dev/asr/asr.c stable/7/sys/dev/buslogic/bt_pci.c stable/7/sys/dev/ciss/ciss.c stable/7/sys/dev/cxgb/cxgb_sge.c stable/7/sys/dev/dpt/dpt_pci.c stable/7/sys/dev/hifn/hifn7751.c stable/7/sys/dev/hptiop/hptiop.c stable/7/sys/dev/hptmv/entry.c stable/7/sys/dev/ida/ida_pci.c stable/7/sys/dev/if_ndis/if_ndis_pci.c stable/7/sys/dev/iir/iir_pci.c stable/7/sys/dev/ips/ips_pci.c stable/7/sys/dev/mfi/mfi_pci.c stable/7/sys/dev/mlx/mlx_pci.c stable/7/sys/dev/mly/mly.c stable/7/sys/dev/twe/twe_freebsd.c Directory Properties: stable/7/sys/ (props changed) Modified: stable/7/sys/dev/advansys/adv_pci.c ============================================================================== --- stable/7/sys/dev/advansys/adv_pci.c Fri May 18 20:43:48 2012 (r235630) +++ stable/7/sys/dev/advansys/adv_pci.c Fri May 18 21:40:17 2012 (r235631) @@ -189,7 +189,7 @@ adv_pci_attach(device_t dev) /* Allocate a dmatag for our transfer DMA maps */ /* XXX Should be a child of the PCI bus dma tag */ error = bus_dma_tag_create( - /* parent */ NULL, + /* parent */ bus_get_dma_tag(dev), /* alignment */ 1, /* boundary */ 0, /* lowaddr */ ADV_PCI_MAX_DMA_ADDR, Modified: stable/7/sys/dev/advansys/adw_pci.c ============================================================================== --- stable/7/sys/dev/advansys/adw_pci.c Fri May 18 20:43:48 2012 (r235630) +++ stable/7/sys/dev/advansys/adw_pci.c Fri May 18 21:40:17 2012 (r235631) @@ -260,7 +260,7 @@ adw_pci_attach(device_t dev) /* Allocate a dmatag for our transfer DMA maps */ /* XXX Should be a child of the PCI bus dma tag */ error = bus_dma_tag_create( - /* parent */ NULL, + /* parent */ bus_get_dma_tag(dev), /* alignment */ 1, /* boundary */ 0, /* lowaddr */ ADW_PCI_MAX_DMA_ADDR, Modified: stable/7/sys/dev/amr/amr_pci.c ============================================================================== --- stable/7/sys/dev/amr/amr_pci.c Fri May 18 20:43:48 2012 (r235630) +++ stable/7/sys/dev/amr/amr_pci.c Fri May 18 21:40:17 2012 (r235631) @@ -277,7 +277,7 @@ amr_pci_attach(device_t dev) /* * Allocate the parent bus DMA tag appropriate for PCI. */ - if (bus_dma_tag_create(NULL, /* parent */ + if (bus_dma_tag_create(bus_get_dma_tag(dev), /* PCI parent */ 1, 0, /* alignment,boundary */ AMR_IS_SG64(sc) ? BUS_SPACE_MAXADDR : Modified: stable/7/sys/dev/an/if_an_pci.c ============================================================================== --- stable/7/sys/dev/an/if_an_pci.c Fri May 18 20:43:48 2012 (r235630) +++ stable/7/sys/dev/an/if_an_pci.c Fri May 18 21:40:17 2012 (r235631) @@ -206,7 +206,7 @@ an_attach_pci(dev) sc->an_mem_aux_bhandle = rman_get_bushandle(sc->mem_aux_res); /* Allocate DMA region */ - error = bus_dma_tag_create(NULL, /* parent */ + error = bus_dma_tag_create(bus_get_dma_tag(dev),/* parent */ 1, 0, /* alignment, bounds */ BUS_SPACE_MAXADDR_32BIT, /* lowaddr */ BUS_SPACE_MAXADDR, /* highaddr */ Modified: stable/7/sys/dev/arcmsr/arcmsr.c ============================================================================== --- stable/7/sys/dev/arcmsr/arcmsr.c Fri May 18 20:43:48 2012 (r235630) +++ stable/7/sys/dev/arcmsr/arcmsr.c Fri May 18 21:40:17 2012 (r235631) @@ -3396,7 +3396,7 @@ static u_int32_t arcmsr_initialize(devic return ENOMEM; } } - if(bus_dma_tag_create( /*parent*/ NULL, + if(bus_dma_tag_create( /*PCI parent*/ bus_get_dma_tag(dev), /*alignemnt*/ 1, /*boundary*/ 0, /*lowaddr*/ BUS_SPACE_MAXADDR, Modified: stable/7/sys/dev/asr/asr.c ============================================================================== --- stable/7/sys/dev/asr/asr.c Fri May 18 20:43:48 2012 (r235630) +++ stable/7/sys/dev/asr/asr.c Fri May 18 21:40:17 2012 (r235631) @@ -2331,7 +2331,7 @@ asr_alloc_dma(Asr_softc_t *sc) dev = sc->ha_dev; - if (bus_dma_tag_create(NULL, /* parent */ + if (bus_dma_tag_create(bus_get_dma_tag(dev), /* PCI parent */ 1, 0, /* algnmnt, boundary */ BUS_SPACE_MAXADDR_32BIT, /* lowaddr */ BUS_SPACE_MAXADDR, /* highaddr */ Modified: stable/7/sys/dev/buslogic/bt_pci.c ============================================================================== --- stable/7/sys/dev/buslogic/bt_pci.c Fri May 18 20:43:48 2012 (r235630) +++ stable/7/sys/dev/buslogic/bt_pci.c Fri May 18 21:40:17 2012 (r235631) @@ -173,7 +173,7 @@ bt_pci_attach(device_t dev) /* Allocate a dmatag for our CCB DMA maps */ /* XXX Should be a child of the PCI bus dma tag */ - if (bus_dma_tag_create( /* parent */ NULL, + if (bus_dma_tag_create( /* PCI parent */ bus_get_dma_tag(dev), /* alignemnt */ 1, /* boundary */ 0, /* lowaddr */ BUS_SPACE_MAXADDR_32BIT, Modified: stable/7/sys/dev/ciss/ciss.c ============================================================================== --- stable/7/sys/dev/ciss/ciss.c Fri May 18 20:43:48 2012 (r235630) +++ stable/7/sys/dev/ciss/ciss.c Fri May 18 21:40:17 2012 (r235631) @@ -698,7 +698,7 @@ ciss_init_pci(struct ciss_softc *sc) * Note that "simple" adapters can only address within a 32-bit * span. */ - if (bus_dma_tag_create(NULL, /* parent */ + if (bus_dma_tag_create(bus_get_dma_tag(sc->ciss_dev),/* PCI parent */ 1, 0, /* alignment, boundary */ BUS_SPACE_MAXADDR, /* lowaddr */ BUS_SPACE_MAXADDR, /* highaddr */ Modified: stable/7/sys/dev/cxgb/cxgb_sge.c ============================================================================== --- stable/7/sys/dev/cxgb/cxgb_sge.c Fri May 18 20:43:48 2012 (r235630) +++ stable/7/sys/dev/cxgb/cxgb_sge.c Fri May 18 21:40:17 2012 (r235631) @@ -426,7 +426,7 @@ t3_sge_alloc(adapter_t *sc) { /* The parent tag. */ - if (bus_dma_tag_create( NULL, /* parent */ + if (bus_dma_tag_create( bus_get_dma_tag(sc->dev),/* PCI parent */ 1, 0, /* algnmnt, boundary */ BUS_SPACE_MAXADDR, /* lowaddr */ BUS_SPACE_MAXADDR, /* highaddr */ Modified: stable/7/sys/dev/dpt/dpt_pci.c ============================================================================== --- stable/7/sys/dev/dpt/dpt_pci.c Fri May 18 20:43:48 2012 (r235630) +++ stable/7/sys/dev/dpt/dpt_pci.c Fri May 18 21:40:17 2012 (r235631) @@ -133,7 +133,7 @@ dpt_pci_attach (device_t dev) /* Allocate a dmatag representing the capabilities of this attachment */ /* XXX Should be a child of the PCI bus dma tag */ - if (bus_dma_tag_create( /* parent */ NULL, + if (bus_dma_tag_create( /* PCI parent */ bus_get_dma_tag(dev), /* alignemnt */ 1, /* boundary */ 0, /* lowaddr */ BUS_SPACE_MAXADDR_32BIT, Modified: stable/7/sys/dev/hifn/hifn7751.c ============================================================================== --- stable/7/sys/dev/hifn/hifn7751.c Fri May 18 20:43:48 2012 (r235630) +++ stable/7/sys/dev/hifn/hifn7751.c Fri May 18 21:40:17 2012 (r235631) @@ -454,7 +454,7 @@ hifn_attach(device_t dev) * Setup the area where the Hifn DMA's descriptors * and associated data structures. */ - if (bus_dma_tag_create(NULL, /* parent */ + if (bus_dma_tag_create(bus_get_dma_tag(dev), /* PCI parent */ 1, 0, /* alignment,boundary */ BUS_SPACE_MAXADDR_32BIT, /* lowaddr */ BUS_SPACE_MAXADDR, /* highaddr */ Modified: stable/7/sys/dev/hptiop/hptiop.c ============================================================================== --- stable/7/sys/dev/hptiop/hptiop.c Fri May 18 20:43:48 2012 (r235630) +++ stable/7/sys/dev/hptiop/hptiop.c Fri May 18 21:40:17 2012 (r235631) @@ -1367,7 +1367,7 @@ static int hptiop_attach(device_t dev) mtx_init(&hba->lock, "hptioplock", NULL, MTX_DEF); #endif - if (bus_dma_tag_create(NULL,/* parent */ + if (bus_dma_tag_create(bus_get_dma_tag(dev),/* PCI parent */ 1, /* alignment */ 0, /* boundary */ BUS_SPACE_MAXADDR, /* lowaddr */ Modified: stable/7/sys/dev/hptmv/entry.c ============================================================================== --- stable/7/sys/dev/hptmv/entry.c Fri May 18 20:43:48 2012 (r235630) +++ stable/7/sys/dev/hptmv/entry.c Fri May 18 21:40:17 2012 (r235631) @@ -1325,7 +1325,7 @@ init_adapter(IAL_ADAPTER_T *pAdapter) _vbus_p->OsExt = (void *)pAdapter; pMvSataAdapter->IALData = pAdapter; - if (bus_dma_tag_create(NULL,/* parent */ + if (bus_dma_tag_create(bus_get_dma_tag(pAdapter->hpt_dev),/* parent */ 4, /* alignment */ BUS_SPACE_MAXADDR_32BIT+1, /* boundary */ BUS_SPACE_MAXADDR, /* lowaddr */ Modified: stable/7/sys/dev/ida/ida_pci.c ============================================================================== --- stable/7/sys/dev/ida/ida_pci.c Fri May 18 20:43:48 2012 (r235630) +++ stable/7/sys/dev/ida/ida_pci.c Fri May 18 21:40:17 2012 (r235631) @@ -269,7 +269,7 @@ ida_pci_attach(device_t dev) } error = bus_dma_tag_create( - /* parent */ NULL, + /* parent */ bus_get_dma_tag(dev), /* alignment */ 1, /* boundary */ 0, /* lowaddr */ BUS_SPACE_MAXADDR_32BIT, Modified: stable/7/sys/dev/if_ndis/if_ndis_pci.c ============================================================================== --- stable/7/sys/dev/if_ndis/if_ndis_pci.c Fri May 18 20:43:48 2012 (r235630) +++ stable/7/sys/dev/if_ndis/if_ndis_pci.c Fri May 18 21:40:17 2012 (r235631) @@ -287,7 +287,7 @@ ndis_attach_pci(dev) * Allocate the parent bus DMA tag appropriate for PCI. */ #define NDIS_NSEG_NEW 32 - error = bus_dma_tag_create(NULL, /* parent */ + error = bus_dma_tag_create(bus_get_dma_tag(dev),/* PCI parent */ 1, 0, /* alignment, boundary */ BUS_SPACE_MAXADDR_32BIT,/* lowaddr */ BUS_SPACE_MAXADDR, /* highaddr */ Modified: stable/7/sys/dev/iir/iir_pci.c ============================================================================== --- stable/7/sys/dev/iir/iir_pci.c Fri May 18 20:43:48 2012 (r235630) +++ stable/7/sys/dev/iir/iir_pci.c Fri May 18 21:40:17 2012 (r235631) @@ -319,7 +319,8 @@ iir_pci_attach(device_t dev) /* Allocate a dmatag representing the capabilities of this attachment */ /* XXX Should be a child of the PCI bus dma tag */ - if (bus_dma_tag_create(/*parent*/NULL, /*alignemnt*/1, /*boundary*/0, + if (bus_dma_tag_create(/*parent*/bus_get_dma_tag(dev), + /*alignemnt*/1, /*boundary*/0, /*lowaddr*/BUS_SPACE_MAXADDR_32BIT, /*highaddr*/BUS_SPACE_MAXADDR, /*filter*/NULL, /*filterarg*/NULL, Modified: stable/7/sys/dev/ips/ips_pci.c ============================================================================== --- stable/7/sys/dev/ips/ips_pci.c Fri May 18 20:43:48 2012 (r235630) +++ stable/7/sys/dev/ips/ips_pci.c Fri May 18 21:40:17 2012 (r235631) @@ -135,7 +135,7 @@ static int ips_pci_attach(device_t dev) device_printf(dev, "irq setup failed\n"); goto error; } - if (bus_dma_tag_create( /* parent */ NULL, + if (bus_dma_tag_create( /* PCI parent */bus_get_dma_tag(dev), /* alignemnt */ 1, /* boundary */ 0, /* lowaddr */ BUS_SPACE_MAXADDR_32BIT, Modified: stable/7/sys/dev/mfi/mfi_pci.c ============================================================================== --- stable/7/sys/dev/mfi/mfi_pci.c Fri May 18 20:43:48 2012 (r235630) +++ stable/7/sys/dev/mfi/mfi_pci.c Fri May 18 21:40:17 2012 (r235631) @@ -211,7 +211,7 @@ mfi_pci_attach(device_t dev) error = ENOMEM; /* Allocate parent DMA tag */ - if (bus_dma_tag_create( NULL, /* parent */ + if (bus_dma_tag_create( bus_get_dma_tag(dev), /* PCI parent */ 1, 0, /* algnmnt, boundary */ BUS_SPACE_MAXADDR, /* lowaddr */ BUS_SPACE_MAXADDR, /* highaddr */ Modified: stable/7/sys/dev/mlx/mlx_pci.c ============================================================================== --- stable/7/sys/dev/mlx/mlx_pci.c Fri May 18 20:43:48 2012 (r235630) +++ stable/7/sys/dev/mlx/mlx_pci.c Fri May 18 21:40:17 2012 (r235631) @@ -191,7 +191,7 @@ mlx_pci_attach(device_t dev) /* * Allocate the parent bus DMA tag appropriate for PCI. */ - error = bus_dma_tag_create(NULL, /* parent */ + error = bus_dma_tag_create(bus_get_dma_tag(dev), /* PCI parent */ 1, 0, /* alignment, boundary */ BUS_SPACE_MAXADDR_32BIT, /* lowaddr */ BUS_SPACE_MAXADDR, /* highaddr */ Modified: stable/7/sys/dev/mly/mly.c ============================================================================== --- stable/7/sys/dev/mly/mly.c Fri May 18 20:43:48 2012 (r235630) +++ stable/7/sys/dev/mly/mly.c Fri May 18 21:40:17 2012 (r235631) @@ -393,7 +393,7 @@ mly_pci_attach(struct mly_softc *sc) * * Note that all of these controllers are 64-bit capable. */ - if (bus_dma_tag_create(NULL, /* parent */ + if (bus_dma_tag_create(bus_get_dma_tag(sc->mly_dev),/* PCI parent */ 1, 0, /* alignment, boundary */ BUS_SPACE_MAXADDR_32BIT, /* lowaddr */ BUS_SPACE_MAXADDR, /* highaddr */ Modified: stable/7/sys/dev/twe/twe_freebsd.c ============================================================================== --- stable/7/sys/dev/twe/twe_freebsd.c Fri May 18 20:43:48 2012 (r235630) +++ stable/7/sys/dev/twe/twe_freebsd.c Fri May 18 21:40:17 2012 (r235631) @@ -228,7 +228,7 @@ twe_attach(device_t dev) /* * Allocate the parent bus DMA tag appropriate for PCI. */ - if (bus_dma_tag_create(NULL, /* parent */ + if (bus_dma_tag_create(bus_get_dma_tag(dev), /* PCI parent */ 1, 0, /* alignment, boundary */ BUS_SPACE_MAXADDR_32BIT, /* lowaddr */ BUS_SPACE_MAXADDR, /* highaddr */ From owner-svn-src-stable-7@FreeBSD.ORG Fri May 18 23:29:30 2012 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id BA8BB106566C; Fri, 18 May 2012 23:29:30 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A35288FC0A; Fri, 18 May 2012 23:29:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q4INTUIA086655; Fri, 18 May 2012 23:29:30 GMT (envelope-from sbruno@svn.freebsd.org) Received: (from sbruno@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4INTU4X086651; Fri, 18 May 2012 23:29:30 GMT (envelope-from sbruno@svn.freebsd.org) Message-Id: <201205182329.q4INTU4X086651@svn.freebsd.org> From: Sean Bruno Date: Fri, 18 May 2012 23:29:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r235636 - in stable/7/sys: conf dev/mfi modules/mfi X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 May 2012 23:29:30 -0000 Author: sbruno Date: Fri May 18 23:29:30 2012 New Revision: 235636 URL: http://svn.freebsd.org/changeset/base/235636 Log: MFC of head thunderbolt support for mfi(4) r233711 -- IFV head_mfi into head for initial thunderbolt support r233768 -- atomic_t --> mfi_atomic r233805 -- fix tinderbuild, move megasas_sge to mfivar.h r233877 -- remove atomic.h from includes r235014 -- fix reading of sector >= 2^32 or 2^21, repair RAID handling r235016 -- style(9) r235040 -- fix returns from mfi_tbolt_sync_map_info() r235318 -- repair panic on PAE i386 r235321 -- repair the repair of panics on PAE i386 Added: stable/7/sys/dev/mfi/mfi_syspd.c - copied unchanged from r233711, head/sys/dev/mfi/mfi_syspd.c stable/7/sys/dev/mfi/mfi_tbolt.c - copied, changed from r233711, head/sys/dev/mfi/mfi_tbolt.c Modified: stable/7/sys/conf/files stable/7/sys/dev/mfi/mfi.c stable/7/sys/dev/mfi/mfi_cam.c stable/7/sys/dev/mfi/mfi_debug.c stable/7/sys/dev/mfi/mfi_disk.c stable/7/sys/dev/mfi/mfi_ioctl.h stable/7/sys/dev/mfi/mfi_linux.c stable/7/sys/dev/mfi/mfi_pci.c stable/7/sys/dev/mfi/mfireg.h stable/7/sys/dev/mfi/mfivar.h stable/7/sys/modules/mfi/Makefile Directory Properties: stable/7/sys/ (props changed) Modified: stable/7/sys/conf/files ============================================================================== --- stable/7/sys/conf/files Fri May 18 21:50:26 2012 (r235635) +++ stable/7/sys/conf/files Fri May 18 23:29:30 2012 (r235636) @@ -948,6 +948,8 @@ dev/mfi/mfi.c optional mfi dev/mfi/mfi_debug.c optional mfi dev/mfi/mfi_pci.c optional mfi pci dev/mfi/mfi_disk.c optional mfi +dev/mfi/mfi_syspd.c optional mfi +dev/mfi/mfi_tbolt.c optional mfi dev/mfi/mfi_linux.c optional mfi compat_linux dev/mfi/mfi_cam.c optional mfip scbus dev/mii/acphy.c optional miibus | acphy Modified: stable/7/sys/dev/mfi/mfi.c ============================================================================== --- stable/7/sys/dev/mfi/mfi.c Fri May 18 21:50:26 2012 (r235635) +++ stable/7/sys/dev/mfi/mfi.c Fri May 18 23:29:30 2012 (r235636) @@ -53,6 +53,7 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_compat.h" #include "opt_mfi.h" #include @@ -72,6 +73,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -79,43 +81,52 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include static int mfi_alloc_commands(struct mfi_softc *); static int mfi_comms_init(struct mfi_softc *); -static int mfi_wait_command(struct mfi_softc *, struct mfi_command *); static int mfi_get_controller_info(struct mfi_softc *); static int mfi_get_log_state(struct mfi_softc *, struct mfi_evt_log_state **); static int mfi_parse_entries(struct mfi_softc *, int, int); -static int mfi_dcmd_command(struct mfi_softc *, struct mfi_command **, - uint32_t, void **, size_t); static void mfi_data_cb(void *, bus_dma_segment_t *, int, int); static void mfi_startup(void *arg); static void mfi_intr(void *arg); static void mfi_ldprobe(struct mfi_softc *sc); +static void mfi_syspdprobe(struct mfi_softc *sc); +static void mfi_handle_evt(void *context, int pending); static int mfi_aen_register(struct mfi_softc *sc, int seq, int locale); static void mfi_aen_complete(struct mfi_command *); -static int mfi_aen_setup(struct mfi_softc *, uint32_t); static int mfi_add_ld(struct mfi_softc *sc, int); static void mfi_add_ld_complete(struct mfi_command *); +static int mfi_add_sys_pd(struct mfi_softc *sc, int); +static void mfi_add_sys_pd_complete(struct mfi_command *); static struct mfi_command * mfi_bio_command(struct mfi_softc *); static void mfi_bio_complete(struct mfi_command *); -static int mfi_mapcmd(struct mfi_softc *, struct mfi_command *); +static struct mfi_command *mfi_build_ldio(struct mfi_softc *,struct bio*); +static struct mfi_command *mfi_build_syspdio(struct mfi_softc *,struct bio*); static int mfi_send_frame(struct mfi_softc *, struct mfi_command *); -static void mfi_complete(struct mfi_softc *, struct mfi_command *); static int mfi_abort(struct mfi_softc *, struct mfi_command *); -static int mfi_linux_ioctl_int(struct cdev *, u_long, caddr_t, int, d_thread_t *); +static int mfi_linux_ioctl_int(struct cdev *, u_long, caddr_t, int, struct thread *); static void mfi_timeout(void *); static int mfi_user_command(struct mfi_softc *, struct mfi_ioc_passthru *); -static void mfi_enable_intr_xscale(struct mfi_softc *sc); -static void mfi_enable_intr_ppc(struct mfi_softc *sc); -static int32_t mfi_read_fw_status_xscale(struct mfi_softc *sc); -static int32_t mfi_read_fw_status_ppc(struct mfi_softc *sc); -static int mfi_check_clear_intr_xscale(struct mfi_softc *sc); -static int mfi_check_clear_intr_ppc(struct mfi_softc *sc); -static void mfi_issue_cmd_xscale(struct mfi_softc *sc,uint32_t bus_add,uint32_t frame_cnt); -static void mfi_issue_cmd_ppc(struct mfi_softc *sc,uint32_t bus_add,uint32_t frame_cnt); +static void mfi_enable_intr_xscale(struct mfi_softc *sc); +static void mfi_enable_intr_ppc(struct mfi_softc *sc); +static int32_t mfi_read_fw_status_xscale(struct mfi_softc *sc); +static int32_t mfi_read_fw_status_ppc(struct mfi_softc *sc); +static int mfi_check_clear_intr_xscale(struct mfi_softc *sc); +static int mfi_check_clear_intr_ppc(struct mfi_softc *sc); +static void mfi_issue_cmd_xscale(struct mfi_softc *sc, bus_addr_t bus_add, + uint32_t frame_cnt); +static void mfi_issue_cmd_ppc(struct mfi_softc *sc, bus_addr_t bus_add, + uint32_t frame_cnt); +static int mfi_config_lock(struct mfi_softc *sc, uint32_t opcode); +static void mfi_config_unlock(struct mfi_softc *sc, int locked); +static int mfi_check_command_pre(struct mfi_softc *sc, struct mfi_command *cm); +static void mfi_check_command_post(struct mfi_softc *sc, struct mfi_command *cm); +static int mfi_check_for_sscd(struct mfi_softc *sc, struct mfi_command *cm); SYSCTL_NODE(_hw, OID_AUTO, mfi, CTLFLAG_RD, 0, "MFI driver parameters"); static int mfi_event_locale = MFI_EVT_LOCALE_ALL; @@ -133,6 +144,11 @@ TUNABLE_INT("hw.mfi.max_cmds", &mfi_max_ SYSCTL_INT(_hw_mfi, OID_AUTO, max_cmds, CTLFLAG_RD, &mfi_max_cmds, 0, "Max commands"); +static int mfi_detect_jbod_change = 1; +TUNABLE_INT("hw.mfi.detect_jbod_change", &mfi_detect_jbod_change); +SYSCTL_INT(_hw_mfi, OID_AUTO, detect_jbod_change, CTLFLAG_RW, + &mfi_detect_jbod_change, 0, "Detect a change to a JBOD"); + /* Management interface */ static d_open_t mfi_open; static d_close_t mfi_close; @@ -152,6 +168,7 @@ static struct cdevsw mfi_cdevsw = { MALLOC_DEFINE(M_MFIBUF, "mfibuf", "Buffers for the MFI driver"); #define MFI_INQ_LENGTH SHORT_INQUIRY_LENGTH +struct mfi_skinny_dma_info mfi_skinny; static void mfi_enable_intr_xscale(struct mfi_softc *sc) @@ -162,12 +179,17 @@ mfi_enable_intr_xscale(struct mfi_softc static void mfi_enable_intr_ppc(struct mfi_softc *sc) { - MFI_WRITE4(sc, MFI_ODCR0, 0xFFFFFFFF); if (sc->mfi_flags & MFI_FLAGS_1078) { + MFI_WRITE4(sc, MFI_ODCR0, 0xFFFFFFFF); MFI_WRITE4(sc, MFI_OMSK, ~MFI_1078_EIM); - } else if (sc->mfi_flags & MFI_FLAGS_GEN2) { + } + else if (sc->mfi_flags & MFI_FLAGS_GEN2) { + MFI_WRITE4(sc, MFI_ODCR0, 0xFFFFFFFF); MFI_WRITE4(sc, MFI_OMSK, ~MFI_GEN2_EIM); } + else if (sc->mfi_flags & MFI_FLAGS_SKINNY) { + MFI_WRITE4(sc, MFI_OMSK, ~0x00000001); + } } static int32_t @@ -205,35 +227,51 @@ mfi_check_clear_intr_ppc(struct mfi_soft if (!(status & MFI_1078_RM)) { return 1; } - } else if (sc->mfi_flags & MFI_FLAGS_GEN2) { + } + else if (sc->mfi_flags & MFI_FLAGS_GEN2) { if (!(status & MFI_GEN2_RM)) { return 1; } } - - MFI_WRITE4(sc, MFI_ODCR0, status); + else if (sc->mfi_flags & MFI_FLAGS_SKINNY) { + if (!(status & MFI_SKINNY_RM)) { + return 1; + } + } + if (sc->mfi_flags & MFI_FLAGS_SKINNY) + MFI_WRITE4(sc, MFI_OSTS, status); + else + MFI_WRITE4(sc, MFI_ODCR0, status); return 0; } static void -mfi_issue_cmd_xscale(struct mfi_softc *sc,uint32_t bus_add,uint32_t frame_cnt) +mfi_issue_cmd_xscale(struct mfi_softc *sc, bus_addr_t bus_add, uint32_t frame_cnt) { MFI_WRITE4(sc, MFI_IQP,(bus_add >>3)|frame_cnt); } static void -mfi_issue_cmd_ppc(struct mfi_softc *sc,uint32_t bus_add,uint32_t frame_cnt) +mfi_issue_cmd_ppc(struct mfi_softc *sc, bus_addr_t bus_add, uint32_t frame_cnt) { - MFI_WRITE4(sc, MFI_IQP, (bus_add |frame_cnt <<1)|1 ); + if (sc->mfi_flags & MFI_FLAGS_SKINNY) { + MFI_WRITE4(sc, MFI_IQPL, (bus_add | frame_cnt <<1)|1 ); + MFI_WRITE4(sc, MFI_IQPH, 0x00000000); + } else { + MFI_WRITE4(sc, MFI_IQP, (bus_add | frame_cnt <<1)|1 ); + } } -static int +int mfi_transition_firmware(struct mfi_softc *sc) { - int32_t fw_state, cur_state; + uint32_t fw_state, cur_state; int max_wait, i; + uint32_t cur_abs_reg_val = 0; + uint32_t prev_abs_reg_val = 0; - fw_state = sc->mfi_read_fw_status(sc)& MFI_FWSTATE_MASK; + cur_abs_reg_val = sc->mfi_read_fw_status(sc); + fw_state = cur_abs_reg_val & MFI_FWSTATE_MASK; while (fw_state != MFI_FWSTATE_READY) { if (bootverbose) device_printf(sc->mfi_dev, "Waiting for firmware to " @@ -244,36 +282,62 @@ mfi_transition_firmware(struct mfi_softc device_printf(sc->mfi_dev, "Firmware fault\n"); return (ENXIO); case MFI_FWSTATE_WAIT_HANDSHAKE: - MFI_WRITE4(sc, MFI_IDB, MFI_FWINIT_CLEAR_HANDSHAKE); - max_wait = 2; + if (sc->mfi_flags & MFI_FLAGS_SKINNY || sc->mfi_flags & MFI_FLAGS_TBOLT) + MFI_WRITE4(sc, MFI_SKINNY_IDB, MFI_FWINIT_CLEAR_HANDSHAKE); + else + MFI_WRITE4(sc, MFI_IDB, MFI_FWINIT_CLEAR_HANDSHAKE); + max_wait = MFI_RESET_WAIT_TIME; break; case MFI_FWSTATE_OPERATIONAL: - MFI_WRITE4(sc, MFI_IDB, MFI_FWINIT_READY); - max_wait = 10; + if (sc->mfi_flags & MFI_FLAGS_SKINNY || sc->mfi_flags & MFI_FLAGS_TBOLT) + MFI_WRITE4(sc, MFI_SKINNY_IDB, 7); + else + MFI_WRITE4(sc, MFI_IDB, MFI_FWINIT_READY); + max_wait = MFI_RESET_WAIT_TIME; break; case MFI_FWSTATE_UNDEFINED: case MFI_FWSTATE_BB_INIT: - max_wait = 2; + max_wait = MFI_RESET_WAIT_TIME; + break; + case MFI_FWSTATE_FW_INIT_2: + max_wait = MFI_RESET_WAIT_TIME; break; case MFI_FWSTATE_FW_INIT: - case MFI_FWSTATE_DEVICE_SCAN: case MFI_FWSTATE_FLUSH_CACHE: - max_wait = 20; + max_wait = MFI_RESET_WAIT_TIME; + break; + case MFI_FWSTATE_DEVICE_SCAN: + max_wait = MFI_RESET_WAIT_TIME; /* wait for 180 seconds */ + prev_abs_reg_val = cur_abs_reg_val; + break; + case MFI_FWSTATE_BOOT_MESSAGE_PENDING: + if (sc->mfi_flags & MFI_FLAGS_SKINNY || sc->mfi_flags & MFI_FLAGS_TBOLT) + MFI_WRITE4(sc, MFI_SKINNY_IDB, MFI_FWINIT_HOTPLUG); + else + MFI_WRITE4(sc, MFI_IDB, MFI_FWINIT_HOTPLUG); + max_wait = MFI_RESET_WAIT_TIME; break; default: - device_printf(sc->mfi_dev,"Unknown firmware state %d\n", + device_printf(sc->mfi_dev, "Unknown firmware state %#x\n", fw_state); return (ENXIO); } for (i = 0; i < (max_wait * 10); i++) { - fw_state = sc->mfi_read_fw_status(sc) & MFI_FWSTATE_MASK; + cur_abs_reg_val = sc->mfi_read_fw_status(sc); + fw_state = cur_abs_reg_val & MFI_FWSTATE_MASK; if (fw_state == cur_state) DELAY(100000); else break; } + if (fw_state == MFI_FWSTATE_DEVICE_SCAN) { + /* Check the device scanning progress */ + if (prev_abs_reg_val != cur_abs_reg_val) { + continue; + } + } if (fw_state == cur_state) { - device_printf(sc->mfi_dev, "firmware stuck in state " + device_printf(sc->mfi_dev, "Firmware stuck in state " "%#x\n", fw_state); return (ENXIO); } @@ -282,26 +346,36 @@ mfi_transition_firmware(struct mfi_softc } static void -mfi_addr32_cb(void *arg, bus_dma_segment_t *segs, int nsegs, int error) +mfi_addr_cb(void *arg, bus_dma_segment_t *segs, int nsegs, int error) { - uint32_t *addr; + bus_addr_t *addr; addr = arg; *addr = segs[0].ds_addr; } + int mfi_attach(struct mfi_softc *sc) { uint32_t status; int error, commsz, framessz, sensesz; int frames, unit, max_fw_sge; + uint32_t tb_mem_size = 0; - device_printf(sc->mfi_dev, "Megaraid SAS driver Ver 3.00 \n"); + if (sc == NULL) + return EINVAL; + + device_printf(sc->mfi_dev, "Megaraid SAS driver Ver %s \n", + MEGASAS_VERSION); mtx_init(&sc->mfi_io_lock, "MFI I/O lock", NULL, MTX_DEF); sx_init(&sc->mfi_config_lock, "MFI config"); TAILQ_INIT(&sc->mfi_ld_tqh); + TAILQ_INIT(&sc->mfi_syspd_tqh); + TAILQ_INIT(&sc->mfi_evt_queue); + TASK_INIT(&sc->mfi_evt_task, 0, mfi_handle_evt, sc); + TASK_INIT(&sc->mfi_map_sync_task, 0, mfi_handle_map_sync, sc); TAILQ_INIT(&sc->mfi_aen_pids); TAILQ_INIT(&sc->mfi_cam_ccbq); @@ -310,15 +384,29 @@ mfi_attach(struct mfi_softc *sc) mfi_initq_busy(sc); mfi_initq_bio(sc); + sc->adpreset = 0; + sc->last_seq_num = 0; + sc->disableOnlineCtrlReset = 1; + sc->issuepend_done = 1; + sc->hw_crit_error = 0; + if (sc->mfi_flags & MFI_FLAGS_1064R) { sc->mfi_enable_intr = mfi_enable_intr_xscale; sc->mfi_read_fw_status = mfi_read_fw_status_xscale; sc->mfi_check_clear_intr = mfi_check_clear_intr_xscale; sc->mfi_issue_cmd = mfi_issue_cmd_xscale; - } - else { + } else if (sc->mfi_flags & MFI_FLAGS_TBOLT) { + sc->mfi_enable_intr = mfi_tbolt_enable_intr_ppc; + sc->mfi_disable_intr = mfi_tbolt_disable_intr_ppc; + sc->mfi_read_fw_status = mfi_tbolt_read_fw_status_ppc; + sc->mfi_check_clear_intr = mfi_tbolt_check_clear_intr_ppc; + sc->mfi_issue_cmd = mfi_tbolt_issue_cmd_ppc; + sc->mfi_adp_reset = mfi_tbolt_adp_reset; + sc->mfi_tbolt = 1; + TAILQ_INIT(&sc->mfi_cmd_tbolt_tqh); + } else { sc->mfi_enable_intr = mfi_enable_intr_ppc; - sc->mfi_read_fw_status = mfi_read_fw_status_ppc; + sc->mfi_read_fw_status = mfi_read_fw_status_ppc; sc->mfi_check_clear_intr = mfi_check_clear_intr_ppc; sc->mfi_issue_cmd = mfi_issue_cmd_ppc; } @@ -331,6 +419,32 @@ mfi_attach(struct mfi_softc *sc) return (ENXIO); } + /* Start: LSIP200113393 */ + if (bus_dma_tag_create( sc->mfi_parent_dmat, /* parent */ + 1, 0, /* algnmnt, boundary */ + BUS_SPACE_MAXADDR_32BIT,/* lowaddr */ + BUS_SPACE_MAXADDR, /* highaddr */ + NULL, NULL, /* filter, filterarg */ + MEGASAS_MAX_NAME*sizeof(bus_addr_t), /* maxsize */ + 1, /* msegments */ + MEGASAS_MAX_NAME*sizeof(bus_addr_t), /* maxsegsize */ + 0, /* flags */ + NULL, NULL, /* lockfunc, lockarg */ + &sc->verbuf_h_dmat)) { + device_printf(sc->mfi_dev, "Cannot allocate verbuf_h_dmat DMA tag\n"); + return (ENOMEM); + } + if (bus_dmamem_alloc(sc->verbuf_h_dmat, (void **)&sc->verbuf, + BUS_DMA_NOWAIT, &sc->verbuf_h_dmamap)) { + device_printf(sc->mfi_dev, "Cannot allocate verbuf_h_dmamap memory\n"); + return (ENOMEM); + } + bzero(sc->verbuf, MEGASAS_MAX_NAME*sizeof(bus_addr_t)); + bus_dmamap_load(sc->verbuf_h_dmat, sc->verbuf_h_dmamap, + sc->verbuf, MEGASAS_MAX_NAME*sizeof(bus_addr_t), + mfi_addr_cb, &sc->verbuf_h_busaddr, 0); + /* End: LSIP200113393 */ + /* * Get information needed for sizing the contiguous memory for the * frame pool. Size down the sgl parameter since we know that @@ -341,8 +455,102 @@ mfi_attach(struct mfi_softc *sc) status = sc->mfi_read_fw_status(sc); sc->mfi_max_fw_cmds = status & MFI_FWSTATE_MAXCMD_MASK; max_fw_sge = (status & MFI_FWSTATE_MAXSGL_MASK) >> 16; - sc->mfi_max_sge = min(max_fw_sge, ((MAXPHYS / PAGE_SIZE) + 1)); + sc->mfi_max_sge = min(max_fw_sge, ((MFI_MAXPHYS / PAGE_SIZE) + 1)); + + /* ThunderBolt Support get the contiguous memory */ + + if (sc->mfi_flags & MFI_FLAGS_TBOLT) { + mfi_tbolt_init_globals(sc); + device_printf(sc->mfi_dev, "MaxCmd = %x MaxSgl = %x state = %x \n", + sc->mfi_max_fw_cmds, sc->mfi_max_sge, status); + tb_mem_size = mfi_tbolt_get_memory_requirement(sc); + + if (bus_dma_tag_create( sc->mfi_parent_dmat, /* parent */ + 1, 0, /* algnmnt, boundary */ + BUS_SPACE_MAXADDR_32BIT,/* lowaddr */ + BUS_SPACE_MAXADDR, /* highaddr */ + NULL, NULL, /* filter, filterarg */ + tb_mem_size, /* maxsize */ + 1, /* msegments */ + tb_mem_size, /* maxsegsize */ + 0, /* flags */ + NULL, NULL, /* lockfunc, lockarg */ + &sc->mfi_tb_dmat)) { + device_printf(sc->mfi_dev, "Cannot allocate comms DMA tag\n"); + return (ENOMEM); + } + if (bus_dmamem_alloc(sc->mfi_tb_dmat, (void **)&sc->request_message_pool, + BUS_DMA_NOWAIT, &sc->mfi_tb_dmamap)) { + device_printf(sc->mfi_dev, "Cannot allocate comms memory\n"); + return (ENOMEM); + } + bzero(sc->request_message_pool, tb_mem_size); + bus_dmamap_load(sc->mfi_tb_dmat, sc->mfi_tb_dmamap, + sc->request_message_pool, tb_mem_size, mfi_addr_cb, &sc->mfi_tb_busaddr, 0); + + /* For ThunderBolt memory init */ + if (bus_dma_tag_create( sc->mfi_parent_dmat, /* parent */ + 0x100, 0, /* alignmnt, boundary */ + BUS_SPACE_MAXADDR_32BIT,/* lowaddr */ + BUS_SPACE_MAXADDR, /* highaddr */ + NULL, NULL, /* filter, filterarg */ + MFI_FRAME_SIZE, /* maxsize */ + 1, /* msegments */ + MFI_FRAME_SIZE, /* maxsegsize */ + 0, /* flags */ + NULL, NULL, /* lockfunc, lockarg */ + &sc->mfi_tb_init_dmat)) { + device_printf(sc->mfi_dev, "Cannot allocate init DMA tag\n"); + return (ENOMEM); + } + if (bus_dmamem_alloc(sc->mfi_tb_init_dmat, (void **)&sc->mfi_tb_init, + BUS_DMA_NOWAIT, &sc->mfi_tb_init_dmamap)) { + device_printf(sc->mfi_dev, "Cannot allocate init memory\n"); + return (ENOMEM); + } + bzero(sc->mfi_tb_init, MFI_FRAME_SIZE); + bus_dmamap_load(sc->mfi_tb_init_dmat, sc->mfi_tb_init_dmamap, + sc->mfi_tb_init, MFI_FRAME_SIZE, mfi_addr_cb, + &sc->mfi_tb_init_busaddr, 0); + if (mfi_tbolt_init_desc_pool(sc, sc->request_message_pool, + tb_mem_size)) { + device_printf(sc->mfi_dev, + "Thunderbolt pool preparation error\n"); + return 0; + } + /* + Allocate DMA memory mapping for MPI2 IOC Init descriptor, + we are taking it diffrent from what we have allocated for Request + and reply descriptors to avoid confusion later + */ + tb_mem_size = sizeof(struct MPI2_IOC_INIT_REQUEST); + if (bus_dma_tag_create( sc->mfi_parent_dmat, /* parent */ + 1, 0, /* algnmnt, boundary */ + BUS_SPACE_MAXADDR_32BIT,/* lowaddr */ + BUS_SPACE_MAXADDR, /* highaddr */ + NULL, NULL, /* filter, filterarg */ + tb_mem_size, /* maxsize */ + 1, /* msegments */ + tb_mem_size, /* maxsegsize */ + 0, /* flags */ + NULL, NULL, /* lockfunc, lockarg */ + &sc->mfi_tb_ioc_init_dmat)) { + device_printf(sc->mfi_dev, + "Cannot allocate comms DMA tag\n"); + return (ENOMEM); + } + if (bus_dmamem_alloc(sc->mfi_tb_ioc_init_dmat, + (void **)&sc->mfi_tb_ioc_init_desc, + BUS_DMA_NOWAIT, &sc->mfi_tb_ioc_init_dmamap)) { + device_printf(sc->mfi_dev, "Cannot allocate comms memory\n"); + return (ENOMEM); + } + bzero(sc->mfi_tb_ioc_init_desc, tb_mem_size); + bus_dmamap_load(sc->mfi_tb_ioc_init_dmat, sc->mfi_tb_ioc_init_dmamap, + sc->mfi_tb_ioc_init_desc, tb_mem_size, mfi_addr_cb, + &sc->mfi_tb_ioc_init_busaddr, 0); + } /* * Create the dma tag for data buffers. Used both for block I/O * and for various internal data queries. @@ -392,8 +600,7 @@ mfi_attach(struct mfi_softc *sc) } bzero(sc->mfi_comms, commsz); bus_dmamap_load(sc->mfi_comms_dmat, sc->mfi_comms_dmamap, - sc->mfi_comms, commsz, mfi_addr32_cb, &sc->mfi_comms_busaddr, 0); - + sc->mfi_comms, commsz, mfi_addr_cb, &sc->mfi_comms_busaddr, 0); /* * Allocate DMA memory for the command frames. Keep them in the * lower 4GB for efficiency. Calculate the size of the commands at @@ -410,6 +617,8 @@ mfi_attach(struct mfi_softc *sc) } else { sc->mfi_sge_size = sizeof(struct mfi_sg32); } + if (sc->mfi_flags & MFI_FLAGS_SKINNY) + sc->mfi_sge_size = sizeof(struct mfi_sg_skinny); frames = (sc->mfi_sge_size * sc->mfi_max_sge - 1) / MFI_FRAME_SIZE + 2; sc->mfi_cmd_size = frames * MFI_FRAME_SIZE; framessz = sc->mfi_cmd_size * sc->mfi_max_fw_cmds; @@ -434,8 +643,7 @@ mfi_attach(struct mfi_softc *sc) } bzero(sc->mfi_frames, framessz); bus_dmamap_load(sc->mfi_frames_dmat, sc->mfi_frames_dmamap, - sc->mfi_frames, framessz, mfi_addr32_cb, &sc->mfi_frames_busaddr,0); - + sc->mfi_frames, framessz, mfi_addr_cb, &sc->mfi_frames_busaddr,0); /* * Allocate DMA memory for the frame sense data. Keep them in the * lower 4GB for efficiency @@ -461,39 +669,46 @@ mfi_attach(struct mfi_softc *sc) return (ENOMEM); } bus_dmamap_load(sc->mfi_sense_dmat, sc->mfi_sense_dmamap, - sc->mfi_sense, sensesz, mfi_addr32_cb, &sc->mfi_sense_busaddr, 0); - + sc->mfi_sense, sensesz, mfi_addr_cb, &sc->mfi_sense_busaddr, 0); if ((error = mfi_alloc_commands(sc)) != 0) return (error); - if ((error = mfi_comms_init(sc)) != 0) - return (error); + /* Before moving the FW to operational state, check whether + * hostmemory is required by the FW or not + */ - if ((error = mfi_get_controller_info(sc)) != 0) - return (error); + /* ThunderBolt MFI_IOC2 INIT */ + if (sc->mfi_flags & MFI_FLAGS_TBOLT) { + sc->mfi_disable_intr(sc); + if ((error = mfi_tbolt_init_MFI_queue(sc)) != 0) { + device_printf(sc->mfi_dev, + "TB Init has failed with error %d\n",error); + return error; + } - mtx_lock(&sc->mfi_io_lock); - if ((error = mfi_aen_setup(sc, 0), 0) != 0) { - mtx_unlock(&sc->mfi_io_lock); - return (error); - } - mtx_unlock(&sc->mfi_io_lock); + if ((error = mfi_tbolt_alloc_cmd(sc)) != 0) + return error; + if (bus_setup_intr(sc->mfi_dev, sc->mfi_irq, + INTR_MPSAFE|INTR_TYPE_BIO, NULL, mfi_intr_tbolt, sc, + &sc->mfi_intr)) { + device_printf(sc->mfi_dev, "Cannot set up interrupt\n"); + return (EINVAL); + } + sc->mfi_enable_intr(sc); + } else { + if ((error = mfi_comms_init(sc)) != 0) + return (error); - /* - * Set up the interrupt handler. XXX This should happen in - * mfi_pci.c - */ - sc->mfi_irq_rid = 0; - if ((sc->mfi_irq = bus_alloc_resource_any(sc->mfi_dev, SYS_RES_IRQ, - &sc->mfi_irq_rid, RF_SHAREABLE | RF_ACTIVE)) == NULL) { - device_printf(sc->mfi_dev, "Cannot allocate interrupt\n"); - return (EINVAL); - } - if (bus_setup_intr(sc->mfi_dev, sc->mfi_irq, INTR_MPSAFE|INTR_TYPE_BIO, - NULL, mfi_intr, sc, &sc->mfi_intr)) { - device_printf(sc->mfi_dev, "Cannot set up interrupt\n"); - return (EINVAL); + if (bus_setup_intr(sc->mfi_dev, sc->mfi_irq, + INTR_MPSAFE|INTR_TYPE_BIO, NULL, mfi_intr, sc, &sc->mfi_intr)) { + device_printf(sc->mfi_dev, "Cannot set up interrupt\n"); + return (EINVAL); + } + sc->mfi_enable_intr(sc); } + if ((error = mfi_get_controller_info(sc)) != 0) + return (error); + sc->disableOnlineCtrlReset = 0; /* Register a config hook to probe the bus for arrays */ sc->mfi_ich.ich_func = mfi_startup; @@ -503,6 +718,10 @@ mfi_attach(struct mfi_softc *sc) "hook\n"); return (EINVAL); } + if ((error = mfi_aen_setup(sc, 0), 0) != 0) { + mtx_unlock(&sc->mfi_io_lock); + return (error); + } /* * Register a shutdown handler. @@ -541,6 +760,10 @@ mfi_attach(struct mfi_softc *sc) callout_reset(&sc->mfi_watchdog_callout, MFI_CMD_TIMEOUT * hz, mfi_timeout, sc); + if (sc->mfi_flags & MFI_FLAGS_TBOLT) { + mfi_tbolt_sync_map_info(sc); + } + return (0); } @@ -574,8 +797,11 @@ mfi_alloc_commands(struct mfi_softc *sc) cm->cm_sc = sc; cm->cm_index = i; if (bus_dmamap_create(sc->mfi_buffer_dmat, 0, - &cm->cm_dmamap) == 0) + &cm->cm_dmamap) == 0) { + mtx_lock(&sc->mfi_io_lock); mfi_release_command(cm); + mtx_unlock(&sc->mfi_io_lock); + } else break; sc->mfi_total_cmds++; @@ -590,6 +816,8 @@ mfi_release_command(struct mfi_command * struct mfi_frame_header *hdr; uint32_t *hdr_data; + mtx_assert(&cm->cm_sc->mfi_io_lock, MA_OWNED); + /* * Zero out the important fields of the frame, but make sure the * context field is preserved. For efficiency, handle the fields @@ -614,24 +842,31 @@ mfi_release_command(struct mfi_command * cm->cm_data = NULL; cm->cm_sg = 0; cm->cm_total_frame_size = 0; + cm->retry_for_fw_reset = 0; mfi_enqueue_free(cm); } -static int -mfi_dcmd_command(struct mfi_softc *sc, struct mfi_command **cmp, uint32_t opcode, - void **bufp, size_t bufsize) +int +mfi_dcmd_command(struct mfi_softc *sc, struct mfi_command **cmp, + uint32_t opcode, void **bufp, size_t bufsize) { struct mfi_command *cm; struct mfi_dcmd_frame *dcmd; void *buf = NULL; - + uint32_t context = 0; + mtx_assert(&sc->mfi_io_lock, MA_OWNED); - + cm = mfi_dequeue_free(sc); if (cm == NULL) return (EBUSY); + /* Zero out the MFI frame */ + context = cm->cm_frame->header.context; + bzero(cm->cm_frame, sizeof(union mfi_frame)); + cm->cm_frame->header.context = context; + if ((bufsize > 0) && (bufp != NULL)) { if (*bufp == NULL) { buf = malloc(bufsize, M_MFIBUF, M_NOWAIT|M_ZERO); @@ -651,6 +886,7 @@ mfi_dcmd_command(struct mfi_softc *sc, s dcmd->header.timeout = 0; dcmd->header.flags = 0; dcmd->header.data_len = bufsize; + dcmd->header.scsi_status = 0; dcmd->opcode = opcode; cm->cm_sg = &dcmd->sgl; cm->cm_total_frame_size = MFI_DCMD_FRAME_SIZE; @@ -672,11 +908,17 @@ mfi_comms_init(struct mfi_softc *sc) struct mfi_init_frame *init; struct mfi_init_qinfo *qinfo; int error; + uint32_t context = 0; mtx_lock(&sc->mfi_io_lock); if ((cm = mfi_dequeue_free(sc)) == NULL) return (EBUSY); + /* Zero out the MFI frame */ + context = cm->cm_frame->header.context; + bzero(cm->cm_frame, sizeof(union mfi_frame)); + cm->cm_frame->header.context = context; + /* * Abuse the SG list area of the frame to hold the init_qinfo * object; @@ -737,9 +979,11 @@ mfi_get_controller_info(struct mfi_softc BUS_DMASYNC_POSTREAD); bus_dmamap_unload(sc->mfi_buffer_dmat, cm->cm_dmamap); - max_sectors_1 = (1 << ci->stripe_sz_ops.min) * ci->max_strips_per_io; + max_sectors_1 = (1 << ci->stripe_sz_ops.max) * ci->max_strips_per_io; max_sectors_2 = ci->max_request_size; sc->mfi_max_io = min(max_sectors_1, max_sectors_2); + sc->disableOnlineCtrlReset = + ci->properties.OnOffProperties.disableOnlineCtrlReset; out: if (ci) @@ -756,6 +1000,7 @@ mfi_get_log_state(struct mfi_softc *sc, struct mfi_command *cm = NULL; int error; + mtx_lock(&sc->mfi_io_lock); error = mfi_dcmd_command(sc, &cm, MFI_DCMD_CTRL_EVENT_GETINFO, (void **)log_state, sizeof(**log_state)); if (error) @@ -774,11 +1019,12 @@ mfi_get_log_state(struct mfi_softc *sc, out: if (cm) mfi_release_command(cm); + mtx_unlock(&sc->mfi_io_lock); return (error); } -static int +int mfi_aen_setup(struct mfi_softc *sc, uint32_t seq_start) { struct mfi_evt_log_state *log_state = NULL; @@ -788,10 +1034,11 @@ mfi_aen_setup(struct mfi_softc *sc, uint class_locale.members.reserved = 0; class_locale.members.locale = mfi_event_locale; - class_locale.members.class = mfi_event_class; + class_locale.members.evt_class = mfi_event_class; if (seq_start == 0) { error = mfi_get_log_state(sc, &log_state); + sc->mfi_boot_seq_num = log_state->boot_seq_num; if (error) { if (log_state) free(log_state, M_MFIBUF); @@ -813,7 +1060,7 @@ mfi_aen_setup(struct mfi_softc *sc, uint return 0; } -static int +int mfi_wait_command(struct mfi_softc *sc, struct mfi_command *cm) { @@ -886,6 +1133,64 @@ mfi_free(struct mfi_softc *sc) if (sc->mfi_comms_dmat != NULL) bus_dma_tag_destroy(sc->mfi_comms_dmat); + /* ThunderBolt contiguous memory free here */ + if (sc->mfi_flags & MFI_FLAGS_TBOLT) { + if (sc->mfi_tb_busaddr != 0) + bus_dmamap_unload(sc->mfi_tb_dmat, sc->mfi_tb_dmamap); + if (sc->request_message_pool != NULL) + bus_dmamem_free(sc->mfi_tb_dmat, sc->request_message_pool, + sc->mfi_tb_dmamap); + if (sc->mfi_tb_dmat != NULL) + bus_dma_tag_destroy(sc->mfi_tb_dmat); + + /* Version buffer memory free */ + /* Start LSIP200113393 */ + if (sc->verbuf_h_busaddr != 0) + bus_dmamap_unload(sc->verbuf_h_dmat, sc->verbuf_h_dmamap); + if (sc->verbuf != NULL) + bus_dmamem_free(sc->verbuf_h_dmat, sc->verbuf, + sc->verbuf_h_dmamap); + if (sc->verbuf_h_dmat != NULL) + bus_dma_tag_destroy(sc->verbuf_h_dmat); + + /* End LSIP200113393 */ + /* ThunderBolt INIT packet memory Free */ + if (sc->mfi_tb_init_busaddr != 0) + bus_dmamap_unload(sc->mfi_tb_init_dmat, sc->mfi_tb_init_dmamap); + if (sc->mfi_tb_init != NULL) + bus_dmamem_free(sc->mfi_tb_init_dmat, sc->mfi_tb_init, + sc->mfi_tb_init_dmamap); + if (sc->mfi_tb_init_dmat != NULL) + bus_dma_tag_destroy(sc->mfi_tb_init_dmat); + + /* ThunderBolt IOC Init Desc memory free here */ + if (sc->mfi_tb_ioc_init_busaddr != 0) + bus_dmamap_unload(sc->mfi_tb_ioc_init_dmat, + sc->mfi_tb_ioc_init_dmamap); + if (sc->mfi_tb_ioc_init_desc != NULL) + bus_dmamem_free(sc->mfi_tb_ioc_init_dmat, + sc->mfi_tb_ioc_init_desc, + sc->mfi_tb_ioc_init_dmamap); + if (sc->mfi_tb_ioc_init_dmat != NULL) + bus_dma_tag_destroy(sc->mfi_tb_ioc_init_dmat); + for (int i = 0; i < sc->mfi_max_fw_cmds; i++) { + if (sc->mfi_cmd_pool_tbolt != NULL) { + if (sc->mfi_cmd_pool_tbolt[i] != NULL) { + free(sc->mfi_cmd_pool_tbolt[i], + M_MFIBUF); + sc->mfi_cmd_pool_tbolt[i] = NULL; + } + } + } + if (sc->mfi_cmd_pool_tbolt != NULL) { + free(sc->mfi_cmd_pool_tbolt, M_MFIBUF); + sc->mfi_cmd_pool_tbolt = NULL; + } + if (sc->request_desc_pool != NULL) { + free(sc->request_desc_pool, M_MFIBUF); + sc->request_desc_pool = NULL; + } + } if (sc->mfi_buffer_dmat != NULL) bus_dma_tag_destroy(sc->mfi_buffer_dmat); if (sc->mfi_parent_dmat != NULL) @@ -912,6 +1217,8 @@ mfi_startup(void *arg) sx_xlock(&sc->mfi_config_lock); mtx_lock(&sc->mfi_io_lock); mfi_ldprobe(sc); + if (sc->mfi_flags & MFI_FLAGS_SKINNY) + mfi_syspdprobe(sc); mtx_unlock(&sc->mfi_io_lock); sx_xunlock(&sc->mfi_config_lock); } @@ -928,12 +1235,7 @@ mfi_intr(void *arg) if (sc->mfi_check_clear_intr(sc)) return; - /* - * Do a dummy read to flush the interrupt ACK that we just performed, - * ensuring that everything is really, truly consistent. - */ - (void)sc->mfi_read_fw_status(sc); - +restart: pi = sc->mfi_comms->hw_pi; ci = sc->mfi_comms->hw_ci; mtx_lock(&sc->mfi_io_lock); @@ -958,6 +1260,14 @@ mfi_intr(void *arg) mfi_startio(sc); mtx_unlock(&sc->mfi_io_lock); + /* + * Dummy read to flush the bus; this ensures that the indexes are up + * to date. Restart processing if more commands have come it. + */ + (void)sc->mfi_read_fw_status(sc); + if (pi != sc->mfi_comms->hw_pi) + goto restart; + return; } @@ -978,6 +1288,9 @@ mfi_shutdown(struct mfi_softc *sc) if (sc->mfi_aen_cm != NULL) mfi_abort(sc, sc->mfi_aen_cm); + if (sc->mfi_map_sync_cm != NULL) + mfi_abort(sc, sc->mfi_map_sync_cm); + dcmd = &cm->cm_frame->dcmd; dcmd->header.flags = MFI_FRAME_DIR_NONE; cm->cm_flags = MFI_CMD_POLLED; @@ -993,6 +1306,81 @@ mfi_shutdown(struct mfi_softc *sc) } static void +mfi_syspdprobe(struct mfi_softc *sc) +{ + struct mfi_frame_header *hdr; + struct mfi_command *cm = NULL; + struct mfi_pd_list *pdlist = NULL; + struct mfi_system_pd *syspd, *tmp; + int error, i, found; + + sx_assert(&sc->mfi_config_lock, SA_XLOCKED); + mtx_assert(&sc->mfi_io_lock, MA_OWNED); + /* Add SYSTEM PD's */ + error = mfi_dcmd_command(sc, &cm, MFI_DCMD_PD_LIST_QUERY, + (void **)&pdlist, sizeof(*pdlist)); + if (error) { + device_printf(sc->mfi_dev, + "Error while forming SYSTEM PD list\n"); + goto out; + } + + cm->cm_flags = MFI_CMD_DATAIN | MFI_CMD_POLLED; + cm->cm_frame->dcmd.mbox[0] = MR_PD_QUERY_TYPE_EXPOSED_TO_HOST; + cm->cm_frame->dcmd.mbox[1] = 0; + if (mfi_mapcmd(sc, cm) != 0) { + device_printf(sc->mfi_dev, + "Failed to get syspd device listing\n"); + goto out; + } + bus_dmamap_sync(sc->mfi_buffer_dmat,cm->cm_dmamap, + BUS_DMASYNC_POSTREAD); + bus_dmamap_unload(sc->mfi_buffer_dmat, cm->cm_dmamap); + hdr = &cm->cm_frame->header; + if (hdr->cmd_status != MFI_STAT_OK) { + device_printf(sc->mfi_dev, + "MFI_DCMD_PD_LIST_QUERY failed %x\n", hdr->cmd_status); + goto out; + } + /* Get each PD and add it to the system */ + for (i = 0; i < pdlist->count; i++) { + if (pdlist->addr[i].device_id == + pdlist->addr[i].encl_device_id) + continue; + found = 0; + TAILQ_FOREACH(syspd, &sc->mfi_syspd_tqh, pd_link) { + if (syspd->pd_id == pdlist->addr[i].device_id) + found = 1; + } + if (found == 0) + mfi_add_sys_pd(sc, pdlist->addr[i].device_id); + } + /* Delete SYSPD's whose state has been changed */ + TAILQ_FOREACH_SAFE(syspd, &sc->mfi_syspd_tqh, pd_link, tmp) { + found = 0; + for (i = 0; i < pdlist->count; i++) { + if (syspd->pd_id == pdlist->addr[i].device_id) + found = 1; + } + if (found == 0) { + printf("DELETE\n"); + mtx_unlock(&sc->mfi_io_lock); + mtx_lock(&Giant); + device_delete_child(sc->mfi_dev, syspd->pd_dev); + mtx_unlock(&Giant); + mtx_lock(&sc->mfi_io_lock); + } + } +out: + if (pdlist) + free(pdlist, M_MFIBUF); + if (cm) + mfi_release_command(cm); + + return; +} + +static void mfi_ldprobe(struct mfi_softc *sc) { struct mfi_frame_header *hdr; @@ -1086,10 +1474,124 @@ format_class(int8_t class) static void mfi_decode_evt(struct mfi_softc *sc, struct mfi_evt_detail *detail) { + struct mfi_system_pd *syspd = NULL; device_printf(sc->mfi_dev, "%d (%s/0x%04x/%s) - %s\n", detail->seq, - format_timestamp(detail->time), detail->class.members.locale, - format_class(detail->class.members.class), detail->description); + format_timestamp(detail->time), detail->evt_class.members.locale, + format_class(detail->evt_class.members.evt_class), + detail->description); + + /* Don't act on old AEN's or while shutting down */ + if (detail->seq < sc->mfi_boot_seq_num || sc->mfi_detaching) + return; + + switch (detail->arg_type) { + case MR_EVT_ARGS_NONE: + if (detail->code == MR_EVT_CTRL_HOST_BUS_SCAN_REQUESTED) { + device_printf(sc->mfi_dev, "HostBus scan raised\n"); + if (mfi_detect_jbod_change) { + /* + * Probe for new SYSPD's and Delete + * invalid SYSPD's + */ + sx_xlock(&sc->mfi_config_lock); + mtx_lock(&sc->mfi_io_lock); + mfi_syspdprobe(sc); + mtx_unlock(&sc->mfi_io_lock); + sx_xunlock(&sc->mfi_config_lock); + } + } + break; + case MR_EVT_ARGS_LD_STATE: + /* During load time driver reads all the events starting + * from the one that has been logged after shutdown. Avoid + * these old events. + */ + if (detail->args.ld_state.new_state == MFI_LD_STATE_OFFLINE ) { + /* Remove the LD */ + struct mfi_disk *ld; + TAILQ_FOREACH(ld, &sc->mfi_ld_tqh, ld_link) { + if (ld->ld_id == + detail->args.ld_state.ld.target_id) + break; + } + /* + Fix: for kernel panics when SSCD is removed + KASSERT(ld != NULL, ("volume dissappeared")); + */ + if (ld != NULL) { + mtx_lock(&Giant); + device_delete_child(sc->mfi_dev, ld->ld_dev); + mtx_unlock(&Giant); + } + } + break; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-7@FreeBSD.ORG Sat May 19 00:11:05 2012 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 986BB1065670; Sat, 19 May 2012 00:11:05 +0000 (UTC) (envelope-from oliver.pntr@gmail.com) Received: from mail-yx0-f182.google.com (mail-yx0-f182.google.com [209.85.213.182]) by mx1.freebsd.org (Postfix) with ESMTP id D2B7E8FC12; Sat, 19 May 2012 00:11:01 +0000 (UTC) Received: by yenl8 with SMTP id l8so4240995yen.13 for ; Fri, 18 May 2012 17:11:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=n6PICyJkaRxxcq+SKOSdyl3ibqEVPHts1HRtQ2lP394=; b=050I8Zf03IB0QOGbrstEVM6vGTGzi3UI04djPMlLGoNj9csOdMG9AR/VDFLiaKIOi1 +mzjgHPbSHO0WhCE7YBkPnBEYoBWxrcUWJ6SQrzpVMdrRMEvD4sRjwUOa4vCDcG6EDHI IKdnoXiM4k2kAog0hrTs1El/wj0getcUQuR+M//6Zln6wEjbvuAwUoP+rGLlbMKTKMcR f13plFKo7XUHJzT9KHH+Ch3usjxhxWVlrxygqAAUm4E+QaSBUm4FmAY8h+cd6lje41Za PqXbcByHIntLimdKpkkE+LyGrSvrfbFZUknz23dios2jgtZ2xHujSAneZ6BRw2u+1YJh by/Q== MIME-Version: 1.0 Received: by 10.101.143.14 with SMTP id v14mr4352780ann.55.1337386261100; Fri, 18 May 2012 17:11:01 -0700 (PDT) Received: by 10.236.44.73 with HTTP; Fri, 18 May 2012 17:11:01 -0700 (PDT) In-Reply-To: <201205182329.q4INTU4X086651@svn.freebsd.org> References: <201205182329.q4INTU4X086651@svn.freebsd.org> Date: Sat, 19 May 2012 02:11:01 +0200 Message-ID: From: Oliver Pinter To: Sean Bruno Content-Type: text/plain; charset=ISO-8859-1 Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-7@freebsd.org Subject: Re: svn commit: r235636 - in stable/7/sys: conf dev/mfi modules/mfi X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 May 2012 00:11:05 -0000 cc -O2 -fno-strict-aliasing -pipe -fno-delete-null-pointer-checks -march=core2 - fno-builtin-strftime -Wsystem-headers -Wall -Wno-format-y2k -W -Wno-unused-param eter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wno-uninitialized -Wno-pointer-sign -c /usr/src/usr.sbin/mfiutil/mfi_evt.c /usr/src/usr.sbin/mfiutil/mfi_evt.c: In function 'mfi_decode_evt': /usr/src/usr.sbin/mfiutil/mfi_evt.c:366: error: 'struct mfi_evt_detail' has no m ember named 'class' /usr/src/usr.sbin/mfiutil/mfi_evt.c:367: error: 'struct mfi_evt_detail' has no m ember named 'class' /usr/src/usr.sbin/mfiutil/mfi_evt.c: In function 'show_events': /usr/src/usr.sbin/mfiutil/mfi_evt.c:562: error: 'struct ' has no memb er named 'class' /usr/src/usr.sbin/mfiutil/mfi_evt.c:572: error: 'struct ' has no memb er named 'class' cc -O2 -fno-strict-aliasing -pipe -fno-delete-null-pointer-checks -march=core2 - DGTAGS -DSYSV_CURSES -I/usr/src/usr.bin/vi -I/usr/src/usr.bin/vi/../../contrib/n vi -I/usr/src/usr.bin/vi/../../contrib/nvi/include -c /usr/src/usr.bin/vi/../.. /contrib/nvi/ex/ex_put.c *** Error code 1 --------------- diff --git a/usr.sbin/mfiutil/mfi_evt.c b/usr.sbin/mfiutil/mfi_evt.c index a14bb19..336fbd3 100644 --- a/usr.sbin/mfiutil/mfi_evt.c +++ b/usr.sbin/mfiutil/mfi_evt.c @@ -363,8 +363,8 @@ mfi_decode_evt(int fd, struct mfi_evt_detail *detail, int verbose) { printf("%5d (%s/%s/%s) - ", detail->seq, format_timestamp(detail->time), - format_locale(detail->class.members.locale), - format_class(detail->class.members.class)); + format_locale(detail->evt_class.members.locale), + format_class(detail->evt_class.members.evt_class)); switch (detail->arg_type) { case MR_EVT_ARGS_NONE: break; @@ -559,7 +559,7 @@ show_events(int ac, char **av) num_events = 15; filter.members.reserved = 0; filter.members.locale = MFI_EVT_LOCALE_ALL; - filter.members.class = MFI_EVT_CLASS_WARNING; + filter.members.evt_class = MFI_EVT_CLASS_WARNING; start = info.boot_seq_num; stop = info.newest_seq_num; verbose = 0; @@ -569,7 +569,7 @@ show_events(int ac, char **av) while ((ch = getopt(ac, av, "c:l:n:v")) != -1) { switch (ch) { case 'c': - if (parse_class(optarg, &filter.members.class) < 0) { + if (parse_class(optarg, &filter.members.evt_class) < 0) { error = errno; warn("Error parsing event class"); close(fd); -------------- not tested, compiling now On 5/19/12, Sean Bruno wrote: > Author: sbruno > Date: Fri May 18 23:29:30 2012 > New Revision: 235636 > URL: http://svn.freebsd.org/changeset/base/235636 > > Log: > MFC of head thunderbolt support for mfi(4) > > r233711 -- IFV head_mfi into head for initial thunderbolt support > r233768 -- atomic_t --> mfi_atomic > r233805 -- fix tinderbuild, move megasas_sge to mfivar.h > r233877 -- remove atomic.h from includes > r235014 -- fix reading of sector >= 2^32 or 2^21, repair RAID handling > r235016 -- style(9) > r235040 -- fix returns from mfi_tbolt_sync_map_info() > r235318 -- repair panic on PAE i386 > r235321 -- repair the repair of panics on PAE i386 > > Added: > stable/7/sys/dev/mfi/mfi_syspd.c > - copied unchanged from r233711, head/sys/dev/mfi/mfi_syspd.c > stable/7/sys/dev/mfi/mfi_tbolt.c > - copied, changed from r233711, head/sys/dev/mfi/mfi_tbolt.c > Modified: > stable/7/sys/conf/files > stable/7/sys/dev/mfi/mfi.c > stable/7/sys/dev/mfi/mfi_cam.c > stable/7/sys/dev/mfi/mfi_debug.c > stable/7/sys/dev/mfi/mfi_disk.c > stable/7/sys/dev/mfi/mfi_ioctl.h > stable/7/sys/dev/mfi/mfi_linux.c > stable/7/sys/dev/mfi/mfi_pci.c > stable/7/sys/dev/mfi/mfireg.h > stable/7/sys/dev/mfi/mfivar.h > stable/7/sys/modules/mfi/Makefile > Directory Properties: > stable/7/sys/ (props changed) > > Modified: stable/7/sys/conf/files > ============================================================================== > --- stable/7/sys/conf/files Fri May 18 21:50:26 2012 (r235635) > +++ stable/7/sys/conf/files Fri May 18 23:29:30 2012 (r235636) > @@ -948,6 +948,8 @@ dev/mfi/mfi.c optional mfi > dev/mfi/mfi_debug.c optional mfi > dev/mfi/mfi_pci.c optional mfi pci > dev/mfi/mfi_disk.c optional mfi > +dev/mfi/mfi_syspd.c optional mfi > +dev/mfi/mfi_tbolt.c optional mfi > dev/mfi/mfi_linux.c optional mfi compat_linux > dev/mfi/mfi_cam.c optional mfip scbus > dev/mii/acphy.c optional miibus | acphy > > Modified: stable/7/sys/dev/mfi/mfi.c > ============================================================================== > --- stable/7/sys/dev/mfi/mfi.c Fri May 18 21:50:26 2012 (r235635) > +++ stable/7/sys/dev/mfi/mfi.c Fri May 18 23:29:30 2012 (r235636) > @@ -53,6 +53,7 @@ > #include > __FBSDID("$FreeBSD$"); > > +#include "opt_compat.h" > #include "opt_mfi.h" > > #include > @@ -72,6 +73,7 @@ __FBSDID("$FreeBSD$"); > #include > #include > #include > +#include > > #include > #include > @@ -79,43 +81,52 @@ __FBSDID("$FreeBSD$"); > #include > #include > #include > +#include > +#include > > static int mfi_alloc_commands(struct mfi_softc *); > static int mfi_comms_init(struct mfi_softc *); > -static int mfi_wait_command(struct mfi_softc *, struct mfi_command *); > static int mfi_get_controller_info(struct mfi_softc *); > static int mfi_get_log_state(struct mfi_softc *, > struct mfi_evt_log_state **); > static int mfi_parse_entries(struct mfi_softc *, int, int); > -static int mfi_dcmd_command(struct mfi_softc *, struct mfi_command **, > - uint32_t, void **, size_t); > static void mfi_data_cb(void *, bus_dma_segment_t *, int, int); > static void mfi_startup(void *arg); > static void mfi_intr(void *arg); > static void mfi_ldprobe(struct mfi_softc *sc); > +static void mfi_syspdprobe(struct mfi_softc *sc); > +static void mfi_handle_evt(void *context, int pending); > static int mfi_aen_register(struct mfi_softc *sc, int seq, int locale); > static void mfi_aen_complete(struct mfi_command *); > -static int mfi_aen_setup(struct mfi_softc *, uint32_t); > static int mfi_add_ld(struct mfi_softc *sc, int); > static void mfi_add_ld_complete(struct mfi_command *); > +static int mfi_add_sys_pd(struct mfi_softc *sc, int); > +static void mfi_add_sys_pd_complete(struct mfi_command *); > static struct mfi_command * mfi_bio_command(struct mfi_softc *); > static void mfi_bio_complete(struct mfi_command *); > -static int mfi_mapcmd(struct mfi_softc *, struct mfi_command *); > +static struct mfi_command *mfi_build_ldio(struct mfi_softc *,struct bio*); > +static struct mfi_command *mfi_build_syspdio(struct mfi_softc *,struct > bio*); > static int mfi_send_frame(struct mfi_softc *, struct mfi_command *); > -static void mfi_complete(struct mfi_softc *, struct mfi_command *); > static int mfi_abort(struct mfi_softc *, struct mfi_command *); > -static int mfi_linux_ioctl_int(struct cdev *, u_long, caddr_t, int, > d_thread_t *); > +static int mfi_linux_ioctl_int(struct cdev *, u_long, caddr_t, int, struct > thread *); > static void mfi_timeout(void *); > static int mfi_user_command(struct mfi_softc *, > struct mfi_ioc_passthru *); > -static void mfi_enable_intr_xscale(struct mfi_softc *sc); > -static void mfi_enable_intr_ppc(struct mfi_softc *sc); > -static int32_t mfi_read_fw_status_xscale(struct mfi_softc *sc); > -static int32_t mfi_read_fw_status_ppc(struct mfi_softc *sc); > -static int mfi_check_clear_intr_xscale(struct mfi_softc *sc); > -static int mfi_check_clear_intr_ppc(struct mfi_softc *sc); > -static void mfi_issue_cmd_xscale(struct mfi_softc *sc,uint32_t > bus_add,uint32_t frame_cnt); > -static void mfi_issue_cmd_ppc(struct mfi_softc *sc,uint32_t > bus_add,uint32_t frame_cnt); > +static void mfi_enable_intr_xscale(struct mfi_softc *sc); > +static void mfi_enable_intr_ppc(struct mfi_softc *sc); > +static int32_t mfi_read_fw_status_xscale(struct mfi_softc *sc); > +static int32_t mfi_read_fw_status_ppc(struct mfi_softc *sc); > +static int mfi_check_clear_intr_xscale(struct mfi_softc *sc); > +static int mfi_check_clear_intr_ppc(struct mfi_softc *sc); > +static void mfi_issue_cmd_xscale(struct mfi_softc *sc, bus_addr_t > bus_add, > + uint32_t frame_cnt); > +static void mfi_issue_cmd_ppc(struct mfi_softc *sc, bus_addr_t bus_add, > + uint32_t frame_cnt); > +static int mfi_config_lock(struct mfi_softc *sc, uint32_t opcode); > +static void mfi_config_unlock(struct mfi_softc *sc, int locked); > +static int mfi_check_command_pre(struct mfi_softc *sc, struct mfi_command > *cm); > +static void mfi_check_command_post(struct mfi_softc *sc, struct mfi_command > *cm); > +static int mfi_check_for_sscd(struct mfi_softc *sc, struct mfi_command > *cm); > > SYSCTL_NODE(_hw, OID_AUTO, mfi, CTLFLAG_RD, 0, "MFI driver parameters"); > static int mfi_event_locale = MFI_EVT_LOCALE_ALL; > @@ -133,6 +144,11 @@ TUNABLE_INT("hw.mfi.max_cmds", &mfi_max_ > SYSCTL_INT(_hw_mfi, OID_AUTO, max_cmds, CTLFLAG_RD, &mfi_max_cmds, > 0, "Max commands"); > > +static int mfi_detect_jbod_change = 1; > +TUNABLE_INT("hw.mfi.detect_jbod_change", &mfi_detect_jbod_change); > +SYSCTL_INT(_hw_mfi, OID_AUTO, detect_jbod_change, CTLFLAG_RW, > + &mfi_detect_jbod_change, 0, "Detect a change to a JBOD"); > + > /* Management interface */ > static d_open_t mfi_open; > static d_close_t mfi_close; > @@ -152,6 +168,7 @@ static struct cdevsw mfi_cdevsw = { > MALLOC_DEFINE(M_MFIBUF, "mfibuf", "Buffers for the MFI driver"); > > #define MFI_INQ_LENGTH SHORT_INQUIRY_LENGTH > +struct mfi_skinny_dma_info mfi_skinny; > > static void > mfi_enable_intr_xscale(struct mfi_softc *sc) > @@ -162,12 +179,17 @@ mfi_enable_intr_xscale(struct mfi_softc > static void > mfi_enable_intr_ppc(struct mfi_softc *sc) > { > - MFI_WRITE4(sc, MFI_ODCR0, 0xFFFFFFFF); > if (sc->mfi_flags & MFI_FLAGS_1078) { > + MFI_WRITE4(sc, MFI_ODCR0, 0xFFFFFFFF); > MFI_WRITE4(sc, MFI_OMSK, ~MFI_1078_EIM); > - } else if (sc->mfi_flags & MFI_FLAGS_GEN2) { > + } > + else if (sc->mfi_flags & MFI_FLAGS_GEN2) { > + MFI_WRITE4(sc, MFI_ODCR0, 0xFFFFFFFF); > MFI_WRITE4(sc, MFI_OMSK, ~MFI_GEN2_EIM); > } > + else if (sc->mfi_flags & MFI_FLAGS_SKINNY) { > + MFI_WRITE4(sc, MFI_OMSK, ~0x00000001); > + } > } > > static int32_t > @@ -205,35 +227,51 @@ mfi_check_clear_intr_ppc(struct mfi_soft > if (!(status & MFI_1078_RM)) { > return 1; > } > - } else if (sc->mfi_flags & MFI_FLAGS_GEN2) { > + } > + else if (sc->mfi_flags & MFI_FLAGS_GEN2) { > if (!(status & MFI_GEN2_RM)) { > return 1; > } > } > - > - MFI_WRITE4(sc, MFI_ODCR0, status); > + else if (sc->mfi_flags & MFI_FLAGS_SKINNY) { > + if (!(status & MFI_SKINNY_RM)) { > + return 1; > + } > + } > + if (sc->mfi_flags & MFI_FLAGS_SKINNY) > + MFI_WRITE4(sc, MFI_OSTS, status); > + else > + MFI_WRITE4(sc, MFI_ODCR0, status); > return 0; > } > > static void > -mfi_issue_cmd_xscale(struct mfi_softc *sc,uint32_t bus_add,uint32_t > frame_cnt) > +mfi_issue_cmd_xscale(struct mfi_softc *sc, bus_addr_t bus_add, uint32_t > frame_cnt) > { > MFI_WRITE4(sc, MFI_IQP,(bus_add >>3)|frame_cnt); > } > > static void > -mfi_issue_cmd_ppc(struct mfi_softc *sc,uint32_t bus_add,uint32_t > frame_cnt) > +mfi_issue_cmd_ppc(struct mfi_softc *sc, bus_addr_t bus_add, uint32_t > frame_cnt) > { > - MFI_WRITE4(sc, MFI_IQP, (bus_add |frame_cnt <<1)|1 ); > + if (sc->mfi_flags & MFI_FLAGS_SKINNY) { > + MFI_WRITE4(sc, MFI_IQPL, (bus_add | frame_cnt <<1)|1 ); > + MFI_WRITE4(sc, MFI_IQPH, 0x00000000); > + } else { > + MFI_WRITE4(sc, MFI_IQP, (bus_add | frame_cnt <<1)|1 ); > + } > } > > -static int > +int > mfi_transition_firmware(struct mfi_softc *sc) > { > - int32_t fw_state, cur_state; > + uint32_t fw_state, cur_state; > int max_wait, i; > + uint32_t cur_abs_reg_val = 0; > + uint32_t prev_abs_reg_val = 0; > > - fw_state = sc->mfi_read_fw_status(sc)& MFI_FWSTATE_MASK; > + cur_abs_reg_val = sc->mfi_read_fw_status(sc); > + fw_state = cur_abs_reg_val & MFI_FWSTATE_MASK; > while (fw_state != MFI_FWSTATE_READY) { > if (bootverbose) > device_printf(sc->mfi_dev, "Waiting for firmware to " > @@ -244,36 +282,62 @@ mfi_transition_firmware(struct mfi_softc > device_printf(sc->mfi_dev, "Firmware fault\n"); > return (ENXIO); > case MFI_FWSTATE_WAIT_HANDSHAKE: > - MFI_WRITE4(sc, MFI_IDB, MFI_FWINIT_CLEAR_HANDSHAKE); > - max_wait = 2; > + if (sc->mfi_flags & MFI_FLAGS_SKINNY || sc->mfi_flags & > MFI_FLAGS_TBOLT) > + MFI_WRITE4(sc, MFI_SKINNY_IDB, MFI_FWINIT_CLEAR_HANDSHAKE); > + else > + MFI_WRITE4(sc, MFI_IDB, MFI_FWINIT_CLEAR_HANDSHAKE); > + max_wait = MFI_RESET_WAIT_TIME; > break; > case MFI_FWSTATE_OPERATIONAL: > - MFI_WRITE4(sc, MFI_IDB, MFI_FWINIT_READY); > - max_wait = 10; > + if (sc->mfi_flags & MFI_FLAGS_SKINNY || sc->mfi_flags & > MFI_FLAGS_TBOLT) > + MFI_WRITE4(sc, MFI_SKINNY_IDB, 7); > + else > + MFI_WRITE4(sc, MFI_IDB, MFI_FWINIT_READY); > + max_wait = MFI_RESET_WAIT_TIME; > break; > case MFI_FWSTATE_UNDEFINED: > case MFI_FWSTATE_BB_INIT: > - max_wait = 2; > + max_wait = MFI_RESET_WAIT_TIME; > + break; > + case MFI_FWSTATE_FW_INIT_2: > + max_wait = MFI_RESET_WAIT_TIME; > break; > case MFI_FWSTATE_FW_INIT: > - case MFI_FWSTATE_DEVICE_SCAN: > case MFI_FWSTATE_FLUSH_CACHE: > - max_wait = 20; > + max_wait = MFI_RESET_WAIT_TIME; > + break; > + case MFI_FWSTATE_DEVICE_SCAN: > + max_wait = MFI_RESET_WAIT_TIME; /* wait for 180 seconds */ > + prev_abs_reg_val = cur_abs_reg_val; > + break; > + case MFI_FWSTATE_BOOT_MESSAGE_PENDING: > + if (sc->mfi_flags & MFI_FLAGS_SKINNY || sc->mfi_flags & > MFI_FLAGS_TBOLT) > + MFI_WRITE4(sc, MFI_SKINNY_IDB, MFI_FWINIT_HOTPLUG); > + else > + MFI_WRITE4(sc, MFI_IDB, MFI_FWINIT_HOTPLUG); > + max_wait = MFI_RESET_WAIT_TIME; > break; > default: > - device_printf(sc->mfi_dev,"Unknown firmware state %d\n", > + device_printf(sc->mfi_dev, "Unknown firmware state %#x\n", > fw_state); > return (ENXIO); > } > for (i = 0; i < (max_wait * 10); i++) { > - fw_state = sc->mfi_read_fw_status(sc) & MFI_FWSTATE_MASK; > + cur_abs_reg_val = sc->mfi_read_fw_status(sc); > + fw_state = cur_abs_reg_val & MFI_FWSTATE_MASK; > if (fw_state == cur_state) > DELAY(100000); > else > break; > } > + if (fw_state == MFI_FWSTATE_DEVICE_SCAN) { > + /* Check the device scanning progress */ > + if (prev_abs_reg_val != cur_abs_reg_val) { > + continue; > + } > + } > if (fw_state == cur_state) { > - device_printf(sc->mfi_dev, "firmware stuck in state " > + device_printf(sc->mfi_dev, "Firmware stuck in state " > "%#x\n", fw_state); > return (ENXIO); > } > @@ -282,26 +346,36 @@ mfi_transition_firmware(struct mfi_softc > } > > static void > -mfi_addr32_cb(void *arg, bus_dma_segment_t *segs, int nsegs, int error) > +mfi_addr_cb(void *arg, bus_dma_segment_t *segs, int nsegs, int error) > { > - uint32_t *addr; > + bus_addr_t *addr; > > addr = arg; > *addr = segs[0].ds_addr; > } > > + > int > mfi_attach(struct mfi_softc *sc) > { > uint32_t status; > int error, commsz, framessz, sensesz; > int frames, unit, max_fw_sge; > + uint32_t tb_mem_size = 0; > > - device_printf(sc->mfi_dev, "Megaraid SAS driver Ver 3.00 \n"); > + if (sc == NULL) > + return EINVAL; > + > + device_printf(sc->mfi_dev, "Megaraid SAS driver Ver %s \n", > + MEGASAS_VERSION); > > mtx_init(&sc->mfi_io_lock, "MFI I/O lock", NULL, MTX_DEF); > sx_init(&sc->mfi_config_lock, "MFI config"); > TAILQ_INIT(&sc->mfi_ld_tqh); > + TAILQ_INIT(&sc->mfi_syspd_tqh); > + TAILQ_INIT(&sc->mfi_evt_queue); > + TASK_INIT(&sc->mfi_evt_task, 0, mfi_handle_evt, sc); > + TASK_INIT(&sc->mfi_map_sync_task, 0, mfi_handle_map_sync, sc); > TAILQ_INIT(&sc->mfi_aen_pids); > TAILQ_INIT(&sc->mfi_cam_ccbq); > > @@ -310,15 +384,29 @@ mfi_attach(struct mfi_softc *sc) > mfi_initq_busy(sc); > mfi_initq_bio(sc); > > + sc->adpreset = 0; > + sc->last_seq_num = 0; > + sc->disableOnlineCtrlReset = 1; > + sc->issuepend_done = 1; > + sc->hw_crit_error = 0; > + > if (sc->mfi_flags & MFI_FLAGS_1064R) { > sc->mfi_enable_intr = mfi_enable_intr_xscale; > sc->mfi_read_fw_status = mfi_read_fw_status_xscale; > sc->mfi_check_clear_intr = mfi_check_clear_intr_xscale; > sc->mfi_issue_cmd = mfi_issue_cmd_xscale; > - } > - else { > + } else if (sc->mfi_flags & MFI_FLAGS_TBOLT) { > + sc->mfi_enable_intr = mfi_tbolt_enable_intr_ppc; > + sc->mfi_disable_intr = mfi_tbolt_disable_intr_ppc; > + sc->mfi_read_fw_status = mfi_tbolt_read_fw_status_ppc; > + sc->mfi_check_clear_intr = mfi_tbolt_check_clear_intr_ppc; > + sc->mfi_issue_cmd = mfi_tbolt_issue_cmd_ppc; > + sc->mfi_adp_reset = mfi_tbolt_adp_reset; > + sc->mfi_tbolt = 1; > + TAILQ_INIT(&sc->mfi_cmd_tbolt_tqh); > + } else { > sc->mfi_enable_intr = mfi_enable_intr_ppc; > - sc->mfi_read_fw_status = mfi_read_fw_status_ppc; > + sc->mfi_read_fw_status = mfi_read_fw_status_ppc; > sc->mfi_check_clear_intr = mfi_check_clear_intr_ppc; > sc->mfi_issue_cmd = mfi_issue_cmd_ppc; > } > @@ -331,6 +419,32 @@ mfi_attach(struct mfi_softc *sc) > return (ENXIO); > } > > + /* Start: LSIP200113393 */ > + if (bus_dma_tag_create( sc->mfi_parent_dmat, /* parent */ > + 1, 0, /* algnmnt, boundary */ > + BUS_SPACE_MAXADDR_32BIT,/* lowaddr */ > + BUS_SPACE_MAXADDR, /* highaddr */ > + NULL, NULL, /* filter, filterarg */ > + MEGASAS_MAX_NAME*sizeof(bus_addr_t), /* maxsize */ > + 1, /* msegments */ > + MEGASAS_MAX_NAME*sizeof(bus_addr_t), /* maxsegsize */ > + 0, /* flags */ > + NULL, NULL, /* lockfunc, lockarg */ > + &sc->verbuf_h_dmat)) { > + device_printf(sc->mfi_dev, "Cannot allocate verbuf_h_dmat DMA tag\n"); > + return (ENOMEM); > + } > + if (bus_dmamem_alloc(sc->verbuf_h_dmat, (void **)&sc->verbuf, > + BUS_DMA_NOWAIT, &sc->verbuf_h_dmamap)) { > + device_printf(sc->mfi_dev, "Cannot allocate verbuf_h_dmamap memory\n"); > + return (ENOMEM); > + } > + bzero(sc->verbuf, MEGASAS_MAX_NAME*sizeof(bus_addr_t)); > + bus_dmamap_load(sc->verbuf_h_dmat, sc->verbuf_h_dmamap, > + sc->verbuf, MEGASAS_MAX_NAME*sizeof(bus_addr_t), > + mfi_addr_cb, &sc->verbuf_h_busaddr, 0); > + /* End: LSIP200113393 */ > + > /* > * Get information needed for sizing the contiguous memory for the > * frame pool. Size down the sgl parameter since we know that > @@ -341,8 +455,102 @@ mfi_attach(struct mfi_softc *sc) > status = sc->mfi_read_fw_status(sc); > sc->mfi_max_fw_cmds = status & MFI_FWSTATE_MAXCMD_MASK; > max_fw_sge = (status & MFI_FWSTATE_MAXSGL_MASK) >> 16; > - sc->mfi_max_sge = min(max_fw_sge, ((MAXPHYS / PAGE_SIZE) + 1)); > + sc->mfi_max_sge = min(max_fw_sge, ((MFI_MAXPHYS / PAGE_SIZE) + 1)); > + > + /* ThunderBolt Support get the contiguous memory */ > + > + if (sc->mfi_flags & MFI_FLAGS_TBOLT) { > + mfi_tbolt_init_globals(sc); > + device_printf(sc->mfi_dev, "MaxCmd = %x MaxSgl = %x state = %x \n", > + sc->mfi_max_fw_cmds, sc->mfi_max_sge, status); > + tb_mem_size = mfi_tbolt_get_memory_requirement(sc); > + > + if (bus_dma_tag_create( sc->mfi_parent_dmat, /* parent */ > + 1, 0, /* algnmnt, boundary */ > + BUS_SPACE_MAXADDR_32BIT,/* lowaddr */ > + BUS_SPACE_MAXADDR, /* highaddr */ > + NULL, NULL, /* filter, filterarg */ > + tb_mem_size, /* maxsize */ > + 1, /* msegments */ > + tb_mem_size, /* maxsegsize */ > + 0, /* flags */ > + NULL, NULL, /* lockfunc, lockarg */ > + &sc->mfi_tb_dmat)) { > + device_printf(sc->mfi_dev, "Cannot allocate comms DMA tag\n"); > + return (ENOMEM); > + } > + if (bus_dmamem_alloc(sc->mfi_tb_dmat, (void > **)&sc->request_message_pool, > + BUS_DMA_NOWAIT, &sc->mfi_tb_dmamap)) { > + device_printf(sc->mfi_dev, "Cannot allocate comms memory\n"); > + return (ENOMEM); > + } > + bzero(sc->request_message_pool, tb_mem_size); > + bus_dmamap_load(sc->mfi_tb_dmat, sc->mfi_tb_dmamap, > + sc->request_message_pool, tb_mem_size, mfi_addr_cb, &sc->mfi_tb_busaddr, > 0); > + > + /* For ThunderBolt memory init */ > + if (bus_dma_tag_create( sc->mfi_parent_dmat, /* parent */ > + 0x100, 0, /* alignmnt, boundary */ > + BUS_SPACE_MAXADDR_32BIT,/* lowaddr */ > + BUS_SPACE_MAXADDR, /* highaddr */ > + NULL, NULL, /* filter, filterarg */ > + MFI_FRAME_SIZE, /* maxsize */ > + 1, /* msegments */ > + MFI_FRAME_SIZE, /* maxsegsize */ > + 0, /* flags */ > + NULL, NULL, /* lockfunc, lockarg */ > + &sc->mfi_tb_init_dmat)) { > + device_printf(sc->mfi_dev, "Cannot allocate init DMA tag\n"); > + return (ENOMEM); > + } > + if (bus_dmamem_alloc(sc->mfi_tb_init_dmat, (void **)&sc->mfi_tb_init, > + BUS_DMA_NOWAIT, &sc->mfi_tb_init_dmamap)) { > + device_printf(sc->mfi_dev, "Cannot allocate init memory\n"); > + return (ENOMEM); > + } > + bzero(sc->mfi_tb_init, MFI_FRAME_SIZE); > + bus_dmamap_load(sc->mfi_tb_init_dmat, sc->mfi_tb_init_dmamap, > + sc->mfi_tb_init, MFI_FRAME_SIZE, mfi_addr_cb, > + &sc->mfi_tb_init_busaddr, 0); > + if (mfi_tbolt_init_desc_pool(sc, sc->request_message_pool, > + tb_mem_size)) { > + device_printf(sc->mfi_dev, > + "Thunderbolt pool preparation error\n"); > + return 0; > + } > > + /* > + Allocate DMA memory mapping for MPI2 IOC Init descriptor, > + we are taking it diffrent from what we have allocated for Request > + and reply descriptors to avoid confusion later > + */ > + tb_mem_size = sizeof(struct MPI2_IOC_INIT_REQUEST); > + if (bus_dma_tag_create( sc->mfi_parent_dmat, /* parent */ > + 1, 0, /* algnmnt, boundary */ > + BUS_SPACE_MAXADDR_32BIT,/* lowaddr */ > + BUS_SPACE_MAXADDR, /* highaddr */ > + NULL, NULL, /* filter, filterarg */ > + tb_mem_size, /* maxsize */ > + 1, /* msegments */ > + tb_mem_size, /* maxsegsize */ > + 0, /* flags */ > + NULL, NULL, /* lockfunc, lockarg */ > + &sc->mfi_tb_ioc_init_dmat)) { > + device_printf(sc->mfi_dev, > + "Cannot allocate comms DMA tag\n"); > + return (ENOMEM); > + } > + if (bus_dmamem_alloc(sc->mfi_tb_ioc_init_dmat, > + (void **)&sc->mfi_tb_ioc_init_desc, > + BUS_DMA_NOWAIT, &sc->mfi_tb_ioc_init_dmamap)) { > + device_printf(sc->mfi_dev, "Cannot allocate comms memory\n"); > + return (ENOMEM); > + } > + bzero(sc->mfi_tb_ioc_init_desc, tb_mem_size); > + bus_dmamap_load(sc->mfi_tb_ioc_init_dmat, sc->mfi_tb_ioc_init_dmamap, > + sc->mfi_tb_ioc_init_desc, tb_mem_size, mfi_addr_cb, > + &sc->mfi_tb_ioc_init_busaddr, 0); > + } > /* > * Create the dma tag for data buffers. Used both for block I/O > * and for various internal data queries. > @@ -392,8 +600,7 @@ mfi_attach(struct mfi_softc *sc) > } > bzero(sc->mfi_comms, commsz); > bus_dmamap_load(sc->mfi_comms_dmat, sc->mfi_comms_dmamap, > - sc->mfi_comms, commsz, mfi_addr32_cb, &sc->mfi_comms_busaddr, 0); > - > + sc->mfi_comms, commsz, mfi_addr_cb, &sc->mfi_comms_busaddr, 0); > /* > * Allocate DMA memory for the command frames. Keep them in the > * lower 4GB for efficiency. Calculate the size of the commands at > @@ -410,6 +617,8 @@ mfi_attach(struct mfi_softc *sc) > } else { > sc->mfi_sge_size = sizeof(struct mfi_sg32); > } > + if (sc->mfi_flags & MFI_FLAGS_SKINNY) > + sc->mfi_sge_size = sizeof(struct mfi_sg_skinny); > frames = (sc->mfi_sge_size * sc->mfi_max_sge - 1) / MFI_FRAME_SIZE + 2; > sc->mfi_cmd_size = frames * MFI_FRAME_SIZE; > framessz = sc->mfi_cmd_size * sc->mfi_max_fw_cmds; > @@ -434,8 +643,7 @@ mfi_attach(struct mfi_softc *sc) > } > bzero(sc->mfi_frames, framessz); > bus_dmamap_load(sc->mfi_frames_dmat, sc->mfi_frames_dmamap, > - sc->mfi_frames, framessz, mfi_addr32_cb, &sc->mfi_frames_busaddr,0); > - > + sc->mfi_frames, framessz, mfi_addr_cb, &sc->mfi_frames_busaddr,0); > /* > * Allocate DMA memory for the frame sense data. Keep them in the > * lower 4GB for efficiency > @@ -461,39 +669,46 @@ mfi_attach(struct mfi_softc *sc) > return (ENOMEM); > } > bus_dmamap_load(sc->mfi_sense_dmat, sc->mfi_sense_dmamap, > - sc->mfi_sense, sensesz, mfi_addr32_cb, &sc->mfi_sense_busaddr, 0); > - > + sc->mfi_sense, sensesz, mfi_addr_cb, &sc->mfi_sense_busaddr, 0); > if ((error = mfi_alloc_commands(sc)) != 0) > return (error); > > - if ((error = mfi_comms_init(sc)) != 0) > - return (error); > + /* Before moving the FW to operational state, check whether > + * hostmemory is required by the FW or not > + */ > > - if ((error = mfi_get_controller_info(sc)) != 0) > - return (error); > + /* ThunderBolt MFI_IOC2 INIT */ > + if (sc->mfi_flags & MFI_FLAGS_TBOLT) { > + sc->mfi_disable_intr(sc); > + if ((error = mfi_tbolt_init_MFI_queue(sc)) != 0) { > + device_printf(sc->mfi_dev, > + "TB Init has failed with error %d\n",error); > + return error; > + } > > - mtx_lock(&sc->mfi_io_lock); > - if ((error = mfi_aen_setup(sc, 0), 0) != 0) { > - mtx_unlock(&sc->mfi_io_lock); > - return (error); > - } > - mtx_unlock(&sc->mfi_io_lock); > + if ((error = mfi_tbolt_alloc_cmd(sc)) != 0) > + return error; > + if (bus_setup_intr(sc->mfi_dev, sc->mfi_irq, > + INTR_MPSAFE|INTR_TYPE_BIO, NULL, mfi_intr_tbolt, sc, > + &sc->mfi_intr)) { > + device_printf(sc->mfi_dev, "Cannot set up interrupt\n"); > + return (EINVAL); > + } > + sc->mfi_enable_intr(sc); > + } else { > + if ((error = mfi_comms_init(sc)) != 0) > + return (error); > > - /* > - * Set up the interrupt handler. XXX This should happen in > - * mfi_pci.c > - */ > - sc->mfi_irq_rid = 0; > - if ((sc->mfi_irq = bus_alloc_resource_any(sc->mfi_dev, SYS_RES_IRQ, > - &sc->mfi_irq_rid, RF_SHAREABLE | RF_ACTIVE)) == NULL) { > - device_printf(sc->mfi_dev, "Cannot allocate interrupt\n"); > - return (EINVAL); > - } > - if (bus_setup_intr(sc->mfi_dev, sc->mfi_irq, INTR_MPSAFE|INTR_TYPE_BIO, > - NULL, mfi_intr, sc, &sc->mfi_intr)) { > - device_printf(sc->mfi_dev, "Cannot set up interrupt\n"); > - return (EINVAL); > + if (bus_setup_intr(sc->mfi_dev, sc->mfi_irq, > + INTR_MPSAFE|INTR_TYPE_BIO, NULL, mfi_intr, sc, &sc->mfi_intr)) { > + device_printf(sc->mfi_dev, "Cannot set up interrupt\n"); > + return (EINVAL); > + } > + sc->mfi_enable_intr(sc); > } > + if ((error = mfi_get_controller_info(sc)) != 0) > + return (error); > + sc->disableOnlineCtrlReset = 0; > > /* Register a config hook to probe the bus for arrays */ > sc->mfi_ich.ich_func = mfi_startup; > @@ -503,6 +718,10 @@ mfi_attach(struct mfi_softc *sc) > "hook\n"); > return (EINVAL); > } > + if ((error = mfi_aen_setup(sc, 0), 0) != 0) { > + mtx_unlock(&sc->mfi_io_lock); > + return (error); > + } > > /* > * Register a shutdown handler. > @@ -541,6 +760,10 @@ mfi_attach(struct mfi_softc *sc) > callout_reset(&sc->mfi_watchdog_callout, MFI_CMD_TIMEOUT * hz, > mfi_timeout, sc); > > + if (sc->mfi_flags & MFI_FLAGS_TBOLT) { > + mfi_tbolt_sync_map_info(sc); > + } > + > return (0); > } > > @@ -574,8 +797,11 @@ mfi_alloc_commands(struct mfi_softc *sc) > cm->cm_sc = sc; > cm->cm_index = i; > if (bus_dmamap_create(sc->mfi_buffer_dmat, 0, > - &cm->cm_dmamap) == 0) > + &cm->cm_dmamap) == 0) { > + mtx_lock(&sc->mfi_io_lock); > mfi_release_command(cm); > + mtx_unlock(&sc->mfi_io_lock); > + } > else > break; > sc->mfi_total_cmds++; > @@ -590,6 +816,8 @@ mfi_release_command(struct mfi_command * > struct mfi_frame_header *hdr; > uint32_t *hdr_data; > > + mtx_assert(&cm->cm_sc->mfi_io_lock, MA_OWNED); > + > /* > * Zero out the important fields of the frame, but make sure the > * context field is preserved. For efficiency, handle the fields > @@ -614,24 +842,31 @@ mfi_release_command(struct mfi_command * > cm->cm_data = NULL; > cm->cm_sg = 0; > cm->cm_total_frame_size = 0; > + cm->retry_for_fw_reset = 0; > > mfi_enqueue_free(cm); > } > > -static int > -mfi_dcmd_command(struct mfi_softc *sc, struct mfi_command **cmp, uint32_t > opcode, > - void **bufp, size_t bufsize) > +int > +mfi_dcmd_command(struct mfi_softc *sc, struct mfi_command **cmp, > + uint32_t opcode, void **bufp, size_t bufsize) > { > struct mfi_command *cm; > struct mfi_dcmd_frame *dcmd; > void *buf = NULL; > - > + uint32_t context = 0; > + > mtx_assert(&sc->mfi_io_lock, MA_OWNED); > - > + > cm = mfi_dequeue_free(sc); > if (cm == NULL) > return (EBUSY); > > + /* Zero out the MFI frame */ > + context = cm->cm_frame->header.context; > + bzero(cm->cm_frame, sizeof(union mfi_frame)); > + cm->cm_frame->header.context = context; > + > if ((bufsize > 0) && (bufp != NULL)) { > if (*bufp == NULL) { > buf = malloc(bufsize, M_MFIBUF, M_NOWAIT|M_ZERO); > @@ -651,6 +886,7 @@ mfi_dcmd_command(struct mfi_softc *sc, s > dcmd->header.timeout = 0; > dcmd->header.flags = 0; > dcmd->header.data_len = bufsize; > + dcmd->header.scsi_status = 0; > dcmd->opcode = opcode; > cm->cm_sg = &dcmd->sgl; > cm->cm_total_frame_size = MFI_DCMD_FRAME_SIZE; > @@ -672,11 +908,17 @@ mfi_comms_init(struct mfi_softc *sc) > struct mfi_init_frame *init; > struct mfi_init_qinfo *qinfo; > int error; > + uint32_t context = 0; > > mtx_lock(&sc->mfi_io_lock); > if ((cm = mfi_dequeue_free(sc)) == NULL) > return (EBUSY); > > + /* Zero out the MFI frame */ > + context = cm->cm_frame->header.context; > + bzero(cm->cm_frame, sizeof(union mfi_frame)); > + cm->cm_frame->header.context = context; > + > /* > * Abuse the SG list area of the frame to hold the init_qinfo > * object; > @@ -737,9 +979,11 @@ mfi_get_controller_info(struct mfi_softc > BUS_DMASYNC_POSTREAD); > bus_dmamap_unload(sc->mfi_buffer_dmat, cm->cm_dmamap); > > - max_sectors_1 = (1 << ci->stripe_sz_ops.min) * ci->max_strips_per_io; > + max_sectors_1 = (1 << ci->stripe_sz_ops.max) * ci->max_strips_per_io; > max_sectors_2 = ci->max_request_size; > sc->mfi_max_io = min(max_sectors_1, max_sectors_2); > + sc->disableOnlineCtrlReset = > + ci->properties.OnOffProperties.disableOnlineCtrlReset; > > out: > if (ci) > @@ -756,6 +1000,7 @@ mfi_get_log_state(struct mfi_softc *sc, > struct mfi_command *cm = NULL; > int error; > > + mtx_lock(&sc->mfi_io_lock); > error = mfi_dcmd_command(sc, &cm, MFI_DCMD_CTRL_EVENT_GETINFO, > (void **)log_state, sizeof(**log_state)); > if (error) > @@ -774,11 +1019,12 @@ mfi_get_log_state(struct mfi_softc *sc, > out: > if (cm) > mfi_release_command(cm); > + mtx_unlock(&sc->mfi_io_lock); > > return (error); > } > > -static int > +int > mfi_aen_setup(struct mfi_softc *sc, uint32_t seq_start) > { > struct mfi_evt_log_state *log_state = NULL; > @@ -788,10 +1034,11 @@ mfi_aen_setup(struct mfi_softc *sc, uint > > class_locale.members.reserved = 0; > class_locale.members.locale = mfi_event_locale; > - class_locale.members.class = mfi_event_class; > + class_locale.members.evt_class = mfi_event_class; > > if (seq_start == 0) { > error = mfi_get_log_state(sc, &log_state); > + sc->mfi_boot_seq_num = log_state->boot_seq_num; > if (error) { > if (log_state) > free(log_state, M_MFIBUF); > @@ -813,7 +1060,7 @@ mfi_aen_setup(struct mfi_softc *sc, uint > return 0; > } > > -static int > +int > mfi_wait_command(struct mfi_softc *sc, struct mfi_command *cm) > { > > @@ -886,6 +1133,64 @@ mfi_free(struct mfi_softc *sc) > if (sc->mfi_comms_dmat != NULL) > bus_dma_tag_destroy(sc->mfi_comms_dmat); > > + /* ThunderBolt contiguous memory free here */ > + if (sc->mfi_flags & MFI_FLAGS_TBOLT) { > + if (sc->mfi_tb_busaddr != 0) > + bus_dmamap_unload(sc->mfi_tb_dmat, sc->mfi_tb_dmamap); > + if (sc->request_message_pool != NULL) > + bus_dmamem_free(sc->mfi_tb_dmat, sc->request_message_pool, > + sc->mfi_tb_dmamap); > + if (sc->mfi_tb_dmat != NULL) > + bus_dma_tag_destroy(sc->mfi_tb_dmat); > + > + /* Version buffer memory free */ > + /* Start LSIP200113393 */ > + if (sc->verbuf_h_busaddr != 0) > + bus_dmamap_unload(sc->verbuf_h_dmat, sc->verbuf_h_dmamap); > + if (sc->verbuf != NULL) > + bus_dmamem_free(sc->verbuf_h_dmat, sc->verbuf, > + sc->verbuf_h_dmamap); > + if (sc->verbuf_h_dmat != NULL) > + bus_dma_tag_destroy(sc->verbuf_h_dmat); > + > + /* End LSIP200113393 */ > + /* ThunderBolt INIT packet memory Free */ > + if (sc->mfi_tb_init_busaddr != 0) > + bus_dmamap_unload(sc->mfi_tb_init_dmat, sc->mfi_tb_init_dmamap); > + if (sc->mfi_tb_init != NULL) > + bus_dmamem_free(sc->mfi_tb_init_dmat, sc->mfi_tb_init, > + sc->mfi_tb_init_dmamap); > + if (sc->mfi_tb_init_dmat != NULL) > + bus_dma_tag_destroy(sc->mfi_tb_init_dmat); > + > + /* ThunderBolt IOC Init Desc memory free here */ > + if (sc->mfi_tb_ioc_init_busaddr != 0) > + bus_dmamap_unload(sc->mfi_tb_ioc_init_dmat, > + sc->mfi_tb_ioc_init_dmamap); > + if (sc->mfi_tb_ioc_init_desc != NULL) > + bus_dmamem_free(sc->mfi_tb_ioc_init_dmat, > + sc->mfi_tb_ioc_init_desc, > + sc->mfi_tb_ioc_init_dmamap); > + if (sc->mfi_tb_ioc_init_dmat != NULL) > + bus_dma_tag_destroy(sc->mfi_tb_ioc_init_dmat); > + for (int i = 0; i < sc->mfi_max_fw_cmds; i++) { > + if (sc->mfi_cmd_pool_tbolt != NULL) { > + if (sc->mfi_cmd_pool_tbolt[i] != NULL) { > + free(sc->mfi_cmd_pool_tbolt[i], > + M_MFIBUF); > + sc->mfi_cmd_pool_tbolt[i] = NULL; > + } > + } > + } > + if (sc->mfi_cmd_pool_tbolt != NULL) { > + free(sc->mfi_cmd_pool_tbolt, M_MFIBUF); > + sc->mfi_cmd_pool_tbolt = NULL; > + } > + if (sc->request_desc_pool != NULL) { > + free(sc->request_desc_pool, M_MFIBUF); > + sc->request_desc_pool = NULL; > + } > + } > if (sc->mfi_buffer_dmat != NULL) > bus_dma_tag_destroy(sc->mfi_buffer_dmat); > if (sc->mfi_parent_dmat != NULL) > @@ -912,6 +1217,8 @@ mfi_startup(void *arg) > sx_xlock(&sc->mfi_config_lock); > mtx_lock(&sc->mfi_io_lock); > mfi_ldprobe(sc); > + if (sc->mfi_flags & MFI_FLAGS_SKINNY) > + mfi_syspdprobe(sc); > mtx_unlock(&sc->mfi_io_lock); > sx_xunlock(&sc->mfi_config_lock); > } > @@ -928,12 +1235,7 @@ mfi_intr(void *arg) > if (sc->mfi_check_clear_intr(sc)) > return; > > - /* > - * Do a dummy read to flush the interrupt ACK that we just performed, > - * ensuring that everything is really, truly consistent. > - */ > - (void)sc->mfi_read_fw_status(sc); > - > +restart: > pi = sc->mfi_comms->hw_pi; > ci = sc->mfi_comms->hw_ci; > mtx_lock(&sc->mfi_io_lock); > @@ -958,6 +1260,14 @@ mfi_intr(void *arg) > mfi_startio(sc); > mtx_unlock(&sc->mfi_io_lock); > > + /* > + * Dummy read to flush the bus; this ensures that the indexes are up > + * to date. Restart processing if more commands have come it. > + */ > + (void)sc->mfi_read_fw_status(sc); > + if (pi != sc->mfi_comms->hw_pi) > + goto restart; > + > return; > } > > @@ -978,6 +1288,9 @@ mfi_shutdown(struct mfi_softc *sc) > if (sc->mfi_aen_cm != NULL) > mfi_abort(sc, sc->mfi_aen_cm); > > + if (sc->mfi_map_sync_cm != NULL) > + mfi_abort(sc, sc->mfi_map_sync_cm); > + > dcmd = &cm->cm_frame->dcmd; > dcmd->header.flags = MFI_FRAME_DIR_NONE; > cm->cm_flags = MFI_CMD_POLLED; > @@ -993,6 +1306,81 @@ mfi_shutdown(struct mfi_softc *sc) > } > > static void > +mfi_syspdprobe(struct mfi_softc *sc) > +{ > + struct mfi_frame_header *hdr; > + struct mfi_command *cm = NULL; > + struct mfi_pd_list *pdlist = NULL; > + struct mfi_system_pd *syspd, *tmp; > + int error, i, found; > + > + sx_assert(&sc->mfi_config_lock, SA_XLOCKED); > + mtx_assert(&sc->mfi_io_lock, MA_OWNED); > + /* Add SYSTEM PD's */ > + error = mfi_dcmd_command(sc, &cm, MFI_DCMD_PD_LIST_QUERY, > + (void **)&pdlist, sizeof(*pdlist)); > + if (error) { > + device_printf(sc->mfi_dev, > + "Error while forming SYSTEM PD list\n"); > + goto out; > + } > + > + cm->cm_flags = MFI_CMD_DATAIN | MFI_CMD_POLLED; > + cm->cm_frame->dcmd.mbox[0] = MR_PD_QUERY_TYPE_EXPOSED_TO_HOST; > + cm->cm_frame->dcmd.mbox[1] = 0; > + if (mfi_mapcmd(sc, cm) != 0) { > + device_printf(sc->mfi_dev, > + "Failed to get syspd device listing\n"); > + goto out; > + } > + bus_dmamap_sync(sc->mfi_buffer_dmat,cm->cm_dmamap, > + BUS_DMASYNC_POSTREAD); > + bus_dmamap_unload(sc->mfi_buffer_dmat, cm->cm_dmamap); > + hdr = &cm->cm_frame->header; > + if (hdr->cmd_status != MFI_STAT_OK) { > + device_printf(sc->mfi_dev, > + "MFI_DCMD_PD_LIST_QUERY failed %x\n", hdr->cmd_status); > + goto out; > + } > + /* Get each PD and add it to the system */ > + for (i = 0; i < pdlist->count; i++) { > + if (pdlist->addr[i].device_id == > + pdlist->addr[i].encl_device_id) > + continue; > + found = 0; > + TAILQ_FOREACH(syspd, &sc->mfi_syspd_tqh, pd_link) { > + if (syspd->pd_id == pdlist->addr[i].device_id) > + found = 1; > + } > + if (found == 0) > + mfi_add_sys_pd(sc, pdlist->addr[i].device_id); > + } > + /* Delete SYSPD's whose state has been changed */ > + TAILQ_FOREACH_SAFE(syspd, &sc->mfi_syspd_tqh, pd_link, tmp) { > + found = 0; > + for (i = 0; i < pdlist->count; i++) { > + if (syspd->pd_id == pdlist->addr[i].device_id) > + found = 1; > + } > + if (found == 0) { > + printf("DELETE\n"); > + mtx_unlock(&sc->mfi_io_lock); > + mtx_lock(&Giant); > + device_delete_child(sc->mfi_dev, syspd->pd_dev); > + mtx_unlock(&Giant); > + mtx_lock(&sc->mfi_io_lock); > + } > + } > +out: > + if (pdlist) > + free(pdlist, M_MFIBUF); > + if (cm) > + mfi_release_command(cm); > + > + return; > +} > + > +static void > mfi_ldprobe(struct mfi_softc *sc) > { > struct mfi_frame_header *hdr; > @@ -1086,10 +1474,124 @@ format_class(int8_t class) > static void > mfi_decode_evt(struct mfi_softc *sc, struct mfi_evt_detail *detail) > { > + struct mfi_system_pd *syspd = NULL; > > device_printf(sc->mfi_dev, "%d (%s/0x%04x/%s) - %s\n", detail->seq, > - format_timestamp(detail->time), detail->class.members.locale, > - format_class(detail->class.members.class), detail->description); > + format_timestamp(detail->time), detail->evt_class.members.locale, > + format_class(detail->evt_class.members.evt_class), > + detail->description); > + > + /* Don't act on old AEN's or while shutting down */ > + if (detail->seq < sc->mfi_boot_seq_num || sc->mfi_detaching) > + return; > + > + switch (detail->arg_type) { > + case MR_EVT_ARGS_NONE: > + if (detail->code == MR_EVT_CTRL_HOST_BUS_SCAN_REQUESTED) { > + device_printf(sc->mfi_dev, "HostBus scan raised\n"); > + if (mfi_detect_jbod_change) { > + /* > + * Probe for new SYSPD's and Delete > + * invalid SYSPD's > + */ > + sx_xlock(&sc->mfi_config_lock); > + mtx_lock(&sc->mfi_io_lock); > + mfi_syspdprobe(sc); > + mtx_unlock(&sc->mfi_io_lock); > + sx_xunlock(&sc->mfi_config_lock); > + } > + } > + break; > + case MR_EVT_ARGS_LD_STATE: > + /* During load time driver reads all the events starting > + * from the one that has been logged after shutdown. Avoid > + * these old events. > + */ > + if (detail->args.ld_state.new_state == MFI_LD_STATE_OFFLINE ) { > + /* Remove the LD */ > + struct mfi_disk *ld; > + TAILQ_FOREACH(ld, &sc->mfi_ld_tqh, ld_link) { > + if (ld->ld_id == > + detail->args.ld_state.ld.target_id) > + break; > + } > + /* > + Fix: for kernel panics when SSCD is removed > + KASSERT(ld != NULL, ("volume dissappeared")); > + */ > + if (ld != NULL) { > + mtx_lock(&Giant); > + device_delete_child(sc->mfi_dev, ld->ld_dev); > + mtx_unlock(&Giant); > + } > + } > + break; > > *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** > _______________________________________________ > svn-src-stable@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/svn-src-stable > To unsubscribe, send any mail to "svn-src-stable-unsubscribe@freebsd.org" > From owner-svn-src-stable-7@FreeBSD.ORG Sat May 19 00:38:06 2012 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 43EE7106566C; Sat, 19 May 2012 00:38:06 +0000 (UTC) (envelope-from oliver.pntr@gmail.com) Received: from mail-yx0-f182.google.com (mail-yx0-f182.google.com [209.85.213.182]) by mx1.freebsd.org (Postfix) with ESMTP id 97D818FC0A; Sat, 19 May 2012 00:38:05 +0000 (UTC) Received: by yenl8 with SMTP id l8so4251005yen.13 for ; Fri, 18 May 2012 17:37:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=KnHjD09mNOeX2L21L8cZgH+Nd+kpchfoieR8EMIVvO8=; b=NrgqnSn05Uv3T3bRiAQ8VJNsA8j8hyAkDlV1cVSDnSxmWYBgh9rGKmR7EUXJ8D1SU+ pkTqGXwKsWRT4B9RbyvnDgOwcGgIo7R2IflBI0EBBNhtMrhq/6I8RoNO38nOm/tG6fLU RDdnzRBnJULHUD287IBo1CMwjSgVzgQRpz0T+XWqBHcxD60rnIjJkb9gB3QHEECQg7ng /qnkdUz+8SFJP+22/vv+lYArrCO5DB3yVj7Uam+dImRLyWqqc+ptPeMIwpSy1S8s9Eub zSUrwZlXh8wxbT1kIA9qscRV0YJF/JPZKqzvGhrt1r+mQF2c44e0CSr/MBoPAbc+tK79 QZig== MIME-Version: 1.0 Received: by 10.236.76.233 with SMTP id b69mr14724561yhe.52.1337387878846; Fri, 18 May 2012 17:37:58 -0700 (PDT) Received: by 10.236.44.73 with HTTP; Fri, 18 May 2012 17:37:58 -0700 (PDT) In-Reply-To: References: <201205182329.q4INTU4X086651@svn.freebsd.org> Date: Sat, 19 May 2012 02:37:58 +0200 Message-ID: From: Oliver Pinter To: Sean Bruno Content-Type: multipart/mixed; boundary=20cf300fb37172126b04c058e103 Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-7@freebsd.org Subject: Re: svn commit: r235636 - in stable/7/sys: conf dev/mfi modules/mfi X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 May 2012 00:38:06 -0000 --20cf300fb37172126b04c058e103 Content-Type: text/plain; charset=ISO-8859-1 On 5/19/12, Oliver Pinter wrote: > cc -O2 -fno-strict-aliasing -pipe -fno-delete-null-pointer-checks > -march=core2 - > fno-builtin-strftime -Wsystem-headers -Wall -Wno-format-y2k -W > -Wno-unused-param > eter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith > -Wno-uninitialized > -Wno-pointer-sign -c /usr/src/usr.sbin/mfiutil/mfi_evt.c > /usr/src/usr.sbin/mfiutil/mfi_evt.c: In function 'mfi_decode_evt': > /usr/src/usr.sbin/mfiutil/mfi_evt.c:366: error: 'struct mfi_evt_detail' has > no m > ember named 'class' > /usr/src/usr.sbin/mfiutil/mfi_evt.c:367: error: 'struct mfi_evt_detail' has > no m > ember named 'class' > /usr/src/usr.sbin/mfiutil/mfi_evt.c: In function 'show_events': > /usr/src/usr.sbin/mfiutil/mfi_evt.c:562: error: 'struct ' has no > memb > er named 'class' > /usr/src/usr.sbin/mfiutil/mfi_evt.c:572: error: 'struct ' has no > memb > er named 'class' > cc -O2 -fno-strict-aliasing -pipe -fno-delete-null-pointer-checks > -march=core2 - > DGTAGS -DSYSV_CURSES -I/usr/src/usr.bin/vi > -I/usr/src/usr.bin/vi/../../contrib/n > vi -I/usr/src/usr.bin/vi/../../contrib/nvi/include -c > /usr/src/usr.bin/vi/../.. > /contrib/nvi/ex/ex_put.c > *** Error code 1 > > --------------- > > diff --git a/usr.sbin/mfiutil/mfi_evt.c b/usr.sbin/mfiutil/mfi_evt.c > index a14bb19..336fbd3 100644 > --- a/usr.sbin/mfiutil/mfi_evt.c > +++ b/usr.sbin/mfiutil/mfi_evt.c > @@ -363,8 +363,8 @@ mfi_decode_evt(int fd, struct mfi_evt_detail > *detail, int verbose) > { > > printf("%5d (%s/%s/%s) - ", detail->seq, > format_timestamp(detail->time), > - format_locale(detail->class.members.locale), > - format_class(detail->class.members.class)); > + format_locale(detail->evt_class.members.locale), > + format_class(detail->evt_class.members.evt_class)); > switch (detail->arg_type) { > case MR_EVT_ARGS_NONE: > break; > @@ -559,7 +559,7 @@ show_events(int ac, char **av) > num_events = 15; > filter.members.reserved = 0; > filter.members.locale = MFI_EVT_LOCALE_ALL; > - filter.members.class = MFI_EVT_CLASS_WARNING; > + filter.members.evt_class = MFI_EVT_CLASS_WARNING; > start = info.boot_seq_num; > stop = info.newest_seq_num; > verbose = 0; > @@ -569,7 +569,7 @@ show_events(int ac, char **av) > while ((ch = getopt(ac, av, "c:l:n:v")) != -1) { > switch (ch) { > case 'c': > - if (parse_class(optarg, &filter.members.class) < 0) > { > + if (parse_class(optarg, > &filter.members.evt_class) < 0) { > error = errno; > warn("Error parsing event class"); > close(fd); > > > -------------- > > not tested, compiling now > > On 5/19/12, Sean Bruno wrote: >> Author: sbruno >> Date: Fri May 18 23:29:30 2012 >> New Revision: 235636 >> URL: http://svn.freebsd.org/changeset/base/235636 >> >> Log: >> MFC of head thunderbolt support for mfi(4) >> >> r233711 -- IFV head_mfi into head for initial thunderbolt support >> r233768 -- atomic_t --> mfi_atomic >> r233805 -- fix tinderbuild, move megasas_sge to mfivar.h >> r233877 -- remove atomic.h from includes >> r235014 -- fix reading of sector >= 2^32 or 2^21, repair RAID handling >> r235016 -- style(9) >> r235040 -- fix returns from mfi_tbolt_sync_map_info() >> r235318 -- repair panic on PAE i386 >> r235321 -- repair the repair of panics on PAE i386 >> >> Added: >> stable/7/sys/dev/mfi/mfi_syspd.c >> - copied unchanged from r233711, head/sys/dev/mfi/mfi_syspd.c >> stable/7/sys/dev/mfi/mfi_tbolt.c >> - copied, changed from r233711, head/sys/dev/mfi/mfi_tbolt.c >> Modified: >> stable/7/sys/conf/files >> stable/7/sys/dev/mfi/mfi.c >> stable/7/sys/dev/mfi/mfi_cam.c >> stable/7/sys/dev/mfi/mfi_debug.c >> stable/7/sys/dev/mfi/mfi_disk.c >> stable/7/sys/dev/mfi/mfi_ioctl.h >> stable/7/sys/dev/mfi/mfi_linux.c >> stable/7/sys/dev/mfi/mfi_pci.c >> stable/7/sys/dev/mfi/mfireg.h >> stable/7/sys/dev/mfi/mfivar.h >> stable/7/sys/modules/mfi/Makefile >> Directory Properties: >> stable/7/sys/ (props changed) >> >> Modified: stable/7/sys/conf/files >> ============================================================================== >> --- stable/7/sys/conf/files Fri May 18 21:50:26 2012 (r235635) >> +++ stable/7/sys/conf/files Fri May 18 23:29:30 2012 (r235636) >> @@ -948,6 +948,8 @@ dev/mfi/mfi.c optional mfi >> dev/mfi/mfi_debug.c optional mfi >> dev/mfi/mfi_pci.c optional mfi pci >> dev/mfi/mfi_disk.c optional mfi >> +dev/mfi/mfi_syspd.c optional mfi >> +dev/mfi/mfi_tbolt.c optional mfi >> dev/mfi/mfi_linux.c optional mfi compat_linux >> dev/mfi/mfi_cam.c optional mfip scbus >> dev/mii/acphy.c optional miibus | acphy >> >> Modified: stable/7/sys/dev/mfi/mfi.c >> ============================================================================== >> --- stable/7/sys/dev/mfi/mfi.c Fri May 18 21:50:26 2012 (r235635) >> +++ stable/7/sys/dev/mfi/mfi.c Fri May 18 23:29:30 2012 (r235636) >> @@ -53,6 +53,7 @@ >> #include >> __FBSDID("$FreeBSD$"); >> >> +#include "opt_compat.h" >> #include "opt_mfi.h" >> >> #include >> @@ -72,6 +73,7 @@ __FBSDID("$FreeBSD$"); >> #include >> #include >> #include >> +#include >> >> #include >> #include >> @@ -79,43 +81,52 @@ __FBSDID("$FreeBSD$"); >> #include >> #include >> #include >> +#include >> +#include >> >> static int mfi_alloc_commands(struct mfi_softc *); >> static int mfi_comms_init(struct mfi_softc *); >> -static int mfi_wait_command(struct mfi_softc *, struct mfi_command *); >> static int mfi_get_controller_info(struct mfi_softc *); >> static int mfi_get_log_state(struct mfi_softc *, >> struct mfi_evt_log_state **); >> static int mfi_parse_entries(struct mfi_softc *, int, int); >> -static int mfi_dcmd_command(struct mfi_softc *, struct mfi_command **, >> - uint32_t, void **, size_t); >> static void mfi_data_cb(void *, bus_dma_segment_t *, int, int); >> static void mfi_startup(void *arg); >> static void mfi_intr(void *arg); >> static void mfi_ldprobe(struct mfi_softc *sc); >> +static void mfi_syspdprobe(struct mfi_softc *sc); >> +static void mfi_handle_evt(void *context, int pending); >> static int mfi_aen_register(struct mfi_softc *sc, int seq, int locale); >> static void mfi_aen_complete(struct mfi_command *); >> -static int mfi_aen_setup(struct mfi_softc *, uint32_t); >> static int mfi_add_ld(struct mfi_softc *sc, int); >> static void mfi_add_ld_complete(struct mfi_command *); >> +static int mfi_add_sys_pd(struct mfi_softc *sc, int); >> +static void mfi_add_sys_pd_complete(struct mfi_command *); >> static struct mfi_command * mfi_bio_command(struct mfi_softc *); >> static void mfi_bio_complete(struct mfi_command *); >> -static int mfi_mapcmd(struct mfi_softc *, struct mfi_command *); >> +static struct mfi_command *mfi_build_ldio(struct mfi_softc *,struct >> bio*); >> +static struct mfi_command *mfi_build_syspdio(struct mfi_softc *,struct >> bio*); >> static int mfi_send_frame(struct mfi_softc *, struct mfi_command *); >> -static void mfi_complete(struct mfi_softc *, struct mfi_command *); >> static int mfi_abort(struct mfi_softc *, struct mfi_command *); >> -static int mfi_linux_ioctl_int(struct cdev *, u_long, caddr_t, int, >> d_thread_t *); >> +static int mfi_linux_ioctl_int(struct cdev *, u_long, caddr_t, int, >> struct >> thread *); >> static void mfi_timeout(void *); >> static int mfi_user_command(struct mfi_softc *, >> struct mfi_ioc_passthru *); >> -static void mfi_enable_intr_xscale(struct mfi_softc *sc); >> -static void mfi_enable_intr_ppc(struct mfi_softc *sc); >> -static int32_t mfi_read_fw_status_xscale(struct mfi_softc *sc); >> -static int32_t mfi_read_fw_status_ppc(struct mfi_softc *sc); >> -static int mfi_check_clear_intr_xscale(struct mfi_softc *sc); >> -static int mfi_check_clear_intr_ppc(struct mfi_softc *sc); >> -static void mfi_issue_cmd_xscale(struct mfi_softc *sc,uint32_t >> bus_add,uint32_t frame_cnt); >> -static void mfi_issue_cmd_ppc(struct mfi_softc *sc,uint32_t >> bus_add,uint32_t frame_cnt); >> +static void mfi_enable_intr_xscale(struct mfi_softc *sc); >> +static void mfi_enable_intr_ppc(struct mfi_softc *sc); >> +static int32_t mfi_read_fw_status_xscale(struct mfi_softc *sc); >> +static int32_t mfi_read_fw_status_ppc(struct mfi_softc *sc); >> +static int mfi_check_clear_intr_xscale(struct mfi_softc *sc); >> +static int mfi_check_clear_intr_ppc(struct mfi_softc *sc); >> +static void mfi_issue_cmd_xscale(struct mfi_softc *sc, bus_addr_t >> bus_add, >> + uint32_t frame_cnt); >> +static void mfi_issue_cmd_ppc(struct mfi_softc *sc, bus_addr_t bus_add, >> + uint32_t frame_cnt); >> +static int mfi_config_lock(struct mfi_softc *sc, uint32_t opcode); >> +static void mfi_config_unlock(struct mfi_softc *sc, int locked); >> +static int mfi_check_command_pre(struct mfi_softc *sc, struct >> mfi_command >> *cm); >> +static void mfi_check_command_post(struct mfi_softc *sc, struct >> mfi_command >> *cm); >> +static int mfi_check_for_sscd(struct mfi_softc *sc, struct mfi_command >> *cm); >> >> SYSCTL_NODE(_hw, OID_AUTO, mfi, CTLFLAG_RD, 0, "MFI driver parameters"); >> static int mfi_event_locale = MFI_EVT_LOCALE_ALL; >> @@ -133,6 +144,11 @@ TUNABLE_INT("hw.mfi.max_cmds", &mfi_max_ >> SYSCTL_INT(_hw_mfi, OID_AUTO, max_cmds, CTLFLAG_RD, &mfi_max_cmds, >> 0, "Max commands"); >> >> +static int mfi_detect_jbod_change = 1; >> +TUNABLE_INT("hw.mfi.detect_jbod_change", &mfi_detect_jbod_change); >> +SYSCTL_INT(_hw_mfi, OID_AUTO, detect_jbod_change, CTLFLAG_RW, >> + &mfi_detect_jbod_change, 0, "Detect a change to a JBOD"); >> + >> /* Management interface */ >> static d_open_t mfi_open; >> static d_close_t mfi_close; >> @@ -152,6 +168,7 @@ static struct cdevsw mfi_cdevsw = { >> MALLOC_DEFINE(M_MFIBUF, "mfibuf", "Buffers for the MFI driver"); >> >> #define MFI_INQ_LENGTH SHORT_INQUIRY_LENGTH >> +struct mfi_skinny_dma_info mfi_skinny; >> >> static void >> mfi_enable_intr_xscale(struct mfi_softc *sc) >> @@ -162,12 +179,17 @@ mfi_enable_intr_xscale(struct mfi_softc >> static void >> mfi_enable_intr_ppc(struct mfi_softc *sc) >> { >> - MFI_WRITE4(sc, MFI_ODCR0, 0xFFFFFFFF); >> if (sc->mfi_flags & MFI_FLAGS_1078) { >> + MFI_WRITE4(sc, MFI_ODCR0, 0xFFFFFFFF); >> MFI_WRITE4(sc, MFI_OMSK, ~MFI_1078_EIM); >> - } else if (sc->mfi_flags & MFI_FLAGS_GEN2) { >> + } >> + else if (sc->mfi_flags & MFI_FLAGS_GEN2) { >> + MFI_WRITE4(sc, MFI_ODCR0, 0xFFFFFFFF); >> MFI_WRITE4(sc, MFI_OMSK, ~MFI_GEN2_EIM); >> } >> + else if (sc->mfi_flags & MFI_FLAGS_SKINNY) { >> + MFI_WRITE4(sc, MFI_OMSK, ~0x00000001); >> + } >> } >> >> static int32_t >> @@ -205,35 +227,51 @@ mfi_check_clear_intr_ppc(struct mfi_soft >> if (!(status & MFI_1078_RM)) { >> return 1; >> } >> - } else if (sc->mfi_flags & MFI_FLAGS_GEN2) { >> + } >> + else if (sc->mfi_flags & MFI_FLAGS_GEN2) { >> if (!(status & MFI_GEN2_RM)) { >> return 1; >> } >> } >> - >> - MFI_WRITE4(sc, MFI_ODCR0, status); >> + else if (sc->mfi_flags & MFI_FLAGS_SKINNY) { >> + if (!(status & MFI_SKINNY_RM)) { >> + return 1; >> + } >> + } >> + if (sc->mfi_flags & MFI_FLAGS_SKINNY) >> + MFI_WRITE4(sc, MFI_OSTS, status); >> + else >> + MFI_WRITE4(sc, MFI_ODCR0, status); >> return 0; >> } >> >> static void >> -mfi_issue_cmd_xscale(struct mfi_softc *sc,uint32_t bus_add,uint32_t >> frame_cnt) >> +mfi_issue_cmd_xscale(struct mfi_softc *sc, bus_addr_t bus_add, uint32_t >> frame_cnt) >> { >> MFI_WRITE4(sc, MFI_IQP,(bus_add >>3)|frame_cnt); >> } >> >> static void >> -mfi_issue_cmd_ppc(struct mfi_softc *sc,uint32_t bus_add,uint32_t >> frame_cnt) >> +mfi_issue_cmd_ppc(struct mfi_softc *sc, bus_addr_t bus_add, uint32_t >> frame_cnt) >> { >> - MFI_WRITE4(sc, MFI_IQP, (bus_add |frame_cnt <<1)|1 ); >> + if (sc->mfi_flags & MFI_FLAGS_SKINNY) { >> + MFI_WRITE4(sc, MFI_IQPL, (bus_add | frame_cnt <<1)|1 ); >> + MFI_WRITE4(sc, MFI_IQPH, 0x00000000); >> + } else { >> + MFI_WRITE4(sc, MFI_IQP, (bus_add | frame_cnt <<1)|1 ); >> + } >> } >> >> -static int >> +int >> mfi_transition_firmware(struct mfi_softc *sc) >> { >> - int32_t fw_state, cur_state; >> + uint32_t fw_state, cur_state; >> int max_wait, i; >> + uint32_t cur_abs_reg_val = 0; >> + uint32_t prev_abs_reg_val = 0; >> >> - fw_state = sc->mfi_read_fw_status(sc)& MFI_FWSTATE_MASK; >> + cur_abs_reg_val = sc->mfi_read_fw_status(sc); >> + fw_state = cur_abs_reg_val & MFI_FWSTATE_MASK; >> while (fw_state != MFI_FWSTATE_READY) { >> if (bootverbose) >> device_printf(sc->mfi_dev, "Waiting for firmware to " >> @@ -244,36 +282,62 @@ mfi_transition_firmware(struct mfi_softc >> device_printf(sc->mfi_dev, "Firmware fault\n"); >> return (ENXIO); >> case MFI_FWSTATE_WAIT_HANDSHAKE: >> - MFI_WRITE4(sc, MFI_IDB, MFI_FWINIT_CLEAR_HANDSHAKE); >> - max_wait = 2; >> + if (sc->mfi_flags & MFI_FLAGS_SKINNY || sc->mfi_flags & >> MFI_FLAGS_TBOLT) >> + MFI_WRITE4(sc, MFI_SKINNY_IDB, MFI_FWINIT_CLEAR_HANDSHAKE); >> + else >> + MFI_WRITE4(sc, MFI_IDB, MFI_FWINIT_CLEAR_HANDSHAKE); >> + max_wait = MFI_RESET_WAIT_TIME; >> break; >> case MFI_FWSTATE_OPERATIONAL: >> - MFI_WRITE4(sc, MFI_IDB, MFI_FWINIT_READY); >> - max_wait = 10; >> + if (sc->mfi_flags & MFI_FLAGS_SKINNY || sc->mfi_flags & >> MFI_FLAGS_TBOLT) >> + MFI_WRITE4(sc, MFI_SKINNY_IDB, 7); >> + else >> + MFI_WRITE4(sc, MFI_IDB, MFI_FWINIT_READY); >> + max_wait = MFI_RESET_WAIT_TIME; >> break; >> case MFI_FWSTATE_UNDEFINED: >> case MFI_FWSTATE_BB_INIT: >> - max_wait = 2; >> + max_wait = MFI_RESET_WAIT_TIME; >> + break; >> + case MFI_FWSTATE_FW_INIT_2: >> + max_wait = MFI_RESET_WAIT_TIME; >> break; >> case MFI_FWSTATE_FW_INIT: >> - case MFI_FWSTATE_DEVICE_SCAN: >> case MFI_FWSTATE_FLUSH_CACHE: >> - max_wait = 20; >> + max_wait = MFI_RESET_WAIT_TIME; >> + break; >> + case MFI_FWSTATE_DEVICE_SCAN: >> + max_wait = MFI_RESET_WAIT_TIME; /* wait for 180 seconds */ >> + prev_abs_reg_val = cur_abs_reg_val; >> + break; >> + case MFI_FWSTATE_BOOT_MESSAGE_PENDING: >> + if (sc->mfi_flags & MFI_FLAGS_SKINNY || sc->mfi_flags & >> MFI_FLAGS_TBOLT) >> + MFI_WRITE4(sc, MFI_SKINNY_IDB, MFI_FWINIT_HOTPLUG); >> + else >> + MFI_WRITE4(sc, MFI_IDB, MFI_FWINIT_HOTPLUG); >> + max_wait = MFI_RESET_WAIT_TIME; >> break; >> default: >> - device_printf(sc->mfi_dev,"Unknown firmware state %d\n", >> + device_printf(sc->mfi_dev, "Unknown firmware state %#x\n", >> fw_state); >> return (ENXIO); >> } >> for (i = 0; i < (max_wait * 10); i++) { >> - fw_state = sc->mfi_read_fw_status(sc) & MFI_FWSTATE_MASK; >> + cur_abs_reg_val = sc->mfi_read_fw_status(sc); >> + fw_state = cur_abs_reg_val & MFI_FWSTATE_MASK; >> if (fw_state == cur_state) >> DELAY(100000); >> else >> break; >> } >> + if (fw_state == MFI_FWSTATE_DEVICE_SCAN) { >> + /* Check the device scanning progress */ >> + if (prev_abs_reg_val != cur_abs_reg_val) { >> + continue; >> + } >> + } >> if (fw_state == cur_state) { >> - device_printf(sc->mfi_dev, "firmware stuck in state " >> + device_printf(sc->mfi_dev, "Firmware stuck in state " >> "%#x\n", fw_state); >> return (ENXIO); >> } >> @@ -282,26 +346,36 @@ mfi_transition_firmware(struct mfi_softc >> } >> >> static void >> -mfi_addr32_cb(void *arg, bus_dma_segment_t *segs, int nsegs, int error) >> +mfi_addr_cb(void *arg, bus_dma_segment_t *segs, int nsegs, int error) >> { >> - uint32_t *addr; >> + bus_addr_t *addr; >> >> addr = arg; >> *addr = segs[0].ds_addr; >> } >> >> + >> int >> mfi_attach(struct mfi_softc *sc) >> { >> uint32_t status; >> int error, commsz, framessz, sensesz; >> int frames, unit, max_fw_sge; >> + uint32_t tb_mem_size = 0; >> >> - device_printf(sc->mfi_dev, "Megaraid SAS driver Ver 3.00 \n"); >> + if (sc == NULL) >> + return EINVAL; >> + >> + device_printf(sc->mfi_dev, "Megaraid SAS driver Ver %s \n", >> + MEGASAS_VERSION); >> >> mtx_init(&sc->mfi_io_lock, "MFI I/O lock", NULL, MTX_DEF); >> sx_init(&sc->mfi_config_lock, "MFI config"); >> TAILQ_INIT(&sc->mfi_ld_tqh); >> + TAILQ_INIT(&sc->mfi_syspd_tqh); >> + TAILQ_INIT(&sc->mfi_evt_queue); >> + TASK_INIT(&sc->mfi_evt_task, 0, mfi_handle_evt, sc); >> + TASK_INIT(&sc->mfi_map_sync_task, 0, mfi_handle_map_sync, sc); >> TAILQ_INIT(&sc->mfi_aen_pids); >> TAILQ_INIT(&sc->mfi_cam_ccbq); >> >> @@ -310,15 +384,29 @@ mfi_attach(struct mfi_softc *sc) >> mfi_initq_busy(sc); >> mfi_initq_bio(sc); >> >> + sc->adpreset = 0; >> + sc->last_seq_num = 0; >> + sc->disableOnlineCtrlReset = 1; >> + sc->issuepend_done = 1; >> + sc->hw_crit_error = 0; >> + >> if (sc->mfi_flags & MFI_FLAGS_1064R) { >> sc->mfi_enable_intr = mfi_enable_intr_xscale; >> sc->mfi_read_fw_status = mfi_read_fw_status_xscale; >> sc->mfi_check_clear_intr = mfi_check_clear_intr_xscale; >> sc->mfi_issue_cmd = mfi_issue_cmd_xscale; >> - } >> - else { >> + } else if (sc->mfi_flags & MFI_FLAGS_TBOLT) { >> + sc->mfi_enable_intr = mfi_tbolt_enable_intr_ppc; >> + sc->mfi_disable_intr = mfi_tbolt_disable_intr_ppc; >> + sc->mfi_read_fw_status = mfi_tbolt_read_fw_status_ppc; >> + sc->mfi_check_clear_intr = mfi_tbolt_check_clear_intr_ppc; >> + sc->mfi_issue_cmd = mfi_tbolt_issue_cmd_ppc; >> + sc->mfi_adp_reset = mfi_tbolt_adp_reset; >> + sc->mfi_tbolt = 1; >> + TAILQ_INIT(&sc->mfi_cmd_tbolt_tqh); >> + } else { >> sc->mfi_enable_intr = mfi_enable_intr_ppc; >> - sc->mfi_read_fw_status = mfi_read_fw_status_ppc; >> + sc->mfi_read_fw_status = mfi_read_fw_status_ppc; >> sc->mfi_check_clear_intr = mfi_check_clear_intr_ppc; >> sc->mfi_issue_cmd = mfi_issue_cmd_ppc; >> } >> @@ -331,6 +419,32 @@ mfi_attach(struct mfi_softc *sc) >> return (ENXIO); >> } >> >> + /* Start: LSIP200113393 */ >> + if (bus_dma_tag_create( sc->mfi_parent_dmat, /* parent */ >> + 1, 0, /* algnmnt, boundary */ >> + BUS_SPACE_MAXADDR_32BIT,/* lowaddr */ >> + BUS_SPACE_MAXADDR, /* highaddr */ >> + NULL, NULL, /* filter, filterarg */ >> + MEGASAS_MAX_NAME*sizeof(bus_addr_t), /* maxsize */ >> + 1, /* msegments */ >> + MEGASAS_MAX_NAME*sizeof(bus_addr_t), /* maxsegsize */ >> + 0, /* flags */ >> + NULL, NULL, /* lockfunc, lockarg */ >> + &sc->verbuf_h_dmat)) { >> + device_printf(sc->mfi_dev, "Cannot allocate verbuf_h_dmat DMA tag\n"); >> + return (ENOMEM); >> + } >> + if (bus_dmamem_alloc(sc->verbuf_h_dmat, (void **)&sc->verbuf, >> + BUS_DMA_NOWAIT, &sc->verbuf_h_dmamap)) { >> + device_printf(sc->mfi_dev, "Cannot allocate verbuf_h_dmamap >> memory\n"); >> + return (ENOMEM); >> + } >> + bzero(sc->verbuf, MEGASAS_MAX_NAME*sizeof(bus_addr_t)); >> + bus_dmamap_load(sc->verbuf_h_dmat, sc->verbuf_h_dmamap, >> + sc->verbuf, MEGASAS_MAX_NAME*sizeof(bus_addr_t), >> + mfi_addr_cb, &sc->verbuf_h_busaddr, 0); >> + /* End: LSIP200113393 */ >> + >> /* >> * Get information needed for sizing the contiguous memory for the >> * frame pool. Size down the sgl parameter since we know that >> @@ -341,8 +455,102 @@ mfi_attach(struct mfi_softc *sc) >> status = sc->mfi_read_fw_status(sc); >> sc->mfi_max_fw_cmds = status & MFI_FWSTATE_MAXCMD_MASK; >> max_fw_sge = (status & MFI_FWSTATE_MAXSGL_MASK) >> 16; >> - sc->mfi_max_sge = min(max_fw_sge, ((MAXPHYS / PAGE_SIZE) + 1)); >> + sc->mfi_max_sge = min(max_fw_sge, ((MFI_MAXPHYS / PAGE_SIZE) + 1)); >> + >> + /* ThunderBolt Support get the contiguous memory */ >> + >> + if (sc->mfi_flags & MFI_FLAGS_TBOLT) { >> + mfi_tbolt_init_globals(sc); >> + device_printf(sc->mfi_dev, "MaxCmd = %x MaxSgl = %x state = %x \n", >> + sc->mfi_max_fw_cmds, sc->mfi_max_sge, status); >> + tb_mem_size = mfi_tbolt_get_memory_requirement(sc); >> + >> + if (bus_dma_tag_create( sc->mfi_parent_dmat, /* parent */ >> + 1, 0, /* algnmnt, boundary */ >> + BUS_SPACE_MAXADDR_32BIT,/* lowaddr */ >> + BUS_SPACE_MAXADDR, /* highaddr */ >> + NULL, NULL, /* filter, filterarg */ >> + tb_mem_size, /* maxsize */ >> + 1, /* msegments */ >> + tb_mem_size, /* maxsegsize */ >> + 0, /* flags */ >> + NULL, NULL, /* lockfunc, lockarg */ >> + &sc->mfi_tb_dmat)) { >> + device_printf(sc->mfi_dev, "Cannot allocate comms DMA tag\n"); >> + return (ENOMEM); >> + } >> + if (bus_dmamem_alloc(sc->mfi_tb_dmat, (void >> **)&sc->request_message_pool, >> + BUS_DMA_NOWAIT, &sc->mfi_tb_dmamap)) { >> + device_printf(sc->mfi_dev, "Cannot allocate comms memory\n"); >> + return (ENOMEM); >> + } >> + bzero(sc->request_message_pool, tb_mem_size); >> + bus_dmamap_load(sc->mfi_tb_dmat, sc->mfi_tb_dmamap, >> + sc->request_message_pool, tb_mem_size, mfi_addr_cb, >> &sc->mfi_tb_busaddr, >> 0); >> + >> + /* For ThunderBolt memory init */ >> + if (bus_dma_tag_create( sc->mfi_parent_dmat, /* parent */ >> + 0x100, 0, /* alignmnt, boundary */ >> + BUS_SPACE_MAXADDR_32BIT,/* lowaddr */ >> + BUS_SPACE_MAXADDR, /* highaddr */ >> + NULL, NULL, /* filter, filterarg */ >> + MFI_FRAME_SIZE, /* maxsize */ >> + 1, /* msegments */ >> + MFI_FRAME_SIZE, /* maxsegsize */ >> + 0, /* flags */ >> + NULL, NULL, /* lockfunc, lockarg */ >> + &sc->mfi_tb_init_dmat)) { >> + device_printf(sc->mfi_dev, "Cannot allocate init DMA tag\n"); >> + return (ENOMEM); >> + } >> + if (bus_dmamem_alloc(sc->mfi_tb_init_dmat, (void **)&sc->mfi_tb_init, >> + BUS_DMA_NOWAIT, &sc->mfi_tb_init_dmamap)) { >> + device_printf(sc->mfi_dev, "Cannot allocate init memory\n"); >> + return (ENOMEM); >> + } >> + bzero(sc->mfi_tb_init, MFI_FRAME_SIZE); >> + bus_dmamap_load(sc->mfi_tb_init_dmat, sc->mfi_tb_init_dmamap, >> + sc->mfi_tb_init, MFI_FRAME_SIZE, mfi_addr_cb, >> + &sc->mfi_tb_init_busaddr, 0); >> + if (mfi_tbolt_init_desc_pool(sc, sc->request_message_pool, >> + tb_mem_size)) { >> + device_printf(sc->mfi_dev, >> + "Thunderbolt pool preparation error\n"); >> + return 0; >> + } >> >> + /* >> + Allocate DMA memory mapping for MPI2 IOC Init descriptor, >> + we are taking it diffrent from what we have allocated for Request >> + and reply descriptors to avoid confusion later >> + */ >> + tb_mem_size = sizeof(struct MPI2_IOC_INIT_REQUEST); >> + if (bus_dma_tag_create( sc->mfi_parent_dmat, /* parent */ >> + 1, 0, /* algnmnt, boundary */ >> + BUS_SPACE_MAXADDR_32BIT,/* lowaddr */ >> + BUS_SPACE_MAXADDR, /* highaddr */ >> + NULL, NULL, /* filter, filterarg */ >> + tb_mem_size, /* maxsize */ >> + 1, /* msegments */ >> + tb_mem_size, /* maxsegsize */ >> + 0, /* flags */ >> + NULL, NULL, /* lockfunc, lockarg */ >> + &sc->mfi_tb_ioc_init_dmat)) { >> + device_printf(sc->mfi_dev, >> + "Cannot allocate comms DMA tag\n"); >> + return (ENOMEM); >> + } >> + if (bus_dmamem_alloc(sc->mfi_tb_ioc_init_dmat, >> + (void **)&sc->mfi_tb_ioc_init_desc, >> + BUS_DMA_NOWAIT, &sc->mfi_tb_ioc_init_dmamap)) { >> + device_printf(sc->mfi_dev, "Cannot allocate comms memory\n"); >> + return (ENOMEM); >> + } >> + bzero(sc->mfi_tb_ioc_init_desc, tb_mem_size); >> + bus_dmamap_load(sc->mfi_tb_ioc_init_dmat, sc->mfi_tb_ioc_init_dmamap, >> + sc->mfi_tb_ioc_init_desc, tb_mem_size, mfi_addr_cb, >> + &sc->mfi_tb_ioc_init_busaddr, 0); >> + } >> /* >> * Create the dma tag for data buffers. Used both for block I/O >> * and for various internal data queries. >> @@ -392,8 +600,7 @@ mfi_attach(struct mfi_softc *sc) >> } >> bzero(sc->mfi_comms, commsz); >> bus_dmamap_load(sc->mfi_comms_dmat, sc->mfi_comms_dmamap, >> - sc->mfi_comms, commsz, mfi_addr32_cb, &sc->mfi_comms_busaddr, 0); >> - >> + sc->mfi_comms, commsz, mfi_addr_cb, &sc->mfi_comms_busaddr, 0); >> /* >> * Allocate DMA memory for the command frames. Keep them in the >> * lower 4GB for efficiency. Calculate the size of the commands at >> @@ -410,6 +617,8 @@ mfi_attach(struct mfi_softc *sc) >> } else { >> sc->mfi_sge_size = sizeof(struct mfi_sg32); >> } >> + if (sc->mfi_flags & MFI_FLAGS_SKINNY) >> + sc->mfi_sge_size = sizeof(struct mfi_sg_skinny); >> frames = (sc->mfi_sge_size * sc->mfi_max_sge - 1) / MFI_FRAME_SIZE + 2; >> sc->mfi_cmd_size = frames * MFI_FRAME_SIZE; >> framessz = sc->mfi_cmd_size * sc->mfi_max_fw_cmds; >> @@ -434,8 +643,7 @@ mfi_attach(struct mfi_softc *sc) >> } >> bzero(sc->mfi_frames, framessz); >> bus_dmamap_load(sc->mfi_frames_dmat, sc->mfi_frames_dmamap, >> - sc->mfi_frames, framessz, mfi_addr32_cb, >> &sc->mfi_frames_busaddr,0); >> - >> + sc->mfi_frames, framessz, mfi_addr_cb, &sc->mfi_frames_busaddr,0); >> /* >> * Allocate DMA memory for the frame sense data. Keep them in the >> * lower 4GB for efficiency >> @@ -461,39 +669,46 @@ mfi_attach(struct mfi_softc *sc) >> return (ENOMEM); >> } >> bus_dmamap_load(sc->mfi_sense_dmat, sc->mfi_sense_dmamap, >> - sc->mfi_sense, sensesz, mfi_addr32_cb, &sc->mfi_sense_busaddr, 0); >> - >> + sc->mfi_sense, sensesz, mfi_addr_cb, &sc->mfi_sense_busaddr, 0); >> if ((error = mfi_alloc_commands(sc)) != 0) >> return (error); >> >> - if ((error = mfi_comms_init(sc)) != 0) >> - return (error); >> + /* Before moving the FW to operational state, check whether >> + * hostmemory is required by the FW or not >> + */ >> >> - if ((error = mfi_get_controller_info(sc)) != 0) >> - return (error); >> + /* ThunderBolt MFI_IOC2 INIT */ >> + if (sc->mfi_flags & MFI_FLAGS_TBOLT) { >> + sc->mfi_disable_intr(sc); >> + if ((error = mfi_tbolt_init_MFI_queue(sc)) != 0) { >> + device_printf(sc->mfi_dev, >> + "TB Init has failed with error %d\n",error); >> + return error; >> + } >> >> - mtx_lock(&sc->mfi_io_lock); >> - if ((error = mfi_aen_setup(sc, 0), 0) != 0) { >> - mtx_unlock(&sc->mfi_io_lock); >> - return (error); >> - } >> - mtx_unlock(&sc->mfi_io_lock); >> + if ((error = mfi_tbolt_alloc_cmd(sc)) != 0) >> + return error; >> + if (bus_setup_intr(sc->mfi_dev, sc->mfi_irq, >> + INTR_MPSAFE|INTR_TYPE_BIO, NULL, mfi_intr_tbolt, sc, >> + &sc->mfi_intr)) { >> + device_printf(sc->mfi_dev, "Cannot set up interrupt\n"); >> + return (EINVAL); >> + } >> + sc->mfi_enable_intr(sc); >> + } else { >> + if ((error = mfi_comms_init(sc)) != 0) >> + return (error); >> >> - /* >> - * Set up the interrupt handler. XXX This should happen in >> - * mfi_pci.c >> - */ >> - sc->mfi_irq_rid = 0; >> - if ((sc->mfi_irq = bus_alloc_resource_any(sc->mfi_dev, SYS_RES_IRQ, >> - &sc->mfi_irq_rid, RF_SHAREABLE | RF_ACTIVE)) == NULL) { >> - device_printf(sc->mfi_dev, "Cannot allocate interrupt\n"); >> - return (EINVAL); >> - } >> - if (bus_setup_intr(sc->mfi_dev, sc->mfi_irq, INTR_MPSAFE|INTR_TYPE_BIO, >> - NULL, mfi_intr, sc, &sc->mfi_intr)) { >> - device_printf(sc->mfi_dev, "Cannot set up interrupt\n"); >> - return (EINVAL); >> + if (bus_setup_intr(sc->mfi_dev, sc->mfi_irq, >> + INTR_MPSAFE|INTR_TYPE_BIO, NULL, mfi_intr, sc, &sc->mfi_intr)) { >> + device_printf(sc->mfi_dev, "Cannot set up interrupt\n"); >> + return (EINVAL); >> + } >> + sc->mfi_enable_intr(sc); >> } >> + if ((error = mfi_get_controller_info(sc)) != 0) >> + return (error); >> + sc->disableOnlineCtrlReset = 0; >> >> /* Register a config hook to probe the bus for arrays */ >> sc->mfi_ich.ich_func = mfi_startup; >> @@ -503,6 +718,10 @@ mfi_attach(struct mfi_softc *sc) >> "hook\n"); >> return (EINVAL); >> } >> + if ((error = mfi_aen_setup(sc, 0), 0) != 0) { >> + mtx_unlock(&sc->mfi_io_lock); >> + return (error); >> + } >> >> /* >> * Register a shutdown handler. >> @@ -541,6 +760,10 @@ mfi_attach(struct mfi_softc *sc) >> callout_reset(&sc->mfi_watchdog_callout, MFI_CMD_TIMEOUT * hz, >> mfi_timeout, sc); >> >> + if (sc->mfi_flags & MFI_FLAGS_TBOLT) { >> + mfi_tbolt_sync_map_info(sc); >> + } >> + >> return (0); >> } >> >> @@ -574,8 +797,11 @@ mfi_alloc_commands(struct mfi_softc *sc) >> cm->cm_sc = sc; >> cm->cm_index = i; >> if (bus_dmamap_create(sc->mfi_buffer_dmat, 0, >> - &cm->cm_dmamap) == 0) >> + &cm->cm_dmamap) == 0) { >> + mtx_lock(&sc->mfi_io_lock); >> mfi_release_command(cm); >> + mtx_unlock(&sc->mfi_io_lock); >> + } >> else >> break; >> sc->mfi_total_cmds++; >> @@ -590,6 +816,8 @@ mfi_release_command(struct mfi_command * >> struct mfi_frame_header *hdr; >> uint32_t *hdr_data; >> >> + mtx_assert(&cm->cm_sc->mfi_io_lock, MA_OWNED); >> + >> /* >> * Zero out the important fields of the frame, but make sure the >> * context field is preserved. For efficiency, handle the fields >> @@ -614,24 +842,31 @@ mfi_release_command(struct mfi_command * >> cm->cm_data = NULL; >> cm->cm_sg = 0; >> cm->cm_total_frame_size = 0; >> + cm->retry_for_fw_reset = 0; >> >> mfi_enqueue_free(cm); >> } >> >> -static int >> -mfi_dcmd_command(struct mfi_softc *sc, struct mfi_command **cmp, >> uint32_t >> opcode, >> - void **bufp, size_t bufsize) >> +int >> +mfi_dcmd_command(struct mfi_softc *sc, struct mfi_command **cmp, >> + uint32_t opcode, void **bufp, size_t bufsize) >> { >> struct mfi_command *cm; >> struct mfi_dcmd_frame *dcmd; >> void *buf = NULL; >> - >> + uint32_t context = 0; >> + >> mtx_assert(&sc->mfi_io_lock, MA_OWNED); >> - >> + >> cm = mfi_dequeue_free(sc); >> if (cm == NULL) >> return (EBUSY); >> >> + /* Zero out the MFI frame */ >> + context = cm->cm_frame->header.context; >> + bzero(cm->cm_frame, sizeof(union mfi_frame)); >> + cm->cm_frame->header.context = context; >> + >> if ((bufsize > 0) && (bufp != NULL)) { >> if (*bufp == NULL) { >> buf = malloc(bufsize, M_MFIBUF, M_NOWAIT|M_ZERO); >> @@ -651,6 +886,7 @@ mfi_dcmd_command(struct mfi_softc *sc, s >> dcmd->header.timeout = 0; >> dcmd->header.flags = 0; >> dcmd->header.data_len = bufsize; >> + dcmd->header.scsi_status = 0; >> dcmd->opcode = opcode; >> cm->cm_sg = &dcmd->sgl; >> cm->cm_total_frame_size = MFI_DCMD_FRAME_SIZE; >> @@ -672,11 +908,17 @@ mfi_comms_init(struct mfi_softc *sc) >> struct mfi_init_frame *init; >> struct mfi_init_qinfo *qinfo; >> int error; >> + uint32_t context = 0; >> >> mtx_lock(&sc->mfi_io_lock); >> if ((cm = mfi_dequeue_free(sc)) == NULL) >> return (EBUSY); >> >> + /* Zero out the MFI frame */ >> + context = cm->cm_frame->header.context; >> + bzero(cm->cm_frame, sizeof(union mfi_frame)); >> + cm->cm_frame->header.context = context; >> + >> /* >> * Abuse the SG list area of the frame to hold the init_qinfo >> * object; >> @@ -737,9 +979,11 @@ mfi_get_controller_info(struct mfi_softc >> BUS_DMASYNC_POSTREAD); >> bus_dmamap_unload(sc->mfi_buffer_dmat, cm->cm_dmamap); >> >> - max_sectors_1 = (1 << ci->stripe_sz_ops.min) * ci->max_strips_per_io; >> + max_sectors_1 = (1 << ci->stripe_sz_ops.max) * ci->max_strips_per_io; >> max_sectors_2 = ci->max_request_size; >> sc->mfi_max_io = min(max_sectors_1, max_sectors_2); >> + sc->disableOnlineCtrlReset = >> + ci->properties.OnOffProperties.disableOnlineCtrlReset; >> >> out: >> if (ci) >> @@ -756,6 +1000,7 @@ mfi_get_log_state(struct mfi_softc *sc, >> struct mfi_command *cm = NULL; >> int error; >> >> + mtx_lock(&sc->mfi_io_lock); >> error = mfi_dcmd_command(sc, &cm, MFI_DCMD_CTRL_EVENT_GETINFO, >> (void **)log_state, sizeof(**log_state)); >> if (error) >> @@ -774,11 +1019,12 @@ mfi_get_log_state(struct mfi_softc *sc, >> out: >> if (cm) >> mfi_release_command(cm); >> + mtx_unlock(&sc->mfi_io_lock); >> >> return (error); >> } >> >> -static int >> +int >> mfi_aen_setup(struct mfi_softc *sc, uint32_t seq_start) >> { >> struct mfi_evt_log_state *log_state = NULL; >> @@ -788,10 +1034,11 @@ mfi_aen_setup(struct mfi_softc *sc, uint >> >> class_locale.members.reserved = 0; >> class_locale.members.locale = mfi_event_locale; >> - class_locale.members.class = mfi_event_class; >> + class_locale.members.evt_class = mfi_event_class; >> >> if (seq_start == 0) { >> error = mfi_get_log_state(sc, &log_state); >> + sc->mfi_boot_seq_num = log_state->boot_seq_num; >> if (error) { >> if (log_state) >> free(log_state, M_MFIBUF); >> @@ -813,7 +1060,7 @@ mfi_aen_setup(struct mfi_softc *sc, uint >> return 0; >> } >> >> -static int >> +int >> mfi_wait_command(struct mfi_softc *sc, struct mfi_command *cm) >> { >> >> @@ -886,6 +1133,64 @@ mfi_free(struct mfi_softc *sc) >> if (sc->mfi_comms_dmat != NULL) >> bus_dma_tag_destroy(sc->mfi_comms_dmat); >> >> + /* ThunderBolt contiguous memory free here */ >> + if (sc->mfi_flags & MFI_FLAGS_TBOLT) { >> + if (sc->mfi_tb_busaddr != 0) >> + bus_dmamap_unload(sc->mfi_tb_dmat, sc->mfi_tb_dmamap); >> + if (sc->request_message_pool != NULL) >> + bus_dmamem_free(sc->mfi_tb_dmat, sc->request_message_pool, >> + sc->mfi_tb_dmamap); >> + if (sc->mfi_tb_dmat != NULL) >> + bus_dma_tag_destroy(sc->mfi_tb_dmat); >> + >> + /* Version buffer memory free */ >> + /* Start LSIP200113393 */ >> + if (sc->verbuf_h_busaddr != 0) >> + bus_dmamap_unload(sc->verbuf_h_dmat, sc->verbuf_h_dmamap); >> + if (sc->verbuf != NULL) >> + bus_dmamem_free(sc->verbuf_h_dmat, sc->verbuf, >> + sc->verbuf_h_dmamap); >> + if (sc->verbuf_h_dmat != NULL) >> + bus_dma_tag_destroy(sc->verbuf_h_dmat); >> + >> + /* End LSIP200113393 */ >> + /* ThunderBolt INIT packet memory Free */ >> + if (sc->mfi_tb_init_busaddr != 0) >> + bus_dmamap_unload(sc->mfi_tb_init_dmat, sc->mfi_tb_init_dmamap); >> + if (sc->mfi_tb_init != NULL) >> + bus_dmamem_free(sc->mfi_tb_init_dmat, sc->mfi_tb_init, >> + sc->mfi_tb_init_dmamap); >> + if (sc->mfi_tb_init_dmat != NULL) >> + bus_dma_tag_destroy(sc->mfi_tb_init_dmat); >> + >> + /* ThunderBolt IOC Init Desc memory free here */ >> + if (sc->mfi_tb_ioc_init_busaddr != 0) >> + bus_dmamap_unload(sc->mfi_tb_ioc_init_dmat, >> + sc->mfi_tb_ioc_init_dmamap); >> + if (sc->mfi_tb_ioc_init_desc != NULL) >> + bus_dmamem_free(sc->mfi_tb_ioc_init_dmat, >> + sc->mfi_tb_ioc_init_desc, >> + sc->mfi_tb_ioc_init_dmamap); >> + if (sc->mfi_tb_ioc_init_dmat != NULL) >> + bus_dma_tag_destroy(sc->mfi_tb_ioc_init_dmat); >> + for (int i = 0; i < sc->mfi_max_fw_cmds; i++) { >> + if (sc->mfi_cmd_pool_tbolt != NULL) { >> + if (sc->mfi_cmd_pool_tbolt[i] != NULL) { >> + free(sc->mfi_cmd_pool_tbolt[i], >> + M_MFIBUF); >> + sc->mfi_cmd_pool_tbolt[i] = NULL; >> + } >> + } >> + } >> + if (sc->mfi_cmd_pool_tbolt != NULL) { >> + free(sc->mfi_cmd_pool_tbolt, M_MFIBUF); >> + sc->mfi_cmd_pool_tbolt = NULL; >> + } >> + if (sc->request_desc_pool != NULL) { >> + free(sc->request_desc_pool, M_MFIBUF); >> + sc->request_desc_pool = NULL; >> + } >> + } >> if (sc->mfi_buffer_dmat != NULL) >> bus_dma_tag_destroy(sc->mfi_buffer_dmat); >> if (sc->mfi_parent_dmat != NULL) >> @@ -912,6 +1217,8 @@ mfi_startup(void *arg) >> sx_xlock(&sc->mfi_config_lock); >> mtx_lock(&sc->mfi_io_lock); >> mfi_ldprobe(sc); >> + if (sc->mfi_flags & MFI_FLAGS_SKINNY) >> + mfi_syspdprobe(sc); >> mtx_unlock(&sc->mfi_io_lock); >> sx_xunlock(&sc->mfi_config_lock); >> } >> @@ -928,12 +1235,7 @@ mfi_intr(void *arg) >> if (sc->mfi_check_clear_intr(sc)) >> return; >> >> - /* >> - * Do a dummy read to flush the interrupt ACK that we just performed, >> - * ensuring that everything is really, truly consistent. >> - */ >> - (void)sc->mfi_read_fw_status(sc); >> - >> +restart: >> pi = sc->mfi_comms->hw_pi; >> ci = sc->mfi_comms->hw_ci; >> mtx_lock(&sc->mfi_io_lock); >> @@ -958,6 +1260,14 @@ mfi_intr(void *arg) >> mfi_startio(sc); >> mtx_unlock(&sc->mfi_io_lock); >> >> + /* >> + * Dummy read to flush the bus; this ensures that the indexes are up >> + * to date. Restart processing if more commands have come it. >> + */ >> + (void)sc->mfi_read_fw_status(sc); >> + if (pi != sc->mfi_comms->hw_pi) >> + goto restart; >> + >> return; >> } >> >> @@ -978,6 +1288,9 @@ mfi_shutdown(struct mfi_softc *sc) >> if (sc->mfi_aen_cm != NULL) >> mfi_abort(sc, sc->mfi_aen_cm); >> >> + if (sc->mfi_map_sync_cm != NULL) >> + mfi_abort(sc, sc->mfi_map_sync_cm); >> + >> dcmd = &cm->cm_frame->dcmd; >> dcmd->header.flags = MFI_FRAME_DIR_NONE; >> cm->cm_flags = MFI_CMD_POLLED; >> @@ -993,6 +1306,81 @@ mfi_shutdown(struct mfi_softc *sc) >> } >> >> static void >> +mfi_syspdprobe(struct mfi_softc *sc) >> +{ >> + struct mfi_frame_header *hdr; >> + struct mfi_command *cm = NULL; >> + struct mfi_pd_list *pdlist = NULL; >> + struct mfi_system_pd *syspd, *tmp; >> + int error, i, found; >> + >> + sx_assert(&sc->mfi_config_lock, SA_XLOCKED); >> + mtx_assert(&sc->mfi_io_lock, MA_OWNED); >> + /* Add SYSTEM PD's */ >> + error = mfi_dcmd_command(sc, &cm, MFI_DCMD_PD_LIST_QUERY, >> + (void **)&pdlist, sizeof(*pdlist)); >> + if (error) { >> + device_printf(sc->mfi_dev, >> + "Error while forming SYSTEM PD list\n"); >> + goto out; >> + } >> + >> + cm->cm_flags = MFI_CMD_DATAIN | MFI_CMD_POLLED; >> + cm->cm_frame->dcmd.mbox[0] = MR_PD_QUERY_TYPE_EXPOSED_TO_HOST; >> + cm->cm_frame->dcmd.mbox[1] = 0; >> + if (mfi_mapcmd(sc, cm) != 0) { >> + device_printf(sc->mfi_dev, >> + "Failed to get syspd device listing\n"); >> + goto out; >> + } >> + bus_dmamap_sync(sc->mfi_buffer_dmat,cm->cm_dmamap, >> + BUS_DMASYNC_POSTREAD); >> + bus_dmamap_unload(sc->mfi_buffer_dmat, cm->cm_dmamap); >> + hdr = &cm->cm_frame->header; >> + if (hdr->cmd_status != MFI_STAT_OK) { >> + device_printf(sc->mfi_dev, >> + "MFI_DCMD_PD_LIST_QUERY failed %x\n", hdr->cmd_status); >> + goto out; >> + } >> + /* Get each PD and add it to the system */ >> + for (i = 0; i < pdlist->count; i++) { >> + if (pdlist->addr[i].device_id == >> + pdlist->addr[i].encl_device_id) >> + continue; >> + found = 0; >> + TAILQ_FOREACH(syspd, &sc->mfi_syspd_tqh, pd_link) { >> + if (syspd->pd_id == pdlist->addr[i].device_id) >> + found = 1; >> + } >> + if (found == 0) >> + mfi_add_sys_pd(sc, pdlist->addr[i].device_id); >> + } >> + /* Delete SYSPD's whose state has been changed */ >> + TAILQ_FOREACH_SAFE(syspd, &sc->mfi_syspd_tqh, pd_link, tmp) { >> + found = 0; >> + for (i = 0; i < pdlist->count; i++) { >> + if (syspd->pd_id == pdlist->addr[i].device_id) >> + found = 1; >> + } >> + if (found == 0) { >> + printf("DELETE\n"); >> + mtx_unlock(&sc->mfi_io_lock); >> + mtx_lock(&Giant); >> + device_delete_child(sc->mfi_dev, syspd->pd_dev); >> + mtx_unlock(&Giant); >> + mtx_lock(&sc->mfi_io_lock); >> + } >> + } >> +out: >> + if (pdlist) >> + free(pdlist, M_MFIBUF); >> + if (cm) >> + mfi_release_command(cm); >> + >> + return; >> +} >> + >> +static void >> mfi_ldprobe(struct mfi_softc *sc) >> { >> struct mfi_frame_header *hdr; >> @@ -1086,10 +1474,124 @@ format_class(int8_t class) >> static void >> mfi_decode_evt(struct mfi_softc *sc, struct mfi_evt_detail *detail) >> { >> + struct mfi_system_pd *syspd = NULL; >> >> device_printf(sc->mfi_dev, "%d (%s/0x%04x/%s) - %s\n", detail->seq, >> - format_timestamp(detail->time), detail->class.members.locale, >> - format_class(detail->class.members.class), detail->description); >> + format_timestamp(detail->time), detail->evt_class.members.locale, >> + format_class(detail->evt_class.members.evt_class), >> + detail->description); >> + >> + /* Don't act on old AEN's or while shutting down */ >> + if (detail->seq < sc->mfi_boot_seq_num || sc->mfi_detaching) >> + return; >> + >> + switch (detail->arg_type) { >> + case MR_EVT_ARGS_NONE: >> + if (detail->code == MR_EVT_CTRL_HOST_BUS_SCAN_REQUESTED) { >> + device_printf(sc->mfi_dev, "HostBus scan raised\n"); >> + if (mfi_detect_jbod_change) { >> + /* >> + * Probe for new SYSPD's and Delete >> + * invalid SYSPD's >> + */ >> + sx_xlock(&sc->mfi_config_lock); >> + mtx_lock(&sc->mfi_io_lock); >> + mfi_syspdprobe(sc); >> + mtx_unlock(&sc->mfi_io_lock); >> + sx_xunlock(&sc->mfi_config_lock); >> + } >> + } >> + break; >> + case MR_EVT_ARGS_LD_STATE: >> + /* During load time driver reads all the events starting >> + * from the one that has been logged after shutdown. Avoid >> + * these old events. >> + */ >> + if (detail->args.ld_state.new_state == MFI_LD_STATE_OFFLINE ) { >> + /* Remove the LD */ >> + struct mfi_disk *ld; >> + TAILQ_FOREACH(ld, &sc->mfi_ld_tqh, ld_link) { >> + if (ld->ld_id == >> + detail->args.ld_state.ld.target_id) >> + break; >> + } >> + /* >> + Fix: for kernel panics when SSCD is removed >> + KASSERT(ld != NULL, ("volume dissappeared")); >> + */ >> + if (ld != NULL) { >> + mtx_lock(&Giant); >> + device_delete_child(sc->mfi_dev, ld->ld_dev); >> + mtx_unlock(&Giant); >> + } >> + } >> + break; >> >> *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** >> _______________________________________________ >> svn-src-stable@freebsd.org mailing list >> http://lists.freebsd.org/mailman/listinfo/svn-src-stable >> To unsubscribe, send any mail to "svn-src-stable-unsubscribe@freebsd.org" >> > --20cf300fb37172126b04c058e103 Content-Type: text/x-diff; charset=US-ASCII; name="20120519023614-mfi-compile-fix-after-r235636.diff" Content-Disposition: attachment; filename="20120519023614-mfi-compile-fix-after-r235636.diff" Content-Transfer-Encoding: base64 X-Attachment-Id: file0 ZGlmZiAtLWdpdCBhL3Vzci5zYmluL21maXV0aWwvbWZpX2V2dC5jIGIvdXNyLnNiaW4vbWZpdXRp bC9tZmlfZXZ0LmMKaW5kZXggYTE0YmIxOS4uMzM2ZmJkMyAxMDA2NDQKLS0tIGEvdXNyLnNiaW4v bWZpdXRpbC9tZmlfZXZ0LmMKKysrIGIvdXNyLnNiaW4vbWZpdXRpbC9tZmlfZXZ0LmMKQEAgLTM2 Myw4ICszNjMsOCBAQCBtZmlfZGVjb2RlX2V2dChpbnQgZmQsIHN0cnVjdCBtZmlfZXZ0X2RldGFp bCAqZGV0YWlsLCBpbnQgdmVyYm9zZSkKIHsKIAogCXByaW50ZigiJTVkICglcy8lcy8lcykgLSAi LCBkZXRhaWwtPnNlcSwgZm9ybWF0X3RpbWVzdGFtcChkZXRhaWwtPnRpbWUpLAotCSAgICBmb3Jt YXRfbG9jYWxlKGRldGFpbC0+Y2xhc3MubWVtYmVycy5sb2NhbGUpLAotCSAgICBmb3JtYXRfY2xh c3MoZGV0YWlsLT5jbGFzcy5tZW1iZXJzLmNsYXNzKSk7CisJICAgIGZvcm1hdF9sb2NhbGUoZGV0 YWlsLT5ldnRfY2xhc3MubWVtYmVycy5sb2NhbGUpLAorCSAgICBmb3JtYXRfY2xhc3MoZGV0YWls LT5ldnRfY2xhc3MubWVtYmVycy5ldnRfY2xhc3MpKTsKIAlzd2l0Y2ggKGRldGFpbC0+YXJnX3R5 cGUpIHsKIAljYXNlIE1SX0VWVF9BUkdTX05PTkU6CiAJCWJyZWFrOwpAQCAtNTU5LDcgKzU1OSw3 IEBAIHNob3dfZXZlbnRzKGludCBhYywgY2hhciAqKmF2KQogCW51bV9ldmVudHMgPSAxNTsKIAlm aWx0ZXIubWVtYmVycy5yZXNlcnZlZCA9IDA7CiAJZmlsdGVyLm1lbWJlcnMubG9jYWxlID0gTUZJ X0VWVF9MT0NBTEVfQUxMOwotCWZpbHRlci5tZW1iZXJzLmNsYXNzID0gTUZJX0VWVF9DTEFTU19X QVJOSU5HOworCWZpbHRlci5tZW1iZXJzLmV2dF9jbGFzcyA9IE1GSV9FVlRfQ0xBU1NfV0FSTklO RzsKIAlzdGFydCA9IGluZm8uYm9vdF9zZXFfbnVtOwogCXN0b3AgPSBpbmZvLm5ld2VzdF9zZXFf bnVtOwogCXZlcmJvc2UgPSAwOwpAQCAtNTY5LDcgKzU2OSw3IEBAIHNob3dfZXZlbnRzKGludCBh YywgY2hhciAqKmF2KQogCXdoaWxlICgoY2ggPSBnZXRvcHQoYWMsIGF2LCAiYzpsOm46diIpKSAh PSAtMSkgewogCQlzd2l0Y2ggKGNoKSB7CiAJCWNhc2UgJ2MnOgotCQkJaWYgKHBhcnNlX2NsYXNz KG9wdGFyZywgJmZpbHRlci5tZW1iZXJzLmNsYXNzKSA8IDApIHsKKwkJCWlmIChwYXJzZV9jbGFz cyhvcHRhcmcsICZmaWx0ZXIubWVtYmVycy5ldnRfY2xhc3MpIDwgMCkgewogCQkJCWVycm9yID0g ZXJybm87CiAJCQkJd2FybigiRXJyb3IgcGFyc2luZyBldmVudCBjbGFzcyIpOwogCQkJCWNsb3Nl KGZkKTsK --20cf300fb37172126b04c058e103-- From owner-svn-src-stable-7@FreeBSD.ORG Sat May 19 14:13:16 2012 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C19F8106566C; Sat, 19 May 2012 14:13:16 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id ABB788FC08; Sat, 19 May 2012 14:13:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q4JEDGxG026281; Sat, 19 May 2012 14:13:16 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4JEDGCD026278; Sat, 19 May 2012 14:13:16 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201205191413.q4JEDGCD026278@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sat, 19 May 2012 14:13:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r235648 - stable/7/usr.sbin/mfiutil X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 May 2012 14:13:16 -0000 Author: bz Date: Sat May 19 14:13:16 2012 New Revision: 235648 URL: http://svn.freebsd.org/changeset/base/235648 Log: MFC r222589: There are a couple of structs in mfireg.h with members named 'class'. These cause problems when trying to include the header in a C++ project. Rename them to 'evt_class', and track the change in mfi and mfiutil. Submitted by: Mark Johnston Sponsored by: Sandvine Incorporated Missed with: r235636 Submitted by: Oliver Pinter (oliver.pntr gmail.com) to unbreak the build Modified: stable/7/usr.sbin/mfiutil/mfi_evt.c Directory Properties: stable/7/usr.sbin/mfiutil/ (props changed) Modified: stable/7/usr.sbin/mfiutil/mfi_evt.c ============================================================================== --- stable/7/usr.sbin/mfiutil/mfi_evt.c Sat May 19 12:44:27 2012 (r235647) +++ stable/7/usr.sbin/mfiutil/mfi_evt.c Sat May 19 14:13:16 2012 (r235648) @@ -363,8 +363,8 @@ mfi_decode_evt(int fd, struct mfi_evt_de { printf("%5d (%s/%s/%s) - ", detail->seq, format_timestamp(detail->time), - format_locale(detail->class.members.locale), - format_class(detail->class.members.class)); + format_locale(detail->evt_class.members.locale), + format_class(detail->evt_class.members.evt_class)); switch (detail->arg_type) { case MR_EVT_ARGS_NONE: break; @@ -559,7 +559,7 @@ show_events(int ac, char **av) num_events = 15; filter.members.reserved = 0; filter.members.locale = MFI_EVT_LOCALE_ALL; - filter.members.class = MFI_EVT_CLASS_WARNING; + filter.members.evt_class = MFI_EVT_CLASS_WARNING; start = info.boot_seq_num; stop = info.newest_seq_num; verbose = 0; @@ -569,7 +569,7 @@ show_events(int ac, char **av) while ((ch = getopt(ac, av, "c:l:n:v")) != -1) { switch (ch) { case 'c': - if (parse_class(optarg, &filter.members.class) < 0) { + if (parse_class(optarg, &filter.members.evt_class) < 0) { error = errno; warn("Error parsing event class"); close(fd); From owner-svn-src-stable-7@FreeBSD.ORG Sat May 19 14:15:39 2012 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id EF827106567B; Sat, 19 May 2012 14:15:39 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mx1.sbone.de (bird.sbone.de [46.4.1.90]) by mx1.freebsd.org (Postfix) with ESMTP id 9963C8FC16; Sat, 19 May 2012 14:15:39 +0000 (UTC) Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:31::2013:587]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.sbone.de (Postfix) with ESMTPS id 0E14F25D3897; Sat, 19 May 2012 14:15:37 +0000 (UTC) Received: from content-filter.sbone.de (content-filter.sbone.de [IPv6:fde9:577b:c1a9:31::2013:2742]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPS id EB398BE748A; Sat, 19 May 2012 14:15:36 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:31::2013:587]) by content-filter.sbone.de (content-filter.sbone.de [fde9:577b:c1a9:31::2013:2742]) (amavisd-new, port 10024) with ESMTP id zIcknlT2yHVN; Sat, 19 May 2012 14:15:36 +0000 (UTC) Received: from orange-en1.sbone.de (orange-en1.sbone.de [IPv6:fde9:577b:c1a9:31:cabc:c8ff:fecf:e8e3]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id F157EBE7489; Sat, 19 May 2012 14:15:35 +0000 (UTC) Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: "Bjoern A. Zeeb" In-Reply-To: Date: Sat, 19 May 2012 14:15:34 +0000 Content-Transfer-Encoding: quoted-printable Message-Id: <72892663-EFC5-4050-8D46-162BCCCD46AA@FreeBSD.org> References: <201205182329.q4INTU4X086651@svn.freebsd.org> To: Oliver Pinter X-Mailer: Apple Mail (2.1084) Cc: svn-src-stable@freebsd.org, Sean Bruno , src-committers@freebsd.org, svn-src-stable-7@freebsd.org, svn-src-all@freebsd.org Subject: Re: svn commit: r235636 - in stable/7/sys: conf dev/mfi modules/mfi X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 May 2012 14:15:40 -0000 On 19. May 2012, at 00:37 , Oliver Pinter wrote: > <20120519023614-mfi-compile-fix-after-r235636.diff> I did a proper MFC of the missing change; I think stable/7 should be = good now. Thanks! /bz going to look at 8 and the others now as well. --=20 Bjoern A. Zeeb You have to have visions! It does not matter how good you are. It matters what good you do! From owner-svn-src-stable-7@FreeBSD.ORG Sat May 19 14:38:15 2012 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 944B4106566B; Sat, 19 May 2012 14:38:15 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7D0888FC18; Sat, 19 May 2012 14:38:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q4JEcF4k027504; Sat, 19 May 2012 14:38:15 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4JEcFch027499; Sat, 19 May 2012 14:38:15 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201205191438.q4JEcFch027499@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sat, 19 May 2012 14:38:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r235651 - in stable/7: lib/libc/gen sys/net sys/sys X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 May 2012 14:38:15 -0000 Author: bz Date: Sat May 19 14:38:14 2012 New Revision: 235651 URL: http://svn.freebsd.org/changeset/base/235651 Log: MFC r231505,231520: Introduce a new NET_RT_IFLISTL API to query the address list. It works on extended and extensible structs if_msghdrl and ifa_msghdrl. This will allow us to extend both the msghdrl structs and eventually if_data in the future without breaking the ABI. The MFC is just to provide the new API to old stable branches to make updating and if needed downgrading a lot easier for updates to 10. Modified: stable/7/lib/libc/gen/sysctl.3 stable/7/sys/net/if.h stable/7/sys/net/rtsock.c stable/7/sys/sys/socket.h Directory Properties: stable/7/lib/libc/ (props changed) stable/7/sys/ (props changed) Modified: stable/7/lib/libc/gen/sysctl.3 ============================================================================== --- stable/7/lib/libc/gen/sysctl.3 Sat May 19 14:32:47 2012 (r235650) +++ stable/7/lib/libc/gen/sysctl.3 Sat May 19 14:38:14 2012 (r235651) @@ -28,7 +28,7 @@ .\" @(#)sysctl.3 8.4 (Berkeley) 5/9/95 .\" $FreeBSD$ .\" -.Dd April 25, 2010 +.Dd February 11, 2012 .Dt SYSCTL 3 .Os .Sh NAME @@ -568,6 +568,7 @@ The fifth and sixth level names are as f .It "NET_RT_DUMP None" .It "NET_RT_IFLIST 0 or if_index" .It "NET_RT_IFMALIST 0 or if_index" +.It "NET_RT_IFLISTL 0 or if_index" .El .Pp The @@ -575,6 +576,19 @@ The name returns information about multicast group memberships on all interfaces if 0 is specified, or for the interface specified by .Va if_index . +.Pp +The +.Dv NET_RT_IFLISTL +is like +.Dv NET_RT_IFLIST , +just returning message header structs with additional fields allowing the +interface to be extended without breaking binary compatibility. +The +.Dv NET_RT_IFLISTL +uses 'l' versions of the message header structures: +.Va struct if_msghdrl +and +.Va struct ifa_msghdrl . .It Li PF_INET Get or set various global information about the IPv4 (Internet Protocol version 4). Modified: stable/7/sys/net/if.h ============================================================================== --- stable/7/sys/net/if.h Sat May 19 14:32:47 2012 (r235650) +++ stable/7/sys/net/if.h Sat May 19 14:38:14 2012 (r235651) @@ -230,6 +230,7 @@ struct if_data { /* * Message format for use in obtaining information about interfaces * from getkerninfo and the routing socket + * For the new, extensible interface see struct if_msghdrl below. */ struct if_msghdr { u_short ifm_msglen; /* to skip over non-understood messages */ @@ -242,8 +243,34 @@ struct if_msghdr { }; /* + * The 'l' version shall be used by new interfaces, like NET_RT_IFLISTL. It is + * extensible after ifm_data_off or within ifm_data. Both the if_msghdr and + * if_data now have a member field detailing the struct length in addition to + * the routing message length. Macros are provided to find the start of + * ifm_data and the start of the socket address strucutres immediately following + * struct if_msghdrl given a pointer to struct if_msghdrl. + */ +#define IF_MSGHDRL_IFM_DATA(_l) \ + (struct if_data *)((char *)(_l) + (_l)->ifm_data_off) +#define IF_MSGHDRL_RTA(_l) \ + (void *)((uintptr_t)(_l) + (_l)->ifm_len) +struct if_msghdrl { + u_short ifm_msglen; /* to skip over non-understood messages */ + u_char ifm_version; /* future binary compatibility */ + u_char ifm_type; /* message type */ + int ifm_addrs; /* like rtm_addrs */ + int ifm_flags; /* value of if_flags */ + u_short ifm_index; /* index for associated ifp */ + u_short _ifm_spare1; /* spare space to grow if_index, see if_var.h */ + u_short ifm_len; /* length of if_msghdrl incl. if_data */ + u_short ifm_data_off; /* offset of if_data from beginning */ + struct if_data ifm_data;/* statistics and other data about if */ +}; + +/* * Message format for use in obtaining information about interface addresses * from getkerninfo and the routing socket + * For the new, extensible interface see struct ifa_msghdrl below. */ struct ifa_msghdr { u_short ifam_msglen; /* to skip over non-understood messages */ @@ -256,6 +283,33 @@ struct ifa_msghdr { }; /* + * The 'l' version shall be used by new interfaces, like NET_RT_IFLISTL. It is + * extensible after ifam_metric or within ifam_data. Both the ifa_msghdrl and + * if_data now have a member field detailing the struct length in addition to + * the routing message length. Macros are provided to find the start of + * ifm_data and the start of the socket address strucutres immediately following + * struct ifa_msghdrl given a pointer to struct ifa_msghdrl. + */ +#define IFA_MSGHDRL_IFAM_DATA(_l) \ + (struct if_data *)((char *)(_l) + (_l)->ifam_data_off) +#define IFA_MSGHDRL_RTA(_l) \ + (void *)((uintptr_t)(_l) + (_l)->ifam_len) +struct ifa_msghdrl { + u_short ifam_msglen; /* to skip over non-understood messages */ + u_char ifam_version; /* future binary compatibility */ + u_char ifam_type; /* message type */ + int ifam_addrs; /* like rtm_addrs */ + int ifam_flags; /* value of ifa_flags */ + u_short ifam_index; /* index for associated ifp */ + u_short _ifam_spare1; /* spare space to grow if_index, see if_var.h */ + u_short ifam_len; /* length of ifa_msghdrl incl. if_data */ + u_short ifam_data_off; /* offset of if_data from beginning */ + int ifam_metric; /* value of ifa_metric */ + struct if_data ifam_data;/* statistics and other data about if or + * address */ +}; + +/* * Message format for use in obtaining information about multicast addresses * from the routing socket */ Modified: stable/7/sys/net/rtsock.c ============================================================================== --- stable/7/sys/net/rtsock.c Sat May 19 14:32:47 2012 (r235650) +++ stable/7/sys/net/rtsock.c Sat May 19 14:38:14 2012 (r235651) @@ -62,6 +62,76 @@ extern void sctp_addr_change(struct ifaddr *ifa, int cmd); #endif /* SCTP */ +#ifdef COMPAT_FREEBSD32 +#include +#include + +struct if_data32 { + uint8_t ifi_type; + uint8_t ifi_physical; + uint8_t ifi_addrlen; + uint8_t ifi_hdrlen; + uint8_t ifi_link_state; + uint8_t ifi_spare_char1; + uint8_t ifi_spare_char2; + uint8_t ifi_datalen; + uint32_t ifi_mtu; + uint32_t ifi_metric; + uint32_t ifi_baudrate; + uint32_t ifi_ipackets; + uint32_t ifi_ierrors; + uint32_t ifi_opackets; + uint32_t ifi_oerrors; + uint32_t ifi_collisions; + uint32_t ifi_ibytes; + uint32_t ifi_obytes; + uint32_t ifi_imcasts; + uint32_t ifi_omcasts; + uint32_t ifi_iqdrops; + uint32_t ifi_noproto; + uint32_t ifi_hwassist; + int32_t ifi_epoch; + struct timeval32 ifi_lastchange; +}; + +struct if_msghdr32 { + uint16_t ifm_msglen; + uint8_t ifm_version; + uint8_t ifm_type; + int32_t ifm_addrs; + int32_t ifm_flags; + uint16_t ifm_index; + struct if_data32 ifm_data; +}; + +struct if_msghdrl32 { + uint16_t ifm_msglen; + uint8_t ifm_version; + uint8_t ifm_type; + int32_t ifm_addrs; + int32_t ifm_flags; + uint16_t ifm_index; + uint16_t _ifm_spare1; + uint16_t ifm_len; + uint16_t ifm_data_off; + struct if_data32 ifm_data; +}; + +struct ifa_msghdrl32 { + uint16_t ifam_msglen; + uint8_t ifam_version; + uint8_t ifam_type; + int32_t ifam_addrs; + int32_t ifam_flags; + uint16_t ifam_index; + uint16_t _ifam_spare1; + uint16_t ifam_len; + uint16_t ifam_data_off; + int32_t ifam_metric; + struct if_data32 ifam_data; +}; +#endif /* COMPAT_FREEBSD32 */ + MALLOC_DEFINE(M_RTABLE, "routetbl", "routing tables"); /* NB: these are not modified */ @@ -845,6 +915,9 @@ rt_xaddrs(caddr_t cp, caddr_t cplim, str return (0); } +/* + * Used by the routing socket. + */ static struct mbuf * rt_msg1(int type, struct rt_addrinfo *rtinfo) { @@ -912,6 +985,9 @@ rt_msg1(int type, struct rt_addrinfo *rt return (m); } +/* + * Used by the sysctl code and routing socket. + */ static int rt_msg2(int type, struct rt_addrinfo *rtinfo, caddr_t cp, struct walkarg *w) { @@ -925,11 +1001,31 @@ again: case RTM_DELADDR: case RTM_NEWADDR: - len = sizeof(struct ifa_msghdr); + if (w != NULL && w->w_op == NET_RT_IFLISTL) { +#ifdef COMPAT_FREEBSD32 + if (w->w_req->flags & SCTL_MASK32) + len = sizeof(struct ifa_msghdrl32); + else +#endif + len = sizeof(struct ifa_msghdrl); + } else + len = sizeof(struct ifa_msghdr); break; case RTM_IFINFO: - len = sizeof(struct if_msghdr); +#ifdef COMPAT_FREEBSD32 + if (w != NULL && w->w_req->flags & SCTL_MASK32) { + if (w->w_op == NET_RT_IFLISTL) + len = sizeof(struct if_msghdrl32); + else + len = sizeof(struct if_msghdr32); + break; + } +#endif + if (w != NULL && w->w_op == NET_RT_IFLISTL) + len = sizeof(struct if_msghdrl); + else + len = sizeof(struct if_msghdr); break; case RTM_NEWMADDR: @@ -1314,6 +1410,127 @@ sysctl_dumpentry(struct radix_node *rn, } static int +sysctl_iflist_ifml(struct ifnet *ifp, struct rt_addrinfo *info, + struct walkarg *w, int len) +{ + struct if_msghdrl *ifm; + +#ifdef COMPAT_FREEBSD32 + if (w->w_req->flags & SCTL_MASK32) { + struct if_msghdrl32 *ifm32; + + ifm32 = (struct if_msghdrl32 *)w->w_tmem; + ifm32->ifm_addrs = info->rti_addrs; + ifm32->ifm_flags = ifp->if_flags | ifp->if_drv_flags; + ifm32->ifm_index = ifp->if_index; + ifm32->_ifm_spare1 = 0; + ifm32->ifm_len = sizeof(*ifm32); + ifm32->ifm_data_off = offsetof(struct if_msghdrl32, ifm_data); + + copy_ifdata32(&ifp->if_data, &ifm32->ifm_data); + + return (SYSCTL_OUT(w->w_req, (caddr_t)ifm32, len)); + } +#endif + ifm = (struct if_msghdrl *)w->w_tmem; + ifm->ifm_addrs = info->rti_addrs; + ifm->ifm_flags = ifp->if_flags | ifp->if_drv_flags; + ifm->ifm_index = ifp->if_index; + ifm->_ifm_spare1 = 0; + ifm->ifm_len = sizeof(*ifm); + ifm->ifm_data_off = offsetof(struct if_msghdrl, ifm_data); + + ifm->ifm_data = ifp->if_data; + + return (SYSCTL_OUT(w->w_req, (caddr_t)ifm, len)); +} + +static int +sysctl_iflist_ifm(struct ifnet *ifp, struct rt_addrinfo *info, + struct walkarg *w, int len) +{ + struct if_msghdr *ifm; + +#ifdef COMPAT_FREEBSD32 + if (w->w_req->flags & SCTL_MASK32) { + struct if_msghdr32 *ifm32; + + ifm32 = (struct if_msghdr32 *)w->w_tmem; + ifm32->ifm_addrs = info->rti_addrs; + ifm32->ifm_flags = ifp->if_flags | ifp->if_drv_flags; + ifm32->ifm_index = ifp->if_index; + + copy_ifdata32(&ifp->if_data, &ifm32->ifm_data); + + return (SYSCTL_OUT(w->w_req, (caddr_t)ifm32, len)); + } +#endif + ifm = (struct if_msghdr *)w->w_tmem; + ifm->ifm_addrs = info->rti_addrs; + ifm->ifm_flags = ifp->if_flags | ifp->if_drv_flags; + ifm->ifm_index = ifp->if_index; + + ifm->ifm_data = ifp->if_data; + + return (SYSCTL_OUT(w->w_req, (caddr_t)ifm, len)); +} + +static int +sysctl_iflist_ifaml(struct ifaddr *ifa, struct rt_addrinfo *info, + struct walkarg *w, int len) +{ + struct ifa_msghdrl *ifam; + +#ifdef COMPAT_FREEBSD32 + if (w->w_req->flags & SCTL_MASK32) { + struct ifa_msghdrl32 *ifam32; + + ifam32 = (struct ifa_msghdrl32 *)w->w_tmem; + ifam32->ifam_addrs = info->rti_addrs; + ifam32->ifam_flags = ifa->ifa_flags; + ifam32->ifam_index = ifa->ifa_ifp->if_index; + ifam32->_ifam_spare1 = 0; + ifam32->ifam_len = sizeof(*ifam32); + ifam32->ifam_data_off = + offsetof(struct ifa_msghdrl32, ifam_data); + ifam32->ifam_metric = ifa->ifa_metric; + + copy_ifdata32(&ifa->ifa_ifp->if_data, &ifam32->ifam_data); + + return (SYSCTL_OUT(w->w_req, (caddr_t)ifam32, len)); + } +#endif + + ifam = (struct ifa_msghdrl *)w->w_tmem; + ifam->ifam_addrs = info->rti_addrs; + ifam->ifam_flags = ifa->ifa_flags; + ifam->ifam_index = ifa->ifa_ifp->if_index; + ifam->_ifam_spare1 = 0; + ifam->ifam_len = sizeof(*ifam); + ifam->ifam_data_off = offsetof(struct ifa_msghdrl, ifam_data); + ifam->ifam_metric = ifa->ifa_metric; + + ifam->ifam_data = ifa->if_data; + + return (SYSCTL_OUT(w->w_req, w->w_tmem, len)); +} + +static int +sysctl_iflist_ifam(struct ifaddr *ifa, struct rt_addrinfo *info, + struct walkarg *w, int len) +{ + struct ifa_msghdr *ifam; + + ifam = (struct ifa_msghdr *)w->w_tmem; + ifam->ifam_addrs = info->rti_addrs; + ifam->ifam_flags = ifa->ifa_flags; + ifam->ifam_index = ifa->ifa_ifp->if_index; + ifam->ifam_metric = ifa->ifa_metric; + + return (SYSCTL_OUT(w->w_req, w->w_tmem, len)); +} + +static int sysctl_iflist(int af, struct walkarg *w) { struct ifnet *ifp; @@ -1332,14 +1549,10 @@ sysctl_iflist(int af, struct walkarg *w) len = rt_msg2(RTM_IFINFO, &info, NULL, w); info.rti_info[RTAX_IFP] = NULL; if (w->w_req && w->w_tmem) { - struct if_msghdr *ifm; - - ifm = (struct if_msghdr *)w->w_tmem; - ifm->ifm_index = ifp->if_index; - ifm->ifm_flags = ifp->if_flags | ifp->if_drv_flags; - ifm->ifm_data = ifp->if_data; - ifm->ifm_addrs = info.rti_addrs; - error = SYSCTL_OUT(w->w_req,(caddr_t)ifm, len); + if (w->w_op == NET_RT_IFLISTL) + error = sysctl_iflist_ifml(ifp, &info, w, len); + else + error = sysctl_iflist_ifm(ifp, &info, w, len); if (error) goto done; } @@ -1354,14 +1567,12 @@ sysctl_iflist(int af, struct walkarg *w) info.rti_info[RTAX_BRD] = ifa->ifa_dstaddr; len = rt_msg2(RTM_NEWADDR, &info, NULL, w); if (w->w_req && w->w_tmem) { - struct ifa_msghdr *ifam; - - ifam = (struct ifa_msghdr *)w->w_tmem; - ifam->ifam_index = ifa->ifa_ifp->if_index; - ifam->ifam_flags = ifa->ifa_flags; - ifam->ifam_metric = ifa->ifa_metric; - ifam->ifam_addrs = info.rti_addrs; - error = SYSCTL_OUT(w->w_req, w->w_tmem, len); + if (w->w_op == NET_RT_IFLISTL) + error = sysctl_iflist_ifaml(ifa, &info, + w, len); + else + error = sysctl_iflist_ifam(ifa, &info, + w, len); if (error) goto done; } @@ -1473,6 +1684,7 @@ sysctl_rtsock(SYSCTL_HANDLER_ARGS) break; case NET_RT_IFLIST: + case NET_RT_IFLISTL: error = sysctl_iflist(af, &w); break; Modified: stable/7/sys/sys/socket.h ============================================================================== --- stable/7/sys/sys/socket.h Sat May 19 14:32:47 2012 (r235650) +++ stable/7/sys/sys/socket.h Sat May 19 14:38:14 2012 (r235651) @@ -416,7 +416,9 @@ struct sockaddr_storage { #define NET_RT_FLAGS 2 /* by flags, e.g. RESOLVING */ #define NET_RT_IFLIST 3 /* survey interface list */ #define NET_RT_IFMALIST 4 /* return multicast address list */ -#define NET_RT_MAXID 5 +#define NET_RT_IFLISTL 5 /* Survey interface list, using 'l'en + * versions of msghdr structs. */ +#define NET_RT_MAXID 6 #define CTL_NET_RT_NAMES { \ { 0, 0 }, \ @@ -424,6 +426,7 @@ struct sockaddr_storage { { "flags", CTLTYPE_STRUCT }, \ { "iflist", CTLTYPE_STRUCT }, \ { "ifmalist", CTLTYPE_STRUCT }, \ + { "iflistl", CTLTYPE_STRUCT }, \ } #endif /* __BSD_VISIBLE */ From owner-svn-src-stable-7@FreeBSD.ORG Sat May 19 18:33:29 2012 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 9F84C10657F4; Sat, 19 May 2012 18:33:29 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 898418FC08; Sat, 19 May 2012 18:33:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q4JIXTc6038533; Sat, 19 May 2012 18:33:29 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4JIXTiJ038527; Sat, 19 May 2012 18:33:29 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201205191833.q4JIXTiJ038527@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sat, 19 May 2012 18:33:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r235659 - stable/7/sys/netinet X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 May 2012 18:33:29 -0000 Author: bz Date: Sat May 19 18:33:28 2012 New Revision: 235659 URL: http://svn.freebsd.org/changeset/base/235659 Log: MFC r231767: Fix PAWS (Protect Against Wrapped Sequence numbers) in cases when hz >> 1000 and thus getting outside the timestamp clock frequenceny of 1ms < x < 1s per tick as mandated by RFC1323, leading to connection resets on idle connections. Always use a granularity of 1ms using getmicrouptime() making all but relevant callouts independent of hz. Use getmicrouptime(), not getmicrotime() as the latter may make a jump possibly breaking TCP nfsroot mounts having our timestamps move forward for more than 24.8 days in a second without having been idle for that long. PR: kern/61404 Modified: stable/7/sys/netinet/tcp_input.c stable/7/sys/netinet/tcp_output.c stable/7/sys/netinet/tcp_seq.h stable/7/sys/netinet/tcp_syncache.c stable/7/sys/netinet/tcp_timewait.c Directory Properties: stable/7/sys/ (props changed) Modified: stable/7/sys/netinet/tcp_input.c ============================================================================== --- stable/7/sys/netinet/tcp_input.c Sat May 19 18:33:08 2012 (r235658) +++ stable/7/sys/netinet/tcp_input.c Sat May 19 18:33:28 2012 (r235659) @@ -933,7 +933,7 @@ tcp_do_segment(struct mbuf *m, struct tc */ if ((to.to_flags & TOF_TS) && (to.to_tsecr != 0)) { to.to_tsecr -= tp->ts_offset; - if (TSTMP_GT(to.to_tsecr, ticks)) + if (TSTMP_GT(to.to_tsecr, tcp_ts_getticks())) to.to_tsecr = 0; } @@ -958,7 +958,7 @@ tcp_do_segment(struct mbuf *m, struct tc if (to.to_flags & TOF_TS) { tp->t_flags |= TF_RCVD_TSTMP; tp->ts_recent = to.to_tsval; - tp->ts_recent_age = ticks; + tp->ts_recent_age = tcp_ts_getticks(); } if (to.to_flags & TOF_MSS) tcp_mss(tp, to.to_mss); @@ -1002,7 +1002,7 @@ tcp_do_segment(struct mbuf *m, struct tc */ if ((to.to_flags & TOF_TS) != 0 && SEQ_LEQ(th->th_seq, tp->last_ack_sent)) { - tp->ts_recent_age = ticks; + tp->ts_recent_age = tcp_ts_getticks(); tp->ts_recent = to.to_tsval; } @@ -1054,11 +1054,13 @@ tcp_do_segment(struct mbuf *m, struct tc */ if ((to.to_flags & TOF_TS) != 0 && to.to_tsecr) { - if (!tp->t_rttlow || - tp->t_rttlow > ticks - to.to_tsecr) - tp->t_rttlow = ticks - to.to_tsecr; + u_int t; + + t = tcp_ts_getticks() - to.to_tsecr; + if (!tp->t_rttlow || tp->t_rttlow > t) + tp->t_rttlow = t; tcp_xmit_timer(tp, - ticks - to.to_tsecr + 1); + TCP_TS_TO_TICKS(t) + 1); } else if (tp->t_rtttime && SEQ_GT(th->th_ack, tp->t_rtseq)) { if (!tp->t_rttlow || @@ -1499,7 +1501,7 @@ tcp_do_segment(struct mbuf *m, struct tc TSTMP_LT(to.to_tsval, tp->ts_recent)) { /* Check to see if ts_recent is over 24 days old. */ - if ((int)(ticks - tp->ts_recent_age) > TCP_PAWS_IDLE) { + if (tcp_ts_getticks() - tp->ts_recent_age > TCP_PAWS_IDLE) { /* * Invalidate ts_recent. If this segment updates * ts_recent, the age will be reset later and ts_recent @@ -1652,7 +1654,7 @@ tcp_do_segment(struct mbuf *m, struct tc SEQ_LEQ(th->th_seq, tp->last_ack_sent) && SEQ_LEQ(tp->last_ack_sent, th->th_seq + tlen + ((thflags & (TH_SYN|TH_FIN)) != 0))) { - tp->ts_recent_age = ticks; + tp->ts_recent_age = tcp_ts_getticks(); tp->ts_recent = to.to_tsval; } @@ -1994,11 +1996,13 @@ process_ACK: * timestamps of 0 or we could calculate a * huge RTT and blow up the retransmit timer. */ - if ((to.to_flags & TOF_TS) != 0 && - to.to_tsecr) { - if (!tp->t_rttlow || tp->t_rttlow > ticks - to.to_tsecr) - tp->t_rttlow = ticks - to.to_tsecr; - tcp_xmit_timer(tp, ticks - to.to_tsecr + 1); + if ((to.to_flags & TOF_TS) != 0 && to.to_tsecr) { + u_int t; + + t = tcp_ts_getticks() - to.to_tsecr; + if (!tp->t_rttlow || tp->t_rttlow > t) + tp->t_rttlow = t; + tcp_xmit_timer(tp, TCP_TS_TO_TICKS(t) + 1); } else if (tp->t_rtttime && SEQ_GT(th->th_ack, tp->t_rtseq)) { if (!tp->t_rttlow || tp->t_rttlow > ticks - tp->t_rtttime) tp->t_rttlow = ticks - tp->t_rtttime; Modified: stable/7/sys/netinet/tcp_output.c ============================================================================== --- stable/7/sys/netinet/tcp_output.c Sat May 19 18:33:08 2012 (r235658) +++ stable/7/sys/netinet/tcp_output.c Sat May 19 18:33:28 2012 (r235659) @@ -685,13 +685,13 @@ send: /* Timestamps. */ if ((tp->t_flags & TF_RCVD_TSTMP) || ((flags & TH_SYN) && (tp->t_flags & TF_REQ_TSTMP))) { - to.to_tsval = ticks + tp->ts_offset; + to.to_tsval = tcp_ts_getticks() + tp->ts_offset; to.to_tsecr = tp->ts_recent; to.to_flags |= TOF_TS; /* Set receive buffer autosizing timestamp. */ if (tp->rfbuf_ts == 0 && (so->so_rcv.sb_flags & SB_AUTOSIZE)) - tp->rfbuf_ts = ticks; + tp->rfbuf_ts = tcp_ts_getticks(); } /* Selective ACK's. */ if (tp->t_flags & TF_SACK_PERMIT) { Modified: stable/7/sys/netinet/tcp_seq.h ============================================================================== --- stable/7/sys/netinet/tcp_seq.h Sat May 19 18:33:08 2012 (r235658) +++ stable/7/sys/netinet/tcp_seq.h Sat May 19 18:33:28 2012 (r235659) @@ -62,7 +62,34 @@ (tp)->snd_una = (tp)->snd_nxt = (tp)->snd_max = (tp)->snd_up = \ (tp)->snd_recover = (tp)->iss -#define TCP_PAWS_IDLE (24 * 24 * 60 * 60 * hz) - /* timestamp wrap-around time */ +#ifdef _KERNEL +/* + * Clock macros for RFC 1323 timestamps. + */ +#define TCP_TS_TO_TICKS(_t) ((_t) * hz / 1000) + +/* Timestamp wrap-around time, 24 days. */ +#define TCP_PAWS_IDLE (24 * 24 * 60 * 60 * 1000) + +/* + * tcp_ts_getticks() in ms, should be 1ms < x < 1000ms according to RFC 1323. + * We always use 1ms granularity independent of hz. + */ +static __inline u_int +tcp_ts_getticks(void) +{ + struct timeval tv; + u_long ms; + + /* + * getmicrouptime() should be good enough for any 1-1000ms granularity. + * Do not use getmicrotime() here as it might break nfsroot/tcp. + */ + getmicrouptime(&tv); + ms = tv.tv_sec * 1000 + tv.tv_usec / 1000; + + return (ms); +} +#endif /* _KERNEL */ #endif /* _NETINET_TCP_SEQ_H_ */ Modified: stable/7/sys/netinet/tcp_syncache.c ============================================================================== --- stable/7/sys/netinet/tcp_syncache.c Sat May 19 18:33:08 2012 (r235658) +++ stable/7/sys/netinet/tcp_syncache.c Sat May 19 18:33:28 2012 (r235659) @@ -821,7 +821,7 @@ syncache_socket(struct syncache *sc, str if (sc->sc_flags & SCF_TIMESTAMP) { tp->t_flags |= TF_REQ_TSTMP|TF_RCVD_TSTMP; tp->ts_recent = sc->sc_tsreflect; - tp->ts_recent_age = ticks; + tp->ts_recent_age = tcp_ts_getticks(); tp->ts_offset = sc->sc_tsoff; } #ifdef TCP_SIGNATURE @@ -1224,7 +1224,7 @@ _syncache_add(struct in_conninfo *inc, s */ if (to->to_flags & TOF_TS) { sc->sc_tsreflect = to->to_tsval; - sc->sc_ts = ticks; + sc->sc_ts = tcp_ts_getticks(); sc->sc_flags |= SCF_TIMESTAMP; } if (to->to_flags & TOF_SCALE) { @@ -1640,7 +1640,7 @@ syncookie_generate(struct syncache_head data |= md5_buffer[2] << 10; /* more digest bits */ data ^= md5_buffer[3]; sc->sc_ts = data; - sc->sc_tsoff = data - ticks; /* after XOR */ + sc->sc_tsoff = data - tcp_ts_getticks(); /* after XOR */ } tcpstat.tcps_sc_sendcookie++; @@ -1725,7 +1725,7 @@ syncookie_lookup(struct in_conninfo *inc sc->sc_flags |= SCF_TIMESTAMP; sc->sc_tsreflect = to->to_tsval; sc->sc_ts = to->to_tsecr; - sc->sc_tsoff = to->to_tsecr - ticks; + sc->sc_tsoff = to->to_tsecr - tcp_ts_getticks(); sc->sc_flags |= (data & 0x1) ? SCF_SIGNATURE : 0; sc->sc_flags |= ((data >> 1) & 0x1) ? SCF_SACK : 0; sc->sc_requested_s_scale = min((data >> 2) & 0xf, Modified: stable/7/sys/netinet/tcp_timewait.c ============================================================================== --- stable/7/sys/netinet/tcp_timewait.c Sat May 19 18:33:08 2012 (r235658) +++ stable/7/sys/netinet/tcp_timewait.c Sat May 19 18:33:28 2012 (r235659) @@ -517,7 +517,7 @@ tcp_twrespond(struct tcptw *tw, int flag */ if (tw->t_recent && flags == TH_ACK) { to.to_flags |= TOF_TS; - to.to_tsval = ticks + tw->ts_offset; + to.to_tsval = tcp_ts_getticks() + tw->ts_offset; to.to_tsecr = tw->t_recent; } optlen = tcp_addoptions(&to, (u_char *)(th + 1)); From owner-svn-src-stable-7@FreeBSD.ORG Sat May 19 22:17:35 2012 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D91B81065670; Sat, 19 May 2012 22:17:35 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C44358FC16; Sat, 19 May 2012 22:17:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q4JMHZek048918; Sat, 19 May 2012 22:17:35 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4JMHZNu048916; Sat, 19 May 2012 22:17:35 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201205192217.q4JMHZNu048916@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sat, 19 May 2012 22:17:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r235667 - stable/7/sys/dev/ixgbe X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 May 2012 22:17:36 -0000 Author: bz Date: Sat May 19 22:17:34 2012 New Revision: 235667 URL: http://svn.freebsd.org/changeset/base/235667 Log: MFC r234620: If we pass down 64k - L2 hdr size + 1 to 64K L3+ data adding an ether header will make the data go over the 64k limits announced to busdma as maxsize and the transaction will fail. With TSO this can result in a TCP regression due to the lost packet. According to the data sheets ixgbe(4) 82598 and 82599 can handle up to 256k so increase the maximum. Reported by: Jon Kåre Hellan, UNINETT (jon.kare.hellan uninett.no) Tested by: Jon Kåre Hellan, UNINETT (jon.kare.hellan uninett.no) Modified: stable/7/sys/dev/ixgbe/ixgbe.h Directory Properties: stable/7/sys/ (props changed) Modified: stable/7/sys/dev/ixgbe/ixgbe.h ============================================================================== --- stable/7/sys/dev/ixgbe/ixgbe.h Sat May 19 22:16:12 2012 (r235666) +++ stable/7/sys/dev/ixgbe/ixgbe.h Sat May 19 22:17:34 2012 (r235667) @@ -168,7 +168,7 @@ #define IXGBE_82599_SCATTER 32 #define MSIX_82598_BAR 3 #define MSIX_82599_BAR 4 -#define IXGBE_TSO_SIZE 65535 +#define IXGBE_TSO_SIZE 262140 #define IXGBE_TX_BUFFER_SIZE ((u32) 1514) #define IXGBE_RX_HDR 128 #define CSUM_OFFLOAD 7 /* Bits in csum flags */ From owner-svn-src-stable-7@FreeBSD.ORG Sat May 19 22:50:39 2012 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 712321065675; Sat, 19 May 2012 22:50:39 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5BEE18FC12; Sat, 19 May 2012 22:50:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q4JModp5050567; Sat, 19 May 2012 22:50:39 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4JModox050565; Sat, 19 May 2012 22:50:39 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201205192250.q4JModox050565@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sat, 19 May 2012 22:50:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r235670 - stable/7/sys/dev/re X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 May 2012 22:50:39 -0000 Author: bz Date: Sat May 19 22:50:38 2012 New Revision: 235670 URL: http://svn.freebsd.org/changeset/base/235670 Log: MFC r234643: Do not toggle IFCAP_TSO4 if we would also do TSO6. Given the driver does not currently announce/support TSO6 that cannot happen. Clean it up anyway for consistency. Modified: stable/7/sys/dev/re/if_re.c Directory Properties: stable/7/sys/ (props changed) Modified: stable/7/sys/dev/re/if_re.c ============================================================================== --- stable/7/sys/dev/re/if_re.c Sat May 19 22:50:22 2012 (r235669) +++ stable/7/sys/dev/re/if_re.c Sat May 19 22:50:38 2012 (r235670) @@ -3386,7 +3386,7 @@ re_ioctl(struct ifnet *ifp, u_long comma reinit = 1; } if ((mask & IFCAP_TSO4) != 0 && - (ifp->if_capabilities & IFCAP_TSO) != 0) { + (ifp->if_capabilities & IFCAP_TSO4) != 0) { ifp->if_capenable ^= IFCAP_TSO4; if ((IFCAP_TSO4 & ifp->if_capenable) != 0) ifp->if_hwassist |= CSUM_TSO;