WIP: ATA to CAM integration

Alexander Motin mav at mavhome.dp.ua
Tue Jun 2 16:54:55 UTC 2009


After replying to several similar questions about my ATA plans last
time, I have decided to announce things I am working on now together
with Scott Long.

While learning FreeBSD ATA implementation, I have found, that it has
numerous deep problems, from quite fuzzy APIs to different issues in
device detection and error recovery. Also, as soon as this
infrastructure was written many years ago, it has completely no support
for any kind of command queuing, which is normal for the most of modern
drives and controllers. Fixing all of this require many significant changes.

Also, you may know, that SAS controllers and expanders allow attaching
SATA devices and port multipliers to them, by transporting ATA commands
over SCSI (SAS) bus. ATAPI, same time, is the way to transport SCSI
commands over ATA interface. So deep technologies interoperation pushes
us to have similarly integrated infrastructures on software level. We
are already have atapicam driver which is used to give CAM SCSI
infrastructure access to ATAPI devices by translating drivers API and
SCSI bus emulation. But it works only one way and also not perfect.

Looking to all of this, I have decided to join Scott, to reanimate his
project of making CAM a system's universal infrastructure for both SCSI
and ATA. This project is not about some kind of SCSI-to-ATA translation,
used by some OS, like OpenBSD. It is about extending CAM, to equally
support both SCSI and ATA worlds natively and integrate them as tight as

This project is going to have several main steps:
 - separate SCSI command set and SCSI bus management code from abstract
CAM code and create abstract transport API (this step is mostly done now
by Scott),
 - implement ATA command set device drivers, ATA bus management code and
ATA host controller drivers (this step is now in progress by me),
 - update CAM to use newbus, to make it's components interoperation more
transparent and formalized (this is now in planning and preparation stage),
 - when mentioned above finished, port the rest of existing ATA
controller drivers one by one to the new world order.

Our code now lives in PERFORCE in scottl-camlock project branch. It is
in early development, but we already have there working CAM driver for
AHCI controller with command queuing and basic NCQ support, simple SATA
bus management code and ATA disk driver. I am able now to boot my system
and work from SATA drive on AHCI controller, using ATA disk driver,
having command queuing and NCQ enabled, read and write disks with SATA
ATAPI DVD-RW drive, using native SCSI CD driver. And all of that only
with CAM, without using any part of ATA infrastructure.

Alexander Motin

More information about the freebsd-arch mailing list