6

The Dual-Drive IDE Hell

 2 years ago
source link: https://www.os2museum.com/wp/the-dual-drive-ide-hell/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

The Dual-Drive IDE Hell

I have perhaps inaccurate but very strong memories from my PC-building days (in the early to mid-1990s) that one of the most failure-prone and frustrating endeavors was trying to get two IDE drives working together on a single cable as a master/slave pair, or as Device 0/1 in the language of the ATA Standard.

It’s not that it was fundamentally impossible… but it was insanely random and unpredictable. No one could tell in advance whether any given pair of IDE drives would work. Mixing drive vendors seemed to increase the likelihood of failure, but using two drives from the same vendor was by no means a guarantee of success.

Various jumpers used for configuring IDE hard disks

There were two major reasons for why this was the case:

  • The whole thing started out as a giant hack, pretending that two separate IDE drives are really two drives attached to a single AT style controller.
  • The vast majority of IDE users only ever had one drive, thus not putting enough pressure on IDE vendors to get their act together.

Eventually, by the late 1990s, things did work reasonably well. The key ingredient was cable select and (barely) special cables which allowed all drives to be configured identically and work as either master or slave depending on their cable position. This was not exactly a revolutionary concept; PC floppy drives and ST506 interface hard disks used the same idea, using a twist in the cable, since the early 1980s.

But floppy and ST506 drives were much simpler to deal with: The controller had two (or in theory four) drive select lines to work with, and each drive responded only when selected. In the IDE world, things were much trickier because the two drives had to share the same I/O interface including hardware registers and interrupt lines, and therefore had to carefully cooperate to decide which drive should be responding to register accesses and how.

But it was even more complicated than that. To behave correctly, Device 0 has to act differently depending on whether Device 1 is present; if Device 1 is present, Device 0 has to let it respond to register accesses directed to it, but if there is no Device 1, then Device 0 has to respond to simulate a two-drive controller with no second drive attached.

The worst case is an IDE channel configured with only Device 1, because Device 1 has no way to know whether Device 0 is present, and therefore cannot respond for it. This scenario can be made to work, and it was somewhat common with ATAPI CD-ROMs, but host software has to be prepared to deal with it.

The way dual-drive IDE works is careful coordination between Device 0 and Device 1, hinging on the drive/head register (at I/O port 1F6h for standard primary IDE, 176h for secondary). In brief, both drives respond to register writes, but only the selected drive responds to writes to the command register. For read access and command register writes, only the selected device responds; in addition, Device 0 also responds for Device 1 when it knows there is no Device 1.

This carefully choreographed dance is also why seemingly trivial command overlapping can’t be done with IDE: The host cannot change the selected device while a command is executing (BSY or DRQ bits set in the status register), because this could lead to a situation where both drives believe they are active and both might respond to register reads or both try to deliver data, with predictably unpleasant results.

Configuration

In the early days of IDE, configuration was done solely through jumpers. There were typically three distinct settings, not just two: Master, slave, and single drive. (As an aside, the ATA standards used the Device 0/1 terminology from the beginning, while the drive industry stuck with the master/slave terminology for a very long time.)

The separate master vs. single settings were needed because there was not yet a standardized way for Device 0 to recognize the presence of Device 1, yet Device 0 needed to behave differently depending on whether Device 1 was there or not.

The original ATA standard defined a protocol using the DASP- and PDIAG- signals which allows Device 1 to advertise its presence (DASP-) and report whether its diagnostics passed (PDIAG-). Of course pre-standard drives didn’t necessarily support this protocol.

Many early IDE drives therefore had jumper settings that told the drive configured as Device 0 whether it should expect an ATA-compliant Device 1. This is perhaps one of the best examples of a setting that makes perfect sense to engineers yet is worse than useless to users: They have no way to tell whether a drive they’re trying to connect is ATA-compliant or not.

As a real world example, consider the configuration jumpers on Quantum ProDrive AT disks. These were all drives sold in the early 1990s; not only did Quantum change the jumpers on the drives several times (though not nearly as much as some other vendors), the drive behavior also clearly changed. That resulted in a fairly complex settings matrix just for Quantum’s own drives, with intricate details such as “Use the SS jumper alone only when the PD40/80 firmware EPROM is 7.0 or greater, otherwise use the DS jumper.” When a Quantum drive shared an IDE channel with another manufacturer’s hard disk, in many situations Quantum offered two possibilities of jumpering the Quantum drive, with no hint as to how one should choose the correct configuration.

Example: WD93044-A

The WD93044-A (made in 1990) is a good example of how such an early IDE drive may be configured. It has a block of three jumpers. When no jumpers are present, the drive is configured as the single drive in a system. Then there are separate jumpers for master and slave configurations.

And finally there is another jumper for “installation with a pre-existing Conner CP342 drive”. The documentation says: Configure the [WD93044-A] intelligent storage peripheral as the slave. Install jumpers on the J8 connector as shown below. The Conner drive must be configured as the master. This configuration presumes that you will use the LED on your WD93024-A or WD93044-A. However, if the host system requires a front panel LED, then configure the WD93024-A/44–A as the master and the Conner drive as the slave.

Say what?! That’s just stupidly complicated. And what if the drive is a Conner CP341 or CP344? Does the WD drive need to be set up the same way, or differently? And what does it have to do with LEDs?

The last question at least has an answer: The DASP- signal, in the words of the ATA standard, is “a time-multiplexed signal which indicates that a drive is active, or that Drive 1 is present”. Except, of course, it’s only time-multiplexed on ATA-compliant drives, not necessarily on pre-standard IDE drives such as the Conner CP342.

The single vs. master setting makes a visible difference to software with the WD93044-A drive. When it is jumpered as a master but there is no other drive, the WD93044-A waits about 5 seconds after a reset or EXECUTE DRIVE DIAGNOSTIC before it considers the slave drive to have failed. In addition, whenever Device 1 is selected, register reads return with all bits set because there is nothing responding. This leads to a situation where Device 1 may appear to be permanently busy, potentially severely confusing the host if it won’t switch away from Device 1 while it is busy (which it shouldn’t).

When the WD93044-A is jumpered as a single drive and Device 1 is selected, the status register reads as zero (indicating a drive that is not ready but also a controller that is not busy), which is consistent with an AT style disk controller with no second drive attached.

Jumper Zoo

Just to make things even more difficult, sometimes there is another complication: You have a drive, you know how it should be configured, but don’t have the right jumper. “Modern” drives (circa mid-1990s and later) almost uniformly use either classic Berg connector style jumpers with 2.54mm (1/10″) pitch and 0.64mm (1/40″) wide square pins, or smaller jumpers with 2.0mm pitch and 0.5mm pins.

But there are also drives which cleverly combined the two standards for 2.54mm pitch and 0.5mm pins, and those don’t work with either of the standard jumper types. Circa 1990 Conner and Quantum drives are known to have used these mongrel jumpers, and I failed to find any source of these jumpers in modern times, other than cannibalizing old drives.

Some drives (e.g. early 1990s IBM) also used jumpers that have the standard 2mm pitch but are very short, and cannot be used with typical jumpers. But the matching jumpers at least can still be sourced nowadays. On WD’s connector diagram, pin 39 is labeled as “-ACTIVE”.

An Afterthought?

Reviewing the initial high-level IDE description (a paper presented by Ken Hallam of WD at BUSCON East conference in Sep/Oct 1986) shows that there was no mention of attaching two IDE drives on a shared cable. Only the typical case with a single drive was considered. Pin 39 on the IDE connector was labeled “-ACTIVE” in the WD definition.

The very first IDE hardware, Western Digital’s WD1003-IWH adapter board, clearly reflects that thinking and allows attaching one ST506 style drive to an IDE connector. For this early implementation, two drives made no sense either logistically or in the intended use case (portable PCs with no room for second drive).

The Compaq DeskPro 386 Technical Reference (Sep 1986) is rather more interesting. In the chapter describing the fixed disk adapter, pin 39 is again labeled “ACTIVE-“, and described as follows: Active-low signal indicating that the fixed disk drive LED indicator is on and the fixed disk drive is being accessed.

But in the chapter describing the drives (in this case, a CDC Wren II with an IDE controller), we learn that the drives have a jumper that “designates the drive as C: or D:”, and a diagram shows two drives connected. Pin 39 is labeled “SLAVE PRESENT-” and described as follows: Active-low signal indicating to the host that a second drive is present.

Not only does this contradict the documentation of the connector on the adapter board that the drive is attached to, it doesn’t even make any sense. The “slave present” signal doesn’t indicate anything to the host, since the host has no way to read its value; it indicates the presence of a second drive to the other drive which needs to be aware of it.

It is possible or even likely that the option of connecting two IDE drives together was an afterthought, not initially considered when the IDE connector was specified. At the same time it clearly occurred to someone back in 1986 that it is possible, as long as the two IDE drives cooperate.

The Compaq 80286-Based Products Technical Reference from May 1987 reflects the evolving IDE definition. Pin 39 is labeled as “DASP-” (Drive Active/Slave Present) and described as follows: Time-multiplexed signal that indicates drive active or slave present. When the drive is executing a diagnostic command, this line is an output from a slave drive, and an input to the master drive indicating that a slave drive is present. At all times other than during diagnostics, this line is an output from both master and slave drives which is active when the drive is selected and being accessed (BSY is active), and is used to drive an activity LED indicator. This signal must be an open-collector output.

The May 1987 Tech Ref also shows jumper settings for both CDC and Conner IDE drives, and clearly indicates that it was possible to use two Conner or two CDC drives. It is not clear from the Tech Ref if it was possible to mix CDC and Conner drives on the same cable; the text suggests that it perhaps wasn’t.

It is notable that the CDC drives were clearly capable of detecting the presence or absence of a second drive, and thus only needed one jumper because there was no separate “single” and “master” setting. On the other hand, the Conner drives were different and required separate single/master jumper settings (and used three jumpers). It is plausible that the CDC drives used the DASP protocol from the very beginning and Conner drives did not.

At any rate, the mess and confusion is clearly as old as IDE itself.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK