Identify a PCIe device using PCI config space
Given the list of PCI devices installed in the system, I need to identify PCIe devices. So far, I've been using iteration over the list of capabilities to see if the device has extended cap structure (which would correspond to cap ID 0x10). And, if the device has an extended cap structure, then it is a PCIe device开发者_运维问答 for sure. However, it seems like this method fails to identify some devices. I was wondering if anyone knows of a better method.
Thanks.
I used below way to retrieve PCIe devices:
- check if PCI device config register 0x6 bit4 = 1(capability list exist status) ?
- check if PCI device config register 0x34 != 0(capability pointer valid) ?
- check if PCIe capability(ID = 0x10) exist ?
If all above are true then this device is a PCIe device !!!
I am curious about the situation that "this method fails to identify some devices" ?
PCI/PCIE device scanning, It is possible to have redundant addresses in the capabilities pointer(corrupted PCI config space).
Please check if there is any redundancy in capability pointer values in all B:D:F combinations, If you found any issues you can directly contact your BIOS vendor to get it rectified.
精彩评论