Before hard drives the primary way to record information was to write it to a magnetic tape drive. One of the major limiting factors for a tape drive was that it used sequential accesss storage. To accesss any piece on information, the drive would have to be re-wound or fast-forwarded to the chosen index, and then sequential stepped thru to accesss any data.
For other interesting historical storage formats see: Selectron Tube, Punched Tape, Magnetic Drum
Magnetic tape's had bad seek times, so the IBM research department developed a fast and cheap storage device, the IBM 350 hard drive disk (HDD). The main principle behind the HDD hasn't changed since its inception in 1954, a rotating magnetic disc (platter) with an adjustable magnetic head. As the platter rotated under the head, the head would write characters at a frequency of 2 * 106 chars/second using IBM's character encoding(EBCDIC). With a static write frequency The outer track sectors are physically longer and have a lower bit density than the inner ones. This leads to wasted space on the outer tracks, and were a significant loss in storage space (up-to 50%) in early HDDs. To fix this wasted space problem modern HDDs use a technique called zone bit recording.
The idea behind ZBR is to maximize the bits per inch (bpi) across the whole platter. This can be achieved by either decreasing angular velocity or increasing read/write frequencies for outer tracks. changing platter speeds is power expensive and slower then head relocation, so most modern HDD vary the read/write frequency. This creates the side effect where outer sector tracks contain more data than the inner ones. To solve this, HDD manufacturers simple define outer tracks to have more sectors than inner ones. They also break up the platter along radii into different head frequency zones. A platter implementing zone bit recording would look like:
Back in the early days of HDDs, each hard drive consisted of a few hundred Cylinders (vertical intersection of a track and multiple platters), a few heads (roughly twice the number of platters), and a constant number of sectors. The CHS address look-up was a simple way for the BIOS to accesss data on a HDD.
Since then HDD have become more complicated with zone bit recording, and faulty sector remapping. Unfortunately BIOS standards have not changed much since their inception, and still required the HDD to specify a fixed number of sectors across all tracks. To get around this limitations modern HDDs give BIOS bogus information that approximates the total size of the HDD and then the HDD controller re-maps the passed CHS address into the real physical CHS address.
Another way to represent sector addresses on an HDD is to give each sector a unique sequential id. Usually the first Cylinder-Head-Sector is identified as sector 0, the next sector as 1, all the way up through each head, and cylinder until each sector is uniquly numbered. Nearly all modern HDD and BIOSes use LBA. This didn't get around the CHS limitation of Early BIOS, but is the way modern BIOS accesss HDD sectors.
The interrupt 0x13 specification allocates 24 bits to the CHS address, giving 10 bits to the Cylinder, 8 bits to the Head and 6 bits to the Sector. Sectors also stared indexing at 1 which left a max of 63 for the sector value.
mov AL, 1 ;Read 1 sector mov CX, 0x043F ;C:4, S:63 mov DH, 0x0F ;H:15 mov DL, 0x80 ;Drive 1 mov BX, SectorData int 0x13
The IDE/ATA Specification started out at 22 bits, but changed to 28 once it became a standard. The 28 bits allowed for 268 * 106 sectors to be address by the BIOS. with 16 bits for the Cylinders, 4 for the Heads, and 8 for the sectors. There is no direct interface between a program and the IDE/ATA control commands. If a program needs access to the hard drive it must do it through the Interrupt 0x13 command.
|IDE/ATA-5 28 bits||1111111111111111||1111||11111111||128 GiB|
|Interrupt 0x13 24 bits||1111111111||11111111||111111||7.88 GiB|
|Union 20 bits||1111111111||1111||111111||504 MiB|
Early computers didn't have HDDs larger than a couple of MiB, and never needed to accesss more than a million sectors, So like any lazy programmer, the BIOS did direct mapping of the Int 0x13 fields to the IDE/ATA fields. This resulted in a truncation of the Head field, reducing the number of total available bits to 20; or 504 MiB of address able space.
This limit was a software limit, not a hardware or specification limit, and could easily be fixed by flashing a new BIOS. There are other ways (Dedicated Controler cards, BIOS extension cards), but flashing a new BIOS from the manufacturer was the cheapest way to fix this problem.
The fix for this limit was easily done when they saw tat the extra bits in the Int 0x13 Head field could just be moved over to the IDE/ATA Cylinder field without loosing any information. The ECHS specifications say the presented number of cylinders was divided by N until it was under 1024 (210), and the total number of heads was multiplied by N. So for example n imaginary drive the represents itself to the BIOS as having 12272 Cylinders, 16 Heads, and 63 Sectors would be remapped to having 767 Cylinders, 256 Heads, and 63 Sectors N = 16. and now the an Interrupt 0x13 call could accesss every sector on our imaginary HDD.
To do the actual translations the BIOS did something similar to the following:
IDE_Cylinder = Int13_Cylinder << 4 | (Int13_Head & 0xF0) >> 4; IDE_Head = Int13_Head & 0x0F; IDE_Sector = Int13_Sector;
With an ECHS capable BIOS the total number of availble address bits was raised to 24 allowing for ~16*106 sectors or 7.88 GiB of HDD space. This is a hard limit set by the interrupt 0x13 specification. The only way around this is with a new specification. That is exactly what the interrupt 0x13 extension is.
As with the previous limit the only way to fix this is with a new BIOS flash. These new larger commands currently use a 16 byte Disk Address Packet which allows for 64 bits to be used in Sector addressing. They also learnt from their past mistake of making the address width a static size. The 1st byte of the address packet describe how large the whole packet is, and if need be can be expanded into the un-used 2nd byte, but with 64 bits the extended instructions can address up to 8 Zebibytes (270) of HDD space. Even with the most advanced HDD on today's market we are ways off from having HDD that large.
This extension doesn't do CHS addressing, instead opting for the simpler LBA; which requires not only the BIOS, but HDD and operating system to also use LBA
With modern BIOS using the Interrupt 0x13 extensions, an OS, or boot loader can specify up to ~18*1018 sectors, but the IDE/ATA-5 standard still limits the BIOS from addressing more than ~268*106 sectors. Again we need to create a new specification to fix this 128 GiB limitation.
The ATA-6 specification defines a single 48 bit address field capable of representing up to 128 pebibytes. ATA-6 also uses the LBA format to accesss sectors, which reduces BIOS work by no-longer needing to translate to or from CHS addresses.
|504 MiB limit||210 cylinders * 24 heads * 26-1 sectors||ATA-Int13 union||Extended CHS|
|7.88 GiB limit||210 cylinders * 28 heads * 26-1 sectors||Int13 interface||Int13 extensions|
|128 GiB limit||216 cylinders * 24 heads * 28 sectors||ATA interface||ATA-6 specification|