Hi guys!
I am a linux newbie and I am facing some issues regarding accessing the configuration space of PCI devices. At this time, I am developing a driver which access directly to the configuration space of any PCI device using the traditional enumeration scheme: bus, device, function, register. I found that I need a struct pci_dev *dev for accessing the configuration space using the pci_(read|write)_config_(byte|word|dword). But, I have to enable some bits in some devices and I only have the bus, dev, fun, reg numbers, I do not have any pci_dev structure. I found that using the pci_bus_(read|write)_config(byte|word|dword) funtions I can access to any dev+fun device but, how can I create a pci_bus structure from a bus number, for example: I want to access to bus=0x0, dev=0x1, func=0x0, reg=0xCA. How can I do that?, I mean how can I create the missing pci_bus structure from 0?. Also, I found that the bus structure have diferent lists inside of it: children, devices, etc.
This module is just for debugging proposes I know that this is not a proper behaivor.
Thanks and regards,
Jesus