ISA/PCI, ATA/SATA and BIOS Get drive parameters

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
madanra
Member
Member
Posts: 149
Joined: Mon Sep 07, 2009 12:01 pm

ISA/PCI, ATA/SATA and BIOS Get drive parameters

Post by madanra »

Hi,

I recently restarted doing OS dev stuff, and this evening tried the BIOS Get drive parameters function, and found the 'host bus' and 'interface type' were as follows:
Bochs: Host bus = 'ISA', interface type = 'ATA'
VirtualPC: Host bus = 'PCI', interface type = 'ATA'
VirtualBox with IDE, SATA SCSI or SAS: Host bus = 'ISA', interface type = 'ATA'
which was not what I was expecting, except for VirtualPC. I then looked around for what the values should be and got thoroughly confused :S

So is PATA and ISA thing or a PCI thing? I thought it was originally ISA and is now PCI, but that doesn't fit with the results above.
More confusing is why VirtualBox is giving interface type 'ATA' for any actual interface.
From what I looked at while trying to find answers to these, I'm guessing this is something to do with the BIOS configuring devices in some sort of legacy mode rather than native; if so, how do I find out what a device (corresponding to a BIOS drive number) really is?

Thanks!
User avatar
turdus
Member
Member
Posts: 496
Joined: Tue Feb 08, 2011 1:58 pm

Re: ISA/PCI, ATA/SATA and BIOS Get drive parameters

Post by turdus »

It can be both. You can use ISA and PCI to access the controller.
I've also implemented this BIOS interface, and deleted the whole thing (I've also found it very unreliable, but on real hardware it should work).
madanra
Member
Member
Posts: 149
Joined: Mon Sep 07, 2009 12:01 pm

Re: ISA/PCI, ATA/SATA and BIOS Get drive parameters

Post by madanra »

Thanks turdus.
I've just brushed up on PCI again, and it's beginning to make a bit more sense.
So if you're accessing using ISA, you just assume base address of 0x01f0/0x170 and IRQ14/15.
But if you're accessing via PCI, it will on start up be configured in compatibility to the same base address/IRQ as ISA, but you could switch to native, and then you could have different base address/IRQ.
So, combining those you can ignore whether it's ISA or PCI, as on start up they're effectively the same, and just look at whether the interface path is 0x01f0 or 0x0170 for primary/secondary controller, and device path for master/slave. AFAIK there's no advantage to switching to native on PCI, so you can just use the base address the BIOS says (if it says 0x01f0 or 0x0170).

Playing around with VirtualBox a bit more, for SCSI/SAS there's no useful information, for SATA it can only boot off ports 0-3, and uses them like master/slave on tertiary and quaternary IDE controllers (at base addresses 0x01e8 and 0x0168). I have no idea whether that's normal behaviour for a SATA drive! Well, I'll start with PATA, and cross the bridge of detecting SATA if and when that comes.
User avatar
turdus
Member
Member
Posts: 496
Joined: Tue Feb 08, 2011 1:58 pm

Re: ISA/PCI, ATA/SATA and BIOS Get drive parameters

Post by turdus »

I say you can drop ISA support without any problem, since PCI is with us about 20 years now. It's absolutely safe to assume that the hardware you're going to use will have it, and it will also have a PCI entry for the ATA controller. Never the less in the last few years manufacturers put SATA and PATA controllers on the motherboards, and they have only PCI interface (or more precisely, 100% sure they have it, not sure about ISA support).
Post Reply