Jump to content

OS/2 SCSI Device Driver Interface Specification: Difference between revisions

From EDM2
No edit summary
Ak120 (talk | contribs)
 
(3 intermediate revisions by the same user not shown)
Line 2: Line 2:
{{IBM-Reprint}}
{{IBM-Reprint}}


==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.
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===
==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.  
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.
<pre>
<pre>
  /-----------------------------------------------------------\
┌───────────────────────────────────────────────────────────┐
  |                                                           |
                                                         
  |                                                           |
                                                         
  |                       OS/2 KERNEL                        |
                      OS/2 KERNEL                       
  |                                                           |
                                                         
  |                                                           |
                                                         
  \-----------------------------------------------------------/
└──────┬──────────────────┬─────────────────┬───────────────┘
          |                 |                 |
        │                                
          |                 |                 |
        │                                
  /--------------\ /----------------\ /--------------\
┌──────┴───────┐ ┌────────┴───────┐ ┌───────┴──────┐
  | CDROM CLASS  | | OPTICAL CLASS | | OTHER CLASS  | ....
CDROM CLASS  │ │ OPTICAL CLASS │ │ OTHER CLASS  ....
  |   DRIVER    | |     DRIVER    | |   DRIVER    |
  DRIVER    │ │     DRIVER    │ │   DRIVER   
  \--------------/ \----------------/ \--------------/
└──────┬───────┘ └────────┬───────┘ └───────┬──────┘
          |                 |                 |
        │                                
          |                 |                 |
        │                                
  /-----------------------------------------------------------\
┌──────┴──────────────────┴─────────────────┴───────────────┐
  |                                                           |
                                                         
  |             OS2SCSI.DMD SCSI DEVICE MANAGER              |
            OS2SCSI.DMD SCSI DEVICE MANAGER             
  |                                                           |
                                                         
  \-----------------------------------------------------------/
└─────────────────────────────┬─────────────────────────────┘
                                |
                              │
                                |
                              │
  /-----------------------------------------------------------\
┌─────────────────────────────┴─────────────────────────────┐
  |                         SCSI ADD                          |
                        SCSI ADD                         
  \-----------------------------------------------------------/
└─────────────────────────────┬─────────────────────────────┘
                                |
                              │
  /-----------------------------------------------------------\
┌─────────────────────────────┴─────────────────────────────┐
  |                       SCSI ADAPTER                      |
                      SCSI ADAPTER                     
  \-----------------------------------------------------------/
└──────┬─────────────────┬──────────────────┬───────────────┘
          |                 |                 |
        │                                
  /--------------\ /----------------\ /--------------\
┌──────┴───────┐ ┌───────┴────────┐ ┌───────┴──────┐
  | CDROM SCSI  | | OPTICAL SCSI  | | OTHER SCSI  | ....
CDROM SCSI  │ │ OPTICAL SCSI  │ │ OTHER SCSI  ....
  |   DEVICE    | |     DEVICE    | |   DEVICE    |
  DEVICE    │ │     DEVICE    │ │   DEVICE   
  \--------------/ \----------------/ \--------------/
└──────────────┘ └────────────────┘ └──────────────┘
</pre>
</pre>
The diagram illustrates the relationship between the device drivers and their interaction with other components of the system.
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.
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.
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.  
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===
==Naming Conventions==
*'''SCSI Driver'''<br />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.
*'''''SCSI Driver'''''<br />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.
*'''IBM Device-Class Drivers'''<br />Current device driver names used by IBM are:<br />OPTICAL.SYS Read/Write optical device driver<br />'''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.  
*'''''IBM Device-Class Drivers'''''<br />Current device driver names used by IBM are:<br />OPTICAL.SYS Read/Write optical device driver<br />'''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.
*'''Message Files'''<br />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.
*'''''Message Files'''''<br />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.


===Generic IOCtl Request===
==Generic IOCtl Request==
The input to the SCSI driver is a generic IOCtl request packet, pointed to by the ES:BX register pair.  
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.  
;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===
===OS/2 SCSI Services===
The SCSI driver supports the following requests:  
The SCSI driver supports the following requests:
*Read Device Parameters
*Read Device Parameters
*Reset/Initialization
*Reset/Initialization
Line 74: Line 74:
*Allocate Device
*Allocate Device
*Return Peripheral Type Count
*Return Peripheral Type Count
*Abort  
*Abort


====Read Device Parameters====
====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.  
This function returns some information about the device. The logical unit number (LUN) is required if a Send Other command is used.
Input Parameter Structure  
{|
Field Length Device Handle WORD  
|+Input Parameter Structure
!Field||Length
|-
|Device Handle||WORD
|}


FUNCTION CATEGORY : 80h
FUNCTION CATEGORY : 80h
FUNCTION CODE    : 43h
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.
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.
<pre>
{|class="wikitable"
|Field Name             |Length
!Field Name||Length
|------------------------+-----
|-
|Device Key Index       |WORD  
|Device Key Index||WORD
|------------------------+-----
|-
|SCB Architecture Card   |BYTE
|SCB Architecture Card Comp. Level||BYTE
|Comp. Level             |    
|-
|------------------------+-----
|Adapter Index||BYTE
|Adapter Index           |BYTE  
|-
|------------------------+-----
|Device Flags||WORD
|Device Flags           |WORD  
|-
|------------------------+-----
|Logical unit number (LUN)||BYTE
|Logical unit number     |BYTE
|-
|(LUN)                   |    
|Physical unit number (PUN)||BYTE
|------------------------+-----
|}
|Physical unit number   |BYTE
;Adapter:Index contains the adapter number for the SCSI adapter.
|(PUN)                   |    
;Device Flags:Bit 4
</pre>
::0 = Adapter cache not supported.
Adapter Index contains the adapter number for the SCSI adapter.  
::1 = Adapter cache supported.
Device Flags  
:Bit 1
Bit 4 0 = Adapter cache not supported. 1 = Adapter cache supported.  
::0 = Device power ON.
Bit 1 0 = Device power ON. 1 = Device power OFF.  
::1 = Device power OFF.
Bit 0 0 = Device is not defective. 1 = Device is defective.  
:Bit 0
::0 = Device is not defective.
::1 = Device is defective.


====Reset/Initialize====
====Reset/Initialize====
This function results in a reset message being issued to the physical device.  
This function results in a reset message being issued to the physical device.
Input Parameter Structure  
{|
Field Length Device Handle WORD Sense Data Size WORD  
|+Input Parameter Structure
!Field||Length
|-
|Device Handle||WORD
|-
|Sense Data Size||WORD
|}


FUNCTION CATEGORY : 80h
FUNCTION CATEGORY : 80h
FUNCTION CODE    : 45h
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.  
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  
;Data Buffer:This function does not require a data buffer. Status is returned in the Status field of the request packet.
This function does not require a data buffer. Status is returned in the Status field of the request packet.


====Enable Adapter Cache====
====Enable Adapter Cache====
This function enables the adapter cache capability for all subsequent commands to this device.  
This function enables the adapter cache capability for all subsequent commands to this device.  
Input Parameter Structure  
{|
Field Length Device Handle WORD  
|+Input Parameter Structure
!Field||Length
|-
|Device Handle||WORD
|}


FUNCTION CATEGORY : 80h
FUNCTION CATEGORY : 80h
FUNCTION CODE    : 4Dh
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.  
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  
;Data Buffer:This function does not require a data buffer. Status is returned in the Status field of the request packet.
This function does not require a data buffer. Status is returned in the Status field of the request packet.  


====Disable Adapter Cache====
====Disable Adapter Cache====
This function disables the adapter cache capability for subsequent commands to the specified device.  
This function disables the adapter cache capability for subsequent commands to the specified device.
Input Parameter Structure  
{|
Field Length Device Handle WORD  
|+Input Parameter Structure
!Field||Length
|-
|Device Handle||WORD
|}


FUNCTION CATEGORY : 80h
FUNCTION CATEGORY : 80h
FUNCTION CODE    : 4Eh
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.  
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  
;Data Buffer:This function does not require a data buffer. Status is returned in the Status field of the request packet.
This function does not require a data buffer. Status is returned in the Status field of the request packet.


====Return Adapter Cache Status====
====Return Adapter Cache Status====
This function returns the adapter cache status for the specified device.  
This function returns the adapter cache status for the specified device.  
Input Parameter Structure  
{|
Field Length Device HandleWORD
|+Input Parameter Structure
!Field||Length
|-
|Device Handle||WORD
|}


FUNCTION CATEGORY : 80h
FUNCTION CATEGORY : 80h
FUNCTION CODE    : 4Fh
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.
|Field Name                    |Length
|------------------------------+-------
|Adapter Cache Status          |BYTE 


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.
{|class="wikitable"
!Field Name||Length
|-
|Adapter Cache Status||BYTE
|}
Adapter Cache Status : 00H  Enabled
Adapter Cache Status : 00H  Enabled
                       01H  Disabled
                       01H  Disabled


====Set Device Timeout====
====Set Device Timeout====
This function sets the timeout value for this device.  
This function sets the timeout value for this device.
Input Parameter Structure  
{|
Field Length Timeout ValueDWORD
|+Input Parameter Structure
!Field||Length
|-
|Timeout Value||DWORD
|}


FUNCTION CATEGORY : 80h
FUNCTION CATEGORY : 80h
FUNCTION CODE    : 50h
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.  
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  
;Data Buffer:This function does not require a data buffer. Status is returned in the Status field of the request packet.
This function does not require a data buffer. Status is returned in the Status field of the request packet.  


====Read Device Timeout====
====Read Device Timeout====
This function returns the current timeout value for this device.  
This function returns the current timeout value for this device.
Input Parameter Structure  
{|
Field Length Device HandleWORD
|+Input Parameter Structure
!Field||Length
|-
|Device Handle||WORD
|}


FUNCTION CATEGORY : 80h
FUNCTION CATEGORY : 80h
FUNCTION CODE    : 51h
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.  
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.
|Field Name             |Length  
{|
|------------------------+-------
!Field Name||Length
|Timeout Value           |DWORD
|-
 
|Timeout Value||DWORD
The timeout value is in milliseconds.  
|}
The timeout value is in milliseconds.


====Transfer SCB====
====Transfer SCB====
This function causes an SCB or a chain of SCBs to be sent to the adapter.
This function causes an SCB or a chain of SCBs to be sent to the adapter.
|Field Name                                   |Length
{|
|---------------------------------------------+----------
!Field Name||Length
|Device Handle                               |WORD    
|-
|---------------------------------------------+----------
|Device Handle||WORD
|Sense Data Size                             |WORD    
|-
|---------------------------------------------+----------
|Sense Data Size||WORD
|Physical Pointer to SCB                     |DWORD    
|-
|---------------------------------------------+----------
|Physical Pointer to SCB||DWORD
|Logical Pointer to SCB Chain Header         |DWORD    
|-
|---------------------------------------------+----------
|Logical Pointer to SCB Chain Header||DWORD
|Flags                                       |BYTE    
|-
|Flags||BYTE
|}
FUNCTION CATEGORY : 80h
FUNCTION CODE    : 52h


FUNCTION CATEGORY : 80h
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.
FUNCTION CODE    : 52h
;Flags:Bit 0 = 0 Normal Length SCB 1 Long SCB
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.
;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.


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.
Flags
Bit 0 = 0 Normal Length SCB 1 Long SCB
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.
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
SCB Chain Header
<pre>
<pre>
          +00h  /----------------------------\
+00h  ┌────────────────────────────┐
                |   Reserved                |
      │   Reserved               
          +02h  |----------------------------|
+02h  ├────────────────────────────┤
                |   Logical Pointer to next  |
      │   Logical Pointer to next 
                |- SCB Chain Header        -|
      ├─ SCB Chain Header        ─┤
                |                           |
      │                          
          +06h  |----------------------------|
+06h  ├────────────────────────────┤
                |   Reserved                |
      │   Reserved               
          +08h  |----------------------------|
+08h  ├────────────────────────────┤
                |   Reserved                |
      │   Reserved               
          +0Ah  |----------------------------|
+0Ah  ├────────────────────────────┤
                |   Logical Pointer to TSB  |
      │   Logical Pointer to TSB 
                |-                         -|
      ├─                         ─┤
                |                           |
      │                          
          +0Eh  |----------------------------|
+0Eh  ├────────────────────────────┤
                |   Reserved                |
      │   Reserved               
          +10h  |----------------------------|
+10h  ├────────────────────────────┤
                |                           |
      │                          
                |                           |
      │                          
                |           SCB            |
      │           SCB           
                |                           |
      │                          
                |       Immediately        |
      │       Immediately       
                |                           |
      │                          
                |           Follows          |
      │           Follows         
                |                           |
      │                          
                |             the            |
      │             the           
                |                           |
      │                          
                |           Chain          |
      │           Chain         
                |                           |
      │                          
                |           Header          |
      │           Header         
                |                           |
      │                          
                |                           |
      │                          
                \----------------------------/
      └────────────────────────────┘
</pre>
</pre>
See Subsystem Control Blocks for a description of the SCB architecture.  
See Subsystem Control Blocks for a description of the SCB architecture.


====Allocate Device====
====Allocate Device====
This function allocates a SCSI peripheral device and returns the device handle that will be used to access the device.  
This function allocates a SCSI peripheral device and returns the device handle that will be used to access the device.  
Input Parameter Structure  
{|
Field Length Device Peripheral Type BYTE Device Type Flags BYTE Nth Available WORD  
|+Input Parameter Structure
!Field||Length
|-
|Device Peripheral Type||BYTE
|-
|Device Type Flags||BYTE
|-
|Nth Available||WORD
|}
FUNCTION CATEGORY : 80h
FUNCTION CODE    : 55h


FUNCTION CATEGORY : 80h
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.
FUNCTION CODE    : 55h
*SCSI Device Types
 
:Direct Access 0x00
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.  
:Sequential Access 0x01
*SCSI Device Types Direct Access0x00 Sequential Access0x01 Printer0x02 Processor0x03 Write Once/Read Many0x04 CD-ROM0x05 Scanner0x06 Optical Memory0x07 Medium Changer0x08 Communications0x09
:Printer 0x02
Data Buffer
:Processor 0x03
|Field Name         |Length
:Write Once/Read Many 0x04
|--------------------+------
:CD-ROM 0x05
|Device Handle       |WORD
:Scanner 0x06
Device Handle Returned to the caller.
:Optical Memory 0x07
:Medium Changer 0x08
:Communications 0x09
{|
|+Data Buffer
!Field Name||Length
|-
|Device Handle||WORD
|}
;Device Handle:Returned to the caller.


====Deallocate Device====
====Deallocate Device====
This function deallocates the SCSI Peripheral Device assigned to this device handle.  
This function deallocates the SCSI Peripheral Device assigned to this device handle.  
Input Parameter Structure  
{|
Field Length Device HandleWORD
|+Input Parameter Structure
 
!Field||Length
FUNCTION CATEGORY : 80h
|-
FUNCTION CODE    : 54h
|Device Handle||WORD
|}
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.  
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  
;Data Buffer:This function does not require a data buffer. Status is returned in the Status field of the request packet.
This function does not require a data buffer. Status is returned in the Status field of the request packet.  


====Return Peripheral Type Count====
====Return Peripheral Type Count====
This function returns a count of the number of devices of a particular type that are detected.  
This function returns a count of the number of devices of a particular type that are detected.  
Input Parameter Structure  
{|
Field Length Device Peripheral TypeBYTE Device Type FlagsBYTE
|+Input Parameter Structure
!Field||Length
|-
|Device Peripheral Type||BYTE
|-
|Device Type Flags||BYTE
|}
  FUNCTION CATEGORY : 80h
  FUNCTION CATEGORY : 80h
  FUNCTION CODE    : 56h
  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.  
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.
|Field Name         |Length
{|
|--------------------+------
!Field Name||Length
|Count of Device Type|WORD
|-
|Requested          |
|Count of Device Type Requested||WORD
Count of Device Type Requested Returned when the request is completed successfully.  
|}
;Count of Device Type Requested:Returned when the request is completed successfully.


====Send Abort====
====Send Abort====
This function causes an abort request to be sent to the device.  
This function causes an abort request to be sent to the device.
Input Parameter Structure  
{|
Field Length Device Handle WORD Sense Data Size WORD Reserved DWORD  
|+Input Parameter Structure
!Field||Length
|-
|Device Handle||WORD
|-
|Sense Data Size||WORD
|-
|Reserved||DWORD
|}
FUNCTION CATEGORY : 80h
FUNCTION CODE    : 57h


FUNCTION CATEGORY : 80h
;Data Buffer:This function does not require a data buffer. Status is returned in the Status field of the request packet.
FUNCTION CODE    : 57h


;Data Buffer
==Return Codes==
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 return code bit categories.
{|class="wikitable"
{|class="wikitable"
!Bit Numbers
!Bit Numbers||Category
!Category
|-
|-
|15
|15||ERROR
|ERROR
|-
|-
|10 - 14
|10 - 14||RESERVED
|RESERVED
|-
|-
|9
|9||BUSY
|BUSY
|-
|-
|8
|8||DONE
|DONE
|-
|-
|7
|7||SCSI ERROR
|SCSI ERROR
|-
|-
|0 - 6
|0 - 6||ERROR CODE (when Bit 15 = 1)
|ERROR CODE (when Bit 15 = 1)
|}
|}
The following table describes bit descriptions.  
The following table describes bit descriptions.
{|class="wikitable"
{|class="wikitable"
!Bit
!Bit||Description
!Description
|-
|-
|07
|07||SCSI Driver-Specific Error
|SCSI Driver-Specific Error
|-
|-
|08
|08||Operation Complete
|Operation Complete
|-
|-
|15
|15||Request Completed with Error
|Request Completed with Error
|}
|}
The following table describes SCSI error codes.  
The following table describes SCSI error codes.
{|class="wikitable"
{|class="wikitable"
!Error Code
!Error Code||Description
!Description
|-
|-
|00h
|00h||Device Error (Sense Data Returned)
|Device Error (Sense Data Returned)
|-
|-
|01h
|01h||Timeout Error
|Timeout Error
|-
|-
|02h
|02h||Unusual Wakeup Error
|Unusual Wakeup Error
|-
|-
|03h
|03h||DevHlp Error
|DevHlp Error
|-
|-
|04h
|04h||Request Block Not Available
|Request Block Not Available
|-
|-
|05h
|05h||Maximum Device Support Exceeded
|Maximum Device Support Exceeded
|-
|-
|06h
|06h||Interrupt Level Not Available
|Interrupt Level Not Available
|-
|-
|07h
|07h||Device Not Available
|Device Not Available
|-
|-
|08h
|08h||More IRQ Levels than Adapters
|More IRQ Levels than Adapters
|-
|-
|09h
|09h||Device Busy
|Device Busy
|-
|-
|0Ah
|0Ah||Request Sense Failed
|Request Sense Failed
|-
|-
|0Bh
|0Bh||Adapter Cache Not Supported
|Adapter Cache Not Supported
|}
|}
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.  
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.  
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.  
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.  
At initialization time, the returned status is OR'd with hex FF00 by the kernel.


===Error Recovery Procedure===
==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.  
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.  
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===
==Device-Class Driver Model==
The device-class driver model is described briefly here to assist in the design of a device-class driver.  
The device-class driver model is described briefly here to assist in the design of a device-class driver.


====Overview====
===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 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.  
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====
===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:  
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:
#Performs a return peripheral device count to determine the count of devices attached.
#Performs a return peripheral device count to determine the count of devices attached.
#Allocates the device.
#Allocates the device.
#Queries the device to determine whether it is supported.
#Queries the device to determine whether it is supported.
#Sets the return code in the request block.
#Sets the return code in the request block.
#Returns the offsets for the end of the code and data segments.  
#Returns the offsets for the end of the code and data segments.


====Strategy Routine====
===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.
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:  
The generic IOCtl request contains the following parameters:
*FUNCTION CATEGORY 80h
*FUNCTION CATEGORY 80h
*FUNCTION CODE Represents function to be performed by the SCSI driver.  
*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.
*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.
*DATA BUFFER ADDRESS Contains a pointer to the data buffer where returned data is stored.


====Interrupt Handler====
===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.
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====
===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:  
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
*SCB chain header and SCBs
*Scatter/gather list
*Scatter/gather list
Line 425: Line 465:
*TSB
*TSB
*Sense data area
*Sense data area
*User data areas.  
*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.


===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.
The following figure shows the format of the subsystem control block as it applies to device-related commands.
<pre>
<pre>
Line 448: Line 489:
<------------ Block Size -------------------------->    Block Length
<------------ Block Size -------------------------->    Block Length
</pre>
</pre>
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.  
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.
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.
<pre>
{|class="wikitable"
|Bit  |Symbol|Function
!Bit||Symbol||Function
|------+------+-------------------------------
|-
|15   |RD   |Input/Output Control          
|15||RD||Input/Output Control
|------+------+-------------------------------
|-
|14   |ES   |Report TSB Status Only on Error
|14||ES||Report TSB Status Only on Error
|------+------+-------------------------------
|-
|13   |RE   |Retry Enable                  
|13||RE||Retry Enable
|------+------+-------------------------------
|-
|12   |PT   |Pointer to List              
|12||PT||Pointer to List
|------+------+-------------------------------
|-
|10   |SS   |Suppress Exception Short      
|10||SS||Suppress Exception Short
|------+------+-------------------------------
|-
|9     |BB   |Bypass Buffer                
|9||BB||Bypass Buffer
|------+------+-------------------------------
|-
|8 - 1 |     |Reserved                      
|8 - 1|| ||Reserved
|------+------+-------------------------------
|-
|0     |CH   |Chain on No Error            
|0||CH||Chain on No Error
|------+------+-------------------------------
|-
|     |     |
| || ||
</pre>
|}
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 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.
;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.
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.
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.  
: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 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 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.  
;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.  
;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.  
;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===
===System Interface===
The following is a list of supported SCBS commands.
The following is a list of supported SCBS commands.
<pre>
{|class="wikitable"
|Command   |Command                                  |Hex   |
!Command Type||Command||Hex Code
|Type      |                                          |Code   |
|-
|-----------+------------------------------------------+-------|
|SCB||Device Inquiry||0B
|SCB       |Device Inquiry                           |0B     |
|-
|-----------+------------------------------------------+-------|
|SCB||Format Unit||16
|SCB       |Format Unit                               |16     |
|-
|-----------+------------------------------------------+-------|
|SCB||Get Command Complete Status||07
|SCB       |Get Command Complete Status               |07     |
|-
|-----------+------------------------------------------+-------|
|SCB||Read Data||01
|SCB       |Read Data                                 |01     |
|-
|-----------+------------------------------------------+-------|
|SCB||Read Device Capacity||09
|SCB       |Read Device Capacity                     |09     |
|-
|-----------+------------------------------------------+-------|
|SCB||Read Prefetch||31
|SCB       |Read Prefetch                             |31     |
|-
|-----------+------------------------------------------+-------|
|SCB||Read Verify||03
|SCB       |Read Verify                               |03     |
|-
|-----------+------------------------------------------+-------|
|SCB||Reassign Block||18
|SCB       |Reassign Block                           |18     |
|-
|-----------+------------------------------------------+-------|
|SCB||Request Sense||08
|SCB       |Request Sense                             |08     |
|-
|-----------+------------------------------------------+-------|
|SCB||Send Other SCSI Command (SCSI CDB)||1F
|SCB       |Send Other SCSI Command (SCSI CDB)       |1F     |
|-
|-----------+------------------------------------------+-------|
|SCB||Write Data||02
|SCB       |Write Data                               |02     |
|-
|-----------+------------------------------------------+-------|
|SCB||Write with Verify||04
|SCB       |Write with Verify                         |04     |
|}
</pre>
;Note: The hex code represents bits 5 - 0 of the first command word.
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 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.  
 
The format for each command is given following the associated command.


Device Inquiry
====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.


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.
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.
<pre>
<pre>
15 14 13 12 11 10  9  8  7  6  5  4  3  2  1  0    Remarks
15 14 13 12 11 10  9  8  7  6  5  4  3  2  1  0    Remarks
Line 525: Line 568:
  0  0  0  1  1  1  0  0 ND NS  0  0  1  0  1  1    Device Inquiry
  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
  1 ES RE  0  0 SS  1  0  0  0  0  0  0  0  0 CH    Enable Word
  &lt;---------- Reserved ------------------------>
  <---------- Reserved ------------------------>
  &lt;---------- Reserved ------------------------>
  <---------- Reserved ------------------------>
  &lt;---------- Least Significant Word ----------&gt;   System Buffer
  <---------- Least Significant Word ---------->   System Buffer
  &lt;---------- Most Significant Word -----------&gt;     Address
  <---------- Most Significant Word ----------->     Address
  &lt;---------- Least Significant Word ----------&gt;   System Buffer
  <---------- Least Significant Word ---------->   System Buffer
  &lt;---------- Most Significant Word -----------&gt;     Byte Count
  <---------- Most Significant Word ----------->     Byte Count
  &lt;---------- Least Significant Word ----------&gt;   Termination Status Block
  <---------- Least Significant Word ---------->   Termination Status Block
  &lt;---------- Most Significant Word -----------&gt;     Address
  <---------- Most Significant Word ----------->     Address
  &lt;---------- Least Significant Word ----------&gt;   Optional SCB Chain
  <---------- Least Significant Word ---------->   Optional SCB Chain
  &lt;---------- Most Significant Word -----------&gt;     Address
  <---------- Most Significant Word ----------->     Address
  &lt;---------- Reserved ------------------------&gt;
  <---------- Reserved ------------------------>
  &lt;---------- Reserved ------------------------&gt;
  <---------- Reserved ------------------------>
</pre>
</pre>
Device Inquiry Data Block
Device Inquiry Data Block
Line 542: Line 585:
Byte    7  6  5  4  3  2  1  0    Remarks
Byte    7  6  5  4  3  2  1  0    Remarks


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


                 .                Inquiry
                 .                Inquiry


  N    &lt;-- Additional Data ---&gt;   Data
  N    <-- Additional Data --->   Data
</pre>
</pre>


Line 567: Line 610:
  0  0  0  1  1  1  0  0 ND NS  0  1  0  1  1  0    Format Unit
  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
  0 ES RE  0  0  0  1  0  0  0  0  0  0  0  0 CH    Enable Word
  &lt;------ Reserved ----&gt; 0  0  0 FD CL  0  0  0    Modifier Bits
  <------ Reserved ----> 0  0  0 FD CL  0  0  0    Modifier Bits
  &lt;---------- Interleave Factor ----------------&gt;   Interleave
  <---------- Interleave Factor ---------------->   Interleave
  &lt;---------- Least Significant Word -----------&gt;   System Buffer
  <---------- Least Significant Word ----------->   System Buffer
  &lt;---------- Most Significant Word ------------&gt;   Address
  <---------- Most Significant Word ------------>   Address
  &lt;---------- Least Significant Word -----------&gt;   Defect List
  <---------- Least Significant Word ----------->   Defect List
  &lt;---------- Most Significant Word ------------&gt;   Byte Count
  <---------- Most Significant Word ------------>   Byte Count
  &lt;---------- Least Significant Word -----------&gt;   Termination Status
  <---------- Least Significant Word ----------->   Termination Status
  &lt;---------- Most Significant Word ------------&gt;   Block Address
  <---------- Most Significant Word ------------>   Block Address
  &lt;---------- Least Significant Word -----------&gt;   Optional SCB Chain
  <---------- Least Significant Word ----------->   Optional SCB Chain
  &lt;---------- Most Significant Word ------------&gt;   Address
  <---------- Most Significant Word ------------>   Address
  &lt;---------- Number of Blocks -----------------&gt;   Block Count
  <---------- Number of Blocks ----------------->   Block Count
  &lt;---------- Block Size -----------------------&gt;   Block Length
  <---------- Block Size ----------------------->   Block Length
</pre>
</pre>
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.  
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.  
Line 591: Line 634:




  0          &lt;----- Reserved -----&gt;
  0          <----- Reserved ----->
  1          &lt;----- Reserved -BF--&gt;
  1          <----- Reserved -BF-->
  2          &lt;----- High Byte ----&gt;
  2          <----- High Byte ---->
  3          &lt;----- Low Byte -----&gt;
  3          <----- Low Byte ----->
               Defect Descriptors
               Defect Descriptors
  4          &lt;----- High Byte ----&gt;   First
  4          <----- High Byte ---->   First
  5          &lt;--------------------&gt;   Defective Block
  5          <-------------------->   Defective Block
  6          &lt;--------------------&gt;   Address
  6          <-------------------->   Address
  7          &lt;----- Low Byte -----&gt;
  7          <----- Low Byte ----->
                     .
                     .
                     .
                     .
                     .
                     .
             &lt;----- High Byte ----&gt;   Last
             <----- High Byte ---->   Last
             &lt;--------------------&gt;   Defective Block
             <-------------------->   Defective Block
             &lt;--------------------&gt;   Address
             <-------------------->   Address
  N          &lt;----- Low Byte -----&gt;
  N          <----- Low Byte ----->
</pre>
</pre>
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.  
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.  
Line 618: Line 661:
  0  0  0  1  1  1  0  0  0  0  0  0  0  1  1  1    Get Command Status
  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
  1 ES RE  0  0  0  1  0  0  0  0  0  0  0  0 CH    Enable Word
  &lt;---------- Reserved ------------------------&gt;
  <---------- Reserved ------------------------>
  &lt;---------- Reserved ------------------------&gt;
  <---------- Reserved ------------------------>
  &lt;---------- Least Significant Word ----------&gt;   System Buffer
  <---------- Least Significant Word ---------->   System Buffer
  &lt;---------- Most Significant Word -----------&gt;     Address
  <---------- 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  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
  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0    Byte Count
  &lt;---------- Least Significant Word ----------&gt;   Termination Status Block
  <---------- Least Significant Word ---------->   Termination Status Block
  &lt;---------- Most Significant Word -----------&gt;     Address
  <---------- Most Significant Word ----------->     Address
  &lt;---------- Least Significant Word ----------&gt;   Optional SCB Chain
  <---------- Least Significant Word ---------->   Optional SCB Chain
  &lt;---------- Most Significant Word -----------&gt;     Address
  <---------- Most Significant Word ----------->     Address
  &lt;---------- Reserved ------------------------&gt;
  <---------- Reserved ------------------------>
  &lt;---------- Reserved ------------------------&gt;
  <---------- Reserved ------------------------>
</pre>
</pre>
====Command Complete Status Block====
====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.  
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.  
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.
<pre>
<pre>
Word     15 14 13 12 11 10  9  8  7  6  5  4  3  2  1  0   Remarks
Word 15 14 13 12 11 10  9  8  7  6  5  4  3  2  1  0 Remarks


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


Word 0 - Subsystem Control Block End Status
Word 0 - Subsystem Control Block End Status
<pre>
{|class="wikitable"
|Bit      |Function
!Bit||Function
|----------+--------------------------------------------------|
|-
|15 - 13   |Reserved                                         |
|15 - 13||Reserved
|----------+--------------------------------------------------|
|-
|12       |Major Exception Occurred                         |
|12||Major Exception Occurred
|----------+--------------------------------------------------|
|-
|11       |Device Not Initialized                           |
|11||Device Not Initialized
|----------+--------------------------------------------------|
|-
|10       |Reserved                                         |
|10||Reserved
|----------+--------------------------------------------------|
|-
| 9       |Device Dependent Status Available                 |
| 9||Device Dependent Status Available
|----------+--------------------------------------------------|
|-
| 8       |Additional Status Available                       |
| 8||Additional Status Available
|----------+--------------------------------------------------|
|-
| 7       |SCB Interrupt Queued                             |
| 7||SCB Interrupt Queued
|----------+--------------------------------------------------|
|-
| 6       |SCB Halted (Error/End Chain)                     |
| 6||SCB Halted (Error/End Chain)
|----------+--------------------------------------------------|
|-
| 5       |Long Record Exception                             |
| 5||Long Record Exception
|----------+--------------------------------------------------|
|-
| 4       |SCB Specification Check                           |
| 4||SCB Specification Check
|----------+--------------------------------------------------|
|-
| 3       |SCB Rejected                                     |
| 3||SCB Rejected
|----------+--------------------------------------------------|
|-
| 2       |Invalid Command Rejected                         |
| 2||Invalid Command Rejected
|----------+--------------------------------------------------|
|-
| 1       |Short Record Exception                           |
| 1||Short Record Exception
|----------+--------------------------------------------------|
|-
| 0       |SCB Ended (No Error)                             |
| 0||SCB Ended (No Error)
</pre>
|}
Note: The function indicated is true when the value of the bit is one. Reserved bits are undefined.
Note: The function indicated is true when the value of the bit is one. Reserved bits are undefined.


Word 1 - Retry Counts
Word 1 - Retry Counts
<pre>
{|class="wikitable"
|Bit      |Function
!Bit||Function
|----------+--------------------------------------------------|
|-
|15       |Adapter Retry Invoked                             |
|15||Adapter Retry Invoked
|----------+--------------------------------------------------|
|-
|14 - 6   |Reserved                                         |
|14 - 6||Reserved
|----------+--------------------------------------------------|
|-
|5         |System Interface Check Retry                     |
|5||System Interface Check Retry
|----------+--------------------------------------------------|
|-
|4 - 0     |Reserved                                         |
|4 - 0||Reserved
</pre>
|}


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


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


Word 6 - Device Dependent Status Length
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.  
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
Word 7 - Command and Device Status
The following table describes command status codes.
The following table describes command status codes.
<pre>
{|class="wikitable"
|Hex      |Command Status
!Hex||Command Status
|----------+--------------------------------------------------|
|-
|1         |SCB Command Completed with Success               |
|1||SCB Command Completed with Success
|----------+--------------------------------------------------|
|-
|5         |SCB Command Completed with Success after Retries |
|5||SCB Command Completed with Success after Retries
|----------+--------------------------------------------------|
|-
|7         |Adapter Hardware Failure                         |
|7||Adapter Hardware Failure
|----------+--------------------------------------------------|
|-
|A         |Immediate Command Completed                       |
|A||Immediate Command Completed
|----------+--------------------------------------------------|
|-
|C         |Command Completed with Failure                   |
|C||Command Completed with Failure
|----------+--------------------------------------------------|
|-
|E         |Command Error (Invalid Command or Parameter)     |
|E||Command Error (Invalid Command or Parameter)
|----------+--------------------------------------------------|
|-
|F         |Software Sequencing Error
|F||Software Sequencing Error
</pre>
|}
Note: All values not shown are reserved.  
Note: All values not shown are reserved.  
The following table describes device status bytes.
The following table describes device status bytes.
<pre>
{|class="wikitable"
|Bit      |Function
!Bit||Function
|----------+--------------------------------------------------|
|-
|7         |Reserved                                         |
|7||Reserved
|----------+--------------------------------------------------|
|-
|6         |Vendor Unique Bit                                 |
|6||Vendor Unique Bit
|----------+--------------------------------------------------|
|-
|5         |Vendor Unique Bit                                 |
|5||Vendor Unique Bit
|----------+--------------------------------------------------|
|-
|4 - 1     |Device Status Code                               |
|4 - 1||Device Status Code
|----------+--------------------------------------------------|
|-
|0         |Vendor Unique Bit
|0||Vendor Unique Bit
</pre>
|}
The following table describes bytes 4-1 device status code.
The following table describes bytes 4-1 device status code.
<pre>
{|class="wikitable"
|Hex      |Device Status                                     |
!Hex||Device Status
|----------+--------------------------------------------------|
|-
|0         |Good Status (No Error)                           |
|0||Good Status (No Error)
|----------+--------------------------------------------------|
|-
|1         |Check Condition (Error)                           |
|1||Check Condition (Error)
|----------+--------------------------------------------------|
|-
|2         |Condition Met/Good (No Error)                     |
|2||Condition Met/Good (No Error)
|----------+--------------------------------------------------|
|-
|4         |Busy (Error)                                     |
|4||Busy (Error)
|----------+--------------------------------------------------|
|-
|8         |Intermediate/Good (No Error)                     |
|8||Intermediate/Good (No Error)
|----------+--------------------------------------------------|
|-
|A         |Intermediate/Condition Met/Good (No Error)       |
|A||Intermediate/Condition Met/Good (No Error)
|----------+--------------------------------------------------|
|-
|C         |Reservation Conflict (Error)
|C||Reservation Conflict (Error)
</pre>
|}
Note: All values not shown are reserved.  
;Note: All values not shown are reserved.


Word 8 - Command Error Code/Device Error Code


Word 8 - Command Error Code/Device Error Code
The following table describes bits 15-8 command error codes.
The following table describes bits 15-8 command error codes.
<pre>
{|class="wikitable"
|Hex      |Error
!Hex||Error
|----------+--------------------------------------------------|
|-
|00       |No Error                                         |
|00||No Error
|----------+--------------------------------------------------|
|-
|01       |Invalid Parameter in SCB                         |
|01||Invalid Parameter in SCB
|----------+--------------------------------------------------|
|-
|02       |Reserved                                         |
|02||Reserved
|----------+--------------------------------------------------|
|-
|03       |Command Not Supported                             |
|03||Command Not Supported
|----------+--------------------------------------------------|
|-
|04       |Command Aborted (By System)                       |
|04||Command Aborted (By System)
|----------+--------------------------------------------------|
|-
|05       |Reserved                                         |
|05||Reserved
|----------+--------------------------------------------------|
|-
|06       |Reserved                                         |
|06||Reserved
|----------+--------------------------------------------------|
|-
|07       |Format Rejected - Sequence Error                 |
|07||Format Rejected - Sequence Error
|----------+--------------------------------------------------|
|-
|08       |Assign Rejected - Command in Progress on Device   |
|08||Assign Rejected - Command in Progress on Device
|----------+--------------------------------------------------|
|-
|09       |Assign Rejected - SCSI Device Already Assigned   |
|09||Assign Rejected - SCSI Device Already Assigned
|----------+--------------------------------------------------|
|-
|0A       |Command Rejected - SCSI Device Not Assigned       |
|0A||Command Rejected - SCSI Device Not Assigned
|----------+--------------------------------------------------|
|-
|OB       |Maximum Logical Block Address Exceeded           |
|OB||Maximum Logical Block Address Exceeded
|----------+--------------------------------------------------|
|-
|OC       |16-Bit Card Slot Address Range Exceeded.         |
|OC||16-Bit Card Slot Address Range Exceeded.
|----------+--------------------------------------------------|
|-
|0D - 12   |Reserved                                         |
|0D - 12||Reserved
|----------+--------------------------------------------------|
|-
|13       |Invalid Device for Command                       |
|13||Invalid Device for Command
|----------+--------------------------------------------------|
|-
|14 - 1F   |Reserved                                         |
|14 - 1F||Reserved
|----------+--------------------------------------------------|
|-
|20       |Adapter Hardware Error                           |
|20||Adapter Hardware Error
|----------+--------------------------------------------------|
|-
|21       |Global Command Time-out                           |
|21||Global Command Time-out
|----------+--------------------------------------------------|
|-
|22       |DMA Error                                         |
|22||DMA Error
|----------+--------------------------------------------------|
|-
|23       |Adapter Buffer Defective                         |
|23||Adapter Buffer Defective
|----------+--------------------------------------------------|
|-
|24       |Command Aborted by Adapter                       |
|24||Command Aborted by Adapter
|----------+--------------------------------------------------|
|-
|25 - 7F   |Reserved                                         |
|25 - 7F||Reserved
|----------+--------------------------------------------------|
|-
|80       |Adapter Microprocessor Detected Error             |
|80||Adapter Microprocessor Detected Error
|----------+--------------------------------------------------|
|-
|81 - FF   |Reserved
|81 - FF||Reserved
</pre>
|}
The following table describes bits 7-0 device error codes.
The following table describes bits 7-0 device error codes.
<pre>
{|class="wikitable"
|Hex      |Error                                             |
!Hex||Error
|----------+--------------------------------------------------|
|-
|00       |No Error                                         |
|00||No Error
|----------+--------------------------------------------------|
|-
|01       |SCSI Bus Reset Occurred                           |
|01||SCSI Bus Reset Occurred
|----------+--------------------------------------------------|
|-
|02       |SCSI Interface Fault                             |
|02||SCSI Interface Fault
|----------+--------------------------------------------------|
|-
|03 - 0F   |Reserved                                         |
|03 - 0F||Reserved
|----------+--------------------------------------------------|
|-
|10       |SCSI Selection Time-out (device not available)   |
|10||SCSI Selection Time-out (device not available)
|----------+--------------------------------------------------|
|-
|11       |Unexpected SCSI Bus Free                         |
|11||Unexpected SCSI Bus Free
|----------+--------------------------------------------------|
|-
|12       |Reserved                                         |
|12||Reserved
|----------+--------------------------------------------------|
|-
|13       |Invalid SCSI Phase Sequence                       |
|13||Invalid SCSI Phase Sequence
|----------+--------------------------------------------------|
|-
|14 - 1F   |Reserved                                         |
|14 - 1F||Reserved
|----------+--------------------------------------------------|
|-
|20       |Short Length Record                               |
|20||Short Length Record
|----------+--------------------------------------------------|
|-
|21 - FF   |Reserved
|21 - FF||Reserved
</pre>
|}


Word 9 - Reserved
Word 9 - Reserved
Word 9 is 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).


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 cache-read hit rations.  
Hex       |Percent
{|class="wikitable"
----------+---------
!Hex||Percent
00 - 99   |00% - 99%
|-
----------+---------
|00 - 99||00% - 99%
A0       |100%
|-
|A0||100%
|}
The following table describes bits 15-8 cache statuses.
The following table describes bits 15-8 cache statuses.
Bit       |Function
{|class="wikitable"
----------+--------------------
!Bit||Function
15 - 12   |Reserved
|-
----------+--------------------
|15 - 12||Reserved
11       |Cache Enabled
|-
----------+--------------------
|11||Cache Enabled
10       |Cache Retry Occurred
|-
----------+--------------------
|10||Cache Retry Occurred
9         |Total Write Hit
|-
----------+--------------------
|9||Total Write Hit
8         |Total Read Hit
|-
 
|8||Total Read Hit
|}
Word B - Last SCB Address Processed - Low Word
Word B - Last SCB Address Processed - Low Word
Word B is the 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 - Last SCB Address Processed - High Word
Word C is the last SCB address processed (high word)
Word C is the last SCB address processed (high word)


Read Data
===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.  
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.  
 
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.
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.
 
<pre>
15 14 13 12 11 10  9  8  7  6  5  4  3  2  1  0    Remarks
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
  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
  1 ES RE PT  0  0 BB  0  0  0  0  0  0  0  0 CH    Enable Word
  &lt;---------- Least Significant Word ----------&gt;   Logical
  <---------- Least Significant Word ---------->   Logical
  &lt;---------- Most Significant Word -----------&gt;     Address
  <---------- Most Significant Word ----------->     Address
  &lt;---------- Least Significant Word ----------&gt;   System Buffer
  <---------- Least Significant Word ---------->   System Buffer
  &lt;---------- Most Significant Word -----------&gt;     Address
  <---------- Most Significant Word ----------->     Address
  &lt;---------- Least Significant Word ----------&gt;   System Buffer
  <---------- Least Significant Word ---------->   System Buffer
  &lt;---------- Most Significant Word -----------&gt;     Byte Count
  <---------- Most Significant Word ----------->     Byte Count
  &lt;---------- Least Significant Word ----------&gt;   Termination Status Block
  <---------- Least Significant Word ---------->   Termination Status Block
  &lt;---------- Most Significant Word -----------&gt;     Address
  <---------- Most Significant Word ----------->     Address
  &lt;---------- Least Significant Word ----------&gt;   Optional SCB Chain
  <---------- Least Significant Word ---------->   Optional SCB Chain
  &lt;---------- Most Significant Word -----------&gt;     Address
  <---------- Most Significant Word ----------->     Address
  &lt;---------- Number of Blocks ----------------&gt;   Block Count
  <---------- Number of Blocks ---------------->   Block Count
  &lt;---------- Block Size ----------------------&gt;   Block Length
  <---------- Block Size ---------------------->   Block Length
</pre>


Read Device Capacity
Read Device Capacity
This SCB command is used to return the Device Capacity status block of the specific device.
This SCB command is used to return the Device Capacity status block of the specific device.
 
<pre>
15 14 13 12 11 10  9  8  7  6  5  4  3  2  1  0    Remarks
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
  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
  1 ES RE  0  0  0  1  0  0  0  0  0  0  0  0 CH    Enable Word
  &lt;---------- Reserved ------------------------&gt;
  <---------- Reserved ------------------------>
  &lt;---------- Reserved ------------------------&gt;
  <---------- Reserved ------------------------>
  &lt;---------- Least Significant Word ----------&gt;   System Buffer
  <---------- Least Significant Word ---------->   System Buffer
  &lt;---------- Most Significant Word -----------&gt;     Address
  <---------- 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  1  0  0  0    System Buffer
  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0    Byte Count
  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0    Byte Count
  &lt;---------- Least Significant Word ----------&gt;   Termination Status Block
  <---------- Least Significant Word ---------->   Termination Status Block
  &lt;---------- Most Significant Word -----------&gt;     Address
  <---------- Most Significant Word ----------->     Address
  &lt;---------- Least Significant Word ----------&gt;   Optional SCB Chain
  <---------- Least Significant Word ---------->   Optional SCB Chain
  &lt;---------- Most Significant Word -----------&gt;     Address
  <---------- Most Significant Word ----------->     Address
  &lt;---------- Reserved ------------------------&gt;
  <---------- Reserved ------------------------>
  &lt;---------- Reserved ------------------------&gt;
  <---------- Reserved ------------------------>
</pre>


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


  0        &lt;----- High Byte ------&gt;
  0        <----- High Byte ------>
  1        &lt;----------------------&gt;     Last Logical
  1        <---------------------->     Last Logical
  2        &lt;----------------------&gt;     Block Address
  2        <---------------------->     Block Address
  3        &lt;----- Low Byte -------&gt;
  3        <----- Low Byte ------->
  4        &lt;----- High Byte ------&gt;
  4        <----- High Byte ------>
  5        &lt;----------------------&gt;     Block
  5        <---------------------->     Block
  6        &lt;----------------------&gt;     Length
  6        <---------------------->     Length
  7        &lt;----- Low Byte -------&gt;
  7        <----- Low Byte ------->
</pre>


Read Prefetch
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.


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.
<pre>
15 14 13 12 11 10  9  8  7  6  5  4  3  2  1  0    Remarks
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
  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
  1 ES RE  0  0  0  1  0  0  0  0  0  0  0  0 CH    Enable Word
  &lt;---------- Least Significant Word ----------&gt;   Logical Block
  <---------- Least Significant Word ---------->   Logical Block
  &lt;---------- Most Significant Word -----------&gt;     Address
  <---------- Most Significant Word ----------->     Address
  &lt;---------- Reserved ------------------------&gt;
  <---------- Reserved ------------------------>
  &lt;---------- Reserved ------------------------&gt;
  <---------- Reserved ------------------------>
  &lt;---------- Reserved ------------------------&gt;
  <---------- Reserved ------------------------>
  &lt;---------- Reserved ------------------------&gt;
  <---------- Reserved ------------------------>
  &lt;---------- Least Significant Word ----------&gt;   Termination Status Block
  <---------- Least Significant Word ---------->   Termination Status Block
  &lt;---------- Most Significant Word -----------&gt;     Address
  <---------- Most Significant Word ----------->     Address
  &lt;---------- Least Significant Word ----------&gt;   Optional SCB Chain
  <---------- Least Significant Word ---------->   Optional SCB Chain
  &lt;---------- Most Significant Word -----------&gt;     Address
  <---------- Most Significant Word ----------->     Address
  &lt;---------- Number of Blocks ----------------&gt;   Block Count
  <---------- Number of Blocks ---------------->   Block Count
  &lt;---------- Block Size ----------------------&gt;   Block Length
  <---------- Block Size ---------------------->   Block Length
</pre>


===Read Verify===
===Read Verify===
Line 966: Line 1,017:
  0  0  0  1  1  1  0  0 ND NS  0  0  0  0  1  1    Read Verify
  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
  1 ES RE  0  0  0  1  0  0  0  0  0  0  0  0 CH    Enable Word
  &lt;---------- Least Significant Word ----------&gt;   Logical Block
  <---------- Least Significant Word ---------->   Logical Block
  &lt;---------- Most Significant Word -----------&gt;     Address
  <---------- Most Significant Word ----------->     Address
  &lt;---------- Reserved ------------------------&gt;
  <---------- Reserved ------------------------>
  &lt;---------- Reserved ------------------------&gt;
  <---------- Reserved ------------------------>
  &lt;---------- Reserved ------------------------&gt;
  <---------- Reserved ------------------------>
  &lt;---------- Reserved ------------------------&gt;
  <---------- Reserved ------------------------>
  &lt;---------- Least Significant Word ----------&gt;   Termination Status Block
  <---------- Least Significant Word ---------->   Termination Status Block
  &lt;---------- Most Significant Word -----------&gt;     Address
  <---------- Most Significant Word ----------->     Address
  &lt;---------- Least Significant Word ----------&gt;   Optional SCB Chain
  <---------- Least Significant Word ---------->   Optional SCB Chain
  &lt;---------- Most Significant Word -----------&gt;     Address
  <---------- Most Significant Word ----------->     Address
  &lt;---------- Number of Blocks ----------------&gt;   Block Count
  <---------- Number of Blocks ---------------->   Block Count
  &lt;---------- Block Size ----------------------&gt;   Block Length
  <---------- Block Size ---------------------->   Block Length


Reassign Block
Reassign Block
Line 986: Line 1,037:
  0  0  0  1  1  1  0  0  0  0  0  1  1  0  0  0    Reassign Block
  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
  0 ES RE  0  0  0  1  0  0  0  0  0  0  0  0 CH    Enable Word
  &lt;--------- Reserved -------------------------&gt;
  <--------- Reserved ------------------------->
  &lt;--------- Reserved -------------------------&gt;
  <--------- Reserved ------------------------->
  &lt;--------- Least Significant Word -----------&gt;   System Buffer
  <--------- Least Significant Word ----------->   System Buffer
  &lt;--------- Most Significant Word ------------&gt;     Address
  <--------- Most Significant Word ------------>     Address
  &lt;--------- Least Significant Word -----------&gt;   System Buffer
  <--------- Least Significant Word ----------->   System Buffer
  &lt;--------- Most Significant Word ------------&gt;     Byte Count
  <--------- Most Significant Word ------------>     Byte Count
  &lt;--------- Least Significant Word -----------&gt;   Termination Status Block
  <--------- Least Significant Word ----------->   Termination Status Block
  &lt;----------Most Significant Word ------------&gt;     Address
  <----------Most Significant Word ------------>     Address
  &lt;--------- Least Significant Word -----------&gt;   Optional SCB Chain
  <--------- Least Significant Word ----------->   Optional SCB Chain
  &lt;--------- Most Significant Word ------------&gt;     Address
  <--------- Most Significant Word ------------>     Address
  &lt;--------- Reserved -------------------------&gt;
  <--------- Reserved ------------------------->
  &lt;--------- Reserved -------------------------&gt;
  <--------- Reserved ------------------------->


Reassign Block Defect List
Reassign Block Defect List
Line 1,004: Line 1,055:
Byte        7  6  5  4  3  2  1  0    Remarks
Byte        7  6  5  4  3  2  1  0    Remarks


  0          &lt;----- Reserved -----&gt;
  0          <----- Reserved ----->
  1          &lt;----- Reserved -----&gt;
  1          <----- Reserved ----->
  2          &lt;----- High Byte ----&gt;   Defect List
  2          <----- High Byte ---->   Defect List
  3          &lt;----- Low Byte -----&gt;   Length
  3          <----- Low Byte ----->   Length
               Defect Descriptors
               Defect Descriptors
  4          &lt;----- High Byte ----&gt;
  4          <----- High Byte ---->
  5          &lt;--------------------&gt;   Defective Logical
  5          <-------------------->   Defective Logical
  6          &lt;--------------------&gt;   Block
  6          <-------------------->   Block
  7          &lt;----- Low Byte -----&gt;   Address
  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.


===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.
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.
 
<pre>
15 14 13 12 11 10  9  8  7  6  5  4  3  2  1  0    Remarks
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
  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
  1 ES RE  0  0 SS  1  0  0  0  0  0  0  0  0 CH    Enable Word
  &lt;---------- Reserved ------------------------&gt;
  <---------- Reserved ------------------------>
  &lt;---------- Reserved ------------------------&gt;
  <---------- Reserved ------------------------>
  &lt;---------- Least Significant Word ----------&gt;   System Buffer
  <---------- Least Significant Word ---------->   System Buffer
  &lt;---------- Most Significant Word -----------&gt;     Address
  <---------- Most Significant Word ----------->     Address
  &lt;---------- Least Significant Word ----------&gt;   System Buffer
  <---------- Least Significant Word ---------->   System Buffer
  &lt;---------- Most Significant Word -----------&gt;     Byte Count
  <---------- Most Significant Word ----------->     Byte Count
  &lt;---------- Least Significant Word ----------&gt;   Termination Status Block
  <---------- Least Significant Word ---------->   Termination Status Block
  &lt;---------- Most Significant Word -----------&gt;     Address
  <---------- Most Significant Word ----------->     Address
  &lt;---------- Least Significant Word ----------&gt;   Optional SCB Chain
  <---------- Least Significant Word ---------->   Optional SCB Chain
  &lt;---------- Most Significant Word -----------&gt;     Address
  <---------- Most Significant Word ----------->     Address
  &lt;---------- Reserved ------------------------&gt;
  <---------- Reserved ------------------------>
  &lt;---------- Reserved ------------------------&gt;
  <---------- Reserved ------------------------>
</pre>


Sense Data Block
====Sense Data Block====


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


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


Byte 0 Error Class/Error Code
Byte 0 Error Class/Error Code
Line 1,055: Line 1,108:
Note: The adapter does not examine or use device-dependent information.  
Note: The adapter does not examine or use device-dependent information.  


Extended Sense Data Block
====Extended Sense Data Block====
 
<pre>
Byte              Sense Bits
Byte              Sense Bits
             7  6  5  4  3  2  1  0    Remarks
             7  6  5  4  3  2  1  0    Remarks


  0          V  1  1  1 &lt;-- Code --&gt;   Error Class/Code
  0          V  1  1  1 <-- Code -->   Error Class/Code
  1          &lt;----- Segment # -----&gt;   Segment Number
  1          <----- Segment # ----->   Segment Number
  2          FM EM IL  X &lt;-- Key --&gt;   Sense Key
  2          FM EM IL  X <-- Key -->   Sense Key
  3          &lt;- Most Significant --&gt;   Information Bytes
  3          <- Most Significant -->   Information Bytes
  4          &lt;---------------------&gt;
  4          <--------------------->
  5          &lt;---------------------&gt;
  5          <--------------------->
  6          &lt;- Least Significant -&gt;
  6          <- Least Significant ->
  7          &lt;--Additional Length--&gt;   # of Bytes
  7          <--Additional Length-->   # of Bytes
  8          &lt;--Additional Sense --&gt;   Additional
  8          <--Additional Sense -->   Additional
                         .              Sense
                         .              Sense
                         .
                         .
  N          &lt;--Additional Sense---&gt;   Bytes
  N          <--Additional Sense--->   Bytes
 
</pre>
Byte 0 Error Class/Error Code
;Byte 0 Error Class/Error Code
Bit 7 The Information bytes are valid only if this bit is a 1.  
: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 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.
: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 1 Segment Number
;Byte 2 Extended Error Bits/Sense Key
This byte contains the current segment descriptor.
: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.
Byte 2 Extended Error Bits/Sense Key
:Bit 5 An Invalid Length (IL) resulted when the specified logical block length did not match the device.
Bit 7 A filemark (FM) has been reached on a sequential access device.  
:Bit 4 X - This bit is reserved.
Bit 6 An end of medium (EM) has been reached on a sequential access device.  
:Bits 3 - 0 The coding of these bits is shown in the following table.
Bit 5 An Invalid Length (IL) resulted when the specified logical block length did not match the device.  
::{|class="wikitable"
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
!Hex Value||Function
|-
|-
Line 1,122: Line 1,172:
|F||Reserved
|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.
Note: The adapter does not examine or use device-dependent information.


Send Other SCSI Command (SCSI CDB)
====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.
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.


;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.
<pre>
15 14 13 12 11 10  9  8  7  6  5  4  3  2  1  0    Remarks
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
  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
RD ES RE PT  0 SS  1  0  0  0  0  0  0  0  0 CH    Enable Word
&lt;------ Reserved -----&gt;&lt;-- SCSI CMD Length ---&gt;
<------ Reserved -----><-- SCSI CMD Length --->
&lt;---------- Reserved -------------------------&gt;
<---------- Reserved ------------------------->
&lt;---------- Least Significant Word -----------&gt;   System Buffer
<---------- Least Significant Word ----------->   System Buffer
&lt;---------- Most Significant Word ------------&gt;     Address
<---------- Most Significant Word ------------>     Address
&lt;---------- Least Significant Word -----------&gt;   System Buffer
<---------- Least Significant Word ----------->   System Buffer
&lt;---------- Most Significant Word ------------&gt;     Byte Count
<---------- Most Significant Word ------------>     Byte Count
&lt;---------- Least Significant Word -----------&gt;   Termination Status Block
<---------- Least Significant Word ----------->   Termination Status Block
&lt;---------- Most Significant Word ------------&gt;     Address
<---------- Most Significant Word ------------>     Address
&lt;---------- Least Significant Word -----------&gt;   Optional SCB Chain
<---------- Least Significant Word ----------->   Optional SCB Chain
&lt;---------- Most Significant Word ------------&gt;     Address
<---------- Most Significant Word ------------>     Address
&lt;-------1------- SCSI Command -------0--------&gt;   SCSI Command
<-------1------- SCSI Command -------0-------->   SCSI Command
&lt;-------3------- SCSI Command -------2--------&gt;
<-------3------- SCSI Command -------2-------->
&lt;-------5------- SCSI Command -------4--------&gt;   Six Bytes or
<-------5------- SCSI Command -------4-------->   Six Bytes or
&lt;-------7------- SCSI Command -------6--------&gt;
<-------7------- SCSI Command -------6-------->
&lt;-------9------- SCSI Command -------8--------&gt;   Ten Bytes or
<-------9------- SCSI Command -------8-------->   Ten Bytes or
&lt;------11------- SCSI Command ------10--------&gt;   Twelve Bytes
<------11------- SCSI Command ------10-------->   Twelve Bytes
</pre>


Write Data
====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.
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
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  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
  0 ES RE PT  0  0 BB  0  0  0  0  0  0  0  0 CH    Enable Word
  &lt;---------- Least Significant Word -----------&gt;   Logical Block
  <---------- Least Significant Word ----------->   Logical Block
  &lt;---------- Most Significant Word ------------&gt;   Address
  <---------- Most Significant Word ------------>   Address
  &lt;---------- Least Significant Word -----------&gt;   System Buffer
  <---------- Least Significant Word ----------->   System Buffer
  &lt;---------- Most Significant Word ------------&gt;   Address
  <---------- Most Significant Word ------------>   Address
  &lt;---------- Least Significant Word -----------&gt;   System Buffer
  <---------- Least Significant Word ----------->   System Buffer
  &lt;---------- Most Significant Word ------------&gt;   Byte Count
  <---------- Most Significant Word ------------>   Byte Count
  &lt;---------- Least Significant Word -----------&gt;   Termination Status Block
  <---------- Least Significant Word ----------->   Termination Status Block
  &lt;---------- Most Significant Word ------------&gt;   Address
  <---------- Most Significant Word ------------>   Address
  &lt;---------- Least Significant Word -----------&gt;   Optional SCB Chain
  <---------- Least Significant Word ----------->   Optional SCB Chain
  &lt;---------- Most Significant Word ------------&gt;   Address
  <---------- Most Significant Word ------------>   Address
  &lt;---------- Number of Blocks -----------------&gt;   Block Count
  <---------- Number of Blocks ----------------->   Block Count
  &lt;---------- Block Size -----------------------&gt;   Block Length
  <---------- 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.


===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
  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  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
  0 ES RE PT  0  0 BB  0  0  0  0  0  0  0  0 CH    Enable Word
  &lt;---------- Least Significant Word -----------&gt;   Logical Block
  <---------- Least Significant Word ----------->   Logical Block
  &lt;---------- Most Significant Word ------------&gt;     Address
  <---------- Most Significant Word ------------>     Address
  &lt;---------- Least Significant Word -----------&gt;   System Buffer
  <---------- Least Significant Word ----------->   System Buffer
  &lt;---------- Most Significant Word ------------&gt;     Address
  <---------- Most Significant Word ------------>     Address
  &lt;---------- Least Significant Word -----------&gt;   System Buffer
  <---------- Least Significant Word ----------->   System Buffer
  &lt;---------- Most Significant Word ------------&gt;     Byte Count
  <---------- Most Significant Word ------------>     Byte Count
  &lt;---------- Least Significant Word -----------&gt;   Termination Status Block
  <---------- Least Significant Word ----------->   Termination Status Block
  &lt;---------- Most Significant Word ------------&gt;     Address
  <---------- Most Significant Word ------------>     Address
  &lt;---------- Least Significant Word -----------&gt;   Optional SCB Chain
  <---------- Least Significant Word ----------->   Optional SCB Chain
  &lt;---------- Most Significant Word ------------&gt;     Address
  <---------- Most Significant Word ------------>     Address
  &lt;---------- Number of Blocks -----------------&gt;   Block Count
  <---------- Number of Blocks ----------------->   Block Count
  &lt;---------- Block Size -----------------------&gt;   Block Length
  <---------- Block Size ----------------------->   Block Length


[[Category:Storage Device Driver Reference]]
[[Category:Storage Device Driver Reference]]

Latest revision as of 20:14, 1 February 2020

Storage Device Driver Reference
  1. About This Book
  2. Introduction to DASD, SCSI, and CD-ROM Programming Interfaces
  3. Installation of OS/2, DASD, SCSI, and CD-ROM Device Drivers
  4. Adapter Device Driver Development Considerations
  5. DASD, SCSI, and CD-ROM Device Manager Interface Specification
  6. Error Handling
  7. Adapter Device Driver Command-Line Parameters
  8. DASD IOCtl Device Driver Test Tool
  9. Optical IOCtl Device Driver Test Tool
  10. Using Filter Device Drivers
  11. Library and Services
  12. CD-ROM Device Manager Interface Specification
  13. CD-ROM Device Driver Test Tool
  14. Building an OS/2 Virtual Disk Driver
  15. OS2DASD.DMD - Technical Reference
  16. Boot Record Architecture
  17. Extended Device Driver Interface Specification
  18. I/O Request Block - C Definitions
  19. OS/2 SCSI Device Driver Interface Specification
  20. Advanced SCSI Programming Interface (ASPI) OS/2 Specification
  21. Adapter Device Driver Interface Questions and Answers
  22. Device Driver Test Tool (DDTT)
  23. Glossary

Reprint Courtesy of International Business Machines Corporation, © International Business Machines Corporation

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

  • SCSI Driver
    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.
  • IBM Device-Class Drivers
    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.
  • Message Files
    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.

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.

Input Parameter Structure
Field Length
Device Handle WORD
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.

Field Name Length
Device Key Index WORD
SCB Architecture Card Comp. Level BYTE
Adapter Index BYTE
Device Flags WORD
Logical unit number (LUN) BYTE
Physical unit number (PUN) BYTE
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.

Input Parameter Structure
Field Length
Device Handle WORD
Sense Data Size WORD
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.

Input Parameter Structure
Field Length
Device Handle WORD
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.

Input Parameter Structure
Field Length
Device Handle WORD
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.

Input Parameter Structure
Field Length
Device Handle WORD
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.

Field Name Length
Adapter Cache Status BYTE

Adapter Cache Status : 00H Enabled

                      01H  Disabled

Set Device Timeout

This function sets the timeout value for this device.

Input Parameter Structure
Field Length
Timeout Value DWORD
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.

Input Parameter Structure
Field Length
Device Handle WORD
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.

Field Name Length
Timeout Value DWORD

The timeout value is in milliseconds.

Transfer SCB

This function causes an SCB or a chain of SCBs to be sent to the adapter.

Field Name Length
Device Handle WORD
Sense Data Size WORD
Physical Pointer to SCB DWORD
Logical Pointer to SCB Chain Header DWORD
Flags BYTE
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.

Flags
Bit 0 = 0 Normal Length SCB 1 Long SCB

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.

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.

Input Parameter Structure
Field Length
Device Peripheral Type BYTE
Device Type Flags BYTE
Nth Available WORD
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
Data Buffer
Field Name Length
Device Handle WORD
Device Handle
Returned to the caller.

Deallocate Device

This function deallocates the SCSI Peripheral Device assigned to this device handle.

Input Parameter Structure
Field Length
Device Handle WORD
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.

Input Parameter Structure
Field Length
Device Peripheral Type BYTE
Device Type Flags BYTE
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.

Field Name Length
Count of Device Type Requested WORD
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.

Input Parameter Structure
Field Length
Device Handle WORD
Sense Data Size WORD
Reserved DWORD
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.

Bit Numbers Category
15 ERROR
10 - 14 RESERVED
9 BUSY
8 DONE
7 SCSI ERROR
0 - 6 ERROR CODE (when Bit 15 = 1)

The following table describes bit descriptions.

Bit Description
07 SCSI Driver-Specific Error
08 Operation Complete
15 Request Completed with Error

The following table describes SCSI error codes.

Error Code Description
00h Device Error (Sense Data Returned)
01h Timeout Error
02h Unusual Wakeup Error
03h DevHlp Error
04h Request Block Not Available
05h Maximum Device Support Exceeded
06h Interrupt Level Not Available
07h Device Not Available
08h More IRQ Levels than Adapters
09h Device Busy
0Ah Request Sense Failed
0Bh Adapter Cache Not Supported

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 Symbol Function
15 RD Input/Output Control
14 ES Report TSB Status Only on Error
13 RE Retry Enable
12 PT Pointer to List
10 SS Suppress Exception Short
9 BB Bypass Buffer
8 - 1 Reserved
0 CH Chain on No Error
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.

Command Type Command Hex Code
SCB Device Inquiry 0B
SCB Format Unit 16
SCB Get Command Complete Status 07
SCB Read Data 01
SCB Read Device Capacity 09
SCB Read Prefetch 31
SCB Read Verify 03
SCB Reassign Block 18
SCB Request Sense 08
SCB Send Other SCSI Command (SCSI CDB) 1F
SCB Write Data 02
SCB Write with Verify 04
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     <Peripheral Device Type>   Major Type
 1     RMB <- Type Qualifier ->   Removable Media Bit
 2     <ISO>  <-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

Bit Function
15 - 13 Reserved
12 Major Exception Occurred
11 Device Not Initialized
10 Reserved
9 Device Dependent Status Available
8 Additional Status Available
7 SCB Interrupt Queued
6 SCB Halted (Error/End Chain)
5 Long Record Exception
4 SCB Specification Check
3 SCB Rejected
2 Invalid Command Rejected
1 Short Record Exception
0 SCB Ended (No Error)

Note: The function indicated is true when the value of the bit is one. Reserved bits are undefined.

Word 1 - Retry Counts

Bit Function
15 Adapter Retry Invoked
14 - 6 Reserved
5 System Interface Check Retry
4 - 0 Reserved

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.

Hex Command Status
1 SCB Command Completed with Success
5 SCB Command Completed with Success after Retries
7 Adapter Hardware Failure
A Immediate Command Completed
C Command Completed with Failure
E Command Error (Invalid Command or Parameter)
F Software Sequencing Error

Note: All values not shown are reserved. The following table describes device status bytes.

Bit Function
7 Reserved
6 Vendor Unique Bit
5 Vendor Unique Bit
4 - 1 Device Status Code
0 Vendor Unique Bit

The following table describes bytes 4-1 device status code.

Hex Device Status
0 Good Status (No Error)
1 Check Condition (Error)
2 Condition Met/Good (No Error)
4 Busy (Error)
8 Intermediate/Good (No Error)
A Intermediate/Condition Met/Good (No Error)
C Reservation Conflict (Error)
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.

Hex Error
00 No Error
01 Invalid Parameter in SCB
02 Reserved
03 Command Not Supported
04 Command Aborted (By System)
05 Reserved
06 Reserved
07 Format Rejected - Sequence Error
08 Assign Rejected - Command in Progress on Device
09 Assign Rejected - SCSI Device Already Assigned
0A Command Rejected - SCSI Device Not Assigned
OB Maximum Logical Block Address Exceeded
OC 16-Bit Card Slot Address Range Exceeded.
0D - 12 Reserved
13 Invalid Device for Command
14 - 1F Reserved
20 Adapter Hardware Error
21 Global Command Time-out
22 DMA Error
23 Adapter Buffer Defective
24 Command Aborted by Adapter
25 - 7F Reserved
80 Adapter Microprocessor Detected Error
81 - FF Reserved

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

Hex Error
00 No Error
01 SCSI Bus Reset Occurred
02 SCSI Interface Fault
03 - 0F Reserved
10 SCSI Selection Time-out (device not available)
11 Unexpected SCSI Bus Free
12 Reserved
13 Invalid SCSI Phase Sequence
14 - 1F Reserved
20 Short Length Record
21 - FF Reserved

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.

Hex Percent
00 - 99 00% - 99%
A0 100%

The following table describes bits 15-8 cache statuses.

Bit Function
15 - 12 Reserved
11 Cache Enabled
10 Cache Retry Occurred
9 Total Write Hit
8 Total Read Hit

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 <Class>  <- 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.
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.

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