Yet Another ATA-2/Fast-ATA/EIDE FAQ



Version: 1.1

Last modified: June 3, 1995

Maintained-by:Peter Herweijer

URL: http://www.wi.leidenuniv.nl/ata



This FAQ is the work of John Wehman and Peter Herweijer.



The most recent version is available by FTP from

ftp.aimnet.com:/pub/users/clau/ide_ata

ftp.rahul.net /pub/lps/hard-disk/ya-ata.faq

ftp.wi.leidenuniv.nl:/pub/faqs



at some point in the future also from

rftm.mit.edu:/pub/usenet/news.answers/Enhanced-IDE-faq/



and finally by WWW from Daniel Tauritz' page

http://www.wi.leidenuniv.nl/ata



You can also get it by e-mail from pieterh@sci.kun.nl by sending message

with "ATA-2 FAQ please" in the Subject: header. The body of the message

will be ignored. Anything fancy will probably break the mail server and

cause it to send you an uuencoded coredump :^)



DISCLAIMER. The information in this FAQ comes without any warranty. The

authors or distributor will not accept responsibility for any damage

incurred directly or indirectly through use of the information contained in

this FAQ.



COPYRIGHT. This document is copyright (c) John Wehman and Peter Herweijer.

You are free to distribute it by electronic means and make as many copies

as you want on electronic or magnetic media as long as this document

remains unmodified, with copyright notices intact. You are allowed to make

paper copies of it for personal use; however, distributing paper copies of

this document is prohibited without the authors' permission.



THANKS. To everyone on comp.sys.ibm.pc.hardware.storage for encouragement

and feedback, especially those who took the time to write down their

comments in some detail. To Hale Landis in particular: without his input

the FAQ would have been considerably less accurate on a number of key

points.

HTML formatting by Roger Mathews



INTRODUCTION



1.0 What is EIDE? What is Fast-ATA?

1.1 What is ATA/IDE?

1.2 What is ATA-2?

1.3 What is ATA-3?

1.4 What is ATA-PI?

1.5 What is an Enhanced BIOS?

1.6 What is a secondary port?



PRACTICALITIES



2.1 What are the main features of EIDE and Fast-ATA?

2.2 What should I look for in an ATA-2 (Fast-ATA, EIDE) interface?

2.3 Is my BIOS enhanced? How can I recognize this?

2.4 Are old IDE drives compatible with ATA-2 (EIDE, Fast-ATA) interfaces?

2.5 Can ATA-2 (EIDE, Fast-ATA) drives be used with my old interface?

2.6 Can large drives be used with my old BIOS?

2.7 I need an Enhanced BIOS to acces >504MB. How do I get one?

2.8 I have software to break the 504MB barrier. Should I use it?

2.9 Can I use a large harddisk with operating systems other than DOS?

2.10 What should I use: Normal, LBA or Large?

2.11 I have a 50MHz VLB system. Is it compatible with ATA-2 interfaces?

2.12 I need a PCI ATA-2 interface that uses only one slot.

2.13 Will adding an 'EIDE' interface help my drives' performance?

2.14 Why isn't my drive as fast as it's advertised to be?

2.15 Why is my new EIDE interface no faster than my old VLB one?

2.16 A guy on the net has the same drive and he gets 16MB/s!

2.17 I can enable write caching on my harddisk. Should I?

2.18 Can I safely change the BIOS' xlation mode (None, LBA, Large)?

2.19 Can I safely move my harddisk between computers?

2.20 I have problems with my Award 4.50G BIOS and large drives.

2.21 Can my drive do 32-bit access?

2.22 Help! I have OnTrack Disk Manager installed and now...

2.23 Help! Windows 32-bit disk access doesn't work anymore!

2.24 Help! Windows for Workgroups' 32-bit file access fails!

2.25 The user's net.resource guide

2.25.1 The user's net.resource guide: I/O card drivers

2.25.2 The user's net.resource guide: hardware manufacturers

2.25.3 The user's net.resource guide: software & BIOS publishers



TECHNICALITIES



3.1.1 How does ATA(-2) work?

3.1.2 What are PIO modes?

3.1.3 What are DMA modes?

3.1.4 How are the Task File and data I/O ports assigned?

3.1.5 What does an ATA-2 interface do?

3.1.6 What is Block mode?

3.1.7 What is LBA?

3.2.1 How does ATAPI differ from, and coexist with, ATA(-2)?

3.2.2 What's so special the secondary port?

3.3.1 How does translation work?

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

3.3.3 What is in the Enhanced Disk Parameter Table?

3.3.4 What are the issues surrounding OnTrack's Disk Manager?

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

3.4 How does Windows' 32-bit disk access work?

3.5.1 The hacker's documentation guide

3.5.2 The hacker's net.resource guide



- Introduction -



The aim of this introduction is to make you familiar with the most

important buzzwords used in this FAQ and to provide a first overview of the

issues involved. Please glance through it before reading the rest of this

document.



1.0 What is EIDE? What is Fast-ATA?



Enhanced IDE (EIDE) is a marketing program from Western Digital consisting

of a software part--an Enhanced BIOS specification which breaks the 504MB

barrier--and a hardware part that has been derived from the ATA-2 (hard

drives) and ATA-PI (tapes, CD-ROMs) standards. Fast-ATA is a similar

Seagate marketing program, endorsed by Quantum, that limits itself to ATA-2

(hard drives) only. If you're unfamiliar with these terms, read on :^)



1.1 What is ATA/IDE?



ATA (AT Attachment) and IDE (Integrated Drive Electronics - or numerous

other interpretations) are one and the same thing: a disk drive

implementation designed to integrate the controller onto the drive itself,

thereby reducing interface costs, and making firmware implementations

easier. This low cost/easy integration created a boom in the disk drive

industry, as PC integrators readily ate up the low-cost alternative. Since

the late 80's, ATA (as it is properly called), has become the drive of

choice for the cost inhibited buyer.



1.2 What is ATA-2?



ATA-2 is a compatible extension of ATA (IDE). The most important additions

are performance enhancing features such as fast PIO and DMA modes. Another

important novelty is the souped-up Identify Drive command allowing a drive

to tell the software exactly what its characteristics are; this is

essential for both Plug'n'Play and compatibility with future revisions of

the standard.



While there is also a new way of addressing sectors on the harddisk (LBA),

this is merely a simplification. Contrary to common myth LBA has nothing to

do with breaking the famous 504MB (528MB) barrier. In fact, even in the old

ATA (aka IDE) standard the theoretical size limit is well over 100GB.



1.3 What is ATA-3?



Oh, help, don't ask. The first draft is out but it's a moving target at

this stage. There's no ATA-3 equipment.



1.4 What is ATA-PI?



ATA Packet Interface is a standard (draft) designed for devices such as

CD-ROMs and tape drives that plug into an ordinary ATA (IDE) port. The

principal advantage of ATAPI hardware is that it's cheap and works on your

current adapter. For CD-ROMs, it has a somewhat lower CPU usage compared to

proprietary adapters but there's no performance gain otherwise. For tape

drives, ATAPI has potential for superior performance and reliability

compared to the popular QIC117 "floppy" tape devices.



While ATAPI CD-ROMs use the harddisk interface, this does not mean that

they look like an ordinary harddisk; to the contrary, from a software point

of view they are a completely different kind of animal. They actually most

closely resemble a SCSI device.



This means that intelligent (e.g. caching) controllers that are not ATAPI

aware will NOT work with these devices. This also means that, at present,

you cannot boot from an ATAPI CD-ROM and you still must load a driver to

use it under DOS or Windows. You can expect native ATAPI support in most

new operating systems, though, and the first ATAPI-aware BIOS that will

even allow booting from an ATAPI CD-ROM has already been introduced.



1.5 What is an Enhanced BIOS?



An Enhanced BIOS is a BIOS that makes it possible to use harddisks

exceeding the (in)famous 504MB (528 million bytes) barrier with

DOS/Windows. The origin of this limit is the disk geometry (cylinders,

heads, sectors) supported by the *combination* of an IDE drive and the

BIOS' software interface. Both IDE and the BIOS are capable of supporting

huge disks, but their combined limitations conspire to restrict the useful

capacity to 504MB.



An Enhanced BIOS circumvents this by using a different geometry when

talking to the drive than when talking to the software. What happens in

between is called 'translation'. For example, if your drive has 1500

cylinders and 16 heads, a translating BIOS will make programs think that

the drive has 750 cylinders and 32 heads.



Unfortunately there are several flavors of translating BIOSes. The de facto

standard is the Microsoft/IBM 'INT 13 Extensions' document; Phoenix has

presented a superset of this in their Enhanced BIOS specification. Phoenix,

AMI and Award BIOSes are based on this. Another popular flavor, which is

flawed and lacks vital features found in the MS/IBM and Phoenix standards,

is that of the Western Digital Enhanced IDE Implementation Guide. However,

the Phoenix EBIOS has broader support in the industry and is the more

future-proof variant: apart from the translation, the Phoenix Enhanced BIOS

specification has room for expansion beyond four ATA devices and adds

important new data structures and calls to the INT13 (software) interface.



1.6 What is a secondary port?



From the early days of the IBM PC there has been the possibility of

connecting a 'secondary' harddisk interface; unfortunately, there has

hardly been any software support up to now. There is hardly anything

special about a secondary interface; it just uses a different interrupt and

I/O addresses to avoid clashes with the ordinary (primary) interface. A

secondary interface allows you to connect another ribbon cable with two

more ATA devices (harddisk, ATAPI CD-ROM or ATAPI tape) for a total of

four.



The secondary port is enjoying a renaissance because the advent of ATAPI

devices (CD-ROM, tape) has made four device support an absolute necessity.



Return to Table of Contents

- Practicalities -



If you're looking for the answer to a specific question as opposed to a

primer in storage technology, try this.!



2.1 What are the main features of EIDE and Fast-ATA?



The fast transfer modes (PIO modes 1-4 and DMA mode 0-2) are the

cornerstone of Fast-ATA and EIDE.

Both Fast-ATA and EIDE are marketing terms contrived by three different

disk drive manufacturers. Fast-ATA is a term coined by Seagate, and

endorsed by Seagate and Quantum; EIDE is coined and endorsed by Western

Digital.



EIDE supports these fast transfer modes, along with:

* LBA mode (explained in the tech section)

* Four devices on the ATA controller (secondary port)

* Translation: larger than 1024 cylinder limit (WD EBIOS)

* Tape Backup and CD ROM devices on the ATA controller (ATAPI)



Fast-ATA and Fast-ATA-2 also support these modes, along with:

* Multiple Read/Write commands

* LBA mode



The difference between the two schemes is mainly in the scope of EIDE. This

specification encompasses many facets of drive/device technology which

haven't been fully ironed out yet. With EIDE, many things can be called

Enhanced, and in practice hardware is tagged EIDE even if it doesn't

support all of EIDE's features. This can make for extremely confusing

purchases. For that reason, this FAQ will avoid the term EIDE whenever

possible, talking about its component parts (ATA-2, ATAPI, etc) instead.

This hopefully allows you to get a better picture of exactly *what* 'EIDE'

features you need.



Another potentially confusing matter is Fast-ATA-2. The latter embraces PIO

mode 4 and DMA mode 2 (16MB/s), while vanilla Fast-ATA only uses PIO mode 3

(11MB/s) and DMA mode 1 (13MB/s). Both fully comply with the ATA-2

standard, so Fast-ATA-2 should be read as [Fast-ATA]-2 rather than

Fast-[ATA-2].



2.2 What should I look for in an ATA-2 (Fast-ATA, EIDE) interface?



There are a number of recent additions to PC storage technology which can

play a role in purchasing a new interface. Some features, however, may

already be present on your system or may be unimportant to you.



The least an ATA-2 interface should provide is PIO mode 3 transfers for

drives that support it. It should also provide proper support for slower

PIO modes (0, 1 and 2) to ensure optimal compatibility with older drives.

The "DMA" modes found on some cards often have little to do with direct

memory access, unfortunately, and are of questionable merit. Other advanced

features like prefetch buffers are also exceedingly rare.



Since ATAPI CD-ROMs and tapestreamers are quickly becoming very popular in

the low-end market, a secondary (ATA) port, which allows you to connect a

total of four ATA devices, is hardly a luxury. Note that a few modern

soundcards provide a secondary ATA interface instead of the traditional

proprietary CD-ROM connectors; make sure it can be disabled or buy a

single-ported interface.



You will want an on-card BIOS too if your mainboard BIOS doesn't support

translation or if it has only buggy or outdated support. The BIOS will

override the mainboard BIOS where harddisks are concerned. It should

preferably conform to the Phoenix Enhanced BIOS specification and build a

proper Enhanced Disk Parameter Table (EDPT) when necessary. It is likely

that substandard BIOSes will cause trouble with future translation- and

EDPT-aware applications, even if they appear to work fine now.



A BIOS ROM will, just like a mainboard with integrated EIDE, often have the

added advantage that you don't need separate DOS drivers. The BIOS on an

interface will occupy 16k of UMB space, though, and you will still need

drivers for every other operating system you use.



Drivers! Without well-designed drivers most interfaces could as well be an

old-fashioned ISA card for all the good they'll do. Even if the card has a

BIOS, which usually removes the need for a driver under DOS, you will still

need drivers for other operating systems, including Windows. Too many

drivers are unstable.



NOTE that most "EIDE" interfaces to date are buggy to some extent. This

includes the expected problems like noncompliance with ATA-2, but also

obscure things like the use a single buffer for both primary and secondary

channel, which may cause data corruption under very specific circumstances.

It can't hurt to track a few newsgroups for hands-on information.



2.3 Is my BIOS enhanced? How can I recognize this?



Good question.

Unfortunately, I know no easy answer. The mere ability to specify more than

1,024 cylinders in the BIOS setup is _not_ conclusive. In your BIOS setup,

drive related settings like "LBA", "ECHS" or even something silly like

"Large" are telltale signs of a BIOS with translation support. A copyright

before 1994, on the other hand, reduces your chances to virtually zero :^(



AMI BIOSes dated 4-25-94 and later and Phoenix BIOS v4.03 and later are

reported to support translation. Some revisions of Phoenix v4.03 may not

support it, though, depending on the computer or system board manufacturer.



Western Digital has a utility available by ftp that examines the Enhanced

Disk Parameter Table (EDPT), if present. If it finds one on your system,

your BIOS has all the bells and whistles

(ftp.wdc.com:/drivers/hdutil/chkbios.com). Beware that BIOSes conforming to

the WD Enhanced BIOS specification won't build an EDPT unless LBA is

enabled. Beware also that with a WD EBIOS it is highly unsafe to enable LBA

on a disk that already contains data. This is due to a flaw in the

specification.



If you're desperate enough, you can also find out by simply trying to enter

more than 1024 cylinders and using, for example, MSD to find out if the

BIOS mangles the geometry or not, but we don't take responsibility for what

may happen to your harddisk. Take care not to write even a single byte to

it!



2.4 Are old IDE drives compatible with ATA-2 (EIDE, Fast-ATA) interfaces?



Yes, this should work fine.



To be used in an advanced mode, the drive has to support the ability to

transfer data at the fast rate. Also, the controller needs to be able to

run at fast mode speed. Older drives can work with ATA-2 interfaces,

provided these interfaces have the intelligence to query the drive as to

its maximum transfer rate. There is a drive command (Identify Drive) that

gets a sector's worth of data which holds all types of drive information,

including the data transfer rates. The controller MUST be able to identify

this for the drive to work properly. Blind PIO Mode 3 (programmed to fast

mode without querying the drive) in an older drive that can't support it

will end up corrupting data, hanging the drive, and just making a mess of

things. But, most controllers out there have some intelligence built in.



If you intend to put an older drive on the same cable as an ATA-2 drive,

you may want to verify that your interface is capable of using independent

timing for master and slave drive. Otherwise, your old drive might end up

holding back your newer one.



2.5 Can ATA-2 (EIDE, Fast-ATA) drives be used with my old interface?



Fast-ATA drives and EIDE drives can be used without fear on regular ISA

controllers. The thing about advanced modes is that the drive is ready for

the data in the fastest mode; the slower the controller, the easier it is

on the drive.



Be sure to read the next question too.



2.6 Can large drives be used with my old BIOS?



Yes, in principle, but there is the small matter of the 504MB barrier.



If the new drive exceeds this capacity, you should ensure you have an

Enhanced BIOS if you want to use more than 504MB with DOS or Windows. It is

important to note that this is a software only issue: you do _not_ need a

special interface to support large drives.



BE WARNED that some older BIOSes will incorrectly handle drives with more

than 1024 cylinders. Instead of truncating the number of cylinders to 1024,

they use the cylinder count modulo 1024. The solution is to specify 1024

cylinders in the BIOS setup.



This becomes a real problem with BIOSes that don't allow you to enter the

drive parameters manually. The 1991-vintage PS/2 models 35sx and 40sx do

this, as do all of the ValuePoint models up to, but not including, the 1994

ValuePoint Performance series. With these machines, you should verify that

the drive has a way to fake having no more than 1024 cylinders (Western

Digital has a utility for their 540MB drive, and many Maxtor drives have a

jumper). Note that some operating systems, such as Linux and OS/2, allow

you to override the BIOS' drive geometry information.



2.7 I need an Enhanced BIOS to acces >504MB. How do I get one?



The options are: a new mainboard BIOS, add-on BIOS, or software.



To upgrade your mainboard BIOS, either by a newer version of your current

BIOS or by a custom made BIOS from firms such as Microid Research (MR

BIOS), is probably the best option. It may or may not be more effective to

replace the entire mainboard and get all the latest bells and whistles for

$100 more.



The next option is to purchase an add-on BIOS that effectively replaces the

harddisk portion of your mainboard BIOS. Most BIOSes on ATA-2 interfaces,

if they have a BIOS at all, also do this, so that may be a nice way to go

if your present interface isn't up to snuff.



Either way, you will have to repartition and reformat the (large) harddisk.

A final option is to use a software solution. Be sure to read the section

about this below.



2.8 I have software to break the 504MB barrier. Should I use it?



This is the most convenient option for some, but there are caveats.



The software, while it is known by all kinds of exotic names depending on

who licensed it, is usually a version of either MicroHouse's EZ-Drive or

OnTrack's Disk Manager. Disk Manager, when used on the boot drive, has to

resort to some trickery in order to be loaded very early during the boot

process (which is necessary for technical reasons). This is accomplished by

modifying the Master Boot Record (MBR) and storing a Dynamic Drive Overlay

(DDO) on the very first disk track. EZ-Drive works in a similar way.



The catch is that the partitions created by the current versions of this

software are completely incompatible with, and unreadable by, everything

else. An annoying effect is that operating system installations, which

often overwrite the MBR, will render the contents of your harddisk

inaccessible. You will need to restore the MBR from the installation floppy

to regain access to your partitions.



More seriously, generic disk-related device drivers will fail even if they

work with all other translation schemes. Important examples are (E)IDE

interface drivers; remember that without these drivers an interface will in

general be much slower. You'll need drivers that are specifically aware of

the translation software you use. Also, many operating systems other than

DOS will not be able to access or use the drive, at least not 'out of the

box'. Disk fixing utilities may fail to work if the partition table or the

DDO/XBIOS overlay is damaged.



OnTrack (tech@ontrack.com, sales@ontrack.com) is aware of these problems

and is working on a new version of DiskManager (v7) that should remove most

of them, more specifically allow multiple operating systems and be

compatible with most drivers, including those of ATA-2 (EIDE) interfaces

and ATAPI CD-ROMs. In the mean time, IBM and Microsoft have fixes for OS/2

(in the Bonus Pack) and NT (Service Pack 2). More about DiskManager in

section 3. We lack details about EZDrive.



2.9 Can I use a large harddisk with operating systems other than DOS?



This is often less of a problem than with DOS, but some OSs don't

understand translation.



With operating systems such as NetWare, Unix, Win/NT and OS/2, the only

thing you need to use large ATA disks is a BIOS that allows specification

of more than 1024 cylinders in the drive type setup. Since these OSs use

the BIOS only when booting, the only consequence of not having an Enhanced

BIOS is that boot managers, boot partitions etcetera have to reside below

cylinder 1024.



Once running, these operating systems use their own software to control the

disks. That way, they are not subject to the BIOS' restrictions such as the

capacity limit. Unfortunately, this also means that if you have a

translating EBIOS or software driver, the OS has to be aware of the

translation scheme used, or conflicts will arise between the operating

system and DOS/Windows. If you can set up partitions so that all DOS and

boot partitions reside below the first 1024 cylinders (504MB), you can

avoid translation altogether and all the hassles with it.



Older operating systems, such as NetWare, don't understand translation at

all. Newer ones (OS/2 3.x, Linux 1.2, more?) will handle standard

translation schemes out of the box, but not those employed by some software

drivers (EZDrive, Disk Manager v6.0 or older). In the case of DM 6, fixes

or updates are available for some operating systems (see above).



2.10 What should I use: Normal, LBA or Large?



'Normal' causes the BIOS to behave like an old fashioned one without

translation. Use this if your drive doesn't need it (ie. has fewer than

1024 cylinders) or if you want to use the drive with a non-DOS operating

system that doesn't understand translation.



'Large' tells the BIOS to use CHS translation. It uses a different geometry

(cylinders/heads/sectors) when talking to the drive than when talking to

the BIOS. This type of translation works with all drives.



'LBA' differs from 'Large' in that it uses so-called LBA addressing to

access the harddisk. The advantage of LBA is that it theoretically is a

little faster. The disadvantages are that not all drives support it, not

even all large ones, and it sometimes turns out to be slower, depending on

the drive.



WARNING! The BIOS may change the (translated) geometry if you change from

Normal or Large to LBA. The same thing may happen if you transfer a disk

that has been formatted on an old, non-LBA computer to a new one that uses

LBA. This HAS destroyed data.



! Section 3 tells more about the differences between these three.



2.11 I have a 50MHz VLB system. Is it compatible with ATA-2 interfaces?



It should be, but there are problematic cases.



It has been observed that some controllers will base their I/O cycle times

on the bus clock of the computer. This means that with a 50MHz bus, the

cycle time will be faster than with a 33MHz bus. This could lead to

undesirable results if these cycle times are faster than the drive can

handle. Make sure your controller supports multiple bus speeds in the

software setup, and program it correctly.



2.12 I need a PCI ATA-2 interface that uses only one slot.



There is a problem with PCI and multi-I/O or dual-ported IDE interfaces.

These interfaces need two or more (predetermined) interrupts, which may not

be possible with your PCI slots. The usual workarounds are either a tiny

"paddle" board that plugs into an ISA slot, or integration of I/O functions

on the mainboard.



Some vendors use single-slot PCI interfaces that rely on a proprietary

extension of the PCI bus. This is obviously not portable; you often can't

even move the card to a different slot in the same machine.



This is not so much a weakness in the design of PCI, but a conflict between

PCI's plug'n'play philosophy and the requirement that these cards be fully

compatible with old cards.



2.13 Will adding an 'EIDE' interface help my drives' performance?



A new interface may or may not help; it is possible to make a rough

prediction if a better interface would really work.



Hardware vendors and marketing people would love to see everyone rush out

and buy the latest generation of "EIDE" adapters. To achieve this noble

goal they tend to juggle with too-good-to-be-true performance figures. The

relation between this advertising hype and the real world is shaky at best.



The main point to remember is: a slow drive is a slow drive no matter how

good the interface. If the speed at which the drive physically transfer the

data to/from the media is the limiting factor in performance, and it often

is, the only way to make things go significantly faster is to purchase a

better drive. Note that the transfer modes supported by modern drives

(those 11MB/s or larger figures) have little to do with their performance.



In addition, an 'ordinary' VLB interface may already offer respectable

bandwidth---the fastest ATA transfer mode is theoretically 8.3 MB/s, which

is more than any ATA-2 drive can sustain. An ISA interface rarely exceeds

2.5MB/s, which is a bit cramped for modern drives.



How to determine if the drive is the bottleneck? You can get a rough idea

by using two different benchmarks. The first benchmark should be a decent

one that really tests the throughput from the drive platter to memory, such

as Norton SI or QBench. For the second you take a 'benchmark' that merely

moves data between the processor and the drive's buffer cache without

exercising the media at all. A popular example that works well on drives

with a buffer cache of 64k or more is Coretest. This second result, while

worthless as a disk benchmark, is a rough indication of the interface

bandwidth.



Often you'll find that the second figure exceeds the first by a

considerable margin (over a factor two). This means that the properties of

the drive itself are the bottleneck, and improving the interface speed any

further won't really help. The only thing that may improve performance

somewhat is using block mode (using either a BIOS option or a driver).



Only if the drive throughput starts to approach the interface bandwidth

will you have a fair chance that a new interface will have a large impact

on performance, _provided_ the drive supports the faster modes.



Be sure to read the following questions to get a more complete picture.



2.14 Why isn't my drive as fast as it's advertised to be?



Good question. The basic answer is that the advertised modes are

*theoretical* transfer rates.



This means that for transfers to or from the buffer cache, the data will be

transferred across the bus at n Bytes in 1 second. Realistically, however,

drives do more than just give data to the host out of cache. For each

sector transferred to the host, it needs to get one from the media. This

reduces the overall "bandwidth", or the total drive's clock cycles

dedicated to these tasks. Also, there is internal controller processing,

table updates, and positioning information that has to be taken into

consideration. This all reduces the throughput of the data cache to the

bus.



On top of that, depending on the benchmark used to determine the

"throughput", the rate can vary from 1MB/s to 9MB/s and upwards, all on the

same drive. Plus, system configuration (MHz CPU, RAM, Smartdrv (if DOS), L1

cache) make a difference as well. Finally, different areas on the same disk

can exhibit as much as a factor two difference in transfer rate.



Bottom line is, whatever benchmark you use, you will not "see" the

advertised transfer rate. The real test is how well it improves *your* day

to day applications. The rest is just fluff.



2.15 Why is my new EIDE interface no faster than my old VLB one?



There are several reasons why it is possible that an ATA-2 interface is no

faster than a local bus ATA one even if the drivers are installed and

everything works properly. The first, and most important, is that the

bandwidth of the fastest ATA mode, 8.3MB/s, exceeds the real world transfer

rate of most drives on the market today by a considerable margin. If this

is the case for your drive, increasing the interface bandwidth beyond this

will have no noticeable effect.



A further possibility is that your drive does not support the ATA-2

transfer modes at all. In that case, an ATA-2 interface may improve

performance relative to an old-fashioned ISA bus interface, but it will be

no faster than a good local bus ATA interface.



Finally, if the ATA-2 interface does not support separate timing for master

and slave drives, putting an ordinary ATA drive on the same cable as an

ATA-2 drive will reduce the interface speed to that of the lowest common

denominator.



2.16 A guy on the net has the same drive and he gets 16MB/s!



"Usenet is like a herd of performing elephants with diarrhea-- massive,

difficult to redirect, awe-inspiring, entertaining, and a source of

mind-boggling amounts of excrement when you least expect it."



-- Gene Spafford (spaf@cs.purdue.edu), 1992



2.17 I can enable write caching on my harddisk. Should I?



Do not confuse this with Smartdrive (or whatever) lazy writes: what is

meant here is altering the drive's buffer cache management algorithm. This

is possible using newer versions of Drive Rocket, with hdparm under Linux,

and probably other utilities too. Provided, of course, the drive supports

this feature. Sometimes it can also be done using jumpers on the drive.



There seem to be problems with this, if a program will issue a soft-reset

(which on Intel Pentium Motherboards also issues a hardware-reset) as soon

as it sees the last IRQ, which overall ends up corrupting data. Use with

care, and BACKUP.



2.18 Can I safely change the BIOS' xlation mode (None, LBA, Large)?



Unfortunately, no. Proceed with care.



While with many BIOSes, the sectors on the disk are addressed in the same

order independent of the translation mode, some use a different type of

translation algorithm. The latter type of BIOS will shuffle your data as if

it were a deck of cards if you alter the translation mode.



Moreover, BIOSes that conform to the WD Enhanced BIOS spec may use

completely dissimilar drive geometries in the software (INT13) interface

depending on the translation mode, which opens up the possibility of data

corruption. This is a major flaw in the WD EBIOS specification.



2.19 Can I safely move my harddisk between computers?



Transferring a partitioned and formatted harddisk between computers is

potentially dangerous if they use different translation schemes (see above)

INCLUDING moving disk from an old computer that doesn't support translation

at all to a new one that does. This is really a little known issue. Usually

everything goes smoothly, but you would NOT be the first to be caught by

surprise. DO NOT ASSUME IT WON'T HAPPEN TO YOU. IT *HAS* DESTROYED DATA.



2.20 I have problems with my Award 4.50G BIOS and large drives.



If your 4.50G BIOS is dated earlier than 13/12/1994, the address

translation table is faulty. To access drives with more than 1024

cylinders, you cannot use address translation (Large) but *must* use LBA.

In versions dated 13/12/1994 or later this has been fixed.



2.21 Can my drive do 32-bit access?



There appears to be an awful lot of confusion about this subject, partly

due to some unhappy terminology.



In the most literal sense, no ATA(-2) drive will allow 32-bit access. Data

is transferred to and from the drive over a 16 bit bus. However, many local

bus interfaces are capable of combining two 16-bit words into a 32-bit

doubleword when reading data from the disk, and the reverse when writing.

This way, data transfer between the CPU and the interface can be done in

32-bit chunks. This is often called 32-bit access, although 32-bit host bus

transfers would be a better name.



With 32-bit host bus transfers, more efficient use is made of the

computer's bus and CPU. On the other hand, these are seldom the bottleneck,

so don't expect miracles from this feature.



Windows' 32-bit disk and file access are completely unrelated issues and

the subject of the following questions.



2.22 Help! I have OnTrack Disk Manager installed and now...



There's a bit about DM in section 3. Read it. If that doesn't help, contact

OnTrack tech support (e-mail: tech@ontrack.com).



2.23 Help! Windows 32-bit disk access doesn't work anymore!



There are numerous reasons why 32BDA can fail; you will more easily be able

to do something about it (or decide if you want to fix it in the first

place) if you know a bit of what it does.



Windows' 32-bit disk access (32BDA) is a bit of a misnomer, actually, since

it has nothing to do with 32-bit data transfers. A slightly better name for

it is "FastDisk". It is a feature of Windows in 386Enhanced mode that

allows one to replace the BIOS' disk routines by Windows' own routines that

work in protected mode. A much better name, then, would be "protected mode

controller access". For some reason Microsoft decided not to use the

latter.



Anyway, the main advantage of this feature is that with it, Windows can use

virtual memory for its DOS sessions. Without 32-bit disk access, DOS

sessions cannot be swapped out and every DOS box takes 640k of REAL memory.

Because it also reduces the number of switches between virtual and

protected mode Windows has to make, it gives a slight performance

improvement as well, but usually nothing dramatic.



If 32BDA is used together with Windows for Workgroups' 32-bit file access

feature, it will eliminate these mode switches altogether (at least for

many disk operations), which gives a far more interesting performance

boost.



Unfortunately, the standard FastDisk routines that are internal to windows,

called *wdctrl, are severely limited in their capabilities. The *wdctrl

software understands nothing of non-IDE hardware (e.g. SCSI), more than two

harddrives, drives with more than 1024 cylinders, 32-bit host bus

transfers, block transfers, or ATAPI CD-ROM drives on the primary ATA

channel. If you use any of these things, 32-bit disk access won't work

unless you have a *wdctrl replacement.



Today, that means that 32-bit disk access won't work "out of the box" for

most of us.



Most interfaces that are incompatible with *wdctrl come with their own

FastDisk routines (usually with a .386 extension). For the rest of you,

many drive manufacturers offer replacement FastDisk software. For Western

Digital you can use ftp.wdc.com (/drivers/win31.exe); for other brands

their BBS is your best bet. You can also contact your vendor to find out

what is available.



NB. These drivers are incompatible with the Stealth feature of some

versions of Quarterdeck's QEMM. Quarterdeck's fix can be found on

ftp.wdc.com:/drivers/hdutil/32bda.com.



2.24 Help! Windows for Workgroups' 32-bit file access fails!



The idiosyncrasies of the 32-bit disk access feature with respect to disk

hardware has led to the popular myth that 32-bit file access has similar

problems. However, that's all it is: a myth. If 32-bit file access fails,

you should first check your filesystem and the programs that use it. As

little as a single open file, e.g. from a printer spooler, will cause 32BFA

to fail. Oh, and put



DEVICE=C:\WINDOWS\IFSHLP.SYS



in your CONFIG.SYS, and make sure your SYSTEM.INI contains the correct

magic incantations (vfat.386, vcache.386). If this doesn't help, read the

FAQ on this topic (see the net.resource guide for details).



2.25 The user's net.resource guide



There are a couple of related FAQs floating around on the net. Hale Landis

(landis@sugs.tware.com) has a few excellent, if pretty technical,

documents, posted irregularly, which he keeps on intending to revise :^)

Daniel Tauritz (dtauritz@WI.LeidenUniv.NL) no longer maintains EIDE

Mini-FAQ that contains a short but potentially useful list of available

interfaces; it needs to be expanded and maintained---any takers? All this

and more can be found on



ftp.wi.leidenuniv.nl:/pub/faqs

http://www.wi.leidenuniv.nl/ata



Don't forget the comp.sys.ibm.pc.hardware FAQ, maintained by Ralph

Valentino. It can be found on comp.answers and the FAQ repository

rtfm.mit.edu. It incorporates the world-famous 'Jumper FAQ' (see

ftp://rtfm.mit.edu/pub/usenet/news.answers/pc-hardware-faq/part3).



On the tangential subject of Windows for Workgroups' 32-bit FILE access,

Mike McCormick (m.mccormick2@genie.geis.com) has a good FAQ in progress,

posted occasionally on comp.os.ms-windows.windows.setup. It can also be

found on comp.answers and therefore on rtfm.mit.edu too.



The SimTel repository, the primary mirror of which is oak.oakland.edu,

contains an immense number of useful material (PD, freeware and shareware).

A tiny selection, all from SimTel/msdos/diskutil:

ideinf10.zip (will determine the properties of your harddisk(s)-- NOT a

benchmark).

3drvs260.zip (gives support for 3 harddisks under DOS).

dqwik211.zip (block mode driver).

no_idle.zip (disables the auto- idle power saving feature of some

harddrives).

1seagate.zip (specs for *all* Seagate harddrives).

wasted14.zip (shows wasted space due to cluster size).

presz111.zip (partition resizer).



A more manageable selection of useful utilities, drivers and information

(this FAQ :^) can be found on



ftp.aimnet.com:/pub/users/clau/ide_ata

ftp.rahul.net:pub/lps/hard-disk



Frank Pikelner (frank@cs.yorku.ca) has compiled a list of >500MB harddisk

and >4x CD-ROM drive specifications. You can access it through

http://www.cs.yorku.ca/People/frank/Welcome.html. If it looks weird, your

browser doesn't support the TABLE tag.



2.25.1 The user's net.resource guide: I/O card drivers



There's an initiative to build a depository of IDE card drivers; you can

find these at ftp.tuug.utu.fi:/pub/drivers/pc/disk/ide_ata



2.25.2 The user's net.resource guide: hardware manufacturers



A number of disk manufacturers now have FTP and web sites; these are



IBM

http://www.ibm.com

http://www.pc.ibm.com (PC Company)



Iomega (they don't make harddrives, but oh well...)

http://www.iomega.com



Maxtor

ftp://ftp.maxtor.com

http://www.maxtor.com (not yet public as of 4/1/1995)



All files from their BBS are on the FTP site, including biosbnch.zip, a

benchmarking utility; greendrv.zip, to set the sleep mode timer on 'green'

drives.



Quantum

http://www.quantum.com



No official FTP site, although drivers to use Quantum's large harddisks

with a non-translating BIOS can be found in



ftp.rahul.net:pub/lps/hard-disk/ide_dos.exe



This is NOT an official Quantum support site and may disappear. This site

contains miscellaneous storage-related programs and information too.



Seagate

ftp://ftp.seagate.com

http://www.seagate.com



This includes specifications of ALL Seagate drives, including detailed

diagrams/pictures.



Western Digital

ftp://ftp.wdc.com

http://www.wdc.com



Many drivers and utilities, some of which won't work if you don't have at

least one WD Caviar drive in your system. Goodies to be found: a good

Windows FastDisk driver in /drivers/hdutil/win31.exe; a Windows helpfile

explaining Enhanced IDE in /docs/eide.exe; a utility to examine the

Enhanced DPT of your BIOS: /drivers/hdutil/chkbios.com.



Pointers to sites offering software from other manufacturers would be

appreciated.



If 'your' manufacturer is doesn't have a net site, you may want to check

the harddrive spec listings to be found on



ftp.ee.ualberta.ca:/pub/drives

http://www.ee.ualberta.ca/ftp.html



Are there any ATA interface manufacturers offering services on the net, or

do they really not care about customer support?



2.25.3 The user's net.resource guide: software & BIOS publishers



AMI

ftp://american.megatrends.com



IBM

http://www.ibm.com

http://www.pc.ibm.com (PC Company)



Microsoft

ftp://ftp.microsoft.com

http://www.microsoft.com



General Windows and DOS updates, fixes and Microsoft Knowledge Base

articles can be found on the Microsoft FTP site (ftp.microsoft.com).

Unfortunately, the structure of this site can hardly be called intuitive

(which, some would argue, is characteristic of Microsoft products in

general).



Novell

http://www.novell.com

http://www.netware.com (Netware info)



OnTrack

e-mail: tech@ontrack.com (tech support) sales@ontrack.com (sales). Phoenix

http://www.ptltd.com SCO

http://www.sco.com



Return to Table of Contents

-Technicalities -



This part of the FAQ is intended to provide additional background

information for the curious. The answers here differ wildly in the depth in

which they treat the material; pick and read at will. It's a FAQ, not a

book.



3.1.1 How does ATA(-2) work?



To understand the basic concepts of advanced ATA drives, one first needs to

understand the basics of drive technology. Basically, when the operating

system needs data to be either read or written to secondary storage (the

hard disk), the BIOS gets the command, and passes that command to the

drive. For operating systems other than DOS, the BIOS is usually replaced

by the operating system's own IO subsystem; the principle remains the same.



How the command is passed, interpreted, and responded to, forms the basis

for Advanced ATA. In a nutshell, there are 7 registers, the Task File, that

the BIOS writes to/reads from to create a command. An eighth register is

used to read and write data. The signals that create these reads and writes

are controlled by the BIOS, but their timing is determined by the interface

hardware, and ATA specifications dictate how fast these signals can be

asserted or deasserted. There are currently 4 modes of Programmed

Input/Output (PIO) and 4 modes of Direct Memory Access (DMA). The numbers

all of you have been reading about are only a small portion of these

specifications, but they are the ones that marketing can tout best. These

"transfer rates" are a result of the specification that controls how fast

the I/O Read and Write cycle time of the data register can operate at.



3.1.2 What are PIO modes?



The PIO mode determines how fast data is transferred to and from the drive.

In the slowest possible mode, PIO mode 0, the data cycle time can not

exceed 600 nanoseconds. In a single cycle, 16 bits are transferred in or

out of the drive. In a single sector, there are 256 words (16 bits = 1

word); 2048 sectors make up a megabyte. So, mathematically,



 1 cycle   1 sector     1 megabyte    2000

 ------- * --------- * ------------ = ----- = 3.3MB/s

  600ns    256 words   2048 sectors   600ns



So, the theoretical transfer rate of PIO Mode 0 (600ns cycle time) is 3.3

megabytes per second.



Here are the rest of the PIO modes, with their respective transfer rates:



 PIO Mode:       Cycle time    transfer rate (ns)    (MB/s)

                       0             600              3.3

   these are the       1             383               .2

   old ATA modes       2             240              8.3

                       3             180             11.1

                       4             120             16.6



When interrogated with an Identify Drive command, a harddisk returns, among

other things, information about the PIO and DMA modes it is capable of

using.



The ATA-2 specific modes (3 and 4) use IORDY hardware flow control. This

means that the drive can use the IORDY line to slow down the interface when

necessary. Interfaces without proper IORDY support may cause data

corruption in the fast PIO modes; with these you're stuck with the slower

modes, with typically half the bandwidth.



When interrogated with an Identify Drive command, a harddisk returns, among

other things, information about the PIO and DMA modes it is capable of

using.



3.1.3 What are DMA modes?



DMA or Direct Memory Access means that the data is transferred directly

between drive and memory without using the CPU as an intermediary, in

contrast to PIO. In true multitasking operating systems like OS/2 or Linux,

DMA leaves the CPU free to do something useful during disk transfers. In a

DOS/Windows environment the CPU will have to wait for the transfer to

finish anyway, so in these cases DMA isn't terribly useful.



There are two distinct types of direct memory access: DMA and busmastering

DMA. Ordinary DMA relies on the DMA controller on the system's mainboard to

perform the complex task of arbitration, grabbing the system bus and

transferring the data. In the case of busmastering DMA, all this is done by

logic on the interface card itself. Of course, this adds considerably to

the complexity and the price of a busmastering interface.



Unfortunately, the DMA controller on ISA systems is ancient and slow, and

out of the question for use with a modern harddisk. VLB cards cannot be

used as DMA targets at all and can only do busmastering DMA. It is only on

EISA- and PCI-based interfaces that non-busmastering DMA is viable: EISA

type 'B' DMA will transfer 4MB/s, PCI type 'F' DMA between 6 and 8MB/s.

Today, proper software support for DMA is still rare, as are interfaces

supporting it.



Anyway, the DMA modes supported are:



  DMA Mode:         Cycle time     transfer rate

 Single Word:         (ns)           (MB/s)

      0               960             2.1    | also in ATA

      1               480             4.2    |

      2               240             8.3

  Multiword:

      0               480             4.2    | also in ATA

      1               150             13.3

      2               120             16.6



Note that some interfaces are able to use these DMA modes as a way to

communicate with the drive, without actually doing direct memory access at

all. In these cases, the DMA modes are just used as glorified PIO modes.

Needless to say, the advertisements and glossy sales stuff don't bother to

point out the difference.



3.1.4 How are the Task File and data I/O ports assigned?



The Task File registers and the data register of the primary ATA channel

occupy the following I/O addresses (in hexadecimal notation):



 Register        Read Function           Write Function



       1F0             Read Data               Write Data

                       (16 Bits)               (16 bits)

       1F1             N/A                     Set Features Data

       1F2             Status of sector        Write sector count

                       count                   for command setup

       1F3             Location of starting    Write sector start

                       sector                  for command setup

       1F4             Location of Cyl-low     Write cyl-low location

                                               for command setup

       1F5             Location of Cyl-high    Write cyl-high location

                                               for command setup

       1F6             Head/device selection   Write device selection

                                               and head selection for

                                               command setup

       1F7             Device Status           Device command



The secondary ATA channel usually occupies ports 170-177. There is no

reason why the number of ports cannot be expanded beyond this; the de facto

standard addresses for the third and fourth ports are 0F0 and 070.

Potential BIOS support for arbitrary extra ports is found only in the

Phoenix specification.



3.1.5 What does an ATA-2 interface do?



Interfaces have come a long way since the ordinary ISA IDE consisting of

little more than a simple buffer. ATA-2 boards have to support at least PIO

modes 0 and 3, usually support more, and will have to ensure that the

correct timing is used at the ATA interface for each of these modes. Since

the timing specifications are quite complicated, a great deal of

flexibility is necessary to implement the ATA-2 standard correctly.



The following figure defines the relationships between the interface

signals for both 8-bit and 16-bit PIO data transfers.



                             |<------------ t0 ------------------------>|

                        __________________________________________       |

 Address Valid *1 _____/                                          \________

                       |<-t1->|<----------- t2 ----------->|<-t9->|      |

                       |      |____________________________|<---t2i----->|_

 DIOR-/DIOW-      ____________/                            \_____________/

                       |      |                            |      |

                       |      |                    ________|__  ->|   |<-t8

 Write Data    *2 --------------------------------<___________>------------

                       |      |                   |<--t3-->|  |       |

                       |      |                          ->|t4|<-     |

                       |      |                     _______|___ ____  |

 Read Data     *2 ---------------------------------<___________X____>------

                     ->|t7|<- |                    |     ->|t6 |<-  | |

                       |  | ->| tA |<-             |<-t5-->|<-t6Z-->|

                       |  |___________________________________________|

 IOCS16-          ________/        |               |                  \____

                                   |             ->|tRd|<-            |

                  _________________|___________________|___________________

 IORDY            XXXXXXXXXXXXXXXXX____________________/

                                   |<-------tB-------->|



*1 Device Address consists of signals CS0-, CS1- and DA2-0

*2 Data consists of DD0-15 (16-bit) or DD0-7 (8-bit)



In this diagram, t0 denotes the read/write cycle time, the most significant

determining parameter for PIO mode throughput. As you can see, there is a

lot more to the various PIO and DMA modes than the read/write cycle time

only. To design a low-cost interface that fully adheres to the ATA-2

specification is quite a challenge. The common approach is to make the

timing completely software programmable; unfortunately, the way ATA cards

are programmed has not been standardized and they are completely

incompatible with each other in this respect. The consequence is that you

will typically need interface-specific drivers for each and every operating

system used in order to profit from the fast transfer modes.



3.1.6 What is Block mode?



Multiple Read/Write commands (reduces Interrupts to host processor).



Besides the obvious transfer increase, Fast-ATA and many other drives allow

for Read/Write Multiple commands, which increase the number of sectors

passed without intervening interrupts. This lessens the host's overhead, as

every interrupt causes the CPU to do a context switch, check the device and

set up the data transfer (or perform the transfer itself in the case of

PIO).



The Read Multiple Command (0xC4) and the Write Multiple Command (0xC5) are

drive-level commands that can transfer multiple sectors of data without

asserting the IRQ line of the drive, signaling the processor that a drive

operation is pending.



The IRQ line is asserted when:



- A read command has been issued, and the requested data is in the drive's

buffer, ready to be taken by the host.



- A write command has been issued, and the data has transferred to the

drive's buffer. If write caching is disabled, the IRQ won't be asserted

until the data has been completely written to the media.



During normal reads and writes, the interrupt can constantly bother the

CPU, and depending on the processor and the task at hand (multi-tasking OS,

Unix, etc), there can be long delays in having the CPU service the drive.

The advent of Read/Write Multiple allows many sectors (from 2 up to as many

as 128) to be transferred in one go, completing the task in as much as 30%

faster times.



On single-tasking operating systems like DOS, any improvement over a few

percent usually indicates bad buffer cache management on the part of the

drive.



A final remark: the block size that is optimal for _drive_ throughput

doesn't have to be the best for _system_ performance! For example, the DOS

FAT filesystem tends to favor a block size equal to the cluster size.



3.1.7 What is LBA?



LBA is a means of linearly addressing sectors addresses, beginning at

sector 1 of head 0, cylinder 0 as LBA 0, and proceeding on to the last

physical sector on the drive, which, for instance, on a standard 540 Meg

drive would be LBA 1,065,456. This is new in ATA-2, but has always been the

one and only addressing mode in SCSI.



LBA reduces CPU overhead because the O/S makes requests in LBA calls, which

the BIOS normally has to convert to CHS (cylinder head sector) addressing

(the common method) before calling the drive. With LBA, this conversion

process is removed. Beware that depending on the way LBA is implemented in

the harddisk firmware, the overhead on the part of the drive may in some

cases increase.



3.2.1 How does ATAPI differ from, and coexist with, ATA(-2)?



For the sake of compatibility with non-ATAPI aware software that might

mistake an ATAPI device for a harddrive, the device pretends it isn't there

until it's waken up by a special sequence of commands. Once activated, it

uses a command protocol that radically differs from that used by harddisks.



The reason is that the 8-bit Task File used by harddisks is not large

enough to support some CD-ROM command structures. Therefore, only a minimum

of traditional ATA commands are supported by ATAPI devices. For most of

their functions, these devices rely on the ATAPI Transport Protocol using

packets of at least 12 bytes sent, as data, through the Data Register.

These packet commands have been derived from the SCSI command set; this

makes it reasonably easy to rewrite existing SCSI CD-ROM and tape drivers

for ATAPI hardware.



Beware that non-ATAPI aware 'intelligent' controllers, for example caching

controllers, will be mightily confused by packet commands. Traditionally,

the data register is only used to transport 512-byte sectors; a 12-byte

command packet looks completely different and should be treated in a

different way by the controller.



3.2.2 What's so special the secondary port?



Nothing, in principle. A secondary IDE port has been reserved in the PC I/O

map for ages (base address 170, IRQ 15), and adapters that could be

configured as secondary have been available for quite some time, even

though BIOS support was lacking. So while it is a part of EIDE, there is

actually nothing new about this feature, except that the possibility of

connecting tape drives and CD-ROMs to the ATA adapter has transformed four

device support from a luxury into a necessity.



Actually, there is another reason to provide a secondary port for ATAPI

devices. There are a number of advanced hardware features for harddisk

interfaces, such as prefetch buffers and write behind, that may get in the

way of ATAPI compatibility. This means that if the software drivers of an

intelligent ATA-2 port are not ATAPI-aware, or simply don't work as they

should, you may run into sticky problems. A secondary port that provides

only basic ATA features is a good way to avoid a lot of headaches.



Finally, an ATAPI device on the primary port will cause Windows FastDisk

drivers that aren't ATAPI aware to fail.



3.3.1 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.



[1] 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. 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.



(CHS) stands for Cylinder, Head, Sector addressing.



[2] 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 are two translation steps, T1 and T2. T2 is the translation performed

by the BIOS. This procedure breaks the 528MB 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 you usually enter in your BIOS setup is the logical geometry, not

the translated one. In case of doubt, consult the BIOS manual.



[3] 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 528MB barrier in essentially the same way as extended CHS

does. Because it is somewhat simpler to use a single linear number to

address a sector on the harddisk compared to a CHS type address, this often

is _slightly_ (read: insignificantly) faster. Depending on the quality the

drive's LBA implementation, it may even turn out to be slower.



A translating BIOS can be implemented via 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 the 540 Meg drive: it has 1057 cylinders, 16

heads. Well, DOS can only handle 1024 cylinders, but it can address up to

255 heads. So, the x-lating BIOS will pass to the O/S, via INT 13 calls,

the geometry 528 (1057/2 (approx)) and 32 heads (16 *2). Then, when the O/S

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.



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



You asked for it :^)



If a drive is less than 528MB, 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 528MB, 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 INT 13H 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 INT 13H AH=08H

function is called. This is 2016000 sectors.



       Cyl/Head/Sector  eCyl/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.



3.3.3 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 is more or less standard across various flavors of

translating BIOSes.



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.



3.3.4 What are the issues surrounding OnTrack's Disk Manager?



This is a cross between a background section and a mini-FAQ on Disk

Manager. If you want to know more or have problems, read this.



Disk Manager 6.x (and above) is a piece of software that performs the

translation necessary to access harddisks of more than 1024 cylinders with

DOS/Windows. This is achieved by installing a Dynamic Drive Overlay (DDO)

to translate drive parameters. At present, it provides only the basic

translation functions, without EDPT or extended INT13 calls. Of course,

this is less of an issue in a software driver than in a system BIOS.



If Disk Manager (DM) is used to format only the slave drive, the DDO can be

installed in the config.sys as an ordinary device driver

(device=dmdrvr.bin). On the other hand, using DM on the master drive isn't

quite that easy from a technical point of view. Since you must boot DOS

from the master drive, and you must load the DDO before you can access the

drive, the only option is to load it very early during the boot process,

before the operating system itself. Changes are made to the Master Boot

Record (MBR) to accomplish this "pre-boot loading".



This scheme works fine, but has a few drawbacks. First, DDO as a pre-boot

loader has implications for floppy boots. If you boot directly from a

floppy, DDO does not have a chance to boot and the partition does not make

sense. This can be remedied by having a line in the config.sys on the

floppy which reads "device=dmdrvr.bin". You can also watch for the "press

spacebar to boot from floppy message" when booting from the hard drive.



The second, and perhaps most important, drawback is that operating system

installations routinely overwrite the MBR with their own boot code. The DDO

is no longer loaded and your partition will be inaccessible until you let

DiskManager write a new MBR. Third, corruption of the DDO sector will

result in a DDO Integrity Error. While it is fairly easy to re-write the

DDO sector (use the DMCFIG.exe utility on your DM diskette), this is is a

sign of a bigger problem (eg. virus) rather than a problem in

itself---contact Ontrack tech support (tech@ontrack.com) for assistance.



An advantage of formatting the master drive with DM instead of loading the

DDO from config.sys is that you can use Windows for Workgroups' 32-bit file

access on both drives---if you use dmdrvr.bin, the slave drive is

restricted to 16-bit file access.



The 6.x versions of Disk Manager have some additional disadvantages that

are to be corrected in version 7. They are not fully compatible with the

device drivers of most VLB ATA(-2) interfaces; also, non-drive (ATAPI)

devices on the chain are not supported. Disk Manager v6.x also only

supports DOS (and Windows 3.x) because of the nonstandard partitioning

scheme used (v7.x will be fully compatible with OS/2 Warp, Windows NT and

Windows 95; Linux has been successfully installed, but has not be through

the full test program, so compatibility is not guaranteed). Actually,

Windows 95 will support 6.x and above Disk Manager 'out of the box', as

will new versions of OS/2 Warp and Windows NT 3.5.1. IBM and MicroSoft have

created fixes that allow older versions of OS/2, Warp and Windows NT to

work with Disk Manager v6.x.



A final concern is disk utilities. If the utility in question hooks INT13

to directly to the hardware (bypassing DOS in the process) it is not going

to "see" DDO and could potentially be destructive. Ontrack's policy on this

is to refer compatibility questions to the manufacturer of the utility as

they cannot possibly maintain compatibility charts for all versions of all

utilities.



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



Too many. See the preceding question 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.



3.4 How does Windows' 32-bit disk access work?



32-bit disk access (32BDA), also known as FastDisk, is a set of

protected-mode drivers that direct INT13 calls to the hard disk controller

through a protected mode interface. For the latter the hard disk controller

has to supply an appropriate virtual device driver (VxD).



Windows ships with one such device built in: *wdctrl. Unfortunately, this

device only supports controllers that are strictly compatible with the

WD1003 standard; this excludes SCSI, ATA-2, CHS translation, disks with

more than 1024 cylinders and even some features of ATA. If it detects one

of these during the initialization phase it will refuse to load. In today's

computers, this means that *wdctrl will rarely do the job and an external

VxD must be used.



32BDA has two advantages over disk access through the BIOS. First, since

the FastDisk VxD is re-entrant, it enables Windows to use virtual memory

for DOS sessions. Using virtual memory without 32BDA could create a

deadlock situation if a page fault is generated during the execution of

BIOS routines. Since the BIOS is not re-entrant, it is not possible to use

a BIOS call to read the page from disk until the first BIOS call has

terminated; on the other hand, this BIOS thread must remain suspended until

the swapped out page has been read.



So 32BDA enables Windows to manage memory much more efficiently with one or

more DOS sessions open.



The second advantage of 32-bit disk access is that it saves two (relatively

slow) switches between virtual and protected mode per disk I/O call. Take,

for instance, a disk read performed by a DOS application. In the absence of

32BDA, each such call causes the following sequence of events:



   *  1 Application calls INT21 to read from disk

   *  2 Windows traps the call, switches to protected mode

   * 3 Windows switches to real mode, returns to DOS

   * 4 DOS makes INT13 call to BIOS disk routines

   * 5 Windows traps the call, switches to protected mode

   * 6 Windows switches to real mode, returns to BIOS

   * 7 BIOS acts upon INT13 call and does the read

   * 8 Windows traps the return from INT13, switches to PM

   *  9 Windows switches to RM, returns the result to DOS

   * 10 DOS receives the result, passes on to application

   * 11 Windows traps the return from DOS, switches to PM

   * 12 Windows switches to RM, returns result to application

   * 13 Application receives the result from the INT21 call



Using 32-bit disk access replaces steps 6 to 8 by a single call to the

FastDisk VxD. This removes two mode switches, resulting in a usually small

disk performance improvement. (Steps 3-11 also apply to native Windows

applications).



3.5.1 The hacker's documentation guide



AT Attachment Interface for Disk Drives, ANSI ASC X3T9.2 working draft,

revision 4a.



AT Attachment Interface with Extensions (ATA-2), ANSI ASC X3T10 working

draft, revision 3, proposed American National Standard 948D.



AT Attachment-3 Interface (ATA-3), ANSI ASC X3T10 working draft, revision

1.



Western Digital Enhanced IDE Implementation Guide, by Western Digital

Corporation, revision 5.0.



Fast ATA Sourcebook, Quantum Corporation, November 1994.



Enhanced Disk Drive Specification, by Phoenix Technologies Ltd., version

1.1, January 95.



3.5.2 The hacker's net.resource guide



Hale Landis (landis@sugs.tware.com) has posted a technical discussion of

various BIOS types and how they support drives with more than 1024

cylinders on csip.hardware.storage. This is available from Daniel Tauritz'

ftp and www sites (see the user's resource guide) and is invaluable to

programmers having to deal with this mess. Lately, he has released a

veritable flood of 'how it works' documents dealing with boot sectors, MBRs

and partition tables---I hope it's being archived somewhere (anyone?).



fission.dt.wdc.com, a Western Digital FTP site, contains loads of material

pertaining to the SFF Committee, the ATA, ATA-2 and ATAPI standards, the

Phoenix Enhanced BIOS spec, and archives of the various reflectors (mailing

lists, such as the ATA-2 and ATAPI lists). Look in /pub/standards. The

mailing lists themselves can be accessed through majordomo@dt.wdc.com; send

a message



To: majordome@dt.wdc.com



help

end



to get more information.



ftp.symbios.com: /pub/standards/io also contains information about ATA,

ATA-2, ATA-3, SCSI-2 and many more standards.



Other pointers are appreciated.



(EOF)



Return to Table of Contents

