Commit 9c690cbf authored by Brett Russ's avatar Brett Russ Committed by Jeff Garzik

[libata scsi] verify cmd bug fixes/support

Also, trim trailing whitespace.
parent 1acc28c3
...@@ -202,7 +202,7 @@ void ata_to_sense_error(struct ata_queued_cmd *qc, u8 drv_stat) ...@@ -202,7 +202,7 @@ void ata_to_sense_error(struct ata_queued_cmd *qc, u8 drv_stat)
{0x40, MEDIUM_ERROR, 0x11, 0x04}, // Uncorrectable ECC error Unrecovered read error {0x40, MEDIUM_ERROR, 0x11, 0x04}, // Uncorrectable ECC error Unrecovered read error
/* BBD - block marked bad */ /* BBD - block marked bad */
{0x80, MEDIUM_ERROR, 0x11, 0x04}, // Block marked bad Medium error, unrecovered read error {0x80, MEDIUM_ERROR, 0x11, 0x04}, // Block marked bad Medium error, unrecovered read error
{0xFF, 0xFF, 0xFF, 0xFF}, // END mark {0xFF, 0xFF, 0xFF, 0xFF}, // END mark
}; };
static unsigned char stat_table[][4] = { static unsigned char stat_table[][4] = {
/* Must be first because BUSY means no other bits valid */ /* Must be first because BUSY means no other bits valid */
...@@ -210,22 +210,22 @@ void ata_to_sense_error(struct ata_queued_cmd *qc, u8 drv_stat) ...@@ -210,22 +210,22 @@ void ata_to_sense_error(struct ata_queued_cmd *qc, u8 drv_stat)
{0x20, HARDWARE_ERROR, 0x00, 0x00}, // Device fault {0x20, HARDWARE_ERROR, 0x00, 0x00}, // Device fault
{0x08, ABORTED_COMMAND, 0x47, 0x00}, // Timed out in xfer, fake parity for now {0x08, ABORTED_COMMAND, 0x47, 0x00}, // Timed out in xfer, fake parity for now
{0x04, RECOVERED_ERROR, 0x11, 0x00}, // Recovered ECC error Medium error, recovered {0x04, RECOVERED_ERROR, 0x11, 0x00}, // Recovered ECC error Medium error, recovered
{0xFF, 0xFF, 0xFF, 0xFF}, // END mark {0xFF, 0xFF, 0xFF, 0xFF}, // END mark
}; };
int i = 0; int i = 0;
cmd->result = SAM_STAT_CHECK_CONDITION; cmd->result = SAM_STAT_CHECK_CONDITION;
/* /*
* Is this an error we can process/parse * Is this an error we can process/parse
*/ */
if(drv_stat & ATA_ERR) if(drv_stat & ATA_ERR)
/* Read the err bits */ /* Read the err bits */
err = ata_chk_err(qc->ap); err = ata_chk_err(qc->ap);
/* Display the ATA level error info */ /* Display the ATA level error info */
printk(KERN_WARNING "ata%u: status=0x%02x { ", qc->ap->id, drv_stat); printk(KERN_WARNING "ata%u: status=0x%02x { ", qc->ap->id, drv_stat);
if(drv_stat & 0x80) if(drv_stat & 0x80)
{ {
...@@ -242,7 +242,7 @@ void ata_to_sense_error(struct ata_queued_cmd *qc, u8 drv_stat) ...@@ -242,7 +242,7 @@ void ata_to_sense_error(struct ata_queued_cmd *qc, u8 drv_stat)
if(drv_stat & 0x01) printk("Error "); if(drv_stat & 0x01) printk("Error ");
} }
printk("}\n"); printk("}\n");
if(err) if(err)
{ {
printk(KERN_WARNING "ata%u: error=0x%02x { ", qc->ap->id, err); printk(KERN_WARNING "ata%u: error=0x%02x { ", qc->ap->id, err);
...@@ -259,11 +259,11 @@ void ata_to_sense_error(struct ata_queued_cmd *qc, u8 drv_stat) ...@@ -259,11 +259,11 @@ void ata_to_sense_error(struct ata_queued_cmd *qc, u8 drv_stat)
if(err & 0x02) printk("TrackZeroNotFound "); if(err & 0x02) printk("TrackZeroNotFound ");
if(err & 0x01) printk("AddrMarkNotFound "); if(err & 0x01) printk("AddrMarkNotFound ");
printk("}\n"); printk("}\n");
/* Should we dump sector info here too ?? */ /* Should we dump sector info here too ?? */
} }
/* Look for err */ /* Look for err */
while(sense_table[i][0] != 0xFF) while(sense_table[i][0] != 0xFF)
{ {
...@@ -301,7 +301,7 @@ void ata_to_sense_error(struct ata_queued_cmd *qc, u8 drv_stat) ...@@ -301,7 +301,7 @@ void ata_to_sense_error(struct ata_queued_cmd *qc, u8 drv_stat)
/* No error ?? */ /* No error ?? */
printk(KERN_ERR "ata%u: called with no error (%02X)!\n", qc->ap->id, drv_stat); printk(KERN_ERR "ata%u: called with no error (%02X)!\n", qc->ap->id, drv_stat);
/* additional-sense-code[-qualifier] */ /* additional-sense-code[-qualifier] */
sb[0] = 0x70; sb[0] = 0x70;
sb[2] = MEDIUM_ERROR; sb[2] = MEDIUM_ERROR;
sb[7] = 0x0A; sb[7] = 0x0A;
...@@ -488,13 +488,18 @@ static unsigned int ata_scsi_verify_xlat(struct ata_queued_cmd *qc, u8 *scsicmd) ...@@ -488,13 +488,18 @@ static unsigned int ata_scsi_verify_xlat(struct ata_queued_cmd *qc, u8 *scsicmd)
} }
if (lba48) { if (lba48) {
tf->command = ATA_CMD_VERIFY_EXT;
tf->hob_nsect = (n_sect >> 8) & 0xff; tf->hob_nsect = (n_sect >> 8) & 0xff;
tf->hob_lbah = (sect >> 40) & 0xff; tf->hob_lbah = (sect >> 40) & 0xff;
tf->hob_lbam = (sect >> 32) & 0xff; tf->hob_lbam = (sect >> 32) & 0xff;
tf->hob_lbal = (sect >> 24) & 0xff; tf->hob_lbal = (sect >> 24) & 0xff;
} else } else {
tf->command = ATA_CMD_VERIFY;
tf->device |= (sect >> 24) & 0xf; tf->device |= (sect >> 24) & 0xf;
}
tf->nsect = n_sect & 0xff; tf->nsect = n_sect & 0xff;
......
...@@ -123,6 +123,8 @@ enum { ...@@ -123,6 +123,8 @@ enum {
ATA_CMD_PIO_WRITE_EXT = 0x34, ATA_CMD_PIO_WRITE_EXT = 0x34,
ATA_CMD_SET_FEATURES = 0xEF, ATA_CMD_SET_FEATURES = 0xEF,
ATA_CMD_PACKET = 0xA0, ATA_CMD_PACKET = 0xA0,
ATA_CMD_VERIFY = 0x40,
ATA_CMD_VERIFY_EXT = 0x42,
/* SETFEATURES stuff */ /* SETFEATURES stuff */
SETFEATURES_XFER = 0x03, SETFEATURES_XFER = 0x03,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment