CD-ROM Device Manager Interface Specification

This chapter contains a description of:
 * CD-ROM device management
 * SCSI and Non-SCSI adapter drivers
 * Command support

The following figure illustrates the layered CD-ROM Device Management structure in the OS/2 operating system. /\ |                CD-ROM Device Manager                  | |                  (OS/2 CDROM.DMD)                     | \/                 ^   SCSI-2 Commands           ^ |                            v                  |                     /-\ |                    | SCSI-2 Emulator | |                    | Filter          | v                    \-/ /\    ^  Vendor Unique v                       v     v  SCSI-1 Commands /--\      /---\ |Non-SCSI CD-ROM       |       | SCSI Bus              | |Adapter Device Driver |      | Adapter Device Driver | \--/      \---/           ^                                ^  Non-SCSI CD-ROM                 SCSI Adapter Adapter |                                | v                               v  CD-ROM Drive                    CD-ROM Drive

The CD-ROM Device Manager
The OS/2 CD-ROM Device Manager (OS2CDROM.DMD) is a generic CD-ROM device driver for CD-ROM drives that comply with the ANSI SCSI-2 standard X3T9.2/ 86-109 (SCSI-2 draft proposed American National Standard Revision 10g). The device driver provides generic data and audio support for drives that support the command set specified in that standard. Vendor unique CD-ROM XA support and multi-session support is provided for selected drive models.

The CD-ROM Device Manager provides a uniform interface between its clients and adapter device drivers. Clients of the Device Manager include: The CD-ROM File System communicates with the CD-ROM Device Manager using the request packet interface defined in the OS/2 Physical Device Driver Reference version 2.00 or later.
 * CD-ROM Installable File System (CDFS.IFS)
 * Multimedia Presentation Manager/2* subsystem
 * virtual CD-ROM device driver (VCDROM.SYS)
 * OS/2 applications

The Multimedia Presentation Manager/2 subsystem and OS/2 applications communicate with the CD-ROM Device Manager using the Category 80 and 81 IOCtl services defined in the OS/2 Physical Device Driver Reference.

DOS applications communicate with the CD-ROM Device Manager indirectly through the virtual DOS CD-ROM device driver VCDROM.SYS. VCDROM.SYS provides virtual support and converts the DOS application request into a file system or Cat 80/81 IOCTL request which is routed to the CD-ROM Device Manager using system device helper services.

The interface between the CD-ROM Device Manager and adapter device drivers adheres to the adapter device driver interface defined in earlier chapters of this reference. The CD-ROM Device Manager converts a request from its client into a SCSI-2 command descriptor block and routes the SCSI-2 command to the specified adapter device driver. The SCSI-2 commands are sent using the IORB adapter passthru command (command code = ADAPTER_PASSTHRU, command modifier = EXECUTE_CDB).

The CD-ROM Device Manager driver (OS2CDROM.DMD) is an installable block device driver and is loaded using a DEVICE= statement in CONFIG.SYS. The driver replaces CDROM.SYS, the CD-ROM device driver shipped in the OS/2 2.1 product.

SCSI-2 Emulation Filters
SCSI CD-ROM target devices with vendor unique commands not supported in the SCSI-2 standard require a SCSI-2 emulation filter. The emulation filter maps SCSI-2 commands received from the CD-ROM Device Manager to the vendor unique commands supported by the target device. This support is required to enable audio support on CD-ROM drives that adhere to the SCSI-1 standard. The SCSI-1 standard does not define a standard command set for audio control.

A SCSI-2 emulation filter is required for each vendor unique CD-ROM drive. Typically, a CD-ROM manufacturer uses the same vendor unique command set for all it's CD-ROM drives, therefore, one filter driver is required for each manufacturer.

The filter driver receives SCSI-2 commands from the CD-ROM Device Manager, converts the command to it's vendor unique equivalent, and routes the filtered command to the SCSI adapter device driver. If data returned with the command needs to be filtered, the filter driver regains control when the request is complete, converts the outgoing data to it's SCSI-2 equivalent, and then returns to the CD-ROM Device Manager. The filtering process is transparent to the Device Manager and to the adapter device drivers.

Filter drivers adhere to the adapter device driver interface previously defined. (See DASD, SCSI, and CD-ROM Device Manager Interface Specification.) The filter driver is loaded using the BASEDEV= statement in CONFIG.SYS.

SCSI Adapter Device Drivers
A SCSI adapter device driver complies with the adapter device driver interface defined in DASD, SCSI, and CD-ROM Device Manager Interface Specification. It must support the ADAPTER_PASSTHRU command for EXECUTE_CDB requests. SCSI-2 commands are sent from the CD-ROM Device Manager using this command. SCSI sense data must be returned when requested.

Non-SCSI CD-ROM Adapter Device Drivers
Several leading CD-ROM drive manufacturers use a proprietary, non-SCSI, host adapter interface for the CD-ROM drive. To support a non-SCSI CD-ROM drive, an adapter device driver is required that emulates a SCSI-2 target device. This enables the CD-ROM Device Manager to issue a common command set to it's target devices, whether or not the firmware on the target device directly supports the SCSI-2 command set.

A non-SCSI CD-ROM adapter device driver adheres to the adapter device driver interface defined in DASD, SCSI, and CD-ROM Device Manager Interface Specification. It must support the ADAPTER_PASSTHRU command for EXECUTE_CDB requests, The SCSI-2 commands are sent from the CD-ROM Device Manager using this command.

The SCSI-2 commands must be emulated by the adapter device driver. This includes sense data which is returned back to the CD-ROM Device Manager.

Non-SCSI CD-ROM Adapter Device Driver Specification
A non-SCSI CD-ROM adapter device driver adheres to the adapter device driver interface defined in DASD, SCSI, and CD-ROM Device Manager Interface Specification. Most commands are received as SCSI-2 command descriptor blocks sent using the IORB ADAPTER_PASSTHRU command. The SCSI command descriptor blocks comply with the ANSI SCSI-2 standard X3T9.2/86-109 (SCSI-2 draft proposed American National Standard Revision 10g).

The following sections describe the mandatory IORB and SCSI-2 commands that a non-SCSI CD-ROM adapter device driver must support. The command structures for the IORB command blocks are defined in IORB Control Blocks.

The C Language definitions for the IORB control blocks are included in I/O Request Block - C Definitions.

Mandatory IORB Command Support
The Adapter Device Driver must support the IORB command set defined in the table below.

For the IOCM_GET_DEVICE_TABLE command, the following information must be returned in the device table. The adapter device driver should return all other fields in the device table as specified in DASD, SCSI, and CD-ROM Device Manager Interface Specification.
 * IOCC_CONFIGURATION
 * The Adapter-to-Device protocol in the AdapterDevBus field of the ADAPTERINFO structure must be set to AI_DEVBUS_NONSCSI_CDROM.
 * The UnitType field in the UNITINFO structure must be set to UIB_TYPE_CDROM
 * The UF_REMOVABLE bit must be set in the UnitFlags field of the UNITINFO structure. The UF_NODASD_SUPT and UF_NOSCSI_SUPT bits should be set to zero.

The IOCM_ALLOCATE_UNIT, IOCM_DEALLOCATE_UNIT and IOCM_CHANGE_UNITINFO must be supported as specified in DASD, SCSI, and CD-ROM Device Manager Interface Specification.
 * IOCC_UNIT_CONTROL

The geometry returned must be the same for both the IOCM_GET_MEDIA_GEOMETRY and the IOCM_GET_DEVICE_GEOMETRY commands. For both commands, only the TotalSectors and the BytesPerSector fields should be set. The TotalSectors field should be equal to the last addressable logical block address on the media + 1. This value should correspond to the value returned in the SCSI- 2 Read Capacity command + 1, which is the starting address of the lead out area. The BytesPerSector field should be set to 2048. TheNumHeads, TotalCylinders and SectorsPerTrack fields should be set to 0. If there is no media present in the drive, the driver should return IOERR_ UNIT_NOT_READY.
 * IOCC_GEOMETRY

The adapter device driver must support the IOCM_READ command as specified in DASD, SCSI, and CD-ROM Device Manager Interface Specification.
 * IOCC_EXECUTE_IO

The adapter device driver must support the IOCM_GET_UNIT_STATUS and IOCM_ GET_LOCK_STATUS commands as specified in DASD, SCSI, and CD-ROM Device Manager Interface Specification.
 * IOCC_UNIT_STATUS

The adapter device driver must support the IOCM_ABORT, IOCM_RESET, IOCM_ LOCK_MEDIA, IOCM_UNLOCK_MEDIA and IOCM_EJECT_MEDIA commands as specified in DASD, SCSI, and CD-ROM Device Manager Interface Specification.
 * IOCC_DEVICE_CONTROL

The adapter device driver must support the IOCM_EXECUTE_CDB command. The list of mandatory SCSI-2 command descriptor blocks which must be supported via this command is defined in the following section.
 * IOCC_ADAPTER_PASSTHRU

Mandatory SCSI-2 Command Support
The following table lists the SCSI-2 commands which must be supported. The command structure for the SCSI-2 command descriptor blocks are defined in the ANSI SCSI-2 standard X3T9.2/86-109 (SCSI-2 draft proposed American National Standard Revision 10g). Developers should refer to the ANSI SCSI-2 specification for a definition of each command. Usage notes for each command, as it relates to implementation under the OS/2 operating system, are included in the following sections.

Note: The Mode Select and Mode Sense commands need only support the Block Descriptor and the Audio Control Page (Page 0E).

The TEST UNIT READY command provides a means to check if the logical unit is ready. Refer to the ANSI SCSI-2 specification for a detailed description of this command.
 * TEST UNIT READY (00h)

The REQUEST SENSE command requests that the target transfer sense data to the initiator. The Adapter Device Driver should return 18 bytes of sense data, as shown in the following table. Setting this bit is optional. If set, the Information Byte field must contain the logical block address associated with the command in error.
 * REQUEST SENSE (03h)
 * A valid bit of zero indicates that the Information Bytes field is not defined
 * A valid bit if one indicates the Information Bytes field contains valid information

The Sense Key, Additional Sense Code and Additional Sense Code Qualifier represent the error condition and must be returned.

All other sense data fields are unused and should be set to 0.

Refer to the ANSI SCSI-2 specification for a detailed description of this command and the complete list of sense key definitions. See I/O Request Block - C Definitions for a discussion on error processing and the mapping of sense data to IORB error codes.

The READ (6-byte) and READ (10-byte) commands request that the target transfer data to the initiator.
 * READ (08h) and READ (028h)

The Adapter Device Driver should return with a sense key error of 08h (Blank Check) and additional sense code of 064h (illegal mode for this track) if any of the following events occur. Refer to the ANSI SCSI-2 specification for a detailed description of this command.
 * 1) If the requested logical block address is in an audio track and the drive does not support reading raw 2352 byte CD-DA data.
 * 2) If the requested logical block address is a mode 2 sector and the drive does not support reading mode 2 sectors.

Reading Mode-2 Sectors

If the CD-ROM drive supports the reading of Mode 2 Form 1 and Mode 2 Form 2 sectors, the Adapter Device Driver should mask the complexity of reading the target sector and return successfully, even if the mode of the target sector does not match the currently specified mode for the drive.

Some drives require the drive be set to the proper mode of the target sector prior to issuing the read. For those drives, the Adapter Device Driver should issue the original read, and if the read fails with an error indicating the current drive mode does not match the mode of the target sector, the adapter device driver must issue the mode select to set the proper mode and then re-issue the read request.

It is the responsibility of the CD-ROM Device Manager to ensure the proper block length is specified via the Mode Select command prior to issuing the read command. So, for Mode 2 Form 1 sectors, the device manager will issue a Mode Select command to set the block length to 2048 bytes. For a Mode 2 Form 2 sector, the device manager will issue a Mode Select to set the block length to 2340 or 2352 bytes, depending on the max block length the drive supports. See the Mode Select command section MODE SELECT (15h).

The SEEK (6 byte) and SEEK (10 byte) commands request that the logical unit seek to the specified logical block address. The adapter device driver must complete the seek operation successfully even if the target sector is an audio sector. If a seek command to an audio sector is not supported by the drive, the driver should issue an alternative command which can successfully seek to the audio sector.
 * SEEK (0Bh) and Seek (2Bh)

The INQUIRY command requests that information regarding parameters of the target and its attached peripheral devices(s) be sent to the initiator. The standard inquiry data contains 36 required bytes and should be returned as shown in the following table.
 * INQUIRY (12h)
 * The Peripheral Qualifier is set to 00h.
 * The Peripheral Device Type is set to 05h (CD-ROM device).
 * The Removable Medium (RMB) bit is set to 1 to indicate the media is removable.
 * The Device Type Modifier is set to 00h.
 * The ISO version is set to 00h.
 * The ECMA version is set to 00h.
 * The ANSI-Approved Version field is set to 02h, indicating this driver adheres to the SCSI-2 specification.
 * The Response Data Format field is set to 02h to indicate compatibility with the SCSI-2 standard.

The Vendor Identification field contains eight bytes of ASCII data identifying the vendor of the product. For example: Byte    08   09   10   11   12   13   14   15 ASCII   S    O    N    Y    sp   sp   sp   sp Code     53h  4Fh  4Eh  59h  20h  20h  20h  20h The Product Identification field contains sixteen bytes of ASCII data identifying the product model. For example: Byte    16  17  18  19  20  21  22  23  24  25  26  27  28  29  30  31 ASCII   C   D   -   R   O   M   sp  C   D   U   5   6   1   sp  sp  sp Code     43h 44h 2Dh 52h 4Fh 4Dh 20h 43h 44h 55h 35h 36h 31h 20h 20h 20h The Product Revision Level field contains four bytes of ASCII data which indicates the revision level of the controller firmware. For example: Byte    32   33   34   35 ASCII   1. 0   0 Code     31h  2Eh  30h  30h

The Adapter Device Driver must support the Mode Select command for the Mode Parameter Block Descriptor and the Audio Control Parameters Page (0x0E).
 * MODE SELECT (15h)

The mode parameter list contains a header, followed by zero or more block descriptors, followed by zero or more variable-length pages.

Mode Select Parameter List

The following table describes the mode select header. The following table describes the mode select block descriptor.
 * Bit |   7  |   6  |   5  |   4  |   3  |   2  |   1  |   0  |
 * Byte |     |      |      |      |      |      |      |      |
 * 0  |                     Density Code                      |
 * 1  | (MSB)                                                 |
 * --- |                 Number of Blocks (00h)                |
 * 3  | (LSB)                                                 |
 * 4  |                       Reserved                        |
 * 5  | (MSB)                                                 |
 * --- |                     Block Length                      |
 * 7  |                                                       |
 * 5  | (MSB)                                                 |
 * --- |                     Block Length                      |
 * 7  |                                                       |
 * 7  |                                                       |
 * The medium type is set to 00h.
 * The block descriptor length is set to either 00h or 08h.
 * The density code is set to 00h.
 * The number of blocks field is set to 00h. This indicates the entire disc has the block length specified.
 * The block length specifies the length in bytes of each logical block.

Block Length Support
The CD-ROM Device Manager will initialize the block length to 2048 bytes per sector. When the Device Manager receives a Readlong IOCtl request (Category 80h, Function 72h), it will issue a Mode Select to change the block length to either 2340 or 2352 bytes, depending on the maximum block length the drive supports. The CD-ROM Device Manager will only issue the Mode Select command to change the block length if the current block length does not match the requested block length.

Prior to the first Read Long IOCtl command, the CD-ROM Device Manager will issue a set of Mode Select commands with various block length values to determine the maximum block length the drive supports. If the Adapter Device Driver receives a Mode Select command with a Block Length value which is not supported, it should return an error with a Sense Key of 05h (Illegal Request) and the Additional Sense Code set to 26h (Invalid field in parameter list).

If the drive can only read a maximum of 2340 bytes per sector, the CD-ROM Device Manager will append 12 bytes of zeros (where the sync bytes are normally placed) to each sector after the read completes. This will ensure a complete 2352 byte sector is always returned back to the application when a ReadLong IOCtl command is issued.

Audio Control Parameter Page
The audio control parameters page sets the playback modes and output controls for subsequent PLAY AUDIO commands and any current audio playback operation. (See the table below.)

The immediate bit (Immed) is set to 1 to indicate the target shall send completion status as soon as the playback operation has been started. The Output Port channel selection specifies the audio channels from the disc to which this output port should be connected, as shown in the table below. The channel volume control indicates the relative volume level for this audio output port. Values between 0x00 and 0xFF and allowed. A volume level of zero indicates the output is muted, a value of 0xFF indicates maximum volume level. The Output Port 2 and Output Port 3 channel selection and volume fields ( bytes 12 to 15) are reserved and are set to 0.

Audio Control Determination
At initialization time, the CD-ROM Device Manager will issue a series of Mode Select commands with various Audio Control Parameter Pages. The Output Port Channel Select and Volume Level fields will be varied to determine the audio control capabilities of the drive. For example, an Audio Control Parameter Page is sent with volume levels different for Channel 0 and Channel 1 to determine if the drive supports independent volume levels for each channel. If the Adapter Device Driver receives a Mode Select command with an Audio Control Parameter Page which is not supported by the drive, it should return an error with a Sense Key of 05h (Illegal Request) and the Additional Sense Code set to 26h (Invalid field in parameter list). This allows the CD-ROM Device Manager to determine the audio capabilities of the drive.

MODE SENSE Command (1Ah)

The MODE SENSE (6) command provides a means for a target to report parameters to the initiator. It is a complementary command to the MODE SELECT (6) command. Refer to the ANSI SCSI-2 specification for a detailed description of this command.

START/STOP UNIT Command (1Bh)

The START/STOP UNIT command requests the target enable or disable the logical unit for media access operations. This command is used to eject media from the drive. If a PREVENT MEDIUM REMOVAL command has been issued, a request to the disc should return with the sense key set to ILLEGAL REQUEST (O5h) and the additional sense code set to MEDIUM REMOVAL PREVENT (53h). Refer to the ANSI SCSI-2 specification for a detailed description of this command.

PREVENT/ALLOW MEDIUM REMOVAL (1Eh)

The PREVENT/ALLOW MEDIUM REMOVAL command requests that the target enable or disable the removal of the medium in the logical unit. Refer to the ANSI SCSI-2 specification for a detailed description of this command.

READ CD-ROM CAPACITY (25h)

The READ CD-ROM CAPACITY command provides a means for the initiator to request information regarding the capacity of the logical unit. The capacity is based on the starting address of the lead-out area minus one. The logical block address returned is the address of the last user accessible block on the disc. Refer to the ANSI SCSI-2 specification for a detailed description of this command.

READ SUB-CHANNEL (42h)

The READ SUB-CHANNEL command requests that the target return the requested sub-channel data plus the state of audio play operations. Note: If a READ SUB CHANNEL command is issued to request the media catalog number (UPC/EAN Bar Coding), the drive should return the UPC code in ASCII format as specified in the SCSI-2 specification. Some drives return the UPC code in BCD. It should be converted to ASCII prior to returning. All other sub-channel data is returned in binary format. Refer to the ANSI SCSI-2 specification for a detailed description of this command.

READ TOC (43h)

The READ TOC command requests that the target transfer data from the table of contents to the initiator.

For drives which do not support a READ TOC command while an audio play operation is in progress, the adapter device driver should buffer the entire TOC data when media is first mounted in the drive. This will ensure the TOC data is retrievable during an audio play operation.

All TOC data is returned in binary format. Refer to the ANSI SCSI-2 specification for a detailed description of this command.

READ HEADER (44h)

The READ HEADER command requests that the device return the CD-ROM data block address header of the requested logical block.

Refer to the ANSI SCSI-2 specification for a detailed description of this command.

PLAY AUDIO (10) (45h)

The PLAY AUDIO command requests the target to begin an audio playback operation. The relative address bit (RelAdr) is not used and will be set to 0. If the requested starting address is not in an audio track, the Adapter Device Driver should return with a sense key error of 08h (Blank Check) and additional sense code of 064h (illegal mode for this track). Refer to the ANSI SCSI-2 specification for a detailed description of this command.

PLAY AUDIO MSF (47h)

The PLAY AUDIO MSF command requests the target to begin an audio playback operation. As specified in the SCSI-2 specification, the starting MSF address and ending MSF address fields are specified in hexadecimal (not in BCD). If the requested starting address is not in an audio track, the Adapter Device Driver should return with a sense key error of 08h (Blank Check) and additional sense code of 064h (illegal mode for this track). Refer to the ANSI SCSI-2 specification for a detailed description of this command.

PAUSE/RESUME (4Bh)

The PAUSE RESUME command requests that the device stop or start an audio play operation. It shall not be considered an error to request a pause when a pause is already in effect or to request a resume when a play operation is in progress. Refer to the ANSI SCSI-2 specification for a detailed description of this command.

READ DISC INFORMATION (F0h) The READ DISC INFORMATION command is a vendor unique command to request information regarding capabilities of the target device. The command is also used to return the starting address of the last session for a multisession photo CD disc.
 * Bit |   7  |   6  |   5  |   4  |   3  |   2  |   1  |   0  |
 * Byte |     |      |      |      |      |      |      |      |
 * 0  |                  Operation Code (F0h)                 |
 * 1  |                Reserved                 |    Type     |
 * 2-9 |                       Reserved                        |
 * 1  |                Reserved                 |    Type     |
 * 2-9 |                       Reserved                        |
 * 2-9 |                       Reserved                        |

TYPE = 00b If the TYPE field in the command descriptor block is 00h, the adapter device driver should return the data shown in the following table: The Maximum Block Length field specifies the maximum block length that can be transferred by the drive during a read operation. The value should match the maximum value which can be specified in the Block Length field of the Block Descriptor during a Mode Select command.
 * Bit |  7  |   6  |   5  |   4  |   3  |   2  |   1  |   0   |
 * Byte |    |      |      |      |      |      |      |       |
 * 0  |        Reserved          | CDDA | Form2| Form1|PhotoCD|
 * 1  |                      Reserved                         |
 * 2  | (MSB)                                                 |
 * --- |                 Maximum Block Length                  |
 * 3  | (LSB)                                                 |
 * 2  | (MSB)                                                 |
 * --- |                 Maximum Block Length                  |
 * 3  | (LSB)                                                 |
 * A multisession photo CD (PhotoCD) bit set to 1 indicates the drive supports the reading of multi-session photo CD discs. *A Mode 2 Form 1 (Form1) bit set to 1 indicates the drive supports the reading of Mode 2 Form 1 sectors. *A Mode 2 Form 2 (Form2) bit set to 1 indicates the drive supports the reading of Mode 2 Form 2 sectors. *A CD-Digital Audio (CDDA) set to 1 indicates the drive supports reading 2352 byte raw CD-DA data.

TYPE = 01b If the TYPE field in the command descriptor block is 01h, the adapter device driver should return the data shown in the following table: If the installed media is a multi-session photo CD disc, the driver should return the absolute address of the last session. The data is returned in MSF format and is expressed in hexadecimal. If the installed media is not a multi-session photo CD disc, the driver must return zero for all fields in the returned control block.
 * Bit |   7  |   6  |   5  |   4  |   3  |   2  |   1  |   0  |
 * Byte |     |      |      |      |      |      |      |      |
 * 0  |                        Reserved                       |
 * 1  |           Address of Last Session (Minutes)           |
 * 2  |           Address of Last Session (Seconds)           |
 * 3  |            Address of Last Session (Frame)            |
 * 2  |           Address of Last Session (Seconds)           |
 * 3  |            Address of Last Session (Frame)            |
 * 3  |            Address of Last Session (Frame)            |
 * 3  |            Address of Last Session (Frame)            |

Multi-Session Photo CD Support
At initialization time, the CD-ROM Device Manager will issue the READ DISC INFORMATION command with TYPE code = 00h to determine if the drive supports the reading of multi-session photo CD discs. If the drive indicates it supports the reading of multi-session photo CD discs (by returning with the PhotoCD bit set in the returned READ DISC INFORMATION data block) the CD- ROM Device Manager will issue the READ DISC INFORMATION command with TYPE code = 01h whenever media is first mounted in the drive.

If the adapter device driver indicates that a multi-session disc is mounted, the CD-ROM Device Manager will use the returned last session address to map subsequent read requests for Volume Descriptor sectors to the Volume Descriptor sectors in the last session on the disc. With this implementation, the responsibility of mapping sectors is done by the CD-ROM Device Manager and not by each adapter device driver.

Error Processing
When a request is issued, the CD-ROM Device Manager will set the IORB_REQ_STATUSBLOCK bit in the RequestControl field of the IORB header. If this bit is set and an error occurs, the Adapter Device Driver must return a valid status block and a valid sense data block back to the Device Manager when the request completes.

The status block is pointed to by the pStatusBlock field in the IORB header. It should be noted that pStatusBlock is a 16 bit near pointer, so the block is within the same segment as the IORB. The sense data is pointed to by the SenseData field in the status block. This field is a 16:16 far pointer. The length of the sense data to return is in specified in the ReqSenseLen field.

The adapter device driver must set the following fields when returning sense data:
 * 1) The IORB_ERROR and IORB_STATUSBLOCK_AVAIL bits must be set in the Status field of the IORB header.
 * 2) The STATUS_SENSEDATA_VALID bit must be set in the Flags field of the Status Block.
 * 3) The value in the Error Code field of the returned sense data must be set to 70h.
 * 4) The Sense Key, Additional Sense Code and Additional Sense Code Qualifier must be set to indicate the returned error.

To maintain consistency with the adapter device driver specification, an IORB error code must also be returned in the IORB header when an error occurs. This is in addition to the returned sense data information. The table below shows the mapping between Sense Data error codes and IORB error codes. If the Adapter Device Driver returns Sense Key and Sense Codes listed in the SCSI-2 specification which are not listed in the table below, the adapter device driver must map the sense key and codes to the most appropriate IORB error code. Key = Sense Key ASC = Additional Sense Code ASCQ = Additional Sense Code Qualifier


 * |          |Description               |IORB Error Code               |
 * |Key ASC   |                          |                              |
 * |ASCQ      |                          |                              |
 * NOT READY |02h 04h 00h|Logical Unit Not Ready   |IOERR_UNIT_NOT_READY          |
 * |02h 04h 01h|Becoming ready           |IOERR_UNIT_NOT_READY          |
 * |02h 57h 00h|Unable to recover TOC    |IOERR_UNIT_NOT_READY          |
 * MEDIUM   |03h 02h 00h|No Seek Complete          |IOERR_RBA_ADDRESSING_ERROR    |
 * ERROR    |03h 11h 00h|Unrecovered Read Error    |IOERR_RBA_CRC_ERROR           |
 * |03h 11h 05h|L-EC Uncorrectable Error |IOERR_RBA_CRC_ERROR           |
 * |03h 11h 06h|CIRC Unrecovered Error   |IOERR_RBA_CRC_ERROR           |
 * |03h 12h 00h|Address Mark Not Found   |IOERR_RBA_ADDRESSING_ERROR    |
 * |03h 15h 00h|Random Positioning Error |IOERR_RBA_ADDRESSING_ERROR    |
 * |03h 16h 00h|Data Synchronization Error|IOERR_RBA_CRC_ERROR          |
 * |03h 30h 00h|Incompatible Medium      |IOERR_MEDIA_NOT_SUPPORTED     |
 * HARDWARE |04h 08h 00h|Unit Communication Fail   |IOERR_DEVICE_NONSPECIFIC      |
 * ERROR    |04h 09h 01h|Tracking Servo Failure    |IOERR_DEVICE_NONSPECIFIC      |
 * |04h 09h 02h|Focus Servo Failure      |IOERR_DEVICE_NONSPECIFIC      |
 * |04h 09h 03h|Spindle Servo Failure    |IOERR_DEVICE_NONSPECIFIC      |
 * |04h 44h 00h|Internal Target Failure  |IOERR_DEVICE_NONSPECIFIC      |
 * ILLEGAL  |05h 20h 00h|Invalid Command Code      |IOERR_DEVICE_REQ_NOT_SUPPORTED|
 * REQUEST  |05h 21h 00h|LBA Out of Range          |IOERR_RBA_ADDRESSING_ERROR    |
 * |05h 24h 00h|Invalid field in CDB     |IOERR_CMD_SYNTAX              |
 * |05h 25h 00h|Unit not supported       |IOERR_CMD_SYNTAX              |
 * |05h 26h 00h|Invalid field in parmlist |IOERR_CMD_SYNTAX             |
 * |05h 63h 00h|End of user area         |IOERR_RBA_ADDRESSING_ERROR    |
 * |05h 64h 00h|Illegal mode for track   |IOERR_RBA_ADDRESSING_ERROR    |
 * |          |Medium may have changed   |                              |
 * UNIT     |06h 28h 00h|Power on reset            |IOERR_MEDIA_CHANGED           |
 * ATTENTION |06h 29h 00h|                         |IOERR_DEVICE_RESET            |
 * |08h 64h 00h|Illegal mode for track   |IOERR_RBA_ADDRESSING_ERROR    |
 * BLANK    |           |                          |                              |
 * CHECK    |           |                          |                              |
 * |05h 63h 00h|End of user area         |IOERR_RBA_ADDRESSING_ERROR    |
 * |05h 64h 00h|Illegal mode for track   |IOERR_RBA_ADDRESSING_ERROR    |
 * |          |Medium may have changed   |                              |
 * UNIT     |06h 28h 00h|Power on reset            |IOERR_MEDIA_CHANGED           |
 * ATTENTION |06h 29h 00h|                         |IOERR_DEVICE_RESET            |
 * |08h 64h 00h|Illegal mode for track   |IOERR_RBA_ADDRESSING_ERROR    |
 * BLANK    |           |                          |                              |
 * CHECK    |           |                          |                              |
 * BLANK    |           |                          |                              |
 * CHECK    |           |                          |                              |