svn commit: r220886 - head/sys/cam/ata
Alexander Motin
mav at FreeBSD.org
Wed Apr 20 13:27:51 UTC 2011
Author: mav
Date: Wed Apr 20 13:27:50 2011
New Revision: 220886
URL: http://svn.freebsd.org/changeset/base/220886
Log:
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:
head/sys/cam/ata/ata_all.h
head/sys/cam/ata/ata_da.c
head/sys/cam/ata/ata_xpt.c
Modified: head/sys/cam/ata/ata_all.h
==============================================================================
--- head/sys/cam/ata/ata_all.h Wed Apr 20 12:58:30 2011 (r220885)
+++ head/sys/cam/ata/ata_all.h Wed Apr 20 13:27:50 2011 (r220886)
@@ -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: head/sys/cam/ata/ata_da.c
==============================================================================
--- head/sys/cam/ata/ata_da.c Wed Apr 20 12:58:30 2011 (r220885)
+++ head/sys/cam/ata/ata_da.c Wed Apr 20 13:27:50 2011 (r220886)
@@ -751,7 +751,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;
@@ -760,7 +761,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: head/sys/cam/ata/ata_xpt.c
==============================================================================
--- head/sys/cam/ata/ata_xpt.c Wed Apr 20 12:58:30 2011 (r220885)
+++ head/sys/cam/ata/ata_xpt.c Wed Apr 20 13:27:50 2011 (r220886)
@@ -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,
More information about the svn-src-head
mailing list