Документ взят из кэша поисковой машины. Адрес оригинального документа : http://crydee.sai.msu.ru/ftproot/pub/comp/hardware/IDE/ata2-faq
Дата изменения: Fri May 12 11:37:04 1995
Дата индексирования: Sun Apr 10 17:05:57 2016
Кодировка:
Article 23694 of comp.sys.ibm.pc.hardware.storage:
Xref: netcom.com comp.sys.ibm.pc.hardware.storage:23694
Newsgroups: comp.sys.ibm.pc.hardware.storage
Path: netcom.com!ix.netcom.com!howland.reston.ans.net!EU.net!sun4nl!sci.kun.nl!news
From: pieterh@sci.kun.nl (Maintainer)
Subject: Yet Another ATA-2/Fast-ATA/EIDE FAQ [1 of 1]
Message-ID:
Sender: news@sci.kun.nl (News owner)
Nntp-Posting-Host: wn3.sci.kun.nl
Organization: The Information FAQtory
Date: Tue, 28 Feb 1995 09:49:06 GMT
Lines: 1226

Name: Yet Another ATA-2/Fast-ATA/EIDE FAQ
Version: 1.0
Last modified: Feb 25, 1995
Maintained-by: Peter Herweijer

This FAQ is the work of John Wehman (jwehman@picosof.com)
and Peter Herweijer (pieterh@sci.kun.nl). The most recent
version is available by FTP from
!
! ftp.netcom.com:/pub/cl/clau
! ftp.wi.leidenuniv.nl:/pub/faqs
!
by WWW from Daniel Tauritz' page
!
! http://www.wi.leidenuniv.nl/~dtauritz/ata.html
!
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. To Hale Landis in particular:
without his comments the FAQ would have been considerably
less accurate on a number of key points.



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?


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 interfaces (EIDE, Fast-ATA)?
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. How do I get one?
2.8 I have a 50MHz VLB system. Is it compatible with ATA-2 interfaces?
2.9 I need a PCI ATA-2 interface that uses only one slot.
2.10 How can I get my drive(s) to perform better?
2.11 Why isn't my drive as fast as it's advertised to be?
2.12 Why is my new EIDE interface no faster than my old VLB one?
2.13 A guy on the net has the same drive and he gets 16MB/s!
2.14 I have software to break the 504MB barrier. Should I use it?
2.15 I can enable write caching on my harddisk. Should I?
2.16 Can I safely change the BIOS' xlation mode (None, LBA, Large)?
2.17 Can my drive do 32-bit access?
2.18 Help! Windows 32-bit disk access doesn't work anymore!
2.19 Help! Windows for Workgroups' 32-bit file access fails!
2.20 The user's net.resource guide


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 What is Block mode?
3.1.5 What is LBA?
3.2.1 How does ATAPI differ from, and coexist with, ATA(-2)?
3.2.2 What's the deal with 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 How many types of translating/Enhanced BIOSes are there?
3.4 How does Windows' 32-bit disk access work?
3.5 The hacker's net.resource guide




- Introduction -


1.0 What is EIDE? What is Fast-ATA?

Enhanced IDE (EIDE) is a marketing program from Western
Digital that consists of an Enhanced BIOS specification plus
! an ATA section 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 don't know
! what ATA-2 or ATA-PI is, read on :^)

1.1 What is ATA/IDE?

ATA (AT Attachment) and IDE (Integrated Drive Electronics -
or numerous other interpretations) are 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, presently still in draft, is a compatible extension
! of ATA. 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
! that can be used by software to determine exactly what the
! characteristics of a drive 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 mainly 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 standard
the theoretical size limit is well over 100GB.

1.3 What is ATA-3?

Oh, help, don't ask. It's under development but a moving
target at this stage.

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 is low cost and doesn't need extra,
! usually proprietary, adapters. There is no performance gain
! except a CPU usage that is somewhat lower than usual. 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 at present you cannot boot from an ATAPI
CD-ROM and that 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 uses translation and other
magic to make it possible to use harddisks exceeding the
(in)famous 504MB (528 million bytes) barrier with
! DOS/Windows. The source of this limit is the disk geometry
! (cylinders, heads, sectors) supported by the combination of
! an ATA (IDE) drive and the BIOS' software (INT13) interface.
! Both 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. This is called translation. For example, if your
! drive has 1500 cylinders and 16 heads, a translating BIOS
! will make programs (for example MSD) think that the drive
! has 750 cylinders and 32 heads.

Unfortunately there are several flavors of translating
BIOSes. The standard that will be most discussed in this
! document is the Phoenix Enhanced BIOS specification; Phoenix
! and AMI BIOSes are based on this. Another popular flavor,
! with less functionality, is that of the Western Digital
! Enhanced IDE Implementation Guide. However, the former 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 interface.



- Practicalities -


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 of these 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 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 also supports 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 confusing
purchases.

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

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 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,
! have the added advantage that you often 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.

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

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 zero :^(

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

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

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
of 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 it has no
! more than 1024 cylinders. 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. How do I get one?

The best option is 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). 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.

The last option is to use a software solution. Be sure to
read the section about this below.

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

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.9 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 ATA
! interfaces. Due to way PCI is designed--with Plug'n'Play in
! mind--an ordinary PCI card cannot grab all the addresses and
! interrupts necessary to make a Multi-I/O board compatible
! with standard interfaces. 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.
!
2.10 How can I get my drive(s) to perform better?
!
! 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 drive is the
! limiting factor in performance, and it usually 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.
!
! 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 good 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.
!
! Usually you'll find that the second figure exceeds the first
! by a considerable margin. 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 approaches the interface
! bandwidth 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.11 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 very 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.

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.12 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.13 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.14 I have software to break the 504MB barrier. Should I use it?
!
! In short, don't unless you really have to.

The software, while it is known by all kinds of exotic names
depending on who licensed it, is usually a version of
! 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 and storing a Dynamic Drive
! Overlay (DDO) on the very first disk track. EZ-Drive works
! in a similar way.

A complication is that operating system installations often
overwrite the MBR, rendering the contents of your harddisk
inaccessible. This problem is amplified by the fact that the
partitions created by this software are often completely
incompatible with, and unreadable by, everything else on
this planet.

Generic disk-related device drivers that work with all other
! translation schemes will fail. Important examples are (E)IDE
! interface drivers. You'll need drivers that are specifically
! aware of the software you use. Operating systems other than
! DOS will not be able to access or use the drive. Disk fixing
! utilities may fail to work if the partition table or the
! DDO/XBIOS overlay is damaged.

Apart from all that, it does the job :^)

OnTrack is aware of these problems and is working on a new
version that should allow multiple operating systems and be
! compatible with most interfaces. IBM and Microsoft have
! fixes for OS/2 (ftp.pcco.ibm.com:/pub/os2_apps/ontrac.zip)
! and NT (ftp pointer anyone?).

OnTrack tech support can be reached at tech@ontrack.com.

2.15 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.16 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.17 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.18 Help! Windows 32-bit disk access doesn't work anymore!

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 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.19 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; there is only one drive (the Quantum
LPR540MB, see Microsoft KB Q119742) that is known to be
incompatible with older versions of the driver. 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).

2.20 The user's net.resource guide

There are a couple of related FAQs floating around on the
net. Hale Landis' (landis@sugs.tware.com) ATA*/*IDE FAQ,
posted on comp.sys.ibm.pc.hardware.misc and .storage, has a
terse but thorough technical overview of the subject. Daniel
Tauritz (dtauritz@WI.LeidenUniv.NL) has an EIDE Mini-FAQ
that contains a useful list of available interfaces.

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.

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:

! SimTel/msdos/diskutil/ideinf10.zip (will determine
! the properties of your harddisk(s)--NOT a benchmark).

! SimTel/msdos/diskutil/3drvs260.zip (gives support for
! 3 harddisks under DOS).

! SimTel/msdos/diskutil/dqwik211.zip (block mode driver).
!
! SimTel/msdos/diskutil/no_idle.zip (disables the auto-
! idle power saving feature of some harddrives).
!
! SimTel/msdos/diskutil/1seagate.zip (specs for all
! Seagate harddrives).
!
! A more manageable selection of useful utilities and
! information (this FAQ :^) can be found on
!
! ftp.netcom.com:/pub/cl/clau
!
! Some harddrive spec listings can be found on
!
! bode.ee.ualberta.ca:/pub/drives
!
! There's an initiative to build a depository of IDE card
! drivers; you can find these at
!
! ftp.tuug.utu.fi:/pub/pc/drivers/disk/ide_ata

ftp.wdc.com, the Western Digital FTP site, contains many
drivers and utilities. Many, but not all, won't work if you
don't have at least one WD Caviar drive in your system. The
Windows FastDisk driver is in

! ftp.wdc.com:/drivers/hdutil/win31.exe (Windows fastdisk
! driver).

! ftp.wdc.com:/docs/eide.exe (Win helpfile explaining]
! Enhanced IDE).

! ftp.wdc.com:/drivers/hdutil/chkbios.com (examines the
! Enhanced DPT of your BIOS, if present).

WD offers a web site too: www.wdc.com.

Seagate is also working on a site.

! Quantum does not have an official net support site, but
! drivers to use their large harddisks with a non-translating
! BIOS can be found in

ftp.rahul.net:pub/lps/hard_drive/ide_dos.exe

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

Pointers to sites offering software from other manufacturers
would be appreciated.

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

OnTrack has an e-mail address for tech support questions:
tech@ontrack.com.



- Technicalities -


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 that the BIOS writes to/reads from to create a
command, and write and read data. The signals that create
these reads and writes (remember, we're talking digital
technology - 1's and 0's actually are electrical signals
that, at their asserted or deasserted state, occupy a time
frame) are controlled by the BIOS. 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 5.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.

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 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 have to stop what it's doing and
check the device.

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.

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

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 problem 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,
they rely on the ATAPI Transport Protocol using packets of
at least 12 bytes length sent 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.

3.2.2 What's the deal with the secondary port?

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. 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 the label 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 that the BIOS does. 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.

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

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 number to address a sector on the harddisk compared
to a CHS type address, this is _slightly_ (read:
insignificantly) faster.


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

3.5 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
will probably be incorporated in his ATA*/*IDE FAQ (see the
user's resource guide) and is invaluable to programmers
having to deal with this mess.

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 ATA-2 and ATAPI reflectors (mailing
lists). Look in /pub/standards.

ncrinfo.ncr.com: /pub/standards/io contains information about
both ATA and SCSI standards.

Other pointers are appreciated.

(EOF)