< COEN 180
COEN 180
SCSI

SCSI can be traced back to 1979 when disk drive manufacturer Shugart began working on a new disk drive interface. After a false start, ANSI approved the first SCSI standard in 1986. SCSI (in many different variations) has remained the primary interface for business level hard drives. SCSI offers greater functionality than is strictly necessary for a hard drive interface, since SCSI interfaces exist for many types of storage. SCSI from the beginning has been based on an IO bus that can address a number of different devices (originally 8). For example, the first RAIDs had strings of disks hanging of a single SCSI bus.

SCSI has its own language. A SCSI address is a SCSI ID. A device with a SCSI Id can actually consist of (originally up to 8) LUNs or Logical Units. The devices are either targets or initiators. An initiator is a device that gives another device (the target) a task to perform. A computer system is connected to the SCIS bus through a host adapter. A peripheral device has instead a controller.


Figure 1: SCSI Terms Examplified

SCSI Standards

SCSI has and is undergoing continuing modifications to increase performance while maintaining interoperability between SCSI devices. SCSI-1 has two transfer rates, asynchronous and synchronous data transfer, the first had transfer rates of 1.5MHz to 4 MHz, the second optional transfer mode achieved 5MHz with SCSI-1 and 10MHz with SCSI-2. During an asynchronous data transfer, sender and receiver exchange data using a request / acknowledge handshake. Synchronous transfer does not have an explicit handing over of data and asumes that sender and receiver implement a clock each at roughly the same speed. Sender and receiver negotiate the use of synchronous transfer (and its parameters) before the transfer of data. The target sends out REQ pulses (on a line of the control bus) at a fixed rate without waiting for ACK pulses, though not exceeding a maximum value, the REC/ACK offset. The data itself is put on the bus. Figure 2 shows an example data transfer. The left portion shows a transfer from the target to the initiator. The target asserts the REQ pulse five times - the value that we use for the REC/ACK offset. The target then waits for the initiator, which sends 5 pieces of data (on each of the data lines) and validates them by pulsing the ACK signal. After the target has received the first ACK, it can send out another REQ, so that eventually target and initiator communicate at the frequence that the slowest of the two allow. The right portion of Figure 2 shows a transfer from the target to the initiator. The target sends out the first REQ signal together with the first datum. The target then follows with more pulses until the REC/ACK offset has been reached. The initiator reacts to the datum and the first REQ pulse by setting the ACK. Immediately after receiving the ACK signal, the target puts out a new datum, which then receives an ACK. The target sends out the following data at the negotiated frequency, the ACKs should also follow at the same negotiated frequency.


Figure 2: SCSI Synchronous Data Transfer

Wide SCSI uses instead of a data bus of 8 bits one of 16 bits or 32 bits, thus doubling or quadrupling the data transfer rate. Fast SCSI-2 uses a tighter synchronous data transfer to increase the transfer rate. The family of SCSI standards got much richer with the SCSI-3 series of protocols. Currently, parallel and serial SCSI standards compete for market share.

Name Specification # of Devices Bus Width Bus Speed MBps
Asynchronous SCSI SCSI-1 8 8 bits 5 MHz 4 MBps
Synchronous SCSI SCSI-1 8 8 bits 5 MHz 5 MBps
Wide SCSI SCSI-2 16 16 bits MHz 10 MBps
Fast SCSI SCSI-2 8 8 bits 10 MHz 10 MBps
Fast/Wide SCSI SCSI-2 16 16 bits 10 MHz 20 MBps
Ultra SCSI SCSI-3 SPI 8 8 bits 20 MHz 20 MBps
Ultra/Wide SCSI SCSI-3 SPI 8 16 bits 20 MHz 40 MBps
Ultra2 SCSI SCSI-3 SPI-2 8 8 bits 40 MHz 40 MBps
Ultra2/Wide SCSI SCSI-3 SPI-2 16 16 bits 40 MHz 80 MBps
Ultra3 SCSI SCSI-3 SPI-3 16 16 bits 40 MHz 160 MBps

Table 1: SCSI Standards (source: http//HowStuffWorks.html)

SCSI Hardware

A computer has access to the SCSI bus via a host adapter. It is possible for the same system to have many host adapters, each giving access to a different SCSI bus. Thus, in a storage area network (SAN) build on SCSI or the SCSI interface, a device is addressed by the triple (bus, target, LUN).

Devices on a SCSI play either the role of an initiator or a target. Originally, most devices assumed either one role or the other exclusively, thus, the host adapters were strictly initiators and controllers (at a disk, e.g.) strictly targets. However, later on devices acquired the capability to play both roles. For example, a tape drive might be a target first, when a command for a block is sent to the tape. The transaction gives up control of the bus, and several minutes later, when the tape device has retrieved the data block, it becomes the initiator picking the host adapter as a target to initiate a transfer to the client. The role of targets and initiators is described in the bon mot "The initiator is the master in the function and the slave in protocol, the target is the slave in function and the master in protocol" (M. Schultz).

SCSI cables consists of two cables, the A cable has 50 pin and the B cable has 68 pins in SCSI 1. There are three different versions of cabling:

The SCSI bus uses phases in order to transmit data or messages.

The first phase is the bus free phase. During the arbitration phase, one or more initiators indicate that they would like to use the bus. If more than one initiator enters the arbitration phase, the one with the highest SCSI ID wins. The next phase is the selection phase, where the initiator puts the address of the target onto the data bus. (The reselection phase fulfills a similar function, after winning arbitration, a target that released the bus to execute a command can reestablish the connection to the initiator.) Finally, there are four phases for exchanging data: the command phase is used for transferring command opcodes, the data phase is used for transfering data bytes, the message phase allows sending or receiving information concerning the protocol itself, and finally, the status phase concludes a command and gives the status of the operation back to the initiator.

SCSI Commands

SCSI has a plethora of different commands. Not unlike TCP, the commands are carefully formatted in a variety of formats. SCSI sees a disk drive as a linear list of blocks referred to by the Logical Block Number. As one example of many a SCSI command, we look at the 10B read command. The first line is 08h for a read. The second byte contains the LUN address, the DPO (disable page output) bit that tells whether the read data should be cached at the device, the FUA (force unit access) bit, that tells the device whether to read from the cache or not if the data is there, and the Rel (Relative addressing) bit that is valid only in a series of linked commands.

0
0
0
0
1
0
0
0
LUN
DPO
FUA
Reserved
Rel
Logical Block
Logical Block
Logical Block
Logical Block (LSB)
Reserved
Transfer Length
Transfer Length
Control Byte

 

© 2003 Thomas Schwarz, S.J., COEN, SCU                                                                              SCU            COEN            T. Schwarz            COEN 180