From owner-svn-src-stable-7@FreeBSD.ORG Sun Nov 6 07:11:29 2011 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 03D5A106564A; Sun, 6 Nov 2011 07:11:29 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DC9A28FC12; Sun, 6 Nov 2011 07:11: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 pA67BSRG004675; Sun, 6 Nov 2011 07:11:28 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA67BRoE004672; Sun, 6 Nov 2011 07:11:27 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201111060711.pA67BRoE004672@svn.freebsd.org> From: Doug Barton Date: Sun, 6 Nov 2011 07:11:27 +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: r227135 - 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, 06 Nov 2011 07:11:29 -0000 Author: dougb Date: Sun Nov 6 07:11:27 2011 New Revision: 227135 URL: http://svn.freebsd.org/changeset/base/227135 Log: MFC r226898: Fix the text and attribution of the poem "Youth" by Samuel Ullman. Our copy was a bastardization of the "older" (probably original?) and shorter version of the poem; and the "newer" version that is better known, and arguably more popular. Standardize on the latter. Cf. http://www.bartleby.com/73/2099.html Modified: stable/7/games/fortune/datfiles/fortunes Directory Properties: stable/7/games/fortune/ (props changed) Modified: stable/7/games/fortune/datfiles/fortunes ============================================================================== --- stable/7/games/fortune/datfiles/fortunes Sun Nov 6 07:07:02 2011 (r227134) +++ stable/7/games/fortune/datfiles/fortunes Sun Nov 6 07:11:27 2011 (r227135) @@ -4942,25 +4942,37 @@ cats on the dinette table, etc. "That stop him?" "No, but it sure slowed him up." % - Youth is not a time of life, it is a state of mind; it is a temper of -the will, a quality of the imagination, a vigor of the emotions, a predominance -of courage over timidity, of the appetite for adventure over love of ease. - Nobody grows old by merely living a number of years; people grow -old only by deserting their ideals. Years wrinkle the skin, but to give up -enthusiasm wrinkles the soul. Worry, doubt, self-distrust, fear, and despair --- these are the long, long years that bow the head and turn the growing spirit -back to dust. - Whether seventy or sixteen, there is in every being's heart the love -of wonder, the sweet amazement at the stars and the starlike things and -thoughts, the undaunted challenge of events, the unfailing childlike appetite -for what next, and the joy and the game of life. - You are as young as your faith, as old as your doubt; as young as your -self-confidence, as old as your fear, as young as your hope, as old as your -despair. - So long as your heart receives messages of beauty, cheer, courage, -grandeur and power from the earth, from man, and from the Infinite, so long -you are young. - -- Samuel Ullman + Youth is not a time of life--it is a state of mind. It is not a +matter of red cheeks, red lips and supple knees. It is a temper of the +will; a quality of the imagination; a vigor of the emotions; it is a +freshness of the deep springs of life. Youth means a tempermental +predominance of courage over timidity, of the appetite for adventure +over a life of ease. This often exists in a man of fifty, more than in +a boy of twenty. Nobody grows old by merely living a number of years; +people grow old by deserting their ideals. + + Years may wrinkle the skin, but to give up enthusiasm wrinkles +the soul. Worry, doubt, self-distrust, fear and despair--these are the +long, long years that bow the head and turn the growing spirit back to +dust. + + Whether seventy or sixteen, there is in every being’s heart a +love of wonder; the sweet amazement at the stars and starlike things and +thoughts; the undaunted challenge of events, the unfailing childlike +appetite for what comes next, and the joy in the game of life. + + You are as young as your faith, as old as your doubt; as young +as your self-confidence, as old as your fear, as young as your hope, as +old as your despair. + + In the central place of your heart there is a wireless station. +So long as it receives messages of beauty, hope, cheer, grandeur, +courage, and power from the earth, from men and from the Infinite--so +long are you young. When the wires are all down and the central places +of your heart are covered with the snows of pessimism and the ice of +cynicism, then are you grown old, indeed! + -- Samuel Ullman, "Youth" (1934), as published in + The Silver Treasury, Prose and Verse for Every Mood % " " -- Charlie Chaplin From owner-svn-src-stable-7@FreeBSD.ORG Sun Nov 6 07:26:32 2011 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 ADFB8106566C; Sun, 6 Nov 2011 07:26:32 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 49A648FC0A; Sun, 6 Nov 2011 07:26:32 +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 pA67QWwD005390; Sun, 6 Nov 2011 07:26:32 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA67QWHe005388; Sun, 6 Nov 2011 07:26:32 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201111060726.pA67QWHe005388@svn.freebsd.org> From: Doug Barton Date: Sun, 6 Nov 2011 07:26:32 +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: r227138 - stable/7/usr.bin/calendar/calendars 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, 06 Nov 2011 07:26:32 -0000 Author: dougb Date: Sun Nov 6 07:26:31 2011 New Revision: 227138 URL: http://svn.freebsd.org/changeset/base/227138 Log: MFC r226909: Add a reminder about quarterly status report due dates Modified: stable/7/usr.bin/calendar/calendars/calendar.freebsd Directory Properties: stable/7/usr.bin/calendar/ (props changed) Modified: stable/7/usr.bin/calendar/calendars/calendar.freebsd ============================================================================== --- stable/7/usr.bin/calendar/calendars/calendar.freebsd Sun Nov 6 07:20:09 2011 (r227137) +++ stable/7/usr.bin/calendar/calendars/calendar.freebsd Sun Nov 6 07:26:31 2011 (r227138) @@ -88,6 +88,7 @@ 03/27 Josef El-Rayes born in Linz, Austria, 1982 03/28 Sean C. Farley born in Indianapolis, Indiana, United States, 1970 03/29 Thierry Thomas born in Luxeuil les Bains, France, 1961 +03/31 First quarter status reports are due on 04/15 04/01 Matthew Jacob born in San Francisco, California, United States, 1958 04/01 Bill Fenner born in Bellefonte, Pennsylvania, United States, 1971 04/01 Peter Edwards born in Dublin, Ireland, 1973 @@ -159,6 +160,7 @@ 06/29 Daniel Harris born in Lubbock, Texas, United States, 1985 06/29 Andrew Pantyukhin born in Moscow, Russian Federation, 1985 06/30 Guido van Rooij born in Best, Noord-Brabant, the Netherlands, 1965 +06/30 Second quarter status reports are due on 07/15 07/01 Matthew Dillon born in San Francisco, California, United States, 1966 07/02 Mark Christopher Ovens born in Preston, Lancashire, United Kingdom, 1958 07/02 Vasil Venelinov Dimov born in Shumen, Bulgaria, 1982 @@ -228,6 +230,7 @@ 09/28 Alex Dupre born in Milano, Italy, 1980 09/29 Matthew Hunt born in Johnstown, Pennsylvania, United States, 1976 09/30 Hiten M. Pandya born in Dar-es-Salaam, Tanzania, East Africa, 1986 +09/30 Third quarter status reports are due on 10/15 10/05 Hiroki Sato born in Yamagata, Japan, 1977 10/05 Chris Costello born in Houston, Texas, United States, 1985 10/09 Stefan Walter born in Werne, Nordrhein-Westfalen, 1978 @@ -275,5 +278,6 @@ 12/28 Ade Lovett born in London, England, 1969 12/28 Marius Strobl born in Cham, Bavaria, Germany, 1978 12/31 Edwin Groothuis born in Geldrop, the Netherlands, 1970 +12/31 Fourth quarter status reports are due on 01/15 #endif /* !_calendar_freebsd_ */ From owner-svn-src-stable-7@FreeBSD.ORG Sun Nov 6 07:33:18 2011 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 66C201065678; Sun, 6 Nov 2011 07:33:18 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3BBAC8FC14; Sun, 6 Nov 2011 07:33: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 pA67XIf0005843; Sun, 6 Nov 2011 07:33:18 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA67XIYX005841; Sun, 6 Nov 2011 07:33:18 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201111060733.pA67XIYX005841@svn.freebsd.org> From: Doug Barton Date: Sun, 6 Nov 2011 07:33: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: r227141 - stable/7/usr.bin/calendar/calendars 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, 06 Nov 2011 07:33:18 -0000 Author: dougb Date: Sun Nov 6 07:33:17 2011 New Revision: 227141 URL: http://svn.freebsd.org/changeset/base/227141 Log: MFC r226927: Add birth date for Ken Thompson Add birth and death dates for Steve Jobs Update birth and add death date for Dennis Ritchie MFC r226942: Fix typo from r226927 Modified: stable/7/usr.bin/calendar/calendars/calendar.birthday Directory Properties: stable/7/usr.bin/calendar/ (props changed) Modified: stable/7/usr.bin/calendar/calendars/calendar.birthday ============================================================================== --- stable/7/usr.bin/calendar/calendars/calendar.birthday Sun Nov 6 07:32:26 2011 (r227140) +++ stable/7/usr.bin/calendar/calendars/calendar.birthday Sun Nov 6 07:33:17 2011 (r227141) @@ -42,6 +42,7 @@ 01/30 Franklin Delano Roosevelt born in Hyde Park, New York, 1882 01/31 Jackie Robinson born, 1919 02/03 Gertrude Stein born, 1874 +02/04 Ken Thompson, creator of unix, born, 1943 02/05 Alex Harvey (SAHB) is born in Glasgow, Scotland, 1935 02/06 King George VI of UK dies; his daughter becomes Elizabeth II, 1952 02/07 Sinclair Lewis born, 1885 @@ -68,6 +69,7 @@ 02/22 Pierre Jules Cesar Janssen born, 1838, found hydrogen in the sun 02/23 W.E.B. DuBois born, 1868 02/24 Winslow Homer born, 1836 +02/24 Steve Jobs born, 1955 02/25 George Harrison born in Liverpool, England, 1943 02/25 Renoir born, 1841 02/26 Dominique Francois Jean Arago born, 1786; @@ -212,7 +214,7 @@ 09/08 Richard ``the Lionheart'', king of England born in Oxford, 1157 09/08 Peter Sellers born in Southsea, England, 1925 09/09 Chinese Communist Party Chairman Mao Tse-Tung dies at age 82, 1976 -09/09 Dennis Ritchie born, 1941 +09/09 Dennis MacAlistair Ritchie, creator of C, born, 1941 09/12 Jesse Owens born, 1913 09/13 Walter Reed born, 1851 09/15 Agatha Christie born in Torquay, England, 1890 @@ -240,6 +242,8 @@ 10/04 John V. Atanasoff born, 1903 10/05 Pablo Picasso born in Malaga, Spain, 1881 10/05 Ray Kroc (founder of McDonald's) born, 1902 +10/05 Steve Jobs died at the age of 56, 2011 +10/12 Dennis MacAlistair Ritchie died at the age of 70, 2011 10/13 Lenny Bruce is born in New York City, 1925 10/13 Virgil (Publius Vergilius Maro) born near Mantua, Italy, 70 BC 10/14 Dwight David Eisenhower, 34th President of the United States, born in From owner-svn-src-stable-7@FreeBSD.ORG Sun Nov 6 08:01:17 2011 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 A513F106564A; Sun, 6 Nov 2011 08:01:17 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 93A048FC13; Sun, 6 Nov 2011 08:01:17 +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 pA681HkQ007282; Sun, 6 Nov 2011 08:01:17 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA681HG4007280; Sun, 6 Nov 2011 08:01:17 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201111060801.pA681HG4007280@svn.freebsd.org> From: Doug Barton Date: Sun, 6 Nov 2011 08:01: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: r227149 - stable/7/usr.sbin/mergemaster 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, 06 Nov 2011 08:01:17 -0000 Author: dougb Date: Sun Nov 6 08:01:17 2011 New Revision: 227149 URL: http://svn.freebsd.org/changeset/base/227149 Log: MFC r213573: mdoc: drop redundant .Pp and .LP calls They have no effect when coming in pairs, or before .Bl/.Bd Modified: stable/7/usr.sbin/mergemaster/mergemaster.8 Directory Properties: stable/7/usr.sbin/mergemaster/ (props changed) Modified: stable/7/usr.sbin/mergemaster/mergemaster.8 ============================================================================== --- stable/7/usr.sbin/mergemaster/mergemaster.8 Sun Nov 6 07:59:34 2011 (r227148) +++ stable/7/usr.sbin/mergemaster/mergemaster.8 Sun Nov 6 08:01:17 2011 (r227149) @@ -330,7 +330,6 @@ overrides .Pa /etc/mergemaster.rc . Here is an example with all values commented out: -.Pp .Bd -literal # These are options for mergemaster, with their default values listed # The following options have command line overrides From owner-svn-src-stable-7@FreeBSD.ORG Sun Nov 6 08:03:33 2011 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 B0EF3106566C; Sun, 6 Nov 2011 08:03:33 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 961FF8FC0C; Sun, 6 Nov 2011 08:03:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pA683Xpb007412; Sun, 6 Nov 2011 08:03:33 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA683Xqu007409; Sun, 6 Nov 2011 08:03:33 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201111060803.pA683Xqu007409@svn.freebsd.org> From: Doug Barton Date: Sun, 6 Nov 2011 08:03:33 +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: r227150 - stable/7/usr.sbin/mergemaster 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, 06 Nov 2011 08:03:33 -0000 Author: dougb Date: Sun Nov 6 08:03:33 2011 New Revision: 227150 URL: http://svn.freebsd.org/changeset/base/227150 Log: MFC r227013: 1. Add a new option, --run-updates, to always or never run the newalises, pwd_mkdb, etc. updates at the end of the comparison. 2. Add an update to the end to handle /etc/localtime, if it exists. If /var/db/zoneinfo exists, automatically update /etc/localtime, which should (hopefully) be safe to do. If not, prompt the user to run tzsetup. 3. Update run_it_now(), the function that handles input for the updates, to make sure that we got a valid answer, and to handle the --run-updates option if supplied. Modified: stable/7/usr.sbin/mergemaster/mergemaster.8 stable/7/usr.sbin/mergemaster/mergemaster.sh Directory Properties: stable/7/usr.sbin/mergemaster/ (props changed) Modified: stable/7/usr.sbin/mergemaster/mergemaster.8 ============================================================================== --- stable/7/usr.sbin/mergemaster/mergemaster.8 Sun Nov 6 08:01:17 2011 (r227149) +++ stable/7/usr.sbin/mergemaster/mergemaster.8 Sun Nov 6 08:03:33 2011 (r227150) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 9, 2011 +.Dd November 1, 2011 .Dt MERGEMASTER 8 .Os .Sh NAME @@ -34,6 +34,7 @@ .Nm .Op Fl scrvhpCP .Op Fl a|iFU +.Op Fl -run-updates=[always|never] .Op Fl m Ar /path/to/sources .Op Fl t Ar /path/to/temp/root .Op Fl d @@ -246,6 +247,11 @@ rc file. Attempt to auto upgrade files that have not been user modified. This option can be dangerous when there are critical changes in the new versions that affect your running system. +.It Fl -run-updates=[always|never] +Specify always or never to run newaliases, pwd_mkdb, etc. +at the end of the comparison run. +If this option is omitted the default is to prompt the user +for each update as necessary. .It Fl m Ar /path/to/sources Specify the path to the directory where you want to do the .Xr make 1 . @@ -365,6 +371,9 @@ with all values commented out: # ***DANGEROUS*** #AUTO_UPGRADE= # +# Either always or never run newaliases, pwd_mkdb at the end (--run-updates) +#RUN_UPDATES= +# # Compare /etc/rc.conf[.local] to /etc/defaults/rc.conf (-C) #COMP_CONFS= # Modified: stable/7/usr.sbin/mergemaster/mergemaster.sh ============================================================================== --- stable/7/usr.sbin/mergemaster/mergemaster.sh Sun Nov 6 08:01:17 2011 (r227149) +++ stable/7/usr.sbin/mergemaster/mergemaster.sh Sun Nov 6 08:03:33 2011 (r227150) @@ -15,7 +15,7 @@ PATH=/bin:/usr/bin:/usr/sbin display_usage () { VERSION_NUMBER=`grep "[$]FreeBSD:" $0 | cut -d ' ' -f 4` echo "mergemaster version ${VERSION_NUMBER}" - echo 'Usage: mergemaster [-scrvhpCP] [-a|[-iFU]]' + echo 'Usage: mergemaster [-scrvhpCP] [-a|[-iFU]] [--run-updates=always|never]' echo ' [-m /path] [-t /path] [-d] [-u N] [-w N] [-A arch] [-D /path]' echo "Options:" echo " -s Strict comparison (diff every pair of files)" @@ -31,6 +31,7 @@ display_usage () { echo ' -P Preserve files that are overwritten' echo " -U Attempt to auto upgrade files that have not been user modified" echo ' ***DANGEROUS***' + echo ' --run-updates= Specify always or never to run newalises, pwd_mkdb, etc.' echo '' echo " -m /path/directory Specify location of source to do the make in" echo " -t /path/directory Specify temp root directory" @@ -262,6 +263,20 @@ if [ -r "$HOME/.mergemasterrc" ]; then . "$HOME/.mergemasterrc" fi +for var in "$@" ; do + case "$var" in + --run-updates*) + RUN_UPDATES=`echo ${var#--run-updates=} | tr [:upper:] [:lower:]` + ;; + *) + newopts="$newopts $var" + ;; + esac +done + +set -- $newopts +unset var newopts + # Check the command line options # while getopts ":ascrvhipCPm:t:du:w:D:A:FU" COMMAND_LINE_ARGUMENT ; do @@ -1223,34 +1238,43 @@ case "${AUTO_UPGRADED_FILES}" in esac run_it_now () { - case "${AUTO_RUN}" in - '') - unset YES_OR_NO - echo '' - echo -n ' Would you like to run it now? y or n [n] ' - read YES_OR_NO + [ -n "$AUTO_RUN" ] && return + + local answer + + echo '' + while : ; do + if [ "$RUN_UPDATES" = always ]; then + answer=y + elif [ "$RUN_UPDATES" = never ]; then + answer=n + else + echo -n ' Would you like to run it now? y or n [n] ' + read answer + fi - case "${YES_OR_NO}" in + case "$answer" in y) echo " Running ${1}" echo '' eval "${1}" + return ;; ''|n) - echo '' - echo " *** Cancelled" - echo '' + if [ ! "$RUN_UPDATES" = never ]; then + echo '' + echo " *** Cancelled" + echo '' + fi echo " Make sure to run ${1} yourself" + return ;; *) echo '' - echo " *** Sorry, I do not understand your answer (${YES_OR_NO})" + echo " *** Sorry, I do not understand your answer (${answer})" echo '' - echo " Make sure to run ${1} yourself" esac - ;; - *) ;; - esac + done } case "${NEED_NEWALIASES}" in @@ -1298,6 +1322,19 @@ case "${NEED_PWD_MKDB}" in ;; esac +if [ -e "${DESTDIR}/etc/localtime" ]; then # Ignore if TZ == UTC + echo '' + if [ -f "${DESTDIR}/var/db/zoneinfo" ]; then + echo "*** Reinstalling `cat ${DESTDIR}/var/db/zoneinfo` as ${DESTDIR}/etc/localtime" + [ -n "${DESTDIR}" ] && tzs_args="-C ${DESTDIR}" + tzsetup $tzs_args -r + else + echo "*** There is no ${DESTDIR}/var/db/zoneinfo file to update ${DESTDIR}/etc/localtime." + echo ' You should run tzsetup' + run_it_now tzsetup + fi +fi + echo '' if [ -r "${MM_EXIT_SCRIPT}" ]; then From owner-svn-src-stable-7@FreeBSD.ORG Sun Nov 6 13:03:59 2011 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 E85CA1065672; Sun, 6 Nov 2011 13:03:59 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D7F288FC0A; Sun, 6 Nov 2011 13:03:59 +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 pA6D3xpd022457; Sun, 6 Nov 2011 13:03:59 GMT (envelope-from brueffer@svn.freebsd.org) Received: (from brueffer@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA6D3xed022455; Sun, 6 Nov 2011 13:03:59 GMT (envelope-from brueffer@svn.freebsd.org) Message-Id: <201111061303.pA6D3xed022455@svn.freebsd.org> From: Christian Brueffer Date: Sun, 6 Nov 2011 13:03:59 +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: r227210 - stable/7/libexec/rshd 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, 06 Nov 2011 13:04:00 -0000 Author: brueffer Date: Sun Nov 6 13:03:59 2011 New Revision: 227210 URL: http://svn.freebsd.org/changeset/base/227210 Log: MFC: r226937 Fix a misplaced parenthesis. Modified: stable/7/libexec/rshd/rshd.c Directory Properties: stable/7/libexec/rshd/ (props changed) Modified: stable/7/libexec/rshd/rshd.c ============================================================================== --- stable/7/libexec/rshd/rshd.c Sun Nov 6 13:02:33 2011 (r227209) +++ stable/7/libexec/rshd/rshd.c Sun Nov 6 13:03:59 2011 (r227210) @@ -317,7 +317,7 @@ doit(struct sockaddr *fromp) } if ((pam_err = pam_set_item(pamh, PAM_RUSER, ruser)) != PAM_SUCCESS || - (pam_err = pam_set_item(pamh, PAM_RHOST, rhost) != PAM_SUCCESS)) { + (pam_err = pam_set_item(pamh, PAM_RHOST, rhost)) != PAM_SUCCESS) { syslog(LOG_ERR|LOG_AUTH, "pam_set_item(): %s", pam_strerror(pamh, pam_err)); rshd_errx(1, "Login incorrect."); From owner-svn-src-stable-7@FreeBSD.ORG Sun Nov 6 13:35:56 2011 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 4303F1065670; Sun, 6 Nov 2011 13:35:56 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 328C18FC08; Sun, 6 Nov 2011 13:35:56 +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 pA6DZurK023652; Sun, 6 Nov 2011 13:35:56 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA6DZuDv023650; Sun, 6 Nov 2011 13:35:56 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201111061335.pA6DZuDv023650@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 6 Nov 2011 13:35:56 +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: r227213 - stable/7/sys/fs/devfs 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, 06 Nov 2011 13:35:56 -0000 Author: kib Date: Sun Nov 6 13:35:55 2011 New Revision: 227213 URL: http://svn.freebsd.org/changeset/base/227213 Log: MFC r227062: Fix kernel panic when d_fdopen csw method is called for NULL fp. This may happen when kernel consumer calls VOP_OPEN(). Modified: stable/7/sys/fs/devfs/devfs_vnops.c Directory Properties: stable/7/sys/ (props changed) Modified: stable/7/sys/fs/devfs/devfs_vnops.c ============================================================================== --- stable/7/sys/fs/devfs/devfs_vnops.c Sun Nov 6 13:17:37 2011 (r227212) +++ stable/7/sys/fs/devfs/devfs_vnops.c Sun Nov 6 13:35:55 2011 (r227213) @@ -887,6 +887,10 @@ devfs_open(struct vop_open_args *ap) dsw = dev_refthread(dev); if (dsw == NULL) return (ENXIO); + if (fp == NULL && dsw->d_fdopen != NULL) { + dev_relthread(dev); + return (ENXIO); + } /* XXX: Special casing of ttys for deadfs. Probably redundant. */ if (dsw->d_flags & D_TTY) From owner-svn-src-stable-7@FreeBSD.ORG Sun Nov 6 19:57:17 2011 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 E03AF106566B; Sun, 6 Nov 2011 19:57:17 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CFD048FC18; Sun, 6 Nov 2011 19:57:17 +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 pA6JvHWc039090; Sun, 6 Nov 2011 19:57:17 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA6JvHUB039088; Sun, 6 Nov 2011 19:57:17 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201111061957.pA6JvHUB039088@svn.freebsd.org> From: Marius Strobl Date: Sun, 6 Nov 2011 19:57: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: r227265 - stable/7/sys/dev/mpt 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, 06 Nov 2011 19:57:18 -0000 Author: marius Date: Sun Nov 6 19:57:17 2011 New Revision: 227265 URL: http://svn.freebsd.org/changeset/base/227265 Log: MFC: r227001 Increase the IOC port initialization timeouts by ten times to what the corresponding Linux driver uses. This allows mpt(4) to still recognize all good SATA devices in presence of a defective one, which takes about 45 seconds. In the long term we probably should implement the logic used by mpt2sas(4) allowing IOC port initialization to complete at a later time. Submitted by: Andrew Boyer Modified: stable/7/sys/dev/mpt/mpt.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/mpt/mpt.c ============================================================================== --- stable/7/sys/dev/mpt/mpt.c Sun Nov 6 19:57:14 2011 (r227264) +++ stable/7/sys/dev/mpt/mpt.c Sun Nov 6 19:57:17 2011 (r227265) @@ -2084,7 +2084,7 @@ mpt_send_port_enable(struct mpt_softc *m mpt_send_cmd(mpt, req); error = mpt_wait_req(mpt, req, REQ_STATE_DONE, REQ_STATE_DONE, - FALSE, (mpt->is_sas || mpt->is_fc)? 30000 : 3000); + FALSE, (mpt->is_sas || mpt->is_fc)? 300000 : 30000); if (error != 0) { mpt_prt(mpt, "port %d enable timed out\n", port); return (-1); From owner-svn-src-stable-7@FreeBSD.ORG Sun Nov 6 21:11:22 2011 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 93DD21065673; Sun, 6 Nov 2011 21:11:22 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 807768FC0C; Sun, 6 Nov 2011 21:11:22 +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 pA6LBMsR042194; Sun, 6 Nov 2011 21:11:22 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA6LBMaZ042182; Sun, 6 Nov 2011 21:11:22 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201111062111.pA6LBMaZ042182@svn.freebsd.org> From: Marius Strobl Date: Sun, 6 Nov 2011 21:11:22 +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: r227279 - in stable/7/sys: conf dev/bm dev/dc dev/mii dev/nge dev/sis dev/ste dev/stge modules/mii pci 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, 06 Nov 2011 21:11:22 -0000 Author: marius Date: Sun Nov 6 21:11:22 2011 New Revision: 227279 URL: http://svn.freebsd.org/changeset/base/227279 Log: MFC: r226995 (partially), r227042 - Import the common MII bitbang'ing code from NetBSD and convert drivers to take advantage of it instead of duplicating it. This reduces the size of the i386 GENERIC kernel by about 8k. The only potential in-tree users left unconverted are ed(4) and xe(4). Xe(4) generally should be changed to use miibus(4) instead of implementing PHY handling on its own, as otherwise it makes not much sense to add a dependency on miibus(4)/mii_bitbang(4) to it just for the MII bitbang'ing code. Ed(4) has some chip specific things interwinded with the MII bitbang'ing code and it's unclear whether it can be converted to common code, at least not without thorough testing of all the various chips supported by ed(4). The common MII bitbang'ing code also is useful in the embedded space for using GPIO pins to implement MII access. - Based on lessons learnt with dc(4) (see r185750), add bus barriers to the MII bitbang read and write functions of the other drivers converted in order to ensure the intended ordering. Given that register access via an index register as well as register bank/window switching is subject to the same problem, also add bus barriers to the respective functions of smc(4), tl(4) and xl(4). - Sprinkle some const. Thanks to the following testers: Andrew Bliznak (nge(4)), nwhitehorn@ (bm(4)), yongari@ (sis(4) and ste(4)) Thanks to Hans-Joerg Sirtl for supplying hardware to test stge(4). Reviewed by: yongari (subset of drivers) Obtained from: NetBSD (partially) Added: stable/7/sys/dev/mii/mii_bitbang.c - copied unchanged from r226995, head/sys/dev/mii/mii_bitbang.c stable/7/sys/dev/mii/mii_bitbang.h - copied unchanged from r226995, head/sys/dev/mii/mii_bitbang.h Modified: stable/7/sys/conf/NOTES stable/7/sys/conf/files stable/7/sys/dev/bm/if_bm.c stable/7/sys/dev/bm/if_bmreg.h stable/7/sys/dev/bm/if_bmvar.h stable/7/sys/dev/dc/if_dc.c stable/7/sys/dev/dc/if_dcreg.h stable/7/sys/dev/nge/if_nge.c stable/7/sys/dev/nge/if_ngereg.h stable/7/sys/dev/sis/if_sis.c stable/7/sys/dev/sis/if_sisreg.h stable/7/sys/dev/ste/if_ste.c stable/7/sys/dev/ste/if_stereg.h stable/7/sys/dev/stge/if_stge.c stable/7/sys/dev/stge/if_stgereg.h stable/7/sys/modules/mii/Makefile stable/7/sys/pci/if_tl.c stable/7/sys/pci/if_tlreg.h stable/7/sys/pci/if_wb.c stable/7/sys/pci/if_wbreg.h stable/7/sys/pci/if_xl.c stable/7/sys/pci/if_xlreg.h Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/conf/NOTES ============================================================================== --- stable/7/sys/conf/NOTES Sun Nov 6 21:09:23 2011 (r227278) +++ stable/7/sys/conf/NOTES Sun Nov 6 21:11:22 2011 (r227279) @@ -1714,13 +1714,15 @@ device puc # MII bus support is required for many PCI Ethernet NICs, # namely those which use MII-compliant transceivers or implement # transceiver control interfaces that operate like an MII. Adding -# "device miibus" to the kernel config pulls in support for -# the generic miibus API and all of the PHY drivers, including a -# generic one for PHYs that aren't specifically handled by an -# individual driver. Support for specific PHYs may be built by adding -# "device mii" then adding the appropriate PHY driver. -device miibus # MII support including all PHYs +# "device miibus" to the kernel config pulls in support for the generic +# miibus API, the common support for for bit-bang'ing the MII and all +# of the PHY drivers, including a generic one for PHYs that aren't +# specifically handled by an individual driver. Support for specific +# PHYs may be built by adding "device mii", "device mii_bitbang" if +# needed by the NIC driver and then adding the appropriate PHY driver. device mii # Minimal MII support +device mii_bitbang # Common module for bit-bang'ing the MII +device miibus # MII support w/ bit-bang'ing and all PHYs device acphy # Altima Communications AC101 device amphy # AMD AM79c873 / Davicom DM910{1,2} Modified: stable/7/sys/conf/files ============================================================================== --- stable/7/sys/conf/files Sun Nov 6 21:09:23 2011 (r227278) +++ stable/7/sys/conf/files Sun Nov 6 21:11:22 2011 (r227279) @@ -966,6 +966,7 @@ dev/mii/ip1000phy.c optional miibus | i dev/mii/jmphy.c optional miibus | jmphy dev/mii/lxtphy.c optional miibus | lxtphy dev/mii/mii.c optional miibus | mii +dev/mii/mii_bitbang.c optional miibus | mii_bitbang dev/mii/mii_physubr.c optional miibus | mii dev/mii/miibus_if.m optional miibus | mii dev/mii/mlphy.c optional miibus | mlphy Modified: stable/7/sys/dev/bm/if_bm.c ============================================================================== --- stable/7/sys/dev/bm/if_bm.c Sun Nov 6 21:09:23 2011 (r227278) +++ stable/7/sys/dev/bm/if_bm.c Sun Nov 6 21:11:22 2011 (r227279) @@ -63,6 +63,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -105,17 +106,28 @@ static void bm_tick (void *xsc); static int bm_ifmedia_upd (struct ifnet *); static void bm_ifmedia_sts (struct ifnet *, struct ifmediareq *); -static void bm_miicsr_dwrite (struct bm_softc *, u_int16_t); -static void bm_mii_writebit (struct bm_softc *, int); -static int bm_mii_readbit (struct bm_softc *); -static void bm_mii_sync (struct bm_softc *); -static void bm_mii_send (struct bm_softc *, u_int32_t, int); -static int bm_mii_readreg (struct bm_softc *, struct bm_mii_frame *); -static int bm_mii_writereg (struct bm_softc *, struct bm_mii_frame *); static int bm_miibus_readreg (device_t, int, int); static int bm_miibus_writereg (device_t, int, int, int); static void bm_miibus_statchg (device_t); +/* + * MII bit-bang glue + */ +static uint32_t bm_mii_bitbang_read(device_t); +static void bm_mii_bitbang_write(device_t, uint32_t); + +static const struct mii_bitbang_ops bm_mii_bitbang_ops = { + bm_mii_bitbang_read, + bm_mii_bitbang_write, + { + BM_MII_DATAOUT, /* MII_BIT_MDO */ + BM_MII_DATAIN, /* MII_BIT_MDI */ + BM_MII_CLK, /* MII_BIT_MDC */ + BM_MII_OENABLE, /* MII_BIT_DIR_HOST_PHY */ + 0, /* MII_BIT_DIR_PHY_HOST */ + } +}; + static device_method_t bm_methods[] = { /* Device interface */ DEVMETHOD(device_probe, bm_probe), @@ -150,171 +162,36 @@ DRIVER_MODULE(miibus, bm, miibus_driver, */ /* - * Write to the MII csr, introducing a delay to allow valid - * MII clock pulses to be formed - */ -static void -bm_miicsr_dwrite(struct bm_softc *sc, u_int16_t val) -{ - CSR_WRITE_2(sc, BM_MII_CSR, val); - /* - * Assume this is a clock toggle and generate a 1us delay - * to cover both MII's 160ns high/low minimum and 400ns - * cycle miniumum - */ - DELAY(1); -} - -/* - * Write a bit to the MII bus. - */ -static void -bm_mii_writebit(struct bm_softc *sc, int bit) -{ - u_int16_t regval; - - regval = BM_MII_OENABLE; - if (bit) - regval |= BM_MII_DATAOUT; - - bm_miicsr_dwrite(sc, regval); - bm_miicsr_dwrite(sc, regval | BM_MII_CLK); - bm_miicsr_dwrite(sc, regval); -} - -/* - * Read a bit from the MII bus. - */ -static int -bm_mii_readbit(struct bm_softc *sc) -{ - u_int16_t regval, bitin; - - /* ~BM_MII_OENABLE */ - regval = 0; - - bm_miicsr_dwrite(sc, regval); - bm_miicsr_dwrite(sc, regval | BM_MII_CLK); - bm_miicsr_dwrite(sc, regval); - bitin = CSR_READ_2(sc, BM_MII_CSR) & BM_MII_DATAIN; - - return (bitin == BM_MII_DATAIN); -} - -/* - * Sync the PHYs by setting data bit and strobing the clock 32 times. + * Write the MII serial port for the MII bit-bang module. */ static void -bm_mii_sync(struct bm_softc *sc) +bm_mii_bitbang_write(device_t dev, uint32_t val) { - int i; - u_int16_t regval; - - regval = BM_MII_OENABLE | BM_MII_DATAOUT; - - bm_miicsr_dwrite(sc, regval); - for (i = 0; i < 32; i++) { - bm_miicsr_dwrite(sc, regval | BM_MII_CLK); - bm_miicsr_dwrite(sc, regval); - } -} - -/* - * Clock a series of bits through the MII. - */ -static void -bm_mii_send(struct bm_softc *sc, u_int32_t bits, int cnt) -{ - int i; - - for (i = (0x1 << (cnt - 1)); i; i >>= 1) - bm_mii_writebit(sc, bits & i); -} - -/* - * Read a PHY register through the MII. - */ -static int -bm_mii_readreg(struct bm_softc *sc, struct bm_mii_frame *frame) -{ - int i, ack, bit; - - /* - * Set up frame for RX. - */ - frame->mii_stdelim = BM_MII_STARTDELIM; - frame->mii_opcode = BM_MII_READOP; - frame->mii_turnaround = 0; - frame->mii_data = 0; - - /* - * Sync the PHYs - */ - bm_mii_sync(sc); - - /* - * Send command/address info - */ - bm_mii_send(sc, frame->mii_stdelim, 2); - bm_mii_send(sc, frame->mii_opcode, 2); - bm_mii_send(sc, frame->mii_phyaddr, 5); - bm_mii_send(sc, frame->mii_regaddr, 5); - - /* - * Check for ack. - */ - ack = bm_mii_readbit(sc); - - /* - * Now try reading data bits. If the ack failed, we still - * need to clock through 16 cycles to keep the PHY(s) in sync. - */ - for (i = 0x8000; i; i >>= 1) { - bit = bm_mii_readbit(sc); - if (!ack && bit) - frame->mii_data |= i; - } + struct bm_softc *sc; - /* - * Skip through idle bit-times - */ - bm_mii_writebit(sc, 0); - bm_mii_writebit(sc, 0); + sc = device_get_softc(dev); - return ((ack) ? 1 : 0); + CSR_WRITE_2(sc, BM_MII_CSR, val); + CSR_BARRIER(sc, BM_MII_CSR, 2, + BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); } /* - * Write to a PHY register through the MII. + * Read the MII serial port for the MII bit-bang module. */ -static int -bm_mii_writereg(struct bm_softc *sc, struct bm_mii_frame *frame) +static uint32_t +bm_mii_bitbang_read(device_t dev) { - /* - * Set up frame for tx - */ - frame->mii_stdelim = BM_MII_STARTDELIM; - frame->mii_opcode = BM_MII_WRITEOP; - frame->mii_turnaround = BM_MII_TURNAROUND; - - /* - * Sync the phy and start the bitbang write sequence - */ - bm_mii_sync(sc); + struct bm_softc *sc; + uint32_t reg; - bm_mii_send(sc, frame->mii_stdelim, 2); - bm_mii_send(sc, frame->mii_opcode, 2); - bm_mii_send(sc, frame->mii_phyaddr, 5); - bm_mii_send(sc, frame->mii_regaddr, 5); - bm_mii_send(sc, frame->mii_turnaround, 2); - bm_mii_send(sc, frame->mii_data, 16); + sc = device_get_softc(dev); - /* - * Idle bit. - */ - bm_mii_writebit(sc, 0); + reg = CSR_READ_2(sc, BM_MII_CSR); + CSR_BARRIER(sc, BM_MII_CSR, 2, + BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); - return (0); + return (reg); } /* @@ -323,34 +200,15 @@ bm_mii_writereg(struct bm_softc *sc, str static int bm_miibus_readreg(device_t dev, int phy, int reg) { - struct bm_softc *sc; - struct bm_mii_frame frame; - - sc = device_get_softc(dev); - bzero(&frame, sizeof(frame)); - - frame.mii_phyaddr = phy; - frame.mii_regaddr = reg; - bm_mii_readreg(sc, &frame); - - return (frame.mii_data); + return (mii_bitbang_readreg(dev, &bm_mii_bitbang_ops, phy, reg)); } static int bm_miibus_writereg(device_t dev, int phy, int reg, int data) { - struct bm_softc *sc; - struct bm_mii_frame frame; - - sc = device_get_softc(dev); - bzero(&frame, sizeof(frame)); - - frame.mii_phyaddr = phy; - frame.mii_regaddr = reg; - frame.mii_data = data; - bm_mii_writereg(sc, &frame); + mii_bitbang_readreg(dev, &bm_mii_bitbang_ops, phy, reg); return (0); } Modified: stable/7/sys/dev/bm/if_bmreg.h ============================================================================== --- stable/7/sys/dev/bm/if_bmreg.h Sun Nov 6 21:09:23 2011 (r227278) +++ stable/7/sys/dev/bm/if_bmreg.h Sun Nov 6 21:11:22 2011 (r227279) @@ -129,14 +129,6 @@ #define BM_MII_DATAIN 0x0008 /* MDIO data in */ /* - * MII constants - */ -#define BM_MII_STARTDELIM 0x01 -#define BM_MII_READOP 0x02 -#define BM_MII_WRITEOP 0x01 -#define BM_MII_TURNAROUND 0x02 - -/* * Various flags */ @@ -174,3 +166,5 @@ #define CSR_READ_1(sc, reg) \ bus_read_1(sc->sc_memr, reg) +#define CSR_BARRIER(sc, reg, length, flags) \ + bus_barrier(sc->sc_memr, reg, length, flags) Modified: stable/7/sys/dev/bm/if_bmvar.h ============================================================================== --- stable/7/sys/dev/bm/if_bmvar.h Sun Nov 6 21:09:23 2011 (r227278) +++ stable/7/sys/dev/bm/if_bmvar.h Sun Nov 6 21:11:22 2011 (r227279) @@ -46,7 +46,6 @@ /* * software state for transmit job mbufs (may be elements of mbuf chains) */ - struct bm_txsoft { struct mbuf *txs_mbuf; /* head of our mbuf chain */ bus_dmamap_t txs_dmamap; /* our DMA map */ @@ -71,7 +70,6 @@ struct bm_rxsoft { bus_dma_segment_t segment; }; - struct bm_softc { struct ifnet *sc_ifp; struct mtx sc_mtx; @@ -113,13 +111,3 @@ struct bm_softc { dbdma_channel_t *sc_txdma, *sc_rxdma; }; - -struct bm_mii_frame { - u_int8_t mii_stdelim; - u_int8_t mii_opcode; - u_int8_t mii_phyaddr; - u_int8_t mii_regaddr; - u_int8_t mii_turnaround; - u_int16_t mii_data; -}; - Modified: stable/7/sys/dev/dc/if_dc.c ============================================================================== --- stable/7/sys/dev/dc/if_dc.c Sun Nov 6 21:09:23 2011 (r227278) +++ stable/7/sys/dev/dc/if_dc.c Sun Nov 6 21:11:22 2011 (r227279) @@ -122,6 +122,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -149,7 +150,7 @@ MODULE_DEPEND(dc, miibus, 1, 1, 1); /* * Various supported device vendors/types and their names. */ -static const struct dc_type dc_devs[] = { +static const struct dc_type const dc_devs[] = { { DC_DEVID(DC_VENDORID_DEC, DC_DEVICEID_21143), 0, "Intel 21143 10/100BaseTX" }, { DC_DEVID(DC_VENDORID_DAVICOM, DC_DEVICEID_DM9009), 0, @@ -267,12 +268,6 @@ static void dc_eeprom_getword_xircom(str static void dc_eeprom_width(struct dc_softc *); static void dc_read_eeprom(struct dc_softc *, caddr_t, int, int, int); -static void dc_mii_writebit(struct dc_softc *, int); -static int dc_mii_readbit(struct dc_softc *); -static void dc_mii_sync(struct dc_softc *); -static void dc_mii_send(struct dc_softc *, uint32_t, int); -static int dc_mii_readreg(struct dc_softc *, struct dc_mii_frame *); -static int dc_mii_writereg(struct dc_softc *, struct dc_mii_frame *); static int dc_miibus_readreg(device_t, int, int); static int dc_miibus_writereg(device_t, int, int, int); static void dc_miibus_statchg(device_t); @@ -301,6 +296,24 @@ static int dc_decode_leaf_sym(struct dc_ static void dc_apply_fixup(struct dc_softc *, int); static int dc_check_multiport(struct dc_softc *); +/* + * MII bit-bang glue + */ +static uint32_t dc_mii_bitbang_read(device_t); +static void dc_mii_bitbang_write(device_t, uint32_t); + +static const struct mii_bitbang_ops dc_mii_bitbang_ops = { + dc_mii_bitbang_read, + dc_mii_bitbang_write, + { + DC_SIO_MII_DATAOUT, /* MII_BIT_MDO */ + DC_SIO_MII_DATAIN, /* MII_BIT_MDI */ + DC_SIO_MII_CLK, /* MII_BIT_MDC */ + 0, /* MII_BIT_DIR_HOST_PHY */ + DC_SIO_MII_DIR, /* MII_BIT_DIR_PHY_HOST */ + } +}; + #ifdef DC_USEIOSPACE #define DC_RES SYS_RES_IOPORT #define DC_RID DC_PCI_CFBIO @@ -606,185 +619,45 @@ dc_read_eeprom(struct dc_softc *sc, cadd } /* - * The following two routines are taken from the Macronix 98713 - * Application Notes pp.19-21. - */ -/* - * Write a bit to the MII bus. + * Write the MII serial port for the MII bit-bang module. */ static void -dc_mii_writebit(struct dc_softc *sc, int bit) +dc_mii_bitbang_write(device_t dev, uint32_t val) { - uint32_t reg; + struct dc_softc *sc; - reg = DC_SIO_ROMCTL_WRITE | (bit != 0 ? DC_SIO_MII_DATAOUT : 0); - CSR_WRITE_4(sc, DC_SIO, reg); - CSR_BARRIER_4(sc, DC_SIO, - BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); - DELAY(1); + sc = device_get_softc(dev); - CSR_WRITE_4(sc, DC_SIO, reg | DC_SIO_MII_CLK); - CSR_BARRIER_4(sc, DC_SIO, - BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); - DELAY(1); - CSR_WRITE_4(sc, DC_SIO, reg); + CSR_WRITE_4(sc, DC_SIO, val); CSR_BARRIER_4(sc, DC_SIO, BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); - DELAY(1); } /* - * Read a bit from the MII bus. + * Read the MII serial port for the MII bit-bang module. */ -static int -dc_mii_readbit(struct dc_softc *sc) +static uint32_t +dc_mii_bitbang_read(device_t dev) { - uint32_t reg; - - reg = DC_SIO_ROMCTL_READ | DC_SIO_MII_DIR; - CSR_WRITE_4(sc, DC_SIO, reg); - CSR_BARRIER_4(sc, DC_SIO, - BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); - DELAY(1); - (void)CSR_READ_4(sc, DC_SIO); - CSR_WRITE_4(sc, DC_SIO, reg | DC_SIO_MII_CLK); - CSR_BARRIER_4(sc, DC_SIO, - BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); - DELAY(1); - CSR_WRITE_4(sc, DC_SIO, reg); - CSR_BARRIER_4(sc, DC_SIO, - BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); - DELAY(1); - if (CSR_READ_4(sc, DC_SIO) & DC_SIO_MII_DATAIN) - return (1); - - return (0); -} + struct dc_softc *sc; + uint32_t val; -/* - * Sync the PHYs by setting data bit and strobing the clock 32 times. - */ -static void -dc_mii_sync(struct dc_softc *sc) -{ - int i; + sc = device_get_softc(dev); - CSR_WRITE_4(sc, DC_SIO, DC_SIO_ROMCTL_WRITE); + val = CSR_READ_4(sc, DC_SIO); CSR_BARRIER_4(sc, DC_SIO, BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); - DELAY(1); - - for (i = 0; i < 32; i++) - dc_mii_writebit(sc, 1); -} - -/* - * Clock a series of bits through the MII. - */ -static void -dc_mii_send(struct dc_softc *sc, uint32_t bits, int cnt) -{ - int i; - - for (i = (0x1 << (cnt - 1)); i; i >>= 1) - dc_mii_writebit(sc, bits & i); -} -/* - * Read an PHY register through the MII. - */ -static int -dc_mii_readreg(struct dc_softc *sc, struct dc_mii_frame *frame) -{ - int i; - - /* - * Set up frame for RX. - */ - frame->mii_stdelim = DC_MII_STARTDELIM; - frame->mii_opcode = DC_MII_READOP; - - /* - * Sync the PHYs. - */ - dc_mii_sync(sc); - - /* - * Send command/address info. - */ - dc_mii_send(sc, frame->mii_stdelim, 2); - dc_mii_send(sc, frame->mii_opcode, 2); - dc_mii_send(sc, frame->mii_phyaddr, 5); - dc_mii_send(sc, frame->mii_regaddr, 5); - - /* - * Now try reading data bits. If the turnaround failed, we still - * need to clock through 16 cycles to keep the PHY(s) in sync. - */ - frame->mii_turnaround = dc_mii_readbit(sc); - if (frame->mii_turnaround != 0) { - for (i = 0; i < 16; i++) - dc_mii_readbit(sc); - goto fail; - } - for (i = 0x8000; i; i >>= 1) { - if (dc_mii_readbit(sc)) - frame->mii_data |= i; - } - -fail: - - /* Clock the idle bits. */ - dc_mii_writebit(sc, 0); - dc_mii_writebit(sc, 0); - - if (frame->mii_turnaround != 0) - return (1); - return (0); -} - -/* - * Write to a PHY register through the MII. - */ -static int -dc_mii_writereg(struct dc_softc *sc, struct dc_mii_frame *frame) -{ - - /* - * Set up frame for TX. - */ - frame->mii_stdelim = DC_MII_STARTDELIM; - frame->mii_opcode = DC_MII_WRITEOP; - frame->mii_turnaround = DC_MII_TURNAROUND; - - /* - * Sync the PHYs. - */ - dc_mii_sync(sc); - - dc_mii_send(sc, frame->mii_stdelim, 2); - dc_mii_send(sc, frame->mii_opcode, 2); - dc_mii_send(sc, frame->mii_phyaddr, 5); - dc_mii_send(sc, frame->mii_regaddr, 5); - dc_mii_send(sc, frame->mii_turnaround, 2); - dc_mii_send(sc, frame->mii_data, 16); - - /* Clock the idle bits. */ - dc_mii_writebit(sc, 0); - dc_mii_writebit(sc, 0); - - return (0); + return (val); } static int dc_miibus_readreg(device_t dev, int phy, int reg) { - struct dc_mii_frame frame; - struct dc_softc *sc; + struct dc_softc *sc; int i, rval, phy_reg = 0; sc = device_get_softc(dev); - bzero(&frame, sizeof(frame)); if (sc->dc_pmode != DC_PMODE_MII) { if (phy == (MII_NPHY - 1)) { @@ -859,34 +732,29 @@ dc_miibus_readreg(device_t dev, int phy, } rval = CSR_READ_4(sc, phy_reg) & 0x0000FFFF; - if (rval == 0xFFFF) return (0); return (rval); } - frame.mii_phyaddr = phy; - frame.mii_regaddr = reg; if (sc->dc_type == DC_TYPE_98713) { phy_reg = CSR_READ_4(sc, DC_NETCFG); CSR_WRITE_4(sc, DC_NETCFG, phy_reg & ~DC_NETCFG_PORTSEL); } - dc_mii_readreg(sc, &frame); + rval = mii_bitbang_readreg(dev, &dc_mii_bitbang_ops, phy, reg); if (sc->dc_type == DC_TYPE_98713) CSR_WRITE_4(sc, DC_NETCFG, phy_reg); - return (frame.mii_data); + return (rval); } static int dc_miibus_writereg(device_t dev, int phy, int reg, int data) { struct dc_softc *sc; - struct dc_mii_frame frame; int i, phy_reg = 0; sc = device_get_softc(dev); - bzero(&frame, sizeof(frame)); if (DC_IS_PNIC(sc)) { CSR_WRITE_4(sc, DC_PN_MII, DC_PN_MIIOPCODE_WRITE | @@ -932,15 +800,11 @@ dc_miibus_writereg(device_t dev, int phy return (0); } - frame.mii_phyaddr = phy; - frame.mii_regaddr = reg; - frame.mii_data = data; - if (sc->dc_type == DC_TYPE_98713) { phy_reg = CSR_READ_4(sc, DC_NETCFG); CSR_WRITE_4(sc, DC_NETCFG, phy_reg & ~DC_NETCFG_PORTSEL); } - dc_mii_writereg(sc, &frame); + mii_bitbang_writereg(dev, &dc_mii_bitbang_ops, phy, reg, data); if (sc->dc_type == DC_TYPE_98713) CSR_WRITE_4(sc, DC_NETCFG, phy_reg); Modified: stable/7/sys/dev/dc/if_dcreg.h ============================================================================== --- stable/7/sys/dev/dc/if_dcreg.h Sun Nov 6 21:09:23 2011 (r227278) +++ stable/7/sys/dev/dc/if_dcreg.h Sun Nov 6 21:11:22 2011 (r227279) @@ -525,27 +525,9 @@ struct dc_mediainfo { struct dc_type { uint32_t dc_devid; uint8_t dc_minrev; - char *dc_name; + const char *dc_name; }; -struct dc_mii_frame { - uint8_t mii_stdelim; - uint8_t mii_opcode; - uint8_t mii_phyaddr; - uint8_t mii_regaddr; - uint8_t mii_turnaround; - uint16_t mii_data; -}; - -/* - * MII constants - */ -#define DC_MII_STARTDELIM 0x01 -#define DC_MII_READOP 0x02 -#define DC_MII_WRITEOP 0x01 -#define DC_MII_TURNAROUND 0x02 - - /* * Registers specific to clone devices. * This mainly relates to RX filter programming: not all 21x4x clones @@ -804,7 +786,7 @@ struct dc_softc { #define CSR_READ_4(sc, reg) \ bus_space_read_4(sc->dc_btag, sc->dc_bhandle, reg) -#define CSR_BARRIER_4(sc, reg, flags) \ +#define CSR_BARRIER_4(sc, reg, flags) \ bus_space_barrier(sc->dc_btag, sc->dc_bhandle, reg, 4, flags) #define DC_TIMEOUT 1000 Copied: stable/7/sys/dev/mii/mii_bitbang.c (from r226995, head/sys/dev/mii/mii_bitbang.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/7/sys/dev/mii/mii_bitbang.c Sun Nov 6 21:11:22 2011 (r227279, copy of r226995, head/sys/dev/mii/mii_bitbang.c) @@ -0,0 +1,180 @@ +/* $NetBSD: mii_bitbang.c,v 1.12 2008/05/04 17:06:09 xtraeme Exp $ */ + +/*- + * Copyright (c) 1999 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, + * NASA Ames Research Center. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following didevlaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following didevlaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * Common module for bit-bang'ing the MII. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include + +#include +#include + +MODULE_VERSION(mii_bitbang, 1); + +static void mii_bitbang_sendbits(device_t dev, mii_bitbang_ops_t ops, + uint32_t data, int nbits); + +#define MWRITE(x) \ +do { \ + ops->mbo_write(dev, (x)); \ + DELAY(1); \ +} while (/* CONSTCOND */ 0) + +#define MREAD ops->mbo_read(dev) + +#define MDO ops->mbo_bits[MII_BIT_MDO] +#define MDI ops->mbo_bits[MII_BIT_MDI] +#define MDC ops->mbo_bits[MII_BIT_MDC] +#define MDIRPHY ops->mbo_bits[MII_BIT_DIR_HOST_PHY] +#define MDIRHOST ops->mbo_bits[MII_BIT_DIR_PHY_HOST] + +/* + * mii_bitbang_sync: + * + * Synchronize the MII. + */ +void +mii_bitbang_sync(device_t dev, mii_bitbang_ops_t ops) +{ + int i; + uint32_t v; + + v = MDIRPHY | MDO; + + MWRITE(v); + for (i = 0; i < 32; i++) { + MWRITE(v | MDC); + MWRITE(v); + } +} + +/* + * mii_bitbang_sendbits: + * + * Send a series of bits to the MII. + */ +static void +mii_bitbang_sendbits(device_t dev, mii_bitbang_ops_t ops, uint32_t data, + int nbits) +{ + int i; + uint32_t v; + + v = MDIRPHY; + MWRITE(v); + + for (i = 1 << (nbits - 1); i != 0; i >>= 1) { + if (data & i) + v |= MDO; + else + v &= ~MDO; + MWRITE(v); + MWRITE(v | MDC); + MWRITE(v); + } +} + +/* + * mii_bitbang_readreg: + * + * Read a PHY register by bit-bang'ing the MII. + */ +int +mii_bitbang_readreg(device_t dev, mii_bitbang_ops_t ops, int phy, int reg) +{ + int i, error, val; + + mii_bitbang_sync(dev, ops); + + mii_bitbang_sendbits(dev, ops, MII_COMMAND_START, 2); + mii_bitbang_sendbits(dev, ops, MII_COMMAND_READ, 2); + mii_bitbang_sendbits(dev, ops, phy, 5); + mii_bitbang_sendbits(dev, ops, reg, 5); + + /* Switch direction to PHY->host, without a clock transition. */ + MWRITE(MDIRHOST); + + /* Turnaround clock. */ + MWRITE(MDIRHOST | MDC); + MWRITE(MDIRHOST); + + /* Check for error. */ + error = MREAD & MDI; + + /* Idle clock. */ + MWRITE(MDIRHOST | MDC); + MWRITE(MDIRHOST); + + val = 0; + for (i = 0; i < 16; i++) { + val <<= 1; + /* Read data prior to clock low-high transition. */ + if (error == 0 && (MREAD & MDI) != 0) + val |= 1; + + MWRITE(MDIRHOST | MDC); + MWRITE(MDIRHOST); + } + + /* Set direction to host->PHY, without a clock transition. */ + MWRITE(MDIRPHY); + + return (error != 0 ? 0 : val); +} + +/* + * mii_bitbang_writereg: + * + * Write a PHY register by bit-bang'ing the MII. + */ +void +mii_bitbang_writereg(device_t dev, mii_bitbang_ops_t ops, int phy, int reg, + int val) +{ + + mii_bitbang_sync(dev, ops); + + mii_bitbang_sendbits(dev, ops, MII_COMMAND_START, 2); + mii_bitbang_sendbits(dev, ops, MII_COMMAND_WRITE, 2); + mii_bitbang_sendbits(dev, ops, phy, 5); + mii_bitbang_sendbits(dev, ops, reg, 5); + mii_bitbang_sendbits(dev, ops, MII_COMMAND_ACK, 2); + mii_bitbang_sendbits(dev, ops, val, 16); + + MWRITE(MDIRPHY); +} Copied: stable/7/sys/dev/mii/mii_bitbang.h (from r226995, head/sys/dev/mii/mii_bitbang.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/7/sys/dev/mii/mii_bitbang.h Sun Nov 6 21:11:22 2011 (r227279, copy of r226995, head/sys/dev/mii/mii_bitbang.h) @@ -0,0 +1,54 @@ +/* $NetBSD: mii_bitbang.h,v 1.6 2009/05/12 14:31:27 cegger Exp $ */ + +/*- + * Copyright (c) 1999 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, + * NASA Ames Research Center. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#define MII_BIT_MDO 0 /* data out (host->PHY) */ +#define MII_BIT_MDI 1 /* data in (PHY->host) */ +#define MII_BIT_MDC 2 /* clock */ +#define MII_BIT_DIR_HOST_PHY 3 /* set direction: host->PHY */ +#define MII_BIT_DIR_PHY_HOST 4 /* set direction: PHY->host */ +#define MII_NBITS 5 + +struct mii_bitbang_ops { + uint32_t (*mbo_read)(device_t); + void (*mbo_write)(device_t, uint32_t); + uint32_t mbo_bits[MII_NBITS]; +}; + +typedef const struct mii_bitbang_ops *mii_bitbang_ops_t; + +int mii_bitbang_readreg(device_t dev, mii_bitbang_ops_t ops, + int phy, int reg); +void mii_bitbang_sync(device_t dev, mii_bitbang_ops_t ops); +void mii_bitbang_writereg(device_t dev, mii_bitbang_ops_t ops, + int phy, int reg, int val); Modified: stable/7/sys/dev/nge/if_nge.c ============================================================================== --- stable/7/sys/dev/nge/if_nge.c Sun Nov 6 21:09:23 2011 (r227278) +++ stable/7/sys/dev/nge/if_nge.c Sun Nov 6 21:11:22 2011 (r227279) @@ -117,6 +117,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -138,7 +139,7 @@ MODULE_DEPEND(nge, miibus, 1, 1, 1); /* * Various supported device vendors/types and their names. */ -static struct nge_type nge_devs[] = { +static const struct nge_type const nge_devs[] = { { NGE_VENDORID, NGE_DEVICEID, "National Semiconductor Gigabit Ethernet" }, { 0, 0, NULL } @@ -180,11 +181,6 @@ static void nge_eeprom_putbyte(struct ng static void nge_eeprom_getword(struct nge_softc *, int, uint16_t *); static void nge_read_eeprom(struct nge_softc *, caddr_t, int, int); -static void nge_mii_sync(struct nge_softc *); -static void nge_mii_send(struct nge_softc *, uint32_t, int); -static int nge_mii_readreg(struct nge_softc *, struct nge_mii_frame *); -static int nge_mii_writereg(struct nge_softc *, struct nge_mii_frame *); - static int nge_miibus_readreg(device_t, int, int); static int nge_miibus_writereg(device_t, int, int, int); static void nge_miibus_statchg(device_t); @@ -200,6 +196,24 @@ static void nge_sysctl_node(struct nge_s static int sysctl_int_range(SYSCTL_HANDLER_ARGS, int, int); static int sysctl_hw_nge_int_holdoff(SYSCTL_HANDLER_ARGS); +/* + * MII bit-bang glue + */ +static uint32_t nge_mii_bitbang_read(device_t); +static void nge_mii_bitbang_write(device_t, uint32_t); + +static const struct mii_bitbang_ops nge_mii_bitbang_ops = { + nge_mii_bitbang_read, + nge_mii_bitbang_write, + { + NGE_MEAR_MII_DATA, /* MII_BIT_MDO */ + NGE_MEAR_MII_DATA, /* MII_BIT_MDI */ + NGE_MEAR_MII_CLK, /* MII_BIT_MDC */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-7@FreeBSD.ORG Mon Nov 7 11:31:37 2011 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 C45BD1065672; Mon, 7 Nov 2011 11:31:37 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B37AB8FC0C; Mon, 7 Nov 2011 11:31:37 +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 pA7BVbb6077051; Mon, 7 Nov 2011 11:31:37 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA7BVbpk077049; Mon, 7 Nov 2011 11:31:37 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201111071131.pA7BVbpk077049@svn.freebsd.org> From: Marius Strobl Date: Mon, 7 Nov 2011 11:31:37 +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: r227301 - stable/7/sys/conf 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: Mon, 07 Nov 2011 11:31:37 -0000 Author: marius Date: Mon Nov 7 11:31:37 2011 New Revision: 227301 URL: http://svn.freebsd.org/changeset/base/227301 Log: Automatically compile in mii_bitbang.c if one of the drivers depending on it since r227279 is compiled into the kernel. This restores POLA for people that don't use "options miibus" but "options mii" and individual PHY drivers instead. This is a direct commit to stable/7. Modified: stable/7/sys/conf/files Modified: stable/7/sys/conf/files ============================================================================== --- stable/7/sys/conf/files Mon Nov 7 11:31:14 2011 (r227300) +++ stable/7/sys/conf/files Mon Nov 7 11:31:37 2011 (r227301) @@ -966,7 +966,9 @@ dev/mii/ip1000phy.c optional miibus | i dev/mii/jmphy.c optional miibus | jmphy dev/mii/lxtphy.c optional miibus | lxtphy dev/mii/mii.c optional miibus | mii -dev/mii/mii_bitbang.c optional miibus | mii_bitbang +dev/mii/mii_bitbang.c optional miibus | mii_bitbang | bm | \ + dc | nge | rl | sis | \ + ste | stge | tl | wb | xl dev/mii/mii_physubr.c optional miibus | mii dev/mii/miibus_if.m optional miibus | mii dev/mii/mlphy.c optional miibus | mlphy From owner-svn-src-stable-7@FreeBSD.ORG Mon Nov 7 13:18:09 2011 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 78CD61065884; Mon, 7 Nov 2011 13:18:09 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 664E18FC19; Mon, 7 Nov 2011 13:18:09 +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 pA7DI9fO080647; Mon, 7 Nov 2011 13:18:09 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA7DI9g3080641; Mon, 7 Nov 2011 13:18:09 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201111071318.pA7DI9g3080641@svn.freebsd.org> From: Marius Strobl Date: Mon, 7 Nov 2011 13:18:09 +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: r227304 - in stable/7/sys: dev/esp sparc64/sbus 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: Mon, 07 Nov 2011 13:18:09 -0000 Author: marius Date: Mon Nov 7 13:18:09 2011 New Revision: 227304 URL: http://svn.freebsd.org/changeset/base/227304 Log: MFC: r226947, r226949, r227284 - Use device_t rather than the NetBSDish struct device. - Move esp_devclass to ncr53c9x.c in order to allow different bus front-ends to use it. - Use KOBJMETHOD_END. - Remove the gl_clear_latched_intr hook as it's not needed for any of the chips nor the front-ends supported in FreeBSD and likely never will be. - Correct the DMA constraints and only limit the tag used for the transfer buffers to 32-bit DMA as that address is written into a 32-bit register. - The ESP200 also only supports up to 64k transfers. - Don't let the DMA and SBus front-end supply a maximum transfer size larger than MAXPHYS as that's the maximum the upper layers use and we otherwise just waste resources unnecessarily. - Initialize the ECB callout and don't zero the handle when returning ECBs to the free list so that ncr53c9x_callout() actually is called with the driver lock held. - On detach the driver lock should be held across cam_sim_free() according to isp(4) and a panic received. - Check the return value of NCRDMA_SETUP(), i.e. bus_dmamap_load(9), and try to handle failures gracefully. - In ncr53c9x_action() replace N calls to xpt_done() in a switch with just one at the end. - On XPT_PATH_INQ report "NCR" rather than "Sun" as the vendor as the former is somewhat more correct as well as the maximum supported transfer size via maxio in order to take advantage of controllers that that can handle more than DFLTPHYS. - Freeze the device queue if a request didn't complete without error and isn't already frozen. - Print the number of MESSAGE (EXTENDED) rejected. - Fix the path encoded in the multiple inclusion protection of ncr53c9xvar.h. - Correct the DMA constraints used in the LSI64854 core to not exceed the maximum supported transfer size and include the boundary so we don't need to check on every setup of a DMA transfer. - Let the bus DMA map callbacks do nothing in case of an error. - Correctly handle > 64k transfers for FAS366 in the LSI64854. A new feature flag NCR_F_LARGEXFER was introduced so we just need to check for this one and not for individual controllers supporting large transfers in several places. - Let the LSI64854 core load transfer buffers using BUS_DMA_NOWAIT as the NCR53C9x core can't handle EINPROGRESS. Due to lack of bounce buffers support, sparc64 doesn't actually use EINPROGRESS and likely never will, as an example for writing additional front-ends for the NCR53C9x core it makes sense to set BUS_DMA_NOWAIT anyway though. - Some minor cleanup. Modified: stable/7/sys/dev/esp/esp_sbus.c stable/7/sys/dev/esp/ncr53c9x.c stable/7/sys/dev/esp/ncr53c9xvar.h stable/7/sys/sparc64/sbus/lsi64854.c stable/7/sys/sparc64/sbus/lsi64854var.h Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/esp/esp_sbus.c ============================================================================== --- stable/7/sys/dev/esp/esp_sbus.c Mon Nov 7 13:17:40 2011 (r227303) +++ stable/7/sys/dev/esp/esp_sbus.c Mon Nov 7 13:18:09 2011 (r227304) @@ -68,13 +68,13 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include #include #include -#include #include #include @@ -92,7 +92,7 @@ __FBSDID("$FreeBSD$"); struct esp_softc { struct ncr53c9x_softc sc_ncr53c9x; /* glue to MI code */ - struct device *sc_dev; + device_t sc_dev; struct resource *sc_res; @@ -102,8 +102,6 @@ struct esp_softc { struct lsi64854_softc *sc_dma; /* pointer to my DMA */ }; -static devclass_t esp_devclass; - static int esp_probe(device_t); static int esp_dma_attach(device_t); static int esp_dma_detach(device_t); @@ -118,7 +116,8 @@ static device_method_t esp_dma_methods[] DEVMETHOD(device_detach, esp_dma_detach), DEVMETHOD(device_suspend, esp_suspend), DEVMETHOD(device_resume, esp_resume), - {0, 0} + + KOBJMETHOD_END }; static driver_t esp_dma_driver = { @@ -136,7 +135,8 @@ static device_method_t esp_sbus_methods[ DEVMETHOD(device_detach, esp_sbus_detach), DEVMETHOD(device_suspend, esp_suspend), DEVMETHOD(device_resume, esp_resume), - {0, 0} + + KOBJMETHOD_END }; static driver_t esp_sbus_driver = { @@ -175,7 +175,6 @@ static const struct ncr53c9x_glue const esp_dma_go, esp_dma_stop, esp_dma_isactive, - NULL, /* gl_clear_latched_intr */ }; static int @@ -245,9 +244,9 @@ esp_sbus_attach(device_t dev) BUS_SPACE_MAXADDR, /* lowaddr */ BUS_SPACE_MAXADDR, /* highaddr */ NULL, NULL, /* filter, filterarg */ - BUS_SPACE_MAXSIZE_32BIT, /* maxsize */ - 0, /* nsegments */ - BUS_SPACE_MAXSIZE_32BIT, /* maxsegsize */ + BUS_SPACE_MAXSIZE, /* maxsize */ + BUS_SPACE_UNRESTRICTED, /* nsegments */ + BUS_SPACE_MAXSIZE, /* maxsegsize */ 0, /* flags */ NULL, NULL, /* no locking */ &lsc->sc_parent_dmat); @@ -292,8 +291,10 @@ esp_sbus_attach(device_t dev) } for (i = 0; i < nchildren; i++) { if (device_is_attached(children[i]) && - sbus_get_slot(children[i]) == sbus_get_slot(dev) && - strcmp(ofw_bus_get_name(children[i]), "dma") == 0) { + sbus_get_slot(children[i]) == + sbus_get_slot(dev) && + strcmp(ofw_bus_get_name(children[i]), + "dma") == 0) { /* XXX hackery */ esc->sc_dma = (struct lsi64854_softc *) device_get_softc(children[i]); @@ -453,13 +454,6 @@ espattach(struct esp_softc *esc, const s NCR_LOCK_INIT(sc); - /* Attach the DMA engine. */ - error = lsi64854_attach(esc->sc_dma); - if (error != 0) { - device_printf(esc->sc_dev, "lsi64854_attach failed\n"); - goto fail_lock; - } - sc->sc_id = OF_getscsinitid(esc->sc_dev); #ifdef ESP_SBUS_DEBUG @@ -516,9 +510,9 @@ espattach(struct esp_softc *esc, const s NCR_WRITE_REG(sc, NCR_CFG2, sc->sc_cfg2); if ((NCR_READ_REG(sc, NCR_CFG2) & ~NCRCFG2_RSVD) != - (NCRCFG2_SCSI2 | NCRCFG2_RPE)) { + (NCRCFG2_SCSI2 | NCRCFG2_RPE)) sc->sc_rev = NCR_VARIANT_ESP100; - } else { + else { sc->sc_cfg2 = NCRCFG2_SCSI2; NCR_WRITE_REG(sc, NCR_CFG2, sc->sc_cfg2); sc->sc_cfg3 = 0; @@ -526,9 +520,9 @@ espattach(struct esp_softc *esc, const s sc->sc_cfg3 = (NCRCFG3_CDB | NCRCFG3_FCLK); NCR_WRITE_REG(sc, NCR_CFG3, sc->sc_cfg3); if (NCR_READ_REG(sc, NCR_CFG3) != - (NCRCFG3_CDB | NCRCFG3_FCLK)) { + (NCRCFG3_CDB | NCRCFG3_FCLK)) sc->sc_rev = NCR_VARIANT_ESP100A; - } else { + else { /* NCRCFG2_FE enables > 64K transfers. */ sc->sc_cfg2 |= NCRCFG2_FE; sc->sc_cfg3 = 0; @@ -543,9 +537,11 @@ espattach(struct esp_softc *esc, const s case 0x02: if ((uid & 0x07) == 0x02) - sc->sc_rev = NCR_VARIANT_FAS216; + sc->sc_rev = + NCR_VARIANT_FAS216; else - sc->sc_rev = NCR_VARIANT_FAS236; + sc->sc_rev = + NCR_VARIANT_FAS236; break; case 0x0a: @@ -560,7 +556,8 @@ espattach(struct esp_softc *esc, const s */ device_printf(esc->sc_dev, "Unknown chip\n"); - goto fail_lsi; + error = ENXIO; + goto fail_lock; } } } @@ -571,12 +568,6 @@ espattach(struct esp_softc *esc, const s #endif /* - * XXX minsync and maxxfer _should_ be set up in MI code, - * XXX but it appears to have some dependency on what sort - * XXX of DMA we're hooked up to, etc. - */ - - /* * This is the value used to start sync negotiations * Note that the NCR register "SYNCTP" is programmed * in "clocks per byte", and has a minimum value of 4. @@ -587,31 +578,27 @@ espattach(struct esp_softc *esc, const s */ sc->sc_minsync = 1000 / sc->sc_freq; + /* + * Except for some variants the maximum transfer size is 64k. + */ + sc->sc_maxxfer = 64 * 1024; sc->sc_maxoffset = 15; sc->sc_extended_geom = 1; /* * Alas, we must now modify the value a bit, because it's - * only valid when can switch on FASTCLK and FASTSCSI bits - * in config register 3... + * only valid when we can switch on FASTCLK and FASTSCSI bits + * in the config register 3... */ switch (sc->sc_rev) { case NCR_VARIANT_ESP100: sc->sc_maxwidth = MSG_EXT_WDTR_BUS_8_BIT; - sc->sc_maxxfer = 64 * 1024; sc->sc_minsync = 0; /* No synch on old chip? */ break; case NCR_VARIANT_ESP100A: - sc->sc_maxwidth = MSG_EXT_WDTR_BUS_8_BIT; - sc->sc_maxxfer = 64 * 1024; - /* Min clocks/byte is 5 */ - sc->sc_minsync = ncr53c9x_cpb2stp(sc, 5); - break; - case NCR_VARIANT_ESP200: sc->sc_maxwidth = MSG_EXT_WDTR_BUS_8_BIT; - sc->sc_maxxfer = 16 * 1024 * 1024; /* Min clocks/byte is 5 */ sc->sc_minsync = ncr53c9x_cpb2stp(sc, 5); break; @@ -642,6 +629,19 @@ espattach(struct esp_softc *esc, const s break; } + /* + * Given that we allocate resources based on sc->sc_maxxfer it doesn't + * make sense to supply a value higher than the maximum actually used. + */ + sc->sc_maxxfer = min(sc->sc_maxxfer, MAXPHYS); + + /* Attach the DMA engine. */ + error = lsi64854_attach(esc->sc_dma); + if (error != 0) { + device_printf(esc->sc_dev, "lsi64854_attach failed\n"); + goto fail_lock; + } + /* Establish interrupt channel. */ i = 0; if ((esc->sc_irqres = bus_alloc_resource_any(esc->sc_dev, SYS_RES_IRQ, Modified: stable/7/sys/dev/esp/ncr53c9x.c ============================================================================== --- stable/7/sys/dev/esp/ncr53c9x.c Mon Nov 7 13:17:40 2011 (r227303) +++ stable/7/sys/dev/esp/ncr53c9x.c Mon Nov 7 13:18:09 2011 (r227304) @@ -123,6 +123,8 @@ __FBSDID("$FreeBSD$"); #include #include +devclass_t esp_devclass; + MODULE_DEPEND(esp, cam, 1, 1, 1); #ifdef NCR53C9X_DEBUG @@ -179,8 +181,7 @@ static inline int ncr53c9x_stp2cpb(struc #define NCR_SET_COUNT(sc, size) do { \ NCR_WRITE_REG((sc), NCR_TCL, (size)); \ NCR_WRITE_REG((sc), NCR_TCM, (size) >> 8); \ - if ((sc->sc_cfg2 & NCRCFG2_FE) || \ - (sc->sc_rev == NCR_VARIANT_FAS366)) \ + if ((sc->sc_features & NCR_F_LARGEXFER) != 0) \ NCR_WRITE_REG((sc), NCR_TCH, (size) >> 16); \ if (sc->sc_rev == NCR_VARIANT_FAS366) \ NCR_WRITE_REG(sc, NCR_RCH, 0); \ @@ -391,6 +392,7 @@ ncr53c9x_attach(struct ncr53c9x_softc *s ecb = &sc->ecb_array[i]; ecb->sc = sc; ecb->tag_id = i; + callout_init_mtx(&ecb->ch, &sc->sc_lock, 0); TAILQ_INSERT_HEAD(&sc->free_list, ecb, free_links); } @@ -449,10 +451,10 @@ ncr53c9x_detach(struct ncr53c9x_softc *s xpt_register_async(0, ncr53c9x_async, sc->sc_sim, sc->sc_path); xpt_free_path(sc->sc_path); xpt_bus_deregister(cam_sim_path(sc->sc_sim)); + cam_sim_free(sc->sc_sim, TRUE); NCR_UNLOCK(sc); - cam_sim_free(sc->sc_sim, TRUE); free(sc->ecb_array, M_DEVBUF); free(sc->sc_tinfo, M_DEVBUF); if (sc->sc_imess_self) @@ -504,6 +506,8 @@ ncr53c9x_reset(struct ncr53c9x_softc *sc /* FALLTHROUGH */ case NCR_VARIANT_ESP100A: sc->sc_features |= NCR_F_SELATN3; + if ((sc->sc_cfg2 & NCRCFG2_FE) != 0) + sc->sc_features |= NCR_F_LARGEXFER; NCR_WRITE_REG(sc, NCR_CFG2, sc->sc_cfg2); /* FALLTHROUGH */ case NCR_VARIANT_ESP100: @@ -514,8 +518,8 @@ ncr53c9x_reset(struct ncr53c9x_softc *sc break; case NCR_VARIANT_FAS366: - sc->sc_features |= - NCR_F_HASCFG3 | NCR_F_FASTSCSI | NCR_F_SELATN3; + sc->sc_features |= NCR_F_HASCFG3 | NCR_F_FASTSCSI | + NCR_F_SELATN3 | NCR_F_LARGEXFER; sc->sc_cfg3 = NCRFASCFG3_FASTCLK | NCRFASCFG3_OBAUTO; if (sc->sc_id > 7) sc->sc_cfg3 |= NCRFASCFG3_IDBIT3; @@ -711,9 +715,6 @@ ncr53c9x_readregs(struct ncr53c9x_softc sc->sc_espintr = NCR_READ_REG(sc, NCR_INTR); - if (sc->sc_glue->gl_clear_latched_intr != NULL) - (*sc->sc_glue->gl_clear_latched_intr)(sc); - /* * Determine the SCSI bus phase, return either a real SCSI bus phase * or some pseudo phase we use to detect certain exceptions. @@ -806,7 +807,7 @@ ncr53c9x_select(struct ncr53c9x_softc *s struct ncr53c9x_tinfo *ti; uint8_t *cmd; size_t dmasize; - int clen, selatn3, selatns; + int clen, error, selatn3, selatns; int lun = ecb->ccb->ccb_h.target_lun; int target = ecb->ccb->ccb_h.target_id; @@ -887,13 +888,19 @@ ncr53c9x_select(struct ncr53c9x_softc *s dmasize = clen; sc->sc_cmdlen = clen; sc->sc_cmdp = cmd; - NCRDMA_SETUP(sc, &sc->sc_cmdp, &sc->sc_cmdlen, 0, &dmasize); + error = NCRDMA_SETUP(sc, &sc->sc_cmdp, &sc->sc_cmdlen, 0, + &dmasize); + if (error != 0) { + sc->sc_cmdlen = 0; + sc->sc_cmdp = NULL; + goto cmd; + } + /* Program the SCSI counter. */ NCR_SET_COUNT(sc, dmasize); /* Load the count in. */ - /* if (sc->sc_rev != NCR_VARIANT_FAS366) */ - NCRCMD(sc, NCRCMD_NOP | NCRCMD_DMA); + NCRCMD(sc, NCRCMD_NOP | NCRCMD_DMA); /* And get the target's attention. */ if (selatn3) { @@ -906,6 +913,7 @@ ncr53c9x_select(struct ncr53c9x_softc *s return; } +cmd: /* * Who am I? This is where we tell the target that we are * happy for it to disconnect etc. @@ -989,13 +997,11 @@ ncr53c9x_action(struct cam_sim *sim, uni case XPT_RESET_BUS: ncr53c9x_init(sc, 1); ccb->ccb_h.status = CAM_REQ_CMP; - xpt_done(ccb); - return; + break; case XPT_CALC_GEOMETRY: cam_calc_geometry(&ccb->ccg, sc->sc_extended_geom); - xpt_done(ccb); - return; + break; case XPT_PATH_INQ: cpi = &ccb->cpi; @@ -1009,19 +1015,19 @@ ncr53c9x_action(struct cam_sim *sim, uni cpi->max_target = sc->sc_ntarg - 1; cpi->max_lun = 7; cpi->initiator_id = sc->sc_id; - cpi->bus_id = 0; - cpi->base_transfer_speed = 3300; strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN); - strncpy(cpi->hba_vid, "Sun", HBA_IDLEN); + strncpy(cpi->hba_vid, "NCR", HBA_IDLEN); strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN); cpi->unit_number = cam_sim_unit(sim); - cpi->transport = XPORT_SPI; - cpi->transport_version = 2; + cpi->bus_id = 0; + cpi->base_transfer_speed = 3300; cpi->protocol = PROTO_SCSI; cpi->protocol_version = SCSI_REV_2; + cpi->transport = XPORT_SPI; + cpi->transport_version = 2; + cpi->maxio = sc->sc_maxxfer; ccb->ccb_h.status = CAM_REQ_CMP; - xpt_done(ccb); - return; + break; case XPT_GET_TRAN_SETTINGS: cts = &ccb->cts; @@ -1064,28 +1070,24 @@ ncr53c9x_action(struct cam_sim *sim, uni CTS_SPI_VALID_DISC; scsi->valid = CTS_SCSI_VALID_TQ; ccb->ccb_h.status = CAM_REQ_CMP; - xpt_done(ccb); - return; + break; case XPT_ABORT: device_printf(sc->sc_dev, "XPT_ABORT called\n"); ccb->ccb_h.status = CAM_FUNC_NOTAVAIL; - xpt_done(ccb); - return; + break; case XPT_TERM_IO: device_printf(sc->sc_dev, "XPT_TERM_IO called\n"); ccb->ccb_h.status = CAM_FUNC_NOTAVAIL; - xpt_done(ccb); - return; + break; case XPT_RESET_DEV: case XPT_SCSI_IO: if (ccb->ccb_h.target_id < 0 || ccb->ccb_h.target_id >= sc->sc_ntarg) { ccb->ccb_h.status = CAM_PATH_INVALID; - xpt_done(ccb); - return; + goto done; } /* Get an ECB to use. */ ecb = ncr53c9x_get_ecb(sc); @@ -1097,8 +1099,7 @@ ncr53c9x_action(struct cam_sim *sim, uni xpt_freeze_simq(sim, 1); ccb->ccb_h.status = CAM_REQUEUE_REQ; device_printf(sc->sc_dev, "unable to allocate ecb\n"); - xpt_done(ccb); - return; + goto done; } /* Initialize ecb. */ @@ -1127,7 +1128,7 @@ ncr53c9x_action(struct cam_sim *sim, uni ecb->flags |= ECB_READY; if (sc->sc_state == NCR_IDLE) ncr53c9x_sched(sc); - break; + return; case XPT_SET_TRAN_SETTINGS: cts = &ccb->cts; @@ -1165,16 +1166,16 @@ ncr53c9x_action(struct cam_sim *sim, uni } ccb->ccb_h.status = CAM_REQ_CMP; - xpt_done(ccb); - return; + break; default: device_printf(sc->sc_dev, "Unhandled function code %d\n", ccb->ccb_h.func_code); ccb->ccb_h.status = CAM_PROVIDE_FAIL; - xpt_done(ccb); - return; } + +done: + xpt_done(ccb); } /* @@ -1329,11 +1330,10 @@ ncr53c9x_sched(struct ncr53c9x_softc *sc sc->sc_nexus = ecb; ncr53c9x_select(sc, ecb); break; - } else { + } else NCR_TRACE(("[%s %d:%d busy] \n", __func__, ecb->ccb->ccb_h.target_id, ecb->ccb->ccb_h.target_lun)); - } } } @@ -1412,10 +1412,10 @@ ncr53c9x_done(struct ncr53c9x_softc *sc, */ if (ccb->ccb_h.status == CAM_REQ_CMP) { ccb->csio.scsi_status = ecb->stat; - if ((ecb->flags & ECB_ABORT) != 0) { + if ((ecb->flags & ECB_ABORT) != 0) ccb->ccb_h.status = CAM_CMD_TIMEOUT; - } else if ((ecb->flags & ECB_SENSE) != 0 && - (ecb->stat != SCSI_STATUS_CHECK_COND)) { + else if ((ecb->flags & ECB_SENSE) != 0 && + (ecb->stat != SCSI_STATUS_CHECK_COND)) { ccb->csio.scsi_status = SCSI_STATUS_CHECK_COND; ccb->ccb_h.status = CAM_SCSI_STATUS_ERROR | CAM_AUTOSNS_VALID; @@ -1439,13 +1439,15 @@ ncr53c9x_done(struct ncr53c9x_softc *sc, } ccb->ccb_h.status = CAM_SCSI_STATUS_ERROR; } - } else { + } else ccb->csio.resid = ecb->dleft; - } if (ecb->stat == SCSI_STATUS_QUEUE_FULL) ccb->ccb_h.status = CAM_SCSI_STATUS_ERROR; else if (ecb->stat == SCSI_STATUS_BUSY) ccb->ccb_h.status = CAM_SCSI_BUSY; + } else if ((ccb->ccb_h.status & CAM_DEV_QFRZN) == 0) { + ccb->ccb_h.status |= CAM_DEV_QFRZN; + xpt_freeze_devq(ccb->ccb_h.path, 1); } #ifdef NCR53C9X_DEBUG @@ -1473,7 +1475,7 @@ ncr53c9x_done(struct ncr53c9x_softc *sc, } } - if (ccb->ccb_h.status == CAM_SEL_TIMEOUT) { + if ((ccb->ccb_h.status & CAM_SEL_TIMEOUT) != 0) { /* Selection timeout -- discard this LUN if empty. */ if (li->untagged == NULL && li->used == 0) { if (lun < NCR_NLUN) @@ -2030,8 +2032,8 @@ gotit: default: xpt_print_path(ecb->ccb->ccb_h.path); - printf("unrecognized MESSAGE EXTENDED;" - " sending REJECT\n"); + printf("unrecognized MESSAGE EXTENDED 0x%x;" + " sending REJECT\n", sc->sc_imess[2]); goto reject; } break; @@ -2039,7 +2041,8 @@ gotit: default: NCR_MSGS(("ident ")); xpt_print_path(ecb->ccb->ccb_h.path); - printf("unrecognized MESSAGE; sending REJECT\n"); + printf("unrecognized MESSAGE 0x%x; sending REJECT\n", + sc->sc_imess[0]); /* FALLTHROUGH */ reject: ncr53c9x_sched_msgout(SEND_REJECT); @@ -2109,6 +2112,7 @@ ncr53c9x_msgout(struct ncr53c9x_softc *s struct ncr53c9x_tinfo *ti; struct ncr53c9x_ecb *ecb; size_t size; + int error; #ifdef NCR53C9X_DEBUG int i; #endif @@ -2246,17 +2250,14 @@ ncr53c9x_msgout(struct ncr53c9x_softc *s NCR_MSGS(("> ")); } #endif - if (sc->sc_rev == NCR_VARIANT_FAS366) { - /* - * XXX FIFO size - */ - ncr53c9x_flushfifo(sc); - ncr53c9x_wrfifo(sc, sc->sc_omp, sc->sc_omlen); - NCRCMD(sc, NCRCMD_TRANS); - } else { + + if (sc->sc_rev != NCR_VARIANT_FAS366) { /* (Re)send the message. */ size = ulmin(sc->sc_omlen, sc->sc_maxxfer); - NCRDMA_SETUP(sc, &sc->sc_omp, &sc->sc_omlen, 0, &size); + error = NCRDMA_SETUP(sc, &sc->sc_omp, &sc->sc_omlen, 0, &size); + if (error != 0) + goto cmd; + /* Program the SCSI counter. */ NCR_SET_COUNT(sc, size); @@ -2264,7 +2265,16 @@ ncr53c9x_msgout(struct ncr53c9x_softc *s NCRCMD(sc, NCRCMD_NOP | NCRCMD_DMA); NCRCMD(sc, NCRCMD_TRANS | NCRCMD_DMA); NCRDMA_GO(sc); + return; } + +cmd: + /* + * XXX FIFO size + */ + ncr53c9x_flushfifo(sc); + ncr53c9x_wrfifo(sc, sc->sc_omp, sc->sc_omlen); + NCRCMD(sc, NCRCMD_TRANS); } void @@ -2299,7 +2309,7 @@ ncr53c9x_intr1(struct ncr53c9x_softc *sc struct ncr53c9x_tinfo *ti; struct timeval cur, wait; size_t size; - int i, nfifo; + int error, i, nfifo; uint8_t msg; NCR_LOCK_ASSERT(sc, MA_OWNED); @@ -2974,8 +2984,14 @@ msgin: size = ecb->clen; sc->sc_cmdlen = size; sc->sc_cmdp = (void *)&ecb->cmd.cmd; - NCRDMA_SETUP(sc, &sc->sc_cmdp, &sc->sc_cmdlen, + error = NCRDMA_SETUP(sc, &sc->sc_cmdp, &sc->sc_cmdlen, 0, &size); + if (error != 0) { + sc->sc_cmdlen = 0; + sc->sc_cmdp = NULL; + goto cmd; + } + /* Program the SCSI counter. */ NCR_SET_COUNT(sc, size); @@ -2985,30 +3001,51 @@ msgin: /* Start the command transfer. */ NCRCMD(sc, NCRCMD_TRANS | NCRCMD_DMA); NCRDMA_GO(sc); - } else { - ncr53c9x_wrfifo(sc, (uint8_t *)&ecb->cmd.cmd, - ecb->clen); - NCRCMD(sc, NCRCMD_TRANS); + sc->sc_prevphase = COMMAND_PHASE; + break; } +cmd: + ncr53c9x_wrfifo(sc, (uint8_t *)&ecb->cmd.cmd, ecb->clen); + NCRCMD(sc, NCRCMD_TRANS); sc->sc_prevphase = COMMAND_PHASE; break; case DATA_OUT_PHASE: NCR_PHASE(("DATA_OUT_PHASE [%ld] ", (long)sc->sc_dleft)); + sc->sc_prevphase = DATA_OUT_PHASE; NCRCMD(sc, NCRCMD_FLUSH); size = ulmin(sc->sc_dleft, sc->sc_maxxfer); - NCRDMA_SETUP(sc, &sc->sc_dp, &sc->sc_dleft, 0, &size); - sc->sc_prevphase = DATA_OUT_PHASE; + error = NCRDMA_SETUP(sc, &sc->sc_dp, &sc->sc_dleft, 0, &size); goto setup_xfer; case DATA_IN_PHASE: NCR_PHASE(("DATA_IN_PHASE ")); + sc->sc_prevphase = DATA_IN_PHASE; if (sc->sc_rev == NCR_VARIANT_ESP100) NCRCMD(sc, NCRCMD_FLUSH); size = ulmin(sc->sc_dleft, sc->sc_maxxfer); - NCRDMA_SETUP(sc, &sc->sc_dp, &sc->sc_dleft, 1, &size); - sc->sc_prevphase = DATA_IN_PHASE; - setup_xfer: + error = NCRDMA_SETUP(sc, &sc->sc_dp, &sc->sc_dleft, 1, &size); +setup_xfer: + if (error != 0) { + switch (error) { + case EFBIG: + ecb->ccb->ccb_h.status |= CAM_REQ_TOO_BIG; + break; + case EINPROGRESS: + panic("%s: cannot deal with deferred DMA", + __func__); + case EINVAL: + ecb->ccb->ccb_h.status |= CAM_REQ_INVALID; + break; + case ENOMEM: + ecb->ccb->ccb_h.status |= CAM_REQUEUE_REQ; + break; + default: + ecb->ccb->ccb_h.status |= CAM_REQ_CMP_ERR; + } + goto finish; + } + /* Target returned to data phase: wipe "done" memory */ ecb->flags &= ~ECB_TENTATIVE_DONE; Modified: stable/7/sys/dev/esp/ncr53c9xvar.h ============================================================================== --- stable/7/sys/dev/esp/ncr53c9xvar.h Mon Nov 7 13:17:40 2011 (r227303) +++ stable/7/sys/dev/esp/ncr53c9xvar.h Mon Nov 7 13:18:09 2011 (r227304) @@ -68,8 +68,8 @@ /* $FreeBSD$ */ -#ifndef _DEV_IC_NCR53C9XVAR_H_ -#define _DEV_IC_NCR53C9XVAR_H_ +#ifndef _NCR53C9XVAR_H_ +#define _NCR53C9XVAR_H_ #include @@ -115,7 +115,8 @@ * scsi_status,sense_data}. */ struct ncr53c9x_ecb { - /* These fields are preserved between alloc and free */ + /* These fields are preserved between alloc and free. */ + struct callout ch; struct ncr53c9x_softc *sc; int tag_id; int flags; @@ -130,7 +131,6 @@ struct ncr53c9x_ecb { #define ECB_RESET 0x80 #define ECB_TENTATIVE_DONE 0x100 int timeout; - struct callout ch; struct { uint8_t msg[3]; /* Selection Id msg and tags */ @@ -290,7 +290,7 @@ extern int ncr53c9x_debug; struct ncr53c9x_softc; /* - * Function switch used as glue to MD code. + * Function switch used as glue to MD code */ struct ncr53c9x_glue { /* Mandatory entry points. */ @@ -304,9 +304,6 @@ struct ncr53c9x_glue { void (*gl_dma_go)(struct ncr53c9x_softc *); void (*gl_dma_stop)(struct ncr53c9x_softc *); int (*gl_dma_isactive)(struct ncr53c9x_softc *); - - /* Optional entry points. */ - void (*gl_clear_latched_intr)(struct ncr53c9x_softc *); }; struct ncr53c9x_softc { @@ -330,7 +327,7 @@ struct ncr53c9x_softc { uint8_t sc_ccf; /* Clock Conversion */ uint8_t sc_timeout; - /* register copies, see espreadregs() */ + /* register copies, see ncr53c9x_readregs() */ uint8_t sc_espintr; uint8_t sc_espstat; uint8_t sc_espstep; @@ -415,6 +412,7 @@ struct ncr53c9x_softc { #define NCR_F_FASTSCSI 0x02 /* chip supports Fast mode */ #define NCR_F_DMASELECT 0x04 /* can do dmaselect */ #define NCR_F_SELATN3 0x08 /* chip supports SELATN3 command */ +#define NCR_F_LARGEXFER 0x10 /* chip supports transfers > 64k */ /* values for sc_msgout */ #define SEND_DEV_RESET 0x0001 @@ -499,8 +497,10 @@ struct ncr53c9x_softc { #define ncr53c9x_cpb2stp(sc, cpb) \ ((250 * (cpb)) / (sc)->sc_freq) +extern devclass_t esp_devclass; + int ncr53c9x_attach(struct ncr53c9x_softc *sc); int ncr53c9x_detach(struct ncr53c9x_softc *sc); void ncr53c9x_intr(void *arg); -#endif /* _DEV_IC_NCR53C9XVAR_H_ */ +#endif /* _NCR53C9XVAR_H_ */ Modified: stable/7/sys/sparc64/sbus/lsi64854.c ============================================================================== --- stable/7/sys/sparc64/sbus/lsi64854.c Mon Nov 7 13:17:40 2011 (r227303) +++ stable/7/sys/sparc64/sbus/lsi64854.c Mon Nov 7 13:18:09 2011 (r227304) @@ -101,7 +101,12 @@ int lsi64854debug = 0; #define DPRINTF(a,x) #endif -#define MAX_DMA_SZ (16*1024*1024) +/* + * The rules say we cannot transfer more than the limit of this DMA chip (64k + * for old and 16Mb for new), and we cannot cross a 16Mb boundary. + */ +#define MAX_DMA_SZ (64 * 1024) +#define BOUNDARY (16 * 1024 * 1024) static void lsi64854_reset(struct lsi64854_softc *); static void lsi64854_map_scsi(void *, bus_dma_segment_t *, int, int); @@ -132,6 +137,7 @@ lsi64854_attach(struct lsi64854_softc *s lockfunc = NULL; lockfuncarg = NULL; + sc->sc_maxdmasize = MAX_DMA_SZ; switch (sc->sc_channel) { case L64854_CHANNEL_SCSI: @@ -142,6 +148,7 @@ lsi64854_attach(struct lsi64854_softc *s } lockfunc = busdma_lock_mutex; lockfuncarg = &nsc->sc_lock; + sc->sc_maxdmasize = nsc->sc_maxxfer; sc->intr = lsi64854_scsi_intr; sc->setup = lsi64854_setup; break; @@ -160,13 +167,13 @@ lsi64854_attach(struct lsi64854_softc *s if (sc->setup != NULL) { error = bus_dma_tag_create( sc->sc_parent_dmat, /* parent */ - 1, 0, /* alignment, boundary */ - BUS_SPACE_MAXADDR, /* lowaddr */ + 1, BOUNDARY, /* alignment, boundary */ + BUS_SPACE_MAXADDR_32BIT, /* lowaddr */ BUS_SPACE_MAXADDR, /* highaddr */ NULL, NULL, /* filter, filterarg */ - MAX_DMA_SZ, /* maxsize */ + sc->sc_maxdmasize, /* maxsize */ 1, /* nsegments */ - MAX_DMA_SZ, /* maxsegsize */ + sc->sc_maxdmasize, /* maxsegsize */ BUS_DMA_ALLOCNOW, /* flags */ lockfunc, lockfuncarg, /* lockfunc, lockfuncarg */ &sc->sc_buffer_dmat); @@ -257,24 +264,25 @@ lsi64854_detach(struct lsi64854_softc *s * other revs: D_ESC_R_PEND bit reads as 0 \ */ \ DMAWAIT(sc, L64854_GCSR(sc) & D_ESC_R_PEND, "R_PEND", dontpanic);\ - if (sc->sc_rev != DMAREV_HME) { \ - /* \ - * Select drain bit based on revision \ - * also clears errors and D_TC flag \ - */ \ - csr = L64854_GCSR(sc); \ - if (sc->sc_rev == DMAREV_1 || sc->sc_rev == DMAREV_0) \ - csr |= D_ESC_DRAIN; \ - else \ - csr |= L64854_INVALIDATE; \ + if (sc->sc_rev != DMAREV_HME) { \ + /* \ + * Select drain bit based on revision \ + * also clears errors and D_TC flag \ + */ \ + csr = L64854_GCSR(sc); \ + if (sc->sc_rev == DMAREV_1 || sc->sc_rev == DMAREV_0) \ + csr |= D_ESC_DRAIN; \ + else \ + csr |= L64854_INVALIDATE; \ \ - L64854_SCSR(sc,csr); \ + L64854_SCSR(sc, csr); \ } \ /* \ * Wait for draining to finish \ * rev0 & rev1 call this PACKCNT \ */ \ - DMAWAIT(sc, L64854_GCSR(sc) & L64854_DRAINING, "DRAINING", dontpanic);\ + DMAWAIT(sc, L64854_GCSR(sc) & L64854_DRAINING, "DRAINING", \ + dontpanic); \ } while (/* CONSTCOND */0) #define DMA_FLUSH(sc, dontpanic) do { \ @@ -289,12 +297,14 @@ lsi64854_detach(struct lsi64854_softc *s csr = L64854_GCSR(sc); \ csr &= ~(L64854_WRITE|L64854_EN_DMA); /* no-ops on ENET */ \ csr |= L64854_INVALIDATE; /* XXX FAS ? */ \ - L64854_SCSR(sc,csr); \ + L64854_SCSR(sc, csr); \ } while (/* CONSTCOND */0) static void lsi64854_reset(struct lsi64854_softc *sc) { + bus_dma_tag_t dmat; + bus_dmamap_t dmam; uint32_t csr; DMA_FLUSH(sc, 1); @@ -303,10 +313,11 @@ lsi64854_reset(struct lsi64854_softc *sc DPRINTF(LDB_ANY, ("%s: csr 0x%x\n", __func__, csr)); if (sc->sc_dmasize != 0) { - bus_dmamap_sync(sc->sc_buffer_dmat, sc->sc_dmamap, - (csr & D_WRITE) != 0 ? BUS_DMASYNC_PREREAD : - BUS_DMASYNC_PREWRITE); - bus_dmamap_unload(sc->sc_buffer_dmat, sc->sc_dmamap); + dmat = sc->sc_buffer_dmat; + dmam = sc->sc_dmamap; + bus_dmamap_sync(dmat, dmam, (csr & D_WRITE) != 0 ? + BUS_DMASYNC_PREREAD : BUS_DMASYNC_PREWRITE); + bus_dmamap_unload(dmat, dmam); } if (sc->sc_rev == DMAREV_HME) @@ -371,15 +382,16 @@ lsi64854_map_scsi(void *arg, bus_dma_seg sc = (struct lsi64854_softc *)arg; + if (error != 0) + return; if (nseg != 1) panic("%s: cannot map %d segments\n", __func__, nseg); bus_dmamap_sync(sc->sc_buffer_dmat, sc->sc_dmamap, - sc->sc_datain ? BUS_DMASYNC_PREREAD : BUS_DMASYNC_PREWRITE); + sc->sc_datain != 0 ? BUS_DMASYNC_PREREAD : BUS_DMASYNC_PREWRITE); bus_write_4(sc->sc_res, L64854_REG_ADDR, segs[0].ds_addr); } -#define DMAMAX(a) (MAX_DMA_SZ - ((a) & (MAX_DMA_SZ - 1))) /* * setup a DMA transfer */ @@ -388,6 +400,7 @@ lsi64854_setup(struct lsi64854_softc *sc int datain, size_t *dmasize) { long bcnt; + int error; uint32_t csr; DMA_FLUSH(sc, 0); @@ -399,15 +412,12 @@ lsi64854_setup(struct lsi64854_softc *sc sc->sc_dmalen = len; sc->sc_datain = datain; - /* - * The rules say we cannot transfer more than the limit - * of this DMA chip (64k for old and 16Mb for new), - * and we cannot cross a 16Mb boundary. - */ - *dmasize = sc->sc_dmasize = - ulmin(*dmasize, DMAMAX((size_t)*sc->sc_dmaaddr)); + KASSERT(*dmasize <= sc->sc_maxdmasize, + ("%s: transfer size %ld too large", __func__, (long)*dmasize)); - DPRINTF(LDB_ANY, ("%s: dmasize=%ld\n", __func__, (long)sc->sc_dmasize)); + sc->sc_dmasize = *dmasize; + + DPRINTF(LDB_ANY, ("%s: dmasize=%ld\n", __func__, (long)*dmasize)); /* * XXX what length? @@ -419,24 +429,31 @@ lsi64854_setup(struct lsi64854_softc *sc bus_write_4(sc->sc_res, L64854_REG_CNT, *dmasize); } - /* Program the DMA address */ - if (sc->sc_dmasize != 0) - if (bus_dmamap_load(sc->sc_buffer_dmat, sc->sc_dmamap, - *sc->sc_dmaaddr, sc->sc_dmasize, lsi64854_map_scsi, sc, 0)) - panic("%s: cannot allocate DVMA address", __func__); + /* + * Load the transfer buffer and program the DMA address. + * Note that the NCR53C9x core can't handle EINPROGRESS so we set + * BUS_DMA_NOWAIT. + */ + if (*dmasize != 0) { + error = bus_dmamap_load(sc->sc_buffer_dmat, sc->sc_dmamap, + *sc->sc_dmaaddr, *dmasize, lsi64854_map_scsi, sc, + BUS_DMA_NOWAIT); + if (error != 0) + return (error); + } if (sc->sc_rev == DMAREV_ESC) { /* DMA ESC chip bug work-around */ - bcnt = sc->sc_dmasize; + bcnt = *dmasize; if (((bcnt + (long)*sc->sc_dmaaddr) & PAGE_MASK_8K) != 0) bcnt = roundup(bcnt, PAGE_SIZE_8K); bus_write_4(sc->sc_res, L64854_REG_CNT, bcnt); } - /* Setup DMA control register */ + /* Setup the DMA control register. */ csr = L64854_GCSR(sc); - if (datain) + if (datain != 0) csr |= L64854_WRITE; else csr &= ~L64854_WRITE; @@ -452,7 +469,7 @@ lsi64854_setup(struct lsi64854_softc *sc /* * Pseudo (chained) interrupt from the esp driver to kick the - * current running DMA transfer. Called from ncr53c9x_intr() + * current running DMA transfer. Called from ncr53c9x_intr() * for now. * * return 1 if it was a DMA continue. @@ -462,19 +479,23 @@ lsi64854_scsi_intr(void *arg) { struct lsi64854_softc *sc = arg; struct ncr53c9x_softc *nsc = sc->sc_client; - int trans, resid; + bus_dma_tag_t dmat; + bus_dmamap_t dmam; + size_t dmasize; + int lxfer, resid, trans; uint32_t csr; csr = L64854_GCSR(sc); DPRINTF(LDB_SCSI, ("%s: addr 0x%x, csr %b\n", __func__, - bus_read_4(sc->sc_res, L64854_REG_ADDR), csr, DDMACSR_BITS)); + bus_read_4(sc->sc_res, L64854_REG_ADDR), csr, DDMACSR_BITS)); - if (csr & (D_ERR_PEND|D_SLAVE_ERR)) { - device_printf(sc->sc_dev, "error: csr=%b\n", csr, DDMACSR_BITS); - csr &= ~D_EN_DMA; /* Stop DMA */ + if (csr & (D_ERR_PEND | D_SLAVE_ERR)) { + device_printf(sc->sc_dev, "error: csr=%b\n", csr, + DDMACSR_BITS); + csr &= ~D_EN_DMA; /* Stop DMA. */ /* Invalidate the queue; SLAVE_ERR bit is write-to-clear */ - csr |= D_INVALIDATE|D_SLAVE_ERR; + csr |= D_INVALIDATE | D_SLAVE_ERR; L64854_SCSR(sc, csr); return (-1); } @@ -490,10 +511,11 @@ lsi64854_scsi_intr(void *arg) L64854_SCSR(sc, csr); sc->sc_active = 0; - if (sc->sc_dmasize == 0) { - /* A "Transfer Pad" operation completed */ - DPRINTF(LDB_SCSI, ("%s: discarded %d bytes (tcl=%d, tcm=%d)\n", - __func__, NCR_READ_REG(nsc, NCR_TCL) | + dmasize = sc->sc_dmasize; + if (dmasize == 0) { + /* A "Transfer Pad" operation completed. */ + DPRINTF(LDB_SCSI, ("%s: discarded %d bytes (tcl=%d, " + "tcm=%d)\n", __func__, NCR_READ_REG(nsc, NCR_TCL) | (NCR_READ_REG(nsc, NCR_TCM) << 8), NCR_READ_REG(nsc, NCR_TCL), NCR_READ_REG(nsc, NCR_TCM))); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-7@FreeBSD.ORG Mon Nov 7 13:46:16 2011 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 ABB15106566C; Mon, 7 Nov 2011 13:46:16 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9721F8FC14; Mon, 7 Nov 2011 13:46: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 pA7DkGZp081769; Mon, 7 Nov 2011 13:46:16 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA7DkGWt081760; Mon, 7 Nov 2011 13:46:16 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201111071346.pA7DkGWt081760@svn.freebsd.org> From: Marius Strobl Date: Mon, 7 Nov 2011 13:46: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: r227307 - in stable/7: . contrib/bsnmp/snmpd contrib/wpa_supplicant gnu/usr.bin/groff/tmac share/man/man4 share/misc sys/amd64/conf sys/conf sys/dev/esp sys/i386/conf sys/modules sys/mo... 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: Mon, 07 Nov 2011 13:46:16 -0000 Author: marius Date: Mon Nov 7 13:46:16 2011 New Revision: 227307 URL: http://svn.freebsd.org/changeset/base/227307 Log: MFC: r227006, r227281, r227282 Add a PCI front-end to esp(4) allowing it to support AMD Am53C974 and replace amd(4) with the former in the amd64, i386 and pc98 GENERIC kernel configuration files. Besides duplicating functionality, amd(4), which previously also supported the AMD Am53C974, unlike esp(4) is no longer maintained and has accumulated enough bit rot over time to always cause a panic during boot as long as at least one target is attached to it (see PR 124667). PR: 124667 Obtained from: NetBSD (based on) Added: stable/7/sys/dev/esp/am53c974reg.h - copied unchanged from r227006, head/sys/dev/esp/am53c974reg.h stable/7/sys/dev/esp/esp_pci.c - copied unchanged from r227006, head/sys/dev/esp/esp_pci.c Modified: stable/7/UPDATING (contents, props changed) stable/7/share/man/man4/esp.4 stable/7/sys/amd64/conf/GENERIC stable/7/sys/conf/NOTES stable/7/sys/conf/files stable/7/sys/i386/conf/GENERIC stable/7/sys/modules/Makefile stable/7/sys/modules/esp/Makefile stable/7/sys/pc98/conf/GENERIC stable/7/sys/sparc64/conf/GENERIC Directory Properties: stable/7/ (props changed) stable/7/COPYRIGHT (props changed) stable/7/Makefile (props changed) stable/7/Makefile.inc1 (props changed) stable/7/ObsoleteFiles.inc (props changed) stable/7/bin/ (props changed) stable/7/bin/chflags/ (props changed) stable/7/bin/chio/ (props changed) stable/7/bin/chmod/ (props changed) stable/7/bin/cp/ (props changed) stable/7/bin/csh/ (props changed) stable/7/bin/dd/ (props changed) stable/7/bin/df/ (props changed) stable/7/bin/echo/ (props changed) stable/7/bin/ed/ (props changed) stable/7/bin/expr/ (props changed) stable/7/bin/kill/ (props changed) stable/7/bin/ln/ (props changed) stable/7/bin/ls/ (props changed) stable/7/bin/pax/ (props changed) stable/7/bin/ps/ (props changed) stable/7/bin/rm/ (props changed) stable/7/bin/sh/ (props changed) stable/7/bin/test/ (props changed) stable/7/cddl/compat/opensolaris/ (props changed) stable/7/cddl/contrib/opensolaris/ (props changed) stable/7/cddl/lib/libzpool/ (props changed) stable/7/contrib/bind9/ (props changed) stable/7/contrib/binutils/ (props changed) stable/7/contrib/bsnmp/ (props changed) stable/7/contrib/bsnmp/snmpd/bsnmpd.1 (props changed) stable/7/contrib/cpio/ (props changed) stable/7/contrib/csup/ (props changed) stable/7/contrib/expat/ (props changed) stable/7/contrib/gcc/ (props changed) stable/7/contrib/gdb/ (props changed) stable/7/contrib/gdtoa/ (props changed) stable/7/contrib/groff/ (props changed) stable/7/contrib/ipfilter/ (props changed) stable/7/contrib/less/ (props changed) stable/7/contrib/libpcap/ (props changed) stable/7/contrib/libstdc++/ (props changed) stable/7/contrib/lukemftp/ (props changed) stable/7/contrib/ncurses/ (props changed) stable/7/contrib/netcat/ (props changed) stable/7/contrib/ntp/ (props changed) stable/7/contrib/nvi/ (props changed) stable/7/contrib/pf/ (props changed) stable/7/contrib/sendmail/ (props changed) stable/7/contrib/smbfs/ (props changed) stable/7/contrib/tcp_wrappers/ (props changed) stable/7/contrib/tcsh/ (props changed) stable/7/contrib/telnet/ (props changed) stable/7/contrib/top/ (props changed) stable/7/contrib/traceroute/ (props changed) stable/7/contrib/wpa_supplicant/ (props changed) stable/7/contrib/wpa_supplicant/wpa_supplicant.conf (props changed) stable/7/crypto/openssh/ (props changed) stable/7/crypto/openssl/ (props changed) stable/7/etc/ (props changed) stable/7/games/factor/ (props changed) stable/7/games/fortune/ (props changed) stable/7/games/grdc/ (props changed) stable/7/gnu/ (props changed) stable/7/gnu/lib/libstdc++/ (props changed) stable/7/gnu/usr.bin/ (props changed) stable/7/gnu/usr.bin/cc/ (props changed) stable/7/gnu/usr.bin/cc/include/ (props changed) stable/7/gnu/usr.bin/cpio/ (props changed) stable/7/gnu/usr.bin/cvs/ (props changed) stable/7/gnu/usr.bin/gdb/ (props changed) stable/7/gnu/usr.bin/gdb/arch/sparc64/ (props changed) stable/7/gnu/usr.bin/gdb/kgdb/ (props changed) stable/7/gnu/usr.bin/grep/ (props changed) stable/7/gnu/usr.bin/groff/ (props changed) stable/7/gnu/usr.bin/groff/tmac/mdoc.local (props changed) stable/7/gnu/usr.bin/man/ (props changed) stable/7/gnu/usr.bin/sort/ (props changed) stable/7/include/ (props changed) stable/7/kerberos5/ (props changed) stable/7/lib/ (props changed) stable/7/lib/bind/ (props changed) stable/7/lib/csu/ (props changed) stable/7/lib/libarchive/ (props changed) stable/7/lib/libbluetooth/ (props changed) stable/7/lib/libc/ (props changed) stable/7/lib/libc/stdtime/ (props changed) stable/7/lib/libc_r/ (props changed) stable/7/lib/libcam/ (props changed) stable/7/lib/libdevstat/ (props changed) stable/7/lib/libdisk/ (props changed) stable/7/lib/libdwarf/ (props changed) stable/7/lib/libelf/ (props changed) stable/7/lib/libexpat/ (props changed) stable/7/lib/libfetch/ (props changed) stable/7/lib/libftpio/ (props changed) stable/7/lib/libgeom/ (props changed) stable/7/lib/libgssapi/ (props changed) stable/7/lib/libkse/ (props changed) stable/7/lib/libkvm/ (props changed) stable/7/lib/libmagic/ (props changed) stable/7/lib/libmemstat/ (props changed) stable/7/lib/libpmc/ (props changed) stable/7/lib/libradius/ (props changed) stable/7/lib/libsm/ (props changed) stable/7/lib/libstand/ (props changed) stable/7/lib/libthr/ (props changed) stable/7/lib/libthread_db/ (props changed) stable/7/lib/libufs/ (props changed) stable/7/lib/libutil/ (props changed) stable/7/lib/msun/ (props changed) stable/7/libexec/ (props changed) stable/7/libexec/comsat/ (props changed) stable/7/libexec/ftpd/ (props changed) stable/7/libexec/rpc.rquotad/ (props changed) stable/7/libexec/rpc.rstatd/ (props changed) stable/7/libexec/rshd/ (props changed) stable/7/libexec/rtld-elf/ (props changed) stable/7/libexec/talkd/ (props changed) stable/7/libexec/tftpd/ (props changed) stable/7/release/ (props changed) stable/7/release/doc/ (props changed) stable/7/release/doc/en_US.ISO8859-1/hardware/ (props changed) stable/7/release/picobsd/tinyware/login/ (props changed) stable/7/rescue/ (props changed) stable/7/sbin/ (props changed) stable/7/sbin/atacontrol/ (props changed) stable/7/sbin/bsdlabel/ (props changed) stable/7/sbin/clri/ (props changed) stable/7/sbin/ddb/ (props changed) stable/7/sbin/devd/ (props changed) stable/7/sbin/devfs/ (props changed) stable/7/sbin/dhclient/ (props changed) stable/7/sbin/dumpfs/ (props changed) stable/7/sbin/fdisk/ (props changed) stable/7/sbin/fdisk_pc98/ (props changed) stable/7/sbin/fsck/ (props changed) stable/7/sbin/fsck_ffs/ (props changed) stable/7/sbin/fsck_msdosfs/ (props changed) stable/7/sbin/geom/ (props changed) stable/7/sbin/geom/class/journal/ (props changed) stable/7/sbin/geom/class/label/ (props changed) stable/7/sbin/geom/class/part/ (props changed) stable/7/sbin/geom/class/stripe/ (props changed) stable/7/sbin/geom/misc/ (props changed) stable/7/sbin/growfs/ (props changed) stable/7/sbin/ifconfig/ (props changed) stable/7/sbin/init/ (props changed) stable/7/sbin/ipf/ (props changed) stable/7/sbin/ipfw/ (props changed) stable/7/sbin/md5/ (props changed) stable/7/sbin/mdconfig/ (props changed) stable/7/sbin/mknod/ (props changed) stable/7/sbin/mksnap_ffs/ (props changed) stable/7/sbin/mount/ (props changed) stable/7/sbin/mount_msdosfs/ (props changed) stable/7/sbin/natd/ (props changed) stable/7/sbin/newfs/ (props changed) stable/7/sbin/newfs_msdos/ (props changed) stable/7/sbin/ping6/ (props changed) stable/7/sbin/rcorder/ (props changed) stable/7/sbin/reboot/ (props changed) stable/7/sbin/restore/ (props changed) stable/7/sbin/route/ (props changed) stable/7/sbin/savecore/ (props changed) stable/7/sbin/sconfig/ (props changed) stable/7/sbin/shutdown/ (props changed) stable/7/sbin/sysctl/ (props changed) stable/7/sbin/tunefs/ (props changed) stable/7/secure/lib/libcrypto/ (props changed) stable/7/secure/lib/libssh/ (props changed) stable/7/secure/lib/libssl/ (props changed) stable/7/secure/libexec/sftp-server/ (props changed) stable/7/secure/usr.bin/bdes/ (props changed) stable/7/secure/usr.bin/openssl/ (props changed) stable/7/secure/usr.bin/ssh/ (props changed) stable/7/secure/usr.sbin/sshd/ (props changed) stable/7/share/ (props changed) stable/7/share/colldef/ (props changed) stable/7/share/dict/ (props changed) stable/7/share/doc/bind9/ (props changed) stable/7/share/doc/papers/devfs/ (props changed) stable/7/share/doc/papers/jail/ (props changed) stable/7/share/doc/smm/01.setup/ (props changed) stable/7/share/examples/ (props changed) stable/7/share/man/ (props changed) stable/7/share/man/man1/ (props changed) stable/7/share/man/man3/ (props changed) stable/7/share/man/man4/ (props changed) stable/7/share/man/man5/ (props changed) stable/7/share/man/man7/ (props changed) stable/7/share/man/man8/ (props changed) stable/7/share/man/man9/ (props changed) stable/7/share/misc/ (props changed) stable/7/share/misc/iso639 (props changed) stable/7/share/misc/pci_vendors (props changed) stable/7/share/mk/ (props changed) stable/7/share/mklocale/ (props changed) stable/7/share/monetdef/ (props changed) stable/7/share/msgdef/ (props changed) stable/7/share/numericdef/ (props changed) stable/7/share/sendmail/ (props changed) stable/7/share/syscons/ (props changed) stable/7/share/syscons/keymaps/ (props changed) stable/7/share/termcap/ (props changed) stable/7/share/timedef/ (props changed) stable/7/share/zoneinfo/ (props changed) stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/tools/ (props changed) stable/7/tools/build/ (props changed) stable/7/tools/build/options/ (props changed) stable/7/tools/debugscripts/ (props changed) stable/7/tools/regression/acct/ (props changed) stable/7/tools/regression/atm/ (props changed) stable/7/tools/regression/bin/ (props changed) stable/7/tools/regression/bin/date/ (props changed) stable/7/tools/regression/bin/sh/ (props changed) stable/7/tools/regression/file/ (props changed) stable/7/tools/regression/file/flock/ (props changed) stable/7/tools/regression/lib/libc/ (props changed) stable/7/tools/regression/usr.bin/ (props changed) stable/7/tools/regression/usr.bin/jot/ (props changed) stable/7/tools/regression/usr.bin/tr/ (props changed) stable/7/tools/sched/ (props changed) stable/7/tools/test/ (props changed) stable/7/tools/test/malloc/ (props changed) stable/7/tools/tools/ (props changed) stable/7/tools/tools/aac/ (props changed) stable/7/tools/tools/crypto/ (props changed) stable/7/tools/tools/editing/ (props changed) stable/7/tools/tools/iwi/ (props changed) stable/7/tools/tools/nanobsd/ (props changed) stable/7/tools/tools/nanobsd/FlashDevice.sub (props changed) stable/7/tools/tools/nanobsd/nanobsd.sh (props changed) stable/7/tools/tools/netrate/ (props changed) stable/7/tools/tools/netrate/netblast/ (props changed) stable/7/tools/tools/netrate/netsend/ (props changed) stable/7/tools/tools/tinybsd/ (props changed) stable/7/tools/tools/umastat/ (props changed) stable/7/tools/tools/usb/ (props changed) stable/7/usr.bin/ (props changed) stable/7/usr.bin/basename/ (props changed) stable/7/usr.bin/bluetooth/rfcomm_sppd/ (props changed) stable/7/usr.bin/calendar/ (props changed) stable/7/usr.bin/catman/ (props changed) stable/7/usr.bin/checknr/ (props changed) stable/7/usr.bin/cksum/ (props changed) stable/7/usr.bin/comm/ (props changed) stable/7/usr.bin/cpuset/ (props changed) stable/7/usr.bin/csup/ (props changed) stable/7/usr.bin/cut/ (props changed) stable/7/usr.bin/dirname/ (props changed) stable/7/usr.bin/du/ (props changed) stable/7/usr.bin/fetch/ (props changed) stable/7/usr.bin/file/ (props changed) stable/7/usr.bin/find/ (props changed) stable/7/usr.bin/finger/ (props changed) stable/7/usr.bin/fold/ (props changed) stable/7/usr.bin/fstat/ (props changed) stable/7/usr.bin/gcore/ (props changed) stable/7/usr.bin/getopt/ (props changed) stable/7/usr.bin/gprof/ (props changed) stable/7/usr.bin/gzip/ (props changed) stable/7/usr.bin/hexdump/ (props changed) stable/7/usr.bin/id/ (props changed) stable/7/usr.bin/indent/ (props changed) stable/7/usr.bin/ipcrm/ (props changed) stable/7/usr.bin/ipcs/ (props changed) stable/7/usr.bin/jot/ (props changed) stable/7/usr.bin/kdump/ (props changed) stable/7/usr.bin/ktrace/ (props changed) stable/7/usr.bin/ldd/ (props changed) stable/7/usr.bin/less/ (props changed) stable/7/usr.bin/lex/ (props changed) stable/7/usr.bin/locate/ (props changed) stable/7/usr.bin/lockf/ (props changed) stable/7/usr.bin/logger/ (props changed) stable/7/usr.bin/m4/ (props changed) stable/7/usr.bin/mail/ (props changed) stable/7/usr.bin/make/ (props changed) stable/7/usr.bin/ncal/ (props changed) stable/7/usr.bin/netstat/ (props changed) stable/7/usr.bin/newgrp/ (props changed) stable/7/usr.bin/nsupdate/ (props changed) stable/7/usr.bin/pkill/ (props changed) stable/7/usr.bin/procstat/ (props changed) stable/7/usr.bin/quota/ (props changed) stable/7/usr.bin/rpcgen/ (props changed) stable/7/usr.bin/rpcinfo/ (props changed) stable/7/usr.bin/rs/ (props changed) stable/7/usr.bin/ruptime/ (props changed) stable/7/usr.bin/script/ (props changed) stable/7/usr.bin/sed/ (props changed) stable/7/usr.bin/shar/ (props changed) stable/7/usr.bin/sockstat/ (props changed) stable/7/usr.bin/split/ (props changed) stable/7/usr.bin/stat/ (props changed) stable/7/usr.bin/su/ (props changed) stable/7/usr.bin/systat/ (props changed) stable/7/usr.bin/tail/ (props changed) stable/7/usr.bin/tar/ (props changed) stable/7/usr.bin/tftp/ (props changed) stable/7/usr.bin/tip/ (props changed) stable/7/usr.bin/top/ (props changed) stable/7/usr.bin/truncate/ (props changed) stable/7/usr.bin/truss/ (props changed) stable/7/usr.bin/uname/ (props changed) stable/7/usr.bin/unifdef/ (props changed) stable/7/usr.bin/units/ (props changed) stable/7/usr.bin/uudecode/ (props changed) stable/7/usr.bin/vmstat/ (props changed) stable/7/usr.bin/w/ (props changed) stable/7/usr.bin/wall/ (props changed) stable/7/usr.bin/wc/ (props changed) stable/7/usr.bin/whereis/ (props changed) stable/7/usr.bin/whois/ (props changed) stable/7/usr.bin/window/ (props changed) stable/7/usr.bin/xargs/ (props changed) stable/7/usr.bin/xinstall/ (props changed) stable/7/usr.bin/xlint/ (props changed) stable/7/usr.bin/ypcat/ (props changed) stable/7/usr.bin/ypmatch/ (props changed) stable/7/usr.bin/ypwhich/ (props changed) stable/7/usr.sbin/ (props changed) stable/7/usr.sbin/Makefile (props changed) stable/7/usr.sbin/acpi/ (props changed) stable/7/usr.sbin/adduser/ (props changed) stable/7/usr.sbin/arp/ (props changed) stable/7/usr.sbin/bluetooth/ (props changed) stable/7/usr.sbin/bluetooth/btpand/ (props changed) stable/7/usr.sbin/bluetooth/hcsecd/ (props changed) stable/7/usr.sbin/bluetooth/hcseriald/ (props changed) stable/7/usr.sbin/bluetooth/rfcomm_pppd/ (props changed) stable/7/usr.sbin/bluetooth/sdpd/ (props changed) stable/7/usr.sbin/boot0cfg/ (props changed) stable/7/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_processor_tbl.c (props changed) stable/7/usr.sbin/bsnmpd/modules/snmp_pf/ (props changed) stable/7/usr.sbin/burncd/ (props changed) stable/7/usr.sbin/cdcontrol/ (props changed) stable/7/usr.sbin/chown/ (props changed) stable/7/usr.sbin/chroot/ (props changed) stable/7/usr.sbin/config/ (props changed) stable/7/usr.sbin/config/SMM.doc/ (props changed) stable/7/usr.sbin/cpucontrol/ (props changed) stable/7/usr.sbin/crashinfo/ (props changed) stable/7/usr.sbin/cron/ (props changed) stable/7/usr.sbin/cron/cron/ (props changed) stable/7/usr.sbin/crunch/ (props changed) stable/7/usr.sbin/cxgbtool/ (props changed) stable/7/usr.sbin/diskinfo/ (props changed) stable/7/usr.sbin/eeprom/ (props changed) stable/7/usr.sbin/extattr/ (props changed) stable/7/usr.sbin/faithd/ (props changed) stable/7/usr.sbin/fdcontrol/ (props changed) stable/7/usr.sbin/fdformat/ (props changed) stable/7/usr.sbin/fdread/ (props changed) stable/7/usr.sbin/fdwrite/ (props changed) stable/7/usr.sbin/fifolog/ (props changed) stable/7/usr.sbin/freebsd-update/ (props changed) stable/7/usr.sbin/fwcontrol/ (props changed) stable/7/usr.sbin/gstat/ (props changed) stable/7/usr.sbin/iostat/ (props changed) stable/7/usr.sbin/jail/ (props changed) stable/7/usr.sbin/jexec/ (props changed) stable/7/usr.sbin/jls/ (props changed) stable/7/usr.sbin/kbdmap/ (props changed) stable/7/usr.sbin/lpr/ (props changed) stable/7/usr.sbin/mailwrapper/ (props changed) stable/7/usr.sbin/makefs/ (props changed) stable/7/usr.sbin/mergemaster/ (props changed) stable/7/usr.sbin/mfiutil/ (props changed) stable/7/usr.sbin/mountd/ (props changed) stable/7/usr.sbin/moused/ (props changed) stable/7/usr.sbin/mptutil/ (props changed) stable/7/usr.sbin/mtree/ (props changed) stable/7/usr.sbin/named/ (props changed) stable/7/usr.sbin/ndiscvt/ (props changed) stable/7/usr.sbin/ndp/ (props changed) stable/7/usr.sbin/newsyslog/ (props changed) stable/7/usr.sbin/nfsd/ (props changed) stable/7/usr.sbin/nscd/ (props changed) stable/7/usr.sbin/ntp/ (props changed) stable/7/usr.sbin/pciconf/ (props changed) stable/7/usr.sbin/pkg_install/ (props changed) stable/7/usr.sbin/pmccontrol/ (props changed) stable/7/usr.sbin/pmcstat/ (props changed) stable/7/usr.sbin/portsnap/ (props changed) stable/7/usr.sbin/powerd/ (props changed) stable/7/usr.sbin/ppp/ (props changed) stable/7/usr.sbin/pstat/ (props changed) stable/7/usr.sbin/pw/ (props changed) stable/7/usr.sbin/pwd_mkdb/ (props changed) stable/7/usr.sbin/rpc.lockd/ (props changed) stable/7/usr.sbin/rpc.statd/ (props changed) stable/7/usr.sbin/rpc.yppasswdd/ (props changed) stable/7/usr.sbin/rpcbind/ (props changed) stable/7/usr.sbin/rtadvd/ (props changed) stable/7/usr.sbin/rtsold/ (props changed) stable/7/usr.sbin/sade/ (props changed) stable/7/usr.sbin/service/ (props changed) stable/7/usr.sbin/setfib/ (props changed) stable/7/usr.sbin/sysinstall/ (props changed) stable/7/usr.sbin/syslogd/ (props changed) stable/7/usr.sbin/traceroute/ (props changed) stable/7/usr.sbin/traceroute6/ (props changed) stable/7/usr.sbin/tzsetup/ (props changed) stable/7/usr.sbin/ugidfw/ (props changed) stable/7/usr.sbin/wpa/wpa_supplicant/ (props changed) stable/7/usr.sbin/ypserv/ (props changed) stable/7/usr.sbin/zic/ (props changed) Modified: stable/7/UPDATING ============================================================================== --- stable/7/UPDATING Mon Nov 7 13:45:18 2011 (r227306) +++ stable/7/UPDATING Mon Nov 7 13:46:16 2011 (r227307) @@ -8,6 +8,10 @@ Items affecting the ports and packages s /usr/ports/UPDATING. Please read that file before running portupgrade. +20111101: + The broken amd(4) driver has been replaced with esp(4) in the amd64, + i386 and pc98 GENERIC kernel configuration files. + 20110221: FreeBSD 7.4-RELEASE Modified: stable/7/share/man/man4/esp.4 ============================================================================== --- stable/7/share/man/man4/esp.4 Mon Nov 7 13:45:18 2011 (r227306) +++ stable/7/share/man/man4/esp.4 Mon Nov 7 13:46:16 2011 (r227307) @@ -1,5 +1,5 @@ .\" -.\" Copyright (c) 2004 Tom Rhodes +.\" Copyright (c) 2011 Marius Strobl .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without @@ -25,158 +25,91 @@ .\" .\" $FreeBSD$ .\" -.Dd September 18, 2005 +.Dd November 1, 2011 .Dt ESP 4 .Os .Sh NAME .Nm esp -.Nd Qlogic FEPS and FAS366 SCSI driver +.Nd Emulex ESP, NCR 53C9x and QLogic FAS families based SCSI controllers .Sh SYNOPSIS -To compile this driver into the kernel, -place the following lines in your +To compile this driver into the kernel, place the following lines in your kernel configuration file: .Bd -ragged -offset indent .Cd "device scbus" .Cd "device esp" .Ed -.Sh HARDWARE +.Pp +Alternatively, to load the driver as a module at boot time, place the +following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +if_esp_load="YES" +.Ed +.Sh DESCRIPTION The .Nm driver provides support for the -.Tn Qlogic -FAS216 and FAS408 +.Tn AMD +Am53C974, the +.Tn Emulex +ESP100, ESP100A, ESP200 and ESP406, the +.Tn NCR +53C90, 53C94 and 53C96 as well as the +.Tn QLogic +FAS100A, FAS216, FAS366 and FAS408 .Tn SCSI controller chips found in a wide variety of systems and peripheral boards. -This includes the -.Tn Qlogic -.Tn SCSI -cards found in most -.Tn Sun -.Tn Ultra 1e -and -.Tn Ultra 2 -machines. -.Pp -For -.Tn Qlogic -.Tn PCI -.Tn SCSI -host adapters, the -.Xr isp 4 -driver should be used in place of the -.Nm -driver. -.Sh IMPLEMENTATION NOTES -During the boot sequence, the +.Sh HARDWARE +Controllers supported by the .Nm -driver -searches the linked list for LUN info by LUN ID. -At this point the driver will attach on that instance, -and then attempt to attach every sub-device. -.Pp -There are at least 4 variations of the -configuration 3 register. -A second config register must be loaded to inquire the chip revision, -otherwise the -.Fn ncr53c9x_reset -function will not set the defaults correctly. -.Pp -The drive attach routine attempts to set the appropriate -bit to put the chip into Fast -.Tn SCSI -mode so that it does not -have to be figured out each time. -This will then be stored in the -.Tn NCR -registers for later use. +driver include: .Pp -The -.Nm -driver makes use of the -.Tn LSI -64854 -.Tn DMA -engine which contains three independent -channels designed to interface with -an NCR539X -.Tn SCSI -controller; -an AM7990 Ethernet controller; -and certain types of parallel port hardware. -As such this driver may eventually replace the -.Xr amd 4 -driver for network hardware. -.Sh DIAGNOSTICS -The following driver specific error messages -may be reported: -.Bl -diag -.It "esp: cannot map %d segments" -The device was unable to map segments while mapping the -.Tn SCSI -devices in -.Tn DMA -mode. -.It "unknown variant %d, devices not attached" -An unknown version of the card was found and devices will -not be attached. -.It "Unhandled function code %d" -The device returned a function code which the driver is -unable to handle, most likely during negotiation. -.It "esp:%d:%d: selection failed %d left in FIFO" -The target left the command phase prematurely. -If a command did not reach the device then it will -be reported as shown above. -.It "invalid state: %d" -The device has reached an invalid state. -.El -.Sh SEE ALSO -.Xr amd 4 , -.Xr isp 4 , -.Xr scbus 4 , -.Xr camcontrol 8 -.Pp -.Bl -item -compact +.Bl -bullet -compact +.It +MELCO IFC-DP (PC-98) +.It +Sun ESP family +.It +Sun FAS family .It -.Pa http://www.qlc.com/ +Tekram DC390 .It -.Pa http://www.sun.com/ +Tekram DC390T .El +.Sh SEE ALSO +.Xr cd 4 , +.Xr ch 4 , +.Xr da 4 , +.Xr intro 4 , +.Xr pci 4 , +.Xr sa 4 , +.Xr sbus 4 , +.Xr scsi 4 , +.Xr camcontrol 8 .Sh HISTORY The .Nm -driver was written for -.Nx -by -.An Eric S. Hvozda . +driver first appeared in +.Nx 1.3 . +The first +.Fx +version to include it was +.Fx 5.3 . +.Sh AUTHORS +.An -nosplit The .Nm -driver was then ported to -.Fx 5.3 +driver was ported to +.Fx by -.An Scott Long Aq scottl@FreeBSD.org . -.Sh AUTHORS -This manual page was written by -.An Tom Rhodes Aq trhodes@FreeBSD.org -instead of porting the original from -.Nx . +.An Scott Long +.Aq scottl@FreeBSD.org +and later on considerably improved by +.An Marius Strobl +.Aq marius@FreeBSD.org . .Sh BUGS The .Nm -driver includes the sbus front-end but lacks the -.Tn PCI -front-end. -Thus it can only support the -.Tn FEPS/FAS366 -.Tn SCSI -found in -.Tn Sun -.Tn Ultra 1e -and -.Tn Ultra 2 -machines at this time. -.Pp -This driver should eventually replace the -.Xr amd 4 -driver, but that requires porting the -.Tn PCI -front-end mentioned above. +driver should read the EEPROM settings of +.Tn Tekram +controllers. Modified: stable/7/sys/amd64/conf/GENERIC ============================================================================== --- stable/7/sys/amd64/conf/GENERIC Mon Nov 7 13:45:18 2011 (r227306) +++ stable/7/sys/amd64/conf/GENERIC Mon Nov 7 13:46:16 2011 (r227307) @@ -97,7 +97,7 @@ options AHC_REG_PRETTY_PRINT # Print re device ahd # AHA39320/29320 and onboard AIC79xx devices options AHD_REG_PRETTY_PRINT # Print register bitfields in debug # output. Adds ~215k to driver. -device amd # AMD 53C974 (Tekram DC-390(T)) +device esp # AMD Am53C974 (Tekram DC-390(T)) device hptiop # Highpoint RocketRaid 3xxx series device isp # Qlogic family #device ispfw # Firmware for QLogic HBAs- normally a module Modified: stable/7/sys/conf/NOTES ============================================================================== --- stable/7/sys/conf/NOTES Mon Nov 7 13:45:18 2011 (r227306) +++ stable/7/sys/conf/NOTES Mon Nov 7 13:46:16 2011 (r227307) @@ -1388,7 +1388,9 @@ options SC_NO_SUSPEND_VTYSWITCH # such as the Tekram DC-390(T). # bt: Most Buslogic controllers: including BT-445, BT-54x, BT-64x, BT-74x, # BT-75x, BT-946, BT-948, BT-956, BT-958, SDC3211B, SDC3211F, SDC3222F -# esp: NCR53c9x. Only for SBUS hardware right now. +# esp: Emulex ESP, NCR 53C9x and QLogic FAS families based controllers +# including the AMD Am53C974 (found on devices such as the Tekram +# DC-390(T)) and the Sun ESP and FAS families of controllers # isp: Qlogic ISP 1020, 1040 and 1040B PCI SCSI host adapters, # ISP 1240 Dual Ultra SCSI, ISP 1080 and 1280 (Dual) Ultra2, # ISP 12160 Ultra3 SCSI, Modified: stable/7/sys/conf/files ============================================================================== --- stable/7/sys/conf/files Mon Nov 7 13:45:18 2011 (r227306) +++ stable/7/sys/conf/files Mon Nov 7 13:46:16 2011 (r227307) @@ -826,6 +826,7 @@ dev/ep/if_ep_eisa.c optional ep eisa dev/ep/if_ep_isa.c optional ep isa dev/ep/if_ep_mca.c optional ep mca dev/ep/if_ep_pccard.c optional ep pccard +dev/esp/esp_pci.c optional esp pci dev/esp/ncr53c9x.c optional esp dev/ex/if_ex.c optional ex dev/ex/if_ex_isa.c optional ex isa Copied: stable/7/sys/dev/esp/am53c974reg.h (from r227006, head/sys/dev/esp/am53c974reg.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/7/sys/dev/esp/am53c974reg.h Mon Nov 7 13:46:16 2011 (r227307, copy of r227006, head/sys/dev/esp/am53c974reg.h) @@ -0,0 +1,72 @@ +/* $NetBSD: pcscpreg.h,v 1.2 2008/04/28 20:23:55 martin Exp $ */ + +/*- + * Copyright (c) 1998 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Izumi Tsutsui. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* $FreeBSD$ */ + +#ifndef _AM53C974_H_ +#define _AM53C974_H_ + +/* + * Am53c974 DMA engine registers + */ + +#define DMA_CMD 0x40 /* Command */ +#define DMACMD_RSVD 0xFFFFFF28 /* reserved */ +#define DMACMD_DIR 0x00000080 /* Transfer Direction (read:1) */ +#define DMACMD_INTE 0x00000040 /* DMA Interrupt Enable */ +#define DMACMD_MDL 0x00000010 /* Map to Memory Description List */ +#define DMACMD_DIAG 0x00000004 /* Diagnostic */ +#define DMACMD_CMD 0x00000003 /* Command Code Bit */ +#define DMACMD_IDLE 0x00000000 /* Idle */ +#define DMACMD_BLAST 0x00000001 /* Blast */ +#define DMACMD_ABORT 0x00000002 /* Abort */ +#define DMACMD_START 0x00000003 /* Start */ + +#define DMA_STC 0x44 /* Start Transfer Count */ +#define DMA_SPA 0x48 /* Start Physical Address */ +#define DMA_WBC 0x4C /* Working Byte Counter */ +#define DMA_WAC 0x50 /* Working Address Counter */ + +#define DMA_STAT 0x54 /* Status Register */ +#define DMASTAT_RSVD 0xFFFFFF80 /* reserved */ +#define DMASTAT_PABT 0x00000040 /* PCI master/target Abort */ +#define DMASTAT_BCMP 0x00000020 /* BLAST Complete */ +#define DMASTAT_SINT 0x00000010 /* SCSI Interrupt */ +#define DMASTAT_DONE 0x00000008 /* DMA Transfer Terminated */ +#define DMASTAT_ABT 0x00000004 /* DMA Transfer Aborted */ +#define DMASTAT_ERR 0x00000002 /* DMA Transfer Error */ +#define DMASTAT_PWDN 0x00000001 /* Power Down Indicator */ + +#define DMA_SMDLA 0x58 /* Starting Memory Descpritor List Address */ +#define DMA_WMAC 0x5C /* Working MDL Counter */ +#define DMA_SBAC 0x70 /* SCSI Bus and Control */ + +#endif /* _AM53C974_H_ */ Copied: stable/7/sys/dev/esp/esp_pci.c (from r227006, head/sys/dev/esp/esp_pci.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/7/sys/dev/esp/esp_pci.c Mon Nov 7 13:46:16 2011 (r227307, copy of r227006, head/sys/dev/esp/esp_pci.c) @@ -0,0 +1,654 @@ +/*- + * Copyright (c) 2011 Marius Strobl + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* $NetBSD: pcscp.c,v 1.45 2010/11/13 13:52:08 uebayasi Exp $ */ + +/*- + * Copyright (c) 1997, 1998, 1999 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, + * NASA Ames Research Center; Izumi Tsutsui. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * esp_pci.c: device dependent code for AMD Am53c974 (PCscsi-PCI) + * written by Izumi Tsutsui + * + * Technical manual available at + * http://www.amd.com/files/connectivitysolutions/networking/archivednetworking/19113.pdf + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include + +#include +#include + +#include +#include + +#include + +#define PCI_DEVICE_ID_AMD53C974 0x20201022 + +struct esp_pci_softc { + struct ncr53c9x_softc sc_ncr53c9x; /* glue to MI code */ + struct device *sc_dev; + + struct resource *sc_res[2]; +#define ESP_PCI_RES_INTR 0 +#define ESP_PCI_RES_IO 1 + + bus_dma_tag_t sc_pdmat; + + bus_dma_tag_t sc_xferdmat; /* DMA tag for transfers */ + bus_dmamap_t sc_xferdmam; /* DMA map for transfers */ + + void *sc_ih; /* interrupt handler */ + + size_t sc_dmasize; /* DMA size */ + void **sc_dmaaddr; /* DMA address */ + size_t *sc_dmalen; /* DMA length */ + int sc_active; /* DMA state */ + int sc_datain; /* DMA Data Direction */ +}; + +static struct resource_spec esp_pci_res_spec[] = { + { SYS_RES_IRQ, 0, RF_SHAREABLE | RF_ACTIVE }, /* ESP_PCI_RES_INTR */ + { SYS_RES_IOPORT, PCIR_BAR(0), RF_ACTIVE }, /* ESP_PCI_RES_IO */ + { -1, 0 } +}; + +#define READ_DMAREG(sc, reg) \ + bus_read_4((sc)->sc_res[ESP_PCI_RES_IO], (reg)) +#define WRITE_DMAREG(sc, reg, var) \ + bus_write_4((sc)->sc_res[ESP_PCI_RES_IO], (reg), (var)) + +#define READ_ESPREG(sc, reg) \ + bus_read_1((sc)->sc_res[ESP_PCI_RES_IO], (reg) << 2) +#define WRITE_ESPREG(sc, reg, val) \ + bus_write_1((sc)->sc_res[ESP_PCI_RES_IO], (reg) << 2, (val)) + +static int esp_pci_probe(device_t); +static int esp_pci_attach(device_t); +static int esp_pci_detach(device_t); +static int esp_pci_suspend(device_t); +static int esp_pci_resume(device_t); + +static device_method_t esp_pci_methods[] = { + DEVMETHOD(device_probe, esp_pci_probe), + DEVMETHOD(device_attach, esp_pci_attach), + DEVMETHOD(device_detach, esp_pci_detach), + DEVMETHOD(device_suspend, esp_pci_suspend), + DEVMETHOD(device_resume, esp_pci_resume), + + KOBJMETHOD_END +}; + +static driver_t esp_pci_driver = { + "esp", + esp_pci_methods, + sizeof(struct esp_pci_softc) +}; + +DRIVER_MODULE(esp, pci, esp_pci_driver, esp_devclass, 0, 0); +MODULE_DEPEND(esp, pci, 1, 1, 1); + +/* + * Functions and the switch for the MI code + */ +static void esp_pci_dma_go(struct ncr53c9x_softc *); +static int esp_pci_dma_intr(struct ncr53c9x_softc *); +static int esp_pci_dma_isactive(struct ncr53c9x_softc *); + +static int esp_pci_dma_isintr(struct ncr53c9x_softc *); +static void esp_pci_dma_reset(struct ncr53c9x_softc *); +static int esp_pci_dma_setup(struct ncr53c9x_softc *, void **, size_t *, + int, size_t *); +static void esp_pci_dma_stop(struct ncr53c9x_softc *); +static void esp_pci_write_reg(struct ncr53c9x_softc *, int, uint8_t); +static uint8_t esp_pci_read_reg(struct ncr53c9x_softc *, int); +static void esp_pci_xfermap(void *arg, bus_dma_segment_t *segs, int nseg, + int error); + +static struct ncr53c9x_glue esp_pci_glue = { + esp_pci_read_reg, + esp_pci_write_reg, + esp_pci_dma_isintr, + esp_pci_dma_reset, + esp_pci_dma_intr, + esp_pci_dma_setup, + esp_pci_dma_go, + esp_pci_dma_stop, + esp_pci_dma_isactive, +}; + +static int +esp_pci_probe(device_t dev) +{ + + if (pci_get_devid(dev) == PCI_DEVICE_ID_AMD53C974) { + device_set_desc(dev, "AMD Am53C974 Fast-SCSI"); + return (BUS_PROBE_DEFAULT); + } + + return (ENXIO); +} + +/* + * Attach this instance, and then all the sub-devices + */ +static int +esp_pci_attach(device_t dev) +{ + struct esp_pci_softc *esc; + struct ncr53c9x_softc *sc; + int error; + + esc = device_get_softc(dev); + sc = &esc->sc_ncr53c9x; + + NCR_LOCK_INIT(sc); + + esc->sc_dev = dev; + sc->sc_glue = &esp_pci_glue; + + pci_enable_busmaster(dev); + + error = bus_alloc_resources(dev, esp_pci_res_spec, esc->sc_res); + if (error != 0) { + device_printf(dev, "failed to allocate resources\n"); + bus_release_resources(dev, esp_pci_res_spec, esc->sc_res); + return (error); + } + + error = bus_dma_tag_create(bus_get_dma_tag(dev), 1, 0, + BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, + BUS_SPACE_MAXSIZE_32BIT, BUS_SPACE_UNRESTRICTED, + BUS_SPACE_MAXSIZE_32BIT, 0, NULL, NULL, &esc->sc_pdmat); + if (error != 0) { + device_printf(dev, "cannot create parent DMA tag\n"); + goto fail_res; + } + + /* + * XXX More of this should be in ncr53c9x_attach(), but + * XXX should we really poke around the chip that much in + * XXX the MI code? Think about this more... + */ + + /* + * Set up static configuration info. + * + * XXX we should read the configuration from the EEPROM. + */ + sc->sc_id = 7; + sc->sc_cfg1 = sc->sc_id | NCRCFG1_PARENB; + sc->sc_cfg2 = NCRCFG2_SCSI2 | NCRCFG2_FE; + sc->sc_cfg3 = NCRAMDCFG3_IDM | NCRAMDCFG3_FCLK; + sc->sc_cfg4 = NCRAMDCFG4_GE12NS | NCRAMDCFG4_RADE; + sc->sc_rev = NCR_VARIANT_AM53C974; + sc->sc_features = NCR_F_FASTSCSI | NCR_F_DMASELECT; + sc->sc_cfg3_fscsi = NCRAMDCFG3_FSCSI; + sc->sc_freq = 40; /* MHz */ + + /* + * This is the value used to start sync negotiations + * Note that the NCR register "SYNCTP" is programmed + * in "clocks per byte", and has a minimum value of 4. + * The SCSI period used in negotiation is one-fourth + * of the time (in nanoseconds) needed to transfer one byte. + * Since the chip's clock is given in MHz, we have the following + * formula: 4 * period = (1000 / freq) * 4 + */ + sc->sc_minsync = 1000 / sc->sc_freq; + + sc->sc_maxxfer = DFLTPHYS; /* see below */ + sc->sc_maxoffset = 15; + sc->sc_extended_geom = 1; + +#define MDL_SEG_SIZE 0x1000 /* 4kbyte per segment */ + + /* + * Create the DMA tag and map for the data transfers. + * + * Note: given that bus_dma(9) only adheres to the requested alignment + * for the first segment (and that also only for bus_dmamem_alloc()ed + * DMA maps) we can't use the Memory Descriptor List. However, also + * when not using the MDL, the maximum transfer size apparently is + * limited to 4k so we have to split transfers up, which plain sucks. + */ + error = bus_dma_tag_create(esc->sc_pdmat, PAGE_SIZE, 0, + BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, + MDL_SEG_SIZE, 1, MDL_SEG_SIZE, BUS_DMA_ALLOCNOW, + busdma_lock_mutex, &sc->sc_lock, &esc->sc_xferdmat); + if (error != 0) { + device_printf(dev, "cannot create transfer DMA tag\n"); + goto fail_pdmat; + } + error = bus_dmamap_create(esc->sc_xferdmat, 0, &esc->sc_xferdmam); + if (error != 0) { + device_printf(dev, "cannnot create transfer DMA map\n"); + goto fail_xferdmat; + } + + error = bus_setup_intr(dev, esc->sc_res[ESP_PCI_RES_INTR], + INTR_MPSAFE | INTR_TYPE_CAM, NULL, ncr53c9x_intr, sc, + &esc->sc_ih); + if (error != 0) { + device_printf(dev, "cannot set up interrupt\n"); + goto fail_xferdmam; + } + + /* Do the common parts of attachment. */ + sc->sc_dev = esc->sc_dev; + error = ncr53c9x_attach(sc); + if (error != 0) { + device_printf(esc->sc_dev, "ncr53c9x_attach failed\n"); + goto fail_intr; + } + + return (0); + + fail_intr: + bus_teardown_intr(esc->sc_dev, esc->sc_res[ESP_PCI_RES_INTR], + esc->sc_ih); + fail_xferdmam: + bus_dmamap_destroy(esc->sc_xferdmat, esc->sc_xferdmam); + fail_xferdmat: + bus_dma_tag_destroy(esc->sc_xferdmat); + fail_pdmat: + bus_dma_tag_destroy(esc->sc_pdmat); + fail_res: + bus_release_resources(dev, esp_pci_res_spec, esc->sc_res); + NCR_LOCK_DESTROY(sc); + + return (error); +} + +static int +esp_pci_detach(device_t dev) +{ + struct ncr53c9x_softc *sc; + struct esp_pci_softc *esc; + int error; + + esc = device_get_softc(dev); + sc = &esc->sc_ncr53c9x; + + bus_teardown_intr(esc->sc_dev, esc->sc_res[ESP_PCI_RES_INTR], + esc->sc_ih); + error = ncr53c9x_detach(sc); + if (error != 0) + return (error); + bus_dmamap_destroy(esc->sc_xferdmat, esc->sc_xferdmam); + bus_dma_tag_destroy(esc->sc_xferdmat); + bus_dma_tag_destroy(esc->sc_pdmat); + bus_release_resources(dev, esp_pci_res_spec, esc->sc_res); + NCR_LOCK_DESTROY(sc); + + return (0); +} + +static int +esp_pci_suspend(device_t dev) +{ + + return (ENXIO); +} + +static int +esp_pci_resume(device_t dev) +{ + + return (ENXIO); +} + +static void +esp_pci_xfermap(void *arg, bus_dma_segment_t *segs, int nsegs, int error) +{ + struct esp_pci_softc *esc = (struct esp_pci_softc *)arg; + + if (error != 0) + return; + + KASSERT(nsegs == 1, ("%s: bad transfer segment count %d", __func__, + nsegs)); + KASSERT(segs[0].ds_len <= MDL_SEG_SIZE, + ("%s: bad transfer segment length %ld", __func__, + (long)segs[0].ds_len)); + + /* Program the DMA Starting Physical Address. */ + WRITE_DMAREG(esc, DMA_SPA, segs[0].ds_addr); +} + +/* + * Glue functions + */ + +static uint8_t +esp_pci_read_reg(struct ncr53c9x_softc *sc, int reg) +{ + struct esp_pci_softc *esc = (struct esp_pci_softc *)sc; + + return (READ_ESPREG(esc, reg)); +} + +static void +esp_pci_write_reg(struct ncr53c9x_softc *sc, int reg, uint8_t v) +{ + struct esp_pci_softc *esc = (struct esp_pci_softc *)sc; + + WRITE_ESPREG(esc, reg, v); +} + +static int +esp_pci_dma_isintr(struct ncr53c9x_softc *sc) +{ + struct esp_pci_softc *esc = (struct esp_pci_softc *)sc; + + return (READ_ESPREG(esc, NCR_STAT) & NCRSTAT_INT) != 0; +} + +static void +esp_pci_dma_reset(struct ncr53c9x_softc *sc) +{ + struct esp_pci_softc *esc = (struct esp_pci_softc *)sc; + + WRITE_DMAREG(esc, DMA_CMD, DMACMD_IDLE); + + esc->sc_active = 0; +} + +static int +esp_pci_dma_intr(struct ncr53c9x_softc *sc) +{ + struct esp_pci_softc *esc = (struct esp_pci_softc *)sc; + bus_dma_tag_t xferdmat; + bus_dmamap_t xferdmam; + size_t dmasize; + int datain, i, resid, trans; + uint32_t dmastat; + char *p = NULL; + + xferdmat = esc->sc_xferdmat; + xferdmam = esc->sc_xferdmam; + datain = esc->sc_datain; + + dmastat = READ_DMAREG(esc, DMA_STAT); + + if ((dmastat & DMASTAT_ERR) != 0) { + /* XXX not tested... */ + WRITE_DMAREG(esc, DMA_CMD, DMACMD_ABORT | (datain != 0 ? + DMACMD_DIR : 0)); + + device_printf(esc->sc_dev, "DMA error detected; Aborting.\n"); + bus_dmamap_sync(xferdmat, xferdmam, datain != 0 ? + BUS_DMASYNC_POSTREAD : BUS_DMASYNC_POSTWRITE); + bus_dmamap_unload(xferdmat, xferdmam); + return (-1); + } + + if ((dmastat & DMASTAT_ABT) != 0) { + /* XXX what should be done? */ + device_printf(esc->sc_dev, "DMA aborted.\n"); + WRITE_DMAREG(esc, DMA_CMD, DMACMD_IDLE | (datain != 0 ? + DMACMD_DIR : 0)); + esc->sc_active = 0; + return (0); + } + + KASSERT(esc->sc_active != 0, ("%s: DMA wasn't active", __func__)); + + /* DMA has stopped. */ + + esc->sc_active = 0; + + dmasize = esc->sc_dmasize; + if (dmasize == 0) { + /* A "Transfer Pad" operation completed. */ + NCR_DMA(("%s: discarded %d bytes (tcl=%d, tcm=%d)\n", + __func__, READ_ESPREG(esc, NCR_TCL) | + (READ_ESPREG(esc, NCR_TCM) << 8), + READ_ESPREG(esc, NCR_TCL), READ_ESPREG(esc, NCR_TCM))); + return (0); + } + + resid = 0; + /* + * If a transfer onto the SCSI bus gets interrupted by the device + * (e.g. for a SAVEPOINTER message), the data in the FIFO counts + * as residual since the ESP counter registers get decremented as + * bytes are clocked into the FIFO. + */ + if (datain == 0 && + (resid = (READ_ESPREG(esc, NCR_FFLAG) & NCRFIFO_FF)) != 0) + NCR_DMA(("%s: empty esp FIFO of %d ", __func__, resid)); + + if ((sc->sc_espstat & NCRSTAT_TC) == 0) { + /* + * "Terminal count" is off, so read the residue + * out of the ESP counter registers. + */ + if (datain != 0) { + resid = READ_ESPREG(esc, NCR_FFLAG) & NCRFIFO_FF; + while (resid > 1) + resid = + READ_ESPREG(esc, NCR_FFLAG) & NCRFIFO_FF; + WRITE_DMAREG(esc, DMA_CMD, DMACMD_BLAST | DMACMD_DIR); + + for (i = 0; i < 0x8000; i++) /* XXX 0x8000 ? */ + if ((READ_DMAREG(esc, DMA_STAT) & + DMASTAT_BCMP) != 0) + break; + + /* See the below comments... */ + if (resid != 0) + p = *esc->sc_dmaaddr; + } + + resid += READ_ESPREG(esc, NCR_TCL) | + (READ_ESPREG(esc, NCR_TCM) << 8) | + (READ_ESPREG(esc, NCR_TCH) << 16); + } else + while ((dmastat & DMASTAT_DONE) == 0) + dmastat = READ_DMAREG(esc, DMA_STAT); + + WRITE_DMAREG(esc, DMA_CMD, DMACMD_IDLE | (datain != 0 ? + DMACMD_DIR : 0)); + + /* Sync the transfer buffer. */ + bus_dmamap_sync(xferdmat, xferdmam, datain != 0 ? + BUS_DMASYNC_POSTREAD : BUS_DMASYNC_POSTWRITE); + bus_dmamap_unload(xferdmat, xferdmam); + + trans = dmasize - resid; + + /* + * From the technical manual notes: + * + * "In some odd byte conditions, one residual byte will be left + * in the SCSI FIFO, and the FIFO flags will never count to 0. + * When this happens, the residual byte should be retrieved + * via PIO following completion of the BLAST operation." + */ + if (p != NULL) { + p += trans; + *p = READ_ESPREG(esc, NCR_FIFO); + trans++; + } + + if (trans < 0) { /* transferred < 0 ? */ +#if 0 + /* + * This situation can happen in perfectly normal operation + * if the ESP is reselected while using DMA to select + * another target. As such, don't print the warning. + */ + device_printf(dev, "xfer (%d) > req (%d)\n", trans, dmasize); +#endif + trans = dmasize; + } + + NCR_DMA(("%s: tcl=%d, tcm=%d, tch=%d; trans=%d, resid=%d\n", __func__, + READ_ESPREG(esc, NCR_TCL), READ_ESPREG(esc, NCR_TCM), + READ_ESPREG(esc, NCR_TCH), trans, resid)); + + *esc->sc_dmalen -= trans; + *esc->sc_dmaaddr = (char *)*esc->sc_dmaaddr + trans; + + return (0); +} + +static int +esp_pci_dma_setup(struct ncr53c9x_softc *sc, void **addr, size_t *len, + int datain, size_t *dmasize) +{ + struct esp_pci_softc *esc = (struct esp_pci_softc *)sc; + int error; + + WRITE_DMAREG(esc, DMA_CMD, DMACMD_IDLE | (datain != 0 ? DMACMD_DIR : + 0)); + + *dmasize = esc->sc_dmasize = ulmin(*dmasize, MDL_SEG_SIZE); + esc->sc_dmaaddr = addr; + esc->sc_dmalen = len; + esc->sc_datain = datain; + + /* + * There's no need to set up DMA for a "Transfer Pad" operation. + */ + if (*dmasize == 0) + return (0); + + /* Set the transfer length. */ + WRITE_DMAREG(esc, DMA_STC, *dmasize); + + /* + * Load the transfer buffer and program the DMA address. + * Note that the NCR53C9x core can't handle EINPROGRESS so we set + * BUS_DMA_NOWAIT. + */ + error = bus_dmamap_load(esc->sc_xferdmat, esc->sc_xferdmam, + *esc->sc_dmaaddr, *dmasize, esp_pci_xfermap, sc, BUS_DMA_NOWAIT); + + return (error); +} + +static void +esp_pci_dma_go(struct ncr53c9x_softc *sc) +{ + struct esp_pci_softc *esc = (struct esp_pci_softc *)sc; + int datain; + + datain = esc->sc_datain; + + /* No DMA transfer for a "Transfer Pad" operation */ + if (esc->sc_dmasize == 0) + return; + + /* Sync the transfer buffer. */ + bus_dmamap_sync(esc->sc_xferdmat, esc->sc_xferdmam, datain != 0 ? + BUS_DMASYNC_PREREAD : BUS_DMASYNC_PREWRITE); + + /* Set the DMA engine to the IDLE state. */ + /* XXX DMA Transfer Interrupt Enable bit is broken? */ + WRITE_DMAREG(esc, DMA_CMD, DMACMD_IDLE | /* DMACMD_INTE | */ + (datain != 0 ? DMACMD_DIR : 0)); + + /* Issue a DMA start command. */ + WRITE_DMAREG(esc, DMA_CMD, DMACMD_START | /* DMACMD_INTE | */ + (datain != 0 ? DMACMD_DIR : 0)); + + esc->sc_active = 1; +} + +static void +esp_pci_dma_stop(struct ncr53c9x_softc *sc) +{ + struct esp_pci_softc *esc = (struct esp_pci_softc *)sc; + + /* DMA stop */ + /* XXX what should we do here ? */ + WRITE_DMAREG(esc, DMA_CMD, + DMACMD_ABORT | (esc->sc_datain != 0 ? DMACMD_DIR : 0)); + bus_dmamap_unload(esc->sc_xferdmat, esc->sc_xferdmam); + + esc->sc_active = 0; +} + +static int +esp_pci_dma_isactive(struct ncr53c9x_softc *sc) +{ + struct esp_pci_softc *esc = (struct esp_pci_softc *)sc; + *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-7@FreeBSD.ORG Mon Nov 7 15:42:25 2011 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 884771065673; Mon, 7 Nov 2011 15:42:25 +0000 (UTC) (envelope-from seanbru@yahoo-inc.com) Received: from mrout2.yahoo.com (mrout2.yahoo.com [216.145.54.172]) by mx1.freebsd.org (Postfix) with ESMTP id 6880E8FC12; Mon, 7 Nov 2011 15:42:25 +0000 (UTC) Received: from [127.0.0.1] (proxy6.corp.yahoo.com [216.145.48.19]) by mrout2.yahoo.com (8.14.4/8.14.4/y.out) with ESMTP id pA7FV8Mj080999; Mon, 7 Nov 2011 07:31:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yahoo-inc.com; s=cobra; t=1320679868; bh=RP6Hk3G5ZfyzEsvWphskPtqlv1xU9v/2ktc24K0FAbI=; h=Subject:From:To:Cc:In-Reply-To:References:Content-Type:Date: Message-ID:Mime-Version:Content-Transfer-Encoding; b=uST6PIc2M/ZdGVQQSdCh8/pQdUMx9MnOFqRyLgEwLPMkHGmAnhAA2MGxQJexLw7mr vNqlxhtByLADx1STXERolxY/P8BvTVV5f8uvUdtEdxA2AQdDRtPpG+NrEvsIh3lSlm LK/5qWbhaloDiQo1H2EkFlk80KR2oBI6k4wMUuiM= From: Sean Bruno To: Kostik Belousov In-Reply-To: <20111020195602.GD50300@deviant.kiev.zoral.com.ua> References: <201110201923.p9KJNLjx088180@svn.freebsd.org> <20111020195602.GD50300@deviant.kiev.zoral.com.ua> Content-Type: text/plain; charset="UTF-8" Date: Mon, 07 Nov 2011 07:31:08 -0800 Message-ID: <1320679868.16024.6.camel@hitfishpass-lx.corp.yahoo.com> Mime-Version: 1.0 X-Mailer: Evolution 2.32.3 (2.32.3-1.fc14) Content-Transfer-Encoding: 7bit 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: r226580 - stable/7/libexec/tftpd 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: Mon, 07 Nov 2011 15:42:25 -0000 On Thu, 2011-10-20 at 12:56 -0700, Kostik Belousov wrote: > > Approved by: re (kib) > It was not. It looks like people just think that 'Approved by: kib' > is some voodo that must be appended for no reason. Today it is second > time happened for the commit that I did not approved. > > It does not matter much for the branch opened for the general commits. > Still, I would prefer that people do not falsely accuse me of > wrongdoing :). Noted. sorry for the "accusation". :-) Sean From owner-svn-src-stable-7@FreeBSD.ORG Mon Nov 7 22:34:07 2011 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 BE411106564A; Mon, 7 Nov 2011 22:34:07 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id ADC538FC0C; Mon, 7 Nov 2011 22:34:07 +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 pA7MY7N7099424; Mon, 7 Nov 2011 22:34:07 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA7MY73n099422; Mon, 7 Nov 2011 22:34:07 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201111072234.pA7MY73n099422@svn.freebsd.org> From: Marius Strobl Date: Mon, 7 Nov 2011 22:34:07 +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: r227321 - stable/7/sys/dev/esp 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: Mon, 07 Nov 2011 22:34:07 -0000 Author: marius Date: Mon Nov 7 22:34:07 2011 New Revision: 227321 URL: http://svn.freebsd.org/changeset/base/227321 Log: Partially disable r227304 as stable/7 doesn't support reporting the maximum supported transfer size, yet. Reported by: Scott Allendorf This is a direct commit to stable/7. Modified: stable/7/sys/dev/esp/ncr53c9x.c Modified: stable/7/sys/dev/esp/ncr53c9x.c ============================================================================== --- stable/7/sys/dev/esp/ncr53c9x.c Mon Nov 7 22:30:19 2011 (r227320) +++ stable/7/sys/dev/esp/ncr53c9x.c Mon Nov 7 22:34:07 2011 (r227321) @@ -1025,7 +1025,9 @@ ncr53c9x_action(struct cam_sim *sim, uni cpi->protocol_version = SCSI_REV_2; cpi->transport = XPORT_SPI; cpi->transport_version = 2; +#if 0 cpi->maxio = sc->sc_maxxfer; +#endif ccb->ccb_h.status = CAM_REQ_CMP; break;