From nobody@FreeBSD.org  Tue Jan 31 00:48:16 2012
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E9D29106564A
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 31 Jan 2012 00:48:16 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id D4DFB8FC0A
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 31 Jan 2012 00:48:16 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.4/8.14.4) with ESMTP id q0V0mGDs097307
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 31 Jan 2012 00:48:16 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.4/8.14.4/Submit) id q0V0mGKd097306;
	Tue, 31 Jan 2012 00:48:16 GMT
	(envelope-from nobody)
Message-Id: <201201310048.q0V0mGKd097306@red.freebsd.org>
Date: Tue, 31 Jan 2012 00:48:16 GMT
From: "Russell J. Yount" <Russell.Yount@gmail.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: Disabling DMA in new Freebsd 9.0 CAM drivers does not work
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         164651
>Category:       kern
>Synopsis:       [cam] Disabling DMA in new Freebsd 9.0 CAM drivers does not work
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    mav
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jan 31 00:50:10 UTC 2012
>Closed-Date:    Thu Feb 09 07:41:10 UTC 2012
>Last-Modified:  Thu Feb  9 07:50:07 UTC 2012
>Originator:     Russell J. Yount
>Release:        Freebsd 9.0
>Organization:
Individual
>Environment:
FreeBSD server8.localdomain 9.0-RELEASE FreeBSD 9.0-RELEASE #0: Sun Jan 15 03:16:02 EST 2012     root@system-u.localdomain:/ufs/disk1/kernel/9.0/usr/src/sys/i386/compile/NET4801  i386

FreeBSD server10.localdomain 9.0-RELEASE FreeBSD 9.0-RELEASE #0: Sat Jan 21 18:44:20 EST 2012     root@system-u.localdomain:/ufs/disk1/kernel/9.0/usr/src/sys/i386/compile/NET4801-NOCAM  i386

>Description:
Soekris Engineering produced a number of early version of the net4801 that did not support DMA on Compact flash disks correctly. Compact flash cards that did support DMA would fail unless "hw.ata.ata_dma=0" was place in /boot/loader.conf
to disable DMA transfers for the ad driver.

FreeBSD 9.0 when compiled with CAM support appears not to disable DMA and just hanges with disk light on. When CAM support is not compiled in FreeBSD 9.0 everything works as before.

The CAM subsystem appears not to support disabling DMA.

I have both net4801s that do and do not support DMA for Compact Flash Disks. The ones that support DMA do work correctly in FreeBSD 9.0. The problem described only affects early production models which did not support DMA.



  
>How-To-Repeat:
Using an old net4801 which does support DMA with a flash card that does.

I suspect DMA is not being disabled at all with CAM and could be tested with other disks.

Am willing to test fixes if needed.  
>Fix:


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->ken 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Wed Feb 1 01:33:36 UTC 2012 
Responsible-Changed-Why:  
Ken, is this your area of expertise?  If not, please just assign it over 
to freebsd-scsi@.  Thanks. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=164651 
Responsible-Changed-From-To: ken->mav 
Responsible-Changed-By: ken 
Responsible-Changed-When: Wed Feb 1 05:11:56 UTC 2012 
Responsible-Changed-Why:  
Sending this to Alexander, since he may have an idea of what the problem 
is. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=164651 

From: Alexander Motin <mav@FreeBSD.org>
To: bug-followup@FreeBSD.org, Russell.Yount@gmail.com
Cc:  
Subject: Re: kern/164651: [cam] Disabling DMA in new Freebsd 9.0 CAM drivers
 does not work
Date: Wed, 01 Feb 2012 11:38:45 +0200

 CAM ATA in 9.0 does not support for hw.ata.ata_dma tunable. But you can 
 use hint.ata.X.mode="PIO4" instead, where X is a bus number.
 
 -- 
 Alexander Motin

From: Russell Yount <russell.yount@gmail.com>
To: Alexander Motin <mav@freebsd.org>
Cc: bug-followup@freebsd.org
Subject: Re: kern/164651: [cam] Disabling DMA in new Freebsd 9.0 CAM drivers
 does not work
Date: Wed, 1 Feb 2012 22:48:49 -0500

 --bcaec5196467f195b504b7f31228
 Content-Type: text/plain; charset=ISO-8859-1
 
 Alexander,
 Thanks very much for that information. It does solve problem. This might be
 good to mention in ada(4) manual page as since people used find information
 on  hw.ata.ata_dma tunable in ad(4) man page.
 
 Thanks again
 
 -Russ
 
 
 On Wed, Feb 1, 2012 at 4:38 AM, Alexander Motin <mav@freebsd.org> wrote:
 
 > CAM ATA in 9.0 does not support for hw.ata.ata_dma tunable. But you can
 > use hint.ata.X.mode="PIO4" instead, where X is a bus number.
 >
 > --
 > Alexander Motin
 >
 
 --bcaec5196467f195b504b7f31228
 Content-Type: text/html; charset=ISO-8859-1
 Content-Transfer-Encoding: quoted-printable
 
 <div>Alexander,</div><div> </div><div>Thanks very much for that information=
 . It does solve problem. This might be good to mention in ada(4) manual pag=
 e as since people used find information on=A0 hw.ata.ata_dma tunable in ad(=
 4) man page.</div>
 <div>=A0</div><div>Thanks again</div><div>=A0</div><div>-Russ<br><br><br></=
 div><div class=3D"gmail_quote">On Wed, Feb 1, 2012 at 4:38 AM, Alexander Mo=
 tin <span dir=3D"ltr">&lt;<a href=3D"mailto:mav@freebsd.org">mav@freebsd.or=
 g</a>&gt;</span> wrote:<br>
 <blockquote style=3D"margin:0px 0px 0px 0.8ex;padding-left:1ex;border-left-=
 color:rgb(204,204,204);border-left-width:1px;border-left-style:solid" class=
 =3D"gmail_quote">CAM ATA in 9.0 does not support for hw.ata.ata_dma tunable=
 . But you can use hint.ata.X.mode=3D&quot;PIO4&quot; instead, where X is a =
 bus number.<span class=3D"HOEnZb"><font color=3D"#888888"><br>
 
 <br>
 -- <br>
 Alexander Motin<br>
 </font></span></blockquote></div><br>
 
 --bcaec5196467f195b504b7f31228--

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/164651: commit references a PR
Date: Thu,  2 Feb 2012 14:18:11 +0000 (UTC)

 Author: mav
 Date: Thu Feb  2 14:17:58 2012
 New Revision: 230912
 URL: http://svn.freebsd.org/changeset/base/230912
 
 Log:
   Make CAM ATA honor old hw.ata.ata_dma and hw.ata.atapi_dma tunables.
   
   Even having more specific hint.ata.X.mode controls, global ones are
   still could be useful from some points, including compatibility.
   
   PR:		kern/164651
   MFC after:	1 week
 
 Modified:
   head/sys/cam/ata/ata_xpt.c
 
 Modified: head/sys/cam/ata/ata_xpt.c
 ==============================================================================
 --- head/sys/cam/ata/ata_xpt.c	Thu Feb  2 12:22:22 2012	(r230911)
 +++ head/sys/cam/ata/ata_xpt.c	Thu Feb  2 14:17:58 2012	(r230912)
 @@ -186,6 +186,12 @@ static void	 ata_dev_async(u_int32_t asy
  static void	 ata_action(union ccb *start_ccb);
  static void	 ata_announce_periph(struct cam_periph *periph);
  
 +static int ata_dma = 1;
 +static int atapi_dma = 1;
 +
 +TUNABLE_INT("hw.ata.ata_dma", &ata_dma);
 +TUNABLE_INT("hw.ata.atapi_dma", &atapi_dma);
 +
  static struct xpt_xport ata_xport = {
  	.alloc_device = ata_alloc_device,
  	.action = ata_action,
 @@ -356,6 +362,13 @@ probestart(struct cam_periph *periph, un
  			if (cts.xport_specific.sata.valid & CTS_SATA_VALID_MODE)
  				mode = cts.xport_specific.sata.mode;
  		}
 +		if (periph->path->device->protocol == PROTO_ATA) {
 +			if (ata_dma == 0 && (mode == 0 || mode > ATA_PIO_MAX))
 +				mode = ATA_PIO_MAX;
 +		} else {
 +			if (atapi_dma == 0 && (mode == 0 || mode > ATA_PIO_MAX))
 +				mode = ATA_PIO_MAX;
 +		}
  negotiate:
  		/* Honor device capabilities. */
  		wantmode = mode = ata_max_mode(ident_buf, mode);
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/164651: commit references a PR
Date: Thu,  9 Feb 2012 07:39:09 +0000 (UTC)

 Author: mav
 Date: Thu Feb  9 07:38:56 2012
 New Revision: 231251
 URL: http://svn.freebsd.org/changeset/base/231251
 
 Log:
   MFC r230912:
   Make CAM ATA honor old hw.ata.ata_dma and hw.ata.atapi_dma tunables.
   
   Even having more specific hint.ata.X.mode controls, global ones are
   still could be useful from some points, including compatibility.
   
   PR:		kern/164651
 
 Modified:
   stable/9/sys/cam/ata/ata_xpt.c
 Directory Properties:
   stable/9/sys/   (props changed)
 
 Modified: stable/9/sys/cam/ata/ata_xpt.c
 ==============================================================================
 --- stable/9/sys/cam/ata/ata_xpt.c	Thu Feb  9 07:28:17 2012	(r231250)
 +++ stable/9/sys/cam/ata/ata_xpt.c	Thu Feb  9 07:38:56 2012	(r231251)
 @@ -186,6 +186,12 @@ static void	 ata_dev_async(u_int32_t asy
  static void	 ata_action(union ccb *start_ccb);
  static void	 ata_announce_periph(struct cam_periph *periph);
  
 +static int ata_dma = 1;
 +static int atapi_dma = 1;
 +
 +TUNABLE_INT("hw.ata.ata_dma", &ata_dma);
 +TUNABLE_INT("hw.ata.atapi_dma", &atapi_dma);
 +
  static struct xpt_xport ata_xport = {
  	.alloc_device = ata_alloc_device,
  	.action = ata_action,
 @@ -356,6 +362,13 @@ probestart(struct cam_periph *periph, un
  			if (cts.xport_specific.sata.valid & CTS_SATA_VALID_MODE)
  				mode = cts.xport_specific.sata.mode;
  		}
 +		if (periph->path->device->protocol == PROTO_ATA) {
 +			if (ata_dma == 0 && (mode == 0 || mode > ATA_PIO_MAX))
 +				mode = ATA_PIO_MAX;
 +		} else {
 +			if (atapi_dma == 0 && (mode == 0 || mode > ATA_PIO_MAX))
 +				mode = ATA_PIO_MAX;
 +		}
  negotiate:
  		/* Honor device capabilities. */
  		wantmode = mode = ata_max_mode(ident_buf, mode);
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: open->closed 
State-Changed-By: mav 
State-Changed-When: Thu Feb 9 07:40:38 UTC 2012 
State-Changed-Why:  
Fixed and merged to 8/9-STABLE. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=164651 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/164651: commit references a PR
Date: Thu,  9 Feb 2012 07:40:26 +0000 (UTC)

 Author: mav
 Date: Thu Feb  9 07:40:13 2012
 New Revision: 231252
 URL: http://svn.freebsd.org/changeset/base/231252
 
 Log:
   MFC r230912:
   Make CAM ATA honor old hw.ata.ata_dma and hw.ata.atapi_dma tunables.
   
   Even having more specific hint.ata.X.mode controls, global ones are
   still could be useful from some points, including compatibility.
   
   PR:             kern/164651
 
 Modified:
   stable/8/sys/cam/ata/ata_xpt.c
 Directory Properties:
   stable/8/sys/   (props changed)
 
 Modified: stable/8/sys/cam/ata/ata_xpt.c
 ==============================================================================
 --- stable/8/sys/cam/ata/ata_xpt.c	Thu Feb  9 07:38:56 2012	(r231251)
 +++ stable/8/sys/cam/ata/ata_xpt.c	Thu Feb  9 07:40:13 2012	(r231252)
 @@ -186,6 +186,12 @@ static void	 ata_dev_async(u_int32_t asy
  static void	 ata_action(union ccb *start_ccb);
  static void	 ata_announce_periph(struct cam_periph *periph);
  
 +static int ata_dma = 1;
 +static int atapi_dma = 1;
 +
 +TUNABLE_INT("hw.ata.ata_dma", &ata_dma);
 +TUNABLE_INT("hw.ata.atapi_dma", &atapi_dma);
 +
  static struct xpt_xport ata_xport = {
  	.alloc_device = ata_alloc_device,
  	.action = ata_action,
 @@ -356,6 +362,13 @@ probestart(struct cam_periph *periph, un
  			if (cts.xport_specific.sata.valid & CTS_SATA_VALID_MODE)
  				mode = cts.xport_specific.sata.mode;
  		}
 +		if (periph->path->device->protocol == PROTO_ATA) {
 +			if (ata_dma == 0 && (mode == 0 || mode > ATA_PIO_MAX))
 +				mode = ATA_PIO_MAX;
 +		} else {
 +			if (atapi_dma == 0 && (mode == 0 || mode > ATA_PIO_MAX))
 +				mode = ATA_PIO_MAX;
 +		}
  negotiate:
  		/* Honor device capabilities. */
  		wantmode = mode = ata_max_mode(ident_buf, mode);
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
>Unformatted:
