简体   繁体   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 https://elixir.bootlin.com/linux/latest/source/include/linux/pci.h#L286

In

struct pci_dev,

I can only see bus and function: 我只能看到总线和功能:

struct pci_bus  *bus;   

and

unsigned int    devfn;  

seems no device (of B/D/F) information? 似乎没有(B / D / F)的设备信息?

and

struct pci_slot *slot;

In my test, the *slot point to NULL, why ? 在我的测试中,*插槽指向NULL,为什么?

Devfn contains the device number in bits 7:3 and the function number in bits 2:0. Devfn在第7:3位包含设备编号,在第2:0位包含功能编号。 The bus number is in bus->number. 总线号在bus-> number中。 So the BDF is 所以BDF是

    bus->number << 8 | devfn

I don't know about slot; 我不知道广告位; perhaps the device you are looking at is an integrated device? 也许您正在查看的设备是集成设备?

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

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