Hello everyone,

Currently developing my own kernel « from scratch » I am trying to develop some PCI drivers. After locating the BIOS32, then PCI BIOS, then peripherals configuration spaces using Memory I/O I’m now able to discover pci devices, read/write to their configuration space and use the information from here to discover each device’s capabilities.

First question : Are those capabilities the actual way of handling individual drivers for each peripherals ? I’ve been starting with virtio devices, the documentation indicates that I should find several capabilities with a specific set of information for each, including a BAR number, that should be the one pointing to this actual capability configuration.

Second question : If using those capabilities is actually the correct way of developing a driver (here for virtio devices), how am I supposed to use the BARs to handle the configuration ? Should I allocate memory for the size of this BAR (I know the operations to make to get the actual size of BARs), anything else ? I’m currently not sure I should allocate it using malloc or something since I think it picks a memory space « randomly » and this memory space cannot contain the informations for the capability.

Sorry if I’m being messy, thanks a lot.