T13/D97119R2 Proposal of an Improved Description of Read Native Max and Set Max Commands including rules for C/H/S and LBA calculation To: X3T13 Technical committee From: Dan Colegrove, IBM Corporation Phone: 408-256-1978 Fax: 408-256-1044 Email: colegrove@vnet.ibm.com and Mark Evans, Quantum Corporation Phone: 408-894-4019 Fax: 408-894-4990 Email: mevans@qntm.com Date: 28 March 1997 Subj: Proposal of rules for C/H/S and LBA calculation for inclusion in ATA/ATAPI-4 Introduction: The following is a proposal for inclusion into ATA/ATAPI-4 of additiol explicit rules for determining the cylinder/head/sector and logical block addressing values returned in the IDENTIFY DEVICE data, including the interaction of INITIALIZE DEVICE PARAMETERS and SET MAX ADDRESS. Also included in this proposal are improvements to the description of the Set Max and Read Native Maximum Address commands. The change bars indicate the edits to revision 1. Page 1
0.0 Host Protected Area feature set A reserved area for data storage outside the normal operating system file system is required for several specialized applications. Systems may wish to store configuration data or save memory to the device in a location that the operating systems cannot change. The Host Protected Area feature set allows a portion of the device to be reserved for such an area when the device is initially configured. A device that implements the Host Protected Area feature set shall implement the following minimum set of commands: a) READ NATIVE MAX ADDRESS b) SET MAX ADDRESS If the Host Protected Area feature set is supported, the device shall indicate so by setting bit 10 of word 82 of the IDENTIFY DEVICE response. The READ NATIVE MAX ADDRESS command allows the host to determine the maximum tive address space of the device even when a protected area has been allocated. The SET MAX ADDRESS command allows the host to redefine the maximum address of the user accessible address space. That is, when the SET MAX ADDRESS command is issued with a maximum address less than the tive maximum address, the device reduces the user accessible address space to the maximum set, providing a protected area above that maximum address. The SET MAX ADDRESS command shall be immediately preceded by a READ NATIVE MAX ADDRESS command. After the SET MAX ADDRESS command has been issued, the device shall report the reduced user address space in response to an IDENTIFY DEVICE command in words 1, 54, 57, 58, 60, and 61. Any read or write command to an address above the maximum address set shall return an IDNF error for a bad parameter just would be for any address that exceeds the device capacity. The volatility bit in the register allows the host to specify if the maximum address set is preserved over power-up and hardware reset On power up or hardware reset the device maximum address returns to the last non-volatile address setting regardless of subsequent volatile SET MAX ADDRESS commands. If the SET MAX ADDRESS command is issued with a value that exceeds the tive maximum address an Aborted command error shall be returned. Typical use of these commands would be: On Reset a) BIOS receives control after a system reset; b) BIOS issues a Read Native Max Address command to find the max capacity of the device;. c) BIOS issues a Set Max Address command to the values returned by Read Native Max Address; d) BIOS reads configuration data from the highest area on the disk; e) BIOS issues a Read Native Max Address command followed by a Non-volatile Set Max Address command to reset the device to the size of the file system. On Save to Disk a) BIOS receives control prior to shut down; b) BIOS issues a Read Native Max Address command to find the max capacity of the device; c) BIOS issues a volatile Set Max Address command to the values returned by Read Native Max Address; d) Memory is copied to the reserved area; e) Shut down completes; f) On power on or hard reset the drive max address returns to the last Non-volatile setting. These commands are intended for use only by system BIOS or other low level boot time process. Using these commands outside BIOS controlled boot or shutdown may result in damage to file systems on the device. Devices may abort a second non-volatile Set Max Address command after a power on or hardware reset. 0.0.1 Host protected area orphan sectors Page 2
Issuing a SET MAX ADDRESS command with an LBA value may create orphan sectors just as an INITIALIZE DEVICE PARAMETERS command may create such sectors (see B.3). If the SET MAX ADDRESS LBA value does not correspond to a cylinder boundary, orphan sectors are created. The device shall report the CHS boundary just below the requested LBA value in word 1. Sectors above this cylinder boundary are orphan sectors and the device may or may not allow access to them in CHS translation. Page 3
0.1 READ NATIVE MAX ADDRESS 0.1.1 Command code F8h 0.1.2 Feature set Host Protected Area feature set. Mandatory when the Host Protected Area feature set is implemented. 0.1.3 Protocol Non-data command, see. 0.1.4 Inputs Features Device/Head obs LBA obs DEV Command F8h Device/Head - if LBA is set to one, the maximum address shall be reported as an LBA value. If LBA is cleared to zero, the maximum address shall be reported as a CHS value. 0.1.5 Normal outputs Error Max tive sector number or LBA Max tive cylinder number low or LBA Max tive cylinder number high or LBA Device/Head obs obs DEV Max tive head or LBA Status BSY DRDY DF DRQ ERR - maximum tive sector number (Identify device information Word 6) or LBA bits (7:0) on the device. - maximum tive cylinder number low or LBA bits (15:8) on the device. - maximum tive cylinder number high or LBA bits (23:16) on device. Device/Head - maximum tive head number ((Identify device information Word 3)-1) or LBA bits (27:24) on the device. Status register - BSY shall be cleared to zero when the command is complete DRDY shall be set to one Page 4
DF shall be cleared to zero DRQ shall be cleared to zero ERR shall be cleared to zero 0.1.6 Error outputs If this command is not supported an Aborted command error shall be returned. An Aborted command error shall be returned if a CHS address is requested and the device does not support a CHS translation. Error ABRT Device/Head obs obs DEV Status BSY DRDY ERR Error register - ABRT shall be set to one if this command not supported. Device/Head register - Status register - BSY shall be cleared to zero when the command is complete DRDY shall be set to one ERR shall be set to one if an Error register bit is set to one 0.1.7 Prerequisites DRDY set equal to one. 0.1.8 Description This command returns the tive maximum address. The tive maximum address is the maximum address that is valid when using the SET MAX ADDRESS command. Page 5
0.2 SET MAX ADDRESS 0.2.1 Command code F9h 0.2.2 Feature set Host Protected Area feature set. Mandatory when the Host Protected Area feature set is implemented. 0.2.3 Protocol Non-data command, see. 0.2.4 Inputs Features V V Max tive sector number or Max LBA Max cylinder low or LBA Max cylinder high or LBA Device/Head obs LBA obs DEV Max tive head or Max LBA Command F9h - V V (Value volatile). If bit 0 is set to one, the device shall preserve the maximum values over powerup or hardware reset. If bit 0 is cleared to zero, the device shall revert to the most recent non-volatile maximum address value setting over power-up or hardware reset. - contains the maximum tive sector number (Identify device information Word 6) or LBA bits (7:0) value to be set. - contains the maximum cylinder low or LBA bits (15:8) value to be set. - contains the maximum cylinder high or LBA bits (23:16) value to be set. Device/Head - if LBA is set to one, the maximum address value is an LBA value. If LBA is cleared to zero, the maximum address value is a CHS value. DEV shall indicate the selected device. Bits (3:0) contain the maximum tive head number ((Identify device information Word 3)-1) or LBA bits (27:24) value to be set 0.2.5 Normal outputs Error Max tive sector or Max LBA Max cylinder low or LBA Max cylinder high or LBA Device/Head obs obs DEV Max tive head or Max LBA Page 6
Status BSY DRDY DF DRQ ERR - maximum tive sector number or LBA bits (7:0) set on the device. - maximum cylinder number low or LBA bits (15:8) set on the device. - maximum cylinder number high or LBA bits (23:16) set on device. Device/Head - maximum tive head number or LBA bits (27:24) set on the device. Status register - BSY shall be cleared to zero when the command is complete DRDY shall be set to one DF shall be cleared to zero DRQ shall be cleared to zero ERR shall be cleared to zero 0.2.6 Error outputs If this command is not supported or the maximum value to be set exceeds the capacity of the device an Aborted command error shall be returned. Error ABRT Device/Head obs obs DEV Status BSY DRDY ERR Error register - ABRT shall be set to one if this command not supported or maximum value requested exceeds the device capacity. Device/Head register - Status register - BSY shall be cleared to zero when the command is complete DRDY shall be set to one ERR shall be set to one if an Error register bit is set to one 0.2.7 Prerequisites DRDY set equal to one. A successful READ NATIVE MAX ADDRESS command shall immediately precede a SET MAX ADDRESS command. 0.2.8 Description After successful completion of this command, all read and write access attempts to LBA or Cylinder addresses greater than specified in the,, and Device/Head registers shall be rejected with an IDNF error. Identify command data words 1, 54, 57, 58, 60, and 61 shall reflect the maximum address set with this command. Devices may abort a second non-volatile Set Max Address command after a power on or hardware reset. After a successful Set Max Address command using a maximum cylinder number value: Page 7
Identify Word 1 = Set Max Cylinder Number +1 Identify Words 60,61 = Identify Word 1 * Identify Word 3 * Identify Word 6 Identify Word 54 = Identify Words 60,61 / (Identify Word 55 * Identify Word 56) Identify Words 57,58 = Identify Word 54 * Identify Word 55 * Identify Word 56 After a successful Set Max Address using a maximum LBA address: Identify Words 60,61 = Maximum LBA address +1 Identify Word 1 = Identify Words 60,61 / (Identify Word 3 * Identify Word 6) Identify Word 54 = Identify Words 60,61 / (Identify Word 55 * Identify Word 56) Identify Words 57,58 = Identify Word 54 * Identify Word 55 * Identify Word 56 The / operator indicates integer division; the * operator multiplication. Page 8
0.3 INITIALIZE DEVICE PARAMETERS 0.3.1 Command code 91h 0.3.2 Feature set General feature set Mandatory for devices not implementing the PACKET Command feature set if a CHS translation is supported. Not mandatory for devices not implementing the PACKET command feature set if the device capacity is greater then 8 Gbytes and only LBA translation is supported. Use prohibited for devices implementing the PACKET Command feature set. 0.3.3 Protocol Non-data, see. 0.3.4 Inputs The register specifies the number of logical sectors per logical track, and the Device/Head register specifies the maximum head number. Features Logical sectors per logical track Device/Head obs obs DE V Max head Command 91h Device/Head register - 0.3.5 Normal outputs Error Device/Head obs obs DEV Status BSY DF DRQ ERR Device/Head register - Status register - BSY shall be cleared to zero when the command is complete DF shall be cleared to zero DRQ shall be cleared to zero ERR shall be cleared to zero Page 9
0.3.6 Error outputs Error ABRT Device/Head obs obs DEV Status BSY DF DRQ ERR Error register - ABRT shall be set to one if the device does not support the requested CHS translation. Device/Head register - Status register - BSY shall be cleared to zero when the command is complete DF (Device Fault) shall be set to one if a device fault has occurred DRQ shall be cleared to zero ERR shall be set to one if an Error register bit is set to one 0.3.7 Prerequisites This command shall be accepted regardless of the state of DRDY. 0.3.8 Description This command ebles the host to set the number of logical sectors per track and the number of logical heads minus 1, per logical cylinder for the current CHS translation mode. A logical sectors per track value zero is illegal. If the capacity of the device is less than 16,515,072 sectors, a device shall support the CHS translation described in words 1, 3, and 6 of the IDENTIFY DEVICE information. Support of other CHS translations is optiol. If the requested CHS translation is not supported, the device shall set the Error bit to one in the Status register and set the Aborted command bit to one in the Error register before clearing the BSY bit to zero in the Status register. If the requested CHS translation is not supported, the device shall fail all media access commands with an ID Not Found error until a valid CHS translation is established. After a successful Initialize Device Parameters command: Identify Word 55 = Max Head + 1 Identify Word 56 = Logical Sectors per Logical Track Identify Word 54 = Identify Words 60,61 / (Identify Word 55 * Identify Word 56) Identify Words 57,58 = Identify Word 54 * Identify Word 55 * Identify Word 56 Page 10
B.2.1 Word 1 For devices less than or equal to 528 MB, IDENTIFY DEVICE data word 1 (Default Cylinders) does not specify a value greater than 1,024. If a device is greater than 528 MB but less than or equal to 8 GB, the maximum value that is placed into this word is determined by the value in Word 3 as shown in table B.1. The value in this word is changed by the Set Maximum Address command. NOTE This algorithm reserves a gap at cylinder address 16,384 to support the legacy of a maintence cylinder. Table B.1 Word 1 value Value in Word 3 Maximum value in Word 1 1 1h 65,535 FFFFh 2 2h 65,535 FFFFh 3 3h 65,535 FFFFh 4 4h 65,535 FFFFh 5 5h 32,767 7FFFh 6 6h 32,767 7FFFh 7 7h 32,767 7FFFh 8 8h 32,767 7FFFh 9 9h 16,383 3FFFh 10 Ah 16,383 3FFFh 11 Bh 16,383 3FFFh 12 Ch 16,383 3FFFh 13 Dh 16,383 3FFFh 14 Eh 16,383 3FFFh 15 Fh 16,383 3FFFh 16 10h 16,383 3FFFh Updated Table 7 Table 7 Security mode command actions Command Locked mode Unlocked mode Frozen mode CHECK POWER MODE Executable Executable Executable DEVICE RESET Executable Executable Executable DOWNLOAD MICROCODE Executable Executable Executable EXECUTE DEVICE DIAGNOSTIC Executable Executable Executable FORMAT TRACK Aborted Executable Executable IDENTIFY DEVICE Executable Executable Executable IDENTIFY DEVICE DMA Executable Executable Executable IDENTIFY PACKET DEVICE Executable Executable Executable IDLE Executable Executable Executable IDLE IMMEDIATE Executable Executable Executable INITIALIZE DEVICE PARAMETERS Executable Executable Executable NOP Executable Executable Executable PACKET Aborted Executable Executable READ BUFFER Executable Executable Executable READ DMA Aborted Executable Executable READ LONG Aborted Executable Executable READ MULTIPLE Aborted Executable Executable READ NATIVE MAX ADDRESS Executable Executable Executable READ SECTORS Aborted Executable Executable Page 11
READ VERIFY SECTORS Aborted Executable Executable RECALIBRATE Executable Executable Executable SECURITY DISABLE PASSWORD Aborted Executable Aborted SECURITY ERASE PREPARE Executable Executable Executable SECURITY ERASE UNIT Executable Executable Aborted SECURITY FREEZE LOCK Aborted Executable Executable SECURITY SET PASSWORD Aborted Executable Aborted SECURITY UNLOCK Executable Executable Aborted SEEK Executable Executable Executable SERVICE Aborted Executable Executable SET FEATURES Executable Executable Executable SET MAX ADDRESS Aborted Executable Executable SET MULTIPLE MODE Executable Executable Executable SLEEP Executable Executable Executable SMART DISABLE OPERATIONS Executable Executable Executable SMART ENABLE/DISABLE AUTOSAVE Executable Executable Executable SMART ENABLE OPERATIONS Executable Executable Executable SMART READ THRESHOLDS Executable Executable Executable SMART READ VALUES Executable Executable Executable SMART RETURN STATUS Executable Executable Executable SMART SAVE VALUES Executable Executable Executable STANDBY Executable Executable Executable STANDBY IMMEDIATE Executable Executable Executable WRITE BUFFER Executable Executable Executable WRITE DMA Aborted Executable Executable WRITE LONG Aborted Executable Executable WRITE MULTIPLE Aborted Executable Executable WRITE SECTORS Aborted Executable Executable WRITE VERIFY Aborted Executable Executable (i) this (i) courtesy of the Microsoft Word incomprehensible feature feature. Page 12