bus detection and device manager

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
Ozguxxx

bus detection and device manager

Post by Ozguxxx »

hey everybody, its been a long time while Ive been watching and not watching, Im trying to get my life in its way... Anyway Im trying to figure out is there a way to detect the busses that are installed on the computer system. Thanx in advance.
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re:bus detection and device manager

Post by Brendan »

Hi,
Ozgunh82 wrote: hey everybody, its been a long time while Ive been watching and not watching, Im trying to get my life in its way... Anyway Im trying to figure out is there a way to detect the busses that are installed on the computer system. Thanx in advance.
There's a few different methods for detecting busses - ACPI, MP specification, Plug & Play and manual probing. Then there's detecting what devices are on the bus (ACPI, Plug & Play and manual probing only).

You might be better to ask more specific questions, e.g. "How do I detect the busses using <insert method here>?".

My ESP circuitry is telling me you're about to ask which is the best method :). Unfortunately (IMHO) none of them are very good.

ACPI is an over-complicated beast that would take years to get working properly, and would include writing an AML (ACPI Machine Language) interpretter and updating it each time microsoft decide to add something. If you somehow managed to implement full ACPI support it'd do bus & device detection and power management. Unfortunately ACPI isn't supported by older computers.

The MP specification isn't designed for detecting busses, but it does report what IRQs are used for which busses, so you could extract a list of busses from that. Not much help but it's a start (especially if you do the rest with manual detection). Unfortunately the MP specification isn't supported by most single-CPU computers.

Plug & play will help with some devices (especially those on the ISA bus). Unfortunately it's not supported by very old computers, and might not be supported on new (and future) computers as it's being replaced by ACPI.

Manual probing can work on almost all computers (regardless of age), but requires heaps of work if you want to detect which devices are present too.

Once you know which busses are present you'd need to know which devices are plugged into each bus. This is another thing you're best using specific questions for, as it's all different. E.g. "How do I detect which devices are on the <ISA/PCI/USB/etc> bus?".

While your OS is gathering this information it's best (IMHO) to build a "tree like structure", which keeps track of how everything is connected together. This would include the CPU/s, memory, the CPUs bus, AGP, PCI, USB, ISA, etc (and all the devices). This is so that the OS knows the correct order to send devices to sleep (for example, so it doesn't send the PCI bridge to sleep and then try to use an ISA device).

I'd write code to handle this "tree like structure" and display it's contents before writing code to detect anything. Then I'd be tempted to use all of the stuff above (depending on what the computer supports) to fill out this "tree like structure" as much as possible. I'd start by adding CPUs to the tree, and then memory...


Cheers,

Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:bus detection and device manager

Post by Pype.Clicker »

well, on most x86-based systems, you can assume a PCI bus to be present. Other busses like USB and PCMCIA are usually attached to the PCI bus trhough bridge controllers that you can identify via PCI enumeration.
Ozguxxx

Re:bus detection and device manager

Post by Ozguxxx »

Thanks a lot for replies, Ill do some researching and Ill surely be back...
Post Reply