520 likes | 771 Views
What is SCSI?. S mall C omputer S ystem I nterface. SCSI is: a Specification a Bus a Protocol. SCSI Terms. Initiator: A SCSI device that requests an operation to be performed by another SCSI device. Host Adapter: A Controller Board that translates host I/O requests
E N D
What is SCSI? Small Computer System Interface • SCSI is: • a Specification • a Bus • a Protocol
SCSI Terms Initiator: A SCSI device that requests an operation to be performed by another SCSI device. Host Adapter: A Controller Board that translates host I/O requests into SCSI requests. Target: A SCSI device that performs an operation as requested by an initiator. Logical Unit: A Physical or Virtual device addressable through a target. LUN: Logical Unit Number. An encoded three-bit identifier for the logical unit.
SCSI Terms SCSI Device: A Host Adapter or Intelligent Peripheral which can be attached to a SCSI bus. SCSI Address: The hex representation (0-7 or 0-F) of the unique address assigned to a SCSI device. Connect: The function which occurs when an initiator selects a target to begin an operation. Disconnect: The function which occurs when a target releases control of the SCSI bus, allowing it to go Bus Free. Reconnect: The function which occurs when a targets selects an initiator to continue an operation after a disconnect.
SCSI Configuration Single Initiator, Single Target LUN0 Initiator Target LUN1 SCSI Bus LUN2
T T SCSI Configuration Single Initiator, Multiple Targets Target 0 Initiator 7 Target 1 SCSI Bus Target n SCSI Bus Terminator
T T SCSI Configuration Multiple Initiators, Multiple Targets Target 0 Initiator 7 Target 1 SCSI Bus Initiator 6 Target n
SCSI Parallel Bus Types Single-Ended - Single Signal Level - 6m max. bus length - No Fast Timings - Uses Even bus pins only Differential - Dual Signal Level - 25m max. bus length - Fast Timings - Uses all pins on bus LVDS (SCSI-3+) - 3VDC Diff Bus 5V -SIG FALSE TRUE 0V TRUE = -SIG < 1.5V 5V -SIG TRUE FALSE +SIG 0V TRUE = +SIG > -SIG
SCSI Parallel Bus Protocol • Bus Phases and their Sequencing • MSG, C/D, I/O collectively known as Bus Phase • Initiator and Target Roles • Initiator Begins an Operation • Target controls operation via Bus Phase and REQ • Initiator can disrupt sequence with ATN and RST
SCSI Parallel Bus Signals 50 Pin Bus (Narrow), 68 Pin Bus (Wide) DB(0-7,P1) I/T 8 Bit Data Bus with Odd Parity DB(8-15, P2) I/T 2nd 8 Bit Data Bus with Odd Parity (Wide Only) REQuest T Asking for data byte to be sent/on bus ACKnowledge I Indicates data byte on bus/read byte ATtentionN I Indicates pending message for target SELect I/T Indicates Selection/Reselection in progress BuSY I/T Indicates SCSI Bus in use ReSeT I Resets all SCSI devices MeSsaGe T Indicates Message Byte Cmd/Data T Indicates Command/Msg or Data In/Out T Indicates Data Direction
SCSI Bus Phases BSYSELMSGC/DI/ODefinition 0 x x x x Bus Free (Idle) 1 1 x x 0 Selection 1 1 x x 1 Reselection 1 0 0 0 0 Data Out I -> T 1 0 0 0 1 Data In I <- T 1 0 0 1 0 Command I -> T 1 0 0 1 1 Status I <- T 1 0 1 0 0 (Reserved) 1 0 1 0 1 (Reserved) 1 0 1 1 0 Message Out I -> T 1 0 1 1 1 Message In I <- T
Asynchronous Bus Conditions Attention Condition - Initiator asserts ATN to indicate pending message for target - Next Bus Phase change will be to Message Out phase Reset Condition - Initiator asserts RESET for 25 usec - Devices currently on the SCSI bus will immediately release - All devices are reset - All outstanding commands are cleared
SCSI Bus Phase Sequencing Bus Free Arbitration Selection Reselection Msg Out Msg In any phase Command Data/Msg phases RESET Status Msg In Bus Free
SCSI Parallel Bus Protocol REQ/ACK Handshakes for Information Transfer In phases: REQ (Target) sends byte ACK (Initiator) indicates byte has been read Out phases: REQ (Target) asks for byte ACK (Initiator) sends byte Two Transfer Modes Asynchronous Synchronous
Information Transfer: Asynchronous Operations In: REQ ACK Data Out: REQ ACK Data Default Transfer Mode for all phases
Information Transfer: Synchronous Operations In: REQ ACK Data Out: REQ ACK Data Data Phases Only, MUST be negotiated (speed and offset)
SCSI Operational Burst Speeds Specification Xfer PeriodBus SizeBurst Speed SCSI-1, Async - narrow 1.5 MB/sec SCSI-1, Sync 200 ns narrow 5 MB/sec SCSI-2, Async - narrow, wide 3, 6 MB/sec SCSI-2, Sync 200 ns narrow, wide 5, 10 MB/sec SCSI-2, “Fast SCSI” 100 ns narrow, wide 10, 20 MB/sec SCSI-3, “Ultra SCSI” 50 ns narrow, wide 20, 40 MB/sec SCSI-3+, “Fast 40” 25 ns narrow, wide 40, 80 MB/sec SCSI-3+, “Fast 80” 12 ns narrow, wide 80, 160 MB/sec
SCSI Message System Performs the following functions: - Unit Selection and Identification - Bus Operations Management - Data Checkpointing & Error Recovery - Command Termination (Initiator) - Command Termination (Target) - Multiple Command Management
SCSI Message System Unit Selection & Identification Identify - First message sent after Selection/Reselection - Selects LUN on target for connection - Establishes the connection (“nexus”) between the Initiator and the Target LUN (“I_T_L nexus”) - Disconnect Privilege granted here, by Initiator 7 6 5 4 3 2 1 0 SCSI-2 SCSI-3 LUN Reserved Reserved Identify (1) Disconnect Privilege LUNTAR (0) LUN SCSI-3 definition has support for 32 LUNs)
SCSI Message System Bus Operational Management Synchronous Data Transfer Request (SDTR) - Starts negotiation for Sync Data Transfer Agreement - Init sends packet [0x01, 0x03, 0x01, {period}, {offset}], Targets responds with values that it supports - Good until Reset or WDTR Wide Data Transfer Request (WDTR) - Starts negotiation for Wide Data Transfers, similar to above - Initiator sends packet [0x01, 0x02, 0x03, {width}] Ignore Wide Residue [0x23, {size}] - Sent to indicate odd byte data transfer on Wide bus Disconnect [0x04] - Sent to indicate a temporary release of the bus
SCSI Message System Data Checkpointing & Error Recovery Error Recovery - Initiator Detected Error [0x05] - Message Parity Error [0x09] - Message Reject [0x07] - NOP [0x08] Data Checkpointing - Save Data Pointers [0x02] - Restore Pointers [0x03] - Modify Data Pointers [0x01, 0x05, 0x00, {arg[4]}]
SCSI Pointers All pointers stored within the Initiator Two sets of pointers (active and saved) for Command, Data, Status for each Logical Unit Save Data Pointers Active -> Saved Restore Data Pointers Saved -> Active Modify Data Pointers Active += arg[4]
SCSI Message System Command Termination (Target) Command Complete [0x00] - Indicates current command is done, with or without error - Also terminates connection: Target goes Bus Free next Linked Command Complete [0x0A] - Used for Linked Commands (multiple commands per connection) - Target goes to Command phase for next CDB, instead of Bus Free Linked Command Complete w/Flag [0x0B] - Sent on Linked Commands with “Flag” bit set in CDB - Generally unused
SCSI Message System Command Termination (Initiator) Abort [0x06] - Clears current connection Abort Tag [0x0D] - Clears current tagged connection Clear Queue [0x0E] - Clears all outstanding tagged commands for this Initiator Bus Device Reset [0x0C] - Clears all outstanding commands for all Initiators (Bus Reset) - Clears all commands for all Initiators on all targets
SCSI Message System Multiple Command Sequencing Command Queuing - Allows multiple commands to be processed by a Target - I_T_L_Q nexus requires extended connection sequence: Identify Queue Tag, one of the following Simple Queue Tag [0x20] Head of Queue Tag [0x21] Ordered Queue Tag [0x22] Queue ID Unique single byte value - Reselection uses Simple Queue Tag Message only
SCSI Message System Multiple Command Sequencing Simple Queue Tag [0x20] - Target may execute commands in any order Ordered Queue Tag [0x22] - Delimits any order sets - Finish all commands before starting this - If multiple cmds, execution is FIFO Head of Queue Tag [0x21] - This command to be executed next - If multiple cmds, execution is LIFO
SCSI Status Byte Sent during Status Phase, prior to Command Complete Message, to indicate success or failure of the command sequence. GOOD [0x00] - Cmd completed without error CHECK CONDITION [0x02] - Cmd complete with error, see Sense Data for details BUSY [0x08] - Unable to process command at present time (Try again later)
SCSI Status Byte INTERMEDIATE [0x10] - Linked command complete without error RESERVATION CONFLICT [0x18] - Device reserved by another initiator QUEUE FULL [0x28] - Maximum number of Queued Cmds in use
SCSI Sense Data • A special data packet specifying error status and location(s) • Separate copy maintained by Target for each Initiator • Retrieved by Request Sense command • Must be retrieved immediately after a CHECK CONDITION, • or sense data is lost • All queued commands are suspended after CHECK CONDITION, • until Sense Data is retrieved (Contingent Allegiance)
SCSI Sense Data Format 0 Valid Error Code (0x70 or 0x71) 1 Segment Number 2 FM EOM ILI (R) Sense Key 3-6 Information Bytes 7 Additional Sense Length 8-11 Command Specific Information 12 Additional Sense Code 13 Additional Sense Code Qualifier 14 Field Replaceable Unit Code 15-17 Sense Key Specific 18-xx Additional Sense Bytes
SCSI Sense Keys 0x0: No Sense 0x8: Blank Check 0x1: Recovered Error 0x9: Vendor Specific 0x2: Not Ready 0xA: Copy Aborted 0x3: Medium Error 0xB: Aborted Command 0x4: Hardware Error 0xC: Equal 0x5: Illegal Request 0xD: Volume Overflow 0x6: Unit Attention 0xE: Miscompare 0x7: Data Protect 0xF: Reserved Sense Data Shorthand: SKey/ASC/ASCQ 3/11/01: Medium Error, Read Retries Exhausted 5/20/00: Illegal Command, Invalid Operation Code D/47/00: Aborted Command, SCSI Parity Error
Unit Attention Condition First sense packet after any of the following: - Power-on - Reset - Mode/Inquiry parameters changed - Runtime firmware change - Commands cleared by another initiator Reports to initiator that operating mode of the Target has changed from the last command sent to the Target. Reported on all SCSI Commands except Inquiry. Command it is reported with is not executed.
SCSI Commands Divided into categories based on device type: - All Device Types - Direct Access Devices (disks) - Sequential Access Devices (tapes) - Processor Devices (Sauna SPs) Standardized command set and structure Some commands mandatory, others optional
SCSI CDB: Byte 0 7 6 5 4 3 2 1 0 Group Code Command Code Group Code Command Description 0 6 Byte Commands 1 10 Byte Commands 2 10 Byte Commands 3-4 Reserved 5 12 Byte commands 6-7 Vendor Specific
SCSI CDB Format 0 Operation Code 1 [LUN] LBA (MSB) 2 LBA 3 LBA (LSB) 4 Transfer/Parameter/Allocation Length 5 Control Byte 0 0 Operation Code 1 1 [LUN] Reserved 2-5 2-5 LBA 6 Reserved 7-8 6-9 Transfer/Parameter/Allocation Length 10 Reserved 9 11 Control Byte
SCSI CDB: Control byte 7 6 5 4 3 2 1 0 Vendor Unique Reserved Flag Link Flag Indicates Target should return Linked CCw/Flag Msg Link Used to continue I/O process across multiple commands
SCSI Commands: All Device Types Change Definition [0x40] - Sets target in SCSI-1, CCS or SCSI-2 mode Inquiry [0x12] - Returns Target ID packet (Device Type, Vendor, Model, etc.) Log Sense/Select [0x4D/0x4C] - Sets/Reports Logged Statistical Information (soft error rates) Mode Sense(6,10)/Select(6,10) [0x1A,0x5A/0x15,0x55] - Sets/Reports Configuration and Runtime Parameters
SCSI Disk Mode Sense Pages Page 0x01: Error Recovery Page - Error Recovery Strategies Page 0x03: Format Device Page - Disk Format Parameters (Zoning, Tracks/Zone, etc.) Page 0x04: Rigid Disk Drive Geometry Page - Disk Physical Geometry (# Cyls, # Heads, etc.) Page 0x08: Caching Mode Page - Read/Write Caching control Page 0x0A: Control Mode Page - Exception Handing & Queue Handling parameters
SCSI Commands: All Device Types Request Sense [0x03] - Returns Sense Data to Initiator Test Unit Ready [0x00] - Returns Target readiness to accept I/O commands Write Buffer [0x3B] - Used to update Target run-time firmware
SCSI Disk Commands Force Reserve [0xE4] - Force Reservation, overriding normal SCSI protocol Format Unit [0x04] - Formats disk, according to Mode Parameters Prefetch [0x34] - Read disk, place data into cache Read (6,10) [0x08, 0x28] - Read disk, transfer data to Initiator Read Capacity [0x25] - Returns size of disk, in # LBAs
SCSI Disk Commands Reassign Blocks [0x07] - Remaps specified LBA(s) Reserve, Release [0x16, 0x17] - Locks Disk for exclusive access by this Initiator Rezero Unit [0x01] - Seeks to LBA 0 Start/Stop Unit [0x1B] - Command to spin up/down disk Synchronize Cache [0x35] - Flush cache to disk, cache remains enabled
SCSI Disk Commands Verify [0x2F] - Verify LBA(s) on disk with passed data Write (6,10) [0x0A, 0x2A] - Write specified LBA(s) with passed data Write and Verify [0x2E] - Treated the same as a Write command Write Same [0x41] - Writes passed sector to multiple LBA(s) on disk
Sample SCSI Command Bus Free Arbitration/80 (7) Select w/ATN/81 (7,0) Message Out/80 (Identify) Command/08 (Read) 00 34 22 01 00 Data In/00 01 02 03 04 05 06 07... Status/00 (Good) Message In/00 (Command Complete) Bus Free
Sample SCSI Command with Disconnect Bus Free Arbitration/80 (7) Select w/ATN/81 (7,0) Message Out/C0 (Identify) Command/08 (Read) 00 34 22 01 00 Message In/04 (Disconnect) Bus Free Arbitration/01 (0) Reselection/81 (7,0) Message In/80 (Identify) Data In/00 01 02 03 04 05 06 07... Status/00 (Good) Message In/00 (Command Complete) Bus Free
Sample SCSI Command with Parity Error Bus Free Arbitration/80 (7) Select w/ATN/81 (7,0) Message Out/C0 (Identify) Command/08 (Read) 00 34 22 01 00 Message In/04 (Disconnect) Bus Free Arbitration/01 (0) Reselection/81 (7,0) Message In/80 (Identify) Data In/00 01 02 03 04* 05+ 06+ 07+... Message Out/05 (Initiator Detected Error) Message In/03 (Restore Pointers) Data In/00 01 02 03 04 05 06 07... Status/00 (Good) Message In/00 (Command Complete) Bus Free
Sample SCSI Queued Command Bus Free Arbitration/80 (7) Select w/ATN/81 (7,0) Message Out w/ATN /C0 (Identify) Message Out w/ATN /20 (Simple Tag) Message Out/00 (Tag ID) Command/08 (Read) 00 34 22 01 00 Message In/04 (Disconnect) Bus Free Arbitration/01 (0) Reselection/81 (7,0) Message In/80 (Identify) Message In/20 (Simple Tag) Message In/00 (Tag ID) Data In/00 01 02 03 04 05 06 07... Status/00 (Good) Message In/00 (Command Complete) Bus Free
Sample SCSI Linked Command Bus Free Arbitration/80 (7) Select w/ATN/81 (7,0) Message Out/80 (Identify) Command/08 (Read) 00 34 22 01 01 Data In/00 01 02 03 04 05 06 07... Status/10 (Intermediate/Good) Message In/0A (Linked Command Complete) Command/08 (Read) 03 22 68 01 00 Data In/00 01 02 03 04 05 06 07... Status/00 (Good) Message In/00 (Command Complete) Bus Free
Processor SCSI Commands Send [0x0A] - Send data packet Test Unit Ready [0x00] - Test readiness to send/receive data Used by SP when acting as an Initiator to send Unsolicited Errors Also used by SP for communication to the peer SP