8.1.2. FORMAT UNIT Command Peripheral Device Type: Direct Access Operation Code Type: Mandatory Table 8-3: FORMAT UNIT Command ============================================================================== Bit| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | Byte | | | | | | | | | ============================================================================== 0 | Operation Code (04h) | -----|-----------------------------------------------------------------------| 1 | Logical Unit Number | FmtData| CmpLst | Defect List Format | -----|-----------------------------------------------------------------------| 2 | Vendor Unique | -----|-----------------------------------------------------------------------| 3 | (MSB) | -----|--- Interleave ---| 4 | (LSB) | -----|-----------------------------------------------------------------------| 5 | Vendor Unique | Reserved | Flag | Link | ============================================================================== The FORMAT UNIT command (Table _-_) ensures that the medium is formatted so that all of the initiator addressable logical blocks can be accessed. In addition, the medium may be certified and control structures may be created for the management of the medium and defects. There is no guarantee that the medium has or has not been altered. The simplest mandatory form of the FORMAT UNIT command (with no format data) accomplishes medium formatting with little initiator control over defect management. The target implementation determines the degree of defect management that is to be performed. Two additional mandatory forms of this command increase the initiator's control over defect management. Several optional forms of this command further increase the initiator's control over defect management, by allowing the initiator to specify which defect list(s) are to be used, to specify defect locations (in several formats), to enable target certification, and to specify what to do in the event that defect lists are not accessible. The FORMAT UNIT command shall be rejected with RESERVATION CONFLICT status if any extent reservation from any initiator is active in the specified logical unit. is reserved (see _._._._). It is recommended that MODE SELECT parameters (if any) be set properly prior to issuing the FORMAT UNIT command. During the execution of the FORMAT UNIT command, the target may perform a medium defect management algorithm (which can be controlled by the initiator, using optional forms of this command). Four sources of defect location information (hereafter called defects) are defined as follows: Primary defect (P) list. This is the list of defects, usually supplied by the original manufacturer of the device or medium, that are considered as permanent defects. It is recommended that the device manufacturer record the P list on a specific location on the device or medium. The P list is located outside of the initiator-accessible logical block space. The P list is accessible by the target (to reference while formatting), but it is not normally accessible by the initiator except through the READ DEFECT DATA command. The P list shall not be subject to additions. Once created, the original P list shall not be subject to change. Target certification (C) list. This list includes defects detected by the target during an optional certification process executed during the FORMAT UNIT command. The C list may or may not be saved and recorded as a separate list by the target. This list shall be added to the G list. Data defect (D) list. This list of defect descriptors may be supplied to the target by the initiator in the DATA OUT phase of the FORMAT UNIT command as shown in Table _-_. The defect list length in the defect list header may be zero, in which case there is no D list. The D list may or may not be saved and recorded as a separate list by the target. This list shall be added to the G list. Grown defect (G) list. This list includes all defects sent to the target from the initiator or identified by the target. This list does not include the P list of defects. This list shall include defects provided to the target in D lists during previous FORMAT UNIT commands or the current FORMAT UNIT command. Entries to this list may also include (at the target's option): (1) Defects provided to the target in D lists during previous FORMAT UNIT commands or the current FORMAT UNIT command. (2) The target certification defects (C list) detected during previous FORMAT UNIT commands, the current FORMAT UNIT command, or vendor unique utilities. (1) Defects identified by the REASSIGN BLOCKS command. (2) Defects identified by the target and automatically reassigned by the target during the execution of other commands. The implementation of automatic defect reassignment is target specific. (See the error recovery parameters page of the MODE SELECT command.) A format data (FmtData) bit of one indicates that a DATA OUT phase shall take place during the command execution. The first four bytes of the DATA OUT phase are the defect list header (see Table _-_), which is followed by zero or more bytes of defect descriptors. This defect list specifies the D list that shall be entered into the defect map. This map indicates the defective areas Each defect descriptor indicates a defective area of the medium that the target shall remove from the space that contains the initiator's addressable logical blocks. Details of how the map is stored and how the medium is reassign are implementation specific. The format of the defect descriptors in the defect list is determined by the defect list format field in the CDB (see Table _-_). A FmtData bit of zero indicates that the DATA OUT phase shall not occur (no defect list header and no defect descriptors are supplied by the initiator). This form of the FORMAT UNIT command allows the target to format the medium with its choice of parameters defect sources. A complete list (CmpLst) bit of one indicates that the data supplied by the initiator during the DATA OUT phase of the command (D list) includes the complete list of known defects. Any previous defect map or defect data, except the P list (if any), shall be erased by the target. The result is to purge any previous G list and to build a new G list. If there was a previous P list, it shall be retained. The target may add to this D list as it formats the medium, according to the format options selected in the defect list header (see Table _-_), by performing a target certification process (creating a new C list). The combination of the D list and the C list (if certification is performed) creates the new G list. When using the block format with a CmpLst bit of one, the defect list refers to the new block length (and not to the previous block length, if it is different) and the defect list refers to physical addresses (i.e., addresses that the logical blocks would occupy if there were no defects, not the previous logical block addresses). A CmpLst bit of zero indicates that the data supplied by the initiator during the DATA OUT phase (D list) is in addition to existing defect data already identified. The target may add to this D list as it formats the medium, according to the format options selected in the defect list header (see Table _-_), by performing a target certification process (creating a new C list). The combination of the D list, the C list (if certification is performed), and any previous G list creates the new G list. The target shall reassign any affected logical blocks. If the target cannot locate the G list, or it cannot determine whether a G list exists, it shall perform the action specified by the state of the STPF bit. When using the block format with a CmpLst bit of zero, the defect list refers to the previous block length (and not to the new block length, if it is different) and the defect list refers to previous logical block addresses (not physical addresses). If the FmtData bit is one, the defect list format field specifies which format is to be used for the defect list (see Table _-_). The interleave field requests that the logical blocks be related in a specific fashion to the physical blocks to facilitate speed matching between the host bus data transfer rate and the block data transfer rate from the device. An interleave value of zero requests that the target use its default interleave. An interleave value of one requests that consecutive logical blocks be placed in consecutive physical order. Values of two or greater are vendor unique. Table 8-4: FORMAT UNIT Defect List ============================================================================== Bit| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | Byte | | | | | | | | | ============================================================================== 0 | Reserved | -----|-----------------------------------------------------------------------| 1 | FOV | DPRY | DCRT | STPF | IP | SNP |Reserved| VU | -----|-----------------------------------------------------------------------| 2 | (MSB) | -----|--- Defect List Length ---| 3 | (LSB) | ============================================================================== | Initialization Pattern Descriptor (if any) | ============================================================================== 0 | (MSB) | -----|--- Initialization Pattern Length ---| 1 | (LSB) | -----|-----------------------------------------------------------------------| 2 | LBA | Reserved | -----|-----------------------------------------------------------------------| 3 | Pattern Type | ============================================================================== 0 - | Initialization Pattern (if any) | xx | | ============================================================================== | Defect Descriptor(s) (if any) | ============================================================================== 0 - | Defect Descriptor 0 | xx | (See specific table for length.) | -----|-----------------------------------------------------------------------| | . | | . | | . | -----|-----------------------------------------------------------------------| 0 - | Defect Descriptor n | xx | (See specific table for length.) | ============================================================================== [The following table is now deleted] Table 8-5: FORMAT UNIT Defect Descriptor Format ============================================================================== Bit in CDB Byte 1 --------------------- 4 3 2 1 0 FmtData | CmpLst | | Defect List | | Format | | | | | See Table Defect Descriptor Format --------------------- --------- -------------------------------------------- 0 0 0 0 0 none No Defect List Header or Defect Descriptors 1 X 0 0 0 _-_ Block Format 1 X 1 0 0 _-_ Bytes from Index Format 1 X 1 0 1 _-_ Physical Sector Format 1 X 1 1 0 none Vendor unique All other codes none Reserved ============================================================================== X = 1 or 0 (i.e., don't care term). The defect list header provides four several optional format control bits. Targets that implement these bits give the initiator additional control over the handling of the primary defect (P) list, the enabling of a target medium certification procedure, and the handling of certain error conditions. use of the four defect sources, and the formatting process. A format options valid (FOV) bit of zero indicates that the target shall use its default settings for the DPRY, DCRT, and STPF bits (see below). The initiator should set these bits to zero. If any of these bits are nonzero, the target shall return CHECK CONDITION status and set the sense key to ILLEGAL REQUEST. A FOV bit of one indicates that the target shall examine the setting of the DPRT, DCRT, and STPF bits. Selection of unimplemented functions shall cause the target to return CHECK CONDITION status and to set the sense key to ILLEGAL REQUEST. When FOV is one the DPRT, DCRT, and STPF bits are defined as follows: A disable primary (DPRY) bit of zero indicates that the target shall not use portions of the medium identified as defective in the primary defect (P) list for initiator addressable logical blocks. If the target cannot locate the P list or it cannot determine whether a P list exists, it shall return CHECK CONDITION status and shall set the sense key to [what?]. perform the action specified by the state of the STPF bit. A DPRY bit of one indicates that the target shall not use the P list to identify defective areas of the medium. The P list is not deleted. (Setting the CmpLst bit to one in the CDB provides a similar mechanism to ignore the G list, however the G list is then replaced.) A disable certification (DCRT) bit of zero indicates that the target shall perform a target-specific medium certification process to generate a target certification (C) list. A DCRT bit of one indicates that the target shall not perform the target- specific medium certification process while formatting. A stop format (STPF) bit of zero indicates that the target shall continue the format process even if either of the P or G lists are not successfully accessed in whole or in part. In this case, the target shall return CHECK CONDITION status and shall set the sense key to RECOVERED ERROR after completion of the format process, if no other error occurs. A STPF bit of one indicates that the target shall stop the format process upon failing to successfully access, in whole or in part, any of the P or G lists. The target shall then return CHECK CONDITION status and shall set the sense key to MEDIUM ERROR. The stop format (STPF) bit controls the behavior of the target when one of the following events occurs: (1) The target has been commanded to use the Primary defect list (DPRY is set to zero), and the target cannot locate the list or determine whether the list exists; (2) The target has been commanded to use the Grown defect list (CmpLst is set to zero), and the target cannot locate the list or determine whether the list exists. A STPF bit of zero indicates that, if one or both of the above conditions occurs, the target shall continue to execute the FORMAT UNIT command. The target shall return CHECK CONDITION status and shall set the sense key to RECOVERED ERROR after completion of the FORMAT UNIT command, if no other error occurs. A STPF bit of one indicates that, if one or both of the above conditions occurs, the target shall terminate the execution of the FORMAT UNIT command. The target shall return CHECK CONDITION status and shall set the sense key to MEDIUM ERROR. IMPLEMENTOR'S NOTE: The use of the format data bit (FmtData), complete list bit (CmpLst), and the defect header give complete control to the initiator over which defect sources will or will not be used during the FORMAT UNIT command. By setting the defect list length to zero, and specifying block format defect descriptors, the initiator can send the format option control bits to the target and gain control over the use of P and/or C lists, without having to specify a D list. Table _-_ defines the implementation requirements for the FORMAT UNIT command. [add decriptions of Initialization Pattern bit (IP), Initialization Pattern Descriptor, and Save No Parameters bit (SNP) here] [note: this table has major changes] Table 8-6: FORMAT UNIT Defect Descriptor Format and Requirements ============================================================================== FmtData | CmpLst Defect | | Defect List List Command | | | Format Length Type Comments - - ----- ------ --------- ------------------------------------------ 0 0 0 0 0 N/A Mandatory Target-defined use of defect sources. ------------------------------------------------------------------------------ BLOCK FORMAT: 1 0 0 0 0 Zero Mandatory (1),(3) 1 1 0 0 0 Zero Mandatory (1),(4) 1 0 0 0 0 >0 Optional (2),(3) 1 1 0 0 0 >0 Optional (2),(4) ------------------------------------------------------------------------------ BYTES FROM INDEX FORMAT: 1 0 1 0 0 Zero Optional (1),(3) 1 1 1 0 0 Zero Optional (1),(4) 1 0 1 0 0 >0 Optional (2),(3) 1 1 1 0 0 >0 Optional (2),(4) ------------------------------------------------------------------------------ PHYSICAL SECTOR FORMAT: 1 0 1 0 1 Zero Optional (1),(3) 1 1 1 0 1 Zero Optional (1),(4) 1 0 1 0 1 >0 Optional (2),(3) 1 1 1 0 1 >0 Optional (2),(4) ------------------------------------------------------------------------------ 1 0 1 1 0 Vendor Unique 1 1 1 1 0 Vendor Unique All other codes Reserved =============================================================================== General note: All options described above cause a new G list to be created during the execution of the FORMAT UNIT command as described in the text above. (1): No D list is transfered to the target during the DATA OUT phase. (2): A D list is transfered to the target during the DATA OUT phase. Add the D list defects to the new G list. (3): Use the existing G list as a defect source. Add existing G list defects to the new G list. (4): Discard the existing G list. Do not add existing G list defects to the new G list. Note: Usage of the P list and the C list is controlled by the FOV, DPRY, and DCRT bits in the defect header. Implementation of these bits is optional as described in the text.