Skip to content

[kernel] Add proper XTIDE 8-bit I/O handling to ATA CF driver#2359

Merged
ghaerr merged 2 commits intomasterfrom
xtide
Jul 18, 2025
Merged

[kernel] Add proper XTIDE 8-bit I/O handling to ATA CF driver#2359
ghaerr merged 2 commits intomasterfrom
xtide

Conversation

@ghaerr
Copy link
Copy Markdown
Owner

@ghaerr ghaerr commented Jul 18, 2025

Adds corrected handling for 8-bit XTIDE I/O to ATA CF driver, learned from 86Box/86Box#5797 (comment) and the XTIDE BIOS source.

Both XTCF and XTIDE require 8-bit I/O, but XTIDE doesn't use a Set 8-bit Feature controller command like XTCF but instead uses the data port+8 to read/write the high byte of word transfers from a controller hardware latch.

For now, the XTIDE uses the same linear register file as ATA, instead of the XTCF register file with offsets SHL 1. We will see whether any other changes are required when tested on real hardware.

For now, XTCF mode is automatically set when running on 8088 or 80186 CPUs. To set XTIDE operation, the ATA CF driver needs to be recompiled with the following line changed in ata.c:

static int mode = MODE_XTIDE;         /* change this to force a particular controller */

A /bootopts option may be added at a later point to select XTIDE dynamically at boot, along with possible settings for the base I/O address.

Also adds @fhendrikx's higher speed I/O from PR #2353.

@ghaerr ghaerr merged commit 866a2d8 into master Jul 18, 2025
1 check passed
@ghaerr ghaerr deleted the xtide branch July 18, 2025 19:52
@toncho11
Copy link
Copy Markdown
Contributor

toncho11 commented Jul 18, 2025

So what will my XTIDE + IDE to SD card adapter? The IDE to SD should be a standard IDE device on the XTIDE card.

It should be the above: static int mode = MODE_XTIDE; ?

@ghaerr
Copy link
Copy Markdown
Owner Author

ghaerr commented Jul 18, 2025

So what will my XTIDE + IDE to SD card adapter? The IDE to SD should be a standard IDE device on the XTIDE card.

It should be the above: static int mode = MODE_XTIDE; ?

Yes. I'd like to write some auto-probing software but haven't figured out how to do that yet.

What's the brand of your XTIDE card?

@toncho11
Copy link
Copy Markdown
Contributor

toncho11 commented Jul 18, 2025

The one with the SD IDE adapter that I want to try is: Monotech XT‑IDE Deluxe / Rev 5.2.
There is a jumper called "IDE address" and it is clearly set to default 0x300.

@ghaerr
Copy link
Copy Markdown
Owner Author

ghaerr commented Jul 18, 2025

Let me see if I can learn about that card a bit to make sure it'll likely work, so you don't waste time trying it.

@ghaerr
Copy link
Copy Markdown
Owner Author

ghaerr commented Jul 18, 2025

The one with the SD IDE adapter that I want to try is: Monotech XT‑IDE Deluxe / Rev 5.2.

Alright, I think I've finally got enough information on XTIDE to get a driver working for that card. Long story short, XTIDE changed the register layout from v1 to v2. In particular high speed mode was added, which changed the register file port layout to allow high speed "16-bit" I/O using the capability of writing a word to two consecutive port address which almost all 8088 system busses support (we use the same "trick" in our fast VGA routines):
XT-IDE - Register map

Right now, the ATA CF driver implements XTIDE v1. It looks like your MonoTech card is XTIDE v2, so I'm going to have to add yet another operating mode to our ATA CF driver. Some cards have a jumper option for high-speed mode or not, effectively implementing a v1 compatible mode.

I'll post an updated driver shortly.

@toncho11
Copy link
Copy Markdown
Contributor

I have a jumper for high-speed mode indeed.

@toncho11
Copy link
Copy Markdown
Contributor

The high speed mode should be an option. The card is not marked well, but I think the jumper is to off currently.
I vaguely remember that it did not work on some machines.

@toncho11
Copy link
Copy Markdown
Contributor

So now I should use xtide=2 for my XT-IDE + SD card?

xtide=0    standard ATA (default for PC/AT (80286+) systems)
xtide=1    XTIDE rev 1 (pre 2012)
xtide=2    XTIDE rev 2 (now standard for XTIDE)
xtide=3    XTCF (automatically set for 8088/8086 systems

@ghaerr
Copy link
Copy Markdown
Owner Author

ghaerr commented Jul 19, 2025

So now I should use xtide=2 for my XT-IDE + SD card?

I have a jumper for high-speed mode indeed.

The high speed mode should be an option.

The difference between XTIDE rev 1 and rev 2 is the high speed option, as documented above. The high speed option swaps address lines A3 and A0 on the card, which allows a using single 16-bit IN/OUT instruction for I/O, increasing speed. This option requires a change in the driver, so you should set xtide=1 for rev 1 or xtide=2 for rev 2, depending on which way your jumper is set.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants