Subject: Re: Feb. 29 kernel
To: Charles M. Hannum <mycroft@NetBSD.ORG>
From: Justin T. Gibbs <>
List: current-users
Date: 03/03/1996 22:28:56
>   At the end of each data phase, the residual is always
>   correct, so you update the residual as the number of sg segments left and t
>   number of bytes left to transfer in the current segment at that time.  [...
>What you describe sounds more or less equivalent to deferring the implied
>RESTORE POINTERS until a new data phase is started.  While this may work,
>it's not clear that it's any more compliant with the SCSI standard.

Not at all.  The data pointers are modified immediately upon reconnection,
it would get really complicated if I didn't do that.  Instead, the residual
count is a separate entity only updated by actual transfers.  As the spec
implies, don't trust the data pointers to give you an acurate picture of
whats been transfered.  So I don't, and the code assumes the data was
transfered correctly unless the target requests some data to be
re-transfered (explicit restore pointers or disconnect/reconnect without
a save data pointers followed by a data phase).

>It seems like the only `correct' solution is to rely on having correct
>residue counts returned from the device.  This only happens for a limited
>subset of device types, but if that's what the standard requires...

I'm not familiar with this portion of the spec.  Is this something you have
to explicitly query from the device, or does it return CHECK SENSE status
and the residual is retrieved that way?

Justin T. Gibbs
  FreeBSD: Turning PCs into workstations