0xFF from ATA Data port

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
rezoimnadze
Posts: 8
Joined: Tue Apr 14, 2009 2:14 am

0xFF from ATA Data port

Post 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.
User avatar
bewing
Member
Member
Posts: 1401
Joined: Wed Feb 07, 2007 1:45 pm
Location: Eugene, OR, US

Re: 0xFF from ATA Data port

Post 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.
rezoimnadze
Posts: 8
Joined: Tue Apr 14, 2009 2:14 am

Re: 0xFF from ATA Data port

Post by rezoimnadze »

Oops! stupid mistake! :oops:
Problem solved.
Thank you very much!

I use Bochs emulator with correct configuration. :roll:
Post Reply