X3T9.2/92-74 Shishir Shah 3/18/92 This document is public review comments for ATA standards 3.0. The current specification with combination of existing INT 13H BIOS interface limits the ATA drive capacity to 528 MB. This document addresses this issue. It is the opinion of Western Digital that a LBA mode of operation is essential to the success of the 3.0 ATA specification. Without it the industry will adopt multiple variant proposals until ATA extensions finally address this issue 1 to 2 years from now! SUPPORT FOR GREATER THAN 528MB ATA DRIVE MARCH 1992 WESTERN DIGITAL CORPORATION OBJECTIVE: Objective of this proposal is to break 528MB boundary limitations created by combination of BIOS and ATA interface. PROBLEM: Today, INT 13H interface defines 10 bit cylinder number (zero based), 8 bit head number (zero based, maximum 255) and 5 bit sector number (one based). ATA task file interface defines 16 bit cylinder number (zero based), 4 bit head number (zero based) and 8 bit sector number (one based). Minimum of these cylinder, head and sector numbers define the maximum capacity of 528 MB for AT IDE drive using standard BIOS and drivers from different OS vendors. Following table tabulates this information. BIOS IDE Limitation ____________________________________________________________ | | Max Sectors/Track 63 255 63 | | Number of heads 255 16 16 | | Number of Cylinders 1024 65536 1024 ____ _____ ____ | | Maximum Capacity 8.4 GB 136.9 GB 528 MB | | ____________________________________________________________ | | During boot up sequence, System INT 13H BIOS ( AT IDE ) reads the drive type from CMOS and gets drive geometry parameters either from BIOS tables or from CMOS (user- defined) or by performing drive Identify command. It resets the drive and sets IDC parameter ( sectors/track, Heads and cylinders ) equal to that is mentioned in the drive table. Same parameters are presented to DOS via INT 13H interface. Drive uses the same parameters to translate Sectors/track, Head and cylinder number to compute the Logical Block Address (LBA). Based on this LBA drive will compute the true physical drive geometry parameters. To support higher capacity than 528 MB ATA drive, BIOS must perform translation from ATA interface parameters to INT 13H interface drive geometry parameters. This means BIOS uses different geometry parameters for Set drive parameter command than actually reported at INT 13H interface. This poses the problem for the protected mode device drivers as they do not know what parameters they should use to communicate with the drive. The drive geometry information presented at INT 13 interface is used in the partition table located on the boot sector. All protected mode drivers uses this information to access ATA drive. PROPOSED SOLUTION: ATA Task file has total of 28 bits available for Sectors, Heads and Cylinder Numbers. If we were to change the definition of these registers as shown below we can access of 137 GB of data at this interface. Current Proposed ____________________________________________________________ | | Bits 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 | | Sector Number | S S S S S S S S | | LBA Byte 0 | | | Cylinder Low | C C C C C C C C | | LBA Byte 1 | | | Cylinder High | C C C C C C C C | | LBA Byte 2 | | | SDH Port | 1 0 1 D H H H H | | 1 L 1 D LBA 27_24| | | ____________________________________________________________ | | Where: C = Cylinder Number D = Drive Select H = Head Number L = 1, Task File in LBA Format S = Sector Number The selection of LBA vs Cylinder, Head and Sector in the task file is made by using a BIT 6 of SDH ( port address 1F6H/176H) register. Currently this bit is defined as 0 in ATA specification. This bit should be redefined as Logical Block Address Bit, when set to 1, task file will indicate Logical Block Address. All op-codes defined today remain the same. The host will write task file register with LBA, set Logical BIT in SDH port and issue the command. The task file registers Cylinder, Head and sector number, will be valid only when I/O is completed successfully OR error is detected during an I/O operation. When last sector/block is transferred, drive will update the task file with correct value of LBA in Cylinder, Head and Sector Registers. INT 13H BIOS may report any geometry at INT 13H interface. Drivers will not use this information for accessing ATA drive that supports LBA. CHANGE TO IDENTIFY COMMAND: ___________________________ Since new capability will be added to this interface, BIT 9 of word 49 ( Drive capabilities ) of IDENTIFY Command data will be defined as Logical Block support available. This bit is currently defined as 0 by ATA specifications. Word 49 Drive Capabilities: Bit 15-10 = 0, Reserved 09 = 1, LBA Mode Supported 08 = 1, DMA Supported 07-00 = Vendor Unique RECOMMENDED DRIVE TYPE: _______________________ It would be nice to have a new drive type that indicates the drive has LBA support. No drive geometry parameters are needed for this drive type. BIOS can use this drive type and issue IDENTIFY command to drive to compute Drive capacity and verify that drive does support LBA mode. Based on this drive capacity, BIOS can build the Drive parameter table and define drive geometry ( Cylinder, Head, Sector ) for INT 13H interface (may use recommended table below). Since there will be a standard drive type defined, Device Drivers that communicate directly to AT IDE interface (Windows 3.1, OS/2, UNIX, Netware, etc) will determine drive geometry based on the BIOS INT 13H, Read Drive parameter (function =8) command. This geometry is required today to support FDISK partition table (LBA 0) and partitions on the drive. RECOMMENDED DRIVE PARAMETER TRANSLATION: ________________________________________ With the approach discussed in this proposal, there is no need to have standard translation of Drive parameters from INT 13H interface to AT IDE Drive interface. The Recommended Drive capacity translation at INT 13H interface is shown in table below: ____________________________________________________________ | | Capacity (C) Heads Sectors Cylinder Size | | Sector / Bytes | | | | C > = 1 GB 32 63 2016 / 1008K | | 1 GB < C <= 2 GB 64 63 4032 / 2016K | | 2 GB < C <= 4 GB 128 63 8064 / 4032K | | 4 GB < C <= 8 GB 255 63 16065/ 8032K | | | | ____________________________________________________________ | | NOTE: The capacity numbers are approximate. Actual numbers can be computed by multiplying Cylinder size in bytes by 1024 cylinders. COMPUTE LBA FROM SECTOR, HEAD, AND CYLINDER NUMBER: ___________________________________________________ LBA = [ { Cylinder * (#of Heads) } + Head ] * Sectors/Track + Sector - 1 PROGRAMMING OF ATA TASK FILE: For higher performance of the drive most drive silicon vendors provides AUTO increment feature. When drive posts an interrupt either to transfer data and/or to post status, ATA taskfile indicates the address of the last sector transferred. AUTO-increment feature in the silicon relieves the drive F/W from the responsibility to update the ATA taskfile with correct sector, head and cylinder values. Today, silicon vendors who support this feature, uses sector number as one based value, where smallest sector number is 1 and highest sector number is 00 (256). To remain compatible with this feature, we would like to propose that LBA byte 0 be treated as one based value ( sector reg value 1 through 00H maps to LBA byte 0 from 00H to 0FFH) when programming the ATA task file in LBA mode. Program ATA Taskfile as follows: Sector Reg as one based LBA byte 0. Cylinder low reg as zero based LBA byte 1 Cylinder High reg as zero based LBA byte 2 SDH reg bits 3_0 as zero based LBA bits 27_24 SDH reg bits 7_4 as 0EH. To get last sector transferred, read ATA Task file and decrement sector number value by one to generate zero based LBA byte 0, ignore the carry. Read Cylinder Low, Cylinder High and SDH Register to get LBA Byte 1, Byte 2 and BITS 27_24 respectively. Example: Starting LBA = 0, Drive 0, Sectors to transfer = 256 Host will program ATA task file as follows: Sector Count 00 Sector Reg 1 Cyl low 0 Cyl High 0 Head Reg 0E0H When IO is complete task file will appear as follows: Sector Reg 00H Cyl Low Reg 0 Cyl High Reg 0 Head Reg 0E0H Host reads Sector register (0), decrements by 1 (0FFH), ignores carry to compute LBA byte 0. Then it reads Cyl low, Cyl High and head register as LBA Byte 1, LBA Byte 2 and LBA bits 27_24 respectively. The last LBA transferred is 0FFH. Starting LBA = 0FFH, Drive 0, Sectors to transfer = 3 Host will program ATA task file as follows: Sector Count 3 Sector Reg 00 Cyl low 0 Cyl High 0 Head Reg 0E0H When IO is complete task file will appear as follows: Sector Reg 2 Cyl Low Reg 1 Cyl High Reg 0 Head Reg 0E0H Host reads Sector register (2), decrements by 1 (1), ignores carry to compute LBA byte 0. Then it reads Cyl low, Cyl High and head register as LBA Byte 1, LBA Byte 2 and LBA bits 27_24 respectively. The last LBA transferred is 102H CHANGES REQUIRED AS FOLLOWS: 1. Drive F/W: _____________ Drive Firmware has to support these changes. When normal command is issued, Drive F/W will read SDH register and check if bit 6 is set. If bit 6 is set, host has programmed task file register with LBA and disregard all IDC data. Upon command completion, update ATA task file with last LBA processed. It is important to note that LBA Byte 0 is one based and must be converted to zero based to get requested LBA. Identify command data has to be modified to indicate that LBA support is present. i.e. BIT 9 of word 49 = 1, for LBA support. 2. INT 13H BIOS: ________________ Changes to BIOS are as follows: DURING POST: ____________ - Send IDENTIFY Command and check if LBA capability present. - IF ( Drive capacity > 528MB ) && ( LBA supported ) LBA_Support = TRUE ELSE LBA_Support = FALSE - Get Drive capacity from word 1 - word 6 of IDENTIFY data and Auto Configure the drive parameter for INT 13H interface (may use recommended table) AT RUN TIME: ____________ - IF ( LBA_Support ) { - Convert INT 13 parameter to LBA. - Program ATA Task file with LBA. - Set the BIT 6 of head/drive register to 1. - Send Normal Op-code. - Upon command completion, Read LBA from task file and convert it to INT 13H cylinder, head , sector number. } 3. OS Drivers ( Windows 3.1, OS/2, UNIX, Novell ): __________________________________________________ To support greater than 528MB drive, OS drivers must be modified as follows: Initialization time: ____________________ - Send Drive IDENTIFY COMMAND. - IF ( Drive capacity > 528MB ) && ( LBA supported ) LBA_Support = TRUE ELSE LBA_Support = FALSE RUN TIME: _________ - IF ( LBA_Support ) { - Program ATA task file with LBA. - Set BIT 6 of Drive/Head Register - Write Normal Command Code in Command Register (1F7). - Upon I/O completion, Read LBA from Task file to get last LBA transferred. } ADVANTAGES: ___________ * Fully Backward Compatible. * Breaks 528MB barrier. New limits will be 137 GB. * OS drivers do not need to translate LBA to Sectors/Track, Heads and Cylinder number. This provides backward compatibility with existing BIOS solutions. Driver changes are relatively small. * One less LBA translation in drive F/W. It can use this LBA to translate to true physical drive geometry parameters. * Can support up-to 4 AT IDE Drives without modifying CMOS setup because drive geometry parameters are not needed to IDC the drive and Drive Geometry tables ( e.g. INT 41H and INT 46H tables) are not required. Drive geometry can be obtained by performing INT 13H, function 8. BARRIERS TO OVER COME: ______________________ * BIOS, and OS drivers must be changed to support higher capacity.