Subject: CVS commit: src
To: None <source-changes@netbsd.org>
From: Perry E. Metzger <perry@netbsd.org>
List: source-changes
Date: 05/05/1999 14:35:16
Module Name:	src
Committed By:	perry
Date:		Wed May  5 21:35:16 UTC 1999

Modified Files:
	src/sys/dev/scsipi: atapi_wdc.c
Log Message:
Add patch from Manuel Bouyer -- his mail message said:

By code inspection I found 2 bugs in the ATAPI code, one may be the cause
of your problem: A counter is not reset when issuing the request_sense
command. This is c_skip, the counter used to track the offset in the data
buffer when a data tranfer needs multiple phases. The effect of this is that
the sense data transfered may be stored outside the sense buffer (sense buffer
+ some, potentially several KB, offset). This can only occur in PIO mode,
DMA is not affected.
This doesn't occur in "normal" use because when reading a data CD, either
the sense is issued for a non-data command (in which case c_skip stays to
0), or an error occured and no data has been transfered, and c_skip is still 0.
I can't see a case where a data READ/WRITE could cause a sense tranfer without
error.

The second problem is that b_resid can be set to a false value (resulting of
the sense tranfer and not the data transfer). Again this is not a problem with
usual data tranfers because both values ends up being 0 when no error occurs.