OS/2 SCSI Device Driver Interface Specification

This appendix describes the high-level interface for the SCSI device driver for the OS/2 operating system. For completeness, all functions are listed; however, functions that are not implemented are so indicated. Some of the internal specifications of the device driver have not been included here so that this document can be externally distributed to vendors wanting to write device drivers to the SCSI device driver interface.

Introduction
The SCSI driver is the lower half of a split model for OS/2 SCSI device drivers. The SCSI driver drives the SCSI adapter through the SCSI adapter device driver as shown in the following figure. ┌───────────────────────────────────────────────────────────┐ │                                                          │ │                                                           │ │                       OS/2 KERNEL                         │ │                                                          │ │                                                           │ └──────┬──────────────────┬─────────────────┬───────────────┘        │                  │                 │        │                  │                 │ ┌──────┴───────┐ ┌────────┴───────┐ ┌───────┴──────┐ │ CDROM CLASS  │ │  OPTICAL CLASS │ │ OTHER CLASS  │  .... │  DRIVER     │ │     DRIVER     │ │    DRIVER    │ └──────┬───────┘ └────────┬───────┘ └───────┬──────┘       │                  │                 │        │                  │                 │ ┌──────┴──────────────────┴─────────────────┴───────────────┐ │                                                           │ │             OS2SCSI.DMD SCSI DEVICE MANAGER               │ │                                                          │ └─────────────────────────────┬─────────────────────────────┘                               │                               │ ┌─────────────────────────────┴─────────────────────────────┐ │                         SCSI ADD                          │ └─────────────────────────────┬─────────────────────────────┘                              │ ┌─────────────────────────────┴─────────────────────────────┐ │                        SCSI ADAPTER                       │ └──────┬─────────────────┬──────────────────┬───────────────┘       │                 │                  │ ┌──────┴───────┐ ┌───────┴────────┐ ┌───────┴──────┐ │ CDROM SCSI   │ │  OPTICAL SCSI  │ │ OTHER SCSI   │  .... │   DEVICE    │ │     DEVICE     │ │    DEVICE    │ └──────────────┘ └────────────────┘ └──────────────┘ The diagram illustrates the relationship between the device drivers and their interaction with other components of the system.

The split device driver model uses the principles of code layering to facilitate development and maintenance of new SCSI device drivers. The provision of common functions in the SCSI driver also reduces memory requirements. Performance is enhanced because the SCSI driver centralizes control of the SCSI channel, thus reducing contention. Only one interrupt handler is registered for all the SCSI peripheral devices.

A split device driver model has been used by IBM for all the SCSI devices except the SCSI fixed disks, which use the OS/2 DASD Manager. The device-class driver is the upper-level driver, and the SCSI driver is the lower-level driver. The device-class driver does not interact directly with the SCSI adapter or the SCSI device. The device-class driver sends commands to the SCSI device manager, which in turn sends commands to the device using the IORB ADD interface.

The device-class driver looks very much like an OS/2 device driver. It maps an OS/2 request into an SCB, or a chain of SCBs, and passes the request immediately to the SCSI driver. The SCSI driver handles all queuing and interrupts and insulates the device-class driver from the procedural details of managing adapter hardware. The device-class driver requests a service, like Transfer SCB, from the SCSI device manager. When control is returned to the device-class driver, the called service is complete. If an error occurred, the termination status block (TSB) might contain error information. In addition, sense data might have been returned.

Naming Conventions
The file name for the SCSI driver is OS2SCSI.DMD. The IDC entry point for the SCSI driver can be obtained from the AttachDD DevHlp function by using the name SCSI-02$ as the device driver name parameter. Current device driver names used by IBM are: OPTICAL.SYS Read/Write optical device driver Note: Naming conflicts are possible, so try to choose unique names for your device-class drivers. In a SCSI environment, different vendor devices for the same SCSI device class can be present in one system. The IBM-reserved message file name for device drivers that have been developed internally is DEV002.MSG. Independent vendors must not use DEV002.MSG for their message files, because if they do, one of those message files could be destroyed during the user installation process. It is suggested that vendors choose a unique message file name by embedding part of their logo or company name in the file name; that would eliminate the possibility of having different vendor devices with the same message file name installed in the same system.
 * SCSI Driver
 * IBM Device-Class Drivers
 * Message Files

Generic IOCtl Request
The input to the SCSI driver is a generic IOCtl request packet, pointed to by the ES:BX register pair.


 * Note: It is not the intention of the IOCTL definitions in the SCSI.SYS specification to provide an application level programming interface to SCSI devices. The intention of the IOCTL definitions is to allow client drivers at their Ring 3 INIT time to communicate with the OS2SCSI.DMD which is running at a higher privilege level than the installable driver.
 * A client driver may choose to provide application level services. However, all responsibility for locking and removing LDT references from the IOCTL/SCB/TSB structures would rest with the client driver not OS2SCSI.DMD.

OS/2 SCSI Services
The SCSI driver supports the following requests:
 * Read Device Parameters
 * Reset/Initialization
 * Enable Adapter Cache
 * Disable Adapter Cache
 * Return Adapter Cache Status
 * Set Device Timeout
 * Read Device Timeout
 * Transfer SCB
 * Deallocate Device
 * Allocate Device
 * Return Peripheral Type Count
 * Abort

Read Device Parameters
This function returns some information about the device. The logical unit number (LUN) is required if a Send Other command is used.

FUNCTION CATEGORY : 80h FUNCTION CODE    : 43h

This function requires a device handle to be passed in the request. The device must be allocated by the device-class driver before calling this function. The function category and function code are to be set up as shown above.
 * Adapter:Index contains the adapter number for the SCSI adapter.
 * Device Flags:Bit 4
 * 0 = Adapter cache not supported.
 * 1 = Adapter cache supported.
 * Bit 1
 * 0 = Device power ON.
 * 1 = Device power OFF.
 * Bit 0
 * 0 = Device is not defective.
 * 1 = Device is defective.

Reset/Initialize
This function results in a reset message being issued to the physical device.

FUNCTION CATEGORY : 80h FUNCTION CODE    : 45h

This function requires a device handle to be passed in the request. The device must be allocated by the device-class driver before calling this function. The function category and function code must be set up as shown above.
 * Data Buffer:This function does not require a data buffer. Status is returned in the Status field of the request packet.

Enable Adapter Cache
This function enables the adapter cache capability for all subsequent commands to this device.

FUNCTION CATEGORY : 80h FUNCTION CODE    : 4Dh

This function requires a device handle to be passed in the request. The device must be allocated by the device-class driver before calling this function. The function category and function code must be set up as shown above.
 * Data Buffer:This function does not require a data buffer. Status is returned in the Status field of the request packet.

Disable Adapter Cache
This function disables the adapter cache capability for subsequent commands to the specified device.

FUNCTION CATEGORY : 80h FUNCTION CODE    : 4Eh

This function requires a device handle to be passed in the request. The device must be allocated by the device-class driver before calling this function. The function category and function code must be set up as shown above.
 * Data Buffer:This function does not require a data buffer. Status is returned in the Status field of the request packet.

Return Adapter Cache Status
This function returns the adapter cache status for the specified device.

FUNCTION CATEGORY : 80h FUNCTION CODE    : 4Fh

This function requires a device handle to be passed in the request. The device must be allocated by the device-class driver before calling this function. The function category and function code must be set up as shown above. Adapter Cache Status : 00H Enabled 01H Disabled

Set Device Timeout
This function sets the timeout value for this device.

FUNCTION CATEGORY : 80h FUNCTION CODE    : 50h

This function requires a device handle and a timeout value to be passed in the request. The timeout value is in milliseconds. The device must be allocated by the device-class driver before calling this function. The function category and function code must be set up as shown above.
 * Data Buffer:This function does not require a data buffer. Status is returned in the Status field of the request packet.

Read Device Timeout
This function returns the current timeout value for this device.

FUNCTION CATEGORY : 80h FUNCTION CODE    : 51h

This function requires a device handle to be passed in the request. The device must be allocated by the device-class driver before calling this function. The function category and function code must be set up as shown above. The timeout value is in milliseconds.

Transfer SCB
This function causes an SCB or a chain of SCBs to be sent to the adapter. FUNCTION CATEGORY : 80h FUNCTION CODE    : 52h

This function requires a device handle to be passed in the request. The device must be allocated by the device-class driver before calling this function. The function category and function code are to be set up as shown above. A normal length SCB is used to send generic SCSI commands to a device. The long SCB is used to send a vendor-unique SCSI command embedded in the SCB.
 * Flags:Bit 0 = 0 Normal Length SCB 1 Long SCB
 * Data Buffer:If an error occurs, the data buffer might contain sense data; the return code indicates whether the sense data is valid. A termination status block also might be returned.

SCB Chain Header +00h ┌────────────────────────────┐ │  Reserved                 │ +02h ├────────────────────────────┤ │  Logical Pointer to next  │ ├─ SCB Chain Header        ─┤ │                           │ +06h  ├────────────────────────────┤ │  Reserved                 │ +08h ├────────────────────────────┤ │  Reserved                 │ +0Ah ├────────────────────────────┤ │  Logical Pointer to TSB   │ ├─                         ─┤       │                            │ +0Eh  ├────────────────────────────┤ │  Reserved                 │ +10h ├────────────────────────────┤ │                           │       │                            │       │            SCB             │ │                           │       │        Immediately         │ │                           │       │           Follows          │ │                           │       │             the            │ │                           │       │            Chain           │ │                           │       │           Header           │ │                           │       │                            │       └────────────────────────────┘ See Subsystem Control Blocks for a description of the SCB architecture.

Allocate Device
This function allocates a SCSI peripheral device and returns the device handle that will be used to access the device. FUNCTION CATEGORY : 80h FUNCTION CODE    : 55h

This function requires a device type, device type flags, and Nth available device to be passed in the request. The device type flags define the removable media indicator. The most significant bit of the device type flags set indicates that the media is removable. The Nth available is the Nth device in the device type group. If Nth available is 0, the next available device is returned.
 * SCSI Device Types
 * Direct Access 0x00
 * Sequential Access 0x01
 * Printer 0x02
 * Processor 0x03
 * Write Once/Read Many 0x04
 * CD-ROM 0x05
 * Scanner 0x06
 * Optical Memory 0x07
 * Medium Changer 0x08
 * Communications 0x09


 * Device Handle:Returned to the caller.

Deallocate Device
This function deallocates the SCSI Peripheral Device assigned to this device handle. FUNCTION CATEGORY : 80h FUNCTION CODE    : 54h

This function requires a device handle to be passed in the request. The device must be allocated by the device-class driver before calling this function. The function category and function code must be set up as shown above.
 * Data Buffer:This function does not require a data buffer. Status is returned in the Status field of the request packet.

Return Peripheral Type Count
This function returns a count of the number of devices of a particular type that are detected. FUNCTION CATEGORY : 80h FUNCTION CODE    : 56h

This function requires a device type and device type flags to be passed in the request. The device type flags define the removable media indicator. The most significant bit of the device type flags set indicates that the media is removable. Function category and function code must be set up as shown above.
 * Count of Device Type Requested:Returned when the request is completed successfully.

Send Abort
This function causes an abort request to be sent to the device. FUNCTION CATEGORY : 80h FUNCTION CODE    : 57h


 * Data Buffer:This function does not require a data buffer. Status is returned in the Status field of the request packet.

Return Codes
The following table describes return code bit categories. The following table describes bit descriptions. The following table describes SCSI error codes. The SCSI device driver can return any of the standard OS/2 device driver return codes as well as the specific error codes listed above. If Bit 15 is set, Bits 0 - 6 contain an error code. If, in addition, Bit 7 is set, the error code in Bits 0 - 6 is one of the SCSI device driver-specific error codes from the table. Otherwise, it is a standard OS/2 device driver error code, such as unknown_command or invalid_parameter. The DONE bit always is set by the SCSI device driver so that a successful return code is hex 0100, not 0. At initialization time, the returned status is OR'd with hex FF00 by the kernel.

Error Recovery Procedure
The SCSI device driver will not perform any error recovery on the SCSI adapter. The SCSI adapter will not be allocated and, therefore, no error recovery procedure is followed. If a Check Condition is detected, the SCSI device driver will request sense data from the device and return it to the device-specific driver if successful. A return code of hex xx80 indicates that sense data has been returned.

Device-Class Driver Model
The device-class driver model is described briefly here to assist in the design of a device-class driver.

Overview
The device-class driver receives OS/2 request packets from the kernel. It is responsible for mapping the received request to a generic IOCtl request to be passed to the SCSI device driver. When a request from the kernel results in sending a Transfer SCB command to the SCSI driver, the device-class driver allocates the SCB chain header and formats the SCB and the SCB chain header. The TSB also must be allocated. When a request from the kernel results in multiple Transfer SCBs, the device-class driver chains the SCBs and sends only one Transfer SCB command to the SCSI driver. This achieves better performance and guarantees that requests are processed sequentially.

The device-class driver calls the SCSI driver to send the request to the device. The SCSI driver returns to the device-class driver after the request is completed. When a Transfer SCB request completes with an error, the SCSI driver performs a Request Sense command to the device to obtain sense data. The sense data is passed back to the caller in the data buffer area of the generic IOCtl request packet. The device-class driver might take some error-recovery steps at this point or return to the kernel, passing the return code from the device.

Initialization Routine
This routine is called when the device-class driver is first loaded into the system. This routine performs all initialization required for the device-class driver and the device. At Init time, all calls to the SCSI driver are made through the DosDevIoctl interface. Typically, initialization performs the functions in the following list:
 * 1) Performs a return peripheral device count to determine the count of devices attached.
 * 2) Allocates the device.
 * 3) Queries the device to determine whether it is supported.
 * 4) Sets the return code in the request block.
 * 5) Returns the offsets for the end of the code and data segments.

Strategy Routine
This routine receives requests from the kernel at task time. It builds a generic IOCtl request packet and sends it to the SCSI driver through the IDC entry point.

The generic IOCtl request contains the following parameters:
 * FUNCTION CATEGORY 80h
 * FUNCTION CODE Represents function to be performed by the SCSI driver.
 * PARAMETER BUFFER ADDRESS Contains a pointer to the parameters required for the function to be performed.
 * DATA BUFFER ADDRESS Contains a pointer to the data buffer where returned data is stored.

Interrupt Handler
An interrupt handler is not required for the device-class driver. All interrupts from the SCSI peripheral devices are handled by the SCSI driver.

DMA Data Structures
All data structures that will be accessed by the DMA must be locked into memory before calling OS2SCSI.DMD. These data structures include the following:
 * SCB chain header and SCBs
 * Scatter/gather list
 * Scatter/gather data areas
 * TSB
 * Sense data area
 * User data areas.

Subsystem Control Blocks
The SCB commands relieve the system of transferring command blocks to the adapter through programmed input and output. The SCB specifies the desired command and associated parameters. An SCB must begin on a doubleword boundary, and any address translations, from virtual to physical, must be performed by system software before the SCB pointer is loaded into the command interface registers. If 80386 virtual page mode is being used, system software must also ensure that the SCB, data buffers, and termination status block (TSB) areas are locked into memory. The SCB specifies the desired command and associated parameters. When the SCB (or chain of SCBs) has been performed by the adapter, an interrupt request is issued to the system. The adapter presents only one interrupt request at a time to the system.

The following figure shows the format of the subsystem control block as it applies to device-related commands. 15 14  13  12  11  10  9  8  7  6  5  4  3  2  1  0     Remarks

< Command Dependent ---> ND NS C5 C4 C3 C2 C1 C0    Command Word RD ES  RE  PT   0  SS  BB 0  0  0  0  0  0  0  0 CH     Enable Word < Least Significant Word -->    Logical Block < Most Significant Word --->     Address < Least Significant Word -->    System Buffer < Most Significant Word --->     Address < Least Significant Word -->    System Buffer < Most Significant Word --->     Byte Count < Least Significant Word -->    Termination Status < Most Significant Word --->     Block Address < Least Significant Word -->    Optional SCB Chain < Most Significant Word --->     Address < Number of Blocks >    Block Count < Block Size -->    Block Length A command is encoded in the first word of the SCB. The setting of bits 15 - 8 of the first word depends on the specific command identified in bits 5 - 0. If bit 7 (ND) of this word is set to 1, the adapter will not disconnect the target device during command execution. If bit 6 (NS) of this word is set to 1, the adapter will not send any Synchronous Data Transfer Request messages to the target device.

The second word of the SCB is used to enable options that are used to modify a specified command, as shown in the following table.
 * Bit 15 (RD):When this bit is set to 1, the adapter transfers data from the SCSI device or adapter into system memory (read). When this bit is set to 0, the adapter transfers data from system memory to the SCSI device or adapter (write).
 * Bit 14 (ES):When this bit is set to 1, the TSB is transferred to memory only if an error (Interrupt ID = C) is detected. When this bit is set to 0, the TSB is always transferred.
 * Note: This bit should always be set to 1, unless the command requires the TSB when no error occurs; command performance is degraded by unnecessarily writing to memory.


 * Bit 13 (RE):When this bit is set to 1, the adapter automatically retries certain operations that fail. This bit may be set to 0 by diagnostic programs to enhance fault isolation.
 * Normally, this bit should be set to 1. See Word 1 - Retry Counts for more information.


 * Bit 12 (PT):When this bit is set to 1, it allows a single command to write data to or read data from several different areas in memory (buffers) as specified in a list. This list contains up to 16 pairs of values, each pair being a 32-bit address and its related 32-bit count. In the SCB, the system buffer address field contains the address of the list, and the system buffer byte count field contains the length of the list in bytes.
 * Bit 10 (SS):When this bit is set to 1, it allows the amount of data transferred on a read operation to be shorter than the system buffer byte count, specified in the SCB, without generating an error.
 * Bit 9 (BB):When set to 1, this bit forces the adapter to transfer data directly from the SCSI device and not from a copy in the cache. Some buffer maintenance may still be performed by the adapter.
 * Bits 8 - 1:These bits are reserved.
 * Bit 0 (CH):This bit selects the type of chaining condition used in command block transfers. When it is set to 0, chaining is disabled. When command blocks are chained, the SCB must contain the 32-bit address of the next SCB . When this bit is set to 1, chaining will occur if the SCB ends with no error.

System Interface
The following is a list of supported SCBS commands.
 * Note: The hex code represents bits 5 - 0 of the first command word.

The adapter maintains a Command Complete status block for each of the command blocks. The command blocks are updated at the completion of each command. This command status block can be obtained by using the Get Command Complete Status Block command. See Command Complete Status Block.

The format for each command is given following the associated command.

Device Inquiry
Through the SCB Device Inquiry command, the system determines which SCSI devices are attached to the adapter, and specific information about those devices. When the Device Inquiry data block has been transferred, the adapter interrupts the system. Because the length of the returned data block is device-dependent, the system should specify the amount of data to be returned. If this is not known, then the system should specify the maximum value (255) and set the suppress short exception (SS) bit to 1. After the Device Inquiry data block is transferred to the specific address, the adapter interrupts the system to indicate that the command is complete.

If a SCSI device is not attached at the assigned physical SCSI address, the command-completed-with-failure interrupt will be returned in the Interrupt Status register. The Command Complete status will indicate selection time-out. If the SCSI logical unit number is not supported by an attached SCSI physical unit, the device type in the Device Inquiry data block is set to hex 7F by the SCSI physical device. 15 14 13 12 11 10 9  8  7  6  5  4  3  2  1  0    Remarks

0 0  0  1  1  1  0  0 ND NS  0  0  1  0  1  1    Device Inquiry 1 ES RE 0  0 SS  1  0  0  0  0  0  0  0  0 CH    Enable Word <-- Reserved > <-- Reserved > <-- Least Significant Word -->   System Buffer <-- Most Significant Word --->    Address <-- Least Significant Word -->   System Buffer <-- Most Significant Word --->    Byte Count <-- Least Significant Word -->   Termination Status Block <-- Most Significant Word --->    Address <-- Least Significant Word -->   Optional SCB Chain <-- Most Significant Word --->    Address <-- Reserved > <-- Reserved > Device Inquiry Data Block Byte   7  6  5  4  3  2  1  0    Remarks

0       Major Type 1    RMB <- Type Qualifier ->   Removable Media Bit 2      <-ECMA-> <-ANSI->   Standards Compliance 3    <-- Reserved --> 4    <- Additional Length -->   # Of Bytes (N-4) - - - - - - - - - - - - - - - - - - - - - - - - - - 5    <-- Additional Data --->   Additional

.               Inquiry

N    <-- Additional Data --->   Data

ECMA - European Computer Manufacturer's Association ISO - International Standards Organization

For more information about the Device Inquiry data block, refer to the American National Standards Institute SCSI Standard X3.131-1986.

Format Unit
This SCB command is used to format a storage device. Formatting the storage device destroys all data. The device performs defect management as specified in the command. Bits within the command specify the source of the defect list and the use and disposition of any defect list on the device. Because all device data is considered erased, any cache data for the device is cleared. 15 14 13 12 11 10 9  8  7  6  5  4  3  2  1  0    Remarks

0 0  0  1  1  1  0  0 ND NS  0  1  0  1  1  0    Format Unit 0 ES RE 0  0  0  1  0  0  0  0  0  0  0  0 CH    Enable Word <-- Reserved > 0  0  0 FD CL  0  0  0    Modifier Bits <-- Interleave Factor >  Interleave <-- Least Significant Word --->  System Buffer <-- Most Significant Word >   Address <-- Least Significant Word --->  Defect List <-- Most Significant Word >   Byte Count <-- Least Significant Word --->  Termination Status <-- Most Significant Word >   Block Address <-- Least Significant Word --->  Optional SCB Chain <-- Most Significant Word >   Address <-- Number of Blocks ->  Block Count <-- Block Size --->  Block Length The interleave factor used during the format operation is specified in the control block. An interleave factor of 0 selects the device default. A factor of 1 selects sequential numbering of logical blocks. All other factor values are device dependent. Modifier bits select options to be used during formatting and are defined as follows: FD Format Data: When this modifier bit is set to 1, the system supplies a defect list for the format operation. The structure of the list depends on the device being formatted. The system buffer address points to the defect list; the length is specified in the byte count. If this bit is set to 0, no defect list is transferred to the device. Note: Not all SCSI devices support the transfer of a defect list. CL Complete List: If the defect list is supplied, this bit determines whether the supplied defect list is in addition to, or replaces, the defect list already in the device. If the bit is set to 1, any previous defect list is replaced. Note: Only a defect list in the following block format is supported by the adapter. See the ANSI SCSI Standard or specific device specification for more information. Defect List Header Byte       7  6  5  4  3  2  1  0    Remarks

0         <- Reserved -> 1         <- Reserved -BF--> 2         <- High Byte > 3         <- Low Byte -> Defect Descriptors 4         <- High Byte >    First 5         <>    Defective Block 6         <>    Address 7         <- Low Byte -> .                   .                    .            <- High Byte >    Last <>   Defective Block <>   Address N         <- Low Byte -> BF Background Format: When this bit is set to 1, the device performs a background format. If the device supports this option, it checks the format of the command, then returns a command status indicating good status, and starts the format operation. If the device does not support the option, it may return a command status block indicating a check condition. Commands received before completing the background format are returned with a command status block indicating a check condition. The Request Sense command returns a sense key indicating that the device is not ready and returns an additional sense code indicating that a Format operation is in progress. The Request Sense data block also shows the percentage of the format completed.

Get Command Complete Status
This SCB command requests the Command Complete status block for the last command executed on a specified device. When the status block is transferred to the system, the adapter generates an interrupt and updates the Interrupt Status register. 15 14 13 12 11 10 9  8  7  6  5  4  3  2  1  0    Remarks

0 0  0  1  1  1  0  0  0  0  0  0  0  1  1  1    Get Command Status 1 ES RE 0  0  0  1  0  0  0  0  0  0  0  0 CH    Enable Word <-- Reserved > <-- Reserved > <-- Least Significant Word -->   System Buffer <-- Most Significant Word --->    Address 0 0  0  0  0  0  0  0  0  0  0  1  1  0  1  0    System Buffer 0 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0    Byte Count <-- Least Significant Word -->   Termination Status Block <-- Most Significant Word --->    Address <-- Least Significant Word -->   Optional SCB Chain <-- Most Significant Word --->    Address <-- Reserved > <-- Reserved >

Command Complete Status Block
The command complete status block is returned to the location specified in the system buffer address field of the Get Command Complete Status command. It contains the status of the last command to a device. It is unchanged until another command is issued to that device or until a reset occurs.

An optional termination status block is returned automatically whenever an error occurs. This allows command complete status to be returned for error recovery.

The command complete status block and termination status block contain the same information. Word 15 14 13 12 11 10  9  8  7  6  5  4  3  2  1  0  Remarks

0   <-- SCB End Status Word -->  SCB Status 1   <-- Retry Counts ->  Retry Counts 2   <-- Least Significant Word --->  Residual Byte 3   <-- Most Significant Word >  Count 4   <-- Least Significant Word>  Scatter/Gather List 5   <-- Most Significant Word >  Element Address 6    0  0  0  0  0  0  0  0  0  0  0  0  1  1  0  0  Device Dependent Status Length 7   <-- Command Status -->< Device Status >  Command Device Status 8   <-- Command Error --->< Device Error ->  Error Codes 9   <-- Reserved -> A   <-- Cache Information Word ---> B   <-- Least Significant Word --->  Last SCB Address C   <-- Most Significant Word >  Processed

Word 0 - Subsystem Control Block End Status Note: The function indicated is true when the value of the bit is one. Reserved bits are undefined.

Word 1 - Retry Counts

Words 2 and 3 - Residual Byte Count These words contain the number of bytes that were not transferred.

Words 4 and 5 - Scatter/Gather List Element Address These words contain the address of the scatter/gather list element being used when the command was ended.

Word 6 - Device Dependent Status Length This word contains the number of bytes of device status information that follow. This word is set to hex 0C to indicate 12 bytes.

Word 7 - Command and Device Status The following table describes command status codes. Note: All values not shown are reserved. The following table describes device status bytes. The following table describes bytes 4-1 device status code.
 * Note: All values not shown are reserved.

Word 8 - Command Error Code/Device Error Code

The following table describes bits 15-8 command error codes. The following table describes bits 7-0 device error codes.

Word 9 - Reserved Word 9 is reserved

Word A - Cache Information Word Bits 7 - 0 are the cache-read hit ratio (expressed as a percentage in a binary coded decimal format).

The following table describes cache-read hit rations. The following table describes bits 15-8 cache statuses. Word B - Last SCB Address Processed - Low Word Word B is the last SCB address processed (low word)

Word C - Last SCB Address Processed - High Word Word C is the last SCB address processed (high word)

Read Data
This SCB command is used for devices with fixed length blocks, such as fixed disk drives. This command causes the adapter to send the SCSI Read command to the device. The blocks specified are read and the data is transferred to the system.

The Read Data command supports multiple block operations up to 65,535 blocks or 16MB minus 1 byte (MB = 1,048,576 bytes), whichever is less, of total data transferred.

For devices with variable length blocks, such as tape drives, the Send Other SCSI SCB command should be used to generate the SCSI Read command. 15 14 13 12 11 10 9  8  7  6  5  4  3  2  1  0    Remarks

0 0  0  1  1  1  0  0 ND NS  0  0  0  0  0  1    Read Data 1 ES RE PT 0  0 BB  0  0  0  0  0  0  0  0 CH    Enable Word <-- Least Significant Word -->   Logical <-- Most Significant Word --->    Address <-- Least Significant Word -->   System Buffer <-- Most Significant Word --->    Address <-- Least Significant Word -->   System Buffer <-- Most Significant Word --->    Byte Count <-- Least Significant Word -->   Termination Status Block <-- Most Significant Word --->    Address <-- Least Significant Word -->   Optional SCB Chain <-- Most Significant Word --->    Address <-- Number of Blocks >   Block Count <-- Block Size -->   Block Length

Read Device Capacity

This SCB command is used to return the Device Capacity status block of the specific device. 15 14 13 12 11 10 9  8  7  6  5  4  3  2  1  0    Remarks

0 0  0  1  1  1  0  0 ND NS  0  0  1  0  0  1    Read Device Capacity 1 ES RE 0  0  0  1  0  0  0  0  0  0  0  0 CH    Enable Word <-- Reserved > <-- Reserved > <-- Least Significant Word -->   System Buffer <-- Most Significant Word --->    Address 0 0  0  0  0  0  0  0  0  0  0  0  1  0  0  0    System Buffer 0 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0    Byte Count <-- Least Significant Word -->   Termination Status Block <-- Most Significant Word --->    Address <-- Least Significant Word -->   Optional SCB Chain <-- Most Significant Word --->    Address <-- Reserved > <-- Reserved >

Device Capacity Data Block Byte      7  6  5  4  3  2  1  0      Remarks

0        <- High Byte --> 1        <-->     Last Logical 2        <-->     Block Address 3        <- Low Byte ---> 4        <- High Byte --> 5        <-->     Block 6        <-->     Length 7        <- Low Byte --->

Read Prefetch

For this SCB command, the blocks specified are read and the data is transferred into the on-card disk cache for later access by a Read Data command. The block length specified must be 512 bytes and the block count must be less than or equal to 17 for the command to transfer data into the cache. If other values are specified, the command is treated as a no-operation.

This command is supported only by the cached adapter. The non- cached adapter will reject this command with a Command Error Interrupt ID. The presence of a cached adapter can be determined by bit 11 of the Cache Information word in the Command Complete Status Block. If this bit is set to 1, the adapter has a cache. Otherwise, no cache is present. 15 14 13 12 11 10 9  8  7  6  5  4  3  2  1  0    Remarks

0 0  0  1  1  1  0  0 ND NS  1  1  0  0  0  1    Read Prefetch 1 ES RE 0  0  0  1  0  0  0  0  0  0  0  0 CH    Enable Word <-- Least Significant Word -->   Logical Block <-- Most Significant Word --->    Address <-- Reserved > <-- Reserved > <-- Reserved > <-- Reserved > <-- Least Significant Word -->   Termination Status Block <-- Most Significant Word --->    Address <-- Least Significant Word -->   Optional SCB Chain <-- Most Significant Word --->    Address <-- Number of Blocks >   Block Count <-- Block Size -->   Block Length

Read Verify
This SCB command reads the specified blocks of data and checks for errors. Data is not transferred by this command; it serves to verify the readability of the data and the correct operation of the device. This command is used for devices with fixed length blocks, such as fixed disk drives. This command causes the adapter to send the SCSI Read and Verify commands to the device. The blocks specified are read and the data is transferred to the system. The Read Verify command supports multiple block operations up to 65,535 blocks or 16MB minus 1 byte (MB = 1,048,576 bytes), whichever is less, of total data transferred. For devices with variable length blocks, such as tape drives, the Send Other SCSI SCB command should be used to generate the SCSI Read and Verify commands.

15 14 13 12 11 10 9  8  7  6  5  4  3  2  1  0    Remarks

0 0  0  1  1  1  0  0 ND NS  0  0  0  0  1  1    Read Verify 1 ES RE 0  0  0  1  0  0  0  0  0  0  0  0 CH    Enable Word <-- Least Significant Word -->   Logical Block <-- Most Significant Word --->    Address <-- Reserved > <-- Reserved > <-- Reserved > <-- Reserved > <-- Least Significant Word -->   Termination Status Block <-- Most Significant Word --->    Address <-- Least Significant Word -->   Optional SCB Chain <-- Most Significant Word --->    Address <-- Number of Blocks >   Block Count <-- Block Size -->   Block Length

Reassign Block This SCB command reassigns the logical block address for a defective block to a spare block. The system supplies the reassign block defect list. The system buffer address in the command block serves as a pointer to the defect list. Because the device data is considered erased by a Reassign Block command, the cache automatically clears any data from the device having a block reassigned.

15 14 13 12 11 10 9  8  7  6  5  4  3  2  1  0    Remarks

0 0  0  1  1  1  0  0  0  0  0  1  1  0  0  0    Reassign Block 0 ES RE 0  0  0  1  0  0  0  0  0  0  0  0 CH    Enable Word <- Reserved -> <- Reserved -> <- Least Significant Word --->   System Buffer <- Most Significant Word >    Address <- Least Significant Word --->   System Buffer <- Most Significant Word >    Byte Count <- Least Significant Word --->   Termination Status Block <--Most Significant Word >    Address <- Least Significant Word --->   Optional SCB Chain <- Most Significant Word >    Address <- Reserved -> <- Reserved ->

Reassign Block Defect List

Defect List Header Byte       7  6  5  4  3  2  1  0    Remarks

0         <- Reserved -> 1         <- Reserved -> 2         <- High Byte >    Defect List 3         <- Low Byte ->    Length Defect Descriptors 4         <- High Byte > 5         <>    Defective Logical 6         <>    Block 7         <- Low Byte ->    Address

Request Sense
This SCB command is used to return the sense data for the specified device. The adapter interrupts the system when the Sense data block is transferred. The length of the data block depends on the device and can be four bytes (non-extended) or more (extended). The format of the data block for both cases is shown. The system should specify the amount of data to be returned in the SCB based on the particular device attached, or specify the maximum value (255) and set the suppress short exception (SS) bit to 1.

The sense data is valid only if a Check Condition status was returned for the previous command to the device. The sense data provides additional information on the check condition. Refer to the ANSI SCSI publication or the particular SCSI device specification for detailed information about the Request Sense data block. 15 14 13 12 11 10 9  8  7  6  5  4  3  2  1  0    Remarks

0 0  0  1  1  1  0  0 ND NS  0  0  1  0  0  0    Request Sense 1 ES RE 0  0 SS  1  0  0  0  0  0  0  0  0 CH    Enable Word <-- Reserved > <-- Reserved > <-- Least Significant Word -->   System Buffer <-- Most Significant Word --->    Address <-- Least Significant Word -->   System Buffer <-- Most Significant Word --->    Byte Count <-- Least Significant Word -->   Termination Status Block <-- Most Significant Word --->    Address <-- Least Significant Word -->   Optional SCB Chain <-- Most Significant Word --->    Address <-- Reserved > <-- Reserved >

Sense Data Block
Byte              Sense Bits 7 6  5  4  3  2  1  0    Remarks

0          AV   <- Code ->    Error Class/Code 1          X  X  X  < High Byte >    Logical 2          <>    Block 3          <- Low Byte ->    Address

Byte 0 Error Class/Error Code Bit 7 Address Valid: When this bit is set to 1, the logical block address field is valid. Bits 6 - 4 Error Class: When the error class is 0, the sense data block is in the format shown above. When the error class is 7, the sense data block is in the extended format, shown on the following page. All other settings are device dependent. Bits 3 - 0 Error Code: Errors are device dependent.

Bytes 1 - 3 Logical Block Address This address is device dependent. Note: The adapter does not examine or use device-dependent information.

Extended Sense Data Block
Byte              Sense Bits 7 6  5  4  3  2  1  0    Remarks

0          V  1  1  1 <-- Code -->   Error Class/Code 1          <- Segment # ->   Segment Number 2          FM EM IL  X <-- Key -->   Sense Key 3          <- Most Significant -->   Information Bytes 4          <-> 5           <-> 6           <- Least Significant -> 7          <--Additional Length-->   # of Bytes 8          <--Additional Sense -->   Additional .             Sense . N          <--Additional Sense--->   Bytes
 * Byte 0 Error Class/Error Code
 * Bit 7 The Information bytes are valid only if this bit is a 1.
 * Bits 6 - 4 Error class 7 is for extended sense data.
 * Bits 3 - 0 Error code 0 is standard format. Error codes hex 1 - E are reserved. Error code hex F is device dependent.


 * Byte 1 Segment Number:This byte contains the current segment descriptor.
 * Byte 2 Extended Error Bits/Sense Key
 * Bit 7 A filemark (FM) has been reached on a sequential access device.
 * Bit 6 An end of medium (EM) has been reached on a sequential access device.
 * Bit 5 An Invalid Length (IL) resulted when the specified logical block length did not match the device.
 * Bit 4 X - This bit is reserved.
 * Bits 3 - 0 The coding of these bits is shown in the following table.
 * {|class="wikitable"

!Hex Value||Function
 * 0||No Sense
 * 1||Recovered Error
 * 2||Not Ready
 * 3||Medium Error
 * 4||Hardware Error
 * 5||Illegal Request
 * 6||Unit Attention
 * 7||Data Protect
 * 8||Blank Check
 * 9||Device Dependent
 * A||Copy Aborted
 * B||Aborted Command
 * C||Equal
 * D||Volume Overflow
 * E||Miscompare
 * F||Reserved
 * }
 * Bytes 3 - N Device-Dependent Status: Refer to the particular device specifications for a definition of these bytes.
 * 9||Device Dependent
 * A||Copy Aborted
 * B||Aborted Command
 * C||Equal
 * D||Volume Overflow
 * E||Miscompare
 * F||Reserved
 * }
 * Bytes 3 - N Device-Dependent Status: Refer to the particular device specifications for a definition of these bytes.
 * D||Volume Overflow
 * E||Miscompare
 * F||Reserved
 * }
 * Bytes 3 - N Device-Dependent Status: Refer to the particular device specifications for a definition of these bytes.
 * }
 * Bytes 3 - N Device-Dependent Status: Refer to the particular device specifications for a definition of these bytes.

Note: The adapter does not examine or use device-dependent information.

Send Other SCSI Command (SCSI CDB)
This SCB command is used to send any SCSI command not supported by the adapter directly to a SCSI device. The command to be issued is placed at the end of the SCB. When commands are issued directly to a device using this command, messages are handled by the adapter. Data transfer direction is controlled by the read-option bit (RD) in the Enable word. When this bit is set to 1, the adapter transfers data to the system from the device. When the read-option bit is set to 0, the adapter transfers data to the device from the system. If the system-buffer byte count specified in the SCB is 0, no data is transferred. Because device data can be altered by this command, the cache is automatically cleared of any data from that device.


 * Note: This command should be used only when other commands cannot perform the operation; otherwise, performance of the SCSI subsystem can be impacted.
 * This command should be issued only to logical device numbers 0 to 14.

15 14 13 12 11 10 9  8  7  6  5  4  3  2  1  0    Remarks

0 0  1  0  0  1  0  0 ND NS  0  1  1  1  1  1    Send Other SCSI Command RD ES RE PT 0 SS  1  0  0  0  0  0  0  0  0 CH    Enable Word <-- Reserved -><-- SCSI CMD Length ---> <-- Reserved -> <-- Least Significant Word --->   System Buffer <-- Most Significant Word >    Address <-- Least Significant Word --->   System Buffer <-- Most Significant Word >    Byte Count <-- Least Significant Word --->   Termination Status Block <-- Most Significant Word >    Address <-- Least Significant Word --->   Optional SCB Chain <-- Most Significant Word >    Address <---1--- SCSI Command ---0>   SCSI Command <---3--- SCSI Command ---2> <---5--- SCSI Command ---4>   Six Bytes or <---7--- SCSI Command ---6> <---9--- SCSI Command ---8>   Ten Bytes or <--11--- SCSI Command --10>    Twelve Bytes

Write Data
This SCB command writes data from the system to the device in consecutive blocks. This command is used for devices with fixed length blocks, such as fixed disk drives. This command causes the adapter to send the SCSI Write command to the device. The blocks specified are read and the data is transferred to the system. No verification is performed.

The Read Data command supports multiple block operations up to 65,535 blocks or 16MB minus 1 byte (MB = 1,048,576 bytes), whichever is less, of total data transferred.

For devices with variable length blocks, such as tape drives, the Send Other SCSI SCB command should be used to generate the SCSI Write command. 15 14 13 12 11 10 9  8  7  6  5  4  3  2  1  0    Remarks 0 0  0  1  1  1  0  0 ND NS  0  0  0  0  1  0    Write Data 0 ES RE PT 0  0 BB  0  0  0  0  0  0  0  0 CH    Enable Word <-- Least Significant Word --->  Logical Block <-- Most Significant Word >   Address <-- Least Significant Word --->  System Buffer <-- Most Significant Word >   Address <-- Least Significant Word --->  System Buffer <-- Most Significant Word >   Byte Count <-- Least Significant Word --->  Termination Status Block <-- Most Significant Word >   Address <-- Least Significant Word --->  Optional SCB Chain <-- Most Significant Word >   Address <-- Number of Blocks ->  Block Count <-- Block Size --->  Block Length

Write with Verify
This SCB command is similar to Write Data, except that a Read Verify command is performed after all blocks are written. This command is used for devices with fixed length blocks, such as fixed disk drives. This command causes the adapter to send the SCSI Write and Verify commands to the device. The blocks specified are read and the data is transferred to the system.

The Write with Verify command supports multiple block operations up to 65 535 blocks or 16MB minus 1 byte (MB = 1,048,576 bytes), whichever is less, of total data transferred.

If an error occurs during a Write with Verify command, the system should retry the command. If all retries of the command fail, the system can allocate a spare block to replace the failing one through the Reassign Block command, and then reissue the command.

For devices with variable length blocks, such as tape drives, the Send Other SCSI SCB command should be used to generate the SCSI Write and Verify commands.

15 14 13 12 11 10 9  8  7  6  5  4  3  2  1  0    Remarks 0 0  0  1  1  1  0  0 ND NS  0  0  0  1  0  0     Write Verify 0 ES RE PT 0  0 BB  0  0  0  0  0  0  0  0 CH     Enable Word <-- Least Significant Word --->   Logical Block <-- Most Significant Word >    Address <-- Least Significant Word --->   System Buffer <-- Most Significant Word >    Address <-- Least Significant Word --->   System Buffer <-- Most Significant Word >    Byte Count <-- Least Significant Word --->   Termination Status Block <-- Most Significant Word >    Address <-- Least Significant Word --->   Optional SCB Chain <-- Most Significant Word >    Address <-- Number of Blocks ->   Block Count <-- Block Size --->   Block Length