Search code examples
c++pcipci-e

Identifying whether a PCI device is PCI or PCIe


I need to be able to identify whether a given PCI device is express or non-express at runtime. One possible way to ID this is to get the Configuration space and check for an extended section. If the extended section exists then it's a PCIe card. Specifically i would check the first four bytes to see if they are 0x100 as the specification requires.

Is this the best way to validate what type of card is being used? Are my assumptions correct?


Solution

  • I think the best way is to look for the PCI Express capability, which is in the regular capability space, not the extended space. The presence of this capability indicates a PCIe device. The capability ID is 0x10.