diff options
Diffstat (limited to 'drivers/ata/libata-eh.c')
-rw-r--r-- | drivers/ata/libata-eh.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c index d5f03a6e3334..58bdc538d229 100644 --- a/drivers/ata/libata-eh.c +++ b/drivers/ata/libata-eh.c | |||
@@ -1360,6 +1360,7 @@ static int ata_eh_read_log_10h(struct ata_device *dev, | |||
1360 | * atapi_eh_request_sense - perform ATAPI REQUEST_SENSE | 1360 | * atapi_eh_request_sense - perform ATAPI REQUEST_SENSE |
1361 | * @dev: device to perform REQUEST_SENSE to | 1361 | * @dev: device to perform REQUEST_SENSE to |
1362 | * @sense_buf: result sense data buffer (SCSI_SENSE_BUFFERSIZE bytes long) | 1362 | * @sense_buf: result sense data buffer (SCSI_SENSE_BUFFERSIZE bytes long) |
1363 | * @dfl_sense_key: default sense key to use | ||
1363 | * | 1364 | * |
1364 | * Perform ATAPI REQUEST_SENSE after the device reported CHECK | 1365 | * Perform ATAPI REQUEST_SENSE after the device reported CHECK |
1365 | * SENSE. This function is EH helper. | 1366 | * SENSE. This function is EH helper. |
@@ -1370,13 +1371,13 @@ static int ata_eh_read_log_10h(struct ata_device *dev, | |||
1370 | * RETURNS: | 1371 | * RETURNS: |
1371 | * 0 on success, AC_ERR_* mask on failure | 1372 | * 0 on success, AC_ERR_* mask on failure |
1372 | */ | 1373 | */ |
1373 | static unsigned int atapi_eh_request_sense(struct ata_queued_cmd *qc) | 1374 | static unsigned int atapi_eh_request_sense(struct ata_device *dev, |
1375 | u8 *sense_buf, u8 dfl_sense_key) | ||
1374 | { | 1376 | { |
1375 | struct ata_device *dev = qc->dev; | 1377 | u8 cdb[ATAPI_CDB_LEN] = |
1376 | unsigned char *sense_buf = qc->scsicmd->sense_buffer; | 1378 | { REQUEST_SENSE, 0, 0, 0, SCSI_SENSE_BUFFERSIZE, 0 }; |
1377 | struct ata_port *ap = dev->link->ap; | 1379 | struct ata_port *ap = dev->link->ap; |
1378 | struct ata_taskfile tf; | 1380 | struct ata_taskfile tf; |
1379 | u8 cdb[ATAPI_CDB_LEN]; | ||
1380 | 1381 | ||
1381 | DPRINTK("ATAPI request sense\n"); | 1382 | DPRINTK("ATAPI request sense\n"); |
1382 | 1383 | ||
@@ -1387,15 +1388,11 @@ static unsigned int atapi_eh_request_sense(struct ata_queued_cmd *qc) | |||
1387 | * for the case where they are -not- overwritten | 1388 | * for the case where they are -not- overwritten |
1388 | */ | 1389 | */ |
1389 | sense_buf[0] = 0x70; | 1390 | sense_buf[0] = 0x70; |
1390 | sense_buf[2] = qc->result_tf.feature >> 4; | 1391 | sense_buf[2] = dfl_sense_key; |
1391 | 1392 | ||
1392 | /* some devices time out if garbage left in tf */ | 1393 | /* some devices time out if garbage left in tf */ |
1393 | ata_tf_init(dev, &tf); | 1394 | ata_tf_init(dev, &tf); |
1394 | 1395 | ||
1395 | memset(cdb, 0, ATAPI_CDB_LEN); | ||
1396 | cdb[0] = REQUEST_SENSE; | ||
1397 | cdb[4] = SCSI_SENSE_BUFFERSIZE; | ||
1398 | |||
1399 | tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE; | 1396 | tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE; |
1400 | tf.command = ATA_CMD_PACKET; | 1397 | tf.command = ATA_CMD_PACKET; |
1401 | 1398 | ||
@@ -1567,7 +1564,9 @@ static unsigned int ata_eh_analyze_tf(struct ata_queued_cmd *qc, | |||
1567 | 1564 | ||
1568 | case ATA_DEV_ATAPI: | 1565 | case ATA_DEV_ATAPI: |
1569 | if (!(qc->ap->pflags & ATA_PFLAG_FROZEN)) { | 1566 | if (!(qc->ap->pflags & ATA_PFLAG_FROZEN)) { |
1570 | tmp = atapi_eh_request_sense(qc); | 1567 | tmp = atapi_eh_request_sense(qc->dev, |
1568 | qc->scsicmd->sense_buffer, | ||
1569 | qc->result_tf.feature >> 4); | ||
1571 | if (!tmp) { | 1570 | if (!tmp) { |
1572 | /* ATA_QCFLAG_SENSE_VALID is used to | 1571 | /* ATA_QCFLAG_SENSE_VALID is used to |
1573 | * tell atapi_qc_complete() that sense | 1572 | * tell atapi_qc_complete() that sense |