On Mon, 26 Nov 2007 20:34:38 +0900, Tejun Heo wrote:
> Make pdc_atapi_pkt() use values from qc->tf instead of creating its
> own.  This is to ease future ATAPI handling changes.
> 
> DONT APPLY YET
> ---
> Mikael, would this work?  Values other than lbam and lbah remain the
> same.  Does sata_promise have strict requirements for lbam and lbah?

...

>       /* set feature and byte counter registers */
> -     if (qc->tf.protocol != ATA_PROT_ATAPI_DMA) {
> +     if (qc->tf.protocol != ATA_PROT_ATAPI_DMA)
>               feature = PDC_FEATURE_ATAPI_PIO;
> -             /* set byte counter register to real transfer byte count */
> -             nbytes = qc->nbytes;
> -             if (nbytes > 0xffff)
> -                     nbytes = 0xffff;
> -     } else {
> +     else
>               feature = PDC_FEATURE_ATAPI_DMA;
> -             /* set byte counter register to 0 */
> -             nbytes = 0;
> -     }
> +
>       buf[20] = (1 << 5) | ATA_REG_FEATURE;
>       buf[21] = feature;
>       buf[22] = (1 << 5) | ATA_REG_BYTEL;
> -     buf[23] = nbytes & 0xFF;
> +     buf[23] = qc->tf.lbam;
>       buf[24] = (1 << 5) | ATA_REG_BYTEH;
> -     buf[25] = (nbytes >> 8) & 0xFF;
> +     buf[25] = qc->tf.lbah;

The original code matches what Promise' own driver does, including
the "set byte counter register to real transfer byte count" comment.
It's certainly possible that if lbah/lbam don't match ->nbytes,
the HW will go nuts. Their data sheets are very quiet about ATAPI.

I can test your proposed change next weekend when I'm back to where
my sata_promise test equipment is.

/Mikael
-
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to