tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: ata(4) and NCQ



on 26/04/2011 13:57 Manuel Bouyer said the following:
> On Wed, Apr 20, 2011 at 02:32:08PM +0300, Andriy Gapon wrote:
>> on 20/04/2011 03:38 Jonathan Stone said the following:
>>> Also that both FreeBSD and Linux took the plunge and handle ATA drives 
>>> through
>>> their SCSI mid-layer.  I agree, that code is big; but maybe that 
>>> alternative is
>>> worth examiining, too.
>>
>> AFAIK, (Open)Solaris did the same.
>> And to clarify: you are actually talking about CAM layer.  Yes, previously 
>> CAM
>> layer was only used for SCSI.
> 
> I'm still not sure what the rationale for this is. Managing the tags
> is simple and could easily be abstracted and shared by the 2 subsystems
> if we want to. 

Right.  And that's what CAM layer does (in addition to other things).

> Using the scsi code for ATA drives means that you either

Again, I don't understand this.  We should first clearly define what SCSI code
is.  In my understanding SCSI code has nothing to do with ATA disks (in FreeBSD
at least).

> have to teach the scsi sd driver to build ATA commands, and the whole
> scsipi to handle ATA commands in addition to SCSI and ATAPI; or
> or keep SCSI commands in the mid-layer and convert SCSI to ATA commands in
> the ATA layer (which I consider useless overhead).

FreeBSD did neither, but closer to the first option.  There is a new peripheral
driver that uses ATA commands to talk to its disks.  Most of the intermediate
layer is command-agnostic.  Transport-specific places had to be taught about
ATA, of course.

> Actually I suspect the idea to have ATA drives show up as SCSI comes from
> windows. But this was done so on windows because of a limitation of the
> windows kernel: if you want to have a drive appears as ATA the controller
> has to follow the pciide 1 specification. if you have a smarter controller,
> the only way to have full control at the controller driver level is to
> register it as a SCSI driver.

Can't say about other OSes, but FreeBSD has chosen this approach because SATA
disks and AHCI controllers are much closer to SCSI concepts, than the primitive
PATA/IDE were.

Here is a very good overview written by a person who did all the work in 
FreeBSD:
ftp2.pl.freebsd.org/pub/FreeBSD/DOC/ata-cam_en.pdf

-- 
Andriy Gapon


Home | Main Index | Thread Index | Old Index