From owner-svn-src-stable@FreeBSD.ORG Sun Nov 6 02:10:41 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 24808106566B; Sun, 6 Nov 2011 02:10:41 +0000 (UTC) (envelope-from obrien@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1399D8FC12; Sun, 6 Nov 2011 02:10:41 +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 pA62AeTt094308; Sun, 6 Nov 2011 02:10:40 GMT (envelope-from obrien@svn.freebsd.org) Received: (from obrien@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA62Ae9D094304; Sun, 6 Nov 2011 02:10:40 GMT (envelope-from obrien@svn.freebsd.org) Message-Id: <201111060210.pA62Ae9D094304@svn.freebsd.org> From: "David E. O'Brien" Date: Sun, 6 Nov 2011 02:10:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227128 - in stable/9: contrib/gcc gnu/usr.bin/cc X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Nov 2011 02:10:41 -0000 Author: obrien Date: Sun Nov 6 02:10:40 2011 New Revision: 227128 URL: http://svn.freebsd.org/changeset/base/227128 Log: MFC: r226702 * Don't give the impression that this compiler is GPLv3. (It is "well known" that GCC 4.2.2 is GPLv3.) * Don't give the impression that this compiler isn't "trustable". * Fix dependency nit. Approved by: re (kib) Modified: stable/9/contrib/gcc/BASE-VER stable/9/contrib/gcc/DEV-PHASE stable/9/gnu/usr.bin/cc/Makefile.ver Directory Properties: stable/9/ (props changed) stable/9/contrib/gcc/ (props changed) Modified: stable/9/contrib/gcc/BASE-VER ============================================================================== --- stable/9/contrib/gcc/BASE-VER Sun Nov 6 02:03:27 2011 (r227127) +++ stable/9/contrib/gcc/BASE-VER Sun Nov 6 02:10:40 2011 (r227128) @@ -1 +1 @@ -4.2.2 +4.2.1 Modified: stable/9/contrib/gcc/DEV-PHASE ============================================================================== --- stable/9/contrib/gcc/DEV-PHASE Sun Nov 6 02:03:27 2011 (r227127) +++ stable/9/contrib/gcc/DEV-PHASE Sun Nov 6 02:10:40 2011 (r227128) @@ -1 +1 @@ -prerelease +patched Modified: stable/9/gnu/usr.bin/cc/Makefile.ver ============================================================================== --- stable/9/gnu/usr.bin/cc/Makefile.ver Sun Nov 6 02:03:27 2011 (r227127) +++ stable/9/gnu/usr.bin/cc/Makefile.ver Sun Nov 6 02:10:40 2011 (r227128) @@ -4,7 +4,7 @@ BASEVER!= cat ${GCCDIR}/BASE-VER DATESTAMP!= cat ${GCCDIR}/DATESTAMP DEVPHASE!= cat ${GCCDIR}/DEV-PHASE -version.o: version.c +version.o: version.c ${GCCDIR}/BASE-VER ${GCCDIR}/DATESTAMP ${GCCDIR}/DEV-PHASE ${CC} ${CFLAGS} -DBASEVER=\"${BASEVER}\" \ -DDATESTAMP=\"\ ${DATESTAMP}\" \ -DDEVPHASE=\"\ ${DEVPHASE}\" -c ${.IMPSRC} From owner-svn-src-stable@FreeBSD.ORG Sun Nov 6 07:02:15 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BAD221065672; Sun, 6 Nov 2011 07:02:15 +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 A88B88FC0A; Sun, 6 Nov 2011 07:02:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pA672FFP004238; Sun, 6 Nov 2011 07:02:15 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA672DSY004235; Sun, 6 Nov 2011 07:02:14 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201111060702.pA672DSY004235@svn.freebsd.org> From: Doug Barton Date: Sun, 6 Nov 2011 07:02:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227133 - stable/9/games/fortune/datfiles X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Nov 2011 07:02:15 -0000 Author: dougb Date: Sun Nov 6 07:02:13 2011 New Revision: 227133 URL: http://svn.freebsd.org/changeset/base/227133 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 Approved by: re (kensmith) Modified: stable/9/games/fortune/datfiles/fortunes Directory Properties: stable/9/games/fortune/ (props changed) Modified: stable/9/games/fortune/datfiles/fortunes ============================================================================== --- stable/9/games/fortune/datfiles/fortunes Sun Nov 6 05:24:54 2011 (r227132) +++ stable/9/games/fortune/datfiles/fortunes Sun Nov 6 07:02:13 2011 (r227133) @@ -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@FreeBSD.ORG Sun Nov 6 07:07:04 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 37DB7106566B; Sun, 6 Nov 2011 07:07:04 +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 1D3788FC13; Sun, 6 Nov 2011 07:07:04 +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 pA6774e7004464; Sun, 6 Nov 2011 07:07:04 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA6772al004461; Sun, 6 Nov 2011 07:07:02 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201111060707.pA6772al004461@svn.freebsd.org> From: Doug Barton Date: Sun, 6 Nov 2011 07:07:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227134 - stable/8/games/fortune/datfiles X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Nov 2011 07:07:04 -0000 Author: dougb Date: Sun Nov 6 07:07:02 2011 New Revision: 227134 URL: http://svn.freebsd.org/changeset/base/227134 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/8/games/fortune/datfiles/fortunes Directory Properties: stable/8/games/fortune/ (props changed) Modified: stable/8/games/fortune/datfiles/fortunes ============================================================================== --- stable/8/games/fortune/datfiles/fortunes Sun Nov 6 07:02:13 2011 (r227133) +++ stable/8/games/fortune/datfiles/fortunes Sun Nov 6 07:07:02 2011 (r227134) @@ -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@FreeBSD.ORG Sun Nov 6 07:11:29 2011 Return-Path: Delivered-To: svn-src-stable@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@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the 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@FreeBSD.ORG Sun Nov 6 07:18:19 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C48FB106564A; Sun, 6 Nov 2011 07:18:19 +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 993FF8FC16; Sun, 6 Nov 2011 07:18:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pA67IJSP004954; Sun, 6 Nov 2011 07:18:19 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA67IJZb004952; Sun, 6 Nov 2011 07:18:19 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201111060718.pA67IJZb004952@svn.freebsd.org> From: Doug Barton Date: Sun, 6 Nov 2011 07:18:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227136 - stable/9/usr.bin/calendar/calendars X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Nov 2011 07:18:19 -0000 Author: dougb Date: Sun Nov 6 07:18:19 2011 New Revision: 227136 URL: http://svn.freebsd.org/changeset/base/227136 Log: MFC r226909: Add a reminder about quarterly status report due dates Approved by: re (kensmith) Modified: stable/9/usr.bin/calendar/calendars/calendar.freebsd Directory Properties: stable/9/usr.bin/calendar/ (props changed) Modified: stable/9/usr.bin/calendar/calendars/calendar.freebsd ============================================================================== --- stable/9/usr.bin/calendar/calendars/calendar.freebsd Sun Nov 6 07:11:27 2011 (r227135) +++ stable/9/usr.bin/calendar/calendars/calendar.freebsd Sun Nov 6 07:18:19 2011 (r227136) @@ -107,6 +107,7 @@ 03/28 Sean C. Farley born in Indianapolis, Indiana, United States, 1970 03/29 Thierry Thomas born in Luxeuil les Bains, France, 1961 03/30 Po-Chuan Hsieh born in Taipei, Taiwan, Republic of China, 1978 +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 @@ -196,6 +197,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 @@ -278,6 +280,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/02 Beat Gaetzi born in Zurich, Switzerland, 1980 10/05 Hiroki Sato born in Yamagata, Japan, 1977 10/05 Chris Costello born in Houston, Texas, United States, 1985 @@ -337,5 +340,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@FreeBSD.ORG Sun Nov 6 07:20:09 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DA4EE106566C; Sun, 6 Nov 2011 07:20:09 +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 AECAB8FC0C; Sun, 6 Nov 2011 07:20: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 pA67K9Rx005075; Sun, 6 Nov 2011 07:20:09 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA67K9aZ005073; Sun, 6 Nov 2011 07:20:09 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201111060720.pA67K9aZ005073@svn.freebsd.org> From: Doug Barton Date: Sun, 6 Nov 2011 07:20:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227137 - stable/8/usr.bin/calendar/calendars X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Nov 2011 07:20:10 -0000 Author: dougb Date: Sun Nov 6 07:20:09 2011 New Revision: 227137 URL: http://svn.freebsd.org/changeset/base/227137 Log: MFC r226909: Add a reminder about quarterly status report due dates Modified: stable/8/usr.bin/calendar/calendars/calendar.freebsd Directory Properties: stable/8/usr.bin/calendar/ (props changed) Modified: stable/8/usr.bin/calendar/calendars/calendar.freebsd ============================================================================== --- stable/8/usr.bin/calendar/calendars/calendar.freebsd Sun Nov 6 07:18:19 2011 (r227136) +++ stable/8/usr.bin/calendar/calendars/calendar.freebsd Sun Nov 6 07:20:09 2011 (r227137) @@ -108,6 +108,7 @@ 03/28 Sean C. Farley born in Indianapolis, Indiana, United States, 1970 03/29 Thierry Thomas born in Luxeuil les Bains, France, 1961 03/30 Po-Chuan Hsieh born in Taipei, Taiwan, Republic of China, 1978 +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 @@ -196,6 +197,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 @@ -276,6 +278,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/02 Beat Gaetzi born in Zurich, Switzerland, 1980 10/05 Hiroki Sato born in Yamagata, Japan, 1977 10/05 Chris Costello born in Houston, Texas, United States, 1985 @@ -333,5 +336,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@FreeBSD.ORG Sun Nov 6 07:26:32 2011 Return-Path: Delivered-To: svn-src-stable@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@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the 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@FreeBSD.ORG Sun Nov 6 07:29:52 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 10009106564A; Sun, 6 Nov 2011 07:29:52 +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 D93BC8FC15; Sun, 6 Nov 2011 07:29:51 +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 pA67TpPw005572; Sun, 6 Nov 2011 07:29:51 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA67TpWI005570; Sun, 6 Nov 2011 07:29:51 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201111060729.pA67TpWI005570@svn.freebsd.org> From: Doug Barton Date: Sun, 6 Nov 2011 07:29:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227139 - stable/9/usr.bin/calendar/calendars X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Nov 2011 07:29:52 -0000 Author: dougb Date: Sun Nov 6 07:29:51 2011 New Revision: 227139 URL: http://svn.freebsd.org/changeset/base/227139 Log: Approved by: re (kensmith) Modified: stable/9/usr.bin/calendar/calendars/calendar.birthday Directory Properties: stable/9/usr.bin/calendar/ (props changed) Modified: stable/9/usr.bin/calendar/calendars/calendar.birthday ============================================================================== --- stable/9/usr.bin/calendar/calendars/calendar.birthday Sun Nov 6 07:26:31 2011 (r227138) +++ stable/9/usr.bin/calendar/calendars/calendar.birthday Sun Nov 6 07:29:51 2011 (r227139) @@ -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, creater 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 @@ -239,6 +241,8 @@ 10/02 Mohandas K. Gandhi born at Porbandar, Kathiawad, India, 1869 10/04 John V. Atanasoff born, 1903 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@FreeBSD.ORG Sun Nov 6 07:32:27 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 70C75106564A; Sun, 6 Nov 2011 07:32:27 +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 458908FC0A; Sun, 6 Nov 2011 07:32:27 +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 pA67WReO005743; Sun, 6 Nov 2011 07:32:27 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA67WRdi005741; Sun, 6 Nov 2011 07:32:27 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201111060732.pA67WRdi005741@svn.freebsd.org> From: Doug Barton Date: Sun, 6 Nov 2011 07:32:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227140 - stable/8/usr.bin/calendar/calendars X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Nov 2011 07:32:27 -0000 Author: dougb Date: Sun Nov 6 07:32:26 2011 New Revision: 227140 URL: http://svn.freebsd.org/changeset/base/227140 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/8/usr.bin/calendar/calendars/calendar.birthday Directory Properties: stable/8/usr.bin/calendar/ (props changed) Modified: stable/8/usr.bin/calendar/calendars/calendar.birthday ============================================================================== --- stable/8/usr.bin/calendar/calendars/calendar.birthday Sun Nov 6 07:29:51 2011 (r227139) +++ stable/8/usr.bin/calendar/calendars/calendar.birthday Sun Nov 6 07:32:26 2011 (r227140) @@ -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 @@ -239,6 +241,8 @@ 10/02 Mohandas K. Gandhi born at Porbandar, Kathiawad, India, 1869 10/04 John V. Atanasoff born, 1903 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@FreeBSD.ORG Sun Nov 6 07:33:18 2011 Return-Path: Delivered-To: svn-src-stable@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@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the 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@FreeBSD.ORG Sun Nov 6 07:35:09 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1E8A31065677; Sun, 6 Nov 2011 07:35:09 +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 0D2E68FC0C; Sun, 6 Nov 2011 07:35: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 pA67Z8bq005949; Sun, 6 Nov 2011 07:35:08 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA67Z86r005947; Sun, 6 Nov 2011 07:35:08 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201111060735.pA67Z86r005947@svn.freebsd.org> From: Doug Barton Date: Sun, 6 Nov 2011 07:35:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227142 - stable/9/usr.sbin/tzsetup X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Nov 2011 07:35:09 -0000 Author: dougb Date: Sun Nov 6 07:35:08 2011 New Revision: 227142 URL: http://svn.freebsd.org/changeset/base/227142 Log: MFC r227011: If the user is moving from any other time zone to UTC we need to delete any old /var/db/zoneinfo file that may exist so that tzsetup -r does the right thing. Approved by: re (kensmith) Modified: stable/9/usr.sbin/tzsetup/tzsetup.c Directory Properties: stable/9/usr.sbin/tzsetup/ (props changed) Modified: stable/9/usr.sbin/tzsetup/tzsetup.c ============================================================================== --- stable/9/usr.sbin/tzsetup/tzsetup.c Sun Nov 6 07:33:17 2011 (r227141) +++ stable/9/usr.sbin/tzsetup/tzsetup.c Sun Nov 6 07:35:08 2011 (r227142) @@ -565,6 +565,18 @@ install_zoneinfo_file(const char *zonein return (DITEM_FAILURE | DITEM_RECREATE); } + if (unlink(path_db) < 0 && errno != ENOENT) { + snprintf(title, sizeof(title), "Error"); + snprintf(prompt, sizeof(prompt), + "Could not delete %s: %s", path_db, + strerror(errno)); + if (usedialog) + dialog_mesgbox(title, prompt, 8, 72); + else + fprintf(stderr, "%s\n", prompt); + + return (DITEM_FAILURE | DITEM_RECREATE); + } return (DITEM_LEAVE_MENU); } From owner-svn-src-stable@FreeBSD.ORG Sun Nov 6 07:43:00 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D79D61065672; Sun, 6 Nov 2011 07:43:00 +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 BC3708FC12; Sun, 6 Nov 2011 07:43:00 +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 pA67h0Ro006313; Sun, 6 Nov 2011 07:43:00 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA67h0TG006310; Sun, 6 Nov 2011 07:43:00 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201111060743.pA67h0TG006310@svn.freebsd.org> From: Doug Barton Date: Sun, 6 Nov 2011 07:43:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227143 - stable/8/usr.sbin/tzsetup X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Nov 2011 07:43:01 -0000 Author: dougb Date: Sun Nov 6 07:43:00 2011 New Revision: 227143 URL: http://svn.freebsd.org/changeset/base/227143 Log: MFC r222139: - add missing options and arguments to program's usage() and sync it with manpage's SYNOPSIS - generally clean up a manpage's formatting Modified: stable/8/usr.sbin/tzsetup/tzsetup.8 stable/8/usr.sbin/tzsetup/tzsetup.c Directory Properties: stable/8/usr.sbin/tzsetup/ (props changed) Modified: stable/8/usr.sbin/tzsetup/tzsetup.8 ============================================================================== --- stable/8/usr.sbin/tzsetup/tzsetup.8 Sun Nov 6 07:35:08 2011 (r227142) +++ stable/8/usr.sbin/tzsetup/tzsetup.8 Sun Nov 6 07:43:00 2011 (r227143) @@ -23,7 +23,8 @@ .\" SUCH DAMAGE. .\" .\" $FreeBSD$ -.Dd July 4, 2009 +.\" +.Dd October 21, 2009 .Dt TZSETUP 8 .Os .Sh NAME @@ -32,8 +33,8 @@ .Sh SYNOPSIS .Nm .Op Fl nrs -.Op Fl C Ar chroot directory -.Op Ar zoneinfo file | zoneinfo name +.Op Fl C Ar chroot_directory +.Op Ar zoneinfo_file | zoneinfo_name .Sh DESCRIPTION The .Nm @@ -50,24 +51,25 @@ the hardware clock does not keep .Pp The following option is available: .Bl -tag -offset indent -width Fl -.It Fl C Ar chroot directory +.It Fl C Ar chroot_directory Open all files and directories relative to -.Ar chroot directory . +.Ar chroot_directory . .It Fl n Do not create or copy files. .It Fl r -Reinstall the zoneinfo file installed last time. The name is obtained from +Reinstall the zoneinfo file installed last time. +The name is obtained from .Pa /var/db/zoneinfo . -.It Fl s +.It Fl s Skip the initial question about adjusting the clock if not set to .Tn UTC . .El .Pp It is possible to short-circuit the menu system by specifying the location of a -.Ar zoneinfo file +.Ar zoneinfo_file or the name of the -.Ar zoneinfo name +.Ar zoneinfo_name on the command line; this is intended mainly for pre-configured installation scripts or people who know which zoneinfo they want to install. .Sh TIMEZONE DATABASE @@ -101,38 +103,41 @@ The source code to the database contains many additional comments and documentation references for the historically minded. .Sh FILES -.Bl -tag -width /usr/share/zoneinfo/zone.tab -compact +.Bl -tag -width ".Pa /usr/share/zoneinfo/zone.tab" -compact .It Pa /etc/localtime -current time zone file. +current time zone file .It Pa /etc/wall_cmos_clock see -.Xr adjkerntz 8 . +.Xr adjkerntz 8 .It Pa /usr/share/misc/iso3166 mapping of .Tn ISO -3166 territory codes to names. +3166 territory codes to names .It Pa /usr/share/zoneinfo -directory for zoneinfo files. +directory for zoneinfo files .It Pa /usr/share/zoneinfo/zone.tab -mapping of timezone file to country and location. +mapping of timezone file to country and location .It Pa /var/db/zoneinfo -saved name of the timezone file installed last. +saved name of the timezone file installed last .El .Sh EXAMPLES Normal usage, to select the right zoneinfo file via the dialog-based user interface: -.Dl # tzsetup +.Dl tzsetup +.Pp Install the file .Pa /usr/share/zoneinfo/Australia/Sydney : -.Dl # tzsetup /usr/share/zoneinfo/Australia/Sydney +.Dl "tzsetup /usr/share/zoneinfo/Australia/Sydney" +.Pp Install the zoneinfo file for Australia/Sydney, assumed to be located in .Pa /usr/share/zoneinfo : -.Dl # tzsetup Australia/Sydney +.Dl "tzsetup Australia/Sydney" +.Pp After a reinstall of the zoneinfo files, you can reinstall the -latest installed zoneinfo file: (as specified in -.Pa /var/db/zoneinfo ) -.Dl # tzsetup -r +latest installed zoneinfo file (as specified in +.Pa /var/db/zoneinfo ) : +.Dl "tzsetup -r" .Sh SEE ALSO .Xr date 1 , .Xr adjtime 2 , Modified: stable/8/usr.sbin/tzsetup/tzsetup.c ============================================================================== --- stable/8/usr.sbin/tzsetup/tzsetup.c Sun Nov 6 07:35:08 2011 (r227142) +++ stable/8/usr.sbin/tzsetup/tzsetup.c Sun Nov 6 07:43:00 2011 (r227143) @@ -731,7 +731,8 @@ static void usage(void) { - fprintf(stderr, "usage: tzsetup [-nrs] [zoneinfo file]\n"); + fprintf(stderr, "usage: tzsetup [-nrs] [-C chroot_directory]" + " [zoneinfo_file | zoneinfo_name]\n"); exit(1); } From owner-svn-src-stable@FreeBSD.ORG Sun Nov 6 07:43:57 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E6380106566B; Sun, 6 Nov 2011 07:43:57 +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 D50D98FC12; Sun, 6 Nov 2011 07:43:57 +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 pA67hv17006394; Sun, 6 Nov 2011 07:43:57 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA67hvmF006392; Sun, 6 Nov 2011 07:43:57 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201111060743.pA67hvmF006392@svn.freebsd.org> From: Doug Barton Date: Sun, 6 Nov 2011 07:43:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227144 - stable/8/usr.sbin/tzsetup X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Nov 2011 07:43:58 -0000 Author: dougb Date: Sun Nov 6 07:43:57 2011 New Revision: 227144 URL: http://svn.freebsd.org/changeset/base/227144 Log: MFC 227011: If the user is moving from any other time zone to UTC we need to delete any old /var/db/zoneinfo file that may exist so that tzsetup -r does the right thing. Modified: stable/8/usr.sbin/tzsetup/tzsetup.c Directory Properties: stable/8/usr.sbin/tzsetup/ (props changed) Modified: stable/8/usr.sbin/tzsetup/tzsetup.c ============================================================================== --- stable/8/usr.sbin/tzsetup/tzsetup.c Sun Nov 6 07:43:00 2011 (r227143) +++ stable/8/usr.sbin/tzsetup/tzsetup.c Sun Nov 6 07:43:57 2011 (r227144) @@ -565,6 +565,18 @@ install_zoneinfo_file(const char *zonein return (DITEM_FAILURE | DITEM_RECREATE); } + if (unlink(path_db) < 0 && errno != ENOENT) { + snprintf(title, sizeof(title), "Error"); + snprintf(prompt, sizeof(prompt), + "Could not delete %s: %s", path_db, + strerror(errno)); + if (usedialog) + dialog_mesgbox(title, prompt, 8, 72); + else + fprintf(stderr, "%s\n", prompt); + + return (DITEM_FAILURE | DITEM_RECREATE); + } return (DITEM_LEAVE_MENU); } From owner-svn-src-stable@FreeBSD.ORG Sun Nov 6 07:47:39 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 31C62106564A; Sun, 6 Nov 2011 07:47:39 +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 16C5E8FC08; Sun, 6 Nov 2011 07:47:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pA67lcvr006580; Sun, 6 Nov 2011 07:47:38 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA67lcvW006577; Sun, 6 Nov 2011 07:47:38 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201111060747.pA67lcvW006577@svn.freebsd.org> From: Doug Barton Date: Sun, 6 Nov 2011 07:47:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227145 - stable/9/usr.sbin/mergemaster X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Nov 2011 07:47:39 -0000 Author: dougb Date: Sun Nov 6 07:47:38 2011 New Revision: 227145 URL: http://svn.freebsd.org/changeset/base/227145 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. Approved by: re (kensmith) Modified: stable/9/usr.sbin/mergemaster/mergemaster.8 stable/9/usr.sbin/mergemaster/mergemaster.sh Directory Properties: stable/9/usr.sbin/mergemaster/ (props changed) Modified: stable/9/usr.sbin/mergemaster/mergemaster.8 ============================================================================== --- stable/9/usr.sbin/mergemaster/mergemaster.8 Sun Nov 6 07:43:57 2011 (r227144) +++ stable/9/usr.sbin/mergemaster/mergemaster.8 Sun Nov 6 07:47:38 2011 (r227145) @@ -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/9/usr.sbin/mergemaster/mergemaster.sh ============================================================================== --- stable/9/usr.sbin/mergemaster/mergemaster.sh Sun Nov 6 07:43:57 2011 (r227144) +++ stable/9/usr.sbin/mergemaster/mergemaster.sh Sun Nov 6 07:47:38 2011 (r227145) @@ -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 @@ -1224,34 +1239,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 @@ -1310,6 +1334,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@FreeBSD.ORG Sun Nov 6 07:50:25 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8BFDA1065672; Sun, 6 Nov 2011 07:50:25 +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 7AAEA8FC1C; Sun, 6 Nov 2011 07:50:25 +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 pA67oPtX006709; Sun, 6 Nov 2011 07:50:25 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA67oPdi006706; Sun, 6 Nov 2011 07:50:25 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201111060750.pA67oPdi006706@svn.freebsd.org> From: Doug Barton Date: Sun, 6 Nov 2011 07:50:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227146 - stable/9/usr.bin/calendar/calendars X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Nov 2011 07:50:25 -0000 Author: dougb Date: Sun Nov 6 07:50:25 2011 New Revision: 227146 URL: http://svn.freebsd.org/changeset/base/227146 Log: Last revision should have said: 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 Approved by: re (kensmith) Modified: stable/9/usr.bin/calendar/calendars/calendar.birthday Modified: stable/9/usr.bin/calendar/calendars/calendar.birthday ============================================================================== --- stable/9/usr.bin/calendar/calendars/calendar.birthday Sun Nov 6 07:47:38 2011 (r227145) +++ stable/9/usr.bin/calendar/calendars/calendar.birthday Sun Nov 6 07:50:25 2011 (r227146) @@ -3,7 +3,7 @@ * * $FreeBSD$ */ - + #ifndef _calendar_birthday_ #define _calendar_birthday_ From owner-svn-src-stable@FreeBSD.ORG Sun Nov 6 07:54:43 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5B6D41065672; Sun, 6 Nov 2011 07:54:43 +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 49F998FC12; Sun, 6 Nov 2011 07:54:43 +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 pA67sh7v006927; Sun, 6 Nov 2011 07:54:43 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA67shEK006925; Sun, 6 Nov 2011 07:54:43 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201111060754.pA67shEK006925@svn.freebsd.org> From: Doug Barton Date: Sun, 6 Nov 2011 07:54:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227147 - stable/8/usr.sbin/mergemaster X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Nov 2011 07:54:43 -0000 Author: dougb Date: Sun Nov 6 07:54:42 2011 New Revision: 227147 URL: http://svn.freebsd.org/changeset/base/227147 Log: MFC r213573: mdoc: drop redundant .Pp and .LP calls They have no effect when coming in pairs, or before .Bl/.Bd Modified: stable/8/usr.sbin/mergemaster/mergemaster.8 Directory Properties: stable/8/usr.sbin/mergemaster/ (props changed) Modified: stable/8/usr.sbin/mergemaster/mergemaster.8 ============================================================================== --- stable/8/usr.sbin/mergemaster/mergemaster.8 Sun Nov 6 07:50:25 2011 (r227146) +++ stable/8/usr.sbin/mergemaster/mergemaster.8 Sun Nov 6 07:54:42 2011 (r227147) @@ -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@FreeBSD.ORG Sun Nov 6 07:59:34 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E4780106564A; Sun, 6 Nov 2011 07:59:34 +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 C9ADC8FC0A; Sun, 6 Nov 2011 07:59:34 +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 pA67xYj8007143; Sun, 6 Nov 2011 07:59:34 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA67xYRc007140; Sun, 6 Nov 2011 07:59:34 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201111060759.pA67xYRc007140@svn.freebsd.org> From: Doug Barton Date: Sun, 6 Nov 2011 07:59:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227148 - stable/8/usr.sbin/mergemaster X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Nov 2011 07:59:35 -0000 Author: dougb Date: Sun Nov 6 07:59:34 2011 New Revision: 227148 URL: http://svn.freebsd.org/changeset/base/227148 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/8/usr.sbin/mergemaster/mergemaster.8 stable/8/usr.sbin/mergemaster/mergemaster.sh Directory Properties: stable/8/usr.sbin/mergemaster/ (props changed) Modified: stable/8/usr.sbin/mergemaster/mergemaster.8 ============================================================================== --- stable/8/usr.sbin/mergemaster/mergemaster.8 Sun Nov 6 07:54:42 2011 (r227147) +++ stable/8/usr.sbin/mergemaster/mergemaster.8 Sun Nov 6 07:59:34 2011 (r227148) @@ -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/8/usr.sbin/mergemaster/mergemaster.sh ============================================================================== --- stable/8/usr.sbin/mergemaster/mergemaster.sh Sun Nov 6 07:54:42 2011 (r227147) +++ stable/8/usr.sbin/mergemaster/mergemaster.sh Sun Nov 6 07:59:34 2011 (r227148) @@ -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 @@ -1226,34 +1241,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 @@ -1312,6 +1336,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@FreeBSD.ORG Sun Nov 6 08:01:17 2011 Return-Path: Delivered-To: svn-src-stable@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@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the 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@FreeBSD.ORG Sun Nov 6 08:03:33 2011 Return-Path: Delivered-To: svn-src-stable@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@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the 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@FreeBSD.ORG Sun Nov 6 09:27:40 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A7B4D106564A; Sun, 6 Nov 2011 09:27:40 +0000 (UTC) (envelope-from fjoe@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9715E8FC14; Sun, 6 Nov 2011 09:27:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pA69ReaK012431; Sun, 6 Nov 2011 09:27:40 GMT (envelope-from fjoe@svn.freebsd.org) Received: (from fjoe@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA69Re1B012429; Sun, 6 Nov 2011 09:27:40 GMT (envelope-from fjoe@svn.freebsd.org) Message-Id: <201111060927.pA69Re1B012429@svn.freebsd.org> From: Max Khon Date: Sun, 6 Nov 2011 09:27:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227205 - stable/8/sys/kern X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Nov 2011 09:27:40 -0000 Author: fjoe Date: Sun Nov 6 09:27:40 2011 New Revision: 227205 URL: http://svn.freebsd.org/changeset/base/227205 Log: Fix the build with KLD_DEBUG defined. Modified: stable/8/sys/kern/kern_linker.c Modified: stable/8/sys/kern/kern_linker.c ============================================================================== --- stable/8/sys/kern/kern_linker.c Sun Nov 6 09:17:48 2011 (r227204) +++ stable/8/sys/kern/kern_linker.c Sun Nov 6 09:27:40 2011 (r227205) @@ -632,7 +632,7 @@ linker_file_unload(linker_file_t file, i */ if ((error = module_unload(mod)) != 0) { KLD_DPF(FILE, ("linker_file_unload: module %s" - " failed unload\n", mod)); + " failed unload\n", module_getname(mod))); return (error); } MOD_XLOCK; From owner-svn-src-stable@FreeBSD.ORG Sun Nov 6 12:37:44 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E5F22106564A; Sun, 6 Nov 2011 12:37:44 +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 D51D48FC13; Sun, 6 Nov 2011 12:37:44 +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 pA6CbinJ021384; Sun, 6 Nov 2011 12:37:44 GMT (envelope-from brueffer@svn.freebsd.org) Received: (from brueffer@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA6CbiX9021382; Sun, 6 Nov 2011 12:37:44 GMT (envelope-from brueffer@svn.freebsd.org) Message-Id: <201111061237.pA6CbiX9021382@svn.freebsd.org> From: Christian Brueffer Date: Sun, 6 Nov 2011 12:37:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227208 - stable/9/libexec/rshd X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Nov 2011 12:37:45 -0000 Author: brueffer Date: Sun Nov 6 12:37:44 2011 New Revision: 227208 URL: http://svn.freebsd.org/changeset/base/227208 Log: MFC: r226937 Fix a misplaced parenthesis. Approved by: re (kib) Modified: stable/9/libexec/rshd/rshd.c Directory Properties: stable/9/libexec/rshd/ (props changed) Modified: stable/9/libexec/rshd/rshd.c ============================================================================== --- stable/9/libexec/rshd/rshd.c Sun Nov 6 10:47:20 2011 (r227207) +++ stable/9/libexec/rshd/rshd.c Sun Nov 6 12:37:44 2011 (r227208) @@ -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@FreeBSD.ORG Sun Nov 6 13:02:33 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ABD69106564A; Sun, 6 Nov 2011 13:02:33 +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 9B2988FC13; Sun, 6 Nov 2011 13:02: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 pA6D2XM9022355; Sun, 6 Nov 2011 13:02:33 GMT (envelope-from brueffer@svn.freebsd.org) Received: (from brueffer@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA6D2XN7022353; Sun, 6 Nov 2011 13:02:33 GMT (envelope-from brueffer@svn.freebsd.org) Message-Id: <201111061302.pA6D2XN7022353@svn.freebsd.org> From: Christian Brueffer Date: Sun, 6 Nov 2011 13:02:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227209 - stable/8/libexec/rshd X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Nov 2011 13:02:33 -0000 Author: brueffer Date: Sun Nov 6 13:02:33 2011 New Revision: 227209 URL: http://svn.freebsd.org/changeset/base/227209 Log: MFC: r226937 Fix a misplaced parenthesis. Modified: stable/8/libexec/rshd/rshd.c Directory Properties: stable/8/libexec/rshd/ (props changed) Modified: stable/8/libexec/rshd/rshd.c ============================================================================== --- stable/8/libexec/rshd/rshd.c Sun Nov 6 12:37:44 2011 (r227208) +++ stable/8/libexec/rshd/rshd.c Sun Nov 6 13:02:33 2011 (r227209) @@ -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@FreeBSD.ORG Sun Nov 6 13:03:59 2011 Return-Path: Delivered-To: svn-src-stable@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@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the 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@FreeBSD.ORG Sun Nov 6 13:06:32 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4A0E21065672; Sun, 6 Nov 2011 13:06:32 +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 39CC58FC13; Sun, 6 Nov 2011 13:06: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 pA6D6W8I022580; Sun, 6 Nov 2011 13:06:32 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA6D6WAp022578; Sun, 6 Nov 2011 13:06:32 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201111061306.pA6D6WAp022578@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 6 Nov 2011 13:06:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227211 - stable/9/sys/fs/devfs X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Nov 2011 13:06:32 -0000 Author: kib Date: Sun Nov 6 13:06:31 2011 New Revision: 227211 URL: http://svn.freebsd.org/changeset/base/227211 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(). Approved by: re (kensmith) Modified: stable/9/sys/fs/devfs/devfs_vnops.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/fs/devfs/devfs_vnops.c ============================================================================== --- stable/9/sys/fs/devfs/devfs_vnops.c Sun Nov 6 13:03:59 2011 (r227210) +++ stable/9/sys/fs/devfs/devfs_vnops.c Sun Nov 6 13:06:31 2011 (r227211) @@ -1050,6 +1050,10 @@ devfs_open(struct vop_open_args *ap) dsw = dev_refthread(dev, &ref); if (dsw == NULL) return (ENXIO); + if (fp == NULL && dsw->d_fdopen != NULL) { + dev_relthread(dev, ref); + return (ENXIO); + } vlocked = VOP_ISLOCKED(vp); VOP_UNLOCK(vp, 0); From owner-svn-src-stable@FreeBSD.ORG Sun Nov 6 13:17:37 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9A65B106566B; Sun, 6 Nov 2011 13:17:37 +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 89FF68FC17; Sun, 6 Nov 2011 13:17: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 pA6DHbCW022988; Sun, 6 Nov 2011 13:17:37 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA6DHb4t022986; Sun, 6 Nov 2011 13:17:37 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201111061317.pA6DHb4t022986@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 6 Nov 2011 13:17:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227212 - stable/8/sys/fs/devfs X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Nov 2011 13:17:37 -0000 Author: kib Date: Sun Nov 6 13:17:37 2011 New Revision: 227212 URL: http://svn.freebsd.org/changeset/base/227212 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/8/sys/fs/devfs/devfs_vnops.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/fs/devfs/devfs_vnops.c ============================================================================== --- stable/8/sys/fs/devfs/devfs_vnops.c Sun Nov 6 13:06:31 2011 (r227211) +++ stable/8/sys/fs/devfs/devfs_vnops.c Sun Nov 6 13:17:37 2011 (r227212) @@ -982,6 +982,10 @@ devfs_open(struct vop_open_args *ap) dsw = dev_refthread(dev, &ref); if (dsw == NULL) return (ENXIO); + if (fp == NULL && dsw->d_fdopen != NULL) { + dev_relthread(dev, ref); + return (ENXIO); + } vlocked = VOP_ISLOCKED(vp); VOP_UNLOCK(vp, 0); From owner-svn-src-stable@FreeBSD.ORG Sun Nov 6 13:35:56 2011 Return-Path: Delivered-To: svn-src-stable@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@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the 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@FreeBSD.ORG Sun Nov 6 15:06:05 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F30651065672; Sun, 6 Nov 2011 15:06:04 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C91BB8FC16; Sun, 6 Nov 2011 15:06:04 +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 pA6F640k027008; Sun, 6 Nov 2011 15:06:04 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA6F64fq027006; Sun, 6 Nov 2011 15:06:04 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201111061506.pA6F64fq027006@svn.freebsd.org> From: Hans Petter Selasky Date: Sun, 6 Nov 2011 15:06:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227216 - stable/9/sys/dev/usb X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Nov 2011 15:06:05 -0000 Author: hselasky Date: Sun Nov 6 15:06:04 2011 New Revision: 227216 URL: http://svn.freebsd.org/changeset/base/227216 Log: MFC r227075: Fix for panic at USB controller attach failure during cold boot. Approved by: re (kib) Modified: stable/9/sys/dev/usb/usb_process.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/dev/usb/usb_process.c ============================================================================== --- stable/9/sys/dev/usb/usb_process.c Sun Nov 6 14:07:23 2011 (r227215) +++ stable/9/sys/dev/usb/usb_process.c Sun Nov 6 15:06:04 2011 (r227216) @@ -67,11 +67,13 @@ static int usb_pcount; #define USB_THREAD_CREATE(f, s, p, ...) \ kproc_kthread_add((f), (s), &usbproc, (p), RFHIGHPID, \ 0, "usb", __VA_ARGS__) +#define USB_THREAD_SUSPEND_CHECK() kthread_suspend_check() #define USB_THREAD_SUSPEND(p) kthread_suspend(p,0) #define USB_THREAD_EXIT(err) kthread_exit() #else #define USB_THREAD_CREATE(f, s, p, ...) \ kthread_create((f), (s), (p), RFHIGHPID, 0, __VA_ARGS__) +#define USB_THREAD_SUSPEND_CHECK() kthread_suspend_check() #define USB_THREAD_SUSPEND(p) kthread_suspend(p,0) #define USB_THREAD_EXIT(err) kthread_exit(err) #endif @@ -98,6 +100,9 @@ usb_process(void *arg) struct usb_proc_msg *pm; struct thread *td; + /* in case of attach error, check for suspended */ + USB_THREAD_SUSPEND_CHECK(); + /* adjust priority */ td = curthread; thread_lock(td); From owner-svn-src-stable@FreeBSD.ORG Sun Nov 6 15:13:02 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7A23B1065672; Sun, 6 Nov 2011 15:13:02 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 695F88FC1F; Sun, 6 Nov 2011 15:13:02 +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 pA6FD2tm027287; Sun, 6 Nov 2011 15:13:02 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA6FD25t027285; Sun, 6 Nov 2011 15:13:02 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201111061513.pA6FD25t027285@svn.freebsd.org> From: Hans Petter Selasky Date: Sun, 6 Nov 2011 15:13:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227217 - stable/8/sys/dev/usb X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Nov 2011 15:13:02 -0000 Author: hselasky Date: Sun Nov 6 15:13:01 2011 New Revision: 227217 URL: http://svn.freebsd.org/changeset/base/227217 Log: MFC r227075: Fix for panic at USB controller attach failure during cold boot. Modified: stable/8/sys/dev/usb/usb_process.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/usb/usb_process.c ============================================================================== --- stable/8/sys/dev/usb/usb_process.c Sun Nov 6 15:06:04 2011 (r227216) +++ stable/8/sys/dev/usb/usb_process.c Sun Nov 6 15:13:01 2011 (r227217) @@ -67,11 +67,13 @@ static int usb_pcount; #define USB_THREAD_CREATE(f, s, p, ...) \ kproc_kthread_add((f), (s), &usbproc, (p), RFHIGHPID, \ 0, "usb", __VA_ARGS__) +#define USB_THREAD_SUSPEND_CHECK() kthread_suspend_check() #define USB_THREAD_SUSPEND(p) kthread_suspend(p,0) #define USB_THREAD_EXIT(err) kthread_exit() #else #define USB_THREAD_CREATE(f, s, p, ...) \ kthread_create((f), (s), (p), RFHIGHPID, 0, __VA_ARGS__) +#define USB_THREAD_SUSPEND_CHECK() kthread_suspend_check() #define USB_THREAD_SUSPEND(p) kthread_suspend(p,0) #define USB_THREAD_EXIT(err) kthread_exit(err) #endif @@ -98,6 +100,9 @@ usb_process(void *arg) struct usb_proc_msg *pm; struct thread *td; + /* in case of attach error, check for suspended */ + USB_THREAD_SUSPEND_CHECK(); + /* adjust priority */ td = curthread; thread_lock(td); From owner-svn-src-stable@FreeBSD.ORG Sun Nov 6 15:58:56 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B8B7F106566B; Sun, 6 Nov 2011 15:58:56 +0000 (UTC) (envelope-from jpaetzel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9EC448FC0A; Sun, 6 Nov 2011 15:58: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 pA6FwuLb028873; Sun, 6 Nov 2011 15:58:56 GMT (envelope-from jpaetzel@svn.freebsd.org) Received: (from jpaetzel@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA6Fwucs028868; Sun, 6 Nov 2011 15:58:56 GMT (envelope-from jpaetzel@svn.freebsd.org) Message-Id: <201111061558.pA6Fwucs028868@svn.freebsd.org> From: Josh Paetzel Date: Sun, 6 Nov 2011 15:58:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227219 - stable/9/usr.sbin/pc-sysinstall/backend X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Nov 2011 15:58:56 -0000 Author: jpaetzel Date: Sun Nov 6 15:58:56 2011 New Revision: 227219 URL: http://svn.freebsd.org/changeset/base/227219 Log: MFC 227118: Roll up several patches used by PC-BSD. - Fix an issue with gmirror. - Allow IPv4 DHCP and IPv6 SLAAC concurrently. - Fix zpool options using the wrong device name. Approved by: re Obtained from: kris@pcbsd.org Modified: stable/9/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh stable/9/usr.sbin/pc-sysinstall/backend/functions-disk.sh stable/9/usr.sbin/pc-sysinstall/backend/functions-networking.sh stable/9/usr.sbin/pc-sysinstall/backend/functions-unmount.sh Directory Properties: stable/9/usr.sbin/pc-sysinstall/ (props changed) Modified: stable/9/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh ============================================================================== --- stable/9/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh Sun Nov 6 15:51:55 2011 (r227218) +++ stable/9/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh Sun Nov 6 15:58:56 2011 (r227219) @@ -280,7 +280,7 @@ setup_gpart_partitions() if [ "${_pType}" = "gpt" ] ; then get_fs_line_xvars "${_pDisk}p${CURPART}" "${STRING}" else - get_fs_line_xvars "${_wSlice}" "${STRING}" + get_fs_line_xvars "${_wSlice}${PARTLETTER}" "${STRING}" fi XTRAOPTS="${VAR}" Modified: stable/9/usr.sbin/pc-sysinstall/backend/functions-disk.sh ============================================================================== --- stable/9/usr.sbin/pc-sysinstall/backend/functions-disk.sh Sun Nov 6 15:51:55 2011 (r227218) +++ stable/9/usr.sbin/pc-sysinstall/backend/functions-disk.sh Sun Nov 6 15:58:56 2011 (r227219) @@ -470,7 +470,8 @@ setup_disk_slice() # Default to round-robin if the user didn't specify if [ -z "$MIRRORBAL" ]; then MIRRORBAL="round-robin" ; fi - echo "$MIRRORDISK:$MIRRORBAL:gm${gmnum}" >${MIRRORCFGDIR}/$DISK + _mFile=`echo $DISK | sed 's|/|%|g'` + echo "$MIRRORDISK:$MIRRORBAL:gm${gmnum}" >${MIRRORCFGDIR}/$_mFile init_gmirror "$gmnum" "$MIRRORBAL" "$DISK" "$MIRRORDISK" # Reset DISK to the gmirror device Modified: stable/9/usr.sbin/pc-sysinstall/backend/functions-networking.sh ============================================================================== --- stable/9/usr.sbin/pc-sysinstall/backend/functions-networking.sh Sun Nov 6 15:51:55 2011 (r227218) +++ stable/9/usr.sbin/pc-sysinstall/backend/functions-networking.sh Sun Nov 6 15:58:56 2011 (r227219) @@ -431,6 +431,10 @@ start_networking() elif [ "$NETDEV" = "IPv6-SLAAC" ] then enable_auto_slaac + elif [ "$NETDEV" = "AUTO-DHCP-SLAAC" ] + then + enable_auto_dhcp + enable_auto_slaac else enable_manual_nic ${NETDEV} fi @@ -457,6 +461,10 @@ save_networking_install() elif [ "$NETDEV" = "IPv6-SLAAC" ] then save_auto_slaac + elif [ "$NETDEV" = "AUTO-DHCP-SLAAC" ] + then + save_auto_dhcp + save_auto_slaac else save_manual_nic ${NETDEV} fi Modified: stable/9/usr.sbin/pc-sysinstall/backend/functions-unmount.sh ============================================================================== --- stable/9/usr.sbin/pc-sysinstall/backend/functions-unmount.sh Sun Nov 6 15:51:55 2011 (r227218) +++ stable/9/usr.sbin/pc-sysinstall/backend/functions-unmount.sh Sun Nov 6 15:58:56 2011 (r227219) @@ -43,7 +43,7 @@ start_gmirror_sync() { cd ${MIRRORCFGDIR} - for DISK in `ls *` + for DISK in `ls ${MIRRORCFGDIR}` do MIRRORDISK="`cat ${DISK} | cut -d ':' -f 1`" MIRRORBAL="`cat ${DISK} | cut -d ':' -f 2`" @@ -51,7 +51,7 @@ start_gmirror_sync() # Start the mirroring service rc_nohalt "gmirror forget ${MIRRORNAME}" - rc_halt "gmirror insert ${MIRRORNAME} /dev/${MIRRORDISK}" + rc_halt "gmirror insert ${MIRRORNAME} ${MIRRORDISK}" done From owner-svn-src-stable@FreeBSD.ORG Sun Nov 6 16:36:55 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2B2A2106566B; Sun, 6 Nov 2011 16:36:55 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1A3DB8FC12; Sun, 6 Nov 2011 16:36:55 +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 pA6Gasg8030350; Sun, 6 Nov 2011 16:36:54 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA6Gase1030348; Sun, 6 Nov 2011 16:36:54 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201111061636.pA6Gase1030348@svn.freebsd.org> From: Nathan Whitehorn Date: Sun, 6 Nov 2011 16:36:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227220 - stable/9/usr.sbin/kbdmap X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Nov 2011 16:36:55 -0000 Author: nwhitehorn Date: Sun Nov 6 16:36:54 2011 New Revision: 227220 URL: http://svn.freebsd.org/changeset/base/227220 Log: MFC r226439: Place quotes around the output of kbdmap(1), designed to be pasted into /etc/rc.conf. PR: bin/161711 Submitted by: manolis Approved by: re (kib) Modified: stable/9/usr.sbin/kbdmap/kbdmap.c Directory Properties: stable/9/usr.sbin/kbdmap/ (props changed) Modified: stable/9/usr.sbin/kbdmap/kbdmap.c ============================================================================== --- stable/9/usr.sbin/kbdmap/kbdmap.c Sun Nov 6 15:58:56 2011 (r227219) +++ stable/9/usr.sbin/kbdmap/kbdmap.c Sun Nov 6 16:36:54 2011 (r227220) @@ -289,7 +289,7 @@ do_kbdcontrol(struct keymap *km) if (!x11) system(kbd_cmd); - fprintf(stderr, "keymap=%s\n", km->keym); + fprintf(stderr, "keymap=\"%s\"\n", km->keym); free(kbd_cmd); } From owner-svn-src-stable@FreeBSD.ORG Sun Nov 6 16:37:50 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9E3251065672; Sun, 6 Nov 2011 16:37:50 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8453B8FC08; Sun, 6 Nov 2011 16:37:50 +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 pA6Gbo2x030454; Sun, 6 Nov 2011 16:37:50 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA6GboOB030450; Sun, 6 Nov 2011 16:37:50 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201111061637.pA6GboOB030450@svn.freebsd.org> From: Nathan Whitehorn Date: Sun, 6 Nov 2011 16:37:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227222 - in stable/9/usr.sbin/bsdinstall: partedit scripts X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Nov 2011 16:37:50 -0000 Author: nwhitehorn Date: Sun Nov 6 16:37:50 2011 New Revision: 227222 URL: http://svn.freebsd.org/changeset/base/227222 Log: MFC r226666,226739,226741: Avoid showing the user some spurious error messages from GEOM [1] and do provide error messages instead of silent failure if there are no disks or no network interfaces in the system [2]. PR: bin/161926 [1], bin/161926 [2] Approved by: re (kib) Modified: stable/9/usr.sbin/bsdinstall/partedit/gpart_ops.c stable/9/usr.sbin/bsdinstall/partedit/partedit.c stable/9/usr.sbin/bsdinstall/scripts/netconfig Directory Properties: stable/9/usr.sbin/bsdinstall/ (props changed) Modified: stable/9/usr.sbin/bsdinstall/partedit/gpart_ops.c ============================================================================== --- stable/9/usr.sbin/bsdinstall/partedit/gpart_ops.c Sun Nov 6 16:37:15 2011 (r227221) +++ stable/9/usr.sbin/bsdinstall/partedit/gpart_ops.c Sun Nov 6 16:37:50 2011 (r227222) @@ -392,8 +392,14 @@ gpart_destroy(struct ggeom *lg_geom) gctl_ro_param(r, "force", sizeof(force), &force); gctl_ro_param(r, "verb", -1, "destroy"); errstr = gctl_issue(r); - if (errstr != NULL && errstr[0] != '\0') - gpart_show_error("Error", NULL, errstr); + if (errstr != NULL && errstr[0] != '\0') { + /* + * Check if we reverted away the existence of the geom + * altogether. Show all other errors to the user. + */ + if (strtol(errstr, NULL, 0) != EINVAL) + gpart_show_error("Error", NULL, errstr); + } gctl_free(r); /* And any metadata associated with the partition scheme itself */ @@ -450,6 +456,10 @@ gpart_edit(struct gprovider *pp) return; } + /* If this is a nested partition, edit as usual */ + if (strcmp(pp->lg_geom->lg_class->lg_name, "PART") == 0) + break; + /* Destroy the geom and all sub-partitions */ gpart_destroy(cp->lg_geom); @@ -507,7 +517,7 @@ editpart: choice = dlg_form("Edit Partition", "", 0, 0, 0, nitems, items, &junk); if (choice) /* Cancel pressed */ - return; + goto endedit; /* Check if the label has a / in it */ if (strchr(items[3].text, '/') != NULL) { @@ -538,6 +548,13 @@ editpart: items[2].text, (strcmp(oldtype, items[0].text) != 0) ? newfs : NULL); +endedit: + if (strcmp(oldtype, items[0].text) != 0 && cp != NULL) + gpart_destroy(cp->lg_geom); + if (strcmp(oldtype, items[0].text) != 0 && strcmp(items[0].text, + "freebsd") == 0) + gpart_partition(pp->lg_name, "BSD"); + for (i = 0; i < (sizeof(items) / sizeof(items[0])); i++) if (items[i].text_free) free(items[i].text); Modified: stable/9/usr.sbin/bsdinstall/partedit/partedit.c ============================================================================== --- stable/9/usr.sbin/bsdinstall/partedit/partedit.c Sun Nov 6 16:37:15 2011 (r227221) +++ stable/9/usr.sbin/bsdinstall/partedit/partedit.c Sun Nov 6 16:37:50 2011 (r227222) @@ -70,7 +70,7 @@ main(int argc, const char **argv) { struct partition_metadata *md; const char *prompt; - struct partedit_item *items; + struct partedit_item *items = NULL; struct gmesh mesh; int i, op, nitems, nscroll; int error; @@ -99,12 +99,21 @@ main(int argc, const char **argv) /* Show the part editor either immediately, or to confirm wizard */ while (1) { - error = geom_gettree(&mesh); - items = read_geom_mesh(&mesh, &nitems); - get_mount_points(items, nitems); dlg_clear(); dlg_put_backtitle(); + error = geom_gettree(&mesh); + if (error == 0) + items = read_geom_mesh(&mesh, &nitems); + if (error || items == NULL) { + dialog_msgbox("Error", "No disks found. If you need to " + "install a kernel driver, choose Shell at the " + "installation menu.", 0, 0, TRUE); + break; + } + + get_mount_points(items, nitems); + if (i >= nitems) i = nitems - 1; op = diskeditor_show("Partition Editor", prompt, Modified: stable/9/usr.sbin/bsdinstall/scripts/netconfig ============================================================================== --- stable/9/usr.sbin/bsdinstall/scripts/netconfig Sun Nov 6 16:37:15 2011 (r227221) +++ stable/9/usr.sbin/bsdinstall/scripts/netconfig Sun Nov 6 16:37:50 2011 (r227222) @@ -49,6 +49,13 @@ for IF in `ifconfig -l`; do DIALOG_TAGS="$DIALOG_TAGS $IF \"$DESC\"" done +if [ -z "$INTERFACES" ]; then + dialog --backtitle 'FreeBSD Installer' \ + --title 'Network Configuration Error' \ + --msgbox 'No network interfaces present to configure.' 0 0 + exit 1 +fi + exec 3>&1 INTERFACE=`echo $DIALOG_TAGS | xargs dialog --backtitle 'FreeBSD Installer' --title 'Network Configuration' --menu 'Please select a network interface to configure:' 0 0 0 2>&1 1>&3` if [ $? -eq $DIALOG_CANCEL ]; then exit 1; fi From owner-svn-src-stable@FreeBSD.ORG Sun Nov 6 16:54:24 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F3EED1065689; Sun, 6 Nov 2011 16:54:23 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C9FC98FC1F; Sun, 6 Nov 2011 16:54:23 +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 pA6GsNkl031306; Sun, 6 Nov 2011 16:54:23 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA6GsNLj031304; Sun, 6 Nov 2011 16:54:23 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201111061654.pA6GsNLj031304@svn.freebsd.org> From: Alexander Motin Date: Sun, 6 Nov 2011 16:54:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227226 - stable/9/sys/geom X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Nov 2011 16:54:24 -0000 Author: mav Date: Sun Nov 6 16:54:23 2011 New Revision: 227226 URL: http://svn.freebsd.org/changeset/base/227226 Log: MFC r226985: Workaround the problem introduced by combination of r162200 and r215687. r162200 delays provider orphanization until all running requests complete, to workaround broken orphan() method implementation in some classes. r215687 removes persistent periodic (10Hz) event thread wake ups. Together these changes can indefinitely delay orphanization until some other event wake up the event thread. One consequence of this is inability of CAM to destroy device disconnected when busy and, as consequence, create new one after reconnection. While the best solution would be to revert r162200, it is not easy, as some classes still broken in that way. Instead conditionally wake up event thread if there are some providers waiting for orphanization. Approved by: re (kib) Modified: stable/9/sys/geom/geom_event.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/geom/geom_event.c ============================================================================== --- stable/9/sys/geom/geom_event.c Sun Nov 6 16:52:26 2011 (r227225) +++ stable/9/sys/geom/geom_event.c Sun Nov 6 16:54:23 2011 (r227226) @@ -294,7 +294,7 @@ g_run_events() } else { g_topology_unlock(); msleep(&g_wait_event, &g_eventlock, PRIBIO | PDROP, - "-", 0); + "-", TAILQ_EMPTY(&g_doorstep) ? 0 : hz / 10); } } /* NOTREACHED */ From owner-svn-src-stable@FreeBSD.ORG Sun Nov 6 16:58:17 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DF279106564A; Sun, 6 Nov 2011 16:58:17 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CE8FB8FC0C; Sun, 6 Nov 2011 16:58: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 pA6GwH4o031507; Sun, 6 Nov 2011 16:58:17 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA6GwHRk031505; Sun, 6 Nov 2011 16:58:17 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201111061658.pA6GwHRk031505@svn.freebsd.org> From: Alexander Motin Date: Sun, 6 Nov 2011 16:58:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227227 - stable/8/sys/geom X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Nov 2011 16:58:18 -0000 Author: mav Date: Sun Nov 6 16:58:17 2011 New Revision: 227227 URL: http://svn.freebsd.org/changeset/base/227227 Log: MFC r226985: Workaround the problem introduced by combination of r162200 and r215687. r162200 delays provider orphanization until all running requests complete, to workaround broken orphan() method implementation in some classes. r215687 removes persistent periodic (10Hz) event thread wake ups. Together these changes can indefinitely delay orphanization until some other event wake up the event thread. One consequence of this is inability of CAM to destroy device disconnected when busy and, as consequence, create new one after reconnection. While the best solution would be to revert r162200, it is not easy, as some classes still broken in that way. Instead conditionally wake up event thread if there are some providers waiting for orphanization. Modified: stable/8/sys/geom/geom_event.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/geom/geom_event.c ============================================================================== --- stable/8/sys/geom/geom_event.c Sun Nov 6 16:54:23 2011 (r227226) +++ stable/8/sys/geom/geom_event.c Sun Nov 6 16:58:17 2011 (r227227) @@ -247,7 +247,7 @@ g_run_events() } else { g_topology_unlock(); msleep(&g_wait_event, &g_eventlock, PRIBIO | PDROP, - "-", 0); + "-", TAILQ_EMPTY(&g_doorstep) ? 0 : hz / 10); } } /* NOTREACHED */ From owner-svn-src-stable@FreeBSD.ORG Sun Nov 6 17:23:50 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3076E106564A; Sun, 6 Nov 2011 17:23:50 +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 1CA7A8FC13; Sun, 6 Nov 2011 17:23:50 +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 pA6HNoiu032563; Sun, 6 Nov 2011 17:23:50 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA6HNntX032551; Sun, 6 Nov 2011 17:23:49 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201111061723.pA6HNntX032551@svn.freebsd.org> From: Marius Strobl Date: Sun, 6 Nov 2011 17:23:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227229 - in stable/9/sys: conf dev/fxp dev/mii dev/usb/net dev/xl modules/fxp modules/mii modules/usb/rue modules/xl X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Nov 2011 17:23:50 -0000 Author: marius Date: Sun Nov 6 17:23:49 2011 New Revision: 227229 URL: http://svn.freebsd.org/changeset/base/227229 Log: MFC: r226154, r226165 - Follow the lead of dcphy(4) and pnphy(4) and move the reminder of the PHY drivers that only ever attach to a particular MAC driver, i.e. inphy(4), ruephy(4) and xlphy(4), to the directory where the respective MAC driver lives and only compile it into the kernel when the latter is also there, also removing it from miibus.ko and moving it into the module of the respective MAC driver. - While at it, rename exphy.c, which comes from NetBSD where the MAC driver it corresponds to also is named ex(4) instead of xl(4) but that in FreeBSD actually identifies itself as xlphy(4), and its function names accordingly for consistency. - Additionally while at it, fix some minor style issues like whitespace in the register headers and add multi-inclusion protection to inphyreg.h. Approved by: re (kib) Added: stable/9/sys/dev/fxp/inphy.c - copied unchanged from r226154, head/sys/dev/fxp/inphy.c stable/9/sys/dev/fxp/inphyreg.h - copied unchanged from r226154, head/sys/dev/fxp/inphyreg.h stable/9/sys/dev/usb/net/ruephy.c - copied unchanged from r226154, head/sys/dev/usb/net/ruephy.c stable/9/sys/dev/usb/net/ruephyreg.h - copied unchanged from r226154, head/sys/dev/usb/net/ruephyreg.h stable/9/sys/dev/xl/xlphy.c - copied unchanged from r226154, head/sys/dev/xl/xlphy.c Deleted: stable/9/sys/dev/mii/exphy.c stable/9/sys/dev/mii/inphy.c stable/9/sys/dev/mii/inphyreg.h stable/9/sys/dev/mii/ruephy.c stable/9/sys/dev/mii/ruephyreg.h Modified: stable/9/sys/conf/NOTES stable/9/sys/conf/files stable/9/sys/modules/fxp/Makefile stable/9/sys/modules/mii/Makefile stable/9/sys/modules/usb/rue/Makefile stable/9/sys/modules/xl/Makefile Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/conf/NOTES ============================================================================== --- stable/9/sys/conf/NOTES Sun Nov 6 17:20:44 2011 (r227228) +++ stable/9/sys/conf/NOTES Sun Nov 6 17:23:49 2011 (r227229) @@ -1862,10 +1862,8 @@ device bmtphy # Broadcom BCM5201/BCM5 device brgphy # Broadcom BCM54xx/57xx 1000baseTX device ciphy # Cicada/Vitesse CS/VSC8xxx device e1000phy # Marvell 88E1000 1000/100/10-BT -device exphy # 3Com internal PHY device gentbi # Generic 10-bit 1000BASE-{LX,SX} fiber ifaces device icsphy # ICS ICS1889-1893 -device inphy # Intel 82553/82555 device ip1000phy # IC Plus IP1000A/IP1001 device jmphy # JMicron JMP211/JMP202 device lxtphy # Level One LXT-970 @@ -1879,7 +1877,6 @@ device rdcphy # RDC Semiconductor R60 device rgephy # RealTek 8169S/8110S/8211B/8211C device rlphy # RealTek 8139 device rlswitch # RealTek 8305 -device ruephy # RealTek RTL8150 device smcphy # SMSC LAN91C111 device tdkphy # TDK 89Q2120 device tlphy # Texas Instruments ThunderLAN Modified: stable/9/sys/conf/files ============================================================================== --- stable/9/sys/conf/files Sun Nov 6 17:20:44 2011 (r227228) +++ stable/9/sys/conf/files Sun Nov 6 17:23:49 2011 (r227229) @@ -1092,6 +1092,7 @@ dev/firewire/sbp_targ.c optional sbp_ta dev/flash/at45d.c optional at45d dev/flash/mx25l.c optional mx25l dev/fxp/if_fxp.c optional fxp +dev/fxp/inphy.c optional fxp dev/gem/if_gem.c optional gem dev/gem/if_gem_pci.c optional gem pci dev/gem/if_gem_sbus.c optional gem sbus @@ -1418,12 +1419,8 @@ dev/mii/bmtphy.c optional miibus | bmtp dev/mii/brgphy.c optional miibus | brgphy dev/mii/ciphy.c optional miibus | ciphy dev/mii/e1000phy.c optional miibus | e1000phy -# XXX only xl cards? -dev/mii/exphy.c optional miibus | exphy dev/mii/gentbi.c optional miibus | gentbi dev/mii/icsphy.c optional miibus | icsphy -# XXX only fxp cards? -dev/mii/inphy.c optional miibus | inphy dev/mii/ip1000phy.c optional miibus | ip1000phy dev/mii/jmphy.c optional miibus | jmphy dev/mii/lxtphy.c optional miibus | lxtphy @@ -1440,8 +1437,6 @@ dev/mii/rdcphy.c optional miibus | rdcp dev/mii/rgephy.c optional miibus | rgephy dev/mii/rlphy.c optional miibus | rlphy dev/mii/rlswitch.c optional rlswitch -# XXX rue only? -dev/mii/ruephy.c optional miibus | ruephy dev/mii/smcphy.c optional miibus | smcphy dev/mii/tdkphy.c optional miibus | tdkphy dev/mii/tlphy.c optional miibus | tlphy @@ -1924,6 +1919,7 @@ dev/usb/net/if_mos.c optional mos dev/usb/net/if_rue.c optional rue dev/usb/net/if_udav.c optional udav dev/usb/net/if_usie.c optional usie +dev/usb/net/ruephy.c optional rue dev/usb/net/usb_ethernet.c optional aue | axe | cdce | cue | kue | mos | \ rue | udav dev/usb/net/uhso.c optional uhso @@ -2062,6 +2058,7 @@ wpi.fw optional wpifw \ dev/xe/if_xe.c optional xe dev/xe/if_xe_pccard.c optional xe pccard dev/xl/if_xl.c optional xl pci +dev/xl/xlphy.c optional xl pci fs/coda/coda_fbsd.c optional vcoda fs/coda/coda_psdev.c optional vcoda fs/coda/coda_subr.c optional vcoda Copied: stable/9/sys/dev/fxp/inphy.c (from r226154, head/sys/dev/fxp/inphy.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/sys/dev/fxp/inphy.c Sun Nov 6 17:23:49 2011 (r227229, copy of r226154, head/sys/dev/fxp/inphy.c) @@ -0,0 +1,197 @@ +/*- + * Copyright (c) 2001 Jonathan Lemon + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the author nor the names of any co-contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#include +__FBSDID("$FreeBSD$"); + +/* + * driver for Intel 82553 and 82555 PHYs + */ + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include "miidevs.h" + +#include + +#include "miibus_if.h" + +static int inphy_probe(device_t dev); +static int inphy_attach(device_t dev); + +static device_method_t inphy_methods[] = { + /* device interface */ + DEVMETHOD(device_probe, inphy_probe), + DEVMETHOD(device_attach, inphy_attach), + DEVMETHOD(device_detach, mii_phy_detach), + DEVMETHOD(device_shutdown, bus_generic_shutdown), + { 0, 0 } +}; + +static devclass_t inphy_devclass; + +static driver_t inphy_driver = { + "inphy", + inphy_methods, + sizeof(struct mii_softc) +}; + +DRIVER_MODULE(inphy, miibus, inphy_driver, inphy_devclass, 0, 0); + +static int inphy_service(struct mii_softc *, struct mii_data *, int); +static void inphy_status(struct mii_softc *); +static void inphy_reset(struct mii_softc *); + +static const struct mii_phydesc inphys[] = { + MII_PHY_DESC(xxINTEL, I82553), + MII_PHY_DESC(yyINTEL, I82553), + MII_PHY_DESC(yyINTEL, I82555), + MII_PHY_DESC(yyINTEL, I82562EM), + MII_PHY_DESC(yyINTEL, I82562ET), + MII_PHY_END +}; + +static const struct mii_phy_funcs inphy_funcs = { + inphy_service, + inphy_status, + inphy_reset +}; + +static int +inphy_probe(device_t dev) +{ + + return (mii_phy_dev_probe(dev, inphys, BUS_PROBE_DEFAULT)); +} + +static int +inphy_attach(device_t dev) +{ + + mii_phy_dev_attach(dev, MIIF_NOMANPAUSE, &inphy_funcs, 1); + return (0); +} + +static int +inphy_service(struct mii_softc *sc, struct mii_data *mii, int cmd) +{ + + switch (cmd) { + case MII_POLLSTAT: + break; + + case MII_MEDIACHG: + /* + * If the interface is not up, don't do anything. + */ + if ((mii->mii_ifp->if_flags & IFF_UP) == 0) + break; + + mii_phy_setmedia(sc); + break; + + case MII_TICK: + if (mii_phy_tick(sc) == EJUSTRETURN) + return (0); + break; + } + + /* Update the media status. */ + PHY_STATUS(sc); + + /* Callback if something changed. */ + mii_phy_update(sc, cmd); + return (0); +} + +static void +inphy_status(struct mii_softc *sc) +{ + struct mii_data *mii = sc->mii_pdata; + struct ifmedia_entry *ife = mii->mii_media.ifm_cur; + int bmsr, bmcr, scr; + + mii->mii_media_status = IFM_AVALID; + mii->mii_media_active = IFM_ETHER; + + bmsr = PHY_READ(sc, MII_BMSR) | PHY_READ(sc, MII_BMSR); + if (bmsr & BMSR_LINK) + mii->mii_media_status |= IFM_ACTIVE; + + bmcr = PHY_READ(sc, MII_BMCR); + if (bmcr & BMCR_ISO) { + mii->mii_media_active |= IFM_NONE; + mii->mii_media_status = 0; + return; + } + + if (bmcr & BMCR_LOOP) + mii->mii_media_active |= IFM_LOOP; + + if (bmcr & BMCR_AUTOEN) { + if ((bmsr & BMSR_ACOMP) == 0) { + mii->mii_media_active |= IFM_NONE; + return; + } + + scr = PHY_READ(sc, MII_INPHY_SCR); + if (scr & SCR_S100) + mii->mii_media_active |= IFM_100_TX; + else + mii->mii_media_active |= IFM_10_T; + if (scr & SCR_FDX) + mii->mii_media_active |= + IFM_FDX | mii_phy_flowstatus(sc); + else + mii->mii_media_active |= IFM_HDX; + } else + mii->mii_media_active = ife->ifm_media; +} + +static void +inphy_reset(struct mii_softc *sc) +{ + + mii_phy_reset(sc); + + /* Ensure Bay flow control is disabled. */ + PHY_WRITE(sc, MII_INPHY_SCR, + PHY_READ(sc, MII_INPHY_SCR) & ~SCR_FLOWCTL); +} Copied: stable/9/sys/dev/fxp/inphyreg.h (from r226154, head/sys/dev/fxp/inphyreg.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/sys/dev/fxp/inphyreg.h Sun Nov 6 17:23:49 2011 (r227229, copy of r226154, head/sys/dev/fxp/inphyreg.h) @@ -0,0 +1,40 @@ +/*- + * Copyright (c) 2001 Jonathan Lemon + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the author nor the names of any co-contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _INPHYREG_H +#define _INPHYREG_H + +#define MII_INPHY_SCR 0x10 /* status and control register */ +#define SCR_FLOWCTL 0x8000 +#define SCR_S100 0x0002 /* autonegotiated speed */ +#define SCR_FDX 0x0001 /* autonegotiated duplex */ + +#endif Copied: stable/9/sys/dev/usb/net/ruephy.c (from r226154, head/sys/dev/usb/net/ruephy.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/sys/dev/usb/net/ruephy.c Sun Nov 6 17:23:49 2011 (r227229, copy of r226154, head/sys/dev/usb/net/ruephy.c) @@ -0,0 +1,232 @@ +/*- + * Copyright (c) 2001-2003, Shunsuke Akiyama . + * 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. + * + */ + +#include +__FBSDID("$FreeBSD$"); + +/* + * driver for RealTek RTL8150 internal PHY + */ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include "miidevs.h" + +#include + +#include "miibus_if.h" + +static int ruephy_probe(device_t); +static int ruephy_attach(device_t); + +static device_method_t ruephy_methods[] = { + /* device interface */ + DEVMETHOD(device_probe, ruephy_probe), + DEVMETHOD(device_attach, ruephy_attach), + DEVMETHOD(device_detach, mii_phy_detach), + DEVMETHOD(device_shutdown, bus_generic_shutdown), + { 0, 0 } +}; + +static devclass_t ruephy_devclass; + +static driver_t ruephy_driver = { + "ruephy", + ruephy_methods, + sizeof(struct mii_softc) +}; + +DRIVER_MODULE(ruephy, miibus, ruephy_driver, ruephy_devclass, 0, 0); + +static int ruephy_service(struct mii_softc *, struct mii_data *, int); +static void ruephy_reset(struct mii_softc *); +static void ruephy_status(struct mii_softc *); + +/* + * The RealTek RTL8150 internal PHY doesn't have vendor/device ID + * registers; rue(4) fakes up a return value of all zeros. + */ +static const struct mii_phydesc ruephys[] = { + { 0, 0, "RealTek RTL8150 internal media interface" }, + MII_PHY_END +}; + +static const struct mii_phy_funcs ruephy_funcs = { + ruephy_service, + ruephy_status, + ruephy_reset +}; + +static int +ruephy_probe(device_t dev) +{ + + if (strcmp(device_get_name(device_get_parent(device_get_parent(dev))), + "rue") == 0) + return (mii_phy_dev_probe(dev, ruephys, BUS_PROBE_DEFAULT)); + return (ENXIO); +} + +static int +ruephy_attach(device_t dev) +{ + + mii_phy_dev_attach(dev, MIIF_NOISOLATE | MIIF_NOMANPAUSE, + &ruephy_funcs, 1); + return (0); +} + +static int +ruephy_service(struct mii_softc *sc, struct mii_data *mii, int cmd) +{ + struct ifmedia_entry *ife = mii->mii_media.ifm_cur; + int reg; + + switch (cmd) { + case MII_POLLSTAT: + break; + + case MII_MEDIACHG: + /* + * If the interface is not up, don't do anything. + */ + if ((mii->mii_ifp->if_flags & IFF_UP) == 0) + break; + + mii_phy_setmedia(sc); + break; + + case MII_TICK: + /* + * Is the interface even up? + */ + if ((mii->mii_ifp->if_flags & IFF_UP) == 0) + return (0); + + /* + * Only used for autonegotiation. + */ + if (IFM_SUBTYPE(ife->ifm_media) != IFM_AUTO) + break; + + /* + * Check to see if we have link. If we do, we don't + * need to restart the autonegotiation process. Read + * the MSR twice in case it's latched. + */ + reg = PHY_READ(sc, RUEPHY_MII_MSR) | + PHY_READ(sc, RUEPHY_MII_MSR); + if (reg & RUEPHY_MSR_LINK) + break; + + /* Only retry autonegotiation every mii_anegticks seconds. */ + if (sc->mii_ticks <= sc->mii_anegticks) + break; + + sc->mii_ticks = 0; + PHY_RESET(sc); + if (mii_phy_auto(sc) == EJUSTRETURN) + return (0); + break; + } + + /* Update the media status. */ + PHY_STATUS(sc); + + /* Callback if something changed. */ + mii_phy_update(sc, cmd); + + return (0); +} + +static void +ruephy_reset(struct mii_softc *sc) +{ + + mii_phy_reset(sc); + + /* + * XXX RealTek RTL8150 PHY doesn't set the BMCR properly after + * XXX reset, which breaks autonegotiation. + */ + PHY_WRITE(sc, MII_BMCR, (BMCR_S100 | BMCR_AUTOEN | BMCR_FDX)); +} + +static void +ruephy_status(struct mii_softc *phy) +{ + struct mii_data *mii = phy->mii_pdata; + struct ifmedia_entry *ife = mii->mii_media.ifm_cur; + int bmsr, bmcr, msr; + + mii->mii_media_status = IFM_AVALID; + mii->mii_media_active = IFM_ETHER; + + msr = PHY_READ(phy, RUEPHY_MII_MSR) | PHY_READ(phy, RUEPHY_MII_MSR); + if (msr & RUEPHY_MSR_LINK) + mii->mii_media_status |= IFM_ACTIVE; + + bmcr = PHY_READ(phy, MII_BMCR); + if (bmcr & BMCR_ISO) { + mii->mii_media_active |= IFM_NONE; + mii->mii_media_status = 0; + return; + } + + bmsr = PHY_READ(phy, MII_BMSR) | PHY_READ(phy, MII_BMSR); + if (bmcr & BMCR_AUTOEN) { + if ((bmsr & BMSR_ACOMP) == 0) { + /* Erg, still trying, I guess... */ + mii->mii_media_active |= IFM_NONE; + return; + } + + if (msr & RUEPHY_MSR_SPEED100) + mii->mii_media_active |= IFM_100_TX; + else + mii->mii_media_active |= IFM_10_T; + + if (msr & RUEPHY_MSR_DUPLEX) + mii->mii_media_active |= + IFM_FDX | mii_phy_flowstatus(phy); + else + mii->mii_media_active |= IFM_HDX; + } else + mii->mii_media_active = ife->ifm_media; +} Copied: stable/9/sys/dev/usb/net/ruephyreg.h (from r226154, head/sys/dev/usb/net/ruephyreg.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/sys/dev/usb/net/ruephyreg.h Sun Nov 6 17:23:49 2011 (r227229, copy of r226154, head/sys/dev/usb/net/ruephyreg.h) @@ -0,0 +1,38 @@ +/*- + * Copyright (c) 2001-2003, Shunsuke Akiyama . + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _RUEPHYREG_H_ +#define _RUEPHYREG_H_ + +#define RUEPHY_MII_MSR 0x0137 /* B, R/W */ +#define RUEPHY_MSR_RXFCE 0x40 +#define RUEPHY_MSR_DUPLEX 0x10 +#define RUEPHY_MSR_SPEED100 0x08 +#define RUEPHY_MSR_LINK 0x04 + +#endif /* _RUEPHYREG_H_ */ Copied: stable/9/sys/dev/xl/xlphy.c (from r226154, head/sys/dev/xl/xlphy.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/sys/dev/xl/xlphy.c Sun Nov 6 17:23:49 2011 (r227229, copy of r226154, head/sys/dev/xl/xlphy.c) @@ -0,0 +1,197 @@ +/* $NetBSD: exphy.c,v 1.16 1999/04/23 04:24:32 thorpej Exp $ */ + +/*- + * Copyright (c) 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, and by Frank van der Linden. + * + * 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. + */ + +/*- + * Copyright (c) 1997 Manuel Bouyer. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +/* + * driver for 3Com internal PHYs + */ + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include "miidevs.h" + +#include "miibus_if.h" + +static int xlphy_probe(device_t); +static int xlphy_attach(device_t); + +static device_method_t xlphy_methods[] = { + /* device interface */ + DEVMETHOD(device_probe, xlphy_probe), + DEVMETHOD(device_attach, xlphy_attach), + DEVMETHOD(device_detach, mii_phy_detach), + DEVMETHOD(device_shutdown, bus_generic_shutdown), + { 0, 0 } +}; + +static devclass_t xlphy_devclass; + +static driver_t xlphy_driver = { + "xlphy", + xlphy_methods, + sizeof(struct mii_softc) +}; + +DRIVER_MODULE(xlphy, miibus, xlphy_driver, xlphy_devclass, 0, 0); + +static int xlphy_service(struct mii_softc *, struct mii_data *, int); +static void xlphy_reset(struct mii_softc *); + +/* + * Some 3Com internal PHYs report zero for OUI and model, others use + * actual values. + * Note that the 3Com internal PHYs having OUI 0x105a and model 0 are + * handled fine by ukphy(4); they can be isolated and don't require + * special treatment after reset. + */ +static const struct mii_phydesc xlphys[] = { + { 0, 0, "3Com internal media interface" }, + MII_PHY_DESC(xxBROADCOM, 3C905C), + MII_PHY_END +}; + +static const struct mii_phy_funcs xlphy_funcs = { + xlphy_service, + ukphy_status, + xlphy_reset +}; + +static int +xlphy_probe(device_t dev) +{ + + if (strcmp(device_get_name(device_get_parent(device_get_parent(dev))), + "xl") == 0) + return (mii_phy_dev_probe(dev, xlphys, BUS_PROBE_DEFAULT)); + return (ENXIO); +} + +static int +xlphy_attach(device_t dev) +{ + + /* + * The 3Com PHY can never be isolated. + */ + mii_phy_dev_attach(dev, MIIF_NOISOLATE | MIIF_NOMANPAUSE, + &xlphy_funcs, 1); + return (0); +} + +static int +xlphy_service(struct mii_softc *sc, struct mii_data *mii, int cmd) +{ + + switch (cmd) { + case MII_POLLSTAT: + break; + + case MII_MEDIACHG: + /* + * If the interface is not up, don't do anything. + */ + if ((mii->mii_ifp->if_flags & IFF_UP) == 0) + break; + + mii_phy_setmedia(sc); + break; + + case MII_TICK: + /* + * Is the interface even up? + */ + if ((mii->mii_ifp->if_flags & IFF_UP) == 0) + return (0); + + /* + * The 3Com PHY's autonegotiation doesn't need to be + * kicked; it continues in the background. + */ + break; + } + + /* Update the media status. */ + PHY_STATUS(sc); + + /* Callback if something changed. */ + mii_phy_update(sc, cmd); + return (0); +} + +static void +xlphy_reset(struct mii_softc *sc) +{ + + mii_phy_reset(sc); + + /* + * XXX 3Com PHY doesn't set the BMCR properly after + * XXX reset, which breaks autonegotiation. + */ + PHY_WRITE(sc, MII_BMCR, BMCR_S100|BMCR_AUTOEN|BMCR_FDX); +} Modified: stable/9/sys/modules/fxp/Makefile ============================================================================== --- stable/9/sys/modules/fxp/Makefile Sun Nov 6 17:20:44 2011 (r227228) +++ stable/9/sys/modules/fxp/Makefile Sun Nov 6 17:23:49 2011 (r227229) @@ -3,6 +3,6 @@ .PATH: ${.CURDIR}/../../dev/fxp KMOD= if_fxp -SRCS= if_fxp.c device_if.h bus_if.h pci_if.h miibus_if.h +SRCS= device_if.h bus_if.h if_fxp.c inphy.c miibus_if.h miidevs.h pci_if.h .include Modified: stable/9/sys/modules/mii/Makefile ============================================================================== --- stable/9/sys/modules/mii/Makefile Sun Nov 6 17:20:44 2011 (r227228) +++ stable/9/sys/modules/mii/Makefile Sun Nov 6 17:23:49 2011 (r227229) @@ -5,10 +5,10 @@ KMOD= miibus SRCS= acphy.c amphy.c atphy.c axphy.c bmtphy.c brgphy.c bus_if.h SRCS+= ciphy.c device_if.h -SRCS+= e1000phy.c exphy.c gentbi.c icsphy.c inphy.c ip1000phy.c jmphy.c +SRCS+= e1000phy.c gentbi.c icsphy.c ip1000phy.c jmphy.c SRCS+= lxtphy.c miibus_if.c miibus_if.h mii.c miidevs.h mii_physubr.c SRCS+= mlphy.c nsgphy.c nsphy.c nsphyter.c pci_if.h pnaphy.c qsphy.c -SRCS+= rdcphy.c rgephy.c rlphy.c ruephy.c tdkphy.c tlphy.c truephy.c +SRCS+= rdcphy.c rgephy.c rlphy.c tdkphy.c tlphy.c truephy.c SRCS+= ukphy.c ukphy_subr.c SRCS+= xmphy.c Modified: stable/9/sys/modules/usb/rue/Makefile ============================================================================== --- stable/9/sys/modules/usb/rue/Makefile Sun Nov 6 17:20:44 2011 (r227228) +++ stable/9/sys/modules/usb/rue/Makefile Sun Nov 6 17:23:49 2011 (r227229) @@ -30,8 +30,7 @@ S= ${.CURDIR}/../../.. .PATH: $S/dev/usb/net KMOD= if_rue -SRCS= opt_bus.h opt_usb.h device_if.h bus_if.h usb_if.h usbdevs.h \ - miibus_if.h opt_inet.h \ - if_rue.c +SRCS= bus_if.h device_if.h miibus_if.h miidevs.h if_rue.c opt_bus.h +SRCS+= opt_inet.h opt_usb.h ruephy.c usb_if.h usbdevs.h .include Modified: stable/9/sys/modules/xl/Makefile ============================================================================== --- stable/9/sys/modules/xl/Makefile Sun Nov 6 17:20:44 2011 (r227228) +++ stable/9/sys/modules/xl/Makefile Sun Nov 6 17:23:49 2011 (r227229) @@ -3,7 +3,6 @@ .PATH: ${.CURDIR}/../../dev/xl KMOD= if_xl -SRCS= if_xl.c device_if.h bus_if.h pci_if.h -SRCS+= miibus_if.h +SRCS= bus_if.h device_if.h if_xl.c miibus_if.h miidevs.h pci_if.h xlphy.c .include From owner-svn-src-stable@FreeBSD.ORG Sun Nov 6 17:25:23 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 51C5D1065670; Sun, 6 Nov 2011 17:25:23 +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 4142C8FC1A; Sun, 6 Nov 2011 17:25:23 +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 pA6HPNqZ032664; Sun, 6 Nov 2011 17:25:23 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA6HPNgS032662; Sun, 6 Nov 2011 17:25:23 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201111061725.pA6HPNgS032662@svn.freebsd.org> From: Marius Strobl Date: Sun, 6 Nov 2011 17:25:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227230 - stable/9/sys/dev/mpt X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Nov 2011 17:25:23 -0000 Author: marius Date: Sun Nov 6 17:25:22 2011 New Revision: 227230 URL: http://svn.freebsd.org/changeset/base/227230 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 Approved by: re (kib) Modified: stable/9/sys/dev/mpt/mpt.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/dev/mpt/mpt.c ============================================================================== --- stable/9/sys/dev/mpt/mpt.c Sun Nov 6 17:23:49 2011 (r227229) +++ stable/9/sys/dev/mpt/mpt.c Sun Nov 6 17:25:22 2011 (r227230) @@ -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@FreeBSD.ORG Sun Nov 6 17:31:57 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A5AEE1065672; Sun, 6 Nov 2011 17:31:57 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 93DFF8FC1A; Sun, 6 Nov 2011 17:31:57 +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 pA6HVvPK032995; Sun, 6 Nov 2011 17:31:57 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA6HVvgW032986; Sun, 6 Nov 2011 17:31:57 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201111061731.pA6HVvgW032986@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sun, 6 Nov 2011 17:31:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227232 - in stable/9/sys: modules modules/ipfw netinet/ipfw X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Nov 2011 17:31:57 -0000 Author: bz Date: Sun Nov 6 17:31:57 2011 New Revision: 227232 URL: http://svn.freebsd.org/changeset/base/227232 Log: MFC r227085: Always use the opt_*.h options for ipfw.ko, not just when compiled into the kernel. Do not try to build the module in case of no INET support but keep #error calls for now in case we would compile it into the kernel. This should fix an issue where the module would fail to enable IPv6 support from the rc framework, but also other INET and INET6 parts being silently compiled out without giving a warning in the module case. While here garbage collect unneeded opt_*.h includes. opt_ipdn.h is not used anywhere but we need to leave the DUMMYNET entry in options for conditional inclusion in kernel so keep the file with the same name. Reported by: pluknet Reviewed by: plunket, jhb Approved by: re (kib) Modified: stable/9/sys/modules/Makefile stable/9/sys/modules/ipfw/Makefile stable/9/sys/netinet/ipfw/ip_fw2.c stable/9/sys/netinet/ipfw/ip_fw_dynamic.c stable/9/sys/netinet/ipfw/ip_fw_log.c stable/9/sys/netinet/ipfw/ip_fw_pfil.c stable/9/sys/netinet/ipfw/ip_fw_sockopt.c stable/9/sys/netinet/ipfw/ip_fw_table.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/modules/Makefile ============================================================================== --- stable/9/sys/modules/Makefile Sun Nov 6 17:30:32 2011 (r227231) +++ stable/9/sys/modules/Makefile Sun Nov 6 17:31:57 2011 (r227232) @@ -136,7 +136,7 @@ SUBDIR= ${_3dfx} \ ${_io} \ ipdivert \ ${_ipfilter} \ - ipfw \ + ${_ipfw} \ ipfw_nat \ ${_ipmi} \ ip_mroute_mod \ @@ -377,6 +377,10 @@ _if_carp= if_carp _ipfilter= ipfilter .endif +.if ${MK_INET_SUPPORT} != "no" || defined(ALL_MODULES) +_ipfw= ipfw +.endif + .if ${MK_NETGRAPH} != "no" || defined(ALL_MODULES) _netgraph= netgraph .endif Modified: stable/9/sys/modules/ipfw/Makefile ============================================================================== --- stable/9/sys/modules/ipfw/Makefile Sun Nov 6 17:30:32 2011 (r227231) +++ stable/9/sys/modules/ipfw/Makefile Sun Nov 6 17:31:57 2011 (r227232) @@ -8,7 +8,7 @@ KMOD= ipfw SRCS= ip_fw2.c ip_fw_pfil.c SRCS+= ip_fw_dynamic.c ip_fw_log.c SRCS+= ip_fw_sockopt.c ip_fw_table.c -SRCS+= opt_inet.h opt_inet6.h opt_ipfw.h opt_ipsec.h +SRCS+= opt_inet.h opt_inet6.h opt_ipdivert.h opt_ipfw.h opt_ipsec.h CFLAGS+= -DIPFIREWALL CFLAGS+= -I${.CURDIR}/../../contrib/pf Modified: stable/9/sys/netinet/ipfw/ip_fw2.c ============================================================================== --- stable/9/sys/netinet/ipfw/ip_fw2.c Sun Nov 6 17:30:32 2011 (r227231) +++ stable/9/sys/netinet/ipfw/ip_fw2.c Sun Nov 6 17:31:57 2011 (r227232) @@ -31,14 +31,11 @@ __FBSDID("$FreeBSD$"); */ #include "opt_ipfw.h" -#if !defined(KLD_MODULE) #include "opt_ipdivert.h" -#include "opt_ipdn.h" #include "opt_inet.h" #ifndef INET #error IPFIREWALL requires INET. #endif /* INET */ -#endif #include "opt_inet6.h" #include "opt_ipsec.h" Modified: stable/9/sys/netinet/ipfw/ip_fw_dynamic.c ============================================================================== --- stable/9/sys/netinet/ipfw/ip_fw_dynamic.c Sun Nov 6 17:30:32 2011 (r227231) +++ stable/9/sys/netinet/ipfw/ip_fw_dynamic.c Sun Nov 6 17:31:57 2011 (r227232) @@ -34,16 +34,11 @@ __FBSDID("$FreeBSD$"); */ #include "opt_ipfw.h" -#if !defined(KLD_MODULE) -#include "opt_ipdivert.h" -#include "opt_ipdn.h" #include "opt_inet.h" #ifndef INET #error IPFIREWALL requires INET. #endif /* INET */ -#endif #include "opt_inet6.h" -#include "opt_ipsec.h" #include #include Modified: stable/9/sys/netinet/ipfw/ip_fw_log.c ============================================================================== --- stable/9/sys/netinet/ipfw/ip_fw_log.c Sun Nov 6 17:30:32 2011 (r227231) +++ stable/9/sys/netinet/ipfw/ip_fw_log.c Sun Nov 6 17:31:57 2011 (r227232) @@ -31,16 +31,11 @@ __FBSDID("$FreeBSD$"); */ #include "opt_ipfw.h" -#if !defined(KLD_MODULE) -#include "opt_ipdivert.h" -#include "opt_ipdn.h" #include "opt_inet.h" #ifndef INET #error IPFIREWALL requires INET. #endif /* INET */ -#endif #include "opt_inet6.h" -#include "opt_ipsec.h" #include #include Modified: stable/9/sys/netinet/ipfw/ip_fw_pfil.c ============================================================================== --- stable/9/sys/netinet/ipfw/ip_fw_pfil.c Sun Nov 6 17:30:32 2011 (r227231) +++ stable/9/sys/netinet/ipfw/ip_fw_pfil.c Sun Nov 6 17:31:57 2011 (r227232) @@ -28,14 +28,11 @@ __FBSDID("$FreeBSD$"); #include "opt_ipfw.h" -#if !defined(KLD_MODULE) -#include "opt_ipdn.h" #include "opt_inet.h" #include "opt_inet6.h" #ifndef INET #error IPFIREWALL requires INET. #endif /* INET */ -#endif /* KLD_MODULE */ #include #include Modified: stable/9/sys/netinet/ipfw/ip_fw_sockopt.c ============================================================================== --- stable/9/sys/netinet/ipfw/ip_fw_sockopt.c Sun Nov 6 17:30:32 2011 (r227231) +++ stable/9/sys/netinet/ipfw/ip_fw_sockopt.c Sun Nov 6 17:31:57 2011 (r227232) @@ -34,16 +34,11 @@ __FBSDID("$FreeBSD$"); */ #include "opt_ipfw.h" -#if !defined(KLD_MODULE) -#include "opt_ipdivert.h" -#include "opt_ipdn.h" #include "opt_inet.h" #ifndef INET #error IPFIREWALL requires INET. #endif /* INET */ -#endif #include "opt_inet6.h" -#include "opt_ipsec.h" #include #include Modified: stable/9/sys/netinet/ipfw/ip_fw_table.c ============================================================================== --- stable/9/sys/netinet/ipfw/ip_fw_table.c Sun Nov 6 17:30:32 2011 (r227231) +++ stable/9/sys/netinet/ipfw/ip_fw_table.c Sun Nov 6 17:31:57 2011 (r227232) @@ -40,16 +40,11 @@ __FBSDID("$FreeBSD$"); */ #include "opt_ipfw.h" -#if !defined(KLD_MODULE) -#include "opt_ipdivert.h" -#include "opt_ipdn.h" #include "opt_inet.h" #ifndef INET #error IPFIREWALL requires INET. #endif /* INET */ -#endif #include "opt_inet6.h" -#include "opt_ipsec.h" #include #include From owner-svn-src-stable@FreeBSD.ORG Sun Nov 6 19:47:45 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B9A6E106566C; Sun, 6 Nov 2011 19:47:45 +0000 (UTC) (envelope-from marius@alchemy.franken.de) Received: from alchemy.franken.de (alchemy.franken.de [194.94.249.214]) by mx1.freebsd.org (Postfix) with ESMTP id 4F9DF8FC1E; Sun, 6 Nov 2011 19:47:44 +0000 (UTC) Received: from alchemy.franken.de (localhost [127.0.0.1]) by alchemy.franken.de (8.14.4/8.14.4/ALCHEMY.FRANKEN.DE) with ESMTP id pA6Jlh4p084174; Sun, 6 Nov 2011 20:47:44 +0100 (CET) (envelope-from marius@alchemy.franken.de) Received: (from marius@localhost) by alchemy.franken.de (8.14.4/8.14.4/Submit) id pA6JlhGJ084173; Sun, 6 Nov 2011 20:47:43 +0100 (CET) (envelope-from marius) Date: Sun, 6 Nov 2011 20:47:43 +0100 From: Marius Strobl To: Hans Petter Selasky Message-ID: <20111106194743.GD56603@alchemy.franken.de> References: <201111061513.pA6FD25t027285@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201111061513.pA6FD25t027285@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-8@freebsd.org Subject: Re: svn commit: r227217 - stable/8/sys/dev/usb X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Nov 2011 19:47:45 -0000 On Sun, Nov 06, 2011 at 03:13:02PM +0000, Hans Petter Selasky wrote: > Author: hselasky > Date: Sun Nov 6 15:13:01 2011 > New Revision: 227217 > URL: http://svn.freebsd.org/changeset/base/227217 > > Log: > MFC r227075: > Fix for panic at USB controller attach failure during cold boot. > > Modified: > stable/8/sys/dev/usb/usb_process.c > Directory Properties: > stable/8/sys/ (props changed) > stable/8/sys/amd64/include/xen/ (props changed) > stable/8/sys/cddl/contrib/opensolaris/ (props changed) > stable/8/sys/contrib/dev/acpica/ (props changed) > stable/8/sys/contrib/pf/ (props changed) > > Modified: stable/8/sys/dev/usb/usb_process.c > ============================================================================== > --- stable/8/sys/dev/usb/usb_process.c Sun Nov 6 15:06:04 2011 (r227216) > +++ stable/8/sys/dev/usb/usb_process.c Sun Nov 6 15:13:01 2011 (r227217) > @@ -67,11 +67,13 @@ static int usb_pcount; > #define USB_THREAD_CREATE(f, s, p, ...) \ > kproc_kthread_add((f), (s), &usbproc, (p), RFHIGHPID, \ > 0, "usb", __VA_ARGS__) > +#define USB_THREAD_SUSPEND_CHECK() kthread_suspend_check() In stable/8 kthread_suspend_check(9) takes an struct thread * argument. Marius From owner-svn-src-stable@FreeBSD.ORG Sun Nov 6 19:57:15 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 013C11065672; Sun, 6 Nov 2011 19:57:15 +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 E4BCE8FC1D; Sun, 6 Nov 2011 19:57:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pA6JvEgW039056; Sun, 6 Nov 2011 19:57:14 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA6JvEKL039054; Sun, 6 Nov 2011 19:57:14 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201111061957.pA6JvEKL039054@svn.freebsd.org> From: Marius Strobl Date: Sun, 6 Nov 2011 19:57:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227264 - stable/8/sys/dev/mpt X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Nov 2011 19:57:15 -0000 Author: marius Date: Sun Nov 6 19:57:14 2011 New Revision: 227264 URL: http://svn.freebsd.org/changeset/base/227264 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/8/sys/dev/mpt/mpt.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/mpt/mpt.c ============================================================================== --- stable/8/sys/dev/mpt/mpt.c Sun Nov 6 19:05:42 2011 (r227263) +++ stable/8/sys/dev/mpt/mpt.c Sun Nov 6 19:57:14 2011 (r227264) @@ -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@FreeBSD.ORG Sun Nov 6 19:57:17 2011 Return-Path: Delivered-To: svn-src-stable@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@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the 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@FreeBSD.ORG Sun Nov 6 20:29:18 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BCD88106566C; Sun, 6 Nov 2011 20:29:18 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A30BF8FC16; Sun, 6 Nov 2011 20:29: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 pA6KTImL040369; Sun, 6 Nov 2011 20:29:18 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA6KTIDt040363; Sun, 6 Nov 2011 20:29:18 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201111062029.pA6KTIDt040363@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sun, 6 Nov 2011 20:29:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227268 - in stable/9: share/man/man4 sys/conf sys/dev/qlxgb sys/modules sys/modules/qlxgb X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Nov 2011 20:29:18 -0000 Author: bz Date: Sun Nov 6 20:29:18 2011 New Revision: 227268 URL: http://svn.freebsd.org/changeset/base/227268 Log: MFC r227064: Add QLogic 10 Gigabit Ethernet & CNA Adapter Driver version 1.30 for 3200 and 8200 series cards. Submitted by: David C Somayajulu (david.somayajulu@qlogic.com), Qlogic Corporation Approved by: re (kib) Added: stable/9/share/man/man4/qlxgb.4 - copied, changed from r227064, head/share/man/man4/qlxgb.4 stable/9/sys/dev/qlxgb/ - copied from r227064, head/sys/dev/qlxgb/ stable/9/sys/modules/qlxgb/ - copied from r227064, head/sys/modules/qlxgb/ Modified: stable/9/share/man/man4/Makefile stable/9/sys/conf/files.amd64 stable/9/sys/modules/Makefile Directory Properties: stable/9/share/man/man4/ (props changed) stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/share/man/man4/Makefile ============================================================================== --- stable/9/share/man/man4/Makefile Sun Nov 6 20:16:50 2011 (r227267) +++ stable/9/share/man/man4/Makefile Sun Nov 6 20:29:18 2011 (r227268) @@ -347,6 +347,7 @@ MAN= aac.4 \ pts.4 \ pty.4 \ puc.4 \ + ${_qlxgb.4} \ ral.4 \ random.4 \ rc.4 \ @@ -713,6 +714,10 @@ _xen.4= xen.4 MLINKS+=lindev.4 full.4 .endif +.if ${MACHINE_CPUARCH} == "amd64" +_qlxgb.4= qlxgb.4 +.endif + .if ${MACHINE_CPUARCH} == "powerpc" _atp.4= atp.4 .endif Copied and modified: stable/9/share/man/man4/qlxgb.4 (from r227064, head/share/man/man4/qlxgb.4) ============================================================================== --- head/share/man/man4/qlxgb.4 Thu Nov 3 21:20:22 2011 (r227064, copy source) +++ stable/9/share/man/man4/qlxgb.4 Sun Nov 6 20:29:18 2011 (r227268) @@ -83,7 +83,7 @@ or by E-mail at The .Nm device driver first appeared in -.Fx 10.0 . +.Fx 9.0 . .Sh AUTHORS .An -nosplit The Modified: stable/9/sys/conf/files.amd64 ============================================================================== --- stable/9/sys/conf/files.amd64 Sun Nov 6 20:16:50 2011 (r227267) +++ stable/9/sys/conf/files.amd64 Sun Nov 6 20:29:18 2011 (r227268) @@ -208,6 +208,12 @@ dev/lindev/lindev.c optional lindev dev/nfe/if_nfe.c optional nfe pci dev/nve/if_nve.c optional nve pci dev/nvram/nvram.c optional nvram isa +dev/qlxgb/qla_dbg.c optional qlxgb pci +dev/qlxgb/qla_hw.c optional qlxgb pci +dev/qlxgb/qla_ioctl.c optional qlxgb pci +dev/qlxgb/qla_isr.c optional qlxgb pci +dev/qlxgb/qla_misc.c optional qlxgb pci +dev/qlxgb/qla_os.c optional qlxgb pci dev/sio/sio.c optional sio dev/sio/sio_isa.c optional sio isa dev/sio/sio_pccard.c optional sio pccard Modified: stable/9/sys/modules/Makefile ============================================================================== --- stable/9/sys/modules/Makefile Sun Nov 6 20:16:50 2011 (r227267) +++ stable/9/sys/modules/Makefile Sun Nov 6 20:29:18 2011 (r227268) @@ -254,6 +254,7 @@ SUBDIR= ${_3dfx} \ ${_pst} \ pty \ puc \ + ${_qlxgb} \ ral \ ralfw \ ${_random} \ @@ -620,6 +621,7 @@ _opensolaris= opensolaris _padlock= padlock .endif _pccard= pccard +_qlxgb= qlxgb _rdma= rdma _s3= s3 _safe= safe From owner-svn-src-stable@FreeBSD.ORG Sun Nov 6 20:38:02 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AC468106566C; Sun, 6 Nov 2011 20:38:02 +0000 (UTC) (envelope-from marius@alchemy.franken.de) Received: from alchemy.franken.de (alchemy.franken.de [194.94.249.214]) by mx1.freebsd.org (Postfix) with ESMTP id 29EA48FC12; Sun, 6 Nov 2011 20:38:01 +0000 (UTC) Received: from alchemy.franken.de (localhost [127.0.0.1]) by alchemy.franken.de (8.14.4/8.14.4/ALCHEMY.FRANKEN.DE) with ESMTP id pA6Kc0Dl084442; Sun, 6 Nov 2011 21:38:00 +0100 (CET) (envelope-from marius@alchemy.franken.de) Received: (from marius@localhost) by alchemy.franken.de (8.14.4/8.14.4/Submit) id pA6Kc0t0084441; Sun, 6 Nov 2011 21:38:00 +0100 (CET) (envelope-from marius) Date: Sun, 6 Nov 2011 21:38:00 +0100 From: Marius Strobl To: Hans Petter Selasky Message-ID: <20111106203800.GE56603@alchemy.franken.de> References: <201111061513.pA6FD25t027285@svn.freebsd.org> <20111106194743.GD56603@alchemy.franken.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20111106194743.GD56603@alchemy.franken.de> User-Agent: Mutt/1.4.2.3i Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-8@freebsd.org Subject: Re: svn commit: r227217 - stable/8/sys/dev/usb X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Nov 2011 20:38:02 -0000 On Sun, Nov 06, 2011 at 08:47:43PM +0100, Marius Strobl wrote: > On Sun, Nov 06, 2011 at 03:13:02PM +0000, Hans Petter Selasky wrote: > > Author: hselasky > > Date: Sun Nov 6 15:13:01 2011 > > New Revision: 227217 > > URL: http://svn.freebsd.org/changeset/base/227217 > > > > Log: > > MFC r227075: > > Fix for panic at USB controller attach failure during cold boot. > > > > Modified: > > stable/8/sys/dev/usb/usb_process.c > > Directory Properties: > > stable/8/sys/ (props changed) > > stable/8/sys/amd64/include/xen/ (props changed) > > stable/8/sys/cddl/contrib/opensolaris/ (props changed) > > stable/8/sys/contrib/dev/acpica/ (props changed) > > stable/8/sys/contrib/pf/ (props changed) > > > > Modified: stable/8/sys/dev/usb/usb_process.c > > ============================================================================== > > --- stable/8/sys/dev/usb/usb_process.c Sun Nov 6 15:06:04 2011 (r227216) > > +++ stable/8/sys/dev/usb/usb_process.c Sun Nov 6 15:13:01 2011 (r227217) > > @@ -67,11 +67,13 @@ static int usb_pcount; > > #define USB_THREAD_CREATE(f, s, p, ...) \ > > kproc_kthread_add((f), (s), &usbproc, (p), RFHIGHPID, \ > > 0, "usb", __VA_ARGS__) > > +#define USB_THREAD_SUSPEND_CHECK() kthread_suspend_check() > > In stable/8 kthread_suspend_check(9) takes an struct thread * argument. > Sorry, I didn't look closely enough, it probably should use the same approach as hptmv(4): #if (__FreeBSD_version >= 800002) kproc_suspend_check(curproc); #elif (__FreeBSD_version >= 500043) kthread_suspend_check(curproc); #else kproc_suspend_loop(curproc); #endif In any case, r227217 broke kernel compilation of stable/8. Marius From owner-svn-src-stable@FreeBSD.ORG Sun Nov 6 21:09:10 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F0429106564A; Sun, 6 Nov 2011 21:09:10 +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 DC6A98FC13; Sun, 6 Nov 2011 21:09:10 +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 pA6L9Axn042017; Sun, 6 Nov 2011 21:09:10 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA6L9AE3042004; Sun, 6 Nov 2011 21:09:10 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201111062109.pA6L9AE3042004@svn.freebsd.org> From: Marius Strobl Date: Sun, 6 Nov 2011 21:09:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227277 - in stable/9/sys: arm/conf conf dev/bm dev/dc dev/mii dev/nge dev/sis dev/smc dev/ste dev/stge dev/tl dev/wb dev/xl modules/mii pci X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Nov 2011 21:09:11 -0000 Author: marius Date: Sun Nov 6 21:09:10 2011 New Revision: 227277 URL: http://svn.freebsd.org/changeset/base/227277 Log: MFC: r226995, 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) Approved by: re (kib) Obtained from: NetBSD (partially) Added: stable/9/sys/dev/mii/mii_bitbang.c - copied unchanged from r226995, head/sys/dev/mii/mii_bitbang.c stable/9/sys/dev/mii/mii_bitbang.h - copied unchanged from r226995, head/sys/dev/mii/mii_bitbang.h Modified: stable/9/sys/arm/conf/GUMSTIX stable/9/sys/conf/NOTES stable/9/sys/conf/files stable/9/sys/dev/bm/if_bm.c stable/9/sys/dev/bm/if_bmreg.h stable/9/sys/dev/bm/if_bmvar.h stable/9/sys/dev/dc/if_dc.c stable/9/sys/dev/dc/if_dcreg.h stable/9/sys/dev/nge/if_nge.c stable/9/sys/dev/nge/if_ngereg.h stable/9/sys/dev/sis/if_sis.c stable/9/sys/dev/sis/if_sisreg.h stable/9/sys/dev/smc/if_smc.c stable/9/sys/dev/ste/if_ste.c stable/9/sys/dev/ste/if_stereg.h stable/9/sys/dev/stge/if_stge.c stable/9/sys/dev/stge/if_stgereg.h stable/9/sys/dev/tl/if_tl.c stable/9/sys/dev/tl/if_tlreg.h stable/9/sys/dev/wb/if_wb.c stable/9/sys/dev/wb/if_wbreg.h stable/9/sys/dev/xl/if_xl.c stable/9/sys/dev/xl/if_xlreg.h stable/9/sys/modules/mii/Makefile stable/9/sys/pci/if_rl.c stable/9/sys/pci/if_rlreg.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/arm/conf/GUMSTIX ============================================================================== --- stable/9/sys/arm/conf/GUMSTIX Sun Nov 6 20:59:07 2011 (r227276) +++ stable/9/sys/arm/conf/GUMSTIX Sun Nov 6 21:09:10 2011 (r227277) @@ -70,6 +70,7 @@ options PREEMPTION device loop device ether device mii +device mii_bitbang device smc device smcphy device uart Modified: stable/9/sys/conf/NOTES ============================================================================== --- stable/9/sys/conf/NOTES Sun Nov 6 20:59:07 2011 (r227276) +++ stable/9/sys/conf/NOTES Sun Nov 6 21:09:10 2011 (r227277) @@ -1846,13 +1846,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/9/sys/conf/files ============================================================================== --- stable/9/sys/conf/files Sun Nov 6 20:59:07 2011 (r227276) +++ stable/9/sys/conf/files Sun Nov 6 21:09:10 2011 (r227277) @@ -1425,6 +1425,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/9/sys/dev/bm/if_bm.c ============================================================================== --- stable/9/sys/dev/bm/if_bm.c Sun Nov 6 20:59:07 2011 (r227276) +++ stable/9/sys/dev/bm/if_bm.c Sun Nov 6 21:09:10 2011 (r227277) @@ -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/9/sys/dev/bm/if_bmreg.h ============================================================================== --- stable/9/sys/dev/bm/if_bmreg.h Sun Nov 6 20:59:07 2011 (r227276) +++ stable/9/sys/dev/bm/if_bmreg.h Sun Nov 6 21:09:10 2011 (r227277) @@ -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/9/sys/dev/bm/if_bmvar.h ============================================================================== --- stable/9/sys/dev/bm/if_bmvar.h Sun Nov 6 20:59:07 2011 (r227276) +++ stable/9/sys/dev/bm/if_bmvar.h Sun Nov 6 21:09:10 2011 (r227277) @@ -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/9/sys/dev/dc/if_dc.c ============================================================================== --- stable/9/sys/dev/dc/if_dc.c Sun Nov 6 20:59:07 2011 (r227276) +++ stable/9/sys/dev/dc/if_dc.c Sun Nov 6 21:09:10 2011 (r227277) @@ -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 @@ -605,185 +618,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)) { @@ -858,34 +731,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 | @@ -931,15 +799,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/9/sys/dev/dc/if_dcreg.h ============================================================================== --- stable/9/sys/dev/dc/if_dcreg.h Sun Nov 6 20:59:07 2011 (r227276) +++ stable/9/sys/dev/dc/if_dcreg.h Sun Nov 6 21:09:10 2011 (r227277) @@ -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/9/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/9/sys/dev/mii/mii_bitbang.c Sun Nov 6 21:09:10 2011 (r227277, 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/9/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/9/sys/dev/mii/mii_bitbang.h Sun Nov 6 21:09:10 2011 (r227277, 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/9/sys/dev/nge/if_nge.c ============================================================================== --- stable/9/sys/dev/nge/if_nge.c Sun Nov 6 20:59:07 2011 (r227276) +++ stable/9/sys/dev/nge/if_nge.c Sun Nov 6 21:09:10 2011 (r227277) @@ -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 + */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@FreeBSD.ORG Sun Nov 6 21:09:24 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 48B9F106564A; Sun, 6 Nov 2011 21:09:24 +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 34E7A8FC0C; Sun, 6 Nov 2011 21:09:24 +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 pA6L9O37042073; Sun, 6 Nov 2011 21:09:24 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA6L9OLV042060; Sun, 6 Nov 2011 21:09:24 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201111062109.pA6L9OLV042060@svn.freebsd.org> From: Marius Strobl Date: Sun, 6 Nov 2011 21:09:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227278 - in stable/8/sys: arm/conf conf dev/bm dev/dc dev/mii dev/nge dev/sis dev/smc dev/ste dev/stge dev/tl dev/wb dev/xl modules/mii pci X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Nov 2011 21:09:24 -0000 Author: marius Date: Sun Nov 6 21:09:23 2011 New Revision: 227278 URL: http://svn.freebsd.org/changeset/base/227278 Log: MFC: r226995, 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/8/sys/dev/mii/mii_bitbang.c - copied unchanged from r226995, head/sys/dev/mii/mii_bitbang.c stable/8/sys/dev/mii/mii_bitbang.h - copied unchanged from r226995, head/sys/dev/mii/mii_bitbang.h Modified: stable/8/sys/arm/conf/GUMSTIX stable/8/sys/conf/NOTES stable/8/sys/conf/files stable/8/sys/dev/bm/if_bm.c stable/8/sys/dev/bm/if_bmreg.h stable/8/sys/dev/bm/if_bmvar.h stable/8/sys/dev/dc/if_dc.c stable/8/sys/dev/dc/if_dcreg.h stable/8/sys/dev/nge/if_nge.c stable/8/sys/dev/nge/if_ngereg.h stable/8/sys/dev/sis/if_sis.c stable/8/sys/dev/sis/if_sisreg.h stable/8/sys/dev/smc/if_smc.c stable/8/sys/dev/ste/if_ste.c stable/8/sys/dev/ste/if_stereg.h stable/8/sys/dev/stge/if_stge.c stable/8/sys/dev/stge/if_stgereg.h stable/8/sys/dev/tl/if_tl.c stable/8/sys/dev/tl/if_tlreg.h stable/8/sys/dev/wb/if_wb.c stable/8/sys/dev/wb/if_wbreg.h stable/8/sys/dev/xl/if_xl.c stable/8/sys/dev/xl/if_xlreg.h stable/8/sys/modules/mii/Makefile stable/8/sys/pci/if_rl.c stable/8/sys/pci/if_rlreg.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/arm/conf/GUMSTIX ============================================================================== --- stable/8/sys/arm/conf/GUMSTIX Sun Nov 6 21:09:10 2011 (r227277) +++ stable/8/sys/arm/conf/GUMSTIX Sun Nov 6 21:09:23 2011 (r227278) @@ -72,6 +72,7 @@ options PREEMPTION device loop device ether device mii +device mii_bitbang device smc device smcphy device uart Modified: stable/8/sys/conf/NOTES ============================================================================== --- stable/8/sys/conf/NOTES Sun Nov 6 21:09:10 2011 (r227277) +++ stable/8/sys/conf/NOTES Sun Nov 6 21:09:23 2011 (r227278) @@ -1819,13 +1819,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/8/sys/conf/files ============================================================================== --- stable/8/sys/conf/files Sun Nov 6 21:09:10 2011 (r227277) +++ stable/8/sys/conf/files Sun Nov 6 21:09:23 2011 (r227278) @@ -1309,6 +1309,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/8/sys/dev/bm/if_bm.c ============================================================================== --- stable/8/sys/dev/bm/if_bm.c Sun Nov 6 21:09:10 2011 (r227277) +++ stable/8/sys/dev/bm/if_bm.c Sun Nov 6 21:09:23 2011 (r227278) @@ -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/8/sys/dev/bm/if_bmreg.h ============================================================================== --- stable/8/sys/dev/bm/if_bmreg.h Sun Nov 6 21:09:10 2011 (r227277) +++ stable/8/sys/dev/bm/if_bmreg.h Sun Nov 6 21:09:23 2011 (r227278) @@ -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/8/sys/dev/bm/if_bmvar.h ============================================================================== --- stable/8/sys/dev/bm/if_bmvar.h Sun Nov 6 21:09:10 2011 (r227277) +++ stable/8/sys/dev/bm/if_bmvar.h Sun Nov 6 21:09:23 2011 (r227278) @@ -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/8/sys/dev/dc/if_dc.c ============================================================================== --- stable/8/sys/dev/dc/if_dc.c Sun Nov 6 21:09:10 2011 (r227277) +++ stable/8/sys/dev/dc/if_dc.c Sun Nov 6 21:09:23 2011 (r227278) @@ -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 @@ -605,185 +618,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)) { @@ -858,34 +731,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 | @@ -931,15 +799,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/8/sys/dev/dc/if_dcreg.h ============================================================================== --- stable/8/sys/dev/dc/if_dcreg.h Sun Nov 6 21:09:10 2011 (r227277) +++ stable/8/sys/dev/dc/if_dcreg.h Sun Nov 6 21:09:23 2011 (r227278) @@ -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/8/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/8/sys/dev/mii/mii_bitbang.c Sun Nov 6 21:09:23 2011 (r227278, 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/8/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/8/sys/dev/mii/mii_bitbang.h Sun Nov 6 21:09:23 2011 (r227278, 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/8/sys/dev/nge/if_nge.c ============================================================================== --- stable/8/sys/dev/nge/if_nge.c Sun Nov 6 21:09:10 2011 (r227277) +++ stable/8/sys/dev/nge/if_nge.c Sun Nov 6 21:09:23 2011 (r227278) @@ -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 + */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@FreeBSD.ORG Sun Nov 6 21:11:22 2011 Return-Path: Delivered-To: svn-src-stable@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@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the 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@FreeBSD.ORG Sun Nov 6 23:26:18 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 13946106566B; Sun, 6 Nov 2011 23:26:18 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe02.c2i.net [212.247.154.34]) by mx1.freebsd.org (Postfix) with ESMTP id 111788FC13; Sun, 6 Nov 2011 23:26:16 +0000 (UTC) X-T2-Spam-Status: No, hits=-1.0 required=5.0 tests=ALL_TRUSTED, BAYES_20 Received: from [188.126.198.129] (account mc467741@c2i.net HELO laptop002.hselasky.homeunix.org) by mailfe02.swip.net (CommuniGate Pro SMTP 5.2.19) with ESMTPA id 201163649; Mon, 07 Nov 2011 00:16:11 +0100 From: Hans Petter Selasky To: Marius Strobl Date: Mon, 7 Nov 2011 00:13:09 +0100 User-Agent: KMail/1.13.5 (FreeBSD/8.2-STABLE; KDE/4.4.5; amd64; ; ) References: <20111106194743.GD56603@alchemy.franken.de> <20111106203800.GE56603@alchemy.franken.de> In-Reply-To: <20111106203800.GE56603@alchemy.franken.de> X-Face: *nPdTl_}RuAI6^PVpA02T?$%Xa^>@hE0uyUIoiha$pC:9TVgl.Oq, NwSZ4V"|LR.+tj}g5 %V,x^qOs~mnU3]Gn; cQLv&.N>TrxmSFf+p6(30a/{)KUU!s}w\IhQBj}[g}bj0I3^glmC( :AuzV9:.hESm-x4h240C`9=w MIME-Version: 1.0 Content-Type: Text/Plain; charset="windows-1252" Content-Transfer-Encoding: 7bit Message-Id: <201111070013.09627.hselasky@c2i.net> Cc: "svn-src-stable@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" , "svn-src-stable-8@freebsd.org" Subject: Re: svn commit: r227217 - stable/8/sys/dev/usb X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Nov 2011 23:26:18 -0000 On Sunday 06 November 2011 21:38:00 Marius Strobl wrote: > On Sun, Nov 06, 2011 at 08:47:43PM +0100, Marius Strobl wrote: > > On Sun, Nov 06, 2011 at 03:13:02PM +0000, Hans Petter Selasky wrote: > > > Author: hselasky > > > Date: Sun Nov 6 15:13:01 2011 > > > New Revision: 227217 > > > URL: http://svn.freebsd.org/changeset/base/227217 > > > > > > Log: > > > MFC r227075: > > > Fix for panic at USB controller attach failure during cold boot. > > > > > > Modified: > > > stable/8/sys/dev/usb/usb_process.c > > > > > > Directory Properties: > > > stable/8/sys/ (props changed) > > > stable/8/sys/amd64/include/xen/ (props changed) > > > stable/8/sys/cddl/contrib/opensolaris/ (props changed) > > > stable/8/sys/contrib/dev/acpica/ (props changed) > > > stable/8/sys/contrib/pf/ (props changed) > > > > > > Modified: stable/8/sys/dev/usb/usb_process.c > > > ======================================================================= > > > ======= --- stable/8/sys/dev/usb/usb_process.c Sun Nov 6 15:06:04 > > > 2011 (r227216) +++ stable/8/sys/dev/usb/usb_process.c Sun Nov 6 > > > 15:13:01 2011 (r227217) @@ -67,11 +67,13 @@ static int usb_pcount; > > > > > > #define USB_THREAD_CREATE(f, s, p, ...) \ > > > > > > kproc_kthread_add((f), (s), &usbproc, (p), RFHIGHPID, \ > > > > > > 0, "usb", __VA_ARGS__) > > > > > > +#define USB_THREAD_SUSPEND_CHECK() kthread_suspend_check() > > > > In stable/8 kthread_suspend_check(9) takes an struct thread * argument. > > Sorry, I didn't look closely enough, it probably should use the same > approach as hptmv(4): > #if (__FreeBSD_version >= 800002) > kproc_suspend_check(curproc); > #elif (__FreeBSD_version >= 500043) > kthread_suspend_check(curproc); > #else > kproc_suspend_loop(curproc); > #endif > > In any case, r227217 broke kernel compilation of stable/8. Hi, I'll fix this ASAP. Sorry for the inconvenience. --HPS From owner-svn-src-stable@FreeBSD.ORG Sun Nov 6 23:34:41 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 00BA3106564A; Sun, 6 Nov 2011 23:34:41 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E47658FC16; Sun, 6 Nov 2011 23:34:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pA6NYeig047296; Sun, 6 Nov 2011 23:34:40 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA6NYevj047294; Sun, 6 Nov 2011 23:34:40 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201111062334.pA6NYevj047294@svn.freebsd.org> From: Hans Petter Selasky Date: Sun, 6 Nov 2011 23:34:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227287 - stable/8/sys/dev/usb X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Nov 2011 23:34:41 -0000 Author: hselasky Date: Sun Nov 6 23:34:40 2011 New Revision: 227287 URL: http://svn.freebsd.org/changeset/base/227287 Log: MFC r227286: Fix kernel build breakage of 8-stable. Reported by: Marius Strobl Modified: stable/8/sys/dev/usb/usb_process.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/usb/usb_process.c ============================================================================== --- stable/8/sys/dev/usb/usb_process.c Sun Nov 6 23:26:26 2011 (r227286) +++ stable/8/sys/dev/usb/usb_process.c Sun Nov 6 23:34:40 2011 (r227287) @@ -67,13 +67,17 @@ static int usb_pcount; #define USB_THREAD_CREATE(f, s, p, ...) \ kproc_kthread_add((f), (s), &usbproc, (p), RFHIGHPID, \ 0, "usb", __VA_ARGS__) +#if (__FreeBSD_version >= 900000) #define USB_THREAD_SUSPEND_CHECK() kthread_suspend_check() +#else +#define USB_THREAD_SUSPEND_CHECK() kthread_suspend_check(curthread) +#endif #define USB_THREAD_SUSPEND(p) kthread_suspend(p,0) #define USB_THREAD_EXIT(err) kthread_exit() #else #define USB_THREAD_CREATE(f, s, p, ...) \ kthread_create((f), (s), (p), RFHIGHPID, 0, __VA_ARGS__) -#define USB_THREAD_SUSPEND_CHECK() kthread_suspend_check() +#define USB_THREAD_SUSPEND_CHECK() kthread_suspend_check(curproc) #define USB_THREAD_SUSPEND(p) kthread_suspend(p,0) #define USB_THREAD_EXIT(err) kthread_exit(err) #endif From owner-svn-src-stable@FreeBSD.ORG Mon Nov 7 02:32:03 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 17892106564A; Mon, 7 Nov 2011 02:32:03 +0000 (UTC) (envelope-from jhellenthal@gmail.com) Received: from mail-gx0-f182.google.com (mail-gx0-f182.google.com [209.85.161.182]) by mx1.freebsd.org (Postfix) with ESMTP id 6B3468FC08; Mon, 7 Nov 2011 02:32:02 +0000 (UTC) Received: by ggnk3 with SMTP id k3so4412297ggn.13 for ; Sun, 06 Nov 2011 18:32:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to; bh=bvibc8r+h1ipra5A7W3z8ZNrttK3eF0YA6Abia3h/Ns=; b=hzxhpNoU1E7lsOoyUFaWUIt1H3MGVDFuxgZ0Cea/efzbMA14wouLMtAqrYCsgWJV1L IlOFab2FtE4+G4jn6K2x3UYwXJMsyLklzTRwWeixL41OEOtkCDsLgHZne9FJB9Stj+zl JOhJ62AMhsLb7viVlVoU5Vr/uAeAzAaGsXvoQ= Received: by 10.42.151.4 with SMTP id c4mr41370036icw.39.1320631686201; Sun, 06 Nov 2011 18:08:06 -0800 (PST) Received: from DataIX.net (adsl-99-181-144-127.dsl.klmzmi.sbcglobal.net. [99.181.144.127]) by mx.google.com with ESMTPS id eh34sm35899551ibb.5.2011.11.06.18.08.03 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 06 Nov 2011 18:08:04 -0800 (PST) Sender: Jason Hellenthal Received: from DataIX.net (localhost.DataIX.local [127.0.0.1]) by DataIX.net (8.14.5/8.14.5) with ESMTP id pA7280Zn047640 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 6 Nov 2011 21:08:00 -0500 (EST) (envelope-from jhell@DataIX.net) Received: (from jhell@localhost) by DataIX.net (8.14.5/8.14.5/Submit) id pA727xeS047639; Sun, 6 Nov 2011 21:07:59 -0500 (EST) (envelope-from jhell@DataIX.net) Date: Sun, 6 Nov 2011 21:07:59 -0500 From: Jason Hellenthal To: Marius Strobl Message-ID: <20111107020759.GA45996@DataIX.net> References: <201111062109.pA6L9OLV042060@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="qMm9M+Fa2AknHoGS" Content-Disposition: inline In-Reply-To: <201111062109.pA6L9OLV042060@svn.freebsd.org> Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-8@freebsd.org Subject: Re: svn commit: r227278 - in stable/8/sys: arm/conf conf dev/bm dev/dc dev/mii dev/nge dev/sis dev/smc dev/ste dev/stge dev/tl dev/wb dev/xl modules/mii pci X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Nov 2011 02:32:03 -0000 --qMm9M+Fa2AknHoGS Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable The following commmit broke building without device miibus at least on i386. if_dc.o(.text+0x24b4): In function `dc_miibus_writereg': /usr/src/sys/dev/dc/if_dc.c:806: undefined reference to `mii_bitbang_writer= eg' if_dc.o(.text+0x26cc): In function `dc_miibus_readreg': /usr/src/sys/dev/dc/if_dc.c:743: undefined reference to `mii_bitbang_readre= g' If you try to use the modular device mii and the single *phy you will get t= he above error when it comes time to link the kernel. On Sun, Nov 06, 2011 at 09:09:24PM +0000, Marius Strobl wrote: > Author: marius > Date: Sun Nov 6 21:09:23 2011 > New Revision: 227278 > URL: http://svn.freebsd.org/changeset/base/227278 >=20 > Log: > MFC: r226995, r227042 > =20 > - Import the common MII bitbang'ing code from NetBSD and convert driver= s 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 otherwi= se 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 t= o the > same problem, also add bus barriers to the respective functions of sm= c(4), > tl(4) and xl(4). > - Sprinkle some const. > =20 > 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). > =20 > Reviewed by: yongari (subset of drivers) > Obtained from: NetBSD (partially) >=20 > Added: > stable/8/sys/dev/mii/mii_bitbang.c > - copied unchanged from r226995, head/sys/dev/mii/mii_bitbang.c > stable/8/sys/dev/mii/mii_bitbang.h > - copied unchanged from r226995, head/sys/dev/mii/mii_bitbang.h > Modified: > stable/8/sys/arm/conf/GUMSTIX > stable/8/sys/conf/NOTES > stable/8/sys/conf/files > stable/8/sys/dev/bm/if_bm.c > stable/8/sys/dev/bm/if_bmreg.h > stable/8/sys/dev/bm/if_bmvar.h > stable/8/sys/dev/dc/if_dc.c > stable/8/sys/dev/dc/if_dcreg.h > stable/8/sys/dev/nge/if_nge.c > stable/8/sys/dev/nge/if_ngereg.h > stable/8/sys/dev/sis/if_sis.c > stable/8/sys/dev/sis/if_sisreg.h > stable/8/sys/dev/smc/if_smc.c > stable/8/sys/dev/ste/if_ste.c > stable/8/sys/dev/ste/if_stereg.h > stable/8/sys/dev/stge/if_stge.c > stable/8/sys/dev/stge/if_stgereg.h > stable/8/sys/dev/tl/if_tl.c > stable/8/sys/dev/tl/if_tlreg.h > stable/8/sys/dev/wb/if_wb.c > stable/8/sys/dev/wb/if_wbreg.h > stable/8/sys/dev/xl/if_xl.c > stable/8/sys/dev/xl/if_xlreg.h > stable/8/sys/modules/mii/Makefile > stable/8/sys/pci/if_rl.c > stable/8/sys/pci/if_rlreg.h > Directory Properties: > stable/8/sys/ (props changed) > stable/8/sys/amd64/include/xen/ (props changed) > stable/8/sys/cddl/contrib/opensolaris/ (props changed) > stable/8/sys/contrib/dev/acpica/ (props changed) > stable/8/sys/contrib/pf/ (props changed) >=20 > Modified: stable/8/sys/arm/conf/GUMSTIX > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- stable/8/sys/arm/conf/GUMSTIX Sun Nov 6 21:09:10 2011 (r227277) > +++ stable/8/sys/arm/conf/GUMSTIX Sun Nov 6 21:09:23 2011 (r227278) > @@ -72,6 +72,7 @@ options PREEMPTION > device loop > device ether > device mii > +device mii_bitbang > device smc > device smcphy > device uart >=20 > Modified: stable/8/sys/conf/NOTES > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- stable/8/sys/conf/NOTES Sun Nov 6 21:09:10 2011 (r227277) > +++ stable/8/sys/conf/NOTES Sun Nov 6 21:09:23 2011 (r227278) > @@ -1819,13 +1819,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 > =20 > device acphy # Altima Communications AC101 > device amphy # AMD AM79c873 / Davicom DM910{1,2} >=20 > Modified: stable/8/sys/conf/files > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- stable/8/sys/conf/files Sun Nov 6 21:09:10 2011 (r227277) > +++ stable/8/sys/conf/files Sun Nov 6 21:09:23 2011 (r227278) > @@ -1309,6 +1309,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 >=20 > Modified: stable/8/sys/dev/bm/if_bm.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- stable/8/sys/dev/bm/if_bm.c Sun Nov 6 21:09:10 2011 (r227277) > +++ stable/8/sys/dev/bm/if_bm.c Sun Nov 6 21:09:23 2011 (r227278) > @@ -63,6 +63,7 @@ __FBSDID("$FreeBSD$"); > #include > =20 > #include > +#include > #include > =20 > #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 *); > =20 > -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); > =20 > +/* > + * 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 =3D { > + 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[] =3D { > /* Device interface */ > DEVMETHOD(device_probe, bm_probe), > @@ -150,171 +162,36 @@ DRIVER_MODULE(miibus, bm, miibus_driver, > */ > =20 > /* > - * 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 =3D BM_MII_OENABLE; > - if (bit) > - regval |=3D 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 =3D 0; > - > - bm_miicsr_dwrite(sc, regval); > - bm_miicsr_dwrite(sc, regval | BM_MII_CLK); > - bm_miicsr_dwrite(sc, regval); > - bitin =3D CSR_READ_2(sc, BM_MII_CSR) & BM_MII_DATAIN; > - > - return (bitin =3D=3D 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 =3D BM_MII_OENABLE | BM_MII_DATAOUT; > - > - bm_miicsr_dwrite(sc, regval); > - for (i =3D 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 =3D (0x1 << (cnt - 1)); i; i >>=3D 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 =3D BM_MII_STARTDELIM; > - frame->mii_opcode =3D BM_MII_READOP; > - frame->mii_turnaround =3D 0; > - frame->mii_data =3D 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 =3D 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 =3D 0x8000; i; i >>=3D 1) { > - bit =3D bm_mii_readbit(sc); > - if (!ack && bit) > - frame->mii_data |=3D i; > - } > + struct bm_softc *sc; > =20 > - /* > - * Skip through idle bit-times > - */ > - bm_mii_writebit(sc, 0); > - bm_mii_writebit(sc, 0); > + sc =3D device_get_softc(dev); > =20 > - 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); > } > =20 > /* > - * 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 =3D BM_MII_STARTDELIM; > - frame->mii_opcode =3D BM_MII_WRITEOP; > - frame->mii_turnaround =3D BM_MII_TURNAROUND; > - > - /* > - * Sync the phy and start the bitbang write sequence > - */ > - bm_mii_sync(sc); > + struct bm_softc *sc; > + uint32_t reg; > =20 > - 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 =3D device_get_softc(dev); > =20 > - /* > - * Idle bit. > - */ > - bm_mii_writebit(sc, 0); > + reg =3D CSR_READ_2(sc, BM_MII_CSR); > + CSR_BARRIER(sc, BM_MII_CSR, 2, > + BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); > =20 > - return (0); > + return (reg); > } > =20 > /* > @@ -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 =3D device_get_softc(dev); > - bzero(&frame, sizeof(frame)); > - > - frame.mii_phyaddr =3D phy; > - frame.mii_regaddr =3D reg; > =20 > - bm_mii_readreg(sc, &frame); > - > - return (frame.mii_data); > + return (mii_bitbang_readreg(dev, &bm_mii_bitbang_ops, phy, reg)); > } > =20 > static int > bm_miibus_writereg(device_t dev, int phy, int reg, int data) > { > - struct bm_softc *sc; > - struct bm_mii_frame frame; > - > - sc =3D device_get_softc(dev); > - bzero(&frame, sizeof(frame)); > - > - frame.mii_phyaddr =3D phy; > - frame.mii_regaddr =3D reg; > - frame.mii_data =3D data; > =20 > - bm_mii_writereg(sc, &frame); > + mii_bitbang_readreg(dev, &bm_mii_bitbang_ops, phy, reg); > =20 > return (0); > } >=20 > Modified: stable/8/sys/dev/bm/if_bmreg.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- stable/8/sys/dev/bm/if_bmreg.h Sun Nov 6 21:09:10 2011 (r227277) > +++ stable/8/sys/dev/bm/if_bmreg.h Sun Nov 6 21:09:23 2011 (r227278) > @@ -129,14 +129,6 @@ > #define BM_MII_DATAIN 0x0008 /* MDIO data in */ > =20 > /* > - * MII constants > - */ > -#define BM_MII_STARTDELIM 0x01 > -#define BM_MII_READOP 0x02 > -#define BM_MII_WRITEOP 0x01 > -#define BM_MII_TURNAROUND 0x02 > - > -/* > * Various flags > */ > =20 > @@ -174,3 +166,5 @@ > #define CSR_READ_1(sc, reg) \ > bus_read_1(sc->sc_memr, reg) > =20 > +#define CSR_BARRIER(sc, reg, length, flags) \ > + bus_barrier(sc->sc_memr, reg, length, flags) >=20 > Modified: stable/8/sys/dev/bm/if_bmvar.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- stable/8/sys/dev/bm/if_bmvar.h Sun Nov 6 21:09:10 2011 (r227277) > +++ stable/8/sys/dev/bm/if_bmvar.h Sun Nov 6 21:09:23 2011 (r227278) > @@ -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; > }; > =20 > - > struct bm_softc { > struct ifnet *sc_ifp; > struct mtx sc_mtx;=09 > @@ -113,13 +111,3 @@ struct bm_softc { > =20 > 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; > -}; > - >=20 > Modified: stable/8/sys/dev/dc/if_dc.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- stable/8/sys/dev/dc/if_dc.c Sun Nov 6 21:09:10 2011 (r227277) > +++ stable/8/sys/dev/dc/if_dc.c Sun Nov 6 21:09:23 2011 (r227278) > @@ -122,6 +122,7 @@ __FBSDID("$FreeBSD$"); > #include > =20 > #include > +#include > #include > =20 > #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[] =3D { > +static const struct dc_type const dc_devs[] =3D { > { 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); > =20 > -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 *); > =20 > +/* > + * 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 =3D { > + 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 > @@ -605,185 +618,45 @@ dc_read_eeprom(struct dc_softc *sc, cadd > } > =20 > /* > - * 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; > =20 > - reg =3D DC_SIO_ROMCTL_WRITE | (bit !=3D 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 =3D device_get_softc(dev); > =20 > - 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); > } > =20 > /* > - * 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 =3D 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; > =20 > -/* > - * 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 =3D device_get_softc(dev); > =20 > - CSR_WRITE_4(sc, DC_SIO, DC_SIO_ROMCTL_WRITE); > + val =3D CSR_READ_4(sc, DC_SIO); > CSR_BARRIER_4(sc, DC_SIO, > BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); > - DELAY(1); > - > - for (i =3D 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 =3D (0x1 << (cnt - 1)); i; i >>=3D 1) > - dc_mii_writebit(sc, bits & i); > -} > =20 > -/* > - * 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 =3D DC_MII_STARTDELIM; > - frame->mii_opcode =3D 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 =3D dc_mii_readbit(sc); > - if (frame->mii_turnaround !=3D 0) { > - for (i =3D 0; i < 16; i++) > - dc_mii_readbit(sc); > - goto fail; > - } > - for (i =3D 0x8000; i; i >>=3D 1) { > - if (dc_mii_readbit(sc)) > - frame->mii_data |=3D i; > - } > - > -fail: > - > - /* Clock the idle bits. */ > - dc_mii_writebit(sc, 0); > - dc_mii_writebit(sc, 0); > - > - if (frame->mii_turnaround !=3D 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 =3D DC_MII_STARTDELIM; > - frame->mii_opcode =3D DC_MII_WRITEOP; > - frame->mii_turnaround =3D 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); > } > =20 > 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 =3D 0; > =20 > sc =3D device_get_softc(dev); > - bzero(&frame, sizeof(frame)); > =20 > if (sc->dc_pmode !=3D DC_PMODE_MII) { > if (phy =3D=3D (MII_NPHY - 1)) { > @@ -858,34 +731,29 @@ dc_miibus_readreg(device_t dev, int phy, > } > =20 > rval =3D CSR_READ_4(sc, phy_reg) & 0x0000FFFF; > - > if (rval =3D=3D 0xFFFF) > return (0); > return (rval); > } > =20 > - frame.mii_phyaddr =3D phy; > - frame.mii_regaddr =3D reg; > if (sc->dc_type =3D=3D DC_TYPE_98713) { > phy_reg =3D CSR_READ_4(sc, DC_NETCFG); > CSR_WRITE_4(sc, DC_NETCFG, phy_reg & ~DC_NETCFG_PORTSEL); > } > - dc_mii_readreg(sc, &frame); > + rval =3D mii_bitbang_readreg(dev, &dc_mii_bitbang_ops, phy, reg); > if (sc->dc_type =3D=3D DC_TYPE_98713) > CSR_WRITE_4(sc, DC_NETCFG, phy_reg); > =20 > - return (frame.mii_data); > + return (rval); > } > =20 > 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 =3D 0; > =20 > sc =3D device_get_softc(dev); > - bzero(&frame, sizeof(frame)); > =20 > if (DC_IS_PNIC(sc)) { > CSR_WRITE_4(sc, DC_PN_MII, DC_PN_MIIOPCODE_WRITE | > @@ -931,15 +799,11 @@ dc_miibus_writereg(device_t dev, int phy > return (0); > } > =20 > - frame.mii_phyaddr =3D phy; > - frame.mii_regaddr =3D reg; > - frame.mii_data =3D data; > - > if (sc->dc_type =3D=3D DC_TYPE_98713) { > phy_reg =3D 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 =3D=3D DC_TYPE_98713) > CSR_WRITE_4(sc, DC_NETCFG, phy_reg); > =20 >=20 > Modified: stable/8/sys/dev/dc/if_dcreg.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- stable/8/sys/dev/dc/if_dcreg.h Sun Nov 6 21:09:10 2011 (r227277) > +++ stable/8/sys/dev/dc/if_dcreg.h Sun Nov 6 21:09:23 2011 (r227278) > @@ -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; > }; > =20 > -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) > =20 > -#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) > =20 > #define DC_TIMEOUT 1000 >=20 > Copied: stable/8/sys/dev/mii/mii_bitbang.c (from r226995, head/sys/dev/mi= i/mii_bitbang.c) > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ stable/8/sys/dev/mii/mii_bitbang.c Sun Nov 6 21:09:23 2011 (r227278,= 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 Foundati= on > + * 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 t= he > + * documentation and/or other materials provided with the distributio= n. > + * > + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBU= TORS > + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT L= IMITED > + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTI= CULAR > + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBU= TORS > + * 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 BUSIN= ESS > + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER = IN > + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWIS= E) > + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED O= F 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 =3D MDIRPHY | MDO; > + > + MWRITE(v); > + for (i =3D 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 =3D MDIRPHY; > + MWRITE(v); > + > + for (i =3D 1 << (nbits - 1); i !=3D 0; i >>=3D 1) { > + if (data & i) > + v |=3D MDO; > + else > + v &=3D ~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 re= g) > +{ > + 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 =3D MREAD & MDI; > + > + /* Idle clock. */ > + MWRITE(MDIRHOST | MDC); > + MWRITE(MDIRHOST); > + > + val =3D 0; > + for (i =3D 0; i < 16; i++) { > + val <<=3D 1; > + /* Read data prior to clock low-high transition. */ > + if (error =3D=3D 0 && (MREAD & MDI) !=3D 0) > + val |=3D 1; > + > + MWRITE(MDIRHOST | MDC); > + MWRITE(MDIRHOST); > + } > + > + /* Set direction to host->PHY, without a clock transition. */ > + MWRITE(MDIRPHY); > + > + return (error !=3D 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 r= eg, > + 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); > +} >=20 > Copied: stable/8/sys/dev/mii/mii_bitbang.h (from r226995, head/sys/dev/mi= i/mii_bitbang.h) > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ stable/8/sys/dev/mii/mii_bitbang.h Sun Nov 6 21:09:23 2011 (r227278,= 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 Foundati= on > + * 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 distributio= n. > + * > + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBU= TORS > + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT L= IMITED > + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTI= CULAR > + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBU= TORS > + * 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 BUSIN= ESS > + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER = IN > + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWIS= E) > + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED O= F 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); >=20 > Modified: stable/8/sys/dev/nge/if_nge.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- stable/8/sys/dev/nge/if_nge.c Sun Nov 6 21:09:10 2011 (r227277) > +++ stable/8/sys/dev/nge/if_nge.c Sun Nov 6 21:09:23 2011 (r227278) > @@ -117,6 +117,7 @@ __FBSDID("$FreeBSD$"); > #include > =20 > #include > +#include > #include > =20 > #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[] =3D { > +static const struct nge_type const nge_devs[] =3D { > { 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); > =20 > -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); > =20 > +/* > + * MII bit-bang glue > + */ >=20 > *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** > _______________________________________________ > svn-src-stable-8@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/svn-src-stable-8 > To unsubscribe, send any mail to "svn-src-stable-8-unsubscribe@freebsd.or= g" --qMm9M+Fa2AknHoGS Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (FreeBSD) Comment: http://bit.ly/0x89D8547E iQEcBAEBAgAGBQJOtz1/AAoJEJBXh4mJ2FR+evwH/iGnUgNS6VoErPz2CdrpuGb0 iiMS91aXk6jA3Ot+IH0yR1oYABj4F3nMD5PquJyTL6FQUlOrl/YH6+HPD1qRsnhX T27tG6HyyVRWz8XKhAmssrq72jJsiqLPXs46bi1a9Z6hIxZDQ/yPF8eZ2FgNJXnN kFLNWe+j9ViM1xmoEl9N8xXwaN7+PzmxFazziIE3wp8Jj8SV0nU/eR22KhLBIxv3 EMRz5qQcLAleiEmE7bu0qrasHBRTiMFdpxOXa2TcaebOrIeg8Qv4MCaSXLr+/YIP jTzJXqQ9+HehyApfUIHzX7/CJTSNTnL8BMuhlSlBsUb9Bn7/xq/Pw9b5lZvQRxo= =3a+T -----END PGP SIGNATURE----- --qMm9M+Fa2AknHoGS-- From owner-svn-src-stable@FreeBSD.ORG Mon Nov 7 11:31:15 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BC6EC106564A; Mon, 7 Nov 2011 11:31:14 +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 AB74D8FC0C; Mon, 7 Nov 2011 11:31:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pA7BVE9f076999; Mon, 7 Nov 2011 11:31:14 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA7BVE9J076997; Mon, 7 Nov 2011 11:31:14 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201111071131.pA7BVE9J076997@svn.freebsd.org> From: Marius Strobl Date: Mon, 7 Nov 2011 11:31:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227300 - stable/8/sys/conf X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Nov 2011 11:31:15 -0000 Author: marius Date: Mon Nov 7 11:31:14 2011 New Revision: 227300 URL: http://svn.freebsd.org/changeset/base/227300 Log: Automatically compile in mii_bitbang.c if one of the drivers depending on it since r227278 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/8. Modified: stable/8/sys/conf/files Modified: stable/8/sys/conf/files ============================================================================== --- stable/8/sys/conf/files Mon Nov 7 09:42:22 2011 (r227299) +++ stable/8/sys/conf/files Mon Nov 7 11:31:14 2011 (r227300) @@ -1309,7 +1309,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 | smc | \ + 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@FreeBSD.ORG Mon Nov 7 11:31:37 2011 Return-Path: Delivered-To: svn-src-stable@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@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the 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@FreeBSD.ORG Mon Nov 7 11:42:59 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A5754106564A; Mon, 7 Nov 2011 11:42:59 +0000 (UTC) (envelope-from marius@alchemy.franken.de) Received: from alchemy.franken.de (alchemy.franken.de [194.94.249.214]) by mx1.freebsd.org (Postfix) with ESMTP id 33CFE8FC0A; Mon, 7 Nov 2011 11:42:58 +0000 (UTC) Received: from alchemy.franken.de (localhost [127.0.0.1]) by alchemy.franken.de (8.14.4/8.14.4/ALCHEMY.FRANKEN.DE) with ESMTP id pA7BgpVa093811; Mon, 7 Nov 2011 12:42:51 +0100 (CET) (envelope-from marius@alchemy.franken.de) Received: (from marius@localhost) by alchemy.franken.de (8.14.4/8.14.4/Submit) id pA7Bgp2w093810; Mon, 7 Nov 2011 12:42:51 +0100 (CET) (envelope-from marius) Date: Mon, 7 Nov 2011 12:42:51 +0100 From: Marius Strobl To: Jason Hellenthal Message-ID: <20111107114251.GA93221@alchemy.franken.de> References: <201111062109.pA6L9OLV042060@svn.freebsd.org> <20111107020759.GA45996@DataIX.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20111107020759.GA45996@DataIX.net> User-Agent: Mutt/1.4.2.3i Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-8@freebsd.org Subject: Re: svn commit: r227278 - in stable/8/sys: arm/conf conf dev/bm dev/dc dev/mii dev/nge dev/sis dev/smc dev/ste dev/stge dev/tl dev/wb dev/xl modules/mii pci X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Nov 2011 11:42:59 -0000 On Sun, Nov 06, 2011 at 09:07:59PM -0500, Jason Hellenthal wrote: > > > The following commmit broke building without device miibus at least on i386. > > if_dc.o(.text+0x24b4): In function `dc_miibus_writereg': > /usr/src/sys/dev/dc/if_dc.c:806: undefined reference to `mii_bitbang_writereg' > if_dc.o(.text+0x26cc): In function `dc_miibus_readreg': > /usr/src/sys/dev/dc/if_dc.c:743: undefined reference to `mii_bitbang_readreg' > > If you try to use the modular device mii and the single *phy you will get the above error when it comes time to link the kernel. Yes, you now need to additionally put "options mii_bitbang" into your kernel configuration file if you don't use "options miibus" but "options mii" and individual PHY drivers in combination with one of the MAC drivers that where converted to use the common MII bitbang'ing code, see sys/conf/NOTES. Given that this is a rather exotic approach intended for embedded use it didn't occur to me to note it beyond NOTES. However, thinking about it I decided for stable/7 and stable/8 to automatically drag in the common MII bitbang'ing code if one of the MAC drivers depending on it is compiled into the kernel in order to not break POLA. Marius From owner-svn-src-stable@FreeBSD.ORG Mon Nov 7 13:16:51 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5BB97106566C; Mon, 7 Nov 2011 13:16:51 +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 494A18FC0C; Mon, 7 Nov 2011 13:16:51 +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 pA7DGpT2080506; Mon, 7 Nov 2011 13:16:51 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA7DGpFQ080500; Mon, 7 Nov 2011 13:16:51 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201111071316.pA7DGpFQ080500@svn.freebsd.org> From: Marius Strobl Date: Mon, 7 Nov 2011 13:16:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227302 - in stable/9/sys: dev/esp sparc64/sbus X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Nov 2011 13:16:51 -0000 Author: marius Date: Mon Nov 7 13:16:51 2011 New Revision: 227302 URL: http://svn.freebsd.org/changeset/base/227302 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. Approved by: re (kib) Modified: stable/9/sys/dev/esp/esp_sbus.c stable/9/sys/dev/esp/ncr53c9x.c stable/9/sys/dev/esp/ncr53c9xvar.h stable/9/sys/sparc64/sbus/lsi64854.c stable/9/sys/sparc64/sbus/lsi64854var.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/dev/esp/esp_sbus.c ============================================================================== --- stable/9/sys/dev/esp/esp_sbus.c Mon Nov 7 11:31:37 2011 (r227301) +++ stable/9/sys/dev/esp/esp_sbus.c Mon Nov 7 13:16:51 2011 (r227302) @@ -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/9/sys/dev/esp/ncr53c9x.c ============================================================================== --- stable/9/sys/dev/esp/ncr53c9x.c Mon Nov 7 11:31:37 2011 (r227301) +++ stable/9/sys/dev/esp/ncr53c9x.c Mon Nov 7 13:16:51 2011 (r227302) @@ -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/9/sys/dev/esp/ncr53c9xvar.h ============================================================================== --- stable/9/sys/dev/esp/ncr53c9xvar.h Mon Nov 7 11:31:37 2011 (r227301) +++ stable/9/sys/dev/esp/ncr53c9xvar.h Mon Nov 7 13:16:51 2011 (r227302) @@ -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/9/sys/sparc64/sbus/lsi64854.c ============================================================================== --- stable/9/sys/sparc64/sbus/lsi64854.c Mon Nov 7 11:31:37 2011 (r227301) +++ stable/9/sys/sparc64/sbus/lsi64854.c Mon Nov 7 13:16:51 2011 (r227302) @@ -94,7 +94,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); @@ -125,6 +130,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: @@ -135,6 +141,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; @@ -153,13 +160,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); @@ -250,24 +257,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 { \ @@ -282,12 +290,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); @@ -296,10 +306,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) @@ -364,15 +375,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 */ @@ -381,6 +393,7 @@ lsi64854_setup(struct lsi64854_softc *sc int datain, size_t *dmasize) { long bcnt; + int error; uint32_t csr; DMA_FLUSH(sc, 0); @@ -392,15 +405,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? @@ -412,24 +422,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; @@ -445,7 +462,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. @@ -455,19 +472,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); } @@ -483,10 +504,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@FreeBSD.ORG Mon Nov 7 13:17:40 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 870E51065670; Mon, 7 Nov 2011 13:17:40 +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 74B468FC0C; Mon, 7 Nov 2011 13:17:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pA7DHePk080588; Mon, 7 Nov 2011 13:17:40 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA7DHe8g080582; Mon, 7 Nov 2011 13:17:40 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201111071317.pA7DHe8g080582@svn.freebsd.org> From: Marius Strobl Date: Mon, 7 Nov 2011 13:17:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227303 - in stable/8/sys: dev/esp sparc64/sbus X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Nov 2011 13:17:40 -0000 Author: marius Date: Mon Nov 7 13:17:40 2011 New Revision: 227303 URL: http://svn.freebsd.org/changeset/base/227303 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/8/sys/dev/esp/esp_sbus.c stable/8/sys/dev/esp/ncr53c9x.c stable/8/sys/dev/esp/ncr53c9xvar.h stable/8/sys/sparc64/sbus/lsi64854.c stable/8/sys/sparc64/sbus/lsi64854var.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/esp/esp_sbus.c ============================================================================== --- stable/8/sys/dev/esp/esp_sbus.c Mon Nov 7 13:16:51 2011 (r227302) +++ stable/8/sys/dev/esp/esp_sbus.c Mon Nov 7 13:17:40 2011 (r227303) @@ -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/8/sys/dev/esp/ncr53c9x.c ============================================================================== --- stable/8/sys/dev/esp/ncr53c9x.c Mon Nov 7 13:16:51 2011 (r227302) +++ stable/8/sys/dev/esp/ncr53c9x.c Mon Nov 7 13:17:40 2011 (r227303) @@ -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/8/sys/dev/esp/ncr53c9xvar.h ============================================================================== --- stable/8/sys/dev/esp/ncr53c9xvar.h Mon Nov 7 13:16:51 2011 (r227302) +++ stable/8/sys/dev/esp/ncr53c9xvar.h Mon Nov 7 13:17:40 2011 (r227303) @@ -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/8/sys/sparc64/sbus/lsi64854.c ============================================================================== --- stable/8/sys/sparc64/sbus/lsi64854.c Mon Nov 7 13:16:51 2011 (r227302) +++ stable/8/sys/sparc64/sbus/lsi64854.c Mon Nov 7 13:17:40 2011 (r227303) @@ -94,7 +94,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); @@ -125,6 +130,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: @@ -135,6 +141,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; @@ -153,13 +160,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); @@ -250,24 +257,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 { \ @@ -282,12 +290,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); @@ -296,10 +306,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) @@ -364,15 +375,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 */ @@ -381,6 +393,7 @@ lsi64854_setup(struct lsi64854_softc *sc int datain, size_t *dmasize) { long bcnt; + int error; uint32_t csr; DMA_FLUSH(sc, 0); @@ -392,15 +405,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? @@ -412,24 +422,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; @@ -445,7 +462,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. @@ -455,19 +472,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); } @@ -483,10 +504,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@FreeBSD.ORG Mon Nov 7 13:18:09 2011 Return-Path: Delivered-To: svn-src-stable@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@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the 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@FreeBSD.ORG Mon Nov 7 13:40:55 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 497C8106567B; Mon, 7 Nov 2011 13:40:55 +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 34E8A8FC18; Mon, 7 Nov 2011 13:40:55 +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 pA7DetEi081489; Mon, 7 Nov 2011 13:40:55 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA7DetqP081480; Mon, 7 Nov 2011 13:40:55 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201111071340.pA7DetqP081480@svn.freebsd.org> From: Marius Strobl Date: Mon, 7 Nov 2011 13:40:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227305 - in stable/9: . contrib/top share/man/man4 share/mk sys/amd64/conf sys/conf sys/dev/esp sys/i386/conf sys/modules sys/modules/esp sys/pc98/conf sys/sparc64/conf X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Nov 2011 13:40:55 -0000 Author: marius Date: Mon Nov 7 13:40:54 2011 New Revision: 227305 URL: http://svn.freebsd.org/changeset/base/227305 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 Approved by: re (kib) Obtained from: NetBSD (based on) Added: stable/9/sys/dev/esp/am53c974reg.h - copied unchanged from r227006, head/sys/dev/esp/am53c974reg.h stable/9/sys/dev/esp/esp_pci.c - copied unchanged from r227006, head/sys/dev/esp/esp_pci.c Modified: stable/9/UPDATING stable/9/share/man/man4/esp.4 stable/9/sys/amd64/conf/GENERIC stable/9/sys/conf/NOTES stable/9/sys/conf/files stable/9/sys/i386/conf/GENERIC stable/9/sys/modules/Makefile stable/9/sys/modules/esp/Makefile stable/9/sys/pc98/conf/GENERIC stable/9/sys/sparc64/conf/GENERIC Directory Properties: stable/9/ (props changed) stable/9/Makefile.inc1 (props changed) stable/9/bin/ps/ (props changed) stable/9/cddl/contrib/opensolaris/ (props changed) stable/9/contrib/bind9/ (props changed) stable/9/contrib/binutils/ (props changed) stable/9/contrib/bzip2/ (props changed) stable/9/contrib/compiler-rt/ (props changed) stable/9/contrib/dialog/ (props changed) stable/9/contrib/ee/ (props changed) stable/9/contrib/expat/ (props changed) stable/9/contrib/file/ (props changed) stable/9/contrib/gcc/ (props changed) stable/9/contrib/gdb/ (props changed) stable/9/contrib/gdtoa/ (props changed) stable/9/contrib/gnu-sort/ (props changed) stable/9/contrib/groff/ (props changed) stable/9/contrib/less/ (props changed) stable/9/contrib/libpcap/ (props changed) stable/9/contrib/libstdc++/ (props changed) stable/9/contrib/llvm/ (props changed) stable/9/contrib/llvm/tools/clang/ (props changed) stable/9/contrib/ncurses/ (props changed) stable/9/contrib/netcat/ (props changed) stable/9/contrib/ntp/ (props changed) stable/9/contrib/one-true-awk/ (props changed) stable/9/contrib/openbsm/ (props changed) stable/9/contrib/openpam/ (props changed) stable/9/contrib/openresolv/ (props changed) stable/9/contrib/pf/ (props changed) stable/9/contrib/sendmail/ (props changed) stable/9/contrib/tcpdump/ (props changed) stable/9/contrib/tcsh/ (props changed) stable/9/contrib/tnftp/ (props changed) stable/9/contrib/top/ (props changed) stable/9/contrib/top/install-sh (props changed) stable/9/contrib/tzcode/ (props changed) stable/9/contrib/tzcode/stdtime/ (props changed) stable/9/contrib/tzcode/zic/ (props changed) stable/9/contrib/tzdata/ (props changed) stable/9/contrib/wpa/ (props changed) stable/9/contrib/xz/ (props changed) stable/9/crypto/openssh/ (props changed) stable/9/crypto/openssl/ (props changed) stable/9/etc/ (props changed) stable/9/games/fortune/ (props changed) stable/9/gnu/lib/ (props changed) stable/9/gnu/usr.bin/binutils/ (props changed) stable/9/gnu/usr.bin/cc/cc_tools/ (props changed) stable/9/gnu/usr.bin/gdb/ (props changed) stable/9/include/ (props changed) stable/9/kerberos5/ (props changed) stable/9/lib/clang/ (props changed) stable/9/lib/libc/ (props changed) stable/9/lib/libc/stdtime/ (props changed) stable/9/lib/libfetch/ (props changed) stable/9/lib/libusb/ (props changed) stable/9/lib/libutil/ (props changed) stable/9/lib/libz/ (props changed) stable/9/libexec/rshd/ (props changed) stable/9/libexec/rtld-elf/ (props changed) stable/9/release/ (props changed) stable/9/sbin/ (props changed) stable/9/sbin/atacontrol/ (props changed) stable/9/sbin/camcontrol/ (props changed) stable/9/sbin/ipfw/ (props changed) stable/9/share/doc/ (props changed) stable/9/share/examples/ (props changed) stable/9/share/man/man4/ (props changed) stable/9/share/man/man5/ (props changed) stable/9/share/man/man7/ (props changed) stable/9/share/man/man9/ (props changed) stable/9/share/misc/ (props changed) stable/9/share/mk/bsd.arch.inc.mk (props changed) stable/9/share/zoneinfo/ (props changed) stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) stable/9/tools/ (props changed) stable/9/usr.bin/calendar/ (props changed) stable/9/usr.bin/clang/ (props changed) stable/9/usr.bin/csup/ (props changed) stable/9/usr.bin/fetch/ (props changed) stable/9/usr.bin/grep/ (props changed) stable/9/usr.bin/procstat/ (props changed) stable/9/usr.bin/script/ (props changed) stable/9/usr.bin/sed/ (props changed) stable/9/usr.sbin/boot0cfg/ (props changed) stable/9/usr.sbin/bsdinstall/ (props changed) stable/9/usr.sbin/burncd/ (props changed) stable/9/usr.sbin/freebsd-update/ (props changed) stable/9/usr.sbin/makefs/ (props changed) stable/9/usr.sbin/mergemaster/ (props changed) stable/9/usr.sbin/mfiutil/ (props changed) stable/9/usr.sbin/ndiscvt/ (props changed) stable/9/usr.sbin/pc-sysinstall/ (props changed) stable/9/usr.sbin/portsnap/ (props changed) stable/9/usr.sbin/rtadvctl/ (props changed) stable/9/usr.sbin/rtadvd/ (props changed) stable/9/usr.sbin/rtsold/ (props changed) stable/9/usr.sbin/tzsetup/ (props changed) stable/9/usr.sbin/usbdump/ (props changed) stable/9/usr.sbin/zic/ (props changed) Modified: stable/9/UPDATING ============================================================================== --- stable/9/UPDATING Mon Nov 7 13:18:09 2011 (r227304) +++ stable/9/UPDATING Mon Nov 7 13:40:54 2011 (r227305) @@ -9,6 +9,10 @@ handbook. Items affecting the ports and packages system can be found in /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. + 20110913: This commit modifies vfs_register() so that it uses a hash calculation to set vfc_typenum, which is enabled by default. Modified: stable/9/share/man/man4/esp.4 ============================================================================== --- stable/9/share/man/man4/esp.4 Mon Nov 7 13:18:09 2011 (r227304) +++ stable/9/share/man/man4/esp.4 Mon Nov 7 13:40:54 2011 (r227305) @@ -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/9/sys/amd64/conf/GENERIC ============================================================================== --- stable/9/sys/amd64/conf/GENERIC Mon Nov 7 13:18:09 2011 (r227304) +++ stable/9/sys/amd64/conf/GENERIC Mon Nov 7 13:40:54 2011 (r227305) @@ -95,7 +95,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/9/sys/conf/NOTES ============================================================================== --- stable/9/sys/conf/NOTES Mon Nov 7 13:18:09 2011 (r227304) +++ stable/9/sys/conf/NOTES Mon Nov 7 13:40:54 2011 (r227305) @@ -1459,7 +1459,9 @@ options TEKEN_UTF8 # UTF-8 output hand # 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/9/sys/conf/files ============================================================================== --- stable/9/sys/conf/files Mon Nov 7 13:18:09 2011 (r227304) +++ stable/9/sys/conf/files Mon Nov 7 13:40:54 2011 (r227305) @@ -1064,6 +1064,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/9/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/9/sys/dev/esp/am53c974reg.h Mon Nov 7 13:40:54 2011 (r227305, 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/9/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/9/sys/dev/esp/esp_pci.c Mon Nov 7 13:40:54 2011 (r227305, 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@FreeBSD.ORG Mon Nov 7 13:45:19 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 00BDF1065670; Mon, 7 Nov 2011 13:45:19 +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 E04EA8FC17; Mon, 7 Nov 2011 13:45: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 pA7DjIEj081698; Mon, 7 Nov 2011 13:45:18 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA7DjIVu081689; Mon, 7 Nov 2011 13:45:18 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201111071345.pA7DjIVu081689@svn.freebsd.org> From: Marius Strobl Date: Mon, 7 Nov 2011 13:45:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227306 - in stable/8: . contrib/bsnmp/snmpd contrib/top contrib/xz gnu/usr.bin lib/libusb release/picobsd/floppy.tree/sbin sbin/geom/class/sched share/man/man4 share/misc sys/amd64/con... X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Nov 2011 13:45:19 -0000 Author: marius Date: Mon Nov 7 13:45:18 2011 New Revision: 227306 URL: http://svn.freebsd.org/changeset/base/227306 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/8/sys/dev/esp/am53c974reg.h - copied unchanged from r227006, head/sys/dev/esp/am53c974reg.h stable/8/sys/dev/esp/esp_pci.c - copied unchanged from r227006, head/sys/dev/esp/esp_pci.c Modified: stable/8/UPDATING (contents, props changed) stable/8/share/man/man4/esp.4 stable/8/sys/amd64/conf/GENERIC stable/8/sys/conf/NOTES stable/8/sys/conf/files stable/8/sys/i386/conf/GENERIC stable/8/sys/modules/Makefile stable/8/sys/modules/esp/Makefile stable/8/sys/pc98/conf/GENERIC stable/8/sys/sparc64/conf/GENERIC Directory Properties: stable/8/ (props changed) stable/8/COPYRIGHT (props changed) stable/8/LOCKS (props changed) stable/8/MAINTAINERS (props changed) stable/8/Makefile (props changed) stable/8/Makefile.inc1 (props changed) stable/8/ObsoleteFiles.inc (props changed) stable/8/README (props changed) stable/8/bin/ (props changed) stable/8/bin/chio/ (props changed) stable/8/bin/chmod/ (props changed) stable/8/bin/cp/ (props changed) stable/8/bin/csh/ (props changed) stable/8/bin/date/ (props changed) stable/8/bin/df/ (props changed) stable/8/bin/echo/ (props changed) stable/8/bin/ed/ (props changed) stable/8/bin/expr/ (props changed) stable/8/bin/getfacl/ (props changed) stable/8/bin/kenv/ (props changed) stable/8/bin/kill/ (props changed) stable/8/bin/ln/ (props changed) stable/8/bin/ls/ (props changed) stable/8/bin/mv/ (props changed) stable/8/bin/pax/ (props changed) stable/8/bin/pkill/ (props changed) stable/8/bin/ps/ (props changed) stable/8/bin/pwait/ (props changed) stable/8/bin/setfacl/ (props changed) stable/8/bin/sh/ (props changed) stable/8/bin/sleep/ (props changed) stable/8/bin/stty/ (props changed) stable/8/bin/test/ (props changed) stable/8/cddl/compat/opensolaris/ (props changed) stable/8/cddl/contrib/dtracetoolkit/ (props changed) stable/8/cddl/contrib/opensolaris/ (props changed) stable/8/cddl/lib/ (props changed) stable/8/cddl/lib/libnvpair/ (props changed) stable/8/cddl/lib/libzpool/ (props changed) stable/8/cddl/sbin/ (props changed) stable/8/cddl/usr.bin/ (props changed) stable/8/cddl/usr.sbin/ (props changed) stable/8/contrib/ (props changed) stable/8/contrib/bind9/ (props changed) stable/8/contrib/binutils/ (props changed) stable/8/contrib/bsnmp/ (props changed) stable/8/contrib/bsnmp/snmpd/bsnmpd.1 (props changed) stable/8/contrib/bzip2/ (props changed) stable/8/contrib/com_err/ (props changed) stable/8/contrib/csup/ (props changed) stable/8/contrib/ee/ (props changed) stable/8/contrib/expat/ (props changed) stable/8/contrib/file/ (props changed) stable/8/contrib/gcc/ (props changed) stable/8/contrib/gdb/ (props changed) stable/8/contrib/gdtoa/ (props changed) stable/8/contrib/groff/ (props changed) stable/8/contrib/ipfilter/ (props changed) stable/8/contrib/less/ (props changed) stable/8/contrib/libpcap/ (props changed) stable/8/contrib/libstdc++/ (props changed) stable/8/contrib/lukemftp/ (props changed) stable/8/contrib/ncurses/ (props changed) stable/8/contrib/netcat/ (props changed) stable/8/contrib/ntp/ (props changed) stable/8/contrib/nvi/ (props changed) stable/8/contrib/one-true-awk/ (props changed) stable/8/contrib/openbsm/ (props changed) stable/8/contrib/openpam/ (props changed) stable/8/contrib/pf/ (props changed) stable/8/contrib/sendmail/ (props changed) stable/8/contrib/tcp_wrappers/ (props changed) stable/8/contrib/tcpdump/ (props changed) stable/8/contrib/tcsh/ (props changed) stable/8/contrib/telnet/ (props changed) stable/8/contrib/top/ (props changed) stable/8/contrib/top/install-sh (props changed) stable/8/contrib/traceroute/ (props changed) stable/8/contrib/wpa/ (props changed) stable/8/contrib/xz/ (props changed) stable/8/contrib/xz/AUTHORS (props changed) stable/8/contrib/xz/COPYING (props changed) stable/8/contrib/xz/ChangeLog (props changed) stable/8/contrib/xz/FREEBSD-Xlist (props changed) stable/8/contrib/xz/FREEBSD-upgrade (props changed) stable/8/contrib/xz/README (props changed) stable/8/contrib/xz/THANKS (props changed) stable/8/contrib/xz/TODO (props changed) stable/8/contrib/xz/po/ (props changed) stable/8/contrib/xz/src/ (props changed) stable/8/crypto/heimdal/ (props changed) stable/8/crypto/openssh/ (props changed) stable/8/crypto/openssl/ (props changed) stable/8/etc/ (props changed) stable/8/games/factor/ (props changed) stable/8/games/fortune/ (props changed) stable/8/games/grdc/ (props changed) stable/8/games/pom/ (props changed) stable/8/gnu/lib/csu/ (props changed) stable/8/gnu/lib/libgcc/ (props changed) stable/8/gnu/lib/libstdc++/ (props changed) stable/8/gnu/usr.bin/ (props changed) stable/8/gnu/usr.bin/Makefile (props changed) stable/8/gnu/usr.bin/binutils/ld/ (props changed) stable/8/gnu/usr.bin/cc/cc_tools/ (props changed) stable/8/gnu/usr.bin/cc/include/ (props changed) stable/8/gnu/usr.bin/dialog/ (props changed) stable/8/gnu/usr.bin/gdb/ (props changed) stable/8/gnu/usr.bin/gdb/arch/sparc64/ (props changed) stable/8/gnu/usr.bin/gdb/kgdb/ (props changed) stable/8/gnu/usr.bin/groff/ (props changed) stable/8/gnu/usr.bin/patch/ (props changed) stable/8/include/ (props changed) stable/8/kerberos5/lib/libgssapi_krb5/ (props changed) stable/8/kerberos5/lib/libgssapi_spnego/ (props changed) stable/8/kerberos5/usr.bin/kdestroy/ (props changed) stable/8/kerberos5/usr.bin/kpasswd/ (props changed) stable/8/lib/ (props changed) stable/8/lib/bind/ (props changed) stable/8/lib/csu/ (props changed) stable/8/lib/libarchive/ (props changed) stable/8/lib/libbluetooth/ (props changed) stable/8/lib/libc/ (props changed) stable/8/lib/libc/stdtime/ (props changed) stable/8/lib/libc_r/ (props changed) stable/8/lib/libcam/ (props changed) stable/8/lib/libcompat/ (props changed) stable/8/lib/libdevinfo/ (props changed) stable/8/lib/libdevstat/ (props changed) stable/8/lib/libdisk/ (props changed) stable/8/lib/libedit/ (props changed) stable/8/lib/libelf/ (props changed) stable/8/lib/libexpat/ (props changed) stable/8/lib/libfetch/ (props changed) stable/8/lib/libgeom/ (props changed) stable/8/lib/libgpib/ (props changed) stable/8/lib/libgssapi/ (props changed) stable/8/lib/libjail/ (props changed) stable/8/lib/libkse/ (props changed) stable/8/lib/libkvm/ (props changed) stable/8/lib/liblzma/ (props changed) stable/8/lib/libmagic/ (props changed) stable/8/lib/libmemstat/ (props changed) stable/8/lib/libpam/ (props changed) stable/8/lib/libpmc/ (props changed) stable/8/lib/libproc/ (props changed) stable/8/lib/libradius/ (props changed) stable/8/lib/librpcsec_gss/ (props changed) stable/8/lib/librtld_db/ (props changed) stable/8/lib/libsm/ (props changed) stable/8/lib/libstand/ (props changed) stable/8/lib/libtacplus/ (props changed) stable/8/lib/libthr/ (props changed) stable/8/lib/libthread_db/ (props changed) stable/8/lib/libufs/ (props changed) stable/8/lib/libugidfw/ (props changed) stable/8/lib/libusb/ (props changed) stable/8/lib/libusb/usb.h (props changed) stable/8/lib/libusbhid/ (props changed) stable/8/lib/libutil/ (props changed) stable/8/lib/libz/ (props changed) stable/8/lib/libz/contrib/ (props changed) stable/8/lib/msun/ (props changed) stable/8/libexec/ (props changed) stable/8/libexec/comsat/ (props changed) stable/8/libexec/ftpd/ (props changed) stable/8/libexec/rshd/ (props changed) stable/8/libexec/rtld-elf/ (props changed) stable/8/libexec/tftpd/ (props changed) stable/8/release/ (props changed) stable/8/release/doc/en_US.ISO8859-1/hardware/ (props changed) stable/8/release/picobsd/ (props changed) stable/8/release/picobsd/floppy.tree/sbin/ (props changed) stable/8/release/picobsd/floppy.tree/sbin/dhclient-script (props changed) stable/8/release/picobsd/qemu/ (props changed) stable/8/release/picobsd/tinyware/login/ (props changed) stable/8/release/powerpc/ (props changed) stable/8/rescue/ (props changed) stable/8/sbin/ (props changed) stable/8/sbin/atacontrol/ (props changed) stable/8/sbin/bsdlabel/ (props changed) stable/8/sbin/camcontrol/ (props changed) stable/8/sbin/conscontrol/ (props changed) stable/8/sbin/ddb/ (props changed) stable/8/sbin/devd/ (props changed) stable/8/sbin/devfs/ (props changed) stable/8/sbin/dhclient/ (props changed) stable/8/sbin/dump/ (props changed) stable/8/sbin/dumpfs/ (props changed) stable/8/sbin/fdisk/ (props changed) stable/8/sbin/fsck/ (props changed) stable/8/sbin/fsck_ffs/ (props changed) stable/8/sbin/fsck_msdosfs/ (props changed) stable/8/sbin/fsirand/ (props changed) stable/8/sbin/geom/ (props changed) stable/8/sbin/geom/class/multipath/ (props changed) stable/8/sbin/geom/class/part/ (props changed) stable/8/sbin/geom/class/sched/gsched.8 (props changed) stable/8/sbin/geom/class/stripe/ (props changed) stable/8/sbin/ggate/ (props changed) stable/8/sbin/growfs/ (props changed) stable/8/sbin/gvinum/ (props changed) stable/8/sbin/hastctl/ (props changed) stable/8/sbin/hastd/ (props changed) stable/8/sbin/ifconfig/ (props changed) stable/8/sbin/ipfw/ (props changed) stable/8/sbin/iscontrol/ (props changed) stable/8/sbin/kldload/ (props changed) stable/8/sbin/kldstat/ (props changed) stable/8/sbin/mdconfig/ (props changed) stable/8/sbin/mdmfs/ (props changed) stable/8/sbin/mknod/ (props changed) stable/8/sbin/mksnap_ffs/ (props changed) stable/8/sbin/mount/ (props changed) stable/8/sbin/mount_cd9660/ (props changed) stable/8/sbin/mount_msdosfs/ (props changed) stable/8/sbin/mount_nfs/ (props changed) stable/8/sbin/mount_unionfs/ (props changed) stable/8/sbin/natd/ (props changed) stable/8/sbin/newfs/ (props changed) stable/8/sbin/newfs_msdos/ (props changed) stable/8/sbin/ping6/ (props changed) stable/8/sbin/quotacheck/ (props changed) stable/8/sbin/rcorder/ (props changed) stable/8/sbin/reboot/ (props changed) stable/8/sbin/restore/ (props changed) stable/8/sbin/route/ (props changed) stable/8/sbin/routed/ (props changed) stable/8/sbin/setkey/ (props changed) stable/8/sbin/shutdown/ (props changed) stable/8/sbin/spppcontrol/ (props changed) stable/8/sbin/sysctl/ (props changed) stable/8/sbin/tunefs/ (props changed) stable/8/sbin/umount/ (props changed) stable/8/secure/ (props changed) stable/8/secure/lib/libcrypto/ (props changed) stable/8/secure/lib/libssl/ (props changed) stable/8/secure/usr.bin/bdes/ (props changed) stable/8/secure/usr.bin/openssl/ (props changed) stable/8/share/dict/ (props changed) stable/8/share/doc/papers/devfs/ (props changed) stable/8/share/doc/papers/jail/ (props changed) stable/8/share/doc/smm/01.setup/ (props changed) stable/8/share/examples/ (props changed) stable/8/share/examples/cvsup/ (props changed) stable/8/share/man/ (props changed) stable/8/share/man/man1/ (props changed) stable/8/share/man/man3/ (props changed) stable/8/share/man/man4/ (props changed) stable/8/share/man/man5/ (props changed) stable/8/share/man/man7/ (props changed) stable/8/share/man/man8/ (props changed) stable/8/share/man/man9/ (props changed) stable/8/share/misc/ (props changed) stable/8/share/misc/bsd-family-tree (props changed) stable/8/share/mk/ (props changed) stable/8/share/skel/ (props changed) stable/8/share/syscons/ (props changed) stable/8/share/termcap/ (props changed) stable/8/share/timedef/ (props changed) stable/8/share/zoneinfo/ (props changed) stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/tools/ (props changed) stable/8/tools/build/mk/ (props changed) stable/8/tools/build/options/ (props changed) stable/8/tools/debugscripts/ (props changed) stable/8/tools/kerneldoc/subsys/ (props changed) stable/8/tools/regression/acct/ (props changed) stable/8/tools/regression/acltools/ (props changed) stable/8/tools/regression/aio/aiotest/ (props changed) stable/8/tools/regression/bin/ (props changed) stable/8/tools/regression/bin/date/ (props changed) stable/8/tools/regression/bin/sh/ (props changed) stable/8/tools/regression/bin/test/ (props changed) stable/8/tools/regression/doat/ (props changed) stable/8/tools/regression/fifo/ (props changed) stable/8/tools/regression/geom/ (props changed) stable/8/tools/regression/lib/libc/ (props changed) stable/8/tools/regression/lib/msun/test-conj.t (props changed) stable/8/tools/regression/mqueue/mqtest1/ (props changed) stable/8/tools/regression/mqueue/mqtest2/ (props changed) stable/8/tools/regression/mqueue/mqtest3/ (props changed) stable/8/tools/regression/mqueue/mqtest4/ (props changed) stable/8/tools/regression/mqueue/mqtest5/ (props changed) stable/8/tools/regression/netinet/ (props changed) stable/8/tools/regression/poll/ (props changed) stable/8/tools/regression/posixsem/ (props changed) stable/8/tools/regression/priv/ (props changed) stable/8/tools/regression/sockets/unix_gc/ (props changed) stable/8/tools/regression/usr.bin/ (props changed) stable/8/tools/regression/usr.bin/pkill/ (props changed) stable/8/tools/regression/usr.bin/pkill/pgrep-_g.t (props changed) stable/8/tools/regression/usr.bin/pkill/pgrep-_s.t (props changed) stable/8/tools/regression/usr.bin/pkill/pkill-_g.t (props changed) stable/8/tools/regression/usr.bin/sed/ (props changed) stable/8/tools/regression/usr.bin/tr/ (props changed) stable/8/tools/test/ (props changed) stable/8/tools/test/malloc/ (props changed) stable/8/tools/tools/ (props changed) stable/8/tools/tools/aac/ (props changed) stable/8/tools/tools/ath/ (props changed) stable/8/tools/tools/ath/common/dumpregs.h (props changed) stable/8/tools/tools/ath/common/dumpregs_5210.c (props changed) stable/8/tools/tools/ath/common/dumpregs_5211.c (props changed) stable/8/tools/tools/ath/common/dumpregs_5212.c (props changed) stable/8/tools/tools/ath/common/dumpregs_5416.c (props changed) stable/8/tools/tools/cfi/ (props changed) stable/8/tools/tools/ether_reflect/ (props changed) stable/8/tools/tools/iwi/ (props changed) stable/8/tools/tools/mctest/ (props changed) stable/8/tools/tools/nanobsd/ (props changed) stable/8/tools/tools/netrate/ (props changed) stable/8/tools/tools/netrate/netblast/ (props changed) stable/8/tools/tools/netrate/netsend/ (props changed) stable/8/tools/tools/netrate/tcpp/ (props changed) stable/8/tools/tools/termcap/termcap.pl (props changed) stable/8/tools/tools/umastat/ (props changed) stable/8/tools/tools/vimage/ (props changed) stable/8/usr.bin/ (props changed) stable/8/usr.bin/apply/ (props changed) stable/8/usr.bin/ar/ (props changed) stable/8/usr.bin/awk/ (props changed) stable/8/usr.bin/biff/ (props changed) stable/8/usr.bin/c89/ (props changed) stable/8/usr.bin/c99/ (props changed) stable/8/usr.bin/calendar/ (props changed) stable/8/usr.bin/catman/ (props changed) stable/8/usr.bin/checknr/ (props changed) stable/8/usr.bin/chpass/Makefile (props changed) stable/8/usr.bin/column/ (props changed) stable/8/usr.bin/comm/ (props changed) stable/8/usr.bin/cpio/ (props changed) stable/8/usr.bin/cpuset/ (props changed) stable/8/usr.bin/csup/ (props changed) stable/8/usr.bin/du/ (props changed) stable/8/usr.bin/ee/ (props changed) stable/8/usr.bin/enigma/ (props changed) stable/8/usr.bin/fetch/ (props changed) stable/8/usr.bin/find/ (props changed) stable/8/usr.bin/finger/ (props changed) stable/8/usr.bin/fold/ (props changed) stable/8/usr.bin/fstat/ (props changed) stable/8/usr.bin/gcore/ (props changed) stable/8/usr.bin/getopt/ (props changed) stable/8/usr.bin/gzip/ (props changed) stable/8/usr.bin/hexdump/ (props changed) stable/8/usr.bin/indent/ (props changed) stable/8/usr.bin/ipcs/ (props changed) stable/8/usr.bin/jot/ (props changed) stable/8/usr.bin/kdump/ (props changed) stable/8/usr.bin/killall/ (props changed) stable/8/usr.bin/ktrace/ (props changed) stable/8/usr.bin/lastcomm/ (props changed) stable/8/usr.bin/ldd/ (props changed) stable/8/usr.bin/less/ (props changed) stable/8/usr.bin/lex/ (props changed) stable/8/usr.bin/limits/ (props changed) stable/8/usr.bin/locale/ (props changed) stable/8/usr.bin/locate/ (props changed) stable/8/usr.bin/lock/ (props changed) stable/8/usr.bin/lockf/ (props changed) stable/8/usr.bin/logger/ (props changed) stable/8/usr.bin/look/ (props changed) stable/8/usr.bin/m4/ (props changed) stable/8/usr.bin/mail/ (props changed) stable/8/usr.bin/make/ (props changed) stable/8/usr.bin/makewhatis/ (props changed) stable/8/usr.bin/minigzip/ (props changed) stable/8/usr.bin/ncal/ (props changed) stable/8/usr.bin/netstat/ (props changed) stable/8/usr.bin/nfsstat/ (props changed) stable/8/usr.bin/pathchk/ (props changed) stable/8/usr.bin/perror/ (props changed) stable/8/usr.bin/printf/ (props changed) stable/8/usr.bin/procstat/ (props changed) stable/8/usr.bin/rlogin/ (props changed) stable/8/usr.bin/rpcgen/ (props changed) stable/8/usr.bin/rpcinfo/ (props changed) stable/8/usr.bin/rs/ (props changed) stable/8/usr.bin/ruptime/ (props changed) stable/8/usr.bin/script/ (props changed) stable/8/usr.bin/sed/ (props changed) stable/8/usr.bin/showmount/ (props changed) stable/8/usr.bin/sockstat/ (props changed) stable/8/usr.bin/split/ (props changed) stable/8/usr.bin/stat/ (props changed) stable/8/usr.bin/su/ (props changed) stable/8/usr.bin/systat/ (props changed) stable/8/usr.bin/tail/ (props changed) stable/8/usr.bin/tar/ (props changed) stable/8/usr.bin/tftp/ (props changed) stable/8/usr.bin/tip/ (props changed) stable/8/usr.bin/top/ (props changed) stable/8/usr.bin/touch/ (props changed) stable/8/usr.bin/tr/ (props changed) stable/8/usr.bin/truss/ (props changed) stable/8/usr.bin/uname/ (props changed) stable/8/usr.bin/unifdef/ (props changed) stable/8/usr.bin/uniq/ (props changed) stable/8/usr.bin/unzip/ (props changed) stable/8/usr.bin/usbhidaction/ (props changed) stable/8/usr.bin/usbhidctl/ (props changed) stable/8/usr.bin/uudecode/ (props changed) stable/8/usr.bin/vmstat/ (props changed) stable/8/usr.bin/w/ (props changed) stable/8/usr.bin/wall/ (props changed) stable/8/usr.bin/whois/ (props changed) stable/8/usr.bin/xargs/ (props changed) stable/8/usr.bin/xinstall/ (props changed) stable/8/usr.bin/xlint/ (props changed) stable/8/usr.bin/xz/ (props changed) stable/8/usr.bin/yacc/ (props changed) stable/8/usr.sbin/ (props changed) stable/8/usr.sbin/Makefile (props changed) stable/8/usr.sbin/acpi/ (props changed) stable/8/usr.sbin/arp/ (props changed) stable/8/usr.sbin/asf/ (props changed) stable/8/usr.sbin/bluetooth/ (props changed) stable/8/usr.sbin/bluetooth/bthidcontrol/ (props changed) stable/8/usr.sbin/bluetooth/bthidd/ (props changed) stable/8/usr.sbin/bluetooth/l2control/ (props changed) stable/8/usr.sbin/bluetooth/l2ping/ (props changed) stable/8/usr.sbin/boot0cfg/ (props changed) stable/8/usr.sbin/bsnmpd/ (props changed) stable/8/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_processor_tbl.c (props changed) stable/8/usr.sbin/burncd/ (props changed) stable/8/usr.sbin/cdcontrol/ (props changed) stable/8/usr.sbin/chown/ (props changed) stable/8/usr.sbin/config/ (props changed) stable/8/usr.sbin/config/SMM.doc/ (props changed) stable/8/usr.sbin/cpucontrol/ (props changed) stable/8/usr.sbin/crashinfo/ (props changed) stable/8/usr.sbin/cron/ (props changed) stable/8/usr.sbin/crunch/examples/ (props changed) stable/8/usr.sbin/ctm/ (props changed) stable/8/usr.sbin/cxgbtool/ (props changed) stable/8/usr.sbin/devinfo/ (props changed) stable/8/usr.sbin/diskinfo/ (props changed) stable/8/usr.sbin/dumpcis/cardinfo.h (props changed) stable/8/usr.sbin/dumpcis/cis.h (props changed) stable/8/usr.sbin/faithd/ (props changed) stable/8/usr.sbin/fdcontrol/ (props changed) stable/8/usr.sbin/fdformat/ (props changed) stable/8/usr.sbin/fdread/ (props changed) stable/8/usr.sbin/fdwrite/ (props changed) stable/8/usr.sbin/fifolog/ (props changed) stable/8/usr.sbin/flowctl/ (props changed) stable/8/usr.sbin/freebsd-update/ (props changed) stable/8/usr.sbin/i2c/ (props changed) stable/8/usr.sbin/ifmcstat/ (props changed) stable/8/usr.sbin/inetd/ (props changed) stable/8/usr.sbin/iostat/ (props changed) stable/8/usr.sbin/jail/ (props changed) stable/8/usr.sbin/jls/ (props changed) stable/8/usr.sbin/kbdmap/ (props changed) stable/8/usr.sbin/lpr/ (props changed) stable/8/usr.sbin/mailwrapper/ (props changed) stable/8/usr.sbin/makefs/ (props changed) stable/8/usr.sbin/mergemaster/ (props changed) stable/8/usr.sbin/mfiutil/ (props changed) stable/8/usr.sbin/mountd/ (props changed) stable/8/usr.sbin/moused/ (props changed) stable/8/usr.sbin/mptutil/ (props changed) stable/8/usr.sbin/mtest/ (props changed) stable/8/usr.sbin/mtree/ (props changed) stable/8/usr.sbin/named/ (props changed) stable/8/usr.sbin/ndp/ (props changed) stable/8/usr.sbin/newsyslog/ (props changed) stable/8/usr.sbin/nfsd/ (props changed) stable/8/usr.sbin/nfsdumpstate/ (props changed) stable/8/usr.sbin/nfsuserd/ (props changed) stable/8/usr.sbin/ntp/ (props changed) stable/8/usr.sbin/pciconf/ (props changed) stable/8/usr.sbin/periodic/ (props changed) stable/8/usr.sbin/pkg_install/ (props changed) stable/8/usr.sbin/pmcannotate/ (props changed) stable/8/usr.sbin/pmccontrol/ (props changed) stable/8/usr.sbin/pmcstat/ (props changed) stable/8/usr.sbin/portsnap/ (props changed) stable/8/usr.sbin/powerd/ (props changed) stable/8/usr.sbin/ppp/ (props changed) stable/8/usr.sbin/pppctl/ (props changed) stable/8/usr.sbin/pstat/ (props changed) stable/8/usr.sbin/pw/ (props changed) stable/8/usr.sbin/rpc.lockd/ (props changed) stable/8/usr.sbin/rpc.statd/ (props changed) stable/8/usr.sbin/rpc.umntall/ (props changed) stable/8/usr.sbin/rpcbind/ (props changed) stable/8/usr.sbin/rtadvd/ (props changed) stable/8/usr.sbin/rtsold/ (props changed) stable/8/usr.sbin/sade/ (props changed) stable/8/usr.sbin/service/ (props changed) stable/8/usr.sbin/services_mkdb/ (props changed) stable/8/usr.sbin/setfmac/ (props changed) stable/8/usr.sbin/setpmac/ (props changed) stable/8/usr.sbin/smbmsg/ (props changed) stable/8/usr.sbin/sysinstall/ (props changed) stable/8/usr.sbin/syslogd/ (props changed) stable/8/usr.sbin/tcpdrop/ (props changed) stable/8/usr.sbin/traceroute/ (props changed) stable/8/usr.sbin/traceroute6/ (props changed) stable/8/usr.sbin/tzsetup/ (props changed) stable/8/usr.sbin/uathload/ (props changed) stable/8/usr.sbin/ugidfw/ (props changed) stable/8/usr.sbin/uhsoctl/ (props changed) stable/8/usr.sbin/usbconfig/ (props changed) stable/8/usr.sbin/usbdump/ (props changed) stable/8/usr.sbin/vidcontrol/ (props changed) stable/8/usr.sbin/watchdogd/ (props changed) stable/8/usr.sbin/wpa/ (props changed) stable/8/usr.sbin/ypserv/ (props changed) stable/8/usr.sbin/zic/ (props changed) Modified: stable/8/UPDATING ============================================================================== --- stable/8/UPDATING Mon Nov 7 13:40:54 2011 (r227305) +++ stable/8/UPDATING Mon Nov 7 13:45:18 2011 (r227306) @@ -15,6 +15,10 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 8. debugging tools present in HEAD were left in place because sun4v support still needs work to become production ready. +20111101: + The broken amd(4) driver has been replaced with esp(4) in the amd64, + i386 and pc98 GENERIC kernel configuration files. + 20110606: A new version of ZFS (version 28) has been merged. This version does not depend on a python library and the Modified: stable/8/share/man/man4/esp.4 ============================================================================== --- stable/8/share/man/man4/esp.4 Mon Nov 7 13:40:54 2011 (r227305) +++ stable/8/share/man/man4/esp.4 Mon Nov 7 13:45:18 2011 (r227306) @@ -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/8/sys/amd64/conf/GENERIC ============================================================================== --- stable/8/sys/amd64/conf/GENERIC Mon Nov 7 13:40:54 2011 (r227305) +++ stable/8/sys/amd64/conf/GENERIC Mon Nov 7 13:45:18 2011 (r227306) @@ -108,7 +108,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/8/sys/conf/NOTES ============================================================================== --- stable/8/sys/conf/NOTES Mon Nov 7 13:40:54 2011 (r227305) +++ stable/8/sys/conf/NOTES Mon Nov 7 13:45:18 2011 (r227306) @@ -1434,7 +1434,9 @@ options TEKEN_XTERM # xterm-style term # 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/8/sys/conf/files ============================================================================== --- stable/8/sys/conf/files Mon Nov 7 13:40:54 2011 (r227305) +++ stable/8/sys/conf/files Mon Nov 7 13:45:18 2011 (r227306) @@ -959,6 +959,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/8/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/8/sys/dev/esp/am53c974reg.h Mon Nov 7 13:45:18 2011 (r227306, 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/8/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/8/sys/dev/esp/esp_pci.c Mon Nov 7 13:45:18 2011 (r227306, 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@FreeBSD.ORG Mon Nov 7 13:46:16 2011 Return-Path: Delivered-To: svn-src-stable@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@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the 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@FreeBSD.ORG Mon Nov 7 15:42:25 2011 Return-Path: Delivered-To: svn-src-stable@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@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the 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@FreeBSD.ORG Mon Nov 7 22:34:07 2011 Return-Path: Delivered-To: svn-src-stable@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@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the 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; From owner-svn-src-stable@FreeBSD.ORG Mon Nov 7 23:09:18 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C836C106564A; Mon, 7 Nov 2011 23:09:18 +0000 (UTC) (envelope-from pho@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B7D2D8FC0C; Mon, 7 Nov 2011 23:09: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 pA7N9Irj000845; Mon, 7 Nov 2011 23:09:18 GMT (envelope-from pho@svn.freebsd.org) Received: (from pho@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA7N9IeU000843; Mon, 7 Nov 2011 23:09:18 GMT (envelope-from pho@svn.freebsd.org) Message-Id: <201111072309.pA7N9IeU000843@svn.freebsd.org> From: Peter Holm Date: Mon, 7 Nov 2011 23:09:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227325 - stable/8/sys/ufs/ufs X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Nov 2011 23:09:18 -0000 Author: pho Date: Mon Nov 7 23:09:18 2011 New Revision: 227325 URL: http://svn.freebsd.org/changeset/base/227325 Log: MFC r226967, r226971: Added missing cache purge of from argument. Modified: stable/8/sys/ufs/ufs/ufs_vnops.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/ufs/ufs/ufs_vnops.c ============================================================================== --- stable/8/sys/ufs/ufs/ufs_vnops.c Mon Nov 7 22:58:49 2011 (r227324) +++ stable/8/sys/ufs/ufs/ufs_vnops.c Mon Nov 7 23:09:18 2011 (r227325) @@ -1512,6 +1512,15 @@ relock: cache_purge(fdvp); } error = ufs_dirremove(fdvp, fip, fcnp->cn_flags, 0); + /* + * The kern_renameat() looks up the fvp using the DELETE flag, which + * causes the removal of the name cache entry for fvp. + * As the relookup of the fvp is done in two steps: + * ufs_lookup_ino() and then VFS_VGET(), another thread might do a + * normal lookup of the from name just before the VFS_VGET() call, + * causing the cache entry to be re-instantiated. + */ + cache_purge(fvp); unlockout: vput(fdvp); From owner-svn-src-stable@FreeBSD.ORG Tue Nov 8 14:24:34 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3F185106566B; Tue, 8 Nov 2011 14:24:34 +0000 (UTC) (envelope-from kensmith@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2E9F38FC15; Tue, 8 Nov 2011 14:24:34 +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 pA8EOY7w035021; Tue, 8 Nov 2011 14:24:34 GMT (envelope-from kensmith@svn.freebsd.org) Received: (from kensmith@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA8EOYRP035019; Tue, 8 Nov 2011 14:24:34 GMT (envelope-from kensmith@svn.freebsd.org) Message-Id: <201111081424.pA8EOYRP035019@svn.freebsd.org> From: Ken Smith Date: Tue, 8 Nov 2011 14:24:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227337 - stable/9/sys/conf X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Nov 2011 14:24:34 -0000 Author: kensmith Date: Tue Nov 8 14:24:33 2011 New Revision: 227337 URL: http://svn.freebsd.org/changeset/base/227337 Log: Start up 9.0-RC2. Approved by: re (implicit) Modified: stable/9/sys/conf/newvers.sh Modified: stable/9/sys/conf/newvers.sh ============================================================================== --- stable/9/sys/conf/newvers.sh Tue Nov 8 14:22:40 2011 (r227336) +++ stable/9/sys/conf/newvers.sh Tue Nov 8 14:24:33 2011 (r227337) @@ -32,7 +32,7 @@ TYPE="FreeBSD" REVISION="9.0" -BRANCH="RC1" +BRANCH="RC2" if [ "X${BRANCH_OVERRIDE}" != "X" ]; then BRANCH=${BRANCH_OVERRIDE} fi From owner-svn-src-stable@FreeBSD.ORG Wed Nov 9 18:12:43 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 471A0106566B; Wed, 9 Nov 2011 18:12:43 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3678A8FC24; Wed, 9 Nov 2011 18:12:43 +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 pA9IChuB093778; Wed, 9 Nov 2011 18:12:43 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA9IChFH093774; Wed, 9 Nov 2011 18:12:43 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201111091812.pA9IChFH093774@svn.freebsd.org> From: John Baldwin Date: Wed, 9 Nov 2011 18:12:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227397 - stable/9/sys/dev/acpica X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Nov 2011 18:12:43 -0000 Author: jhb Date: Wed Nov 9 18:12:42 2011 New Revision: 227397 URL: http://svn.freebsd.org/changeset/base/227397 Log: MFC 226302: If an allocation for a specific resource range fails because it is not in a decoded range for an ACPI Host-PCI bridge, try to allocate it from the ACPI system resource range. If that works, permit the resource allocation regardless. Approved by: re (kib) Modified: stable/9/sys/dev/acpica/acpi.c stable/9/sys/dev/acpica/acpi_pcib_acpi.c stable/9/sys/dev/acpica/acpivar.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/dev/acpica/acpi.c ============================================================================== --- stable/9/sys/dev/acpica/acpi.c Wed Nov 9 18:11:29 2011 (r227396) +++ stable/9/sys/dev/acpica/acpi.c Wed Nov 9 18:12:42 2011 (r227397) @@ -1238,7 +1238,6 @@ acpi_alloc_resource(device_t bus, device struct resource_list_entry *rle; struct resource_list *rl; struct resource *res; - struct rman *rm; int isdefault = (start == 0UL && end == ~0UL); /* @@ -1291,15 +1290,29 @@ acpi_alloc_resource(device_t bus, device } else res = BUS_ALLOC_RESOURCE(device_get_parent(bus), child, type, rid, start, end, count, flags); - if (res != NULL || start + count - 1 != end) - return (res); /* * If the first attempt failed and this is an allocation of a * specific range, try to satisfy the request via a suballocation - * from our system resource regions. Note that we only handle - * memory and I/O port system resources. + * from our system resource regions. */ + if (res == NULL && start + count - 1 == end) + res = acpi_alloc_sysres(child, type, rid, start, end, count, flags); + return (res); +} + +/* + * Attempt to allocate a specific resource range from the system + * resource ranges. Note that we only handle memory and I/O port + * system resources. + */ +struct resource * +acpi_alloc_sysres(device_t child, int type, int *rid, u_long start, u_long end, + u_long count, u_int flags) +{ + struct rman *rm; + struct resource *res; + switch (type) { case SYS_RES_IOPORT: rm = &acpi_rman_io; @@ -1311,6 +1324,7 @@ acpi_alloc_resource(device_t bus, device return (NULL); } + KASSERT(start + count - 1 == end, ("wildcard resource range")); res = rman_reserve_resource(rm, start, end, count, flags & ~RF_ACTIVE, child); if (res == NULL) Modified: stable/9/sys/dev/acpica/acpi_pcib_acpi.c ============================================================================== --- stable/9/sys/dev/acpica/acpi_pcib_acpi.c Wed Nov 9 18:11:29 2011 (r227396) +++ stable/9/sys/dev/acpica/acpi_pcib_acpi.c Wed Nov 9 18:12:42 2011 (r227397) @@ -501,6 +501,7 @@ acpi_pcib_acpi_alloc_resource(device_t d { #ifdef NEW_PCIB struct acpi_hpcib_softc *sc; + struct resource *res; #endif #if defined(__i386__) || defined(__amd64__) @@ -509,8 +510,11 @@ acpi_pcib_acpi_alloc_resource(device_t d #ifdef NEW_PCIB sc = device_get_softc(dev); - return (pcib_host_res_alloc(&sc->ap_host_res, child, type, rid, start, end, - count, flags)); + res = pcib_host_res_alloc(&sc->ap_host_res, child, type, rid, start, end, + count, flags); + if (res == NULL && start + count - 1 == end) + res = acpi_alloc_sysres(child, type, rid, start, end, count, flags); + return (res); #else return (bus_generic_alloc_resource(dev, child, type, rid, start, end, count, flags)); Modified: stable/9/sys/dev/acpica/acpivar.h ============================================================================== --- stable/9/sys/dev/acpica/acpivar.h Wed Nov 9 18:11:29 2011 (r227396) +++ stable/9/sys/dev/acpica/acpivar.h Wed Nov 9 18:12:42 2011 (r227397) @@ -382,6 +382,8 @@ ACPI_STATUS acpi_lookup_irq_resource(dev struct resource *res, ACPI_RESOURCE *acpi_res); ACPI_STATUS acpi_parse_resources(device_t dev, ACPI_HANDLE handle, struct acpi_parse_resource_set *set, void *arg); +struct resource *acpi_alloc_sysres(device_t child, int type, int *rid, + u_long start, u_long end, u_long count, u_int flags); /* ACPI event handling */ UINT32 acpi_event_power_button_sleep(void *context); From owner-svn-src-stable@FreeBSD.ORG Wed Nov 9 18:26:20 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 478EC1065689; Wed, 9 Nov 2011 18:26:20 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 35EE58FC1C; Wed, 9 Nov 2011 18:26:20 +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 pA9IQKiK094349; Wed, 9 Nov 2011 18:26:20 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA9IQKRW094342; Wed, 9 Nov 2011 18:26:20 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201111091826.pA9IQKRW094342@svn.freebsd.org> From: John Baldwin Date: Wed, 9 Nov 2011 18:26:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227400 - in stable/9/sys/boot/i386: common libi386 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Nov 2011 18:26:20 -0000 Author: jhb Date: Wed Nov 9 18:26:19 2011 New Revision: 227400 URL: http://svn.freebsd.org/changeset/base/227400 Log: MFC 226748: - Add a new header for the x86 boot code that defines various structures and constants related to the BIOS Enhanced Disk Drive Specification. - Use this header instead of magic numbers and various duplicate structure definitions for doing I/O. - Use an actual structure for the request to fetch drive parameters in drvsize() rather than a gross hack of a char array with some magic size. While here, change drvsize() to only pass the 1.1 version of the structure and not request device path information. If we want device path information you have to set the length of the device path information as an input (along with probably checking the actual EDD version to see which size one should use as the device path information is variable-length). This fixes data smashing problems from passing an EDD 3 structure to BIOSes supporting EDD 4. Approved by: re (kib) Added: stable/9/sys/boot/i386/common/edd.h - copied unchanged from r226748, head/sys/boot/i386/common/edd.h Modified: stable/9/sys/boot/i386/common/drv.c stable/9/sys/boot/i386/libi386/Makefile stable/9/sys/boot/i386/libi386/bioscd.c stable/9/sys/boot/i386/libi386/biosdisk.c stable/9/sys/boot/i386/libi386/libi386.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/boot/i386/common/drv.c ============================================================================== --- stable/9/sys/boot/i386/common/drv.c Wed Nov 9 18:25:50 2011 (r227399) +++ stable/9/sys/boot/i386/common/drv.c Wed Nov 9 18:26:19 2011 (r227400) @@ -26,6 +26,7 @@ __FBSDID("$FreeBSD$"); #include "rbx.h" #include "util.h" #include "drv.h" +#include "edd.h" #ifdef USE_XREAD #include "xreadorg.h" #endif @@ -34,38 +35,30 @@ __FBSDID("$FreeBSD$"); #define V86_ZR(x) ((x) & PSL_Z) #ifdef GPT +static struct edd_params params; + uint64_t drvsize(struct dsk *dskp) { - unsigned char params[0x42]; - uint64_t sectors; - - *(uint32_t *)params = sizeof(params); + params.len = sizeof(struct edd_params); v86.ctl = V86_FLAGS; v86.addr = 0x13; v86.eax = 0x4800; v86.edx = dskp->drive; - v86.ds = VTOPSEG(params); - v86.esi = VTOPOFF(params); + v86.ds = VTOPSEG(¶ms); + v86.esi = VTOPOFF(¶ms); v86int(); if (V86_CY(v86.efl)) { printf("error %u\n", v86.eax >> 8 & 0xff); return (0); } - memcpy(§ors, params + 0x10, sizeof(sectors)); - return (sectors); + return (params.sectors); } #endif /* GPT */ #ifndef USE_XREAD -static struct { - uint16_t len; - uint16_t count; - uint16_t off; - uint16_t seg; - uint64_t lba; -} packet; +static struct edd_packet packet; #endif int @@ -76,7 +69,7 @@ drvread(struct dsk *dskp, void *buf, dad if (!OPT_CHECK(RBX_QUIET)) printf("%c\b", c = c << 8 | c >> 24); #ifndef USE_XREAD - packet.len = 0x10; + packet.len = sizeof(struct edd_packet); packet.count = nblk; packet.off = VTOPOFF(buf); packet.seg = VTOPSEG(buf); @@ -110,7 +103,7 @@ int drvwrite(struct dsk *dskp, void *buf, daddr_t lba, unsigned nblk) { - packet.len = 0x10; + packet.len = sizeof(struct edd_packet); packet.count = nblk; packet.off = VTOPOFF(buf); packet.seg = VTOPSEG(buf); Copied: stable/9/sys/boot/i386/common/edd.h (from r226748, head/sys/boot/i386/common/edd.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/sys/boot/i386/common/edd.h Wed Nov 9 18:26:19 2011 (r227400, copy of r226748, head/sys/boot/i386/common/edd.h) @@ -0,0 +1,110 @@ +/*- + * Copyright (c) 2011 Advanced Computing Technologies LLC + * Written by: John H. Baldwin + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _EDD_H_ +#define _EDD_H_ + +/* Supported interfaces for "Check Extensions Present". */ +#define EDD_INTERFACE_FIXED_DISK 0x01 +#define EDD_INTERFACE_EJECT 0x02 +#define EDD_INTERFACE_EDD 0x04 + +struct edd_packet { + uint16_t len; + uint16_t count; + uint16_t off; + uint16_t seg; + uint64_t lba; +}; + +struct edd_packet_v3 { + uint16_t len; + uint16_t count; + uint16_t off; + uint16_t seg; + uint64_t lba; + uint64_t phys_addr; +}; + +struct edd_params { + uint16_t len; + uint16_t flags; + uint32_t cylinders; + uint32_t heads; + uint32_t sectors_per_track; + uint64_t sectors; + uint16_t sector_size; + uint16_t edd_params_seg; + uint16_t edd_params_off; +}; + +struct edd_device_path_v3 { + uint16_t key; + uint8_t len; + uint8_t reserved[3]; + char host_bus[4]; + char interface[8]; + uint64_t interface_path; + uint64_t device_path; + uint8_t reserved2[1]; + uint8_t checksum; +}; + +struct edd_params_v3 { + struct edd_params params; + struct edd_device_path_v3 device_path; +}; + +struct edd_device_path_v4 { + uint16_t key; + uint8_t len; + uint8_t reserved[3]; + char host_bus[4]; + char interface[8]; + uint64_t interface_path; + uint64_t device_path[2]; + uint8_t reserved2[1]; + uint8_t checksum; +}; + +struct edd_params_v4 { + struct edd_params params; + struct edd_device_path_v4 device_path; +}; + +#define EDD_FLAGS_DMA_BOUNDARY_HANDLING 0x0001 +#define EDD_FLAGS_REMOVABLE_MEDIA 0x0002 +#define EDD_FLAGS_WRITE_VERIFY 0x0004 +#define EDD_FLAGS_MEDIA_CHANGE_NOTIFICATION 0x0008 +#define EDD_FLAGS_LOCKABLE_MEDIA 0x0010 +#define EDD_FLAGS_NO_MEDIA_PRESENT 0x0020 + +#define EDD_DEVICE_PATH_KEY 0xbedd + +#endif /* !_EDD_H_ */ Modified: stable/9/sys/boot/i386/libi386/Makefile ============================================================================== --- stable/9/sys/boot/i386/libi386/Makefile Wed Nov 9 18:25:50 2011 (r227399) +++ stable/9/sys/boot/i386/libi386/Makefile Wed Nov 9 18:26:19 2011 (r227400) @@ -47,7 +47,8 @@ CFLAGS+= -DTERM_EMU # XXX: make alloca() useable CFLAGS+= -Dalloca=__builtin_alloca -CFLAGS+= -I${.CURDIR}/../../common -I${.CURDIR}/../btx/lib \ +CFLAGS+= -I${.CURDIR}/../../common -I${.CURDIR}/../common \ + -I${.CURDIR}/../btx/lib \ -I${.CURDIR}/../../../contrib/dev/acpica/include \ -I${.CURDIR}/../../.. -I. # the location of libstand Modified: stable/9/sys/boot/i386/libi386/bioscd.c ============================================================================== --- stable/9/sys/boot/i386/libi386/bioscd.c Wed Nov 9 18:25:50 2011 (r227399) +++ stable/9/sys/boot/i386/libi386/bioscd.c Wed Nov 9 18:26:19 2011 (r227400) @@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include "libi386.h" #define BIOSCD_SECSIZE 2048 @@ -325,9 +326,9 @@ bc_read(int unit, daddr_t dblk, int blks v86int(); } - packet.len = 0x10; + packet.len = sizeof(struct edd_packet); packet.count = x; - packet.offset = VTOPOFF(xp); + packet.off = VTOPOFF(xp); packet.seg = VTOPSEG(xp); packet.lba = dblk; v86.ctl = V86_FLAGS; Modified: stable/9/sys/boot/i386/libi386/biosdisk.c ============================================================================== --- stable/9/sys/boot/i386/libi386/biosdisk.c Wed Nov 9 18:25:50 2011 (r227399) +++ stable/9/sys/boot/i386/libi386/biosdisk.c Wed Nov 9 18:26:19 2011 (r227400) @@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include "libi386.h" #define BIOS_NUMDRIVES 0x475 @@ -266,7 +267,7 @@ bd_int13probe(struct bdinfo *bd) v86int(); if (!(v86.efl & 0x1) && /* carry clear */ ((v86.ebx & 0xffff) == 0xaa55) && /* signature */ - (v86.ecx & 0x1)) { /* packets mode ok */ + (v86.ecx & EDD_INTERFACE_FIXED_DISK)) { /* packets mode ok */ bd->bd_flags |= BD_MODEEDD1; if((v86.eax & 0xff00) >= 0x3000) bd->bd_flags |= BD_MODEEDD3; @@ -1134,9 +1135,9 @@ bd_edd_io(struct open_disk *od, daddr_t { static struct edd_packet packet; - packet.len = 0x10; + packet.len = sizeof(struct edd_packet); packet.count = blks; - packet.offset = VTOPOFF(dest); + packet.off = VTOPOFF(dest); packet.seg = VTOPSEG(dest); packet.lba = dblk; v86.ctl = V86_FLAGS; Modified: stable/9/sys/boot/i386/libi386/libi386.h ============================================================================== --- stable/9/sys/boot/i386/libi386/libi386.h Wed Nov 9 18:25:50 2011 (r227399) +++ stable/9/sys/boot/i386/libi386/libi386.h Wed Nov 9 18:26:19 2011 (r227400) @@ -52,14 +52,6 @@ struct i386_devdesc } d_kind; }; -struct edd_packet { - uint16_t len; - uint16_t count; - uint16_t offset; - uint16_t seg; - uint64_t lba; -}; - int i386_getdev(void **vdev, const char *devspec, const char **path); char *i386_fmtdev(void *vdev); int i386_setcurrdev(struct env_var *ev, int flags, const void *value); From owner-svn-src-stable@FreeBSD.ORG Wed Nov 9 18:51:41 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D4C0F106566C; Wed, 9 Nov 2011 18:51:41 +0000 (UTC) (envelope-from pho@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C48818FC15; Wed, 9 Nov 2011 18:51:41 +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 pA9IpfNZ095214; Wed, 9 Nov 2011 18:51:41 GMT (envelope-from pho@svn.freebsd.org) Received: (from pho@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA9IpfYH095212; Wed, 9 Nov 2011 18:51:41 GMT (envelope-from pho@svn.freebsd.org) Message-Id: <201111091851.pA9IpfYH095212@svn.freebsd.org> From: Peter Holm Date: Wed, 9 Nov 2011 18:51:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227402 - stable/9/sys/ufs/ufs X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Nov 2011 18:51:41 -0000 Author: pho Date: Wed Nov 9 18:51:41 2011 New Revision: 227402 URL: http://svn.freebsd.org/changeset/base/227402 Log: MFC r226971 Added missing cache purge of from argument. Approved by: re (kensmith) Modified: stable/9/sys/ufs/ufs/ufs_vnops.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/ufs/ufs/ufs_vnops.c ============================================================================== --- stable/9/sys/ufs/ufs/ufs_vnops.c Wed Nov 9 18:48:36 2011 (r227401) +++ stable/9/sys/ufs/ufs/ufs_vnops.c Wed Nov 9 18:51:41 2011 (r227402) @@ -1519,6 +1519,15 @@ relock: cache_purge(fdvp); } error = ufs_dirremove(fdvp, fip, fcnp->cn_flags, 0); + /* + * The kern_renameat() looks up the fvp using the DELETE flag, which + * causes the removal of the name cache entry for fvp. + * As the relookup of the fvp is done in two steps: + * ufs_lookup_ino() and then VFS_VGET(), another thread might do a + * normal lookup of the from name just before the VFS_VGET() call, + * causing the cache entry to be re-instantiated. + */ + cache_purge(fvp); unlockout: vput(fdvp); From owner-svn-src-stable@FreeBSD.ORG Thu Nov 10 16:50:37 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 604FB1065670; Thu, 10 Nov 2011 16:50:37 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4EFCC8FC18; Thu, 10 Nov 2011 16:50: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 pAAGob6L047536; Thu, 10 Nov 2011 16:50:37 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pAAGobuW047534; Thu, 10 Nov 2011 16:50:37 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201111101650.pAAGobuW047534@svn.freebsd.org> From: Alan Cox Date: Thu, 10 Nov 2011 16:50:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227420 - stable/9/sys/vm X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Nov 2011 16:50:37 -0000 Author: alc Date: Thu Nov 10 16:50:36 2011 New Revision: 227420 URL: http://svn.freebsd.org/changeset/base/227420 Log: MFC r226740 Speed up vm_page_cache() and vm_page_remove() by checking for a few common cases that can be handled in constant time. Approved by: re (kib) Modified: stable/9/sys/vm/vm_page.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/vm/vm_page.c ============================================================================== --- stable/9/sys/vm/vm_page.c Thu Nov 10 12:05:26 2011 (r227419) +++ stable/9/sys/vm/vm_page.c Thu Nov 10 16:50:36 2011 (r227420) @@ -908,7 +908,7 @@ void vm_page_remove(vm_page_t m) { vm_object_t object; - vm_page_t root; + vm_page_t next, prev, root; if ((m->oflags & VPO_UNMANAGED) == 0) vm_page_lock_assert(m, MA_OWNED); @@ -923,15 +923,42 @@ vm_page_remove(vm_page_t m) /* * Now remove from the object's list of backed pages. */ - if (m != object->root) - vm_page_splay(m->pindex, object->root); - if (m->left == NULL) - root = m->right; - else { - root = vm_page_splay(m->pindex, m->left); - root->right = m->right; + if ((next = TAILQ_NEXT(m, listq)) != NULL && next->left == m) { + /* + * Since the page's successor in the list is also its parent + * in the tree, its right subtree must be empty. + */ + next->left = m->left; + KASSERT(m->right == NULL, + ("vm_page_remove: page %p has right child", m)); + } else if ((prev = TAILQ_PREV(m, pglist, listq)) != NULL && + prev->right == m) { + /* + * Since the page's predecessor in the list is also its parent + * in the tree, its left subtree must be empty. + */ + KASSERT(m->left == NULL, + ("vm_page_remove: page %p has left child", m)); + prev->right = m->right; + } else { + if (m != object->root) + vm_page_splay(m->pindex, object->root); + if (m->left == NULL) + root = m->right; + else if (m->right == NULL) + root = m->left; + else { + /* + * Move the page's successor to the root, because + * pages are usually removed in ascending order. + */ + if (m->right != next) + vm_page_splay(m->pindex, m->right); + next->left = m->left; + root = next; + } + object->root = root; } - object->root = root; TAILQ_REMOVE(&object->memq, m, listq); /* @@ -2021,7 +2048,7 @@ void vm_page_cache(vm_page_t m) { vm_object_t object; - vm_page_t root; + vm_page_t next, prev, root; vm_page_lock_assert(m, MA_OWNED); object = m->object; @@ -2056,15 +2083,42 @@ vm_page_cache(vm_page_t m) * Remove the page from the object's collection of resident * pages. */ - if (m != object->root) - vm_page_splay(m->pindex, object->root); - if (m->left == NULL) - root = m->right; - else { - root = vm_page_splay(m->pindex, m->left); - root->right = m->right; + if ((next = TAILQ_NEXT(m, listq)) != NULL && next->left == m) { + /* + * Since the page's successor in the list is also its parent + * in the tree, its right subtree must be empty. + */ + next->left = m->left; + KASSERT(m->right == NULL, + ("vm_page_cache: page %p has right child", m)); + } else if ((prev = TAILQ_PREV(m, pglist, listq)) != NULL && + prev->right == m) { + /* + * Since the page's predecessor in the list is also its parent + * in the tree, its left subtree must be empty. + */ + KASSERT(m->left == NULL, + ("vm_page_cache: page %p has left child", m)); + prev->right = m->right; + } else { + if (m != object->root) + vm_page_splay(m->pindex, object->root); + if (m->left == NULL) + root = m->right; + else if (m->right == NULL) + root = m->left; + else { + /* + * Move the page's successor to the root, because + * pages are usually removed in ascending order. + */ + if (m->right != next) + vm_page_splay(m->pindex, m->right); + next->left = m->left; + root = next; + } + object->root = root; } - object->root = root; TAILQ_REMOVE(&object->memq, m, listq); object->resident_page_count--; From owner-svn-src-stable@FreeBSD.ORG Thu Nov 10 17:04:33 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9AF701065673; Thu, 10 Nov 2011 17:04:33 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 89D988FC0A; Thu, 10 Nov 2011 17:04: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 pAAH4XNe048044; Thu, 10 Nov 2011 17:04:33 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pAAH4XdQ048042; Thu, 10 Nov 2011 17:04:33 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201111101704.pAAH4XdQ048042@svn.freebsd.org> From: Alan Cox Date: Thu, 10 Nov 2011 17:04:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227422 - stable/8/sys/vm X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Nov 2011 17:04:33 -0000 Author: alc Date: Thu Nov 10 17:04:33 2011 New Revision: 227422 URL: http://svn.freebsd.org/changeset/base/227422 Log: MFC r226740 Speed up vm_page_cache() and vm_page_remove() by checking for a few common cases that can be handled in constant time. Modified: stable/8/sys/vm/vm_page.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/vm/vm_page.c ============================================================================== --- stable/8/sys/vm/vm_page.c Thu Nov 10 17:01:34 2011 (r227421) +++ stable/8/sys/vm/vm_page.c Thu Nov 10 17:04:33 2011 (r227422) @@ -737,7 +737,7 @@ void vm_page_remove(vm_page_t m) { vm_object_t object; - vm_page_t root; + vm_page_t next, prev, root; if ((object = m->object) == NULL) return; @@ -751,15 +751,42 @@ vm_page_remove(vm_page_t m) /* * Now remove from the object's list of backed pages. */ - if (m != object->root) - vm_page_splay(m->pindex, object->root); - if (m->left == NULL) - root = m->right; - else { - root = vm_page_splay(m->pindex, m->left); - root->right = m->right; + if ((next = TAILQ_NEXT(m, listq)) != NULL && next->left == m) { + /* + * Since the page's successor in the list is also its parent + * in the tree, its right subtree must be empty. + */ + next->left = m->left; + KASSERT(m->right == NULL, + ("vm_page_remove: page %p has right child", m)); + } else if ((prev = TAILQ_PREV(m, pglist, listq)) != NULL && + prev->right == m) { + /* + * Since the page's predecessor in the list is also its parent + * in the tree, its left subtree must be empty. + */ + KASSERT(m->left == NULL, + ("vm_page_remove: page %p has left child", m)); + prev->right = m->right; + } else { + if (m != object->root) + vm_page_splay(m->pindex, object->root); + if (m->left == NULL) + root = m->right; + else if (m->right == NULL) + root = m->left; + else { + /* + * Move the page's successor to the root, because + * pages are usually removed in ascending order. + */ + if (m->right != next) + vm_page_splay(m->pindex, m->right); + next->left = m->left; + root = next; + } + object->root = root; } - object->root = root; TAILQ_REMOVE(&object->memq, m, listq); /* @@ -1802,7 +1829,7 @@ void vm_page_cache(vm_page_t m) { vm_object_t object; - vm_page_t root; + vm_page_t next, prev, root; mtx_assert(&vm_page_queue_mtx, MA_OWNED); object = m->object; @@ -1838,15 +1865,42 @@ vm_page_cache(vm_page_t m) * Remove the page from the object's collection of resident * pages. */ - if (m != object->root) - vm_page_splay(m->pindex, object->root); - if (m->left == NULL) - root = m->right; - else { - root = vm_page_splay(m->pindex, m->left); - root->right = m->right; + if ((next = TAILQ_NEXT(m, listq)) != NULL && next->left == m) { + /* + * Since the page's successor in the list is also its parent + * in the tree, its right subtree must be empty. + */ + next->left = m->left; + KASSERT(m->right == NULL, + ("vm_page_cache: page %p has right child", m)); + } else if ((prev = TAILQ_PREV(m, pglist, listq)) != NULL && + prev->right == m) { + /* + * Since the page's predecessor in the list is also its parent + * in the tree, its left subtree must be empty. + */ + KASSERT(m->left == NULL, + ("vm_page_cache: page %p has left child", m)); + prev->right = m->right; + } else { + if (m != object->root) + vm_page_splay(m->pindex, object->root); + if (m->left == NULL) + root = m->right; + else if (m->right == NULL) + root = m->left; + else { + /* + * Move the page's successor to the root, because + * pages are usually removed in ascending order. + */ + if (m->right != next) + vm_page_splay(m->pindex, m->right); + next->left = m->left; + root = next; + } + object->root = root; } - object->root = root; TAILQ_REMOVE(&object->memq, m, listq); object->resident_page_count--; From owner-svn-src-stable@FreeBSD.ORG Thu Nov 10 19:10:54 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 427A3106566B; Thu, 10 Nov 2011 19:10:54 +0000 (UTC) (envelope-from andre@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 31D0E8FC15; Thu, 10 Nov 2011 19:10:54 +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 pAAJAsYJ052223; Thu, 10 Nov 2011 19:10:54 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pAAJAsWq052221; Thu, 10 Nov 2011 19:10:54 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201111101910.pAAJAsWq052221@svn.freebsd.org> From: Andre Oppermann Date: Thu, 10 Nov 2011 19:10:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227423 - stable/9/sys/netinet X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Nov 2011 19:10:54 -0000 Author: andre Date: Thu Nov 10 19:10:53 2011 New Revision: 227423 URL: http://svn.freebsd.org/changeset/base/227423 Log: Back out r226299 (MFC of r226105) which caused a number of ports that depend on the incorrect IP length field. The fix stays in HEAD and ports should test for it. Requested by: glebius Approved by: re (kib) Modified: stable/9/sys/netinet/raw_ip.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/netinet/raw_ip.c ============================================================================== --- stable/9/sys/netinet/raw_ip.c Thu Nov 10 17:04:33 2011 (r227422) +++ stable/9/sys/netinet/raw_ip.c Thu Nov 10 19:10:53 2011 (r227423) @@ -289,13 +289,6 @@ rip_input(struct mbuf *m, int off) last = NULL; ifp = m->m_pkthdr.rcvif; - /* - * Add back the IP header length which was - * removed by ip_input(). Raw sockets do - * not modify the packet except for some - * byte order swaps. - */ - ip->ip_len += off; hash = INP_PCBHASH_RAW(proto, ip->ip_src.s_addr, ip->ip_dst.s_addr, V_ripcbinfo.ipi_hashmask); From owner-svn-src-stable@FreeBSD.ORG Thu Nov 10 19:36:20 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 34607106564A; Thu, 10 Nov 2011 19:36:20 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0A3068FC0C; Thu, 10 Nov 2011 19:36:20 +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 pAAJaJxh053276; Thu, 10 Nov 2011 19:36:19 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pAAJaJhd053274; Thu, 10 Nov 2011 19:36:19 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201111101936.pAAJaJhd053274@svn.freebsd.org> From: Michael Tuexen Date: Thu, 10 Nov 2011 19:36:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227424 - stable/9/sys/netinet X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Nov 2011 19:36:20 -0000 Author: tuexen Date: Thu Nov 10 19:36:19 2011 New Revision: 227424 URL: http://svn.freebsd.org/changeset/base/227424 Log: MFC 227266: Initialize all components of the sent COOKIE. Approved by: re@ Modified: stable/9/sys/netinet/sctp_output.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/netinet/sctp_output.c ============================================================================== --- stable/9/sys/netinet/sctp_output.c Thu Nov 10 19:10:53 2011 (r227423) +++ stable/9/sys/netinet/sctp_output.c Thu Nov 10 19:36:19 2011 (r227424) @@ -5711,6 +5711,8 @@ do_a_abort: stc.laddress[2] = 0; stc.laddress[3] = 0; stc.laddr_type = SCTP_IPV4_ADDRESS; + /* scope_id is only for v6 */ + stc.scope_id = 0; break; #endif #ifdef INET6 @@ -5719,6 +5721,7 @@ do_a_abort: memcpy(&stc.address, &sin6->sin6_addr, sizeof(struct in6_addr)); stc.addr_type = SCTP_IPV6_ADDRESS; + stc.scope_id = sin6->sin6_scope_id; if (net->src_addr_selected == 0) { /* * strange case here, the INIT should have @@ -5746,6 +5749,7 @@ do_a_abort: /* who are we */ memcpy(stc.identification, SCTP_VERSION_STRING, min(strlen(SCTP_VERSION_STRING), sizeof(stc.identification))); + memset(stc.reserved, 0, SCTP_RESERVE_SPACE); /* now the chunk header */ initack->ch.chunk_type = SCTP_INITIATION_ACK; initack->ch.chunk_flags = 0; From owner-svn-src-stable@FreeBSD.ORG Thu Nov 10 19:54:01 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 339FF1065675; Thu, 10 Nov 2011 19:54:01 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 16F648FC19; Thu, 10 Nov 2011 19:54:01 +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 pAAJs0dI053882; Thu, 10 Nov 2011 19:54:00 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pAAJs0QW053880; Thu, 10 Nov 2011 19:54:00 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201111101954.pAAJs0QW053880@svn.freebsd.org> From: Michael Tuexen Date: Thu, 10 Nov 2011 19:54:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227426 - stable/9/sys/netinet X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Nov 2011 19:54:01 -0000 Author: tuexen Date: Thu Nov 10 19:54:00 2011 New Revision: 227426 URL: http://svn.freebsd.org/changeset/base/227426 Log: MFC 227320: When loading addresses from INITs, always use the correct local address. Approved by: re@ Modified: stable/9/sys/netinet/sctp_pcb.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/netinet/sctp_pcb.c ============================================================================== --- stable/9/sys/netinet/sctp_pcb.c Thu Nov 10 19:41:52 2011 (r227425) +++ stable/9/sys/netinet/sctp_pcb.c Thu Nov 10 19:54:00 2011 (r227426) @@ -6181,54 +6181,65 @@ sctp_load_addresses_from_init(struct sct sin6.sin6_len = sizeof(struct sockaddr_in6); sin6.sin6_port = stcb->rport; #endif - if (altsa == NULL) { - iph = mtod(m, struct ip *); - switch (iph->ip_v) { + iph = mtod(m, struct ip *); + switch (iph->ip_v) { #ifdef INET - case IPVERSION: - { - /* its IPv4 */ - struct sockaddr_in *sin_2; - - sin_2 = (struct sockaddr_in *)(local_sa); - memset(sin_2, 0, sizeof(sin)); - sin_2->sin_family = AF_INET; - sin_2->sin_len = sizeof(sin); - sin_2->sin_port = sh->dest_port; - sin_2->sin_addr.s_addr = iph->ip_dst.s_addr; + case IPVERSION: + { + /* its IPv4 */ + struct sockaddr_in *sin_2; + + sin_2 = (struct sockaddr_in *)(local_sa); + memset(sin_2, 0, sizeof(sin)); + sin_2->sin_family = AF_INET; + sin_2->sin_len = sizeof(sin); + sin_2->sin_port = sh->dest_port; + sin_2->sin_addr.s_addr = iph->ip_dst.s_addr; + if (altsa) { + /* + * For cookies we use the src address NOT + * from the packet but from the original + * INIT. + */ + sa = altsa; + } else { sin.sin_addr = iph->ip_src; sa = (struct sockaddr *)&sin; - break; } + break; + } #endif #ifdef INET6 - case IPV6_VERSION >> 4: - { - /* its IPv6 */ - struct ip6_hdr *ip6; - struct sockaddr_in6 *sin6_2; - - ip6 = mtod(m, struct ip6_hdr *); - sin6_2 = (struct sockaddr_in6 *)(local_sa); - memset(sin6_2, 0, sizeof(sin6)); - sin6_2->sin6_family = AF_INET6; - sin6_2->sin6_len = sizeof(struct sockaddr_in6); - sin6_2->sin6_port = sh->dest_port; + case IPV6_VERSION >> 4: + { + /* its IPv6 */ + struct ip6_hdr *ip6; + struct sockaddr_in6 *sin6_2; + + ip6 = mtod(m, struct ip6_hdr *); + sin6_2 = (struct sockaddr_in6 *)(local_sa); + memset(sin6_2, 0, sizeof(sin6)); + sin6_2->sin6_family = AF_INET6; + sin6_2->sin6_len = sizeof(struct sockaddr_in6); + sin6_2->sin6_port = sh->dest_port; + sin6_2->sin6_addr = ip6->ip6_dst; + if (altsa) { + /* + * For cookies we use the src address NOT + * from the packet but from the original + * INIT. + */ + sa = altsa; + } else { sin6.sin6_addr = ip6->ip6_src; sa = (struct sockaddr *)&sin6; - break; } -#endif - default: - return (-1); break; } - } else { - /* - * For cookies we use the src address NOT from the packet - * but from the original INIT - */ - sa = altsa; +#endif + default: + return (-1); + break; } /* Turn off ECN until we get through all params */ ecn_allowed = 0; From owner-svn-src-stable@FreeBSD.ORG Thu Nov 10 20:28:31 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 36DA91065670; Thu, 10 Nov 2011 20:28:31 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 258AD8FC0A; Thu, 10 Nov 2011 20:28:31 +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 pAAKSVo3055100; Thu, 10 Nov 2011 20:28:31 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pAAKSUTB055094; Thu, 10 Nov 2011 20:28:30 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201111102028.pAAKSUTB055094@svn.freebsd.org> From: Mikolaj Golub Date: Thu, 10 Nov 2011 20:28:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227428 - in stable/9/sys: netinet netinet6 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Nov 2011 20:28:31 -0000 Author: trociny Date: Thu Nov 10 20:28:30 2011 New Revision: 227428 URL: http://svn.freebsd.org/changeset/base/227428 Log: MFC r227204, 227206, 227207: r227204: Fix the typo made in r157474. r227206: Before dereferencing intotw() check for NULL, the same way as it is done for in_pcb (see r157474). r227207: Cache SO_REUSEPORT socket option in inpcb-layer in order to avoid inp_socket->so_options dereference when we may not acquire the lock on the inpcb. This fixes the crash due to NULL pointer dereference in in_pcbbind_setup() when inp_socket->so_options in a pcb returned by in_pcblookup_local() was checked. Reported by: dave jones , Arnaud Lacombe Suggested by: rwatson Glanced by: rwatson Tested by: dave jones Approved by: re (kib) Modified: stable/9/sys/netinet/in_pcb.c stable/9/sys/netinet/in_pcb.h stable/9/sys/netinet/ip_output.c stable/9/sys/netinet6/in6_pcb.c stable/9/sys/netinet6/ip6_output.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/netinet/in_pcb.c ============================================================================== --- stable/9/sys/netinet/in_pcb.c Thu Nov 10 20:15:35 2011 (r227427) +++ stable/9/sys/netinet/in_pcb.c Thu Nov 10 20:28:30 2011 (r227428) @@ -575,8 +575,7 @@ in_pcbbind_setup(struct inpcb *inp, stru ntohl(t->inp_faddr.s_addr) == INADDR_ANY) && (ntohl(sin->sin_addr.s_addr) != INADDR_ANY || ntohl(t->inp_laddr.s_addr) != INADDR_ANY || - (t->inp_socket->so_options & - SO_REUSEPORT) == 0) && + (t->inp_flags2 & INP_REUSEPORT) == 0) && (inp->inp_cred->cr_uid != t->inp_cred->cr_uid)) return (EADDRINUSE); @@ -590,19 +589,19 @@ in_pcbbind_setup(struct inpcb *inp, stru * being in use (for now). This is better * than a panic, but not desirable. */ - tw = intotw(inp); + tw = intotw(t); if (tw == NULL || (reuseport & tw->tw_so_options) == 0) return (EADDRINUSE); - } else if (t && - (reuseport & t->inp_socket->so_options) == 0) { + } else if (t && (reuseport == 0 || + (t->inp_flags2 & INP_REUSEPORT) == 0)) { #ifdef INET6 if (ntohl(sin->sin_addr.s_addr) != INADDR_ANY || ntohl(t->inp_laddr.s_addr) != INADDR_ANY || - INP_SOCKAF(so) == - INP_SOCKAF(t->inp_socket)) + (inp->inp_vflag & INP_IPV6PROTO) == 0 || + (t->inp_vflag & INP_IPV6PROTO) == 0) #endif return (EADDRINUSE); } Modified: stable/9/sys/netinet/in_pcb.h ============================================================================== --- stable/9/sys/netinet/in_pcb.h Thu Nov 10 20:15:35 2011 (r227427) +++ stable/9/sys/netinet/in_pcb.h Thu Nov 10 20:28:30 2011 (r227428) @@ -540,6 +540,7 @@ void inp_4tuple_get(struct inpcb *inp, #define INP_LLE_VALID 0x00000001 /* cached lle is valid */ #define INP_RT_VALID 0x00000002 /* cached rtentry is valid */ #define INP_PCBGROUPWILD 0x00000004 /* in pcbgroup wildcard list */ +#define INP_REUSEPORT 0x00000008 /* SO_REUSEPORT option is set */ /* * Flags passed to in_pcblookup*() functions. Modified: stable/9/sys/netinet/ip_output.c ============================================================================== --- stable/9/sys/netinet/ip_output.c Thu Nov 10 20:15:35 2011 (r227427) +++ stable/9/sys/netinet/ip_output.c Thu Nov 10 20:28:30 2011 (r227428) @@ -895,12 +895,43 @@ ip_ctloutput(struct socket *so, struct s error = optval = 0; if (sopt->sopt_level != IPPROTO_IP) { - if ((sopt->sopt_level == SOL_SOCKET) && - (sopt->sopt_name == SO_SETFIB)) { - inp->inp_inc.inc_fibnum = so->so_fibnum; - return (0); + error = EINVAL; + + if (sopt->sopt_level == SOL_SOCKET && + sopt->sopt_dir == SOPT_SET) { + switch (sopt->sopt_name) { + case SO_REUSEADDR: + INP_WLOCK(inp); + if (IN_MULTICAST(ntohl(inp->inp_laddr.s_addr))) { + if ((so->so_options & + (SO_REUSEADDR | SO_REUSEPORT)) != 0) + inp->inp_flags2 |= INP_REUSEPORT; + else + inp->inp_flags2 &= ~INP_REUSEPORT; + } + INP_WUNLOCK(inp); + error = 0; + break; + case SO_REUSEPORT: + INP_WLOCK(inp); + if ((so->so_options & SO_REUSEPORT) != 0) + inp->inp_flags2 |= INP_REUSEPORT; + else + inp->inp_flags2 &= ~INP_REUSEPORT; + INP_WUNLOCK(inp); + error = 0; + break; + case SO_SETFIB: + INP_WLOCK(inp); + inp->inp_inc.inc_fibnum = so->so_fibnum; + INP_WUNLOCK(inp); + error = 0; + break; + default: + break; + } } - return (EINVAL); + return (error); } switch (sopt->sopt_dir) { Modified: stable/9/sys/netinet6/in6_pcb.c ============================================================================== --- stable/9/sys/netinet6/in6_pcb.c Thu Nov 10 20:15:35 2011 (r227427) +++ stable/9/sys/netinet6/in6_pcb.c Thu Nov 10 20:28:30 2011 (r227428) @@ -187,6 +187,7 @@ in6_pcbbind(register struct inpcb *inp, } if (lport) { struct inpcb *t; + struct tcptw *tw; /* GROSS */ if (ntohs(lport) <= V_ipport_reservedhigh && @@ -206,8 +207,8 @@ in6_pcbbind(register struct inpcb *inp, IN6_IS_ADDR_UNSPECIFIED(&t->in6p_faddr)) && (!IN6_IS_ADDR_UNSPECIFIED(&sin6->sin6_addr) || !IN6_IS_ADDR_UNSPECIFIED(&t->in6p_laddr) || - (t->inp_socket->so_options & SO_REUSEPORT) - == 0) && (inp->inp_cred->cr_uid != + (t->inp_flags2 & INP_REUSEPORT) == 0) && + (inp->inp_cred->cr_uid != t->inp_cred->cr_uid)) return (EADDRINUSE); #ifdef INET @@ -233,10 +234,21 @@ in6_pcbbind(register struct inpcb *inp, } t = in6_pcblookup_local(pcbinfo, &sin6->sin6_addr, lport, lookupflags, cred); - if (t && (reuseport & ((t->inp_flags & INP_TIMEWAIT) ? - intotw(t)->tw_so_options : - t->inp_socket->so_options)) == 0) + if (t && (t->inp_flags & INP_TIMEWAIT)) { + /* + * XXXRW: If an incpb has had its timewait + * state recycled, we treat the address as + * being in use (for now). This is better + * than a panic, but not desirable. + */ + tw = intotw(t); + if (tw == NULL || + (reuseport & tw->tw_so_options) == 0) + return (EADDRINUSE); + } else if (t && (reuseport & t->inp_socket->so_options) + == 0) { return (EADDRINUSE); + } #ifdef INET if ((inp->inp_flags & IN6P_IPV6_V6ONLY) == 0 && IN6_IS_ADDR_UNSPECIFIED(&sin6->sin6_addr)) { @@ -246,19 +258,19 @@ in6_pcbbind(register struct inpcb *inp, t = in_pcblookup_local(pcbinfo, sin.sin_addr, lport, lookupflags, cred); if (t && t->inp_flags & INP_TIMEWAIT) { - if ((reuseport & - intotw(t)->tw_so_options) == 0 && - (ntohl(t->inp_laddr.s_addr) != + tw = intotw(t); + if (tw == NULL) + return (EADDRINUSE); + if ((reuseport & tw->tw_so_options) == 0 + && (ntohl(t->inp_laddr.s_addr) != INADDR_ANY || ((inp->inp_vflag & INP_IPV6PROTO) == (t->inp_vflag & INP_IPV6PROTO)))) return (EADDRINUSE); - } - else if (t && - (reuseport & t->inp_socket->so_options) - == 0 && (ntohl(t->inp_laddr.s_addr) != - INADDR_ANY || INP_SOCKAF(so) == - INP_SOCKAF(t->inp_socket))) + } else if (t && (reuseport == 0 || + (t->inp_flags2 & INP_REUSEPORT) == 0) && + (ntohl(t->inp_laddr.s_addr) != INADDR_ANY || + (t->inp_vflag & INP_IPV6PROTO) == 0)) return (EADDRINUSE); } #endif Modified: stable/9/sys/netinet6/ip6_output.c ============================================================================== --- stable/9/sys/netinet6/ip6_output.c Thu Nov 10 20:15:35 2011 (r227427) +++ stable/9/sys/netinet6/ip6_output.c Thu Nov 10 20:28:30 2011 (r227428) @@ -1421,7 +1421,38 @@ ip6_ctloutput(struct socket *so, struct optval = 0; uproto = (int)so->so_proto->pr_protocol; - if (level == IPPROTO_IPV6) { + if (level != IPPROTO_IPV6) { + error = EINVAL; + + if (sopt->sopt_level == SOL_SOCKET && + sopt->sopt_dir == SOPT_SET) { + switch (sopt->sopt_name) { + case SO_REUSEADDR: + INP_WLOCK(in6p); + if (IN_MULTICAST(ntohl(in6p->inp_laddr.s_addr))) { + if ((so->so_options & + (SO_REUSEADDR | SO_REUSEPORT)) != 0) + in6p->inp_flags2 |= INP_REUSEPORT; + else + in6p->inp_flags2 &= ~INP_REUSEPORT; + } + INP_WUNLOCK(in6p); + error = 0; + break; + case SO_REUSEPORT: + INP_WLOCK(in6p); + if ((so->so_options & SO_REUSEPORT) != 0) + in6p->inp_flags2 |= INP_REUSEPORT; + else + in6p->inp_flags2 &= ~INP_REUSEPORT; + INP_WUNLOCK(in6p); + error = 0; + break; + default: + break; + } + } + } else { /* level == IPPROTO_IPV6 */ switch (op) { case SOPT_SET: @@ -2044,8 +2075,6 @@ do { \ } break; } - } else { /* level != IPPROTO_IPV6 */ - error = EINVAL; } return (error); } From owner-svn-src-stable@FreeBSD.ORG Fri Nov 11 01:37:49 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 191071065670; Fri, 11 Nov 2011 01:37:49 +0000 (UTC) (envelope-from rstone@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 08A838FC13; Fri, 11 Nov 2011 01:37:49 +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 pAB1bmdj064953; Fri, 11 Nov 2011 01:37:48 GMT (envelope-from rstone@svn.freebsd.org) Received: (from rstone@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pAB1bmvi064951; Fri, 11 Nov 2011 01:37:48 GMT (envelope-from rstone@svn.freebsd.org) Message-Id: <201111110137.pAB1bmvi064951@svn.freebsd.org> From: Ryan Stone Date: Fri, 11 Nov 2011 01:37:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227436 - stable/8/sbin/camcontrol X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Nov 2011 01:37:49 -0000 Author: rstone Date: Fri Nov 11 01:37:48 2011 New Revision: 227436 URL: http://svn.freebsd.org/changeset/base/227436 Log: MFC 215507: When doing a camcontrol rescan all or a camcontrol reset all, use the wildcard path id for enumerating the available busses. Previously camcontrol was implicitly passing 0 as the first path id, which meant that if bus 0 was not present camcontrol would fail with EINVAL instead of rescanning/resetting any busses that were present. Modified: stable/8/sbin/camcontrol/camcontrol.c Directory Properties: stable/8/sbin/camcontrol/ (props changed) Modified: stable/8/sbin/camcontrol/camcontrol.c ============================================================================== --- stable/8/sbin/camcontrol/camcontrol.c Fri Nov 11 01:35:07 2011 (r227435) +++ stable/8/sbin/camcontrol/camcontrol.c Fri Nov 11 01:37:48 2011 (r227436) @@ -1526,6 +1526,7 @@ rescan_or_reset_bus(int bus, int rescan) bzero(&(&matchccb.ccb_h)[1], sizeof(struct ccb_dev_match) - sizeof(struct ccb_hdr)); matchccb.ccb_h.func_code = XPT_DEV_MATCH; + matchccb.ccb_h.path_id = CAM_BUS_WILDCARD; bufsize = sizeof(struct dev_match_result) * 20; matchccb.cdm.match_buf_len = bufsize; matchccb.cdm.matches=(struct dev_match_result *)malloc(bufsize); From owner-svn-src-stable@FreeBSD.ORG Fri Nov 11 02:02:56 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4F1BF106566C; Fri, 11 Nov 2011 02:02:56 +0000 (UTC) (envelope-from rstone@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 252E48FC0C; Fri, 11 Nov 2011 02:02: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 pAB22urd065812; Fri, 11 Nov 2011 02:02:56 GMT (envelope-from rstone@svn.freebsd.org) Received: (from rstone@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pAB22u04065810; Fri, 11 Nov 2011 02:02:56 GMT (envelope-from rstone@svn.freebsd.org) Message-Id: <201111110202.pAB22u04065810@svn.freebsd.org> From: Ryan Stone Date: Fri, 11 Nov 2011 02:02:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227437 - stable/8/sys/tools X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Nov 2011 02:02:56 -0000 Author: rstone Date: Fri Nov 11 02:02:55 2011 New Revision: 227437 URL: http://svn.freebsd.org/changeset/base/227437 Log: MFC 220227: GNU awk does not output escaped newlines in multi-line printc statements. This leads to compile errors when trying to compile firmware(9) stubs created with gawk, as multiple #include statements end up on the same line. Replace the multi-line printc statement that outputs all of the #includes with one printc per #include. This allows modules compatible with firmware(9) to be cross-built from a Linux machine without requiring the one true awk to be installed. I've intentionally done the minimal set of changes necessary to make gawk produce valid (but not pretty) C code, to reduce the churn and keep fw_stubs.awk as readable as possible. Modified: stable/8/sys/tools/fw_stub.awk Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/tools/fw_stub.awk ============================================================================== --- stable/8/sys/tools/fw_stub.awk Fri Nov 11 01:37:48 2011 (r227436) +++ stable/8/sys/tools/fw_stub.awk Fri Nov 11 02:02:55 2011 (r227437) @@ -121,13 +121,13 @@ ctmpfilename = cfilename ".tmp"; modname = opt_m; gsub(/[-\.]/, "_", modname); -printc("#include \ -#include \ -#include \ -#include \ -#include \ -#include \ -#include \n"); +printc("#include "); +printc("#include "); +printc("#include "); +printc("#include "); +printc("#include "); +printc("#include "); +printc("#include \n"); if (opt_l) { printc("static long " opt_l "_license_ack = 0;"); From owner-svn-src-stable@FreeBSD.ORG Fri Nov 11 02:10:24 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6B802106564A; Fri, 11 Nov 2011 02:10:24 +0000 (UTC) (envelope-from rstone@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5AFA98FC0A; Fri, 11 Nov 2011 02:10:24 +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 pAB2AOQO066090; Fri, 11 Nov 2011 02:10:24 GMT (envelope-from rstone@svn.freebsd.org) Received: (from rstone@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pAB2AOod066088; Fri, 11 Nov 2011 02:10:24 GMT (envelope-from rstone@svn.freebsd.org) Message-Id: <201111110210.pAB2AOod066088@svn.freebsd.org> From: Ryan Stone Date: Fri, 11 Nov 2011 02:10:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227438 - stable/8/lib/libthr/thread X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Nov 2011 02:10:24 -0000 Author: rstone Date: Fri Nov 11 02:10:24 2011 New Revision: 227438 URL: http://svn.freebsd.org/changeset/base/227438 Log: MFC 220888 r179417 introduced a bug into pthread_once(). Previously pthread_once() used a global pthread_mutex_t for synchronization. r179417 replaced that with an implementation that directly used atomic instructions and thr_* syscalls to synchronize callers to pthread_once. However, calling pthread_mutex_lock on the global mutex implicitly ensured that _thr_check_init() had been called but with r179417 this was no longer guaranteed. This meant that if you were unlucky enough to have your first call into libthr be a call to pthread_once(), you would segfault when trying to access the pointer returned by _get_curthread(). The fix is to explicitly call _thr_check_init() from pthread_once(). Modified: stable/8/lib/libthr/thread/thr_once.c Directory Properties: stable/8/lib/libthr/ (props changed) Modified: stable/8/lib/libthr/thread/thr_once.c ============================================================================== --- stable/8/lib/libthr/thread/thr_once.c Fri Nov 11 02:02:55 2011 (r227437) +++ stable/8/lib/libthr/thread/thr_once.c Fri Nov 11 02:10:24 2011 (r227438) @@ -64,6 +64,8 @@ _pthread_once(pthread_once_t *once_contr struct pthread *curthread; int state; + _thr_check_init(); + for (;;) { state = once_control->state; if (state == ONCE_DONE) From owner-svn-src-stable@FreeBSD.ORG Fri Nov 11 02:13:35 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8F739106564A; Fri, 11 Nov 2011 02:13:35 +0000 (UTC) (envelope-from rstone@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 65A6D8FC08; Fri, 11 Nov 2011 02:13:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pAB2DZux066241; Fri, 11 Nov 2011 02:13:35 GMT (envelope-from rstone@svn.freebsd.org) Received: (from rstone@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pAB2DZLY066239; Fri, 11 Nov 2011 02:13:35 GMT (envelope-from rstone@svn.freebsd.org) Message-Id: <201111110213.pAB2DZLY066239@svn.freebsd.org> From: Ryan Stone Date: Fri, 11 Nov 2011 02:13:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227439 - stable/8/sys/kern X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Nov 2011 02:13:35 -0000 Author: rstone Date: Fri Nov 11 02:13:35 2011 New Revision: 227439 URL: http://svn.freebsd.org/changeset/base/227439 Log: MFC 221081: If the 4BSD scheduler tries to schedule a thread that has been pinned or bound to an AP before SMP has started, the system will panic when we try to touch per-CPU state for that AP because that state has not been initialized yet. Fix this in the same way as ULE: place all threads in the global run queue before SMP has started. Modified: stable/8/sys/kern/sched_4bsd.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/kern/sched_4bsd.c ============================================================================== --- stable/8/sys/kern/sched_4bsd.c Fri Nov 11 02:10:24 2011 (r227438) +++ stable/8/sys/kern/sched_4bsd.c Fri Nov 11 02:13:35 2011 (r227439) @@ -1241,25 +1241,27 @@ sched_add(struct thread *td, int flags) } TD_SET_RUNQ(td); - if (td->td_pinned != 0) { - cpu = td->td_lastcpu; - ts->ts_runq = &runq_pcpu[cpu]; - single_cpu = 1; - CTR3(KTR_RUNQ, - "sched_add: Put td_sched:%p(td:%p) on cpu%d runq", ts, td, - cpu); - } else if (td->td_flags & TDF_BOUND) { - /* Find CPU from bound runq. */ - KASSERT(SKE_RUNQ_PCPU(ts), - ("sched_add: bound td_sched not on cpu runq")); - cpu = ts->ts_runq - &runq_pcpu[0]; - single_cpu = 1; - CTR3(KTR_RUNQ, - "sched_add: Put td_sched:%p(td:%p) on cpu%d runq", ts, td, - cpu); - } else if (ts->ts_flags & TSF_AFFINITY) { - /* Find a valid CPU for our cpuset */ - cpu = sched_pickcpu(td); + /* + * If SMP is started and the thread is pinned or otherwise limited to + * a specific set of CPUs, queue the thread to a per-CPU run queue. + * Otherwise, queue the thread to the global run queue. + * + * If SMP has not yet been started we must use the global run queue + * as per-CPU state may not be initialized yet and we may crash if we + * try to access the per-CPU run queues. + */ + if (smp_started && (td->td_pinned != 0 || td->td_flags & TDF_BOUND || + ts->ts_flags & TSF_AFFINITY)) { + if (td->td_pinned != 0) + cpu = td->td_lastcpu; + else if (td->td_flags & TDF_BOUND) { + /* Find CPU from bound runq. */ + KASSERT(SKE_RUNQ_PCPU(ts), + ("sched_add: bound td_sched not on cpu runq")); + cpu = ts->ts_runq - &runq_pcpu[0]; + } else + /* Find a valid CPU for our cpuset */ + cpu = sched_pickcpu(td); ts->ts_runq = &runq_pcpu[cpu]; single_cpu = 1; CTR3(KTR_RUNQ, From owner-svn-src-stable@FreeBSD.ORG Fri Nov 11 02:15:44 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AD6F61065676; Fri, 11 Nov 2011 02:15:44 +0000 (UTC) (envelope-from rstone@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9CDAC8FC16; Fri, 11 Nov 2011 02:15:44 +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 pAB2FiAX066359; Fri, 11 Nov 2011 02:15:44 GMT (envelope-from rstone@svn.freebsd.org) Received: (from rstone@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pAB2FilL066357; Fri, 11 Nov 2011 02:15:44 GMT (envelope-from rstone@svn.freebsd.org) Message-Id: <201111110215.pAB2FilL066357@svn.freebsd.org> From: Ryan Stone Date: Fri, 11 Nov 2011 02:15:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227440 - stable/8/sys/kern X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Nov 2011 02:15:44 -0000 Author: rstone Date: Fri Nov 11 02:15:44 2011 New Revision: 227440 URL: http://svn.freebsd.org/changeset/base/227440 Log: MFC 224156: Fix a LOR between hwpmc and the kernel linker. When a system-wide sampling mode PMC is allocated, hwpmc calls linker_hwpmc_list_objects() while already holding an exclusive lock on pmc-sx lock. list_objects() tries to acquire an exclusive lock on the kld_sx lock. When a KLD module is loaded or unloaded successfully, kern_kld(un)load calls into the pmc hook while already holding an exclusive lock on the kld_sx lock. Calling the pmc hook requires acquiring a shared lock on the pmc-sx lock. Fix this by only acquiring a shared lock on the kld_sx lock in linker_hwpmc_list_objects(), and also downgrading to a shared lock on the kld_sx lock in kern_kld(un)load before calling into the pmc hook. In kern_kldload this required moving some modifications of the linker_file_t to happen before calling into the pmc hook. This fixes the deadlock by ensuring that the hwpmc -> list_objects() case is always able to proceed. Without this patch, I was able to deadlock a multicore system within minutes by constantly loading and unloading an KLD module while I simultaneously started a sampling mode PMC in a loop. Modified: stable/8/sys/kern/kern_linker.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/kern/kern_linker.c ============================================================================== --- stable/8/sys/kern/kern_linker.c Fri Nov 11 02:13:35 2011 (r227439) +++ stable/8/sys/kern/kern_linker.c Fri Nov 11 02:15:44 2011 (r227440) @@ -68,6 +68,9 @@ int kld_debug = 0; #define KLD_LOCK() sx_xlock(&kld_sx) #define KLD_UNLOCK() sx_xunlock(&kld_sx) +#define KLD_DOWNGRADE() sx_downgrade(&kld_sx) +#define KLD_LOCK_READ() sx_slock(&kld_sx) +#define KLD_UNLOCK_READ() sx_sunlock(&kld_sx) #define KLD_LOCKED() sx_xlocked(&kld_sx) #define KLD_LOCK_ASSERT() do { \ if (!cold) \ @@ -1014,18 +1017,24 @@ kern_kldload(struct thread *td, const ch KLD_LOCK(); error = linker_load_module(kldname, modname, NULL, NULL, &lf); - if (error) - goto unlock; + if (error) { + KLD_UNLOCK(); + goto done; + } + lf->userrefs++; + if (fileid != NULL) + *fileid = lf->id; #ifdef HWPMC_HOOKS + KLD_DOWNGRADE(); pkm.pm_file = lf->filename; pkm.pm_address = (uintptr_t) lf->address; PMC_CALL_HOOK(td, PMC_FN_KLD_LOAD, (void *) &pkm); -#endif - lf->userrefs++; - if (fileid != NULL) - *fileid = lf->id; -unlock: + KLD_UNLOCK_READ(); +#else KLD_UNLOCK(); +#endif + +done: CURVNET_RESTORE(); return (error); } @@ -1097,10 +1106,14 @@ kern_kldunload(struct thread *td, int fi error = ENOENT; #ifdef HWPMC_HOOKS - if (error == 0) + if (error == 0) { + KLD_DOWNGRADE(); PMC_CALL_HOOK(td, PMC_FN_KLD_UNLOAD, (void *) &pkm); + KLD_UNLOCK_READ(); + } else +#else + KLD_UNLOCK(); #endif - KLD_UNLOCK(); CURVNET_RESTORE(); return (error); } @@ -1919,7 +1932,7 @@ linker_hwpmc_list_objects(void) int i, nmappings; nmappings = 0; - KLD_LOCK(); + KLD_LOCK_READ(); TAILQ_FOREACH(lf, &linker_files, link) nmappings++; @@ -1934,7 +1947,7 @@ linker_hwpmc_list_objects(void) kobase[i].pm_address = (uintptr_t)lf->address; i++; } - KLD_UNLOCK(); + KLD_UNLOCK_READ(); KASSERT(i > 0, ("linker_hpwmc_list_objects: no kernel objects?")); From owner-svn-src-stable@FreeBSD.ORG Fri Nov 11 14:42:05 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B5FC310657CC; Fri, 11 Nov 2011 14:42:05 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A41D58FC0A; Fri, 11 Nov 2011 14:42:05 +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 pABEg5k6095065; Fri, 11 Nov 2011 14:42:05 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pABEg5rm095063; Fri, 11 Nov 2011 14:42:05 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201111111442.pABEg5rm095063@svn.freebsd.org> From: Mikolaj Golub Date: Fri, 11 Nov 2011 14:42:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227450 - stable/9/sys/netinet6 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Nov 2011 14:42:05 -0000 Author: trociny Date: Fri Nov 11 14:42:05 2011 New Revision: 227450 URL: http://svn.freebsd.org/changeset/base/227450 Log: MFC r227449: Fix false positive EADDRINUSE that could be returned by bind, due to the typo made in r227207. Reported by: kib Tested by: kib Approved by: re (kib) Modified: stable/9/sys/netinet6/in6_pcb.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/netinet6/in6_pcb.c ============================================================================== --- stable/9/sys/netinet6/in6_pcb.c Fri Nov 11 14:09:09 2011 (r227449) +++ stable/9/sys/netinet6/in6_pcb.c Fri Nov 11 14:42:05 2011 (r227450) @@ -270,7 +270,7 @@ in6_pcbbind(register struct inpcb *inp, } else if (t && (reuseport == 0 || (t->inp_flags2 & INP_REUSEPORT) == 0) && (ntohl(t->inp_laddr.s_addr) != INADDR_ANY || - (t->inp_vflag & INP_IPV6PROTO) == 0)) + (t->inp_vflag & INP_IPV6PROTO) != 0)) return (EADDRINUSE); } #endif From owner-svn-src-stable@FreeBSD.ORG Fri Nov 11 14:53:19 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5D3B2106564A; Fri, 11 Nov 2011 14:53:19 +0000 (UTC) (envelope-from minimarmot@gmail.com) Received: from mail-yw0-f54.google.com (mail-yw0-f54.google.com [209.85.213.54]) by mx1.freebsd.org (Postfix) with ESMTP id D41178FC0A; Fri, 11 Nov 2011 14:53:18 +0000 (UTC) Received: by mail-yw0-f54.google.com with SMTP id 9so849135ywe.13 for ; Fri, 11 Nov 2011 06:53:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=RaoFeCL53I7C6hq7MYe7DQSfl+3Dy8EYsDfSV8c+xAk=; b=Kk5MwJdG1/LlXJu88LIjNOhUMfFw9RzZcthnPCGxk25b+gDnRHvTHU1Q0vrL3hNzld JoEt25gl1xj2XlSy4FwV4Y1A1mcW21PlbaeKkGXoh3ob1woKpg8aELW1rEEMSwjRPKEL 9cN86F4U4GQOJ7A564JTmgPD8JadbAvBdC1hA= MIME-Version: 1.0 Received: by 10.101.42.18 with SMTP id u18mr5622707anj.50.1321021399488; Fri, 11 Nov 2011 06:23:19 -0800 (PST) Received: by 10.236.110.174 with HTTP; Fri, 11 Nov 2011 06:23:19 -0800 (PST) In-Reply-To: <9A674915-EF68-4CEA-93CB-CDE349082019@FreeBSD.org> References: <201110201558.p9KFw550081440@svn.freebsd.org> <9A674915-EF68-4CEA-93CB-CDE349082019@FreeBSD.org> Date: Fri, 11 Nov 2011 09:23:19 -0500 Message-ID: From: Ben Kaduk To: Gleb Smirnoff Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, "Bjoern A. Zeeb" , src-committers@freebsd.org, svn-src-stable-9@freebsd.org Subject: Re: svn commit: r226572 - stable/9/sys/netinet X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Nov 2011 14:53:19 -0000 On Thu, Oct 20, 2011 at 12:40 PM, Bjoern A. Zeeb wrote: > On 20. Oct 2011, at 15:58 , Gleb Smirnoff wrote: > >> Author: glebius >> Date: Thu Oct 20 15:58:05 2011 >> New Revision: 226572 >> URL: http://svn.freebsd.org/changeset/base/226572 >> >> Log: >> =A0MFhead 226401,226402: >> >> =A0 =A0Remove last remnants of classful addressing: >> >> =A0 =A0- Remove ia_net, ia_netmask, ia_netbroadcast from struct in_ifadd= r. >> =A0 =A0- Remove net.inet.ip.subnetsarelocal, I bet no one need it in 201= 1. >> =A0 =A0- fix bug when we were not forwarding to a host which matches cla= ssful >> =A0 =A0 =A0net address. For example router having 192.168.x.y/16 network= attached, >> =A0 =A0 =A0would not forward traffic to 192.168.*.0, which are legal IPs= in >> =A0 =A0 =A0CIDR world. >> =A0 =A0- For compatibility, leave autoguessing of mask based on class. >> >> =A0 =A0Reviewed by: =A0andre, bz, rwatson >> >> =A0 =A0Add support for IPv4 /31 prefixes, as described in RFC3021. >> >> =A0 =A0To run a /31 network, participating hosts MUST drop support >> =A0 =A0for directed broadcasts, and treat the first and last addresses >> =A0 =A0on subnet as unicast. The broadcast address for the prefix >> =A0 =A0should be the link local broadcast address, INADDR_BROADCAST. > ... >> Modified: stable/9/sys/netinet/in_var.h >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> --- stable/9/sys/netinet/in_var.h =A0 =A0 Thu Oct 20 15:55:01 2011 =A0 = =A0 =A0 =A0(r226571) >> +++ stable/9/sys/netinet/in_var.h =A0 =A0 Thu Oct 20 15:58:05 2011 =A0 = =A0 =A0 =A0(r226572) >> @@ -60,12 +60,9 @@ struct in_ifaddr { >> =A0 =A0 =A0 struct =A0ifaddr ia_ifa; =A0 =A0 =A0 =A0 =A0/* protocol-inde= pendent info */ >> #define =A0 =A0 =A0 ia_ifp =A0 =A0 =A0 =A0 =A0ia_ifa.ifa_ifp >> #define ia_flags =A0 =A0 =A0ia_ifa.ifa_flags >> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 /* ia_{,sub}net{,mask} in host order */ >> - =A0 =A0 u_long =A0ia_net; =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 /* network n= umber of interface */ >> - =A0 =A0 u_long =A0ia_netmask; =A0 =A0 =A0 =A0 =A0 =A0 /* mask of net p= art */ >> - =A0 =A0 u_long =A0ia_subnet; =A0 =A0 =A0 =A0 =A0 =A0 =A0/* subnet numb= er, including net */ >> - =A0 =A0 u_long =A0ia_subnetmask; =A0 =A0 =A0 =A0 =A0/* mask of subnet = part */ >> - =A0 =A0 struct =A0in_addr ia_netbroadcast; /* to recognize net broadca= sts */ >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 /* ia_subnet{,mask} in host order */ >> + =A0 =A0 u_long =A0ia_subnet; =A0 =A0 =A0 =A0 =A0 =A0 =A0/* subnet addr= ess */ >> + =A0 =A0 u_long =A0ia_subnetmask; =A0 =A0 =A0 =A0 =A0/* mask of subnet = */ >> =A0 =A0 =A0 LIST_ENTRY(in_ifaddr) ia_hash; =A0/* entry in bucket of inet= addresses */ >> =A0 =A0 =A0 TAILQ_ENTRY(in_ifaddr) ia_link; /* list of internet addresse= s */ >> =A0 =A0 =A0 struct =A0sockaddr_in ia_addr; =A0 =A0/* reserve space for i= nterface name */ > > This should at least break parts of netstat and ifmcstat as I had told yo= u in > private email before. Just so we're clear, it changes the API (at the RC stage!), causing at least the net/openafs port to fail to compile. I presume, given the commit message, that I am just not supposed to use ia_net and ia_netmask any more, and that ia_submet and ia_subnetmask are presumed to be sufficient? -Ben Kaduk