Patch 5/6: Support ATA passthru to ATAPI devices. Revised based on Mark's patch and Jeff's comments. Signed-off-by: Albert Lee <albertcc@xxxxxxxxxx> Cc: Mark Lord <mlord@xxxxxxxxx> --- After reading Mark's patch, I guess we can safely by-pass the cdb_len check: the ATA_12/ATA_16 are for the libata SATL and get unwrapped to ATA taskfiles before the devices ever see them. diff -Nrup 04_dev_bit/drivers/ata/libata-scsi.c 05_supp_atapi/drivers/ata/libata-scsi.c --- 04_dev_bit/drivers/ata/libata-scsi.c 2007-06-07 14:44:27.000000000 +0800 +++ 05_supp_atapi/drivers/ata/libata-scsi.c 2007-06-07 14:44:30.000000000 +0800 @@ -2701,10 +2701,6 @@ static inline ata_xlat_func_t ata_get_xl case VERIFY_16: return ata_scsi_verify_xlat; - case ATA_12: - case ATA_16: - return ata_scsi_pass_thru; - case START_STOP: return ata_scsi_start_stop_xlat; } @@ -2740,8 +2736,14 @@ static inline int __ata_scsi_queuecmd(st void (*done)(struct scsi_cmnd *), struct ata_device *dev) { + u8 cmd = scmd->cmnd[0]; int rc = 0; + if (unlikely(cmd == ATA_12 || cmd == ATA_16)) { + rc = ata_scsi_translate(dev, scmd, done, ata_scsi_pass_thru); + return rc; + } + if (unlikely(!scmd->cmd_len || scmd->cmd_len > dev->cdb_len)) { DPRINTK("bad CDB len=%u, max=%u\n", scmd->cmd_len, dev->cdb_len); @@ -2751,8 +2753,7 @@ static inline int __ata_scsi_queuecmd(st } if (dev->class == ATA_DEV_ATA) { - ata_xlat_func_t xlat_func = ata_get_xlat_func(dev, - scmd->cmnd[0]); + ata_xlat_func_t xlat_func = ata_get_xlat_func(dev, cmd); if (xlat_func) rc = ata_scsi_translate(dev, scmd, done, xlat_func); - To unsubscribe from this list: send the line "unsubscribe linux-ide" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html