[comp.sys.next] SCSI question

jchin@wimsey.bc.ca (Joseph Chin) (04/23/91)

My recent problems with hooking SCSI devices to my 040 cube and the lack
of solution (tho lots of helpful souls at NeXT and HSD have torn all
their hair out on my behalf) have forced me to venture into the wonderful
world of SCSI and try to find an end to this hell!

I need help understanding the intricacies of SCSI and how it works. If
you're a SCSI expert (or even better, a real life SCSI engineer) and you
can spare the time, I will be super grateful if you can clarify the following
for me:

Q. Can an application program accessing a SCSI device through /dev/sg, for
example, a SCSI scanner software, "drop the line" on the SCSI bus before
a transfer (say ... from scanner to HD, or in general, just reading from
the HD) is completed thus causing the following error to appear on the
Console:
	"sd0: Incomplete disk transfer; bytes moved=0x2000; resid= ..."

This may be a stupid and unfounded question, but my limited knowledge
has led me to believe this may be a possible source for my (and possibly
many others) SCSI problems.

Thanks.

:-( Joe
jchin@van-bc.wimsey.bc.ca

-- 
 **************************************************************
 * "Kill the body and the head will die" (Hunter S. Thompson) *
 *    NeXT --> The ultimate electronic publishing platform!   *
 ********** Joseph Chin --> jchin@van-bc.wimsey.bc.ca *********

goykhman_a@apollo.HP.COM (Alex Goykhman) (04/27/91)

In article <1991Apr23.063100.29089@wimsey.bc.ca> jchin@wimsey.bc.ca (Joseph Chin) writes:
>My recent problems with hooking SCSI devices to my 040 cube and the lack
>of solution (tho lots of helpful souls at NeXT and HSD have torn all
>their hair out on my behalf) have forced me to venture into the wonderful
>world of SCSI and try to find an end to this hell!
>
>I need help understanding the intricacies of SCSI and how it works. If
>you're a SCSI expert (or even better, a real life SCSI engineer) and you
>can spare the time, I will be super grateful if you can clarify the following
>for me:
>
>Q. Can an application program accessing a SCSI device through /dev/sg, for
>example, a SCSI scanner software, "drop the line" on the SCSI bus before
>a transfer (say ... from scanner to HD, or in general, just reading from
>the HD) is completed thus causing the following error to appear on the
>Console:
>	"sd0: Incomplete disk transfer; bytes moved=0x2000; resid= ..."

    In real life, a SCSI transfer length is often specified in two different
    places:

        the CDB itself
        the SCSI host adapter's transfer counter

    Those two lengths do not necessarily have to be the same, but the h.a.
    driver has to handle those situations properly.  Handling normally
    includes a) "padding" the transfer, i.e. discarding the extra bytes (READ),
    or appending some kind of predetermined pattern to the end of a date (WRITE)
    b) returning an appropriate error code ("too short", "too long", etc.)
    to the caller.

    It is up to the caller how to interpret those "incorrect length" code.
    Clearly, in your case the caller did not expect one of those codes.
    Why?  It depends, among other things, on what kind of device it was
    (variable block devices being a special case)

    If it were my hair on the line, I would connect a SCSI analyser
    to the bus and compare the CDB transfer length with the number of bytes
    actually transferred through the bus.

>
>This may be a stupid and unfounded question, but my limited knowledge
>has led me to believe this may be a possible source for my (and possibly
>many others) SCSI problems.
>
>Thanks.
>
>:-( Joe
>jchin@van-bc.wimsey.bc.ca
>
>-- 
> **************************************************************
> * "Kill the body and the head will die" (Hunter S. Thompson) *
> *    NeXT --> The ultimate electronic publishing platform!   *
> ********** Joseph Chin --> jchin@van-bc.wimsey.bc.ca *********


| Alex Goykhman                    goykhman_a@apollo.hp.com      |
| Chelmsford System Software Lab   mit-eddie!apollo!goykhman_a   |
| Hewlett-Packard, Company         Naturally, I speak for myself |
------------------------------------------------------------------