summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorthomas <thomas@FreeBSD.org>2004-02-11 10:14:08 +0000
committerthomas <thomas@FreeBSD.org>2004-02-11 10:14:08 +0000
commitb1740ac08599ec2c2d0f22283cc76657a5812c80 (patch)
tree84141f40ae90ad2abf42d034185edf9d17e94627 /sys
parent36a5b6eedb97899b4d53f40be3ad0558e5f44813 (diff)
downloadFreeBSD-src-b1740ac08599ec2c2d0f22283cc76657a5812c80.zip
FreeBSD-src-b1740ac08599ec2c2d0f22283cc76657a5812c80.tar.gz
(atapi_cb): Reenable automatic retrieve of sense data on error, making
it asynchronous to avoid incorrect use of ata_atapicmd within an ATAPI callback. Tested by: harti
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/ata/atapi-cam.c35
1 files changed, 21 insertions, 14 deletions
diff --git a/sys/dev/ata/atapi-cam.c b/sys/dev/ata/atapi-cam.c
index bad2238..7fb897e 100644
--- a/sys/dev/ata/atapi-cam.c
+++ b/sys/dev/ata/atapi-cam.c
@@ -62,7 +62,7 @@ struct atapi_hcb {
union ccb *ccb;
int flags;
#define QUEUED 0x0001
-
+#define AUTOSENSE 0x0002
char *dxfer_alloc;
TAILQ_ENTRY(atapi_hcb) chain;
};
@@ -569,26 +569,33 @@ atapi_cb(struct ata_request *request)
}
#endif
- if (request->result != 0) {
+ if ((hcb->flags & AUTOSENSE) != 0) {
+ rc = CAM_SCSI_STATUS_ERROR;
+ if (request->result == 0) {
+ csio->ccb_h.status |= CAM_AUTOSNS_VALID;
+ }
+ } else if (request->result != 0) {
rc = CAM_SCSI_STATUS_ERROR;
csio->scsi_status = SCSI_STATUS_CHECK_COND;
-#if 0
- /*
- * XXX Temporarily disable autosense, as this seems to cause
- * a missed ATA interrupt.
- */
+
if ((csio->ccb_h.flags & CAM_DIS_AUTOSENSE) == 0) {
- int8_t ccb[16] = { ATAPI_REQUEST_SENSE, 0, 0, 0,
+ static const int8_t ccb[16] = { ATAPI_REQUEST_SENSE, 0, 0, 0,
sizeof(struct atapi_sense), 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0 };
- if (ata_atapicmd(request->device, ccb, (caddr_t)&csio->sense_data,
- sizeof(struct atapi_sense), ATA_R_READ, 30) == 0)
- {
- csio->ccb_h.status |= CAM_AUTOSNS_VALID;
- }
+ bcopy (ccb, request->u.atapi.ccb, sizeof ccb);
+ request->data = (caddr_t)&csio->sense_data;
+ request->bytecount = sizeof(struct atapi_sense);
+ request->transfersize = min(request->bytecount, 65534);
+ request->timeout = csio->ccb_h.timeout;
+ request->retries = 2;
+ request->flags = ATA_R_QUIET|ATA_R_ATAPI|ATA_R_IMMEDIATE;
+ hcb->flags |= AUTOSENSE;
+
+ mtx_unlock (&Giant);
+ ata_queue_request(request);
+ return;
}
-#endif
} else {
rc = CAM_REQ_CMP;
csio->scsi_status = SCSI_STATUS_OK;
OpenPOWER on IntegriCloud