ATA Controllers detection
Posted: Wed Sep 30, 2009 4:10 am
On the wiki I read that one of the ways to check wheter a controller exists or not is to write a value to two of the ports 0x1F2-0x1F5 and 0x172-0x175 and to read the values again and check if they're equal.
This method works on Bochs, Qemu and VMWare. But doesn't on VirtualBox and on (my) real hardware.
On my motherboard I've 6 SATA ports (ASUS Rampage II Extreme), but 0 controllers are detected... How's it possible? I would need at least 3 controllers.
How will I detect other controllers than the primary and secondary (do I need a PIIX driver... whatever it is)? And how will I fix that code?
This method works on Bochs, Qemu and VMWare. But doesn't on VirtualBox and on (my) real hardware.
Code: Select all
int ata_check_controller(word port) {
byte data;
outportb(port + 2, 0xBE);
outportb(port + 3, 0xEF);
if ((inportb(port + 2 != 0xBE) || (inportb(port + 2) != 0xEF)) {
printf("ATAcontroller at 0x%04x\n", port);
return -ENODEV;
}
return 0;
}
How will I detect other controllers than the primary and secondary (do I need a PIIX driver... whatever it is)? And how will I fix that code?