aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/libata-scsi.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/libata-scsi.c')
-rw-r--r--drivers/scsi/libata-scsi.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c
index 2282c04fee46..e0439be4b573 100644
--- a/drivers/scsi/libata-scsi.c
+++ b/drivers/scsi/libata-scsi.c
@@ -418,7 +418,7 @@ void ata_to_sense_error(unsigned id, u8 drv_stat, u8 drv_err, u8 *sk, u8 *asc,
418 int i; 418 int i;
419 419
420 /* Based on the 3ware driver translation table */ 420 /* Based on the 3ware driver translation table */
421 static unsigned char sense_table[][4] = { 421 static const unsigned char sense_table[][4] = {
422 /* BBD|ECC|ID|MAR */ 422 /* BBD|ECC|ID|MAR */
423 {0xd1, ABORTED_COMMAND, 0x00, 0x00}, // Device busy Aborted command 423 {0xd1, ABORTED_COMMAND, 0x00, 0x00}, // Device busy Aborted command
424 /* BBD|ECC|ID */ 424 /* BBD|ECC|ID */
@@ -449,7 +449,7 @@ void ata_to_sense_error(unsigned id, u8 drv_stat, u8 drv_err, u8 *sk, u8 *asc,
449 {0x80, MEDIUM_ERROR, 0x11, 0x04}, // Block marked bad Medium error, unrecovered read error 449 {0x80, MEDIUM_ERROR, 0x11, 0x04}, // Block marked bad Medium error, unrecovered read error
450 {0xFF, 0xFF, 0xFF, 0xFF}, // END mark 450 {0xFF, 0xFF, 0xFF, 0xFF}, // END mark
451 }; 451 };
452 static unsigned char stat_table[][4] = { 452 static const unsigned char stat_table[][4] = {
453 /* Must be first because BUSY means no other bits valid */ 453 /* Must be first because BUSY means no other bits valid */
454 {0x80, ABORTED_COMMAND, 0x47, 0x00}, // Busy, fake parity for now 454 {0x80, ABORTED_COMMAND, 0x47, 0x00}, // Busy, fake parity for now
455 {0x20, HARDWARE_ERROR, 0x00, 0x00}, // Device fault 455 {0x20, HARDWARE_ERROR, 0x00, 0x00}, // Device fault
@@ -1203,12 +1203,11 @@ nothing_to_do:
1203 return 1; 1203 return 1;
1204} 1204}
1205 1205
1206static int ata_scsi_qc_complete(struct ata_queued_cmd *qc, 1206static int ata_scsi_qc_complete(struct ata_queued_cmd *qc)
1207 unsigned int err_mask)
1208{ 1207{
1209 struct scsi_cmnd *cmd = qc->scsicmd; 1208 struct scsi_cmnd *cmd = qc->scsicmd;
1210 u8 *cdb = cmd->cmnd; 1209 u8 *cdb = cmd->cmnd;
1211 int need_sense = (err_mask != 0); 1210 int need_sense = (qc->err_mask != 0);
1212 1211
1213 /* For ATA pass thru (SAT) commands, generate a sense block if 1212 /* For ATA pass thru (SAT) commands, generate a sense block if
1214 * user mandated it or if there's an error. Note that if we 1213 * user mandated it or if there's an error. Note that if we
@@ -1532,7 +1531,7 @@ unsigned int ata_scsiop_inq_80(struct ata_scsi_args *args, u8 *rbuf,
1532 return 0; 1531 return 0;
1533} 1532}
1534 1533
1535static const char *inq_83_str = "Linux ATA-SCSI simulator"; 1534static const char * const inq_83_str = "Linux ATA-SCSI simulator";
1536 1535
1537/** 1536/**
1538 * ata_scsiop_inq_83 - Simulate INQUIRY EVPD page 83, device identity 1537 * ata_scsiop_inq_83 - Simulate INQUIRY EVPD page 83, device identity
@@ -1955,9 +1954,9 @@ void ata_scsi_badcmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *), u8
1955 done(cmd); 1954 done(cmd);
1956} 1955}
1957 1956
1958static int atapi_sense_complete(struct ata_queued_cmd *qc,unsigned int err_mask) 1957static int atapi_sense_complete(struct ata_queued_cmd *qc)
1959{ 1958{
1960 if (err_mask && ((err_mask & AC_ERR_DEV) == 0)) 1959 if (qc->err_mask && ((qc->err_mask & AC_ERR_DEV) == 0))
1961 /* FIXME: not quite right; we don't want the 1960 /* FIXME: not quite right; we don't want the
1962 * translation of taskfile registers into 1961 * translation of taskfile registers into
1963 * a sense descriptors, since that's only 1962 * a sense descriptors, since that's only
@@ -2015,15 +2014,18 @@ static void atapi_request_sense(struct ata_queued_cmd *qc)
2015 2014
2016 qc->complete_fn = atapi_sense_complete; 2015 qc->complete_fn = atapi_sense_complete;
2017 2016
2018 if (ata_qc_issue(qc)) 2017 if (ata_qc_issue(qc)) {
2019 ata_qc_complete(qc, AC_ERR_OTHER); 2018 qc->err_mask |= AC_ERR_OTHER;
2019 ata_qc_complete(qc);
2020 }
2020 2021
2021 DPRINTK("EXIT\n"); 2022 DPRINTK("EXIT\n");
2022} 2023}
2023 2024
2024static int atapi_qc_complete(struct ata_queued_cmd *qc, unsigned int err_mask) 2025static int atapi_qc_complete(struct ata_queued_cmd *qc)
2025{ 2026{
2026 struct scsi_cmnd *cmd = qc->scsicmd; 2027 struct scsi_cmnd *cmd = qc->scsicmd;
2028 unsigned int err_mask = qc->err_mask;
2027 2029
2028 VPRINTK("ENTER, err_mask 0x%X\n", err_mask); 2030 VPRINTK("ENTER, err_mask 0x%X\n", err_mask);
2029 2031