linux - 如何从 struct pci_dev 获取总线/设备/编号?

标签 linux driver pci

https://elixir.bootlin.com/linux/latest/source/include/linux/pci.h#L286

struct pci_dev,

我只能看到总线和功能:

struct pci_bus  *bus;   

unsigned int    devfn;  

好像没有设备(B/D/F)信息?

struct pci_slot *slot;

在我的测试中,*slot 指向 NULL,为什么?

最佳答案

我发现:

device = PCI_SLOT(pdev->devfn);
fn =  PCI_FUNC(pdev->devfn);

https://elixir.bootlin.com/linux/v3.5/source/include/linux/pci.h#L31

关于linux - 如何从 struct pci_dev 获取总线/设备/编号?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53809842/

相关文章:

linux - 这些磁盘读取从哪里来?

linux - 尽管包含符号,perf 也不在注释中显示源代码

c - 如何解码gcc编译的c源代码

linux -/sys/bus/pci/device/0000 :xx:xx. x/resource下的资源文件包含什么信息?

php - UTF-8贯穿始终

windows - 24 位 USB 采样率支持

windows - 将 IRP 读/写数据包从 UMDF 驱动程序发送到内核模式驱动程序

java.net.ConnectException 消息 : Connection timed out: connect

c - 在不连接设备的情况下安装 Linux PCI 驱动程序

linux - 为什么 PCIe TLP header 有 "Last DW BE"和 "First DW BE"?