繁体   English   中英

如何从struct pci_dev获取总线/设备/号码?

[英]How to get bus/device/number from struct pci_dev?

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;

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

我发现:

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

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

Devfn在第7:3位包含设备编号,在第2:0位包含功能编号。 总线号在bus-> number中。 所以BDF是

    bus->number << 8 | devfn

我不知道广告位; 也许您正在查看的设备是集成设备?

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM