Linux/ThinkPad SATA details

Here is the config I am using with Linux kernel as of September 12, 2005. With this configuration, both the hard drive and the CD/DVD are handled as if they were SCSI devices, via the kernel's libata (specifically, the ata_piix driver). The hard drive appears as /dev/sda and the CD as /dev/sr0.

The most important lines, I think, are these:

# CONFIG_IDE is not set

(I'm not sure why CONFIG_SCSI_QLA2XXX is set -- it may be a dependency of SCSI_ATA_PIIX.)

To get the CD/DVD drive properly configured, one hack was required before building the kernel: in include/linux/libata.h in the kernel tree, I replaced the lines:

#undef ATA_ENABLE_ATAPI         /* define to enable ATAPI support */
#undef ATA_ENABLE_PATA          /* define to enable PATA support in some
                                 * low-level drivers */


#define ATA_ENABLE_ATAPI        /* define to enable ATAPI support */
#define ATA_ENABLE_PATA         /* define to enable PATA support in some
                                 * low-level drivers */

The relevant lines occur near the top of the file. I'm not sure that the second #define is needed, but the first, ATA_ENABLE_ATAPI, is required to get decent performance when playing DVDs.

Update for Linux 2.6.14: The enabling of ATAPI support in libata has been moved since 2.6.13. There's no symbol ATA_ENABLE_ATAPI, but there's a module parameter, atapi_enabled (default value 0, optional value 1). Here's an extract from ChangeLog-2.6.14:

    ATAPI is getting close to being ready.  To increase exposure, we enable
    the code in the upstream kernel, but default it to off (present
    behavior).  Users must pass atapi_enabled=1 as a module option (if
    module) or on the kernel command line (if built in) to turn on
    discovery of their ATAPI devices.

So far as I can tell, however, the mechanism of setting atapi_enabled=1 on the kernel command line is broken or non-existent. My CD-ROM was not detected: I had to edit drivers/scsi/libata-core.c in the Linux source tree and change int atapi_enabled = 0 to int atapi_enabled = 1.

If I don't enable ATAPI under ATA -- and, correspondingly, I enable IDE support and treat the CD drive as an IDE device at /dev/hdc -- I get miserable results, with tons of dropped frames, when trying to play DVDs. This seems to be an "issue" with the current 2.6 Linux kernel. Support for ATAPI (read, CDs) under libata is officially "not ready yet" (see the undefs above) but if you use the driver that is officially sanctioned, you get horrible results.

My /etc/fstab looks like this, in part:

/dev/sda3       /       ext3    defaults   1   1
/dev/sda2       none    swap    sw 
/dev/sda1       /mnt/dosc       ntfs    noauto,users,ro,umask=0000     0   0
/dev/sr0        /mnt/cdrom      iso9660 noauto,users    0       0

And in /etc/udev/rules.d/10-local.rules I have:

BUS="scsi", KERNEL="sr0", NAME="%k", SYMLINK="cdrom dvd"

Main R52 page