RFC: ATA to CAM integration patch

Alexander Motin mav at FreeBSD.org
Fri Jun 26 18:47:34 UTC 2009


I would like to present for testing and feedback present state of my and
Scott work on extending CAM subsystem to support ATA in addition to
SCSI. At this moment we have:
  - CAM transport separated on common and SCSI-specific parts, last one
wrapped with small API that allows switching;
  - implemented SATA-specific transport, that is automatically used when
controller reports SATA bus attached to it. It supports both single
drive and Port Multiplier modes. The only parts unfinished yet is the
automatic hot-plug (you have to do reset/rescan manually) and heavy 
errors recovery;
  - implemented ATA disk driver for CAM infrastructure to natively
operate ATA disks. It already supports most of required functionality:
identify, read, write, flush, dump, NCQ;
  - ATAPI devices handled natively by existing SCSI peripherals drivers, 
by tunneling SCSI commands over ATA bus by PACKET ATA extension;
  - implemented AHCI controller driver, supporting most of tasty
hardware features (controller command queuing, NCQ, Port Multiplier,
MSI). Only some features from latest AHCI specifications for which I
have no hardware left unimplemented.
  - camcontrol took minor changes to be able to report ATA devices.

To test our work you should:
  - have any AHCI compatible controller configured to native AHCI mode 
(not a COMPATIBLE or RAID or whatever else) by BIOS;
  - have some Serial ATA/ATAPI drives connected to AHCI controller;
  - patch your recently updated 8-CURRENT with this patch:
  - rebuild and install world and kernel;
  - read new ahci man page;
  - make sure that you will be able to boot if your SATA disk devices 
name change from some ad4 to ada0;
  - load ahci kernel module using loader prompt or loader.conf;
  - boot.

This change does not breaks existing ATA infrastructure, it just
provides higher priority driver for the same hardware. So you should be 
able get back at any time by just not loading ahci module.

To hot-plug/unplug drive you should use `camcontrol reset ...` and then 
`camcontrol rescan`.

Here is what I have running in my system now, connected to on-board ICH8 
and JMB363 AHCI SATA controllers, using external SiI3726 Port Multiplier:

%camcontrol devlist
<ST3250620NS 3.AEK>                at scbus0 target 0 lun 0 (pass0,ada0)
<Optiarc DVD RW AD-7200S 1.0A>     at scbus0 target 1 lun 0 (cd0,pass1)
<Hitachi HTS542525K9SA00 BBFOC31P>  at scbus0 target 2 lun 0 (ada3,pass5)
<Port Multiplier 37261095 1706>    at scbus0 target 15 lun 0 (pass2)
<OCZ-VERTEX 1.30>                  at scbus2 target 0 lun 0 (pass3,ada1)
<ST3250620NS 3.AEK>                at scbus3 target 0 lun 0 (pass4,ada2)

ICH8 AHCI controller works fine with multi-vector MSI enabled and all 
disk drives listed here are using NCQ. Trivial benchmark on usual HDD 
shown me about 15% speedup from enabling NCQ. I am successfully running 
two of my systems with this new driver during last week.

Waiting for your feedback.

Alexander Motin

More information about the freebsd-current mailing list