c - pci_find_capability 返回 0 : "device does not support it"

标签 c linux linux-kernel linux-device-driver pci

我用 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/

相关文章:

linux - 如何知道性能记录的最大事件周期

在运行时检查 Linux 内核配置

c - 当我不知道我需要的数据类型时我该怎么办?

c - 将一个函数作为参数传递给另一个函数

linux - 在我退出非 root 用户的 ssh 后,如何让我的 Linux 程序继续运行?

sql - 如何在 Linux 中解析 postgres 的 XML 输出作为 Basex 的输入

c - 使用 Linux 内核中的循环缓冲区宏

c - 是否可以使用 fopen 在 OS X 上的 C 中读取具有相对路径的文件?

c - 将节点插入到链表的尾部

linux - 如何在shell中插入带有序列号的列?