13.1 IDE

Integrated Drive Electronics (IDE), formally called the AT Attachment (ATA) interface, is the means used by most computers to interface hard disks and other drives to the computer. Early hard disk interfaces used a separate hard disk and controller card, which limited throughput. In 1986, Compaq and Western Digital combined the hard disk and controller card into one unit, thereby inventing IDE. Early IDE drives used an expansion card called a paddle card, but this card was not really a disk controller. It simply provided an interface between the bus and the embedded disk controller on the hard drive itself. All modern systems have IDE interfaces embedded on the motherboard.

You may or may not need to understand much about IDE to install and configure a hard drive, depending on how old your hardware is. The most recent drives, motherboards, and BIOSs handle the hard parts for you, automatically detecting and configuring the drive, interface, and BIOS for optimum performance. So, if all you're doing is installing a new IDE hard drive in a recent PC, you can safely skip this entire section.

If, however, you're upgrading an older system with a new drive, installing an older drive in a new system, or installing an additional drive in a system more than a couple of years old, keep reading. If any of the components is more than a few years old, you need to understand quite a bit about IDE, not just to configure the PC for optimum performance, but also to ensure that your data is not corrupted by running data transfer rates higher than your hardware can safely support. Understanding the fundamentals of IDE also helps you make good decisions when you purchase drives, system boards, and add-on IDE interface cards.

13.1.1 IDE/ATA Standards and Implementations

Although IDE was originally proprietary, the cost and performance advantages of IDE quickly made it the standard hard disk interface. By 1990, most computer systems came with IDE hard disks. A slew of acronyms and standards has arisen as IDE proliferates, some meaningful and many that are just marketing hype. The formal ATA standards are maintained by Technical Committee T13 of the National Committee on Information Technology Standards (NCITS), and may be viewed at http://www.t13.org. These standards include:

ATA-1

The original IDE specification, ATA defines a standard 40-pin interface that supports two hard disk devices on one cable. ATA-1, adopted as T13 0791M and ANSI X3.221-1994, was withdrawn as a standard in 1999.

ATAPI (ATA Packet Interface)

The first ATA standard supported only hard disks. Manufacturers soon realized that the ubiquity, high performance, and low cost of the IDE interface also made it ideal for nondisk devices such as CD-ROM and tape drives. The ATAPI standard was developed to allow these nondisk devices to be connected to a standard ATA port. ATAPI hardware connects to and works with any standard IDE or EIDE port (explained later in this section). Note that, although ATAPI devices connect to ATA ports, they are not ATA devices, and differ significantly from an ATA hard drive. This is not a problem with most motherboard IDE ports and IDE interface cards, but caching controllers and other intelligent interfaces must be explicitly ATAPI-compliant to support ATAPI devices.

ATA-2

Advances in hard disk technology soon made it clear that the original ATA standard was too confining. Since the original standard was completed, several developments made it desirable to produce an updated version of the specification. That updated specification, ATA-2, adds faster PIO and DMA modes, improves Plug-and-Play support, and adds Logical Block Addressing (LBA). ATA-2, adopted as T13 0948D and ANSI X3.279-1996, was withdrawn as a standard in 2001.

ATA-3

Provided several minor improvements to the ATA-2 standard, including enhanced reliability, especially for PIO-4, better power management, and the incorporation of Self Monitoring Analysis and Reporting Technology (SMART), which allows the drive to warn the operating system of impending problems. ATA-3 did not add any PIO or DMA modes faster than those defined in ATA-2. ATA-3 is officially known as T13 2008D AT Attachment-3 Interface and ANSI X3.298-1997 AT Attachment-3 Interface.

ATA/ATAPI-4

Merges ATA-3 and ATAPI into a single integrated book-length standard and formalizes Ultra DMA 33 as a part of that standard. ATA-4 is officially known as T13 1153D AT Attachment-4 with Packet Interface Extension and ANSI NCITS 317-1998 AT Attachment-4 with Packet Interface Extension.

ATA/ATAPI-5

The current standard. ATA/ATAPI-5 formalizes Ultra DMA 66, but otherwise makes only relatively minor enhancements to ATA/ATAPI-4. ATA-5 is officially known as T13 1321D AT Attachment-5 with Packet Interface and ANSI NCITS 340-2000 AT Attachment-5 with Packet Interface.

ATA/ATAPI-6

The forthcoming ATA/ATAPI standard, which is already implemented in practice by drive makers. ATA/ATAPI-6 formalizes Ultra DMA 100 and 48-bit LBA, which expands the maximum disk size possible under ATA from 128 GB to 128 PB (i.e., a binary million times larger), but otherwise makes only relatively minor enhancements to ATA/ATAPI-5. As of July 2003, ATA-6 is still in development and is officially known as T13 1410D AT Attachment-6 with Packet Interface.

ATA/ATAPI-7

The next and likely final ATA/ATAPI standard, before SATA supersedes ATA/ATAPI. ATA/ATAPI-7 is expected to formalize Ultra DMA 133, but otherwise make only relatively minor enhancements to ATA/ATAPI-6. As with ATA/ATAPI-6, drive makers will incorporate the important parts of ATA/ATAPI-7 before it is formally standardized. As of July 2003, ATA/ATAPI-7 is still in development and is officially known as T13 1532D AT Attachment-7 with Packet Interface.

Although these formal standards define the ATA interface, the hard drives and interfaces you can actually buy are marketed using the following ad hoc standards:

Enhanced IDE (EIDE)

A Western Digital IDE implementation that incorporates and extends the ATA-2 and ATAPI standards. EIDE supports: two devices each on primary and secondary ATA interfaces, for a total of four devices; fast transfer modes (PIO-3 or better and multiword DMA-1 or better); Logical Block Addressing (LBA) mode; and connecting ATAPI devices such as CD-ROM and tape drives to the ATA interface. EIDE includes the Western Digital Enhanced BIOS, which eliminates the 504/528 MB limitation under DOS. Recent Western Digital hard drives and EIDE interfaces support some or all of the ATA/ATAPI-4 and proposed ATA/ATAPI-5 standards, including Ultra-DMA/16 and /33 (UDMA modes 0 and 1) and Ultra-DMA/66 modes 2, 3, and 4.

Fast ATA

A Seagate IDE implementation, later endorsed by Quantum, that counters the Western Digital EIDE initiative. Fast ATA and Fast ATA-2 are based on ATA and ATA-2, but not on ATAPI. Fast ATA supports: fast transfer modes (PIO-3 and multiword DMA-1); LBA mode; and Read/Write Multiple commands, also called Block Mode. Fast ATA-2 adds support for PIO-4 and multiword DMA-2. Recent Fast-ATA hard drives support Ultra ATA-33, -66, and -100.

Ultra ATA

An extension to ATA-2, first proposed by Quantum and Intel, and now a part of the ATA/ATAPI-4 standard (as Ultra ATA-33 for UDMA modes 0 and 1), the ATA/ATAPI-5 standard (as Ultra ATA-66 for UDMA modes 2, 3, and 4), the proposed ATA/ATAPI-6 standard (as Ultra ATA-100 for UDMA mode 5), and the proposed ATA/ATAPI-7 standard (as Ultra ATA-133 for UDMA mode 6). Ultra-ATA enhances the earlier SDMA and MDMA modes by adding CRC error detection to prevent data corruption during fast DMA transfers.

To benefit from the increased data transfer rates provided by Ultra-DMA, the drive, the BIOS, the ATA interface, and the operating system must all support it. By late 1997 some PCs and motherboards included embedded Ultra ATA-33 support. Ultra ATA-66 drives and interfaces began shipping in early 1999. ATA-100 drives and interfaces first appeared in early 2001, and soon became standard on new systems and motherboards. ATA-133, championed by Maxtor, is unlikely to achieve critical mass. Only Maxtor makes ATA-133 drives, and Intel seems likely to transition its chipsets and motherboards directly from ATA-100 to SATA. It's easy to upgrade older systems to Ultra ATA simply by adding an inexpensive IDE interface card, such as those made by Promise, SIIG, and others.

13.1.2 IDE/ATA Data Transfer Modes

To understand ATA data transfer modes, it's necessary to understand something about how data is read from and written to the hard drive. Real-mode operating systems such as 16-bit Windows and DOS make read and write requests to the BIOS, which passes the command to the drive. Protected-mode operating systems such as Windows NT/2000/XP and Linux bypass the real-mode BIOS and use their own protected-mode I/O subsystems to accomplish the same purpose.

Data transfer commands are controlled by the BIOS or I/O subsystem, but execution speed?and therefore data transfer rate?is determined by the strobe frequency of the ATA interface hardware. The time needed to complete one full cycle, measured in nanoseconds (ns), is called the cycle time for the interface. A shorter cycle time allows more cycles to be completed in a given period, and therefore provides a higher data transfer rate. For example, a 600 ns cycle time yields 1.66 million cycles/second. Because each cycle transfers one word (16 bits or two bytes), a 600 ns cycle time translates to a data transfer rate of 3.33 MB/s.

ATA supports two data transfer modes, called Programmed Input/Output (PIO) mode and Direct Memory Access (DMA) mode. Both of these have several submodes that use different cycle times and have different data transfer rates. When an ATA interface interrogates a modern drive with the Identify Drive command, the drive returns its model, geometry, and a list of the PIO and DMA modes it supports, allowing the interface, given proper BIOS support, to automatically configure the best settings for optimum drive performance. With an older drive, an older BIOS, or both, it's up to you to configure these settings yourself, so it's important to understand what they mean to avoid either crippling drive performance by choosing too slow a mode or risking your data by choosing one that's too fast for your hardware.

Your operating system also determines whether an ATA hard disk is configured automatically for optimal performance. Windows 98/2000/XP and Linux (usually) detect DMA-capable interfaces and drives and configure them automatically to operate in the more efficient DMA mode. Windows 95 and Windows NT 4 use the less-efficient PIO mode by default, and must be configured manually to use DMA mode on hardware that supports it. Configuring DMA mode on ATA drives is described in Chapter 14.

13.1.2.1 Programmed Input/Output (PIO) Modes

PIO is a means of data transfer that requires the CPU to intermediate data exchanges between the drive and memory. This dependence on the CPU places unnecessary demands on it and slows CPU performance under multitasking operating systems. Accordingly, modern drives and interfaces substitute DMA modes, described later, to provide high-speed data transfer. PIO modes remain important, however, when connecting older drives to newer interfaces or vice versa. Table 13-1 lists PIO modes, not all of which are supported by all drives and all interfaces.

Table 13-1. ATA PIO modes

PIO mode

Cycle time

Transfer rate

Revision

PIO-0

600 ns

3.3 MB/s

ATA

PIO-1

383 ns

5.2 MB/s

ATA

PIO-2

330 ns

8.3 MB/s

ATA

PIO-3

180 ns

11.1 MB/s

ATA-2

PIO-4

120 ns

13.3 MB/s

ATA-2

PIO-5

90 ns

22.2 MB/s

Never implemented

PIO Modes 0, 1, and 2 are not used on recent systems except to support older drives. Using PIO Mode 3 or 4 provides reasonably fast transfer rates, but requires that the drive support the IORDY line for hardware flow control. If the interface delivers data faster than a PIO Mode 3 or 4 drive can accept it, the drive de-asserts IORDY to notify the interface to stop delivering data. Running a drive that does not support IORDY on an interface configured for PIO Mode 3 or 4 may appear to work, but risks corrupting data. If you are not certain that your drive supports PIO Mode 3 or 4, configure the interface to use PIO Mode 2.

13.1.2.2 Direct Memory Access (DMA) Modes

DMA is a data transfer mode that allows bidirectional transfer of data between drives and memory without intervention from the processor. If you use a multitasking operating system such as 32-bit Windows or Linux, using DMA mode increases performance by freeing the CPU to do other things while data is being transferred. DMA doesn't improve performance with single-tasking operating systems such as DOS or 16-bit Windows because the processor must wait until the transfer is complete before doing anything else. Table 13-2 lists DMA modes, not all of which are supported by all drives and all interfaces. Note that ATA-3 introduced no new modes.

Table 13-2. ATA DMA modes

DMA mode

Cycle time

Transfer rate

revision

Single Word Mode 0 (SDMA-0)

960 ns

2.1 MB/s

ATA

Single Word Mode 1 (SDMA-1)

480 ns

4.2 MB/s

ATA

Single Word Mode 2 (SDMA-2)

240 ns

8.3 MB/s

ATA

Multiword Mode 0 (MDMA-0)

480 ns

4.2 MB/s

ATA

Multiword Mode 1 (MDMA-1)

150 ns

13.3 MB/s

ATA-2

Multiword Mode 2 (MDMA-2)

120 ns

16.6 MB/s

ATA-2

Ultra-DMA Mode 0 (UDMA-0)

240 ns

16.6 MB/s

ATA-4

Ultra-DMA Mode 1 (UDMA-1)

160 ns

25.0 MB/s

ATA-4

Ultra-DMA Mode 2 (UDMA-2)

120 ns

33.3 MB/s

ATA-4

Ultra-DMA Mode 3 (UDMA-3)

90 ns

44.4 MB/s

ATA-5

Ultra-DMA Mode 4 (UDMA-4)

60 ns

66.7 MB/s

ATA-5

Ultra-DMA Mode 5 (UDMA-5)

40 ns

100.0 MB/s

ATA-6

Ultra-DMA Mode 6 (UDMA-6)

30 ns

133.3 MB/s

ATA-6/7

The SDMA modes were obsoleted by ATA-3, and are useful only for older drives and interfaces. MDMA modes provide reasonable transfer rates, and are useful for drive/interface configurations that are ATA-2 compliant, but where the drive and/or interface is not Ultra-ATA compliant. Using UDMA modes requires that the drive, interface, BIOS, and operating system be Ultra-ATA compliant. MDMA-2 and UDMA-0 provide identical transfer rates, but MDMA-2 does not use hardware flow control, while UDMA-0 uses CRC error detection to prevent data corruption.

Hardware that supports UDMA Modes 3 and 4, also called UDMA/66, began shipping in early 1999, and had become standard for new systems, motherboards, and hard drives by mid-2000. UDMA/100, also called Ultra ATA-100 or simply ATA-100, is an extension of UDMA/66 developed by Maxtor Corporation and since licensed by other drive makers. ATA-100 components began shipping in volume in early 2001, and are now standard.

ATA-100 provides 100 MB/s throughput for reads, but only 88 MB/s throughput for writes. ATA-100 uses the same 80-wire, 40-pin ATA cable as UDMA/66, which is sufficient to reduce reflections, noise, and inductive coupling to the level required by ATA-100, but reduces signaling voltages to 3.3V from the 5.0V used by all previous ATA standards. Installing a UDMA/66 or /100 drive on an older system requires adding a UDMA/66 or /100 interface card and using a special 80-wire, 40-pin ATA cable.

Ultra ATA-133, also called FastDrive/133, is another Maxtor initiative that has not been widely adopted by other manufacturers. It uses the same 80-wire, 40-pin cable as ATA-66 and ATA-100, and ATA-133 drives and interfaces are backward-compatible with earlier standards.

ATA-133 is a solution in search of a problem. As of July 2003, no ATA hard drive can saturate an ATA-100 interface. Even if that were possible, the ATA data would occupy the entire bandwidth of the PCI bus. Only one device on an ATA channel can be active at a time, which means that PATA will be replaced entirely by SATA before hard drives can saturate an ATA-100 interface. Contrast this with SCSI, which does allow multiple devices to use the channel simultaneously. The fastest SCSI hard drives exceed 60 MB/s throughput, which means that three drives on a channel can saturate even an Ultra160 SCSI interface. Our opinion is that ATA-100 will suffice for desktop systems until SATA replaces PATA, so we consider ATA-133 to be a marketing gimmick rather than a useful technology.

There are two ways to implement DMA. First-party DMA, also called bus-mastering DMA, uses a DMA controller embedded in the device itself to arbitrate possession of the bus and data transfer. Third-party DMA instead depends on the DMA controller that resides on the motherboard. If the motherboard is of recent vintage, either first-party or third-party DMA can be used for high-speed DMA transfer modes.

13.1.3 ATA Multichannel Support

The original ATA specification defined one dual-channel ATA interface that supported one or two ATA devices. ATA-2 defines a second interface, with the primary interface using standard ATA IRQ and base address, and the secondary interface using the alternate IRQ and base address that had always been set aside for that purpose. Any modern motherboard or interface card provides dual-ported ATA support.

Windows 9X/NT/2000/XP and Linux recognize and use the secondary interface automatically. DOS and 16-bit Windows are not dual-port ATA-aware, so installing more than two ATA drives with these operating systems requires either BIOS support for the secondary port or supplemental drivers. If BIOS Setup allows you to enter drive parameters for four drives, you already have the BIOS support you need. If BIOS Setup lists only two drives, you must (in order of desirability) install an updated system BIOS or use a dual-ported bus-mastering ATA adapter with an onboard dual-port BIOS or install dual-port device drivers.

In addition to the well-standardized primary and secondary ATA interfaces, some devices support semistandard tertiary and quaternary ATA interfaces. In theory, at least, you can support up to eight ATA devices on one computer by adding a dual-ported interface card that can be configured as tertiary/quaternary to a system that includes a standard dual-ported ATA interface, assuming that you have the four IRQs needed to support all four ports. We have not seen a BIOS that includes direct support for ATA Ports 3 and 4, although the current Phoenix BIOS specification allows ATA ports beyond 1 and 2 to be defined arbitrarily. Table 13-3 lists the IRQs and base addresses for ATA Ports 1 through 4.

Table 13-3. ATA port IRQ and base address assignments

ATA port

IRQ

Hex base addresses (Channel 0 / Channel 1)

Primary

14

0x1F0 - 0x1F7 and 0x3F6 - 0x3F7

Secondary

15 or 10

0x170 - 0x177 and 0x376 - 0x377

Tertiary

12 or 11

0x1E8 - 0x1EF and 0x3EE - 0x3EF

Quaternary

10 or 9

0x168 - 0x16F and 0x36E - 0x36F

13.1.4 The ATA Interface

Table 13-4 lists the pins and signal names for the ATA interface. Signal names that end with # are active-low. Signal names contained in square brackets are specific to the secondary ATA interface.

Table 13-4. ATA interface pinout and signal definitions

Pin

Signal

 

Pin

Signal

1

Reset IDE

 

2

Ground

3

Data 7

 

4

Data 8

5

Data 6

 

6

Data 9

7

Data 5

 

8

Data 10

9

Data 4

 

10

Data 11

11

Data 3

 

12

Data 12

13

Data 2

 

14

Data 13

15

Data 1

 

16

Data 14

17

Data 0

 

18

Data 15

19

Ground

 

20

Key (no pin)

21

DDRQ0 [DDRQ1]

 

22

Ground

23

I/O Write#

 

24

Ground

25

I/O Read#

 

26

Ground

27

IOCHRDY

 

28

P_ALE (CSEL pull-up)

29

DDACK0# [DDACK1#]

 

30

Ground

31

IRQ 14 [IRQ 15]

 

32

(reserved)

33

DAG1 (Address 1)

 

34

GPIO_DMA66_Detect_Pri [GPIO_DMA66_Detect_Sec]

35

DAG0 (Address 0)

 

36

DAG2 (Address 2)

37

Chip Select 1P# [Chip Select 1S#]

 

38

Chip Select 3P# [Chip Select 3S#]

39

Activity#

 

40

Ground

41

+5VDC (logic)

 

42

+5VDC (motor)

43

Ground

 

44

-TYPE (0=ATA)

The standard ATA interface used in desktop systems uses only pins 1 through 40. Pins 41 through 44 are implemented only in notebook ATA interfaces, for use with 2.5-inch and smaller drives. The additional four pins provide power and ground to the drives, which are not large enough to accept a standard power connector.

ATA interfaces are enabled or disabled in BIOS Setup. Disabling an unused interface frees the interrupt that would otherwise be used by that interface. If there are no devices connected to the secondary ATA interface, disable it in BIOS. If you are running an all-SCSI system, disable both the primary and secondary ATA interfaces. Conversely, if you install an ATA/ATAPI device as the first device on the secondary interface and find that it is not recognized, check BIOS Setup to verify that the interface is enabled. Although most recent systems automatically detect and configure PIO mode versus DMA mode, some systems require you to specify PIO mode versus DMA mode for each interface in Setup.

13.1.5 Configuring ATA Devices

Each ATA interface (often called a channel) can have zero, one, or two ATA and/or ATAPI devices connected to it. Every ATA and ATAPI device has an embedded controller, but ATA permits only one active controller per interface. Therefore, if only one device is attached to an interface, that device must have its embedded controller enabled. If two devices are attached to an ATA interface, one device must have its controller enabled and the other must have its controller disabled.

In ATA terminology, a device whose controller is enabled is called a Master; one whose controller is disabled is called a Slave. In a standard PC with two ATA interfaces, a device may therefore be configured in any one of four ways: Primary Master, Primary Slave, Secondary Master, or Secondary Slave.

13.1.5.1 Assigning masters and slaves

ATA/ATAPI devices are assigned as Master or Slave by setting jumpers on the device. ATA devices have the following jumper selections:

Master

Connecting a jumper in the Master position enables the onboard controller. All ATA and ATAPI devices have this option. Select this jumper position if this is the only device connected to the interface, or if it is the first of two devices connected to the interface.

Slave

Connecting a jumper in the Slave position disables the onboard controller. (One of our technical reviewers notes that he has taken advantage of this to retrieve data from a hard drive whose controller had failed, a very useful thing to keep in mind.) All ATA and ATAPI devices can be set as Slave. Select this jumper position if this is the second device connected to an interface that already has a Master device connected.

When you jumper a device as Master or Slave, it assumes that role regardless of which position it connects to on the ATA cable. For example, if you jumper a device as Master, it functions as Master regardless of whether you connect it to the drive connector at the end of the ATA cable or the drive connector in the middle of the ATA cable.

Cable Select

All recent ATA/ATAPI devices have a third jumper position labeled Cable Select, CS, or CSEL. Connecting a jumper in the CSEL position instructs the device to configure itself as Master or Slave based on its position on the ATA cable. When you use CSEL, the device connected nearest the ATA interface is always configured as Master and the device on the end of the cable is always configured as Slave. CSEL has long been a part of the ATA Plug-and-Play standard and was first formalized in the Intel/Microsoft PC97 standard, but was little used until recently. If the CSEL jumper is connected, no other jumpers may be connected. For more information about CSEL, see the following section.

Sole/Only

When functioning as Master, a few older ATA/ATAPI devices need to know whether they are the only device on the channel, or if a Slave device is also connected. Such devices may have an additional jumper position labeled Sole or Only. For such devices, jumper as Master if it is the first of two devices on the interface, Slave if it is the second of two devices on the interface, and Sole/Only if it is the only device connected to the interface.

Slave Present

A few older drives have a jumper designated Slave Present, or SP. This jumper performs the inverse function of the Sole/Only jumper, by notifying a device jumpered as Master that there is also a Slave device on the channel. For such devices, jumper as Master if it is the only device on the interface, or Slave if it is the second of two devices on the interface. If it is the Master on a channel that also has a Slave installed, connect both the Master and Slave Present jumpers.

13.1.5.2 Using Cable Select

All recent ATA/ATAPI drives provide a Cable Select (CS or CSEL) jumper in addition to the standard Master/Slave jumpers. If you jumper a drive as Master (or Slave), that drive functions as Master (or Slave) regardless of which connector it is attached to on the ATA cable. If you jumper a drive as CSEL, the position of the drive on the cable determines whether the drive functions as a Master or a Slave.

CSEL was introduced in the ATA-2 and ATA-3 specifications as a means to simplify ATA configuration. The goal was that eventually all ATA/ATAPI devices would be configured to use CSEL. That would mean that drives could simply be installed and removed without changing jumpers, with no possibility of conflict due to improper jumper settings. Although CSEL has been around for years, it has only recently become popular with system makers. If you work on a PC built in the last year or two, you may encounter CSEL, so it's good to be aware of it.

Using CSEL requires the following:

  • If one drive is installed on the interface, that drive must support and be configured to use CSEL. If two drives are installed, both must support and be configured to use CSEL.

  • The ATA interface must support CSEL. For this to be true, the ATA interface must ground Pin 28. On many older ATA interfaces, Pin 28 is open or high, and so cannot be used for CSEL. If Pin 28 is not grounded on the interface, any drive configured as CSEL that connects to that interface is configured as Slave.

  • The ATA cable must be a special CSEL cable. Unfortunately, there are three types of CSEL cable:

    • A 40-wire CSEL cable differs from a standard 40-wire ATA cable in that Pin 28 is connected only between the ATA interface and the first drive position on the cable (the middle connector). Pin 28 is not connected between the interface and the second drive position (the end connector on the cable). With such a cable, the drive attached to the middle connector (with Pin 28 connected) is Master; the drive attached to the connector furthest from the interface (with Pin 28 not connected) is Slave.

    • All 80-wire (Ultra DMA) ATA cables support CSEL, but with exactly the opposite orientation of the 40-wire standard CSEL cable. With such a cable, the drive attached to the middle connector (with Pin 28 not connected) is Slave; the drive attached to the connector furthest from the interface (with Pin 28 connected) is Master. This is actually a better arrangement, if a bit nonintuitive?how can a wire be connected to the end connector but not to the one in the middle??because the standard 40-wire CSEL cable puts the Master drive on the middle connector. If only one drive is installed on that cable, that leaves a long "stub" of cable hanging free with nothing connected to it. Electrically, that's a very poor idea because an unterminated cable allows standing waves to form, increasing noise on the line and impairing data integrity.

    • A 40-wire CSEL Y-cable puts the interface connector in the middle with a drive connector on each end, one labeled Master and one Slave. Although this is a good idea in theory, in practice it seldom works. The problem is that IDE cable length limits still apply, which means that the drive connectors don't have enough cable to get to the drives in all but the smallest cases. If you have a tower, you can forget it.

40-wire CSEL cables are supposed to be clearly labeled, but we have found that this is often not the case. It is not possible to identify such cables visually, although you can verify the type using a DVM or continuity tester between the two end connectors on Pin 28. If there is continuity, you have a standard ATA cable. If not, you have a CSEL cable.

Keep unlabeled 40-wire CSEL cables segregated from standard cables. If you substitute a CSEL cable for a standard cable, drives that are jumpered as Master or Slave function properly. If you substitute a standard cable for a CSEL cable and connect one drive jumpered CSEL to that cable, it will function properly as Master. But if you connect two CSEL drives to a standard cable, both function as Master, which may result in anything from subtle problems to (more likely) the system being unable to access either drive.

13.1.5.3 Master/Slave guidelines

When deciding how to allocate devices between two interfaces and choose Master versus Slave status for each, use the following guidelines:

  • Always assign the main hard drive as Primary Master. Particularly if your hard drive supports fast DMA modes (ATA-66 or ATA-100), do not connect another device to the primary ATA interface unless both positions on the secondary interface are occupied.

  • ATA forbids simultaneous I/O on an interface, which means that only one device can be active at a time. If one device is reading or writing, the other device cannot read or write until the active device yields the channel. The implication of this is that if you have two devices that need to perform simultaneous I/O?e.g., a CD writer that you use to duplicate CDs from a CD-ROM drive?you should place those two devices on separate interfaces.

  • If you are connecting an ATA device (a hard drive) and an ATAPI device (e.g., an optical drive or a tape drive) to the same interface, set the hard drive as Master and the ATAPI device as Slave.

  • If you are connecting two similar devices (ATA or ATAPI) to an interface, it generally doesn't matter which device is Master and which Slave. There are exceptions to this, however, particularly with ATAPI devices, some of which really want to be Master (or Slave) depending on which other ATAPI device is connected to the channel.

  • If you are connecting an older device and a newer device to the same ATA interface, it's generally better to configure the newer device as Master because it is likely to have a more capable controller than the older device.

  • Try to avoid sharing one interface between a DMA-capable device and a PIO-only device. If both devices on an interface are DMA-capable, both use DMA. If only one device is DMA-capable, both devices are forced to use PIO, which reduces performance and increases CPU utilization dramatically. Similarly, if both devices are DMA-capable, but at different levels, the more capable device is forced to use the slower DMA mode.

13.1.6 ATA Cables

All desktop ATA cables have three 40-pin connectors, one that connects to the ATA interface and two that connect to ATA/ATAPI drives. All standards-compliant ATA cables?there are many that do not comply?share the following characteristics:

  • An ATA cable must be at least 10 inches (0.254m) long, and no longer than 18 inches (0.457m).

  • The center-to-center distance between one end connector and the middle connector must be 5 inches (0.127m) minimum to 12 inches (0.304m) maximum. The distance between the center connector and the other end connector must be 5 inches minimum to 6 inches (0.152m) maximum.

  • Pin 1 is indicated by a colored stripe on the cable (usually a red stripe on a gray cable).

  • ATA cables are keyed, either by blocking Pin 20, by using a keyed shroud, or both.

ATA cables come in three varieties:

Standard

A standard ATA cable uses a 40-wire ribbon cable and 40-pin connectors in all three positions. All 40 conductors connect to all three connectors. The only real variation, other than cable quality, is the positioning of the three connectors. A standard ATA cable requires using Master/Slave jumpering for connected devices. All connectors on a standard ATA cable are interchangeable, which is to say that any drive may be connected to any position, and the interface itself may be connected to any position, including the center connector. A standard ATA cable may be used with any ATA/ATAPI device through ATA-33. If a standard ATA cable is used to connect ATA-66/100 devices, those devices will function properly, but will fall back to operating at ATA-33.

Standard/CSEL

A standard/CSEL ATA cable is identical to a standard ATA cable except that Pin 28 is not connected between the middle drive connector and the end drive connector. A standard/CSEL ATA cable supports either Master/Slave jumpering or CSEL jumpering for connected devices. Connector position is significant on a standard/CSEL cable. The interface connector on a CSEL cable is either labeled or a different color than the drive connectors. The center connector is for the Master device, and the end connector opposite the interface connector is for the Slave device.

Ultra DMA (80-wire)

An Ultra DMA cable uses an 80-wire ribbon cable and 40-pin connectors in all three positions. The additional 40 wires are dedicated ground wires, each assigned to one of the standard 40 ATA pins. An Ultra DMA cable may be used with any ATA/ATAPI device?and should be for more reliable functioning?but is required for full performance with ATA-66 and ATA-100 devices. All Ultra DMA cables are CSEL cables, and may be used either with drives jumpered CSEL or those jumpered Master/Slave.

The following points about Ultra DMA cables are worth being aware of:

  • The Ultra DMA cable was first defined for UDMA Modes 0 through 2, for transfer speeds up to 33 MB/s, but is optional for those modes. For UDMA Mode 3 and higher, the Ultra DMA cable is required.

  • All Ultra DMA cables have Pin 28 wired to support CSEL mode, and so can be used to connect drives that use either CSEL or Master/Slave jumpering.

  • Color-coded connectors were not specified for earlier ATA cables. The Ultra DMA cable specification requires the following connector colors:

    Blue

    One end connector is blue, which indicates that it attaches to the ATA interface.

    Black

    The opposite end connector is black, and is used to attach the Master drive (Device 0), or a single drive if only one is attached to the cable. If CSEL is used, the black connector configures the drive as Master. If standard Master/Slave jumpering is used, the Master drive must still be attached to the black connector. This is true because ATA-66, ATA-100, and ATA-133 do not allow a single drive to be connected to the middle connector, which results in standing waves that interfere with data communication.

    Gray

    The middle connector is gray, and is used to attach the Slave drive (Device 1), if present.

    Note the difference between using a 40-wire CSEL cable and an 80-wire cable for CSEL operation. Although all Ultra DMA cables support drives jumpered either Master/Slave or CSEL, that does not mean you can freely substitute an 80-wire cable for a 40-wire cable. If the drives are jumpered Master/Slave, substituting an 80-wire cable works fine. However, if the drives are jumpered CSEL, replacing a 40-wire CSEL cable with an 80-wire cable causes the drives to exchange settings. That is, the drive that was Master on the 40-wire cable becomes Slave on the 80-wire cable, and vice versa.

  • Because an Ultra DMA cable is required for ATA-66, ATA-100, or ATA-133 operation, the system must have a way to detect if such a cable is installed. This is done by grounding Pin 34 in the Blue connector, which attaches to the interface. Pin 34 carries the GPIO_DMA66_Detect_Pri signal (primary interface) or the GPIO_DMA66_Detect_Sec signal (secondary interface). These signals are also referred to as /PDIAG:/CBLID. Because 40-wire ATA cables do not ground Pin 34, the system can detect at boot whether a 40-wire or 80-wire cable is installed. In some Ultra ATA cables, the grounding is done internally and is therefore invisible. In others, the signal conductor for Pin 34 is cut in the cable, as shown in Figure 13-1. Figure 13-2 shows a 40-wire standard ATA cable and an 80-wire UltraATA cable side by side for comparison. Note that the 80-wire cable uses a gray end connector, and so is not standards-compliant.

    Figure 13-1. An Ultra DMA cable, showing Pin 34 cut
    figs/pcn3_1301.gif
    Figure 13-2. Standard 40-wire ATA cable (left) and Ultra DMA 80-wire cable
    figs/pcn3_1302.gif

13.1.7 Compatibility Between Old and New IDE Devices

With only minor exceptions, there are no compatibility issues when using new ATA devices with old ATA interfaces or vice versa. Newer drives cannot yield their highest performance when connected to an ATA interface that does not support the fastest transfer modes the drive is capable of, just as a new interface can't improve the performance of an older drive. But you can connect any ATA drive to any ATA interface with reasonable assurance that it will function, although perhaps not optimally.

Nearly all modern ATA interfaces?including the ubiquitous Intel PIIX3 and PIIX4?support independent timing for Master and Slave devices. This means that you can safely put an old, slow ATA or ATAPI device on the same cable as a new, fast hard drive without concern that the older device will cripple the throughput of the newer one.

Note that independent timing does not mean that you should mix DMA and PIO devices on the same interface. If an interface has one PIO-mode device connected, the other device must also run PIO. Also, independent timing does not mean that an interface supports multiple DMA modes simultaneously. For example, if you connect an ATA-66 drive and an ATA-33 drive to the same interface, both run as ATA-33 devices.

13.1.8 IDE Capacity Limits

Various IDE capacity limits exist, which depend on the BIOS, interface hardware, operating system, and other factors. There's a lot of information and misinformation about these limits, so it's worth getting the facts straight before you accept unnecessary limitations. Most of these limits are a result of interactions between the methods that the BIOS and the ATA interface use to address sectors on a hard disk. Even the oldest BIOS or ATA interface can address large hard disks. In combination, however, interactions between the BIOS and the interface may limit the number of addressable sectors to a fraction of the number either could address alone. Table 13-5 summarizes these limits.

Table 13-5. ATA addressing and BIOS addressing limitations

Maximum addressable

ATA limit

Int13 limit

Shared limit

Cylinders

65,536 (216)

1,024 (210)

1,024

Heads

16 (24)

256 (28)

16

Sectors per track

255 (28 - 1)

63 (26 - 1)

63

Disk size (bytes)

136,902,082,560

8,455,716,864

528,482,304

ATA addressing uses four registers that total 28 bits. ATA numbers cylinders starting at 0. The cylinder address is a 16-bit value, divided as a least-significant 8-bit Cylinder Low register and a most-significant 8-bit Cylinder High register, allowing up to 65,536 cylinders to be addressed. Each cylinder has a number of heads, also numbered starting at 0, which are addressed using a 4-bit value stored in the lowest four bits of the Device/Head register, allowing up to 16 heads to be addressed. Sectors are numbered starting at 1, and are addressed using an 8-bit value stored in the Sector Number register, allowing up to 255 sectors to be addressed. These capacities mean that ATA can address up to (65,536 x 16 x 255) 512-byte sectors, which equals 136,902,082,560 bytes.

BIOS Int13 API addressing uses three registers that total 24 bits. Cylinder Low is an 8-bit register that stores the least-significant eight bits of the 10-bit cylinder address. Cylinder High/Sector Number is an 8-bit register whose least-significant two bits store the most-significant two bits of the cylinder address and whose most-significant six bits store the sector number. In conjunction, these addresses allow up to 1,024 cylinders and 63 sectors/track to be addressed. Head Number is an 8-bit register, which allows up to 256 heads to be addressed. These capacities mean that Int13 can address up to (1,024 x 256 x 63) 512-byte sectors, which equals 8,455,716,864 bytes.

The impact of these limits depends entirely on the addressing method used by the BIOS. From the oldest to the newest, here are the methods used by various BIOSs:

Cylinder-Head-Sectors (CHS)

Cylinder-Head-Sectors (CHS) is the access method used by early BIOSs to address individual sectors on a hard disk by identifying them directly by the cylinder, head, and sector where they reside. CHS in an ATA/Int13 environment is subject to the maximum common address register size supported for each element by ATA and Int13 addressing. This means that CHS can address at most 1,024 cylinders, 16 heads, and 63 sectors per track, which results in the 504/528 MB limit.

Extended Cylinder-Head-Sectors (ECHS)

Extended Cylinder-Head-Sectors (ECHS) is the most popular of several access methods (others being Large and Big IDE) used by so-called enhanced or translating BIOSs to support hard disks larger than those supported by CHS. ECHS or bit shift translation works by lying about disk geometry, translating an unsupported physical geometry to a supported logical geometry whose address will fit the available registers. For example, ECHS translation may represent a 1 GB drive whose physical geometry is 2,048 cylinders, 16 heads, and 63 sectors per track as having a logical geometry of 1,024 cylinders, 32 heads, and 63 sectors per track, allowing the full 1 GB to be recognized and used. The problem with ECHS translation is that it is nonstandard, and different BIOSs handle it differently.

Logical Block Addressing (LBA)

Logical Block Addressing (LBA) dispenses with CHS addressing entirely, and addresses each sector sequentially. With LBA addressing, all 28 address bits (16+4+8) are used as one LBA address, allowing up to 228 (268,435,456) sectors or 137,438,953,472 bytes to be addressed. Note that, with LBA addressing, sector numbers start at 0. LBA assist translation can be used only with BIOSs and drives that support LBA. With LBA translation, the drive reports its actual geomet