SATA Operating Modes – AHCI vs IDE

What is AHCI?

AHCI stand for Advance Host Controller Interface. AHCI is a hardware mechanism that allows software to communicate with Serial ATA (SATA) devices (such as host bus adapters) that are designed to offer features not offered by Parallel ATA (PATA) controllers, such as hot-plugging and native command queuing (NCQ). The specification details a system memory structure for computer hardware vendors in order to transfer data between system memory and the device.

Many SATA controllers can enable AHCI either separately or in conjunction with RAID support. Intel recommends choosing RAID mode on their motherboards (which also enables AHCI) rather than the plain AHCI/SATA mode for maximum flexibility, due to the issues caused when the mode is switched once an operating system has already been installed.

AHCI is fully supported out of the box for Microsoft Windows Vista and the Linux operating system from kernel 2.6.19. NetBSD also supports drivers in AHCI mode out of the box in certain versions. Older operating systems require drivers written by the host bus adapter vendor in order to support AHCI.

What is IDE?

The first version of what is now called the ATA/ATAPI interface was developed by Western Digital under the name Integrated Drive Electronics (IDE). Together with Control Data Corporation (who manufactured the hard drive part) and Compaq Computer (into whose systems these drives would initially go), they developed the connector, the signaling protocols, and so on with the goal of remaining software compatible with the existing ST-506 hard drive interface. The first such drives appeared in Compaq PCs in 1986.

The term Integrated Drive Electronics refers not just to the connector and interface definition, but also to the fact that the drive controller is integrated into the drive, as opposed to a separate controller on or connected to the motherboard. The interface cards used to connect a parallel ATA drive to, for example, a PCI slot are not drive controllers, they are merely bridges between the host bus and the ATA interface. Since the original ATA interface is essentially just a 16-bitISA bus in disguise, the bridge was especially simple in case of an ATA connector being located on an ISA interface card. The integrated controller presented the drive to the host computer as an array of 512-byte blocks with a relatively simple command interface. This relieved the mainboard and interface cards in the host computer of the chores of stepping the disk head arm, moving the head arm in and out, and so on, as had to be done with earlier ST-506 and ESDI hard drives. All of these low-level details of the mechanical operation of the drive were now handled by the controller on the drive itself. This also eliminated the need to design a single controller that could handle many different types of drives, since the controller could be unique for the drive. The host need only ask for a particular sector, or block, to be read or written, and either accept the data from the drive or send the data to it.

The interface used by these drives was standardized in 1994 as ANSI standard X3.221-1994, AT Attachment Interface for Disk Drives. After later versions of the standard were developed, this became known as “ATA-1”.

A short-lived, seldom-used implementation of ATA was created for the IBM XT and similar machines that used the 8-bit version of the ISA bus. It has been referred to as “XTA” or “XT Attachment”.

Advantage of AHCI

  1. Hot-Plugging (will not cover here as it will not affect computer performance)
  2. Native Command Queuing (might improve computer/system/hard disk responsiveness, espcially in multi-tasking environment

Will it slow down my computer?

Several websites claim, NCQ (one of AHCI component) will cause performance degradation in single threaded benchmark, but other author claim otherwise. Let put our think hat here.

Their claims might correct at certain extent, but it is hard to prove that those single threaded benchmark will reflect real world application. Nowadays, hard disk is the slowest component in any modern PC (except we are using SSD). Antivirus, firewall, anti-spyware, windows update, background defragmentation, indexing (search), user applications (firefox, word, media player) ; all contribute to super multi-tasking, which I believe NCQ (AHCI) will show it advantage. So, in order to have better understanding on how NCQ (AHCI) could improve system responsiveness, let see what is NCQ actually is.

What is NCQ?

In principle, Native Command Queuing is relatively simple. It allows the drive to execute write /read commands that are transmitted randomly in order to optimise the movement of the reading head.

Speed is increased but there is also an impact on power consumption and noise level which is reduced. Of course, applications don’t have to work simultaneously and don’t have to wait for the previous result to send the next command. This of course isn’t always possible. Another possibility in using NCQ is multitasking in the case where you run two very heavy applications simultaneously from the drive point of view.

To better explain this situation, imagine an elevator, in which two people enter simultaneously on the ground floor. The first pushes the 12th floor button and the second the 2nd floor. It would be counterproductive to go to the 12th floor and then to the 2nd floor. The principle of NCQ was already in the ATA norm since 1997 with TCQ (Tagged Command Queuing). This heavier protocol could sometimes lead to significant performance losses in the case of low loads (no or very little command reorganisation to do) and has been integrated in a limited number of controllers. Hitachi supports it on 7K250 drives, like Western and the Raptor WD740GD, while on the chipset side, we can count on NVIDIA but not Intel.

SATA 3.0 Gbits /s defines a new speed of data transmission for the Serial ATA interface. Initially, SATA reached up to 1.5 Gbits /s, which really corresponds to 150 mega-octets per second as 20% of information is dedicated to error correction. The transfer rate is now increased to 300 MB/s but we have to keep in mind that this is the interface speed. It has nothing to do with disc speed alone. At most, cache speed would be affected.

For NCQ to be enabled, it must be supported and turned on in the SATA host bus adapter and in the hard drive itself. The appropriate driver must be loaded into the operating system to enable NCQ on the host bus adapter. Many newer chipsets support the Advanced Host Controller Interface (AHCI), which should allow a generic driver supplied by the operating system to control them and enable NCQ. In fact, newer mainstream Linux kernels support AHCI natively. Unfortunately, Windows XP requires the installation of a vendor-specific driver even if AHCI is present on the host bus adapter. Windows Vista corrects this situation by including a generic AHCI driver.

Common problems switching to AHCI under Windows :

  • Enabling AHCI in a system BIOS will cause a 0x7B Blue Screen of Death STOP error (INACCESSIBLE_BOOT_DEVICE) on installations of Windows XP where AHCI/RAID drivers for that system’s chipset are not installed. Switching to AHCI mode requires installing new drivers before changing the BIOS settings.
  • For Intel chipsets (for example, Intel ICH9) drivers are available from either an OEM board or computer manufacturer. For the Intel versions, the driver must be loaded before loading the OS (by pressing F6 as setup starts).The Intel drivers will work for both XP and Vista. Also, in the case of ICH9, an unsupported method to enable AHCI on ICH9 is available.
  • When attempting to install Microsoft Windows XP or a previous version on an AHCI-enabled system will cause the setup to fail with the error message “set up could not detect hard disk drive…”. This problem can only be corrected by either using a floppy disk with the appropriate drivers, by slipstreaming the appropriate drivers into the Windows XP installation CD or by turning on IDE emulation in the BIOS settings if available (usually called as COMPATABILITY or ACPI).
  • Enabling AHCI in a system BIOS with Windows Vista already installed will result in a BSoD if SATA has been running in IDE mode during Vista’s installation. Before enabling AHCI in the BIOS, users must first follow the instructions found at Microsoft Knowledge Base article 922976.
  • Enabling AHCI in a system BIOS on installations of Windows XP or Windows Vista will cause SATA Optical drives to disappear. A Hotfix for Windows Vista is available under the title: “SATA optical drives are not available after you start a Windows Vista-based computer.” This problem is also fixed in Vista SP1.

Common problems switching to AHCI under Linux :

  • AHCI controller does not work on AMD/ATI RS400-200 and RS480 HBA when MSI is enabled due to a hardware error. In order for AHCI to work users must provide the “pci=nomsi” kernel boot parameter. With MSI disabled in this way, the PCIe bus can only act as a faster PCI bus with hotplug capabilities. This is also true of the Nvidia nForce 560 chipset.
  • AHCI controller on AMD/ATI SB600 HBA can’t do 64-bit DMA transfers. 64-bit addressing is optional in AHCI 1.1 and the chip claims it can do them, but in reality it can’t, so it is disabled. After that it will be forced to do 32-bit DMA transfers. Thus DMA transfers will occur in the lower 4 GiB region of the memory, and bounce buffers must be used sometimes if there is more than 4 GiB of RAM.

Was this blog post helpful for you?

Support my blog and donate!

My blog is open to the public and will always be freely available. With your donation, we can help others learn, together.