IDE programming documents request ...

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

IDE programming documents request ...

Post by Pype.Clicker »

i need more info about IDE programming, especially the content of the ATA_IDENTIFY returned pseudo-sector.

I've been through http://www.nondot.org/sabre/os/files/Disk/IDE-tech.html, but it doesn't seem to explain everything.
For instance, where is explained that byte order from "model" string must be reversed ? and how can one make sure the HDD will support LBA ?

If some of you has extended knowledge to share ...
distantvoices
Member
Member
Posts: 1600
Joined: Wed Oct 18, 2006 11:59 am
Location: Vienna/Austria
Contact:

Re:IDE programming documents request ...

Post by distantvoices »

merde, que j'ai oublie l'adresse excacte d'une website sur ATA ...

alors ...

A quick google search didn't throw it out anyway, so I'll search tomorrow. but I know there is a kind of ATA ressource center lingering around in internet. They offer drivers and source code and ressources ... Crap that I didn't bookmark it ... shame on me and glowing coals amongst my hair ...
... the osdever formerly known as beyond infinity ...
BlueillusionOS iso image
FlashBurn

Re:IDE programming documents request ...

Post by FlashBurn »

Maybe you have a look at http://www.t13.org.
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:IDE programming documents request ...

Post by Pype.Clicker »

hmmm ... seems to be a promizing link.
I'd like to apologize for my laziness ... my modem seems to have nervous breakdown these last days and googling is especially boring under these conditions ... :) thanks alot.
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:IDE programming documents request ...

Post by Pype.Clicker »

eeek!?
I've got a strange behaviour while trying to detect IDE controllers. The code i use looks like

Code: Select all

   byte r=inb(ATA_CYLINDER_LOW);
   outb(ATA_CYLINDER_LOW,~r);
   if (r==inb(ATA_CYLINDER_LOW) error("controller not found");
It has been borrowed to Tim's ata.c driver and expects that if a controller is present, then we should be able to read back a value we stored in registers like CYLINDER_LOW (that is supposed to be a place where we store info for a read/write request on the disk before the command is issued) but that the port will be read as a constant if there is no controller.

That code worked fine on bochs-1.4.x, but it fails on bochs 2.0.2 (it reads '0' both before and after the 'outb' command ?)

Do anybody experienced such a weird behaviour ?
Is the controller test really useful or is it enough to send an ATA_IDENTIFY command and see if a result is returned ?
Therx

Re:IDE programming documents request ...

Post by Therx »

Maybe you just typed it wrong but in the last line the if statement is missing the closing bracket.
Tim

Re:IDE programming documents request ...

Post by Tim »

That method of detection in my code is broken, at least on Bochs. I rely on sending IDENTIFY and waiting for a timeout, although that's obviously very slow. I haven't got round to finding a better solution yet, so maybe it's time one of us did.
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:IDE programming documents request ...

Post by Pype.Clicker »

hmm ... some code extract from BOCHS 2.0.2

Code: Select all

    case 0x04: // cylinder low 0x1f4
      value8 = (!BX_SELECTED_IS_PRESENT(channel)) ? 0 : (BX_SELECTED_CONTROLLER(
channel).cylinder_no & 0x00ff);
      goto return_value8;
Which seems to show that i should have selected the proper drive before starting to talk with the controller ...
BUT if i do select master drive and that it is not present (for instance, what if the IDE bus only has a slave CDROM, but no master ?) how will real hardware react ??
Are the CYLINDER_LOW, etc. registers buffered at the chipset, or do they directly alter the state of the disk's electronic ?

Maybe a valid test would be :

Code: Select all

   atactrl::reset();
   atactrl::select_drive(0);
   if (atactrl::test()) goto found;
   atactrl::select_drive(1);
   if (atactrl::test()) goto found;
   error("controller not found");
   return false;
found:
   // start identifying drives
where "atactrl::test()" performs the CYLINDER_LOW test and "atactrl::select_drive()" issues a outb to set/reset the drive select bit...
Post Reply