Subject: Re: Work-around for certain buggy S-ATA PHYs
To: None <tech-kern@netbsd.org>
From: Christos Zoulas <christos@zoulas.com>
List: tech-kern
Date: 03/21/2003 17:15:09
In article <555D6BF8-5BBF-11D7-A7AD-000A957650EC@wasabisystems.com>,
Jason Thorpe <thorpej@wasabisystems.com> wrote:

i would move the nbp out of the loop and do:

	struct *nbp = NULL;

and then at the end do:
	if (__predict_false(nbp != NULL))

instead of:

       if (__predict_false((bp->b_flags & B_CALL) != 0 &&
                           bp->b_iodone == wd_split_mod15_write))

because I am not sure if the above test is adequate, since it does not
match the exact condition of the first if statement (and anyway it is cheaper).

christos


>-=-=-=-=-=-
>
>Folks...
>
>The following patch fixes some broken behavior I observed with a 
>Seagate Serial ATA disk.
>
>Apparently, the PHY used on some models of Seagate S-ATA drives makes 
>an assumption about the way the data is packetized on the wire, and 
>some controllers break that assumption when the amount of payload 
>*just* fills a S-ATA frame (the controllers are not violating the spec).
>
>The problem only occurs for writes to the disk.
>
>The simplest fix is to just split the transfer in two when that 
>condition arises.  You can detect the condition like so:
>
>	sector_count > 1 && sector_count % 15 == 1
>
>Obviously, the most common case is that of a 16 sector (8K byte), but I 
>have seen 76 sector transfers as well.
>
>This patch basically does 3 things:
>
>	* Adds quirk support to the wd(4) driver.
>
>	* Detects the condition.
>
>	* Splits the transfer when the condition is detected.
>
>Comments?
>
>         -- Jason R. Thorpe <thorpej@wasabisystems.com>
>
>
>-=-=-=-=-=-
>[Attachment type=application/octet-stream, name=sata-mod15.diff]
>-=-=-=-=-=-