Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 28 Apr 2011 07:22:41 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r221153 - stable/8/sys/cam/ata
Message-ID:  <201104280722.p3S7MfO3010889@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Thu Apr 28 07:22:41 2011
New Revision: 221153
URL: http://svn.freebsd.org/changeset/base/221153

Log:
  MFC r220886:
  Add basic support for DMA-capable ATA disks on DMA-incapable controller.
  This is really rare situation these days, but still may happen in embedded.

Modified:
  stable/8/sys/cam/ata/ata_all.h
  stable/8/sys/cam/ata/ata_da.c
  stable/8/sys/cam/ata/ata_xpt.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/cam/ata/ata_all.h
==============================================================================
--- stable/8/sys/cam/ata/ata_all.h	Thu Apr 28 07:21:01 2011	(r221152)
+++ stable/8/sys/cam/ata/ata_all.h	Thu Apr 28 07:22:41 2011	(r221153)
@@ -35,6 +35,8 @@ struct ccb_ataio;
 struct cam_periph;
 union  ccb;
 
+#define	SID_DMA		0x10	/* Abuse inq_flags bit to track enabled DMA. */
+
 struct ata_cmd {
 	u_int8_t	flags;		/* ATA command flags */
 #define		CAM_ATAIO_48BIT		0x01	/* Command has 48-bit format */

Modified: stable/8/sys/cam/ata/ata_da.c
==============================================================================
--- stable/8/sys/cam/ata/ata_da.c	Thu Apr 28 07:21:01 2011	(r221152)
+++ stable/8/sys/cam/ata/ata_da.c	Thu Apr 28 07:22:41 2011	(r221153)
@@ -737,7 +737,8 @@ adaregister(struct cam_periph *periph, v
 	bioq_init(&softc->bio_queue);
 	bioq_init(&softc->trim_queue);
 
-	if (cgd->ident_data.capabilities1 & ATA_SUPPORT_DMA)
+	if (cgd->ident_data.capabilities1 & ATA_SUPPORT_DMA &&
+	    (cgd->inq_flags & SID_DMA))
 		softc->flags |= ADA_FLAG_CAN_DMA;
 	if (cgd->ident_data.support.command2 & ATA_SUPPORT_ADDRESS48)
 		softc->flags |= ADA_FLAG_CAN_48BIT;
@@ -746,7 +747,7 @@ adaregister(struct cam_periph *periph, v
 	if (cgd->ident_data.support.command1 & ATA_SUPPORT_POWERMGT)
 		softc->flags |= ADA_FLAG_CAN_POWERMGT;
 	if (cgd->ident_data.satacapabilities & ATA_SUPPORT_NCQ &&
-	    cgd->inq_flags & SID_CmdQue)
+	    (cgd->inq_flags & SID_DMA) && (cgd->inq_flags & SID_CmdQue))
 		softc->flags |= ADA_FLAG_CAN_NCQ;
 	if (cgd->ident_data.support_dsm & ATA_SUPPORT_DSM_TRIM) {
 		softc->flags |= ADA_FLAG_CAN_TRIM;

Modified: stable/8/sys/cam/ata/ata_xpt.c
==============================================================================
--- stable/8/sys/cam/ata/ata_xpt.c	Thu Apr 28 07:21:01 2011	(r221152)
+++ stable/8/sys/cam/ata/ata_xpt.c	Thu Apr 28 07:22:41 2011	(r221153)
@@ -388,6 +388,11 @@ negotiate:
 		/* If SIM disagree - renegotiate. */
 		if (mode != wantmode)
 			goto negotiate;
+		/* Remember what transport thinks about DMA. */
+		if (mode < ATA_DMA)
+			path->device->inq_flags &= ~SID_DMA;
+		else
+			path->device->inq_flags |= SID_DMA;
 		cam_fill_ataio(ataio,
 		      1,
 		      probedone,



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201104280722.p3S7MfO3010889>