分类: LINUX
2009-05-20 14:08:00
Figure 1 IDE Configuration [5]
Per the ATA-1 standard, there are two IDE bus configurations (see figure 1). First, the IDE bus consists of an interface board (IDE adapter) installed on an ISA bus. Two IDE disk drives connect via a cable to the adapter. The second configuration is where the host adapter is installed on any bus that can serve the hard disk through the IDE interface. A cable attaches the disks to the IDE connector and the bus. By doing this, it eliminates the need to purchase an IDE adapter required by the first configuration. The second arrangement is currently the most popular and is standard with most desktops and laptops with a PCI bus. The ATA-1 standard stipulated that a ATA bus only accommodates two drives. These are addressed using 0 (master) and 1 (slave). Since both drives have an onboard controller, each "hears" all of the IDE commands sent on the IDE bus. Thus, the need is resolved to determine for whom a command is sent. The ATA-1 specification also details two transfer modes in which commands and data may be sent to a disk. These are programmed I/O (PIO) and direct memory access (DMA) [3].
Since its adoption, there has been an effort to improve the IDE/ATA interface resulting in several enhancements to the original standard. The most significant to this project is ATAPI. One of the shortcomings of the original ATA-1 standard was it only supported hard disks. Other devices like CD-ROMS, floppies, etc. were attached to proprietary interfaces. For instance, many original CD-ROMs were connected directly to the sound card. In general, these interfaces proved to be slow and cumbersome. To resolve this, a new standard was accepted called AT Attachment Packet Interface (ATAPI/SFF-8020). This was designed to accommodate the aforementioned devices. It allows them to plug directly into a standard IDE cable and be configured like a ATA drive as a master or slave [2]. At the physical layer, ATAPI uses the same signaling as ATA-2. Above that layer, ATAPI and IDE devices are dissimilar. ATAPI is fundamentally different from ATA (ATA-1, ATA-2, ATA-2) in the way it operates through the use of command packets. This is the source from where its name is derived. Similar to the protocol used by SCSI, packets enable it to use tasks (command register blocks) to communicate with the disk. With the exception of the physical interface, ATAPI is closer to SCSI than it is to ATA. However, ATAPI does support a combination of ATA and SCSI commands. There is a difference between ATAPI and native SCSI commands. ATAPI commands differ because they do not contain a LUN field or have a control byte. There is overlap between ATAPI supported ATA or SCSI commands. For instance, the ATA command IDENTIFY DRIVE provides low-level information about the drive in contrast to the SCSI INQUIRY command which only supplies high-level data regarding the disk. This provides flexibility and slight variation in implementation solutions and is an advantage of ATAPI [3].
Figure 2 ATAPI Command Packet [6]
The ATAPI transport protocol revolves around the ATAPI PACKET command. All functions are executed in the same manner as in ATA-2. This involves using PIO to set the command block and drive bit and to write the command register. One noticeable difference between ATAPI and ATA is how command is written with the first DRQ in ATA whereas in ATAPI the command packet is written instead. The following is the series of events that must occur to send an ATAPI packet (see figure 3):
Figure 3 Timing for a Command Packet Transfer [7]