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.
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!
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.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
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???