UltraDMA Drivers for DOS
                       ============================

1. General Description
   -------------------

   This is a set of four DOS UltraDMA hard-disk drivers.   All the drivers
   run UltraDMA disk(s) on PC mainboards using a "South Bridge" controller
   chip from Intel, VIA, SiS, ALi and other vendors.   The drivers are NOT
   for "add-on" IDE adapter cards from Promise, SiiG, HighPoint or others,
   as such cards already handle UltraDMA in their own on-board BIOS logic.
   The intent of these drivers is to use the mainboard UltraDMA controller
   and so AVOID needing an "add-on" card!

   The four UltraDMA drivers are as follows:

   A) UDMA2 is the most full-featured driver.   It offers "output overlap"
      which buffers all output and does NOT await output end, so user work
      may "overlap" the DMA!    Depending on user software, output overlap
      can yield a significant speed improvement.   If output errors occur,
      or if a 400-msec timer expires, an error message shall be displayed.
      Output overlap must be enabled with a /O in the CONFIG.SYS line that
      loads UDMA2 (see below for switch options).    UDMA2's resident code
      is 1344 bytes when overlap is enabled or 1024 bytes without overlap.
      Its size is due to a local-stack, timer-interrupt logic, and output-
      error message.   (UDMA2S may be used when a small driver is needed).

      UDMA2 output overlap requires that each IDE channel must NOT have an
      UltraDMA and a non-UltraDMA drive!   Other drivers are unaware UDMA2
      leaves output running, and such drivers may post a "controller busy"
      ERROR when using the same channel as UDMA2.   If either channel MUST
      "share" an UltraDMA disk and an ATAPI or non-UltraDMA drive, overlap
      may NOT be used!   UDMA2 is intended for the majority of "home user"
      systems that normally run their UltraDMA hard-disk(s) on the primary
      IDE channel, with non-UltraDMA or ATAPI drives (ZIP, CD-ROM etc.) on
      the secondary channel.   Such systems can get more speed IMMEDIATELY
      by enabling UDMA2 output overlap.

      The UMBPCI upper-memory driver CAN BE USED, starting with V2.0 UDMA2
      and UDMA2S!!    See the /L description in section 2, Switch Options.

   B) UDMA2S is the PREFERRED "small driver", for systems not using output
      overlap.    It omits overlap and a local-stack and uses the same 640
      byte resident "core" as UDMA or UDMAJR.    For UDMA2S, the load-time
      I-O error messages are also omitted (error return-codes DO display).
      Thus UDMA2S retains all load-time functions of UDMA2 and UDMA (80386
      test, "read tests", etc.) and has an object-file size of 3072 bytes.

   C) UDMA is offered for those who wish to remain "compatible" with older
      versions of that driver.   It uses the same 640 byte resident "core"
      as UDMA2S or UDMAJR.   As in prior versions, UDMA is the only driver
      in the set which displays the UltraDMA controller "name" and PCI bus
      data at load-time, for those desiring to see what chip will be used.
      UDMA also does the full set of load-time tests, same as UDMA2.

   D) UDMAJR is offered for "RAM disk" or "embedded" systems which require
      an ABSOLUTE minimum-size UltraDMA driver.   It has the same 640 byte
      resident "core" and offers identical run-time capabilities as UDMA2S
      or UDMA.    UDMAJR omits an 80386 test, "read tests", and controller
      and disk "names" at load-time (the controller I-O address IS shown),
      thus it has an object-file size of 2048 bytes.

   For most users, the recommended drivers are UDMA2 where the performance
   of output-overlap is desired or UDMA2S when a smaller driver is needed.
   UDMA/UDMAJR are only for "compatibility" or "absolute minimum" systems.

   HOWEVER, note that only UDMA2 declares a local-stack, which it needs to
   deal with timer-interrupts and "monitor" output overlap.    The smaller
   drivers take 96 bytes or more of USER stack space for I-O requests, not
   any concern for properly-written DOS programs.    But, on systems where
   the smaller drivers give unexplained "trouble", or if ANY user programs
   are KNOWN to set a "short" run-time stack (under 256 bytes), UDMA2 MUST
   BE USED!   Its local-stack stays active even if overlap is not enabled.
   Starting in V2.0 UDMA2, a local-stack CAN be enabled in "DMA only" mode
   (described below) by the /S switch.   See the /S description in section
   2, Switch Options.

   All the drivers run up to four disks of any size, including newer types
   over 128 gigabytes.   Also, all drivers can be used in "DMA only" mode,
   for minimum DOS systems that do not load an XMS manager.   Without XMS,
   the drivers have no I-O buffer and "pass back" to the BIOS any I-O that
   does not meet DMA requirements, noted below.   As this is less than 50%
   of normal I-O, the drivers in "DMA only" mode are still useful on small
   systems.   Using "DMA only" mode, the resident size of UDMA2 is reduced
   to 704 bytes, and the other drivers are reduced to 576 bytes.     UDMA2
   usually saves memory and sets no local-stack in "DMA only" mode, unless
   /S enables it; then the resident size of UDMA2 will be 960 bytes.

   The drivers "intercept" I-O calls issued as Int 13h requests (Interrupt
   13) to the BIOS.   Only read or write requests are handled.   All other
   Int 13h requests (seeks, I-O for other type devices, etc.) are "passed"
   back to the BIOS or other drivers for handling.   Each disk must handle
   "logical block addressing" (LBA).    The drivers accept 48-bit LBA mode
   I-O requests for FreeDOS, MS-DOS 7.xx, and other newer DOS systems that
   support LBA mode I-O.   24-bit CHS mode I-O requests are also accepted,
   for MS-DOS 6.xx, PC-DOS 7 or earlier.    As CHS requests are limited to
   24-bit addresses, all data accessed using CHS mode must be in the first
   8 gigabytes of a disk.   Other partitions may contain more data and may
   be accessed using operating systems which support LBA mode requests.

   If the buffer for an I-O request is not DWORD-aligned, fails a VDS lock
   or crosses a 64K physical memory boundary, the request shall go through
   a 64K buffer in XMS memory, using Ultra DMA I-O to and from the buffer.
   Minimum DOS systems running the drivers in "DMA only" mode shall "pass"
   these requests back to the BIOS for execution.   Not crossing a 64K DMA
   boundary is required by the Bus Master IDE specification, and alignment
   to a DWORD (4-byte) boundary is required by some Intel "South Bridges".
   I-O requests for more than 64K of data (over 128 sectors) shall also be
   "passed" to the BIOS.   DOS systems should never issue such requests.


2. Switch Options
   --------------

   UDMA or UDMAJR use no switch options.   UDMA2 or UDMA2S switch options,
   specified in the CONFIG.SYS line that loads the driver, are as follows:

      /O    For UDMA2 only, enables output overlap.   This REQUIRES an XMS
              manager (HIMEM.SYS or similar) and 128K of XMS memory.  When
              /B is also specified, or if XMS is unavailable, overlap will
              NOT be enabled, as UDMA2 must then use "DMA only" mode.

      /L    Limits DMA to "low memory" below 640K.   /L is REQUIRED to use
              the UMBPCI upper-memory driver, or any similar drivers whose
              upper-memory areas do not support DMA.   If /L is specified,
              UDMA2 or UDMA2S must be loaded in LOW memory (so DMA command
              lists are "fetched" properly), or else the driver will ABORT
              loading!   /L causes requests for I-O beyond 640K to go thru
              the driver's XMS buffer.   If /B is specified with /L, or if
              XMS memory is unavailable, such requests will be "passed" to
              the BIOS for execution.

      /B    Causes XMS memory to be IGNORED, for "backward compatibility".
              /B forces UDMA2 or UDMA2S to use "DMA only" mode.   Thus, /B
              cancels /O (UDMA2 output overlap is not enabled), causes the
              initialization "read tests" to be omitted, and affects /L as
              noted above.

      /Mn   Specifies the MAXIMUM UltraDMA "mode" to be used by all disks,
              where  n  is a number between 0 and 7, as follows:
                  0 = ATA-16, 16 MB/sec.     4 = ATA-66,   66 MB/sec.
                  1 = ATA-25, 25 MB/sec.     5 = ATA-100, 100 MB/sec.
                  2 = ATA-33, 33 MB/sec.     6 = ATA-133, 133 MB/sec.
                  3 = ATA-44, 44 MB/sec.     7 = ATA-166, 166 MB/sec.
              Disks designed to a "mode" LESS than the given value will be
              limited to their own highest "mode".    At present, "mode 7"
              ATA-166 is not yet implemented, but any driver CAN handle it
              if UltraDMA disks ever use it.

      /S    For UDMA2 only, enables its local-stack if in "DMA only" mode.
              If "DMA only" mode is not used, /S is ignored.   This switch
              is needed ONLY on systems that may have one or more programs
              which set a "short" run-time stack, as noted above!   /S and
              /B are independent and can be used together.

      /X    Disables initialization "read tests".   This switch is a LAST-
              chance "scheme" for making UDMA2 or UDMA2S load on "problem"
              systems!   Any errors detected by the "read tests" should be
              CORRECTED, wherever possible!

   Most users will need only /O to enable UDMA2 output overlap or /L where
   the UMBPCI driver (or similar) is also used.   The other switch options
   are intended for "problem" systems or for "diagnostic" work.    For all
   switches, a dash may replace the slash, and "lower-case" letters may be
   used if desired.    If NO switches are specified, both UDMA2 and UDMA2S
   will run EXACTLY like the older versions of UDMA.


3. Setup and Configuration
   -----------------------

   All drivers are loaded by the CONFIG.SYS file, after any memory-manager
   such as EMM386.EXE or UMBPCI.SYS, but BEFORE loading any "disk caching"
   program such as NCACHE2 or LBACACHE.    Your CONFIG.SYS file should use
   a command-line similar to the following:

               DEVICE[HIGH]=[path]UDMA2.SYS [/O] [/L] [...]

                           =[path]UDMA2S.SYS [/L] [...]

                           =[path]UDMA.SYS

                           =[path]UDMAJR.SYS

   For example: DEVICE=C:\DOS\UDMA2.SYS, DEVICEHIGH=C:\BIN\UDMA2S.SYS etc.
   Note that UDMA and UDMAJR have no command-line switches, while UDMA2 or
   UDMA2S use the switches described above.     All four drivers determine
   which hard-disks to use automatically, and all will run equally well in
   normal or upper-memory.

   Please be sure to set up the hard disk geometry in your BIOS correctly.
   Set it to "Auto", "LBA" or "LBA Assisted", but NOT to "None", "Normal",
   "CHS" or "ECHS". "User Cylinders/Heads/Sectors", "Revised ECHS" or "Bit
   Shift" should work but are NOT preferred.    If BIOS has a setting like
   "UDMA Capable" for a disk, enable it.   Power-saving features such as a
   "drive spin-down timeout" should be DISABLED or driver I-O requests may
   time out!   Also, be sure to use an 80-connector cable for any UltraDMA
   disk operating in "mode 3" ATA-44 (44 MB/sec) or higher.   When cabling
   a single disk to an IDE channel,  note that you MUST use both "ends" of
   the cable, NOT one "end" and the middle connector!   This avoids ERRORS
   as an unused cable-end CAN pick up "noise", like a RADIO antenna!


4. Error Reporting
   ---------------

   All four drivers include a full set of error return-codes,  to indicate
   the exact cause of any error.     UDMA2 and UDMA will display load-time
   diagnostic messages for each of these return codes, if any error occurs
   during the "comparison reads" between the driver and BIOS or during the
   "read speed" test of each UltraDMA disk.   These tests are done only at
   load-time and only if XMS memory is available for an input buffer.   If
   XMS is unavailable, UDMAJR is used, or /B or /X is specified with UDMA2
   or UDMA2S, "read compare" and "read speed" tests will not be performed.
   Users who might be having trouble can forego UDMAJR and instead run any
   of the other drivers as a "diagnostic aid".   The return codes from all
   drivers (available after any I-O request) and the messages for UDMA2 or
   UDMA load-time errors are as follows:

          Code 08h - DMA timed out
               0Fh - DMA error
               20h - Controller busy before I-O
               21h - Controller busy after I-O
               80h - First DRQ timed out
               AAh - Disk not ready before I-O
               ABh - Disk not ready after I-O
               CCh - Write FAULT before I-O
               CDh - Write FAULT after I-O
               E0h - Hard error at I-O end
               FEh - BIOS/driver read MISMATCH (init only)
               FFh - XMS memory error

   If UDMA2 output overlap is enabled, a run-time output error shall cause
   the following message to be displayed:

        UDMA2:  Output ERROR eeh Disk=d LBA=aaaaaaaaaaaah!

   where eeh is one of the return codes listed above, d is the disk number
   (0 for primary-master, 1 if primary-slave, 2 if secondary-master, and 3
   if secondary-slave), and aaaaaaaaaaaah shows the beginning disk address
   expressed as a 12-digit "logical block address" (LBA).    Because UDMA2
   is a physical-level driver called by Int 13h (not a DOS "file driver"),
   the DOS "file" or "directory" for an output error cannot be shown.


5. Hardware and BIOS Issues
   ------------------------

   The UltraDMA "mode", from "mode 0" ATA-16 thru "Mode 6" ATA-133, is set
   to the highest "common" mode handled by a disk and the controller chip.
   The BIOS should preset this value, even if the BIOS itself will not use
   UltraDMA in its own I-O.   Note that for UDMA2 or UDMA2S, the /M switch
   can be used to set a LOWER UltraDMA "mode" for all disks, if necessary.

   All of the drivers are intended for systems which use "legacy" UltraDMA
   controller mode.   They do NOT recognize Serial-ATA controllers nor any
   hard-disk controller set for "native PCI" mode, only "legacy IDE" mode!
   Also, the mainboard is expected to have a normal BIOS program, one that
   supports "EDD" BIOS calls and returns "DPTE" data for "legacy" UltraDMA
   disks, as described in the Phoenix EDD BIOS spec V1.1, 9-May-1995.   It
   is through such BIOS logic that the drivers find which disks to use and
   what their physical parameters are.

   However, there are some "old" motherboards (pre-1998) that run UltraDMA
   but have no "EDD" BIOS.    Also, there are new systems (Compaq and H/P)
   that offer both Serial-ATA and "legacy" IDE controllers, but their BIOS
   in fact does NOT give proper "DPTE" data for "legacy" disks.   For such
   systems, UDMA/UDMAJR starting at V6.8 and any UDMA2/UDMA2S version will
   do a "hardware only" scan for UltraDMA disks, if NO disks are found via
   normal BIOS logic.   The drivers will re-scan the system WITHOUT making
   "EDD" BIOS calls, and they will expect to find:

      BIOS unit 80h = Primary Master disk,   UltraDMA disk #1.
           unit 81h = Primary Slave disk,    UltraDMA disk #2, if present.
           unit 82h = Secondary Master disk, UltraDMA disk #3, if present.
           unit 83h = Secondary Slave disk,  UltraDMA disk #4, if present.

   The "hardware only" scan REQUIRES that UltraDMA disk #1 be the primary-
   master, a second UltraDMA disk to be the primary-slave, etc.   If ATAPI
   devices (ZIP, CD-ROM) are also present, they must use an IDE cable slot
   AFTER all UltraDMA disks, e.g. the secondary channel.   Also, if a SCSI
   controller is present, its on-board BIOS (if any) must be set DISABLED!
   This is so the motherboard main BIOS will not "install" any SCSI drives
   ahead of the UltraDMA hard disks.   This also requires that an UltraDMA
   disk (not a SCSI or CDROM) must be the system "boot" disk.   On systems
   needing a "hardware only" scans, SCSI disks may still be accessed using
   a DOS SCSI driver that is appropriate for the controller and its disks.

   NOTE that such "rules" of attaching the UltraDMA disks first on the IDE
   controller apply ONLY for systems with a missing or invalid "EDD" BIOS.
   If a valid "EDD" BIOS is present as on most good "modern" systems, user
   IDE and SCSI disk drives may be configured in ANY desired order.


6. SPECIAL NOTES
   -------------

   It has been seen that certain CD-ROM "boot" programs declare the CD-ROM
   as a false "hard disk", and the "boot" provides incorrect EDD BIOS data
   for that "disk".    Beginning in V1.7 UDMA2 or UDMA2S, and in V7.2 UDMA
   or UDMAJR, the drivers no-longer "abort" loading for an EDD BIOS error.
   They now display "EDD error!  BIOS unit ignored", then continue to scan
   for other useable UltraDMA disks.    Users who are NOT "booting" from a
   CD-ROM should diagnose which hard disk was passed-over and why.   Users
   who ARE "booting" from a CD-ROM, whose UltraDMA disks were all detected
   properly, may ignore this message.   It indicates a design ERROR in the
   CD-ROM "boot" program, NOT a problem with the UltraDMA driver or disks!

   It has also been seen that a few BIOS programs will NOT "configure" the
   mainboard UltraDMA controller if no IDE devices are found!    Normally,
   if no UltraDMA disks are present, the drivers display "No disks to use;
   driver NOT loaded!" and abort.    However, since the drivers search for
   controllers first, an "unconfigured" controller could cause the drivers
   to display "Bus-Master setup BAD; driver NOT loaded!", then abort.   If
   the latter message is shown, users should first check that all UltraDMA
   hard-disks have been made "active" through the BIOS setup logic, before
   assuming an actual Bus-Master problem exists!