pci_find_capability return 0: "device does not support it"

pci_find_capability return 0: "device does not support it"

我用 PCI_CAP_ID_EXP 调用 pci_find_capability 并且 return 代码为零,这意味着:

Tell if a device supports a given PCI capability. Returns the address of the requested capability structure within the device’s PCI configuration space or 0 in case the device does not support it

为什么设备不支持?

 int pcie_cap_addr = pci_find_capability(pdev, PCI_CAP_ID_EXP);

PCI_CAP_ID_EXP 定义为 0x10.

PCI_CAP_ID_EXP定义为0x10,即PCI Express Capability的能力ID。 PCI Express 规范要求所有 PCIe 设备实现此功能。因此,任何不实现它的设备都不是 PCIe 设备。

如果您使用的系统足够老且具有内置 PCI 插槽,则它可能是 PCI 插槽中的 PCI 卡。

否则,它可能是 PCIe-PCI 桥接器后面的 PCI 设备,或者它可能是不使用任何新 PCIe 功能的根复合体集成设备 (RCIEP),因此它将自己标识为 PCI 设备,而不是比 PCIe 设备。