Re: ATAPI tape drives broken with libata

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Mark Lord wrote:
> 
> I can read and write the tape successfully, and the written data matches
> what is later read back from it.
> 
> Here's the hack I used.  Not ready for mainline, but perhaps it will
> help Alan or whomever come up with something nice for Jeff.
> 
> --- 2.6.23-rc6/drivers/ata/libata-core.c  2007-09-13 09:49:16.000000000
> -0400
> +++ linux/drivers/ata/libata-core.c     2007-09-13 14:15:57.000000000 -0400
> @@ -4932,9 +4932,9 @@
>                if (unlikely(status & (ATA_ERR | ATA_DF))) {
>                        ata_port_printk(ap, KERN_WARNING, "DRQ=1 with
> device "
>                                        "error, dev_stat 0x%X\n", status);
> -                       qc->err_mask |= AC_ERR_HSM;
> -                       ap->hsm_task_state = HSM_ST_ERR;
> -                       goto fsm_start;
> +                       //qc->err_mask |= AC_ERR_HSM;
> +                       //ap->hsm_task_state = HSM_ST_ERR;
> +                       //goto fsm_start;
>                }
> 
>                /* Send the CDB (atapi) or the first data block (ata pio
> out).
> 

It's strange that the device reports DRQ + ERR at this point since if
it knows something wrong, asking to transfer the CDB doesn't help...

Is the device configured to MWDMA? If yes, maybe it's ATAPI DMA of
the previous command makes the device state machine confused...

Could you please try if the attached debug patch helps? Thanks.
--
albert


diff -Nrup 00_libata-dev/drivers/ata/libata-core.c 01_atapi_dma/drivers/ata/libata-core.c
--- 00_libata-dev/drivers/ata/libata-core.c	2007-09-21 10:35:54.000000000 +0800
+++ 01_atapi_dma/drivers/ata/libata-core.c	2007-09-21 10:49:20.000000000 +0800
@@ -4193,6 +4193,8 @@ static void ata_fill_sg_dumb(struct ata_
 int ata_check_atapi_dma(struct ata_queued_cmd *qc)
 {
 	struct ata_port *ap = qc->ap;
+	struct scsi_cmnd *cmd = qc->scsicmd;
+	u8 *scsicmd = cmd->cmnd;
 
 	/* Don't allow DMA if it isn't multiple of 16 bytes.  Quite a
 	 * few ATAPI devices choke on such DMA requests.
@@ -4200,6 +4202,21 @@ int ata_check_atapi_dma(struct ata_queue
 	if (unlikely(qc->nbytes & 15))
 		return 1;
 
+	switch (scsicmd[0]) {
+	case READ_10:
+	case WRITE_10:
+	case READ_12:
+	case WRITE_12:
+	case READ_6:
+	case WRITE_6:
+	case 0xad: /* READ_DVD_STRUCTURE */
+	case 0xbe: /* READ_CD */
+		/* ATAPI DMA maybe ok */
+		break;
+	default:
+		return 1;
+	}
+
 	if (ap->ops->check_atapi_dma)
 		return ap->ops->check_atapi_dma(qc);
 

-
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

[Index of Archives]     [Linux Filesystems]     [Linux SCSI]     [Linux RAID]     [Git]     [Kernel Newbies]     [Linux Newbie]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Samba]     [Device Mapper]

  Powered by Linux