0

I am now looking for countless hours in the linux/pci.h and all connected files to understand how the PCI can be securely scanned (read-only) and then picking a pci_slot when the device matches.

However, I am not able to even start a search as i have no root-bridge or root-node to begin the search with. (the search should be as generic as possible - all done in a kernel module).

I observed that I need a starting-point for functions to further search for children/parent. But i do not want to add or register a slot (which e.g. is done by the function pci_scan_bus() -> https://elixir.bootlin.com/linux/v5.5.5/source/drivers/pci/probe.c#L3085 ). As the book "Linux Device Drivers" stated, there is no way to scan the pci-bus the old fashioned way.

Should I register a dummy device/slot to go up the root node and then recheck the whole tree-structure of the PCI-bus? Even the kernel.org documentation from 2004 is missing major information about some mechanics in how the kernel is managing the pci-bus.

Each answer is appreciated :)

1 Answer 1

0

Sooo after looking further with some lspci help, i figured this out.

pci_find_bus(0x0, 0x0); //should be the host-bus to_pci_host_bridge(&(res_bus->dev));

The children list seems to be loaded with other devices :) Maybe this helps someone in the future.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .