Configuring XTIDE or Direct ATA drive access - ghaerr/elks GitHub Wiki

Page contributors: @toncho11 (original version lost due to github renaming), @ghaerr

The ATA CF (/dev/cfa) driver is used to access XT-IDE ISA cards with removable compact flash, but can also optionally be used as a direct ATA driver for hard drives. If an XTIDE BIOS is present, this can also be used with the ELKS BIOSHD driver, but the ATA CF driver is preferred since it can use the newer Logical Block Addressing (LBA) found in compact flash cards, rather than having to configure the BIOS for a particular CHS setting. The ATA CF driver can be used without an XTIDE BIOS to access CF cards, although booting won't be possible since that still requires an XTIDE BIOS in ROM.

The ATA CF driver supports four slightly different XTIDE card types (four access modes), known as XTIDE v1, XTIDE v2, XTCF, and standard ATA. When using an emulator or real hardware, you may have to know either the card type or which version of XTIDE is emulated. By default, ELKS tries to automatically determine the card type based on CPU type. Your specific XTIDE card type can be set in /bootopts using the xtide=n option, using the table below.

Observe the cf: kernel boot messages for details. Boot from floppy and ensure the ATA CF driver is working correctly by reconfiguring in /bootopts the xtide= variable between boots until a mount /dev/cfa1 is successful. After that works, add root=cfa1 in /bootopts and ELKS should boot using the cfa driver.

If xtide= is not set in /bootopts, the cfa driver will default to XTCF mode 3 if the system is 8086/8088 based, otherwise standard ATA mode 0. You still need to set the root=/dev/cfa1.

/* hardware controller access modes, override using xtide= in /bootopts */
xtide=0    standard ATA (default for PC/AT (80286+) systems), ATA at ports 0x1F0-1FE, 8-bit I/O
xtide=1    XTIDE rev 1 (before 2012), ATA at ports 0x300-0x30E, 8-bit I/O
xtide=2    XTIDE rev 2 (now standard for XTIDE), XTIDE v1 with registers a0/a3 swapped, 16-bit I/O
xtide=3    XTCF (automatically set for 8088/8086 systems)

Modes are set in /bootopts with edit. xtide=0 is for any standard ATA IDE hard drive - usually a physical IDE disk on a 286/386 with built-in IDE controller. xtide=3 is for the version of XT IDE with built-in compact flash card reader. Numbers 0 and 3 are currently the only ones tested. xtide=1 is very old but used for 86Box and PCem. Use xtide=2 if your card is an XTIDE without built-in CF card reader.

disable=hda

This will disable /dev/hda the BIOS hda driver. Good if you decide to use only /dev/cfa* the cfa driver.

disable=cfa

This will disable the cfa driver. Good if you want to skip the 1-2 seconds of ATA probing during boot when using the hda driver, or just want to eliminate three lines from the kernel startup screen when not using ATA CF.

root=cfa1

This will boot using the ATA CF driver from /dev/cfa1, instead of floppy or the BIOS hard drive. To boot from direct floppy, use root=df0 in /bootopts.

Examples

Test an XTIDE v1 card on real hardware, or when using PCem or 86Box:

xtide=1

This will force the ATA CF driver to use XTIDE v1 at ports 0x300-0x30E, 8-bit I/O. After booting from floppy, a mount /dev/cfa1 /mnt can be used to check that the CF card can be accessed before adding root=cfa1 to boot from CF when all is working.

Boot from an XTCF card on an 8086/8088 machine:

xtide=3
root=cfa1
disable=hda

The https://copy.sh/v86 emulator provides a standard ATA hard drive, so a configuration to test booting from ATA CF while not using the BIOSHD driver would be:

xtide=0
root=cfa1
disable=hda

Note: it isn't recommended to use the ATA CF driver for real hardware drives, as the ATA CF driver doesn't perform retries (the controller may internally retry though), while the BIOSHD driver will retry 5 times. This can matter on very old real hardware hard drives.