Re: Follow up? LibPATA code issues / 2.6.15.4 (found the opcode=0x35)!

From: Justin Piszcz
Date: Mon Jul 10 2006 - 11:43:42 EST


Please verify I did the patch correctly, thanks.

On Mon, 10 Jul 2006, Alan Cox wrote:

Ar Llu, 2006-07-10 am 09:59 -0400, ysgrifennodd Justin Piszcz:
[4297741.057000] ata_gen_fixed_sense: failed ata_op=0x35
[4297741.057000] ata4: translated ATA stat/err 0x51/04 to SCSI SK/ASC/ASCQ
0xb/00/00
[4297741.057000] ata_gen_ata_desc_sense: failed ata_op=0x51
[4297741.057000] ata4: status=0x51 { DriveReady SeekComplete Error }
[4297741.057000] ata4: error=0x04 { DriveStatusError }

Also got a 0xca.

Thats "write" so if that is reporting as an unknown command something
very odd indeed is happening.

diff -uprN linux-2.6.17.3/drivers/scsi/libata-scsi.c linux-2.6.17.3-diff/drivers/scsi/libata-scsi.c
--- linux-2.6.17.3/drivers/scsi/libata-scsi.c 2006-06-30 13:37:38.000000000 -0400
+++ linux-2.6.17.3-diff/drivers/scsi/libata-scsi.c 2006-07-09 16:31:45.665112000 -0400
@@ -428,10 +428,16 @@ int ata_scsi_device_suspend(struct scsi_
* spin_lock_irqsave(host_set lock)
*/
void ata_to_sense_error(unsigned id, u8 drv_stat, u8 drv_err, u8 *sk, u8 *asc,
- u8 *ascq)
+ u8 *ascq, struct ata_queued_cmd *qc)
{
int i;

+ struct scsi_cmnd *cmd = qc->scsicmd;
+ struct ata_taskfile *tf = &qc->tf;
+ unsigned char *sb = cmd->sense_buffer;
+ unsigned char *desc = sb + 8;
+ unsigned char ata_op = tf->command;
+
/* Based on the 3ware driver translation table */
static const unsigned char sense_table[][4] = {
/* BBD|ECC|ID|MAR */
@@ -520,6 +526,7 @@ void ata_to_sense_error(unsigned id, u8
printk(KERN_ERR "ata%u: translated ATA stat/err 0x%02x/%02x to "
"SCSI SK/ASC/ASCQ 0x%x/%02x/%02x\n", id, drv_stat, drv_err,
*sk, *asc, *ascq);
+ printk(KERN_ERR "ata_gen_ata_desc_sense: failed ata_op=0x%02x\n", ata_op);
return;
}

@@ -542,6 +549,7 @@ void ata_gen_ata_desc_sense(struct ata_q
struct ata_taskfile *tf = &qc->tf;
unsigned char *sb = cmd->sense_buffer;
unsigned char *desc = sb + 8;
+ unsigned char ata_op = tf->command;

memset(sb, 0, SCSI_SENSE_BUFFERSIZE);

@@ -558,8 +566,9 @@ void ata_gen_ata_desc_sense(struct ata_q
* onto sense key, asc & ascq.
*/
if (tf->command & (ATA_BUSY | ATA_DF | ATA_ERR | ATA_DRQ)) {
+ printk(KERN_WARNING "ata_gen_ata_desc_sense: failed ata_op=0x%02x\n", ata_op);
ata_to_sense_error(qc->ap->id, tf->command, tf->feature,
- &sb[1], &sb[2], &sb[3]);
+ &sb[1], &sb[2], &sb[3],qc);
sb[1] &= 0x0f;
}

@@ -617,6 +626,7 @@ void ata_gen_fixed_sense(struct ata_queu
struct scsi_cmnd *cmd = qc->scsicmd;
struct ata_taskfile *tf = &qc->tf;
unsigned char *sb = cmd->sense_buffer;
+ unsigned char ata_op = tf->command;

memset(sb, 0, SCSI_SENSE_BUFFERSIZE);

@@ -633,8 +643,9 @@ void ata_gen_fixed_sense(struct ata_queu
* onto sense key, asc & ascq.
*/
if (tf->command & (ATA_BUSY | ATA_DF | ATA_ERR | ATA_DRQ)) {
+ printk(KERN_WARNING "ata_gen_fixed_sense: failed ata_op=0x%02x\n", ata_op);
ata_to_sense_error(qc->ap->id, tf->command, tf->feature,
- &sb[2], &sb[12], &sb[13]);
+ &sb[2], &sb[12], &sb[13],qc);
sb[2] &= 0x0f;
}