我用 PCI_CAP_ID_EXP
调用 pci_find_capability
并返回代码为零,这意味着:
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 设备。
关于c - pci_find_capability 返回 0 : "device does not support it",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57665415/