The Enhanced IDE/Fast-ATA FAQ
Online Utenti astalalista main site mappa sito pagina gratis e-mail gratis blog
Dì ad un amico
di questo sito
Aggiorna pagina
Home
Cerca nel sito
aggiungi un link a
questa pagina
Aggiungi ai preferiti
Pagina iniziale
Guestbook
Stampa pagina
contatta AOL - ICQ
Compra da
Astalalista
inserisci annuncio
Aggiungi Link

powered by astalalista

questa ricerca sul tuo sito - incontri - altre ricerche - guadagna
Random Link!
Hosted By
HostedScripts.com

The Enhanced IDE/Fast-ATA FAQ

 go to English version

translate

The EBIOS: translation

12 The EBIOS: translation

Contents of this section

12.1 Why translation?

Both the 'int13' software interface used by the BIOS to communicate with the outside and the Cylinder/Head/Sector (CHS) fields in the partition table reserve

  • 10 bits for the cylinder field, for a total of up to 1024 cylinders;
  • 8 bits for the head field, good for up to 256 heads;
  • 6 bits for the sector field, which gives a maximum of 63 sectors since for historic reasons the sector field starts at sector 1, not 0.
The maximum disk capacity accessible through the traditional int13 interface is therefore 8GB (1024*256*63 sectors of 512 bytes). In some books, you may encounter references to 12-bit cylinder numbers; this extension (using the upper two bits of the sector field) was never widely implemented and isn't supported anywhere.

Now IDE disks have their own set of limitations; these disks, no matter if they're ATA/IDE or ATA-2/EIDE, use

  • 16 bits for the cylinder field, giving 65536 cylinders;
  • 4 bits for the head field, or only 16 heads at most;
  • 8 bits for the sector field.
This is good for a maximum disk capacity of 128GB. However, combine this with the BIOS limitations and you suddenly can't see more than the first 1024 cylinders of the IDE disk, which makes for a limit of just 504MB or 528 million bytes. This is unacceptable today. In the long term, the BIOS limit of 8GB is just as unacceptable, but as a short term solution it is desirable to get the maximum out of the standard int13 interface with IDE drives. This is where translation comes in.

12.2 How does translation work?

There are roughly three ways today's BIOSes can handle translation: standard CHS addressing, Extended CHS addressing, and LBA addressing. Translation does NOT automatically imply LBA, as you will see.

  • Standard CHS: no translation at all :-(

    Communication between drive, BIOS and operating system goes like this:

    +-------- DRIVE --------+    +- BIOS --+    +---- OS ----+
    |                       |    |         |    |   & APPS   |
    |   physical      T1   logical        logical            |
    | geometry used  ====> geometry ----> geometry           |
    |internally only        (CHS)           (CHS)            |
    |                       |    |         |    |            |
    +-----------------------+    +---------+    +------------+
    

    There is only one translation step, T1, which is internal to the drive ('universal translation'). The drive's actual, physical geometry is completely invisible from the outside---the Cylinders, Heads and Sectors printed on the label for use in the BIOS setup have nothing to do with the physical geometry! The logical geometry, used throughout, is subject to both IDE's limitation to 16 heads and to the BIOS' limitation of 1024 cylinders, which gives the (in)famous 504MB limitation.

  • Extended CHS

    +-------- DRIVE --------+    +- BIOS --+    +---- OS ----+
    |                       |    |         |    |   & APPS   |
    |   physical      T1   logical   T2  translated          |
    | geometry used  ====> geometry ====> geometry           |
    |internally only        (CHS)           (CHS)            |
    |                       |    |         |    |            |
    +-----------------------+    +---------+    +------------+
    

    Logical geometry is used to communicate between the drive and the BIOS, while a different, translated geometry is used to communicate between the BIOS and everything else.

    There is an additional translation step, T2, performed by the BIOS. This procedure breaks the 504MB barrier because the geometries used are not subjected to the BIOS and IDE limitations simultaneously: the logical geometry is subject to IDE's 16 head limitation, but not to the 1024 cylinder limitation. For the translated geometry, it is just the reverse.

    Most BIOSes denote extended CHS translation with 'Large'. Note that the geometry usually entered in the BIOS setup is the logical geometry, not the translated one. In case of doubt, consult the BIOS manual.

  • Logical Block Addressing (LBA) Here, the logical geometry is dispensed with entirely and replaced by a single, large, linear block number. This makes far more sense than using a logical geometry that is completely fake anyway.

    +-------- DRIVE --------+    +- BIOS --+    +---- OS ----+
    |                       |    |         |    |   & APPS   |
    |   physical      T1    linear   T2  translated          |
    | geometry used  ====> block no.====> geometry           |
    |internally only        (LBA)           (CHS)            |
    |                       |    |         |    |            |
    +-----------------------+    +---------+    +------------+
    

    This breaks the 504MB barrier in essentially the same way as extended CHS does. Conceptually, using a single linear number to address a sector on the harddisk is simpler than a CHS style address, but it takes more CPU cycles and is sometimes slower on the drive side as well. The differences are pretty insignificant either way.

A translating BIOS can be implemented via the system BIOS or on-board controller BIOS. Basically, this takes the drive's logical default geometry, and if the cylinder count is beyond 1024, will divide the cylinder count by an appropriate factor and multiply the heads by the same. For instance, let's take a 540 Meg drive: it has 1057 cylinders, 16 heads, and 63 sectors per track. Well, the int13 interface used by the BIOS to talk with the world can only handle 1024 cylinders, but it can address up to 255 heads. So, the x-lating BIOS will pass to the OS, via int13 calls, the geometry 528 cylinders (1057/2 (approx)) and 32 heads (16*2). Then, when the OS makes a request to the drive, the BIOS will re-translate the request to the original order, or to an LBA number if LBA is enabled. This allows for capacities of up to 8 gigabytes.

A final word about the 8GB capacity limit, which is inherent in the int13 interface and cannot be solved without ditching the traditional calls. To that purpose, the IBM/Microsoft int13 extensions document specifies a new interface between the BIOS and the operating system or applications. These extended int13 calls are made in terms of LBA addresses and can handle huge disks. Note that the BIOS is required to translate these LBA addresses back to CHS if the drive doesn't support LBA---exactly the reverse of the translation process outlined above.

12.3 I'd like to know how translation works in detail.

You asked for it :-)

If a drive is less than 504MB, it should have a logical geometry, as reported in Identify Device words 53-58, of 1024 or less cylinders, 16 or less heads and 63 or less sectors. Such a drive can be addressed directly without invoking this algorithm. For drives over 504MB, the CHS address received by the BIOS from DOS must be converted to an Extended CHS address, or an LBA address. We'll assume ECHS for now.

First, during BIOS setup, the BIOS must determine the value of N. This value is used to convert the drive's geometry to a geometry that the BIOS can support at the int13 interface. This interface requires that Cyl be less than or equal to 1024. The number of cylinders (Identify Device word 1) is divided by N while the number of heads (Identify Device word 3) is multiplied by N. N must be 2, 4, 8,..., a power of 2.

Second, in most translating BIOSes, the following algorithm is used whenever INT 13H is called to perform a read or write:

eCyl    = ( Cyl * N) + ( Head / dHead ); /* head DIV dHead */
eHead   = ( Head % dHead );              /* head MOD dHead */
eSector = Sector;                        /* used as is     */

By way of example, assume the drive's geometry is 2000 cylinders, 16 heads and 63 sectors (these numbers are in Identify Words 1, 3, and 6) and that the BIOS determines the value of N to be 2. The BIOS reports to DOS that the drive has 1000 cylinders, 32 heads and 63 sectors when int13 ah=08h function is called. This is 2016000 sectors.
Cyl/Head/SectoreCyl/eHead/eSector LBA
0/0/1 0/0/1 0
: : :
500/0/1 1000/0/1 1008000
500/15/63 1000/15/63 1009007
500/16/1 1001/0/1 1009008
500/31/63 1001/15/63 1010015
501/0/1 1002/0/1 1010016
: : :
999/31/63 1999/15/63 2015999
Note the following about this algorithm: The physical ordering of sectors on the drive is unaffected---sector n is followed by sector n+1 for all CHS and Extended CHS and LBA addresses. This is the only sane way of implementing translation, but unfortunately NOT ALL BIOSES DO IT THIS WAY. This means that changing translation modes may be a dangerous thing to do.

12.4 What is in the Enhanced Disk Parameter Table?

In a standard BIOS, the Fixed Disk Parameter Table (FDPT) contains information about the geometry of the harddisk(s). It more or less contains the same information as the drive type entry in the CMOS setup. A program that wants to use the harddisk on a low level, bypassing DOS, normally uses the BIOS' int13 functions to achieve this.

The Enhanced fixed Disk Parameter Table (EDPT) is an extension of the ordinary FDPT that makes use of undefined fields to provide information about the translation mode used. It uses a magic number (A0 in byte 3) and a checksum (in byte 15) to ensure that software cannot mistake random data for an EDPT. This practice is more or less standard across various flavors of translating BIOSes, with differing magic numbers.

On top of this, the Phoenix Enhanced BIOS standard specifies a number of extended int13 functions and a 16 byte FDPT extension. The latter contains detailed information about the current PIO or DMA type, block mode used, LBA or (E)CHS addressing, 32 bit transfer mode, media type (removable, CD-ROM), control port base and IRQ. In other words, it covers all new features of the ATA family and is flexible enough to accommodate more than four devices, nonstandard port addresses and IRQs. Proper support of all this is important to achieve any degree of Plug'n'Play functionality with ATA hardware. The WD EIDE BIOS lacks all these features.

12.5 How many types of translating/Enhanced BIOSes are there?

Too many. See question 12.4 for a discussion of some of the differences between a Phoenix EBIOS and a WD EBIOS. For a more exhaustive discussion of BIOS types, Hale Landis' effort is indispensable---see the resource guide below.

Next Chapter, Previous Chapter

Table of contents of this chapter, General table of contents

Top of the document, Beginning of this Chapter

Creato da: Astalalista - Ultima modifica: 26/Gen/2004 alle 02:57
Labelled with ICRA This page is powered by Copyright Button(TM).
Click here to read how this page is protected by copyright laws.
Please send any
comments to Webmaster


KingsClick Sponsor - Click Here
KingsClick-Your Website Deserves to be King