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

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

   This is a "package" of UltraDMA hard-disk drivers for DOS.   All of the
   drivers run UltraDMA disk(s) on PC motherboards having a "South Bridge"
   controller chip made by Intel, VIA, SiS, ALi and other vendors.   These
   drivers are NOT for use by "add-on" IDE adapters made by Promise, SiiG,
   HighPoint, or others, as such adapter cards already support UltraDMA in
   their own on-board BIOS logic.   The purpose of these drivers is to use
   the motherboard UltraDMA controller and AVOID needing an "add-on" card!

   There are four drivers in this package, as follows:

   A) UDMA2 is the most full-featured driver.   It offers "output overlap"
      which buffers all output and does NOT wait for output end, thus user
      work may "overlap" the DMA!   Depending on the user software, output
      overlap can improve system throughput by 25% or more!   If an output
      error occurs or a 400-msec timeout expires, an error message will be
      displayed.   Output overlap is normally DISABLED and must be enabled
      with a /O in the CONFIG.SYS line that loads UDMA2 (see below for all
      switch options).   UDMA2's resident code is 1344 bytes if overlap is
      enabled or 1024 bytes without overlap.   UDMA2's larger size is from
      its local-stack, timer-interrupt handler, and error-message routine.
      Also, some overlap logic MUST be within the "basic" driver!    Those
      who wish a smaller driver may use one of the others in this package.

      ---NOTE---   UDMA2 output overlap requires that each IDE channel may
      NOT run an UltraDMA and a non-UltraDMA drive!   To remain within the
      DOS design, output overlap uses NO "new" or "odd" logic!   So, other
      drivers are unaware UDMA2 may leave output running, and such drivers
      on the same channel as UDMA2 may give "controller-busy" ERRORS!   If
      either IDE channel MUST "share" an UltraDMA disk and an ATAPI or non
      UltraDMA drive, output overlap CANNOT be used!   Most "home user" PC
      systems have their UltraDMA hard-disk(s) on the primary IDE channel,
      with non-UltraDMA or ATAPI units (ZIP, CD-ROM etc.) on the secondary
      channel.    It is for these systems that UDMA2 is designed, and such
      systems can get an IMMEDIATE speed boost by enabling output overlap!

   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" also used by UDMA and UDMAJR (described below).
      For UDMA2S, the load-time "PCI bus" and text error-messages are also
      omitted (controller Vendor/Device I.D.s and error return-codes still
      ARE shown).    By omitting only extra display text, UDMA2S keeps all
      load-time functions of UDMA2 and UDMA, including "read tests" and an
      80386 test; yet it achieves an object-file size of below 2940 bytes.
      This permits a compression program (UPX or similar) to "pack" UDMA2S
      into a load file of 2.5K or less, ideal for most small systems.

   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, which offers added "protection" from poor external logic!
      As in all previous releases, UDMA is the only driver in the set that
      displays the UltraDMA controller "name" at load-time, for those that
      desire to "see" what chip shall be used.   UDMA also offers the full
      set of load-time tests and message displays, same as in 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 "read tests", an 80386 test, and controller/
      disk "names" at load-time (the controller I-O address IS displayed!)
      and thereby achieves 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 each I-O request,
   which is not any trouble for most properly-written DOS programs.   But,
   on systems where the smaller drivers give unexplained "problems", or if
   ANY user application 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 was not enabled.

   All four drivers support one to four disks of any size, including newer
   models over 128 gigabytes.   Also, all drivers can be run in "DMA only"
   mode, for minimum DOS systems that do not load an XMS driver.   Without
   XMS, the drivers have no I-O buffer and "pass back" to the BIOS any I-O
   request which does not meet DMA requirements (see below).    Since such
   I-O is rare, the drivers in "DMA only" mode are still useful with small
   systems.   Using "DMA only" mode, the resident size of UDMA2 is reduced
   to 688 bytes, and the other drivers are reduced to 576 bytes.    [UDMA2
   does not use a local-stack in "DMA only" mode, to save memory and since
   stack usage is lower without an XMS manager!].

   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 another driver for handling.   Each disk must allow
   "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.   CHS mode requires that all data
   used must be within the first 8 gigabytes of a disk.   Other partitions
   must contain any more data and must be accessed using operating systems
   that support LBA mode requests.   [CHS requests permit 24-bit addresses
   only, thus the 8-gigabyte limit].

   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
              XMS is unavailable, or if /B is also specified, overlap will
              NOT be used, as UDMA2 must then run in "DMA only" mode.

      /B    Causes XMS memory to be IGNORED, for "backward compatibility".
              This switch overrides /O (thus DISABLING output overlap) and
              forces UDMA2 or UDMA2S to run in "DMA only" mode.

      /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".  This switch IS NOT for
              normal use and is meant for "problem" systems only!   At the
              time of V1.5 UDMA2, "mode 7" ATA-166 is not yet implemented,
              but any driver CAN handle it, if UltraDMA disks ever USE it!

      /X    Disables initialization "read tests".   This switch IS NOT for
              normal use and is a LAST-chance "scheme" for making UDMA2 or
              UDMA2S load on "problem" systems only!   Any errors detected
              by the "read tests" SHOULD BE CORRECTED, wherever possible!

   For any switch, a dash may replace the slash, and a "lower-case" letter
   (o, b, m, x) may also be used.    Note that "DMA only" and all switches
   but /O are available in UDMA2 only with V1.5 or later.    Also, when NO
   switches are specified, both UDMA2 and UDMA2S will run EXACTLY like the
   older versions of UDMA!


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

   Load the driver through your "CONFIG.SYS" file after any memory-manager
   (EMM386.EXE, etc.) but PRIOR to any disk-cache program (NCACHE2, etc.).
   You should use a command-line similar to the following:

               DEVICE[HIGH]=[path]UDMA2.SYS [/O] [/B] [/Mn] [/X]

                           =[path]UDMA2S.SYS [/B] [/Mn] [/X]

                           =[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, to avoid the other
   "end" of the cable acting like a RADIO antenna and giving errors due to
   random electrical NOISE!


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 where XMS memory is available (the tests require XMS
   memory).   If XMS is not available, UDMAJR is used, or /B or /X is used
   for UDMA2/UDMA2S, the "read speed" and "read compare" tests will not be
   done.    Users who may be having problems can forego UDMAJR and instead
   run any of the other drivers as a "diagnostic aid".    The return codes
   from all 4 drivers (available after any I-O) 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 displayed!


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 are NOT designed for Serial-ATA controllers and
   will NOT recognize hard-disk controllers set to "native PCI" mode, only
   "legacy IDE" mode!   Also, the mainboard is expected to have a "normal"
   BIOS program, one supporting "EDD" BIOS calls and providing "DPTE" data
   for "legacy" UltraDMA disks, as described in the Phoenix EDD BIOS specs
   V1.1 (9-May-1995).   It is with such BIOS logic that the drivers detect
   which disks to use and what their physical parameters are.

   However, there ARE some "old" motherboards (pre-1998) that run UltraDMA
   disks but have NO "EDD" BIOS.   There are also some NEW systems (Compaq
   and H/P) which offer both a Serial-ATA and parallel IDE controller, but
   their BIOS in fact DOES NOT give proper "DPTE" data for "legacy" disks!
   For such "old" and improper-new systems, UDMA/UDMAJR starting with V6.8
   or any UDMA2/UDMA2S version will do a "hardware only" scan for UltraDMA
   disks, if the drivers find NO disks to use through standard BIOS logic.
   The drivers shall re-scan the system, WITHOUT using 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 these limits of attaching the UltraDMA disks first on the IDE
   controller are required ONLY to deal with a missing/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.


   SPECIAL NOTE
   ------------

   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!