Page 1 of 1

0xFF from ATA Data port

Posted: Tue Nov 17, 2009 2:56 am
by rezoimnadze
Greetings!

I have a problem reading ATA drive in PIO mode.
After IDENTIFY command, i get correct status (ready to read, not busy, no error), but every byte from 0x1f0 is 0xFF.

This is a minimal code, i wrote for you:

OutPortByte(0x1f6,0xa0); // Drive select
OutPortByte(0x1f7,0xEC); // Identify
InPortByte(0x1f7); // Delay
InPortByte(0x1f7);
InPortByte(0x1f7);
InPortByte(0x1f7);
DirectPrintDecimal(InPortByte(0x1f7)); // prints 90 -- 0b1011010
DirectNewLine();
DirectPrintDecimal(InPortByte(0x1f0)); // prints 255 -- 0xFF
DirectNewLine();
DirectPrintDecimal(InPortByte(0x1f0)); // prints 255 -- 0xFF
DirectNewLine();
DirectPrintDecimal(InPortByte(0x1f0)); // prints 255 -- 0xFF
DirectNewLine();

and so on...
It does the same while read operation too.

Could not find any articles about this problem (or mistake).

Thank you.

P.S. I am coding the driver by osdev wiki topics.

Re: 0xFF from ATA Data port

Posted: Tue Nov 17, 2009 8:02 am
by bewing
Is this on real hardware or on an emulator? You need to be reading WORDS (not bytes!) from port 0x1f0 for one thing.

Re: 0xFF from ATA Data port

Posted: Tue Nov 17, 2009 11:38 pm
by rezoimnadze
Oops! stupid mistake! :oops:
Problem solved.
Thank you very much!

I use Bochs emulator with correct configuration. :roll: