Page 1 of 1

Could someone help me about SATA Programming

Posted: Mon Mar 17, 2014 1:26 am
by BadBoy
hi,all
with the code:

Code: Select all

mov dx,1F7h
mov ax,ECh
out dx,ax      ;Send a standard IDENTIFY command to the drive (0xEC). 
in ax,dx         ; The drive should respond with an error in the ERR bit of the Status Register, and a pair of "signature bytes". 
sub dx,3        
in ax,dx        ;On the Primary ATA bus, you get the signature bytes by reading IO ports 0x1F4 and 0x1F5, and you should see values of 0x3C and 0xC3. 
inc dx
in ax,dx
At http://wiki.osdev.org/SATASay: On the Primary ATA bus, you get the signature bytes by reading IO ports 0x1F4 and 0x1F5, and you should see values of 0x3C and 0xC3. But I only see the values FFh in that I/O ports. Why?

What's wrong with my code ?(Is teh ports correct(1F0-1F7)?
thx!

Re: Could someone help me about SATA Programming

Posted: Mon Mar 17, 2014 1:52 am
by Combuster
You're trying a backwards compatibility quirk, which probably only works if your SATA controller is in legacy mode. Also, you're not waiting for the command to actually complete before checking it ends in an error.

The more appropriate way to find SATA controllers is by enumerating the PCI devices.

Re: Could someone help me about SATA Programming

Posted: Tue Mar 18, 2014 5:01 am
by BadBoy
Combuster wrote:You're trying a backwards compatibility quirk, which probably only works if your SATA controller is in legacy mode. Also, you're not waiting for the command to actually complete before checking it ends in an error.

The more appropriate way to find SATA controllers is by enumerating the PCI devices.
Teh SATA controller always return 0xFF in both IDE mode or AHCI mode when I try to identify the ATA and SATA controller. I think that the tutorial:http://wiki.osdev.org/SATA Is a lie! I am using I/O ports 0x1F0 to 0x1F7. Is those I/O ports corrects???