Hierarchical Filemarks (Setmarks) X3T9.2/88-107 Rev. 1 LASER MAGNETIC STORAGE MEMO INTERNATIONAL ------------------------------------------------------------------------- Tape Storage Devision 3 October 1988 To: John Lohmeyer, Chairman X3T9.2 From: Bill Homans (215) 666-4764 Subject: Hierarchical Filemarks (Setmarks) The following proposal is the result of the SSWG. It is recommended that these changes to Sections 7 and 9 be incorporated into Rev. 6. Table 7-11: Segment Descriptor for COPY Function Code 04h ============================================================================== Bit| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | Byte | | | | | | | | | ============================================================================== 0 | Source Address | Reserved | Source LUN | -----|-----------------------------------------------------------------------| 1 | Destination Address | Reserved | Destination LUN | -----|-----------------------------------------------------------------------| 2 | Count | -----|-----------------------------------------------------------------------| 3 | | - - -|- - Reserved - -| 7 | | -----|-----------------------------------------------------------------------| 8 | | - - -|- - Vendor Unique - -| 11 | | ============================================================================== The source address and source LUN fields specify the SCSI bus ID and logical unit of the device to copy the data from for this segment of the COPY command. The destination address and destination LUN fields specify the SCSI bus ID and logical unit to copy the data to for this segment of the COPY command. Some SCSI devices may not support third-party COPY in which the copying SCSI device is not the source or destination device. Some SCSI devices only support COPY within the SCSI device and not to other SCSI devices. If an unsupported COPY operation is requested, the command shall be terminated with a CHECK CONDITION status and the sense key shall be set to ILLEGAL REQUEST with an additional sense code of INVALID FIELD IN PARAMETER LIST (see section 7.1.2.1). The image mode COPY command copies an exact image of the source device medium to the destination device medium, beginning at their current positions. The copy function terminates when the source device encounters physical end- of-medium as defined by the source device (i.e., BLANK CHECK sense key) or immediately after copying count consecutive filemarks from the source device to the destination device. If both the Consecutive Setmark (CS) bit and Report Setmarks (RSM) bit are set to one in the MODE SENSE Device Configuration Parameters page (see 9.3.3) the copy function will terminate after count consecutive setmarks from the source device to the destination device. A count field of zero indicates that the COPY command shall not terminate due to any number of consecutive filemarks or setmarks. Other error or exception conditions (e.g., early-warning end-of-medium on the destination device) may cause the COPY command to terminate prior to completion. In such cases, it is not possible to calculate a residue, so the information bytes in the sense data shall be set to zero. 7.2.3.7. Copies With Unequal Block Lengths When copying data between two devices with unequal block lengths, it is possible for the last source block to not completely fill the last destination block for one or more segments in the COPY command. Two optional bits are defined to assist in controlling the copy manager's actions in this circumstance. The Pad bit (in the CDB) and the Cat bit (in each segment descriptor) are defined as follows: Table 7-44: Error Codes 70h and 71h Sense Data Format ============================================================================== Bit| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | Byte | | | | | | | | | ============================================================================== 0 | Valid | Error Code (70h or 71h) | -----|-----------------------------------------------------------------------| 1 | Segment Number | -----|-----------------------------------------------------------------------| 2 |Filemark| EOM | ILI |Reserved| Sense Key | -----|-----------------------------------------------------------------------| 3 | (MSB) | - - -|- - Information Bytes - -| 6 | (LSB) | -----|-----------------------------------------------------------------------| 7 | Additional Sense Length (n-7) | -----|-----------------------------------------------------------------------| 8 | (MSB) | - - -|- - Command-Specific Information - -| 11 | (LSB) | -----|-----------------------------------------------------------------------| 12 | Additional Sense Code | -----|-----------------------------------------------------------------------| 13 | Additional Sense Code Qualifier | -----|-----------------------------------------------------------------------| 14 | Field Replaceable Unit Code | -----|-----------------------------------------------------------------------| 15 to| SKSV | | - - -|---------- - Sense-Key Specific - -| 17 | | -----|-----------------------------------------------------------------------| 18 to| | - - -|- - Additional Sense Bytes - -| n | | ============================================================================== A valid bit of zero indicates that the information bytes are not as defined in this standard. A valid bit of one indicates the information bytes contain valid information as defined in this standard. Error code values of 00h to 6Fh are not defined by this standard and their use is not recommended. The sense data format for error codes 70h (current errors) and 71h (deferred errors) are defined in Table 7-21. Error code values of 72h to 7Eh are reserved. Error code 7Fh is for a vendor specific sense data format. The segment number field contains the number of the current segment descriptor if the REQUEST SENSE command is in response to a COPY, COMPARE, or COPY AND VERIFY command. Up to 256 segments are supported beginning with segment zero. The filemark bit indicates that the current command has read a filemark. If the Report Setmarks (RSM) bit is set to one in the MODE SENSE Device Configuration Parameters page (see 9.3.3) then either filemark or setmark has been read. In this case filemark or setmark can be determined by interrogating the Additional Sense Codes. This bit is only used for sequential-access devices. The end-of-medium (EOM) bit indicates that an end-of-medium condition (end- of-tape, beginning-of-tape, out-of-paper, etc.) exists on a sequential access device or printer device. For sequential-access devices, this bit indicates that the unit is at or past the early-warning end-of-tape if the direction was forward or that the command could not be completed because beginning-of-tape was encountered if the direction was reverse. Direct-access devices shall not use this bit; instead, these devices shall report attempts to access beyond the end-of-medium as ILLEGAL REQUEST sense key (see Table 7-24). The incorrect length indicator (ILI) bit indicates that the requested logical block length did not match the logical block length of the data on the medium. The sense key, additional sense code and additional sense code qualifier provide a hierarchy of information. The intention of the hierarchy is to provide top-down approach for an initiator to determine information relating to the error and exception conditions. The sense key provides generic categories in which error and exception conditions can be reported. Initiators would typically use sense keys for high level error recovery procedures. Additional sense codes provide further detail describing the sense key. Additional sense code qualifiers add further detail to the additional sense code. The additional sense code and additional sense code qualifier can be used by initiators where sophisticated error recovery procedures require detailed information describing the error and exception conditions. The sense key is mandatory and presents generic information describing an error or exception condition. The sense keys are described in Tables 7-24 and 7-25. The contents of the information field is device-type or command specific and is defined within the appropriate section for the device type or command of interest. Unless specified otherwise, this field contains: (1) The unsigned logical block address associated with the sense key, for direct-access devices (Type 0), write-once read-multiple devices (Type 4), and read-only direct-access devices (Type 5). (2) The difference (residue) of the requested length minus the actual length in either bytes or blocks, as determined by the command, for sequential-access devices (Type 1), printer devices (Type 2), processor devices (Type 3) and some direct access device commands, except as defined for (4) below. (Negative values are indicated by two's complement notation.) (3) The difference (residue) of the requested number of blocks minus the actual number of blocks copied or compared for the current segment descriptor of a COPY, COMPARE, or COPY AND VERIFY command. (4) For sequential access devices operating in buffered modes 1h or 2h that detect an unrecoverable write error, and unwritten data blocks, filemarks, or setmarks. remain in the buffer the value of the information bytes for all commands shall be: (a) the number of data blocks, filemarks, and setmarks in the buffer if the device is in fixed block mode (block length field of the MODE SENSE block descriptor is non-zero). (b) the number of bytes in the buffer, not including filemarks or setmarks, if the device is in variable mode (block length field of the MODE SENSE block descriptor is zero). The additional sense length field specifies the number of additional sense bytes to follow. If the allocation length of the command descriptor block is too small to transfer all of the additional sense bytes, the additional sense length is not adjusted to reflect the truncation. The command-specific information field contains information that depends on the command which was executed. Further meaning for this field is defined within the command description. See COPY, COMPARE, COPY AND VERIFY, SEARCH DATA, and REASSIGN BLOCKS commands. The additional sense code specifies detailed information related to the error or exception condition reported in the sense key field. An additional sense code value is mandatory if that condition is reportable by the device. Additional sense code definitions are found in Table 7-62. If the condition is not reportable by the device, a value of 00h is the recommended additional sense code. The additional sense code qualifier is optional and specifies detailed information related to the additional sense code. If the error or exception condition is reportable by the device the value returned shall be as specified in Table 7-62. If the condition is not reportable by the device, a value of 00h is the recommended additional sense code qualifier. Non-zero values in the field replaceable unit field are used to define a device-specific mechanism or unit that has failed. A value of zero in this field shall indicate that no specific mechanism or unit has been identified to have failed or that the data is not available. The format of this information is not specified in this standard. The sense key specific bytes are described in section 7.1.8.1, below. The additional sense bytes field may contain command specific data, peripheral device specific data, or vendor specific data that further defines the nature of the CHECK CONDITION status. 7.2.15.1. Sense Key Specific The sense-key specific field is defined by this standard when the value of the sense-key specific valid (SKSV) bit is one. The definition of this field is determined by the value of the sense key field. This field is reserved for sense keys not described below. An SKSV value of zero, indicates that this field is not defined by this standard. If the sense key field is set to ILLEGAL REQUEST and the SKSV bit is set to one, the sense-key specific field shall be defined as shown in Table 7-22. These fields point to illegal parameters in command descriptor blocks and data parameters sent by the initiator in the data out phase. Table 7-50: SCSI-2 ASC and ASCQ Assignments F = Flag Column (H = Historical Anomalie) D = Direct Access Device T = Sequential Access Device L = Printer Device P = Processor Device W = Write Once Read Multiple Device R = Read Only (CD-ROM) Device S = Scanner Device O = Optical Memory Device M = Media Changer Device C = Communication Device Byte F 12 13 DTLPWRSOMC Description Comments 00 00 DTLPWRSOMC No additional sense information 00 01 T Filemark detected 00 02 T S End-of-Medium detected 00 03 T Beginning-of-Data detected 00 04 T S Beginning-of-Medium detected 00 05 T S End-of-Data detected 00 06 T Setmark detected 01 00 D W O No index/sector signal 02 00 D W O No seek complete 03 00 DTL W SO Peripheral device write fault 03 01 T No write current 03 02 T Excessive write errors 04 00 DTLPWRSO C Logical unit not ready, cause not reportable 04 01 DTLPWRSO C Logical unit is in process of becoming ready 04 02 DTLPWRSO C Logical unit not ready, initializing command required 04 03 DTLPWRSO C Logical unit not ready, manual intervention required 04 04 DTL O Logical unit not ready, format in progress 05 00 DTL WRSO C Logical unit does not respond to selection 06 00 D WR O No reference position (track zero) found 07 00 DTL WRSO Multiple peripheral devices selected 08 00 DTL WRSO C Logical unit communication failure 08 01 DTL WRSO C Logical unit communication time-out 08 02 DTL WRSO C Logical unit communication parity error 09 00 DT WR O Track following error 09 01 WR O Tracking servo failure 09 02 WR O Focus servo failure 09 03 WR O Spindle servo failure 0A 00 DTLPWRSO C Error log overflow 0B 00 0C 00 T S Write error Sense Key says whether recovered 0D 00 0E 00 0F 00 10 00 D W O ID CRC or ECC error 11 00 DT WRSO Unrecovered read error 11 01 T W SO Read retries exhausted 11 02 T W SO Error too long to correct 11 03 T W SO Multiple read errors 11 04 T Physical End-of-Medium encountered 11 05 WR O L-EC uncorrectable error (L-EC codes present and L-EC on) 11 06 WR O CIRC unrecovered error (L-EC unavailable or off) 11 07 W O Data resychronization error 11 08 T Incomplete block read (postamble not found) 11 09 T No gap found 11 0A T Miscorrected error 12 00 D W O Address mark not found for ID field 13 00 D W O Address mark not found for data field 14 00 DTL WRSO Recorded entity not found 14 01 DT WR O Record not found 14 02 T Filemark or setmark not found 14 03 T End-of-Data not found 14 04 T Block sequence error 15 00 DTL WRSO Random positioning error 15 01 DTL WRSO Mechanical positioning error 15 02 DT WR O Positioning error detected by read of mediun 16 00 D W O Data synchronization mark error 17 00 DT WRSO Recovered read data with no error correction applied 17 01 DT WRSO Recovered read data with retries 17 02 DT WR O Recovered read data with positive head offset 17 03 DT WR O Recovered read data with negative head offset 17 04 WR O Recovered read data with retries and/or CIRC applied 18 00 DT WR O Recovered read data with error correction applied 18 01 D WR O Recovered read data with error correction and retries applied 19 00 D O Defect list error 19 01 D O Grown defect list not available 1A 00 DTLPWRSO C Parameter list length error 1B 00 DTLPWRSO C Synchronous data transfer error 1C 00 D O Primary defect list not found 1D 00 D W O Miscompare during verify operation 1E 00 D W O Recovered ID with ECC correction 1F 00 20 00 DTLPWRSO C Invalid command operation code 21 00 DT WR O Logical block address out of range H 22 00 D Illegal function for device type Should use 20 00, 24 00, or 26 00 23 00 24 00 DTLPWRSO C Invalid field in CDB (check field pointer) 25 00 DTLPWRSO C Unsupported LUN 26 00 DTLPWRSO C Invalid field in parameter list (check field pointer) 27 00 DT W O Write protected 28 00 DTLPWRSO C Not ready to ready transition (Medium may have changed) 29 00 DTLPWRSO C Power on, reset, or BUS DEVICE RESET occurred 2A 00 DTL WRSO C MODE SELECT parameters changed by another initiator 2B 00 DTLPWRSO C COPY cannot execute since host cannot disconnect 2C 00 DTLPWRSO C Command sequence error 2C 01 S Too many windows specified 2C 02 S Invalid combination of windows specified 2D 00 T Overwrite error on update in place 2E 00 2F 00 DTLPWRSOMC Tagged commands cleared by another initiator 30 00 DT WR O Incompatible medium installed 30 01 DT WR O Cannot read medium - unknown format 30 02 DT WR O Cannot read medium - incompatible format 30 03 DT Cleaning cartridge installed 9.1.3. Logical Elements within a Partition The area between BOPx and EOPx contains only two initiator managed kinds of objects, Physical Blocks and File Marks, separated by gaps which are transferred between an initiator and a target or about which status is given. (See sequential access commands READ, SPACE, READ REVERSE, WRITE, and WRITE FILEMARKS.) The format ID at BOM, although at BOP1, is not specifically written or read by an initiator via a command. The initiator supplied or requested data is called a data block. Physical blocks are recorded units of initiator data blocks formatted according to the specifications of the format of the volume. A single physical block may contain one data block, a partial data block or multiple data blocks. When the physical block and the data block are not recorded in a one-to-one relationship, it is the responsibility of the device to perform all blocking, de-blocking, padding, stripping, splitting and/or rebuilding of the data block(s) sent by an initiator. Filemarks, or Tape Marks, are special recorded elements containing no user data written and are used by an initiator to set off sections of recorded data from one another. These sections of recorded data are usually called files or data sets. The filemark format is defined in some American National Standards. The device writes filemarks and detects filemarks. Initiators traditionally use filemarks to separate user data from labels, logical groupings of data from each other, and provide an end of data indication. At least one American National Standard specifically defines filemark use for this purpose. Note: Most current standards do not define an explicit end of data indication so initiator/host software has used conventions with filemarks to substitute for an explicit end of data indication. Setmarks are special recorded elements which provide a segmentation system which is separate and hierarchically superior to filemarks. For Sequential Access Devices of extremely high capacity this segmentation is required to provide clear, concise addressability and fast positioning. The Initiator has control to enable or inhibit the reporting of setmarks. Between physical blocks, filemarks, or setmarks on the medium are gaps. Although recorded on the medium, there is normally no distinguishable mark between two gaps. A gap may be a length of erased medium or a recorded pattern distinct from physical blocks, filemarks, and setmarks. Two physical blocks are separated by one or more gaps as are two filemarks, setmarks or a physical block and a filemark or setmark. Inter-block gaps, the gap between physical blocks, filemarks, and setmarks are introduced on the medium at the time a physical block, filemark, or setmark is written without explicit action by the initiator. n some devices, the length of inter-block gaps may be controlled by the initiator. Minimum and maximum lengths for inter-block gaps are defined in some American National Standards. Erase gaps are physical sections of the medium similar to inter-block gaps but are introduced through explicit commands from the initiator or through device implemented error recovery actions. The length of an erase gap may, in some devices, be controlled by an initiator. Minimum and maximum lengths for erase gaps is defined in some American National Standards. Some devices may have no implementation of an erase gap, but all devices have an implementation of an inter-block gap. After writing data from BOPx, the medium is considered to be a contiguous grouping of physical blocks, file marks, and gaps. Certain American National Standards define gap lengths which, if exceeded, are to be considered as having reached blank medium or a void. Depending on the format, such a void may be treated as an end-of-data indication, an error recovery area causing an interchange error, or a severe error with the medium. Unrecorded volumes (new or erased) exhibit void characteristics if an attempt is made to read or space the volume before data has been written. A sequential-access device may be capable of supporting fixed or variable length data blocks. The capability implemented by a device is acquired from the device through the READ BLOCK LIMITS command. A device that supports only fixed length physical blocks may only be capable of supporting data blocks of the same length. The length of a data block is in bytes. The length of a physical block may or may not be recorded as an exact byte count, depending on the format. A device supporting variable length data blocks or having a format and control for partitioning data blocks across fixed range of data block sizes. The concept of fixed or variable mode for writing and reading data blocks only indicates the method by which the initiator specifies the size of a data block for transfer and not the method of recording on the medium. 9.1.4. Data Buffering A device may contain a storage area capable of holding one or more data blocks - a data buffer. A storage area incapable of holding at least one maximum length data block supported by a device does not qualify as a data buffer. Such a storage area cannot support data recovery of a maximum length data block should an unrecoverable write error occur. A device with a data buffer may be capable of operating in either a buffered mode or an unbuffered mode. Either term is only applicable to the manner in which the device manages data blocks, filemarks, or setmarks to be written to the medium. The reason for this restriction is that in buffered mode, even though a device reports successful write operations, the data block(s) and/or filemarks or setmarks may not have been physically written to the medium. This data integrity exposure is eliminated by an initiator when it selects an unbuffered mode of operation. In unbuffered mode, successful completion of a write command indicates successful transmission to the medium. A device with no data buffer is an unbuffered device and operates only in an unbuffered mode. A device data buffer may contain read-ahead data from the medium or data block(s), filemarks, or setmarks waiting to be written to the medium. On write commands, a device operating in buffered mode transfers command status to an initiator once all write data has been transferred from the initiator. When writing filemarks or setmarks (in immediate mode), command status is transferred once the command is validated and the operation is started. Conversely, an initiator may be able to select an unbuffered mode of operation where the command status is not transferred until the data blocks have been successfully recorded on the medium. Should an unrecoverable write error occur while in buffered mode, the device generates an error condition to be presented for the active command or, if no command is active, on the next applicable command. [ This section needs to be expanded to reflect asynchronous ] [ event notification, extended contingent allegiance, etc. DMD ] The READ POSITION command may be used to determine the number and storage space occupied by data blocks not written before the error was encountered. For some devices, the data block number range defined for the format is available to the initiator in the READ POSITION data. Buffered and unbuffered mode is not applicable during read commands. The device implementation determines when and how much data to read ahead. Certain thresholds may be adjusted by an initiator using the MODE SELECT command. Such adjustments may be self-defeating when two initiators with unlike characteristics share the same device. Use of the RESERVE and RELEASE commands allows an initiator to set and hold threshold values, but the sharing aspect of operation is defeated (e.g., a common transaction logging operation). A device with read-ahead data blocks in the data buffer does not report an unrecovered read error until the data block containing the unrecovered read data is requested by an initiator. The WRITE FILEMARKS command with a count of zero or a count greater than zero with the immediate bit set to zero is used to cause unwritten blocks to be written to the medium. This operation is called a synchronize operation. At the end of a synchronize operation no data blocks remain in the data buffer which have not been written to the medium. The logical and physical positions are the same. A synchronize operation has no affect on a data buffer which contains only read-ahead data or data from write commands for which the data has been successfully written to the medium. 9.1.5. Recorded Object Descriptors (Block Numbering) Some recording formats specify that recorded objects (data blocks, physical blocks, filemarks, and setmarks) have descriptors included in the recorded information on the medium to help determine write sequence and also to help detect device positioning errors. The descriptor values are unique within a partition and may be unique within a volume. For some pre-formatted volumes, the descriptors are associated with physical data blocks. In variable length implementations, the descriptor can be associated with a physical block when the data block and physical block have a one-to-one relationship on the medium. Some formats may carry both recorded object descriptors and physical block descriptors. The LOCATE command defines a four-byte field to hold such descriptors. The command field may be a real physical value. However, it is sufficient for a device to be able to map a four-byte code in the command descriptor block to a unique recorded object within the partition. When a data block is split over more than one physical block or multiple data blocks are concatenated to form a physical block, the data block descriptor and physical block descriptor have no relationship to each other. The physical block descriptor, unless it is also the data block descriptor, is never made available to an initiator. Filemarks or setmarks may or may not have recorded descriptors, but, if descriptors are used in the format, then each filemark or setmark is assigned a value even if it is not recorded with the filemark or setmark. The READ POSITION and LOCATE commands use the format dependent descriptors. The size (limited to 4 bytes maximum), and content of a block descriptor is format specific and is be transparent to an initiator. That is, the READ POSITION command provides block descriptors which may be returned at some later time to a device using a LOCATE command to position to the same location (provided the volume has not been rewritten in the interim). The use of the term "block number" may imply some arithmetic sequence applied to the assignment of recorded object descriptor values. The block number assignment algorithm may be defined in an applicable format standard. 9.1.6. Direction and Position Definitions For sequential access devices, positioning has the connotation of logically being in, before, after, or at some defined place within a volume. This definition means the position is capable of being repeated under the same circumstances. The orientation of the use of the four words (in, before, after, at) is in one direction from BOPx toward EOPx. All positioning defined below is worded from this perspective. Devices without buffers may have some physical equivalent to these logical positions. However, these definitions do not require the medium to have a physical position equivalent to the logical position unless explicitly stated. The forward direction is defined as logically progressing from BOPx toward EOPx. In serpentine devices, logically forward direction has no relationship to physical motion of the medium. The reverse or backward direction is defined as logically progressing from EOPx toward BOPx. In serpentine devices, logically reverse or backward direction has no relationship to physical motion of the medium. The concept of being in some position means not being outside a defined region. The definition allows the position to be on the boundary of a defined region. When a volume is mounted and the medium motion is stopped, the position is always in some partition. When a volume is first mounted, the position is always in the Default Data Partition. When moving between partitions, there is no stable position. The concept of being "at" some position indicates being positioned to the extremity of a partition. A sequential access device may be positioned at BOM or at BOPx or at end-of-data or at EOM or at EOPx since these are stable positions at the extremities of a partition. The concept of being "before" some position indicates that there is some data block, filemark setmark, other defined mark or defined position when moving toward EOPx which may be reached if the proper commands are issued. Not all positions can be reached unless data is written to EOPx. When at BOPx, the position is also before LEOPx since this is a defined position beyond the current position. The current position may be before a data block, before a filemark or setmark, before LEOPx, before EOPx, etc. Being before a data block means that if the initiator issues a valid READ command the data is transferred to the initiator. The phrase "...being before a data block..." also carries the connotation of knowledge on the part of the device that a data block is present. This further implies having just been placed in the current position from the EOPx side of the data block. Otherwise, the phrase "...before the next recorded data block, filemark, or setmark, if any..." is the correct phrase. The LOCATE command is described using this phrasing since positioning can be from either direction and the type of the next recorded element, if any, may not be known. The concept of being "after" some position indicates that there is some data block, filemark, setmark, other defined mark or defined position on the BOPx side of the current position which may be reached if the proper commands are issued. Unless a partition has some data block or filemark written in it there is no after position defined. When a READ command for a single data block has been successfully executed the logical position is after the data block transferred. A READ REVERSE command would transfer the same data block but in a byte reverse order. For a read command, encountering a filemark or setmark leaves the logical position after the filemark or setmark. The phrase "...being after a data block..." also carries the connotation of knowledge on the part of the device that a data block is present. This further implies having just been placed in the current position from the BOPx side of the data block. Otherwise, the phrase "...after the previously recorded data block or filemark..." is correct. The LOCATE command is described using this phrasing since positioning can be from either direction and the type of recorded element before the current position may not be known. If the logical unit encounters early-warning during an ERASE command with the long bit set to zero, and any buffered data remains to be written, the target action is defined by the SEW bit of the device configuration mode parameters page (see 9.3.3). If the SEW bit is not implemented, an attempt to finish writing any buffered data may be made. In all cases, the command shall terminate with CHECK CONDITION status and the EOM and valid bits shall be set to one in the sense data. The sense key and the information bytes shall be set as defined for the early-warning condition of the WRITE command (see 9.2.15). Any buffered erases are not reported as part of the information bytes. If CHECK CONDITION status is returned for an ERASE command with the Immed bit set to one, the erase operation shall not be performed. If the CHECK CONDITION is due to the failure of a previously buffered command, the sense data shall be set as defined for the failing command. Refer to the WRITE command (9.2.15) or the WRITE FILEMARKS command (9.2.16), as appropriate. 9.2.2. LOAD/UNLOAD Command Peripheral Device Type: Sequential Access Operation Code Type: Optional Table 9-3: LOAD/UNLOAD Command ============================================================================== Bit| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | Byte | | | | | | | | | ============================================================================== 0 | Operation Code (1Bh) | -----|-----------------------------------------------------------------------| 1 | Logical Unit Number | Reserved | Immed | -----|-----------------------------------------------------------------------| 2 | Reserved | -----|-----------------------------------------------------------------------| 3 | Reserved | -----|-----------------------------------------------------------------------| 4 | Reserved | EOT | Re-Ten | Load | -----|-----------------------------------------------------------------------| 5 | Control Byte | ============================================================================== The LOAD/UNLOAD command (Table 9-13) requests that the target enable or disable the logical unit for further operations. This command may also be used to request a re-tension function. An immediate bit (Immed) of zero indicates that the target shall not return status until the load/unload operation has completed. An Immed bit of one indicates that the target shall return status as soon as the execution of all previously buffered commands have been completed and the command descriptor block of the LOAD/UNLOAD command has been validated. If CHECK CONDITION status is returned for a LOAD/UNLOAD command with an Immed bit of one, the load/unload operation shall not be performed. IMPLEMENTORS NOTE: For compatibility with devices implemented prior to this version of the standard, it is suggested that a WRITE FILEMARKS command with an Immed bit of zero be used to force any buffered data, filemarks, or setmarks to be written to the medium prior to issuing a LOAD/UNLOAD command with an Immed bit of one. An end-of-tape (EOT) bit of one and a load bit of zero indicates that the medium shall be positioned at end-of-medium (see 9.5) for removal from the peripheral device. Prior to performing the unload operation, any buffered data that is to be written shall be transferred to the medium. An EOT bit of one and a load bit of one shall cause the target to return CHECK CONDITION status. The sense key shall be set to ILLEGAL REQUEST and the additional sense code shall be set to ILLEGAL FIELD IN CDB. A re-tension (Re-Ten) bit of one indicates that the medium on the logical unit shall be correctly tensioned. Implementation of the re-tensioning function is device specific. A load bit of one indicates that the medium in the peripheral device shall be loaded and positioned to the beginning-of-medium (see 9.5). A load bit of zero indicates that the medium in the peripheral device shall be positioned for removal at the extreme position along the medium permitted by the device in the direction away from the supply reel. Prior to performing the unload operation, any buffered data that is to be written shall be transferred to the medium. After completing the unload operation, the target shall return CHECK CONDITION status with the sense key set to NOT READY for all medium-access commands until a new medium is installed or a load operation is successfully completed. For buffered mode 1h and 2h (buffered mode of the MODE SENSE command) the target shall discard the buffered data when a LOAD/UNLOAD command is validated if the previous command was terminated with CHECK CONDITION status. 9.2.3. LOCATE Command Peripheral Device Type: Sequential Access Operation Code Type: Optional Table 9-4: LOCATE Command ============================================================================== Bit| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | Byte | | | | | | | | | ============================================================================== 0 | Operation Code (2Bh) | -----|-----------------------------------------------------------------------| 1 | Logical Unit Number | Reserved | BT | CP | Immed | -----|-----------------------------------------------------------------------| 2 | Reserved | -----|-----------------------------------------------------------------------| 3 | (MSB) | -----|--- ---| 4 | | -----|--- Block Address ---| 5 | | -----|--- ---| 6 | (LSB) | -----|-----------------------------------------------------------------------| 7 | Reserved | -----|-----------------------------------------------------------------------| 8 | Partition | -----|-----------------------------------------------------------------------| 9 | Control Byte | ============================================================================== LOCATE command causes the target to position the medium to the specified block, or filemark within the specified partition. The logical position shall be located before the specified block or filemark. If the Report Setmarks bit (RMS) bit in the MODE SELECT Device Configuration Parameters page is set to one (see 9.3.3) then the LOCATE command causes the target to position the specified setmark within the specified partition. The logical position shall be located before the specified setmark. If there is data that is to be written to the medium in the target's buffer, that data shall be written to the medium prior to performing the locate operation. A block address type (BT) bit of one indicates the value in the block address field shall be interpreted as a product specific value. A BT bit of zero indicates the value in the block address field shall be interpreted as an SCSI logical block address. A change partition (CP) bit of one indicates that a change to the partition as specified in the partition field is to occur prior to positioning to the block specified in the block address field. A CP bit of zero indicates no partition change is to be made and the partition field is to be ignored. An immediate (Immed) bit of zero indicates that the target shall not return status until the locate operation has completed. An Immed bit of one indicates that the target shall return status as soon as the execution of all previous commands have been completed and the command descriptor block of the LOCATE command has been validated. If CHECK CONDITION status is returned for a LOCATE command with an Immed bit of one, the locate operation shall not be performed. The block address field specifies the block to which the target shall position the medium. The value is either a product-specific value (BT bit equal to one) or a logical block address (BT bit equal to zero). The partition field specifies which partition to select if the CP bit is one. Refer to the MODE SENSE Medium Partition Parameters (9.3.4 ) for additional information about partitioning. 9.2.4. PREVENT/ALLOW MEDIUM REMOVAL Command Peripheral Device Type: Sequential Access Operation Code Type: Optional Table 9-5: PREVENT/ALLOW MEDIUM REMOVAL Command ============================================================================== Bit| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | Byte | | | | | | | | | ============================================================================== 0 | Operation Code (1Eh) | -----|-----------------------------------------------------------------------| 1 | Logical Unit Number | Reserved | -----|-----------------------------------------------------------------------| 2 | Reserved | -----|-----------------------------------------------------------------------| 3 | Reserved | -----|-----------------------------------------------------------------------| 4 | Reserved | Prevent| -----|-----------------------------------------------------------------------| 5 | Control Byte | ============================================================================== The PREVENT/ALLOW MEDIUM REMOVAL command (Table 9-29) requests that the target enable or disable the removal of the medium in the logical unit. A prevent bit of one shall inhibit mechanisms that normally allow removal of the medium. A prevent bit of zero shall allow removal of the medium. The prevention of medium removal condition shall terminate upon receipt of a PREVENT/ALLOW MEDIUM REMOVAL command with a prevent bit of zero, by the receipt of a BUS DEVICE RESET message from any initiator, by a hard RESET condition, or by a power off/on cycle. 9.2.5. READ Command Peripheral Device Type: Sequential Access Operation Code Type: Mandatory Table 9-6: READ Command ============================================================================== Bit| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | Byte | | | | | | | | | ============================================================================== 0 | Operation Code (08h) | -----|-----------------------------------------------------------------------| 1 | Logical Unit Number | Reserved | SILI | Fixed | -----|-----------------------------------------------------------------------| 2 | (MSB) | -----|--- ---| 3 | Transfer Length | -----|--- ---| 4 | (LSB) | -----|-----------------------------------------------------------------------| 5 | Control Byte | ============================================================================== The READ command (Table 9-30) requests that the target transfer one or more block(s) of data to the initiator beginning with the next block on the logical unit. The fixed bit specifies whether fixed-length or variable-length blocks are to be transferred. The only mandatory implementation of this command is fixed block mode. Refer to the READ BLOCK LIMITS command (9.2.6) for additional information about fixed and variable block mode. If the fixed bit is one, the transfer length specifies the number of fixed- length blocks to be transferred, using the current block length reported in the MODE SENSE block descriptor (see 7.1.10). If the fixed bit is zero, a variable-length block is requested with the transfer length specifying the maximum number of bytes allocated for the returned data. A successful READ command with a fixed bit of one shall transfer the requested transfer length times the current block length in bytes to the initiator. A successful READ command with a fixed bit of zero shall transfer the requested transfer length in bytes to the initiator. Upon completion, the logical position shall be after the last block transferred (end-of-partition side). If the suppress incorrect length indicator (SILI) bit is one, the target shall not return CHECK CONDITION status if the only error is that the transfer length is not equal to the actual block length. This option is only valid when the fixed bit is zero. IMPLEMENTORS NOTE: Since residue information is not reported when the SILI bit is set, other methods for determining the actual block length should be used (e.g., length information could be included in the data block). If the SILI bit is zero and an incorrect length block is read, CHECK CONDITION status shall be returned and the ILI and valid bits shall be set to one in the sense data. Upon termination, the logical position shall be after the incorrect length block (end-of-partition side). If the fixed bit is one, the information bytes shall be set to the difference (residue) of the requested transfer length minus the actual number of blocks read (not including the incorrect length block). If the fixed bit is zero, the information bytes shall be set to the difference (residue) of the requested transfer length minus the actual block length. Targets that do not support negative residues shall set the information bytes to zero if the actual block length is larger than the requested length. A transfer length of zero indicates that no data shall be transferred. This condition shall not be considered an error and the logical position shall not be changed. If the logical unit encounters a filemark during a READ command, CHECK CONDITION status shall be returned, the sense shall be set to NO SENSE, and the filemark and valid bits shall be set to one in the sense data. If the Report Setmarks (RSM) bit is set to one in the MODE SENSE Device Configuration Parameters page (see 9.3.3) and the unit encounters a setmark during a READ command, CHECK CONDITION status shall be returned, the sense key set to NO SENSE, and the filemark and valid bits shall be set to one in the sense data. The Additional Sense Codes shall indicate "Setmark Detected". Upon termination, the logical position shall be after the filemark or setmark (end- of-partition side). If the fixed bit is one, the information bytes shall be set to the difference (residue) of the requested transfer length minus the actual number of blocks read (not including the filemark or setmark ). If the fixed bit is zero, the information bytes shall be set to the requested transfer length. If the logical unit encounters early-warning during a READ command and the REW bit is set to one in the MODE SENSE Device Configuration Parameters page (see 9.3.3), CHECK CONDITION status shall be returned upon completion of the current block. The EOM and valid bits shall be set to one in the sense data. Upon termination, the logical position shall be after the last block transferred (end-of-partition side). If the fixed bit is one, the information bytes shall be set to the difference (residue) of the requested transfer length minus the actual number of blocks read. If the fixed bit is zero, the information bytes shall be set to the difference (residue) of the requested transfer length minus the actual block length. The target shall not return CHECK CONDITION status when early-warning is encountered if the REW bit is zero or if the option is not supported. IMPLEMENTORS NOTE: Setting the REW bit is not recommended for most system applications since read data may be present after early-warning. If the logical unit encounters end-of-data (see 9.5) during a READ command, CHECK CONDITION status shall be returned, the sense key shall be set to BLANK CHECK, and the valid bit shall be set to one in the sense data. If end-of- data is encountered at or after early-warning, the EOM bit shall also be set to one. Upon termination, the logical position shall be after the last recorded logical block (end-of-partition side). If the fixed bit is one, the information bytes shall be set to the difference (residue) of the requested transfer length minus the actual number of blocks read. If the fixed bit is zero, the information bytes shall be set to the requested transfer length. If the logical unit encounters end-of-partition (see 9.5) during a READ command, CHECK CONDITION status shall be returned, the sense key shall be set to MEDIUM ERROR, and the EOM and valid bits shall be set to one in the sense data. The medium position following this condition is not defined. If the fixed bit is one, the information bytes shall be set to the difference (residue) of the requested transfer length minus the actual number of blocks read. If the fixed bit is zero, the information bytes shall be set to the requested transfer length. If any of the following conditions occur, the target shall return CHECK CONDITION status and shall set the sense key as indicated in the following table. This table does not provide an exhaustive enumeration of all conditions that may cause the CHECK CONDITION status. Condition Sense Key ------------------------------------------- ------------------------ Fixed bit is zero and variable block ILLEGAL REQUEST mode is not supported Fixed bit is zero and the requested ILLEGAL REQUEST block length is not supported Fixed bit is one and the current MODE ILLEGAL REQUEST SENSE block length is zero Fixed bit and SILI bit set to one ILLEGAL REQUEST Unrecovered read error MEDIUM ERROR (note 1, 2) NOTES: (1) If the fixed bit is one, the information bytes shall be set to the difference (residue) of the requested transfer length minus the actual number of blocks read (not including the unrecovered block). If the fixed bit is zero, the information bytes shall be set to the requested transfer length. Upon termination, the logical position shall be after the unrecovered block. (2) If the error recovery mode parameters page (see 9.3.1) is implemented, the current settings specify the target error recovery criteria. If this page is not implemented, the error recovery is vendor unique. 9.2.8. READ REVERSE Command Peripheral Device Type: Sequential Access Operation Code Type: Optional Table 9-11: READ REVERSE Command ============================================================================== Bit| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | Byte | | | | | | | | | ============================================================================== 0 | Operation Code (0Fh) | -----|-----------------------------------------------------------------------| 1 | Logical Unit Number | Reserved | SILI | Fixed | -----|-----------------------------------------------------------------------| 2 | (MSB) | -----|--- ---| 3 | Transfer Length | -----|--- ---| 4 | (LSB) | -----|-----------------------------------------------------------------------| 5 | Control Byte | ============================================================================== The READ REVERSE command (Table 9-8) requests that the target transfer one or more block(s) of data to the initiator beginning at the current position on the logical unit. The execution of this command is similar to the READ command except that medium motion is in the reverse direction. All block(s), and the bytes within the block(s), are transferred in the reverse order. The order of bits within each byte shall not be changed. Upon completion of a READ REVERSE command, the logical position shall be before last block transferred (beginning-of- partition side). Refer to the READ command (9.2.5) for a description of the fixed bit, the SILI bit, and the transfer length field. Filemarks, setmarks, and incorrect length blocks are handled the same as in the READ command, except that upon termination the logical position shall be before the filemark, setmark, or incorrect length block (beginning-of- partition side). If the logical unit encounters beginning-of-partition (see 9.5) during a READ REVERSE command, CHECK CONDITION status shall be returned and the EOM and valid bits shall be set to one in the sense data. If the fixed bit is one, the information bytes shall be set to the difference (residue) of the requested transfer length minus the actual number of blocks transferred. If the fixed bit is zero, the information bytes shall be set to the requested transfer length. If any of the following conditions occur, the target shall return CHECK CONDITION status and shall set the sense key as indicated in the following table. This table does not provide an exhaustive enumeration of all conditions that may cause the CHECK CONDITION status. Condition Sense Key ------------------------------------------- ------------------------ Fixed bit is zero and variable block ILLEGAL REQUEST mode is not supported Fixed bit is zero and the requested ILLEGAL REQUEST block length is not supported Fixed bit is one and the current MODE ILLEGAL REQUEST SENSE block length is zero Fixed bit and SILI bit set to one ILLEGAL REQUEST Unrecovered read error MEDIUM ERROR (note 1, 2) NOTES: (1) If the fixed bit is one, the information bytes shall be set to the difference (residue) of the requested transfer length minus the actual number of blocks read (not including the unrecovered block). If the fixed bit is zero, the information bytes shall be set to the requested transfer length. Upon termination, the logical position shall be before the unrecovered block (beginning-of-partition side). (2) If the error recovery mode parameters page (see 9.3.1) is implemented, the current settings specify the target error recovery criteria. If this page is not implemented, the error recovery is vendor unique. 9.2.9. RECOVER BUFFERED DATA Command Peripheral Device Type: Sequential Access Operation Code Type: Optional Table 9-12: RECOVER BUFFERED DATA Command ============================================================================== Bit| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | Byte | | | | | | | | | ============================================================================== 0 | Operation Code (14h) | -----|-----------------------------------------------------------------------| 1 | Logical Unit Number | Reserved | SILI | Fixed | -----|-----------------------------------------------------------------------| 2 | (MSB) | -----|--- ---| 3 | Transfer Length | -----|--- ---| 4 | (LSB) | -----|-----------------------------------------------------------------------| 5 | Control Byte | ============================================================================== The RECOVER BUFFERED DATA command (Table 9-12) is used to recover data that has been transferred to the target's buffer but has not been successfully written to the medium. It is normally used to recover from error or exception conditions that make it impossible to write the buffered data to the medium. One or more RECOVER BUFFERED DATA commands may be required to recover all unwritten buffered data. The execution of this command is similar to the READ command except that the data is transferred from the target's buffer instead of the medium. The order in which block(s) are transferred is defined by the RBO bit in the MODE SENSE Device Configuration Parameters page (see 9.3.3). If the RBO bit is not implemented, block(s) are transferred in the same order they would have been transferred to the medium. Refer to the READ command (9.2.5) for a description of the fixed bit, the SILI bit, and transfer length field. During a RECOVER BUFFERED DATA command, no more than the requested length shall be transferred. If the requested block length is smaller than the actual block length, a truncated block will be transferred to the initiator and the remaining data from the truncated block will be discarded. IMPLEMENTORS NOTE: During recovery operations involving unknown block sizes, the initiator should select the maximum block length supported by the target to ensure that all buffered data will be transferred. If a buffered filemark is encountered during a RECOVER BUFFERED DATA command, CHECK CONDITION status shall be returned, the sense key shall be set to NO SENSE, and the filemark and valid bits shall be set to one in the sense data. If the Report Setmarks (RMS) bit is set to one in the MODE SENSE Device Parameters page (see 9.3.3) and a buffered setmark is encountered during a RECOVER BUFFERED DATA command, CHECK CONDITION status shall be returned, the sense key shall be set to NO SENSE, and the filemark and valid bits shall set to one in the sense data. The Additional Sense Codes shall indicate "Setmark Detected". ( Upon termination, the logical position shall be after the filemark or setmark. If the fixed bit is one, the information bytes shall be set to the difference (residue) of the requested transfer length minus the actual number of blocks transferred (not including the filemark or setmark). If the fixed bit is zero, the information bytes shall be set to the requested transfer length. If an attempt is made to recover more logical blocks of data than are contained in the target's buffer, CHECK CONDITION status shall be returned, the sense key shall be set to NO SENSE, and the EOM and valid bits shall be set to one in the sense data. If the fixed bit is one, the information bytes shall be set to the difference (residue) of the requested transfer length minus the actual number of blocks transferred. If the fixed bit is zero, the information bytes shall be set to the requested transfer length. If any of the following conditions occur, the target shall return CHECK CONDITION status and shall set the sense key as indicated in the following table. This table does not provide an exhaustive enumeration of all conditions that may cause the CHECK CONDITION status. Condition Sense Key ------------------------------------------- ------------------------ Fixed bit is zero and variable block ILLEGAL REQUEST mode is not supported Fixed bit is zero and the requested ILLEGAL REQUEST block length is not supported Fixed bit is one and the current MODE ILLEGAL REQUEST SENSE block length is zero Fixed bit and SILI bit set to one ILLEGAL REQUEST 9.2.12. SPACE Command Peripheral Device Type: Sequential Access Operation Code Type: Mandatory Table 9-15: SPACE Command ============================================================================== Bit| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | Byte | | | | | | | | | ============================================================================== 0 | Operation (11h) | -----|-----------------------------------------------------------------------| 1 | Logical Unit Number | Reserved | Code | -----|-----------------------------------------------------------------------| 2 | (MSB) | -----|--- ---| 3 | Count | -----|--- ---| 4 | (LSB) | -----|-----------------------------------------------------------------------| 5 | Control Byte | ============================================================================== The SPACE command (Table 9-39) provides a variety of positioning functions that are determined by the code and count. Both forward and reverse positioning are provided, although some targets may only support a subset of this command. Such targets shall return CHECK CONDITION status and set the sense key to ILLEGAL REQUEST in response to any attempt to invoke a function that is not supported. The code is defined as follows: DB(2) DB(1) DB(0) Description Support ----- ----- ----- -------------------- --------- 0 0 0 Blocks Mandatory 0 0 1 Filemarks Mandatory 0 1 0 Sequential Filemarks Optional 0 1 1 End-of-Data Optional 1 0 0 Setmarks Optional 1 0 1 Sequential Setmarks Optional If the Report Setmarks (RSM) bit is set to zero in the MODE SENSE Device Configuration Parameters page (see 9.3.3) and the SPACE command specifies spacing over setmarks or sequential setmarks the target shall reject the command by returning CHECK CONDITION status. The sense key shall be set to to ILLEGAL REQUEST. When spacing over blocks, filemarks, or setmarks, the count field specifies the number of blocks, filemarks, or setmarks to be spaced over. A positive value N in the count field shall cause forward medium movement over N blocks, filemarks, or setmarks ending on the end-of-partition side of the last block, filemark, or setmark. A zero value in the count field shall cause no medium movement. A negative value -N (two's complement notation) in the count field shall cause reverse medium movement over N blocks, filemarks, or setmarks ending on the beginning-of-partition side of the last block, filemark, or setmark. Support of spacing in the reverse direction is optional. If a filemark is encountered while spacing over blocks, the command shall be terminated. If the Report Setmarks (RSM) bit is set to one in the MODE SENSE Device Configuration Parameters page (see 9.3.3) and setmark is encountered while spacing over blocks or filemarks the command shall be terminated. The logical position shall be on the the end-of-partition side of the filemark or setmark if movement was in the forward direction and on the beginning-of- partition side of the filemark or setmark if movement was in the reverse direction. CHECK CONDITION status shall be returned to the initiator, the sense key shall be set to NO SENSE, and the filemark or setmark and valid bits shall be set to one in sense data. The Additional Sense Codes will indicate whether a filemark or setmark was detected. The information bytes shall be set to the difference (residue) of the requested count minus the actual number of blocks spaced over (not including the filemark or setmark). If the early-warning point is encountered during a SPACE command, and the REW bit is set to one in the MODE SENSE Device Configuration Parameters page (see 9.3.3), CHECK CONDITION status shall be returned, the sense key shall be set to NO SENSE, and the EOM and valid bits shall be set to one in sense data. The information bytes shall be set to the difference (residue) of the requested count minus the actual number of blocks spaced over (not including the filemark or setmark). If the REW bit is zero or the option is not supported by the target, the target shall not report CHECK CONDITION status at the early- warning point. IMPLEMENTORS NOTE: It is usually desirable for the target to not report the early-warning condition during a SPACE command because data may be present after the early-warning point. If end-of-data is encountered while spacing over blocks, filemarks, or setmarks, CHECK CONDITION status shall be returned, the sense key shall be set to BLANK CHECK, and the valid bit shall be set to one. Additionally, the EOM bit shall be set to one if end-of-data is encountered at or after early- warning. The information bytes shall be set to the difference (residue) of the requested count minus the actual number of blocks, filemarks, or setmarks spaced over. If the end-of-partition is encountered while spacing forward over blocks, filemarks, or setmarks, CHECK CONDITION status shall be returned, the sense key shall be set to MEDIUM ERROR, and the valid bit shall be set to one. The information bytes shall be set to the difference (residue) of the requested count minus the actual number of blocks, filemarks, or setmarks spaced over. If beginning-of-medium is encountered while spacing over blocks, filemarks, or setmarks in the reverse direction, the target shall return CHECK CONDITION status and shall set the sense key to NO SENSE. The EOM and valid bits shall be set to one, and set the information bytes to the difference (residue) of the requested count minus the actual number of blocks, filemarks, or setmarks spaced over. When spacing over sequential filemarks or setmarks, the count field is interpreted as follows: (1) A positive value N shall cause forward movement to the first occurrence of N or more consecutive filemarks or setmarks being logically positioned after the Nth filemark. or setmark. (2) A zero value shall cause no change in the logical position. (3) A negative value -N (2's complement notation) shall cause reverse movement to the first occurrence of N or more consecutive filemarks or setmarks being logically positioned on the beginning-of-partition side of the Nth filemark. If end-of-partition is encountered while spacing to sequential filemarks or setmarks, CHECK CONDITION status shall be returned, the sense key shall be set to MEDIUM ERROR, the EOM shall be set to one, and the valid bit shall be set to zero. If end-of-data is encountered while spacing to sequential filemarks or setmarks, CHECK CONDITION status shall be returned, the sense key shall be set to BLANK CHECK, the EOM bit shall be set to one, and the valid bit shall be set to zero. When spacing to end-of-data (see 9.5), the count field is ignored. Upon successful completion, the medium shall be postioned such that a subsequent WRITE command would append data to the last logically recorded information. If end-of-partition is encountered while spacing to end-of-data, CHECK CONDITION status shall be returned, the sense key shall be set to MEDIUM ERROR, the EOM shall be set to one, and the valid bit shall be set to zero. 9.2.13. VERIFY Command Peripheral Device Type: Sequential Access Operation Code Type: Optional Table 9-16: VERIFY Command ============================================================================== Bit| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | Byte | | | | | | | | | ============================================================================== 0 | Operation Code (13h) | -----|-----------------------------------------------------------------------| 1 | Logical Unit Number | Reserved | Immed | BytCmp | Fixed | -----|-----------------------------------------------------------------------| 2 | (MSB) | -----|--- ---| 3 | Verification Length | -----|--- ---| 4 | (LSB) | -----|-----------------------------------------------------------------------| 5 | Control Byte | ============================================================================== The VERIFY command (Table 9-27) requests that the target verify one or more block(s) beginning with the next block on the logical unit. Refer to the READ command (9.2.5) for a description of the fixed bit. A byte compare (BytCmp) bit of zero indicates that the verification shall be simply a medium verification (CRC, ECC, etc.). No data shall be transferred between the initiator and target. The verification length specifies the amount of data to verify, in blocks or bytes, as indicated by the fixed bit. A BytCmp bit of one indicates that a byte-by-byte compare of the data on the medium and the data transferred from the initiator shall be performed by the target. Data shall be transferred from the initiator to the target as in a WRITE command. The verification length specifies the amount of data to verify, in blocks or bytes, as indicated by the fixed bit. An immediate (Immed) bit of zero indicates that the command shall not return status until the verify operation has completed. An Immed bit of one indicates that status shall be returned as soon as the command descriptor block has been validated (but after the data transfer from the initiator, if the BytCmp bit is one). IMPLEMENTORS NOTE: In order to ensure that no errors are lost, the initiator should set the Immed bit to zero on the last VERIFY command when issuing a series of VERIFY commands. When the verification length is zero, no data shall be verified and the current logical position shall not be changed. This condition shall not be considered as an error. The VERIFY command shall terminate when the verification length has been satisfied, when an incorrect length block is encountered, when a filemark is encountered, when end-of-data is encountered or when the end-of-partition is encountered. If the Report Setmarks bit is set to one in the MODE SENSE Device Configuration Parameters page (see 9.3.3) and a setmark is encountered the command shall terminate. If the Read Early Warning (RDEW) bit is set to one in the MODE SENSE Device Configuration Parameters page and early-warning is encountered the command shall terminate. The status and sense data for each of these conditions are handled in the same manner as in the READ command (see 9.2.5). Upon successful completion of a VERIFY command, the logical position shall be after the last block verified. If the data does not compare (BytCmp bit of one), the command shall terminate with CHECK CONDITION status, the valid bit shall be set to one, and the sense key shall be set to MISCOMPARE. If the fixed bit is one, the information bytes shall be set to the difference (residue) of the requested verification length minus the actual number of blocks successfully verified. If the fixed bit is zero, the information bytes shall be set to the requested verification length minus the actual number of bytes successfully verified. This number may be larger than the requested verification length if the error occurred on a previous VERIFY command with an Immed bit of one. Upon termination, the medium shall be positioned after the block containing the miscompare (end-of-medium side). If any of the following conditions occur, the target shall return CHECK CONDITION status and shall set the sense key as indicated in the following table. This table does not provide an exhaustive enumeration of all conditions that may cause the CHECK CONDITION status. Condition Sense Key ------------------------------------------- ------------------------ Fixed bit is zero and variable block ILLEGAL REQUEST mode is not supported Fixed bit is zero and the requested ILLEGAL REQUEST block length is not supported Fixed bit is one and the current MODE ILLEGAL REQUEST SENSE block length is zero BytCmp bit is one and byte compare ILLEGAL REQUEST is not supported Unrecovered read error MEDIUM ERROR (note 1, 2) NOTES: (1) If the fixed bit is one, the information bytes shall be set to the difference (residue) of the requested verification length minus the actual number of blocks verified (not including the unrecovered block). If the fixed bit is zero, the information bytes shall be set to the requested verification length. Upon termination, the logical position shall be after the unrecovered block (end-of-partition side). (2) If the error recovery mode parameters page (see 9.3.1) is implemented, the current settings specify the target error recovery criteria. If this page is not implemented, error recovery is device specific. 9.2.14. WRITE Command Peripheral Device Type: Sequential Access Operation Code Type: Mandatory Table 9-17: WRITE Command ============================================================================== Bit| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | Byte | | | | | | | | | ============================================================================== 0 | Operation Code (0Ah) | -----|-----------------------------------------------------------------------| 1 | Logical Unit Number | Reserved | Fixed | -----|-----------------------------------------------------------------------| 2 | (MSB) | -----|--- ---| 3 | Transfer Length | -----|--- ---| 4 | (LSB) | -----|-----------------------------------------------------------------------| 5 | Control Byte | ============================================================================== The WRITE command (Table 9-6) equests that the target write the data that is transferred from the initiator to the current position on the logical unit. The fixed bit specifies whether fixed-length or variable-length blocks are to be transferred. The only mandatory implementation of this command is fixed block mode. See the READ BLOCK LIMITS command (9.2.6) for additional information about fixed and variable block mode. If the fixed bit is one, the transfer length specifies the number of fixed- length blocks to be transferred, using the current block length reported in the MODE SENSE block descriptor (see 7.1.10). If the fixed bit is zero, a single block is transferred with the transfer length specifying block length. If the transfer length is zero, no data shall be transferred and the current position on the logical unit shall not be changed. This condition shall not be considered an error. A WRITE command may be buffered or unbuffered, as specified by the buffered mode field of the MODE SENSE header (see 9.3). For unbuffered operation (buffered mode 0h), the target shall not return GOOD status until all data block(s) are successfully written to the medium. For buffered operation (buffered mode 1h or 2h), the target may return GOOD status as soon as all data block(s) are successfully transferred to the buffer. IMPLEMENTORS NOTE: When completing a buffered write operation, the initiator should issue a WRITE FILEMARKS command with the Immed bit set to zero to ensure that all buffered data, filemarks, and setmarks are written to the medium (see 9.2.16). If the logical unit encounters early-warning during a WRITE command, an attempt to finish writing any data may be made, as determined by the current settings of the REW and SEW bits in the MODE SENSE Device Configuration Parameters page (see 9.3.3). The command shall terminate with CHECK CONDITION status and the EOM and valid bits shall be set to one in the sense data. If all data that is to be written is successfully transferred to the medium, the information bytes shall be set to zero. If any data that is to be written is not transferred to the medium, the sense key shall be set to VOLUME OVERFLOW and the information bytes shall be defined as follows: (1) If unbuffered mode is reported in the MODE SENSE header (see 9.3) and the fixed bit is set to one, the information bytes shall be set to the difference (residue) of the requested transfer length minus the actual number of blocks written. (2) If unbuffered mode is reported and the fixed bit is set to zero, the information bytes shall be set to the requested transfer length. (3) If buffered mode is reported in the MODE SENSE header (see 9.3) and the fixed bit is set to one, the information bytes shall be set to the total number of blocks, filemarks, and setmarks not written (the number of blocks not transferred from the initiator plus the number of blocks, filemarks, and setmarks remaining in the target's buffer). Note that the value in the information bytes may exceed the transfer length. (4) If buffered mode is reported and the fixed bit is set to zero, the information bytes shall be set to the total number of bytes, filemarks, and setmarks not written (the number of bytes not transferred from the initiator plus the number of bytes, filemarks, and setmarks remaining in the target's buffer). Note that the value in the information bytes may exceed the transfer length. IMPLEMENTORS NOTE: The target should ensure that some additional data can be written to the medium (e.g., labels, filemarks, or setmarks) after the first early- warning indication has been returned to the initiator. If a WRITE command is received while the logical unit is positioned between early-warning and end-of-partition (see 9.5), the target shall return CHECK CONDITION status after attempting to perform the command. The EOM and valid bits shall be set to one in the sense data. If all data that is to be written is successfully transferred to the medium, the information bytes shall be set to zero. If any data that is to be written is not transferred to the medium prior to encountering end-of-partition, the sense key shall be set to VOLUME OVERFLOW and the information bytes shall be defined as follows: (1) If the fixed bit is one, the information bytes shall be set to the difference (residue) of the requested transfer length minus the actual number of blocks written to the medium. (2) If the fixed bit is zero, the information bytes shall be set to the requested transfer length. IMPLEMENTORS NOTE: Any WRITE command received between early-warning and end-of-partition is executed in unbuffered mode, regardless of the buffered mode reported in the MODE SENSE header (see 9.3) If any of the following conditions occur, the target shall return CHECK CONDITION status and shall set the sense key as indicated in the following table. This table does not provide an exhaustive enumeration of all conditions that may cause the CHECK CONDITION status. Condition Sense Key ------------------------------------------- ------------------------ Fixed bit is zero and variable block ILLEGAL REQUEST mode is not supported Fixed bit is zero and the requested ILLEGAL REQUEST block length is not supported Fixed bit is one and the current MODE ILLEGAL REQUEST SENSE block length is zero Write attempt on write protected medium DATA PROTECT Unrecovered write error MEDIUM ERROR (note 1, 2, 3, 4) Deferred write error MEDIUM ERROR (note 1, 3, 4) VOLUME OVERFLOW NOTES: (1) If the MODE SENSE Error Recovery Parameters page (see 9.3.1) is implemented, the current settings specify the target error recovery criteria. If the page is not supported, error recovery is device specific. (2) If unbuffered mode is selected and the fixed bit is set to one, the information bytes shall be set to the difference (residue) of the requested transfer length minus the actual number of blocks written. If unbuffered mode is selected and the fixed bit is set to zero, the information bytes shall be set to the requested transfer length. (3) If buffered mode is selected and the fixed bit is one, the information bytes shall be set to the total number of blocks, filemarks, and setmarks not written (the number of blocks not transferred from the initiator plus the number of blocks, filemarks, and setmarks remaining in the target's buffer). If buffered mode is selected and the fixed bit is zero, the information bytes shall be set to the total number of bytes, filemarks, and setmarks not written (the number of bytes not transferred from the initiator plus the number of bytes, filemarks, and setmarks remaining in the target's buffer). In both cases, the value in the information bytes may exceed the transfer length. (4) If buffered mode 1h is selected, the error shall be reported to the first initiator issuing a command (other than INQUIRY or REQUEST SENSE) or the first initiator responding to asynchronous event notification. If buffered mode 2h is selected, the error shall be reported to the initiator with unwritten data in the buffer. See section 6.6 for a description of asynchronous event notification. See section 6.9 for a description of extended contingent allegiance. See section 7.1.15.2 for a description of deferred errors. 9.2.15. WRITE FILEMARKS Command Peripheral Device Type: Sequential Access Operation Code Type: Mandatory Table 9-18: WRITE FILEMARKS Command ============================================================================== Bit| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | Byte | | | | | | | | | ============================================================================== 0 | Operation Code (10h) | -----|-----------------------------------------------------------------------| 1 | Logical Unit Number | Reserved | SM | Immed | -----|-----------------------------------------------------------------------| 2 | (MSB) | -----|--- ---| 3 | Number of Filemarks or Setmarks | -----|--- ---| 4 | (LSB) | -----|-----------------------------------------------------------------------| 5 | Control Byte | ============================================================================== The WRITE FILEMARKS command (Table 9-43) requests that the target write the specified number of filemarks or setmarks to the medium beginning at the current position on the logical unit. The only mandatory implementation of this command is with the immediate bit set to zero. An immediate (Immed) bit of one indicates that the target shall return status as soon as the command descriptor block has been validated. If buffered mode is reported in the MODE SENSE header (see 9.3), the specified number of filemarks or setmarks shall be written. If unbuffered mode is reported, the command shall be rejected. A setmark (SM) bit set to zero indicates that filemarks will be written to the media. A (SM) bit set to one indicates that setmarks will be written to the media. An Immed bit of zero indicates that the target shall not return status until the operation has completed. Any buffered data, filemarks, and setmarks shall be written to the medium prior to completing the command. IMPLEMENTORS NOTE: Upon completion of a buffered write operation, an initiator can issue a WRITE FILEMARKS command with the Immed bit set to zero and the number of filemarks or setmarks field set to zero to ensure that all buffered data, filemarks, and setmarks are successfully written to the medium. If the logical unit encounters early-warning during a WRITE FILEMARKS command, an attempt to finish writing any buffered data, filemarks, and setmarks may be made, as determined by the current settings of the REW and SEW bits in the MODE SENSE Device Configuration Parameters page (see 9.3.3). The command shall terminate with CHECK CONDITION status and the EOM and valid bits shall be set to one in the sense data. If all buffered data, filemarks, and setmarks are successfully transferred to the medium, the information bytes shall be set to zero. If any buffered data, filemarks, and setmarks to be written are not transferred to the medium, the sense key shall be set to VOLUME OVERFLOW and the information bytes shall be defined as follows: (1) If unbuffered mode is reported in the MODE SENSE header (see 9.3), the information bytes shall be set to the difference (residue) of the requested transfer length minus the actual number of filemarks or setmarks written. (2) If buffered mode is reported in the MODE SENSE header (see 9.3), and the buffered data was written in variable block mode (see 9.2.15), the information bytes shall be set to the total number of bytes, filemarks, and setmarks not written (the number of filemarks or setmarks not transferred from the initiator plus the number of bytes, filemarks, and setmarks remaining in the target's buffer). Note that it is possible for the value in the information bytes to exceed the transfer length. (3) If buffered mode is reported and the buffered data was written in fixed block mode (see 9.2.15), the information bytes shall be set to the total number of blocks, filemarks, and setmarks not written (the number filemarks or setmarks not transferred from the initiator plus the number of blocks, filemarks, and setmarks remaining in the target's buffer). Note that it is possible for the value in the information bytes to exceed the transfer length. IMPLEMENTORS NOTE: The target should ensure that some additional data can be written to the medium (e.g., labels, filemarks, and setmarks) after the first early- warning indication has been returned to the initiator. If a WRITE FILEMARKS command is received while the logical unit is positioned between early-warning and end-of-partition (see 9.5), the target shall return CHECK CONDITION status after attempting to perform the command. The EOM and valid bits shall be set to one in the sense data. If all filemarks or setmarks to be written are successfully transferred to the medium, the information bytes shall be set to zero. If any filemarks or setmarks to be written are not transferred to the medium prior to encountering end-of-partition, the sense key shall be set to VOLUME OVERFLOW and the information bytes shall be set to the difference (residue) of the requested transfer length minus the actual number of filemarks or setmarks written to the medium. IMPLEMENTORS NOTE: Any WRITE FILEMARKS command received between early- warning and end-of-partition is executed in unbuffered mode, regardless of the buffered mode reported in the MODE SENSE header (see 9.3) If any of the following conditions occur, the target shall return CHECK CONDITION status and shall set the sense key as indicated in the following table. This table does not provide an exhaustive enumeration of all conditions that may cause the CHECK CONDITION status. Condition Sense Key ------------------------------------------- ------------------------ Immed bit is one and buffered filemark ILLEGAL REQUEST or setmark mode is not supported Immed bit is one and unbuffered mode ILLEGAL REQUEST is reported in MODE SENSE header Immed bit is one and number of filemarks ILLEGAL REQUEST or setmarks field is set to zero Write filemark or setmark attempted DATA PROTECT on write protected medium 9.3. MODE SELECT/MODE SENSE Parameters The generic parameters for the MODE SELECT(6) and MODE SENSE(6) commands are described in section 7.1.6 and section 7.1.8. These commands are mandatory for sequential access devices. The generic parameters for the MODE SELECT/MODE SENSE header are described in section 7.1.10. The following describes the device specific parameters byte (byte 2) of the header. Table 9-19: Sequential-Access Device Specific Parameter Byte ============================================================================== Bit| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | Byte | | | | | | | | | ============================================================================== 0 | Sense Data Length | -----|-----------------------------------------------------------------------| 1 | Medium Type | -----|-----------------------------------------------------------------------| 2 | WP | Buffered Mode | Speed | -----|-----------------------------------------------------------------------| 3 | Block Descriptor Length | ============================================================================== For the MODE SENSE command, a write protect (WP) bit of zero indicates that the medium is write enabled. A WP bit of one indicates that the medium is write protected. For the MODE SELECT command, this field is ignored. 9.3.3. Device Configuration Parameters Page Table 9-26: Device Configuration Parameters ============================================================================== Bit| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | Byte | | | | | | | | | ============================================================================== 0 |Reserved|Reserved| Page Code (10h) | -----|-----------------------------------------------------------------------| 1 | Additional Page Length (0Eh) | -----|-----------------------------------------------------------------------| 2 | RSM | CAP | CAF | Active Format | -----|-----------------------------------------------------------------------| 3 | Active Partition | -----|-----------------------------------------------------------------------| 4 | Write Buffer Full Ratio | -----|-----------------------------------------------------------------------| 5 | Read Buffer Empty Ratio | -----|-----------------------------------------------------------------------| 6 | (MSB) | -----|--- Write Delay Time ---| 7 | (LSB) | -----|-----------------------------------------------------------------------| 8 | DBR | BIS |Reserved| AVC | SOCF | RBO | REW | -----|-----------------------------------------------------------------------| 9 | Gap Size | -----|-----------------------------------------------------------------------| 10 | EOD Defined | EEG | SEW | CS | Reserved | -----|-----------------------------------------------------------------------| 11 | (MSB) | -----|--- ---| 12 | Buffer Size at Early Warning | -----|--- ---| 13 | (LSB) | -----|-----------------------------------------------------------------------| 14 | Select Data Compression Algorithm | -----|-----------------------------------------------------------------------| 15 | Reserved | ============================================================================== This page (Table 9-37) is used to specify the target configuration. Report Setmarks (RSM) bit when set to one indicates that setmarks will be reported. A (RSM) bit set to zero indicates that setmarks will not be reported. Change active partition (CAP) bit, set to one, indicates that the logical partition is to be changed to the one specified by the active partition field. A CAP bit set to zero indicates no partition change is specified. Change active format (CAF) bit, set to one, indicates that the active format is to be changed to the value specified in the active format field. The format may be changed only when the medium is positioned at beginning-of-medium. Active format field indicates which recording format is used when reading or writing data on a logical unit. This field is only applicable to devices with multiple track configurations for a given density code. Values for the active format field shall be assigned as follows: 00h Use the logical unit's default recording format. 01h Use a one track recording format 02h-09h Use a 2-9 track recording format 0Ah Use an 18 track recording format 0Bh-1Fh Reserved IMPLEMENTORS NOTE: A logical unit supporting this field may not support all possible track configurations for the given density code (e.g. a device may only support even track group multiples). Active partition field indicates the current logical partition number in use on the medium. Write buffer full ratio field, on WRITE commands, indicates to the target how full the buffer shall be before writing data to the medium. Read buffer empty ratio field, on READ commands, indicates to the target how empty the buffer shall be before retrieving additional data from the medium. Write delay time field indicates the maximum time, in 100 millisecond increments, that the target should wait before any buffered data that is to be written, is forced to the medium after the last buffered WRITE command that did not cause the buffer to exceed the buffer full ratio. A value of zero indicates that the target shall never force buffered data to the medium under these conditions. A data buffer recovery (DBR) bit of one indicates that the target supports data buffer recovery using the RECOVER BUFFERED DATA command. A DBR bit of zero indicates that the target does not support data buffer recovery. This bit is not changeable. Block identifiers supported (BIS) field with a value of zero indicates that block IDs are not supported in the format written on the medium. A value of one indicates that the format on the medium has recorded information about the block ID relative to a partition. This bit is not changeable. Automatic velocity control (AVC) bit when set to one, indicates that the device shall select the speed (if the device supports more than one speed) based on the data transfer rate that should optimize streaming activity and minimize medium repositioning. When AVC is set to zero, the speed chosen should be the device's selected speed. Stop on consecutive filemarks field when 00b indicates that the device shall pre-read data from the medium in buffered mode to the limits of the buffer capacity without regard for filemarks or setmarks. This implies that the device can differentiate between data blocks, filemarks, and setmarks in the buffer. Values 01b, 10b, and 11b specify that the device shall terminate the pre-read operation if 1, 2 or 3 consecutive filemarks or setmarks are .pn52 detected, respectively. The Consecutive Setmark (CS) bit when set to zero defines the SOCF field as stop on consecutive filemarks. The (CS) bit when set to one defines the SOCF field as stop on consecutive setmarks. Recover buffer order bit when set to one indicates that data blocks are returned from the target's buffer on a RECOVERED BUFFERED DATA command in LIFO order (last-in-first out) from which they were written to the buffer. When set to zero data blocks are to be returned in FIFO (first-in-first out) order. A report early-warning (REW) bit of one indicates that the target shall return CHECK CONDITION status with the EOM bit set to one when the early- warning position is encountered during read and write operations. A REW bit of zero indicates the target shall not report this condition for read operations and it shall report the early warning at a vendor-specific point at or before the medium-defined early-warning position for write operations. IMPLEMENTORS NOTE: A REW bit of one is intended for compatibility with those systems using old tape formats that require an early-warning indication during read operations. Other systems should set this bit to zero to avoid potential data loss when interchanging tapes between peripheral devices. GapSize field value determines the size of the interblock gap when writing data. A value of 00h specifies the device's defined gap size. A value of 1h specifies a device defined gap size sufficiently long to support update-in- place. Values of 02h through 0Fh are multipliers on the device's defined gap size. Values 10h through 7Fh are reserved. Values 80h through FFh are vendor unique. End-of-data (EOD) defined field indicates which format type the logical unit shall use to detect and generate the EOD area. The types of EOD formats are specified below: Value Description ------- -------------------------------------------------- 000b Logical unit's default EOD definition 001b Format defined erased area of medium 010b Number of filemarks or setmarks as specified in the SOCF field 011b EOD recognition and generation is not supported 100b - 111b Reserved Enable EOD generation (EEG) bit set to one indicates that the logical unit shall generate the appropriate EOD area, as determined by the EOD defined field. A value of zero indicates that EOD generation is disabled. IMPLEMENTORS NOTE: Some logical units may not generate EOD at the completion of any write-type operation. If not, it is recommended that generation of EOD (if supported) occur prior to any major direction change, if the direction change follows a write-type operation (For example, a WRITE command followed by a REWIND command). Synchronize at early-warning (SEW) field set to one indicates that the target shall force any buffered data that is to be written, to the medium, when early-warning is encountered. A value of zero indicates that the target shall retain any buffered data in the buffer when early-warning is encountered and return a CHECK CONDITION status with sense key field set to VOLUME OVERFLOW (see WRITE command, section 9.2.18). Buffer size at early-warning field indicates the value, in bytes, to which the target shall reduce its logical buffer size when writing. The target should reduce the buffer size only when the medium is positioned between its early-warning and end-of-partition. A value of zero indicates that the implementation of this function is device specific. NOTE: The intent is to prevent the loss of data by limiting the size of the buffer when near the end-of-partition). Select data compression algorithm field set to 00h indicates that the target shall not use a compression algorithm on any data sent to it prior to writing that data to the medium. A value of 01h indicates that the data to be written shall be compressed using the target's default compression algorithm. Values 02h - 7Fh are Reserved. Values 80h - FFh are Vendor Unique. 9.3.4. Medium Partition Parameters Page This page (Table 9-38) is used to specify the first group of medium partitions. Additional groups are specified in the medium partition pages.