Boot-time list of hardware

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
nono17pero
Posts: 1
Joined: Tue Jul 05, 2011 5:40 am

Boot-time list of hardware

Post by nono17pero »

Hi,
I was wondering if there is a way to build a list of the hardware of a computer at boot time... The idea is to be dispensed to use the BIOS. Why ? Personally, I don't like it :evil: Its interruptions are hiding all the interesting stuff, and it is not funny.
So, theoretically, it should be possible to write small boot-time drivers using IN and OUT instructions. Why wouldn't it be possible since it is what the BIOS does ? Whatever, I would like to now if there is a way to use the I/O instructions to know what kind of hardware is connected (maybe only to know which bootable devices are present) and execute code in consequence.
Thanks beforehand :D
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: Boot-time list of hardware

Post by Combuster »

For the vast majority of hardware, you don't really need bios involvement to detect what's out there. The only thing you typically can't do is to try to reset or configure such hardware because you might interfere with the bios' own plans.

As far as implementations are concerned, the mechanics for detection work pretty much the same.
"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 ]
User avatar
zhiayang
Member
Member
Posts: 368
Joined: Tue Dec 27, 2011 7:57 am
Libera.chat IRC: zhiayang

Re: Boot-time list of hardware

Post by zhiayang »

AFAIK most if not all modern peripherals are connected via PCI of some description. (USB is a PCI device IIRC).
Given the PCI I/O ports are mostly fixed addresses, it is totally possible to probe connected devices at boot-time (possibly in real mode too, although I foresee some problems with the higher MMIO regions).
User avatar
sortie
Member
Member
Posts: 931
Joined: Wed Mar 21, 2012 3:01 pm
Libera.chat IRC: sortie

Re: Boot-time list of hardware

Post by sortie »

It gets a little more fun if you actually remember that the BIOS loads and executes your code. Already there, you have failed to not use the BIOS. Worse, it just loads the master boot record and I bet you can't store a whole real driver in there - you have to use the BIOS again to load a couple more parts of your boot-loader. That's twice you've used the BIOS. However, now you can load enough code such that your boot-loader can use real drivers to communicate with real hardware and execute your operating system entirely without BIOS help.

Oh wait, that's how actual operating systems work. They just use the BIOS to bootstrap themselves and then never use it again. It doesn't really matter, it's just a thing that gets you running.
Post Reply