aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/ata
diff options
context:
space:
mode:
authorThomas Quinot <thomas@FreeBSD.org>2004-02-11 10:14:08 +0000
committerThomas Quinot <thomas@FreeBSD.org>2004-02-11 10:14:08 +0000
commita0e1020523ecaeb6ee5e39d90bf1f6df33e47292 (patch)
tree84141f40ae90ad2abf42d034185edf9d17e94627 /sys/dev/ata
parenteb4f5d9df647f4cbba9b526b4536fb192e237f6f (diff)
Notes
Diffstat (limited to 'sys/dev/ata')
-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 bad223835601..7fb897ed0c12 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;