This message is from the T13 list server.

> host knows exactly how much data will be transferred.  Yes, there
> is the ATAPI "read CDB" issue that some SCSI commands can
> transfer a variable amount of data but this is always resolved by
> using the host's Allocation Length value and looking at the data
> received (for example, looking at the header data from a command
> like Mode Sense).  And everything I said in this paragraph
> applies to both PIO and DMA - PIO and DMA data transfers are the
> same.  Since PIO and DMA are the same there really isn't any
> problem for people to appreciate.

There are some CDBs interpreted differently by different vendors, and it
isn't always reliable to depend on the header length field.  For
example, with CD/DVD drives, you can issue the Get Performance CDB of:

AC 10 00 00 00 00 00 00 00 00 00 00

This retrieves the Read Performance Descriptors with 0 descriptors
requested (an admittedly unlikely CDB to send, but just using this to
make a point).  Some vendors interpret this CDB as meaning that the
caller wants just the header with 0 descriptors following it (total of 8
header bytes returned).  Other vendors interpret this as meaning that
the caller wants nothing, and thus transfers no data.  The MMC
specification itself is a little ambiguous in this area though I read
its intent as being to return the header only with 0 descriptors.

Let's say you pass this CDB to the ATAPI.SYS driver with a data in
buffer size of 8 bytes.  With DMA enabled, the driver returns back
saying 8 bytes were transferred (regardless of whether the drive
returned data or not).

Looking at the Performance Data Length value (first 4 bytes of the
header) can't be trusted as you don't know if the drive really returned
data.

Solution?  Easy enough, just zero out your buffer before sending the
command (or don't issue a 0 descriptor Get Performance CDB).  However,
not all software developers know the various interpretations of all the
various drives and how to work around them.

Knowing the exact # of bytes transferred isn't a necessity, just
something nice to have.

Just my two cents.

Mike


Reply via email to