Page 1 of 1

IDE programming documents request ...

Posted: Fri Mar 28, 2003 8:01 am
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 ...

Re:IDE programming documents request ...

Posted: Fri Mar 28, 2003 3:21 pm
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 ...

Re:IDE programming documents request ...

Posted: Fri Mar 28, 2003 3:30 pm
by FlashBurn
Maybe you have a look at http://www.t13.org.

Re:IDE programming documents request ...

Posted: Sat Mar 29, 2003 4:14 pm
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.

Re:IDE programming documents request ...

Posted: Sun Mar 30, 2003 2:55 pm
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 ?

Re:IDE programming documents request ...

Posted: Sun Mar 30, 2003 3:11 pm
by Therx
Maybe you just typed it wrong but in the last line the if statement is missing the closing bracket.

Re:IDE programming documents request ...

Posted: Sun Mar 30, 2003 3:23 pm
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.

Re:IDE programming documents request ...

Posted: Mon Mar 31, 2003 3:18 am
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...

Re:IDE programming documents request ...

Posted: Wed Apr 02, 2003 4:00 pm
by srg