ATA Controllers detection

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
User avatar
AlfaOmega08
Member
Member
Posts: 226
Joined: Wed Nov 07, 2007 12:15 pm
Location: Italy

ATA Controllers detection

Post by AlfaOmega08 »

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.

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;
}
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?
Please, correct my English...
Motherboard: ASUS Rampage II Extreme
CPU: Core i7 950 @ 3.06 GHz OC at 3.6 GHz
RAM: 4 GB 1600 MHz DDR3
Video: nVidia GeForce 210 GTS... it sucks...
User avatar
~
Member
Member
Posts: 1228
Joined: Tue Mar 06, 2007 11:17 am
Libera.chat IRC: ArcheFire

Re: ATA Controllers detection

Post by ~ »

Here you have something brief about SATA:

http://forum.osdev.org/viewtopic.php?f=1&t=20886

Maybe you could check the specifications and eventually put some sample code. I think that there are links to them in the wiki or searching with Google.


I have very well managed to detect standard ATA/ATAPI devices attached, you can read about the methods used here along with source code (watch mainly for the last posts which actually solve the issue):

http://forum.osdev.org/viewtopic.php?f=1&t=20690
User avatar
AlfaOmega08
Member
Member
Posts: 226
Joined: Wed Nov 07, 2007 12:15 pm
Location: Italy

Re: ATA Controllers detection

Post by AlfaOmega08 »

I found ADVDRVR on ata-atapi.com, and now HD and CD detection works on any emulator. I didn't try VPC however. It still doesn't on my PC. I have a SATA HD and a IDE DVD drive. I expected at least the DVD drive to be detected. However I found in lspci:

Code: Select all

05:00.0 SATA controller: JMicron Technologies, Inc. JMicron 20360/20363 AHCI Controller (rev 03)
05:00.1 IDE interface: JMicron Technologies, Inc. JMicron 20360/20363 AHCI Controller (rev 03)
Do I need driver for those devices?
Please, correct my English...
Motherboard: ASUS Rampage II Extreme
CPU: Core i7 950 @ 3.06 GHz OC at 3.6 GHz
RAM: 4 GB 1600 MHz DDR3
Video: nVidia GeForce 210 GTS... it sucks...
User avatar
Brynet-Inc
Member
Member
Posts: 2426
Joined: Tue Oct 17, 2006 9:29 pm
Libera.chat IRC: brynet
Location: Canada
Contact:

Re: ATA Controllers detection

Post by Brynet-Inc »

OpenBSD has a special driver for a few (..older?) JMicron SATA/PATA host controllers, it acts as some sort of pass through device for pciide/ahci drivers.

SATA controllers should offer PCI IDE compatibility.. but this one might only support AHCI (Which is good, you'll get things like NCQ and device hot plugging).

Good luck.

EDIT: Try looking in your BIOS for a setting related to your SATA controller, perhaps you can force it into PCI IDE mode.
Image
Twitter: @canadianbryan. Award by smcerm, I stole it. Original was larger.
Post Reply