ATA PIO Mode: Difference between revisions

Added notes on forum article and conformancy.
[unchecked revision][unchecked revision]
mNo edit summary
(Added notes on forum article and conformancy.)
Line 95:
 
* Words 100 through 103 taken as a QWORD contain the total number of 48 bit addressable sectors on the drive. (Probably also proof that LBA48 is supported.)
 
===Conformant?===
All by all, it seems that a lot of ATA drives handle operations differently, as ~, one of our members, found out (see [http://forum.osdev.org/viewtopic.php?f=1&t=20690&hilit=ATA+Detection the forums]). The floating bus 0xFF value, for example, isn't always the value you would expect it to be. Different hard drives may also report different values for the Cylinder Low and Cylinder High values which you usually check when an error was returned in status byte after attempting to execute the IDENTIFY (0xEC) command.
 
One could also try to ignore whether the ATA IDENTIFY command returns an error or not, and simply immediately contiune to reading the Cylinder Low and High values. As said above, they should be both 0x00 for standard PATA devices. Sadly, it seems that some hardware (and sometimes Bochs) return different values for these registers. Sometimes it may help to try and 'flush' a couple of registers, e.g.:
 
<source lang="c">
// 'base' is e.g. 0x01F0.
outb(base + 2, 0x00);
outb(base + 3, 0x00);
outb(base + 4, 0x00);
outb(base + 5, 0x00);
</source>
 
Do this preferably just before you execute the IDENTIFY (0xEC) command. This will cause some hardware (and apparently, Bochs) to suddenly return proper values when you read the Cylinder Low and Cylinder High values later.
 
==Addressing Modes==
252

edits