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