Document: X3T9.2/87-126 Date: 9 August 1987 To: X3T9.2 SCSI-2 Working Group and X3T9.2 Committee Members From: Paul R. Nitza - (714) 662-5600 Subj: Send/Receive Diagnostic Commands with Translate Page ============================================================================= Attached for your review is a proposal for adding pages to the Send/Receive Diagnostic commands including the Translate page proposed by Micropolis at the July working group meeting. This proposal departs from previous methods of documentation and attempts to define a portion of the command in the section for all device types (section 7) then define specific options within the command in the appropriate device type section. In this case the Send and Receive Diagnostic commands and common pages are defined in section 7. However, since the translate page is specific to direct access devices I have defined it as two new subsections within section 8. [These are the modifications to RECEIVE DIAGNOSTIC in section 7] RECEIVE DIAGNOSTIC RESULTS Command Peripheral Device Type: All Operation Code Type: Optional RECEIVE DIAGNOSTIC RESULTS Command ============================================================================== Bit| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | Byte | | | | | | | | | ============================================================================== 0 | Operation Code (1Ch) | -----|-----------------------------------------------------------------------| 1 | Logical Unit Number | PF | Reserved | -----|-----------------------------------------------------------------------| 2 | Reserved | -----|-----------------------------------------------------------------------| 3 | (MSB) | -----|--- Allocation Length ---| 4 | (LSB) | -----|-----------------------------------------------------------------------| 5 | Control Byte | ============================================================================== [We need to define what happens if intervening commands occur between the SEND DIAGNOSTIC and RECEIVE DIAGNOSTIC RESULTS commands.] The RECEIVE DIAGNOSTIC RESULTS command (Table 7-19) requests analysis data be sent to the initiator after completion of a SEND DIAGNOSTIC command (see 7.1.9). If the target supports the optional page format the page code field in the SEND DIAGNOSTIC command specifies the format of the returned data. An optional Page Format (PF) bit of one specifies that the information returned by the RECEIVE DIAGNOSTIC RESULTS command shall conform to the page structure as specified in this document. If the SEND DIAGNOSTIC command was sent with the PF bit set to zero and the PF bit in the RECEIVE DIAGNOSTIC command is set to one the target shall return a CHECK CONDITION status with a sense key of ILLEGAL REQUEST and an additional sense code of Illegal Field in CDB. A PF bit of zero indicates that the information returned by the RECEIVE DIAGNOSTIC RESULTS command shall conform to ANSI X3.131-1986 (i.e., all parameters are vendor unique). If the SEND DIAGNOSTIC command was sent with the PF bit set to one and the PF bit in the RECEIVE DIAGNOSTIC command is set to zero the target shall return a CHECK CONDITION status with a sense key of ILLEGAL REQUEST and an additional sense code of Illegal Field in CDB. The allocation length specifies the maximum number of bytes that the initiator has allocated for returned RECEIVE DIAGNOSTIC data. An allocation length of zero indicates that no RECEIVE DIAGNOSTIC data shall be transferred. This condition shall not be considered as an error. The target shall terminate the DATA IN phase when allocation length bytes have been transferred or when all available RECEIVE DIAGNOSTIC data have been transferred to the initiator, whichever is less. The diagnostic data returned is vendor unique. The diagnostic data may not be valid if there are intervening commands. If the target receives a RECEIVE DIAGNOSTIC RESULTS command that was not immediately preceded by a SEND DIAGNOSTIC command with no intervening commands the target shall return a CHECK CONDITION status with a sense key of ILLEGAL REQUEST and an additional sense code of Command Sequence Error. IMPLEMENTORS NOTE: Although diagnostic software is generally device- specific, this command and the SEND DIAGNOSTIC command provide a means to isolate the operating system software from the device-specific diagnostic software. Hence the operating system can remain device-independent. This also allows diagnostic software to be more easily ported to other operating systems. RECEIVE DIAGNOSTIC RESULTS Page Formats When the PF bit is set to one the data returned during the RECEIVE DIAGNOSTIC RESULTS command shall use the page format described in this document. Each page descriptor contains a page header followed by the analysis data which is formatted according to the page code specified in the page code field from the SEND DIAGNOSTIC command. Note: This section only describes the analysis data page format for pages which are common to all device types. The sections for each device type may describe additional pages which may be supported by the target. RECEIVE DIAGNOSTIC General Page Descriptor Format ============================================================================== Bit| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | Byte | | | | | | | | | ============================================================================== 0 | Page Code | -----|-----------------------------------------------------------------------| 1 | Reserved | -----|-----------------------------------------------------------------------| 2 | (MSB) | -----|--- Page Parameter Length ---| 3 | (LSB) | -----|-----------------------------------------------------------------------| 4 | | - - -|- - Page Parameters (if any) - -| n | | ============================================================================== The Page Code field contains the page code from the SEND DIAGNOSTIC command which was sent immediately before the RECEIVE DIAGNOSTIC command. The page codes are defined in table 7-__ (SEND DIAGNOSTIC command). The Page Parameter Length field specifies in bytes the length of the page parameters which follow this field. RECEIVE DIAGNOSTIC Supported Page List Format (Page Code 00h) ============================================================================== Bit| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | Byte | | | | | | | | | ============================================================================== 0 | Page Code (00h) | -----|-----------------------------------------------------------------------| 1 | Reserved | -----|-----------------------------------------------------------------------| 2 | (MSB) | -----|--- Page Parameter Length ---| 3 | (LSB) | -----|-----------------------------------------------------------------------| 4 | First Page Code Supported | -----|-----------------------------------------------------------------------| 5 | Second Page Code Supported | -----|-----------------------------------------------------------------------| . | . . | . | . . | . | . . | -----|-----------------------------------------------------------------------| n | Last Page Code Supported | ============================================================================== The Supported Page List supplies a list of all the page codes supported by the target for the Send/Receive Diagnostic commands. This page shall be implemented if the target supports the page format option in the Send/Receive Diagnostic commands. The Page Parameter Length field shall specify the length in bytes of the parameters that follow. The additional parameters shall contain a list of all the Page Codes supported by the target for the Send/Receive Diagnostic commands. This list shall be in ascending order. [This is a new subsection in section 8 for direct access devices] RECEIVE DIAGNOSTIC RESULTS Command Pages for Direct Access Devices This section describes the optional direct access devices pages for the RECEIVE DIAGNOSTIC command. For a description of the RECEIVE DIAGNOSTIC pages for all device types see section 7._._._. The valid page codes that an initiator may send to a direct access device are defined in the SEND DIAGNOSTIC command (see table 8-__). RECEIVE DIAGNOSTIC Translate Logical/Physical Address (Page Code 40h) The Translate Logical/Physical Address page allows the initiator to translate a logical block address, physical sector address or physical bytes from index address into any one of the other formats. The address to be translated is passed to the target with the SEND DIAGNOSTIC command and the results are returned to the initiator by the RECEIVE DIAGNOSTIC RESULTS command. See table 8-__ for the format of the response returned by the RECEIVE DIAGNOSTIC RESULTS command. RECEIVE DIAGNOSTIC Translate Logical/Physical Address Page Format ============================================================================== Bit| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | Byte | | | | | | | | | ============================================================================== 0 | Page Code (40h) | -----|-----------------------------------------------------------------------| 1 | Reserved | -----|-----------------------------------------------------------------------| 2 | (MSB) | -----|--- Page Parameter Length ---| 3 | (LSB) | -----|-----------------------------------------------------------------------| 4 | Reserved | Supplied Format | -----|-----------------------------------------------------------------------| 5 | RAREA | SPDTOL | ALTTRK | Reserved | Translated Format | -----|-----------------------------------------------------------------------| 6 | | - - -|- - Translated Address 1 - -| 13 | | -----|-----------------------------------------------------------------------| 14 | | - - -|- - Translated Address 2 (if required) - -| 21 | | -----|-----------------------------------------------------------------------| | . . | | . . | | . . | -----|-----------------------------------------------------------------------| n | | - - -|- - Translated Address n (if required) - -| nn | | ============================================================================== The Translate Logical/Physical Address page contains a four byte page header which specifies the page code and length followed by two bytes which describe the translated address followed by zero or more translated address(s). The Page Parameter Length field contains the number of parameter bytes which follow. The Supplied Format field contains the value from the SEND DIAGNOSTIC command supplied format field (see section 8._._). A Reserved Area (RAREA) bit of one indicates that all or part of the translated address falls within a reserved area of the media (i.e., speed tolerance gap, spare sector, etc.). If the entire translated address falls within a reserved area the target may not return a translated address. A RAREA bit of zero indicates that none of the translated address falls within a reserved area of the media. A Speed Tolerance (SPDTOL) bit of one indicates that the target applied a speed tolerance to the translated address. A SPDTOL bit of zero indicates that no speed tolerance was applied to the translated address by the target. IMPLEMENTORS NOTE: The SPDTOL bit is not meant to specifiy that the physical device may or may not require a speed tolerance. This bit only specifies that target did or did not apply a tolerance factor when translating the address. An Alternate Track (ALTTRK) bit of one indicates that the translated address is physically located on an alternate track of the medium. An ALTTRK bit of zero indicates that the translated address is not located on an alternate track of the medium. The Translated Format field contains the value from the SEND DIAGNOSTIC command translate format field (see section 8._._). The Translated Address field contains the address(s) the target translated from the address supplied by the initiator in the SEND DIAGNOSTIC command. This field shall be in the format specified in the Translate Format field. The different formats are described in tables 8-5, 8-6 and 8-7. If the logical block format is specified the block address shall be in the first four bytes of the field and the remaining bytes shall be set to zero. If the returned data is in the logical block or physical sector format and the address to be translated covers more than one address after it has been translated (i.e., accounting for speed tolerance or multiple physical sectors within a single logical block or multiple logical blocks within a single physical sector) the target shall return all possible addresses which are contained in the area specified by the address to be translated. If the returned data is in bytes from index format the target may return one or two translated values. If only one translated value is returned the translated address specifies the beginning of an eight byte area on the medium. If two translated values are returned, the first translated address indicates the starting location and the second indicates the ending location of the area. [What we really need here is a defect list format that includes a length field. This format should be added to the FORMAT UNIT and READ DEFECT DATA commands. Also we need to add a format for optical devices. PRN] If the target cannot determine the exact location of the translated address due to speed tolerances, or any other reason, it shall return multiple translated addresses which cover all the possible areas. [These are the modifications to SEND DIAGNOSTIC in section 7] SEND DIAGNOSTIC Command Peripheral Device Type: All Operation Code Type: Mandatory SEND DIAGNOSTIC Command ============================================================================== Bit| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | Byte | | | | | | | | | ============================================================================== 0 | Operation Code (1Dh) | -----|-----------------------------------------------------------------------| 1 | Logical Unit Number | PF |Reserved|SelfTest| DevOfL | UnitOfL| -----|-----------------------------------------------------------------------| 2 | Reserved | -----|-----------------------------------------------------------------------| 3 | (MSB) | -----|--- Parameter List Length ---| 4 | (LSB) | -----|-----------------------------------------------------------------------| 5 | Control Byte | ============================================================================== The SEND DIAGNOSTIC command (Table 7-26) requests the target to perform diagnostic tests on itself, on the attached peripheral devices, or on both. The only mandatory implementation of this command is the self test (SelfTest) feature with the parameter list length of zero. Except when the self test bit is one, this command is usually followed by a RECEIVE DIAGNOSTIC RESULTS command. A Page Format (PF) bit of one specifies that the SEND DIAGNOSTIC parameters conform to the page structure as specified in this document. A PF bit of zero indicates that the SEND DIAGNOSTIC parameters are as specified in ANSI X3.131-1986 (i.e., all parameters are vendor unique). A self test bit of one directs the target to complete its default self test. If the self test successfully passes, the command shall be terminated with GOOD status; otherwise, the command shall be terminated with CHECK CONDITION status and the sense key shall be set to HARDWARE ERROR. A self test bit of zero directs the target to perform vendor unique test or state modification functions defined by the bytes the operation or function specified in the parameter list. Depending on the vendor unique function or operation requested, a response may or may not be required. If no response is required, successful completion of the function is indicated by presentation of GOOD status. Disconnection is optional during the execution of the function. If a response is required successful completion of the function and preparation of the response is indicated by presentation of GOOD status. The response is then recovered by execution of the RECEIVE DIAGNOSTIC RESULTS command. the target shall either: (1) execute the requested function, prepare the response and indicate completion by returning a GOOD status. The response is then recovered by execution of the RECEIVE DIAGNOSTIC RESULTS command. (2) save the requested function and return GOOD status. The requested function shall then be executed and the response prepared upon receipt of a RECEIVE DIAGNOSTIC RESULTS command. The Device Offline (DevOfL) and Unit Offline (UnitOfL) bits grant permission to perform vendor unique diagnostic operations on the target which may be visible to attached initiators. The bits only affect the diagnostic operation invoked by the particular SEND DIAGNOSTIC command and can be considered reset at the time GOOD status is presented to terminate the SEND DIAGNOSTIC command. A UnitOfL bit of one permits diagnostic operations that may affect the initiator visible medium on the addressed LUN, including write operations to the data space accessible through the READ commands, repositioning of sequential access media, and similar activities. A UnitOfL bit of zero prohibits any diagnostic activity that may be detected by later initiator generated activity. Operations that have no effect on the function of subsequent commands on any LUN are still allowed, including direct-access device seek operations, REZERO UNIT, cache replacement, and similar operations. A DefOfL bit of one permits diagnostic operations that may affect the initiator visible functions of the target and logical units other than the one addressed, including destruction of reservation information, error logs, and sense information. A DefOfL bit of zero prohibits any diagnostic activity that may be detected by later initiator generated activity. Operations that have no effect on the function of subsequent commands on any logical unit are still allowed, including verification of internal table validity, testing of alternate interfaces, and similar operations. The parameter list length specifies the length in bytes of the parameter list that shall be transferred during the DATA OUT phase from the initiator to the target. A parameter list length of zero indicates that no data shall be transferred. This condition shall not be considered as an error. If the specified parameter list length results in the truncation of one or more pages (PF bit set to one) the target shall return CHECK CONDITION status with a sense key of ILLEGAL REQUEST and an additional sense code of Illegal Field in CDB. (See the implementors note under the RECEIVE DIAGNOSTIC RESULTS command in section 7.1.7.) SEND DIAGNOSTIC Parameter List When the PF bit is set to one the SEND DIAGNOSTIC Parameter List shall consist of zero or more page descriptors, each of which defines a function or operation the target shall perform. Each page descriptor contains a page header followed by the page parameters as shown in the table below. Note: This section only describes pages which are common to all device types. The sections for each device type may describe additional pages which may be supported by the target. IMPLEMENTORS NOTE: Some targets may only be able to except a single page for each SEND DIAGNOSTIC command. If the initiator attempts to send multiple pages the target would return CHECK CONDITION status. SEND DIAGNOSTIC General Page Descriptor Format ============================================================================== Bit| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | Byte | | | | | | | | | ============================================================================== 0 | Page Code | -----|-----------------------------------------------------------------------| 1 | Reserved | -----|-----------------------------------------------------------------------| 2 | (MSB) | -----|--- Page Parameter Length ---| 3 | (LSB) | -----|-----------------------------------------------------------------------| 4 | | - - -|- - Page Parameters - -| n | | ============================================================================== The Page Code field specifies the page type and format for this page. The page codes are defined in table 7-__. The Page Parameter Length field specifies in bytes the length of the page parameters which follow this field. SEND DIAGNOSTIC Page Codes ============================================================================== Page Code Description ------------------------------------------------------------------------------ 00h Respond with a list of Supported Pages 01h-3Fh Reserved for pages common to all device types 40h-7Fh Reserved for pages for specific device types (Note: These pages are described in the appropriate device type sections within this document) 80h-FFh Vendor Unique pages ============================================================================== SEND DIAGNOSTIC Supported Page List Format (Page Code 00h) ============================================================================== Bit| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | Byte | | | | | | | | | ============================================================================== 0 | Page Code (00h) | -----|-----------------------------------------------------------------------| 1 | Reserved | -----|-----------------------------------------------------------------------| 2 | (MSB) | -----|--- Page Parameter Length (0000h) ---| 3 | (LSB) | ============================================================================== The Supported Page List instructs the target to supply a list of all the page codes supported by the target for the Send/Receive Diagnostic commands. The page code list shall be returned by the target during the RECEIVE DIAGNOSTIC RESULTS command (see section 7.1.7). This page shall be implemented if the target supports the page format option of this command. The Page Parameter Length field shall be set to zero since no additional parameters are required for this page. [This is a new subsection in section 8 for direct access devices] SEND DIAGNOSTIC Command Pages for Direct Access Devices This section describes the optional direct access devices pages for the SEND DIAGNOSTIC command. For a description of the SEND DIAGNOSTIC pages for all device types see section 7.1.9. The valid page codes that an initiator may send to a direct access device are defined in table 8-__. SEND DIAGNOSTIC Direct Access Device Page Codes ============================================================================== Page Code Description ------------------------------------------------------------------------------ 00h Respond with a list of Supported Pages (see section 7._._) 00h-3Fh Pages for all device types (see section 7._._) 40h Translate Logical/Physical Addresses 41h-7Fh Reserved 80h-FFh Vendor Unique pages ============================================================================== SEND DIAGNOSTIC Translate Logical/Physical Address Page The Translate Logical/Physical Address page allows the initiator to translate a logical block address, physical sector address or physical bytes from index address into any one of the other formats. The address to be translated is passed to the target with the SEND DIAGNOSTIC command and the results are returned to the initiator by the RECEIVE DIAGNOSTIC RESULTS command (see section 7._._ and 8._._). The format of the SEND DIAGNOSTIC Translate Logical/Physical Address page is shown below in table 8-__. See section 8._._ for the format of the response returned by the RECEIVE DIAGNOSTIC RESULTS command. SEND DIAGNOSTIC Translate Logical/Physical Address Page Format ============================================================================== Bit| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | Byte | | | | | | | | | ============================================================================== 0 | Page Code (40h) | -----|-----------------------------------------------------------------------| 1 | Reserved | -----|-----------------------------------------------------------------------| 2 | (MSB) | -----|--- Page Parameter Length (000Ah) ---| 3 | (LSB) | -----|-----------------------------------------------------------------------| 4 | Reserved | Supplied Format | -----|-----------------------------------------------------------------------| 5 | Reserved | Translate Format | -----|-----------------------------------------------------------------------| 6 | | - - -|- - Address to Translate - -| 13 | | ============================================================================== The Supplied Format field specifies the format of Address to Translate field. Valid values for this field are defined in the Format Unit command (see table 8-_, Defect List Format). If the target does not support the supplied format it shall return CHECK CONDITION status with a sense key of ILLEGAL REQUEST and an additional sense code of Invalid Field in Parameter List. The Translate Format field specifies which format the initiator would like the address to be translated to. Valid values for this field are defined in the Format Unit command (see table 8-_, Defect List Format). If the target does not support the specified format it shall return CHECK CONDITION status with a sense key of ILLEGAL REQUEST and an additional sense code of Invalid Field in Parameter List. The Address to Translate field contains a single address the initiator is requesting the target to translate. The format of this field depends on the value in the Supplied Format field. The different formats are described in tables 8-5, 8-6 and 8-7. If the logical block format is specified the block address shall be in the first four bytes of the field with the remaining bytes set to zero.