home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PROGRAMS / UTILS / HARDDISK / SCSITUT.ZIP / SCSI
Encoding:
Text File  |  1987-10-24  |  17.0 KB  |  317 lines

  1. SCSI (pronounced scuzzy) TUTORIAL  By Daniel L. Miller, MD, BSEE
  2.  
  3. 11 West Wedgewood Glen
  4. The Woodlands, TX 77381
  5. copyright 9-5-87 daniel l. miller
  6. HAL PC MEMBER
  7.  
  8. This article combines two interests in that it fits into both the 
  9. advanced pc hardware series and the Texas computer firm series.
  10. The article format is an expanded outline to save printed space.
  11.  
  12. 1  Operational Description
  13.     The Small Computer Serial Interface is an input/output channel
  14.     bus specification.  The specification allows up to eight bus
  15.     controllers to exchange control packets and bytes of data between
  16.     any two pairs of controllers.   
  17.  
  18. 2  Examples of Data Exchange
  19.     Workstation to hard disc, optical disc and high density floppy.
  20.       Workstation is the bus master the peripheral devices are 
  21.       individually accessed.  One initiator , 3 targets.
  22.     Several workstations accessing a bank of hard discs for fast
  23.       data retrieval with interleaved seeks and queed commands.
  24.       Multiple initiators, multiple targets. Each drive disconnects
  25.       from the bus during long seeks, while other drives transfer 
  26.       data and then reconnects when ready to transmit data.
  27.  
  28. 3   Rates of data exchange
  29.       Data rate of readily available bus interface chips  12 - 15
  30.       megabits per second.  NCR 5380 / NCR 5385
  31.       Logic Devices L5380 32 megabits / sec
  32.  
  33. 4   Controller Selection
  34.       Bus controllers are free to access the bus to try to gain
  35.       control to initiate a data exchange. Bus arbitration is 
  36.       according to a fixed priority 0 - 7 rating.  If two devices
  37.       request access the lower priority device must wait.
  38.  
  39. 5   How many devices.  The specification allows 8 controllers
  40.       to be selected from 8 data lines -- one line per each device.
  41.       Two additional lines select up to 4 devices for each controller.
  42.       Up to eight bus controllers each controlling up to 4 devices
  43.       totals 32 devices.
  44.       A proposed extension allows binary decoding of the selection
  45.       lines to allow 64 controllers.  ( Ampro SCSI+ protocol, Ampro advertises in
  46.       Byte )
  47.  
  48. 6   Accessing the Bus
  49.       The scsi interface protocal may be implemented with a dedicated
  50.      cpu and 4 input and 4 output data latches. ( Novix Beta Board )
  51.      However, scsi bus interface chips with data latches are readily available
  52.      both in TTL and CMOS configuration.  NCR, Toshiba 2nd source and
  53.      similar purpose chips are available from Adaptec and Western digital.
  54.      Emulex has announced a vlsi chip scsi processor which they claim can
  55.      implement bus sequences without external microprocessor intervention.
  56.         The NCR chip is programmed by addressing register select lines and
  57.      storing a byte in the controll register and if appropriate in the
  58.      data register.  A programming manual lists the possible commands.
  59.      The chip will perform aribitration logic and drive the bus and 
  60.      detect protocol errors ( called phase errors in the NCR literature )
  61.      and parity errors.  Data ready and error conditions are flagged
  62.      by an inerrupt line.  A register holds a code to identify the type
  63.      of error detected to be read by the host cpu for error interrupt
  64.      handling routines.
  65.         The interface chip has handshake signals to operate efficiently
  66.      with a DMA controller to move blocks of data into or out of a 
  67.      section of memory.  The dma is a dedicated cpu chip that generates
  68.      addresses for moving data sequentially into or out of memory.
  69.  
  70. 6.5  Terminology
  71.      Initiator - the device that begins an interchange 
  72.      Target - The device that is selected by the initiator
  73.      Host - In the configuration of a computer sending data to 
  74.             one or more disk drives, "host" refers to the main workstation
  75.             computer. 
  76.      Controller - any device that connects to the scsi bus
  77.           connects through a controller.
  78.      Device -  Each controller on the bus can control up to 4 devices.
  79.           Each device can be individually addressed, so a device connected
  80.          to one controller can specifically talk with a device on another
  81.          controller.  Devices connected to the same controller cannot 
  82.          talk to each other over the scsi bus.  The devices are also
  83.          called "Logical Units" or LUN's because they are addressed and 
  84.          specified
  85.          by 2 bits in each command sent over the bus, rather than being
  86.          selected by a hardware bus line.
  87.      SASI - sasi stands for Sugart Associates System Interface, a single 
  88.          host multiple target ( non arbitrating ) interface which was the
  89.          precursor to the SCSI specifications.
  90.      SCSI - Small Computer System Interface, the current standard 
  91.          specification is the ANSI (American National Standards Institute)
  92.          version X3.131, 1986.
  93.      Embedded Controller- some drives have a scsi interface built into
  94.          the drive electronics mounted in or on the drive itself.  This
  95.          will be referred to as a "scsi drive."  
  96.      SCSI controller - a scsi interface board that then connects with up
  97.          to four devices like esdi drives or st412/506 drives or optical drives.
  98.         ( The scsi controller is made to talk to regular devices, like the 
  99.          drives in a xt or at computer.)  Scsi controllers are made for
  100.          optical drives, tape systems, ESDI and st412/506 hard discs.  
  101.  
  102. 7   Data Transfer Protocol
  103.        The initiating controller first gains control of the bus and 
  104.     gets the attention of its target controller.  The target then
  105.     takes control of the data exchange and asks the initiator what
  106.     it wants to do.  ie give a command, send or receive data.  The
  107.     initiator responds and the target aknowleges receipt of command
  108.     and transmits or recieves data, under control of the target controller.
  109.     The target will indicate with a message that it has successfully 
  110.     completed its mission.
  111.  
  112.         Bus phases
  113.         BUS FREE phase
  114.  
  115.         SELECTION phase
  116.  
  117.         COMMAND phase   -- 
  118.         DATA phase        |-----These are the information transfer
  119.         STATUS phase      |       phases.
  120.         MESSAGE phase   --|
  121.  
  122.         ARBITRATION phase  (optional)   |            |-for multiple hosts
  123.         RESELECTION phase  (optional)   |---optional-| for multidrive high 
  124.                                                        bus performance
  125.  
  126. 7.5  DATA EXCHANGE WALKTHROUGH
  127.      An example of a simple data interchange between an initiating host
  128.      PC and a target hard disc drive.
  129.      To send a block of data to a disk drive a pc first checks the bus
  130.      busy line.  When the line indicates the bus is free,  the pc will
  131.      send its identification code over the data lines and pull the bus
  132.      control lines.  If there is more than one device desiring to use 
  133.      the bus at the same time, the device with the highest priority
  134.      always wins.  There is no inherent mechanism to insure fairness
  135.      or to force a round robin to prevent one device from tying up the
  136.      bus.  
  137.         After gaining control of the bus the pc will select its target 
  138.      device by activating one of eight lines.  The device selected
  139.      then takes control of the data interchange, and will remain in 
  140.      control until the end of the exchange.  The target asks the pc
  141.      for a command.  The pc responds with a command block to read
  142.      10 blocks beginning with block 5.  The target acknowledges and
  143.      translates the logical block numbers to absolute sectors, seeks and 
  144.      reads the sectors, performs error correction and  transmits the
  145.      data byte by byte with a handshake acknowlegement after each byte.
  146.      When it is finished it requests to send its status and transmits
  147.      a status report, if the status is good and the data does not have
  148.      to be retransmitted the drive then requests to send a message  and
  149.      reports  completion.
  150.   
  151. 8   SCSI Command Format  
  152.         When the target requests a command, the initiator responds by 
  153.         sending out 5 bytes ( 40 bits ) of command information.  These
  154.         bits are used to specify the command and identify the logical
  155.         device.  There is a SCSI COMMON COMMAND SET specification
  156.         The purpose of the specification was to 
  157.         "Allow true second sourcing of SCSI hardware."  However,
  158.         because there are still multiple ways to do certain commands
  159.         and vendor specific functions, hard disc interchangeability 
  160.         has not yet been achieved. From the end user point of view,
  161.         one can't unplug one scsi drive and replace it with one
  162.         from another manufacturer and expect it to work without
  163.         rewriting the device driver software for formats and the message
  164.         handling scsi driver routines. 
  165.         The set of 40 bits is called a command block.  The first byte
  166.         specifies the class of commands or opcode.
  167.         Some Common Command Set Opcodes are the following:
  168.                 Opcode 00 (hex)  TEST UNIT READY
  169.                        03        FORMAT UNIT
  170.                        08        READ
  171.                        0A        WRITE
  172.                        0B        SEEK
  173.  
  174.         Since the drive controller electronics is on the drive side of 
  175.         the SCSI BUS the data is organized by the drive controller and
  176.         requested by block number.  The controller translates the block
  177.         number to the track and sector information used to step to the
  178.         data.  This permits flexibility for the drive manufacturer.  A
  179.         drive with an embedded SCSI controller can reallocate bad blocks
  180.         internally and substitute blocks automatically from a spare track. 
  181.         The meaning of the remaining bits varies for each opcode.
  182.                 The Write Command, opcode 0A, for example
  183.   BYTE 0       opcode  1A    (00001010)
  184.   BYTE 1       Logical unit number in bits 5-6, bits 1-4 specify logical
  185.                  block address
  186.   BYTE 2       logical block address
  187.   BYTE 3       logical block address
  188.   BYTE 4       Bits 2 to 5 specify the transfer length
  189.   BYTE 5       Bits 7 and 6 are vendor unique, bit one is a flag, bit 0 a link
  190.      
  191.  
  192. 9   SCSI Hardware Bus Specification
  193.         25 signal lines; 25 ground lines
  194.         Signals may assume true or false values. Signal assertion (true)is 0 v. 
  195.         Signal negation (false) is 2.5 to 5.25 V dc
  196.         ( Bus driver chips typically invert the signal so bus voltage
  197.         levels are typically the reverse of normal logic levels input to the
  198.         on chip or input to the bus drivers where
  199.         +5 V is true.)
  200.         SCSI BUS SIGNALS
  201.         Busy            indicates the bus is in use
  202.         Select          used by the host to select the drive
  203.         Control/Data    This signal is driven by the target (like a disc drive
  204.                         and indicates whetehr CONTROL or DATA information is 
  205.                         on the DATA bus.  A true value indicates a control
  206.                         signal is on the bus.
  207.         Input/Output
  208.                         This signal is driven by the target (disc drive) and
  209.                         controls the direction of data movement on the DATA 
  210.                         bus with respect to the host.
  211.                         A true value indicates input to the host.
  212.         Message         This signal is driven by the target (disc drive)
  213.                         during the message phase.
  214.         Request         This signal is driven by the target (disc drive) and 
  215.                         indictes  a request for a data transfer handsake acknowlegement.
  216.         Acknowledge     This signal is driven by the host and acknowleges a
  217.                         a data transfer handshake.
  218.         Attention       This signal is driven by the host to indicate a 
  219.                         condition needing attention.
  220.         Reset           This forces a reset of devices on the bus.
  221.         Data lines (8)
  222.         Parity line (1) This line may be used by the devices to signal a 
  223.                         parity error in the received data or command.
  224.         Bus Power lines
  225.  
  226. 10 SCSI CATALOG
  227.  
  228.        HOST BOARDS for the IBM PC, XT, AT, ... IBMetc...COMPAC... CLONES...
  229.         Drop in boards for the pc,xt,at and 386 IBM, Intel, Compac and close 
  230.         clones are available from Advanced Storage Concepts
  231.         and Hudson and Supinger and Future Domain.
  232.         Hudson and Supinger is of interest in 
  233.         that they supply an 
  234.         example dos driver program in C language although  their prom routines
  235.         remain proprietary.   
  236.  
  237.         ADVANCED STORAGE CONCEPTS (The Houston based company in this
  238.         article.) 
  239.         sources a board that just drops into the pc
  240.         XT AT or 386 and uses an included self installing device driver
  241.         to configure the board and install itself as a DOS device
  242.         driver.   I have had one operating in my XT for a year with
  243.         no problem.  Included software functions set up drives of any 
  244.         size and get around the dos 32 megabyte max drive size "limit".
  245.         Operation is transparent.  And from my keyboard and application programs I
  246.         can't tell that I'm using a scsi disc.  The short slot size 
  247.         board has a eeprom that remembers the configuration so there
  248.         are no jumpers or switches to set.  The proms and driver source
  249.         code are proprietary.   Many ( 30+ ) scsi drives are supported.
  250.         The installation program has the data on file for the drives
  251.         like the number of logical blocks and the message codes returned
  252.         and the format commands so the user only has to pick the drive
  253.         name and model from a menu and the program does all the work.
  254.         The installation program has nice colors and jazz and looks like
  255.         something well done in Turbo Pascal and has a good feel to it.
  256.         Advanced Storage Concepts does systems integration for large
  257.         oem's and drive manufacturers and systems suppliers, but did not
  258.         seem to mind my bothering them. At one time they had advertised
  259.         in PC Tech magazine.  
  260.  
  261.         National Memory Systems  sells scsi drive systems and boards
  262.         primarily for minicomputers and super micros and IBM 
  263.         comptible scsi systems. 
  264.  
  265.         SCSI drives are available from a variety of commercial 
  266.              electronics suppliers including Arrow and Hallmark  and
  267.              Dallas Digital and Quality Components in Richardson.
  268.              Integrated scsi controllers built into disc drives are made 
  269.              by many drive manufactureres including
  270.              Quantum, Maxtor, Rodime, Teac, Kodak, Fujitsu, 
  271.              C. Itoh, NEC, Seagate, Shugart Associates (who originated the
  272.              SCSI specifications in conjunction with NCR and Ampro), and
  273.              Connor Periferals. 
  274.              A partial list of devices with scsi interfaces include
  275.              5 1/4 inch drives up to 760 meg from Maxtor, Quantum, NEC
  276.              Toshiba, Fujitsu, Connor Periferals, plus about 10 others.
  277.              5 1/4 inch floppy drives up to 12 (twelve is correct !) megabytes
  278.                from Verbatim (now a Kodak data division).
  279.              3  1/4 inch drives up to 170 meg from Maxtor.
  280.              Miniature lightweight Connor Periferal 40 and 80 meg drives.
  281.              Optical Write once read many time discs from ( 5 1/4) Optotech in Denver
  282.              200 meg per side and Kodak at 1.2 gigabytes in a 12 inch disc.
  283.  
  284.         SCSI controllers made to connect a scsi bus to up to 4 drives
  285.              using the esdi or 502 interface are available.  These controller
  286.              boards would be used to hook the hundreds of cheap drives
  287.              available for the pc xt or ps2 computers to a scsi bus.
  288.              Manufactureres of these controller boards include Adaptec,
  289.              Emulex, and OMTI.
  290.  
  291.         SCSI computer motheroards with a built in
  292.              scsi chip set and the system
  293.              proms or operating system has the software, interrupt handlers,
  294.              and message handlers to talk to at least one brand of scsi drive.
  295.              These computers include the Macintosh Plus, The Amiga, 
  296.              Steve Ciarcia's Micromint's SB180FX, PC TECH SUPER
  297.              10 MHZ AT clone and their 386 machine, The Slicer, The Semidisc
  298.              64180, Chicago Computer's 68000 machine.
  299.              
  300.  
  301.          Drop me a note if you need a commercial address or telephone
  302.              number.
  303.      
  304.                         
  305.      
  306.     
  307.                    
  308.       indictes  a request for a data transfer handsake acknowlegement.
  309.         Acknowledge     This signal is driven by the host and acknowleges a
  310.                         a data transfer handshake.
  311.         Attention       This signal is driven by the host to indicate a 
  312.                         condition needing attention.
  313.         Reset           This forces a reset of devices on the bus.
  314.         Data lines (8)
  315.         Parity line (1) This line may be used by the devices to signal a 
  316.                         parity error in the received data or comma
  317.