svn commit: r247165 - head/sys/dev/ata
Alexander Motin
mav at FreeBSD.org
Fri Feb 22 21:43:22 UTC 2013
Author: mav
Date: Fri Feb 22 21:43:21 2013
New Revision: 247165
URL: http://svnweb.freebsd.org/changeset/base/247165
Log:
Fix command timeout caused by data underrun during fetching ATAPI sense
data, introduced by r246713. There are two places where ata_request is
filled in ATA_CAM: ata_cam_begin_transaction() and ata_cam_request_sense().
In the first case DMA should be done for addresses from the CCB. In second
case, DMA should be done to the different address, the address of the sense
buffer inside the CCB structure itself.
Modified:
head/sys/dev/ata/ata-all.c
head/sys/dev/ata/ata-all.h
head/sys/dev/ata/ata-dma.c
Modified: head/sys/dev/ata/ata-all.c
==============================================================================
--- head/sys/dev/ata/ata-all.c Fri Feb 22 20:49:50 2013 (r247164)
+++ head/sys/dev/ata/ata-all.c Fri Feb 22 21:43:21 2013 (r247165)
@@ -1532,6 +1532,7 @@ ata_cam_begin_transaction(device_t dev,
request->timeout = (ccb->ccb_h.timeout + 999) / 1000;
callout_init_mtx(&request->callout, &ch->state_mtx, CALLOUT_RETURNUNLOCKED);
request->ccb = ccb;
+ request->flags |= ATA_R_DATA_IN_CCB;
ch->running = request;
ch->state = ATA_ACTIVE;
Modified: head/sys/dev/ata/ata-all.h
==============================================================================
--- head/sys/dev/ata/ata-all.h Fri Feb 22 20:49:50 2013 (r247164)
+++ head/sys/dev/ata/ata-all.h Fri Feb 22 21:43:21 2013 (r247165)
@@ -398,6 +398,7 @@ struct ata_request {
#define ATA_R_THREAD 0x00000800
#define ATA_R_DIRECT 0x00001000
#define ATA_R_NEEDRESULT 0x00002000
+#define ATA_R_DATA_IN_CCB 0x00004000
#define ATA_R_ATAPI16 0x00010000
#define ATA_R_ATAPI_INTR 0x00020000
Modified: head/sys/dev/ata/ata-dma.c
==============================================================================
--- head/sys/dev/ata/ata-dma.c Fri Feb 22 20:49:50 2013 (r247164)
+++ head/sys/dev/ata/ata-dma.c Fri Feb 22 21:43:21 2013 (r247165)
@@ -305,7 +305,7 @@ ata_dmaload(struct ata_request *request,
dspa.dmatab = request->dma->sg;
#ifdef ATA_CAM
- if (request->ccb)
+ if (request->flags & ATA_R_DATA_IN_CCB)
error = bus_dmamap_load_ccb(request->dma->data_tag,
request->dma->data_map, request->ccb,
ch->dma.setprd, &dspa, BUS_DMA_NOWAIT);
More information about the svn-src-head
mailing list