PS: I'm targeting an ARM SoC (Raspberry Pi), but I believe these ideas can be applied to PC.
The hardware enumeration will build a tree. In the root level we have the "System" node, which represents the computer. It children are buses (e.g. USB, I2C, SPI, etc.) and each bus have it attached devices (mostly peripherals). In my case, I have the 'virtual' SOC bus which contains devices implemented directly in the SOC and can't be enumerated (e.g. graphic display). Finally, we have 'virtual devices' which are devices built on top of other devices (e.g. filesystems, host bridges, etc). They could be used, for example, to mount a NFS filesystem (filesystem device attached to a network device).
Devices and buses are associated to a driver and contains a block of information (e.g. vendor, model, addresses, class, etc.).
Something to illustrate:
- System
- SOC bus
- Display device
- USB bus
- Host Bridge (e.g. USB hub)
- Printer
- Camera
- Host Bridge (e.g. another USB hub)
- Printer
- Mass storage (e.g. USB stick, external HDD)
- Ext2 filesystem
- Keyboard
- Mouse
- Display
- WiFi dongle
- Host Bridge (e.g. USB hub)
- SPI bus
- Some device
- SOC bus
Question: this seems a good way to represent a device hierarchy?