Subject: Rework of ATA code to support native SATA controllers
To: None <tech-kern@netbsd.org>
From: Jason Thorpe <thorpej@wasabisystems.com>
List: tech-kern
Date: 12/16/2003 10:15:32
--Apple-Mail-15-949535680
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset=US-ASCII; format=flowed

Folks...

Native SATA controllers present a fairly different model as compared to 
standard ATA controllers.

The most glaring difference is the fact that the notion of "master" and 
"slave" drives on a channel is really non-existent.  Sure, some SATA 
controllers emulate that mode, but SATA only has one drive per port[*], 
and so on some 4-port controllers, what we really see is 4 channels, 1 
drive per channel.

[*] SATA-II supports port expansion.  In this case, you have one 
channel which can have up to 15 drives.  One port multiplier is allowed 
per root port, and that port multiplier can have up to 15 ports on it.  
No nesting of port multipliers is allowed.

Another glaring difference, especially with some newer controllers, is 
that the legacy ATA register set does not exist at all.  SATA basically 
encapsulates access to those drive registers in a frame (called a FIS), 
and I'm working with one controller right now where you build the FIS 
in memory and then tell the controller to send it to the drive; there 
are no ATA registers mapped into the CPU's address space at all.

I would like to see our ATA code adapted to handle this.  I think the 
following "clean-up" changes are necessary, at least:

	1. Move all of the ATA register access stuff into wdc-specific files.
	   ATA register values are still valid in native SATA (they're really
	   part of the ATA command set), but the actual access needs to be
	   fully abstracted out.

	2. The "atabus" layer needs to be changed to support more than 2 drives
	   per channel.

	3. The "pciide" layer probably should be changed to support more than
	   2 channels.

I will do some of this work, but I'm going to need help from someone 
who really understands this code (HI MANUEL! :-).

We also need to look at both ATA and SATA command queueing (in SATA, 
the ATA-style command queueing is referred to as "legacy", and the SATA 
command queueing is referred to as "native").  At a glance, the wd 
driver appears to support only one outstanding ata_bio.  This clearly 
has to change :-)

Again, I will do some of this work, but I'm going to need help from 
someone who really understands this code (HI MANUEL! :-) and also how 
legacy command queueing works (err, HI MANUEL! :-)

         -- Jason R. Thorpe <thorpej@wasabisystems.com>

--Apple-Mail-15-949535680
content-type: application/pgp-signature; x-mac-type=70674453;
	name=PGP.sig
content-description: This is a digitally signed message part
content-disposition: inline; filename=PGP.sig
content-transfer-encoding: 7bit

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (Darwin)

iD8DBQE/30vFOpVKkaBm8XkRAkPoAKCowaslIRuNT3RmtvdSC/kt/ANoEQCgpayL
MvzFiHejzTzNejM7S0PC7iM=
=N9di
-----END PGP SIGNATURE-----

--Apple-Mail-15-949535680--