如何从struct pci_dev获取总线/设备/号码? [英] How to get bus/device/number from struct pci_dev?

查看:277
本文介绍了如何从struct pci_dev获取总线/设备/号码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

struct pci_dev,

我只能看到总线和功能:

I can only see bus and function:

struct pci_bus  *bus;   

unsigned int    devfn;  

似乎没有(B / D / F的)设备信息?

seems no device (of B/D/F) information?

struct pci_slot *slot;

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

In my test, the *slot point to NULL, why ?

推荐答案

我发现:

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

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

这篇关于如何从struct pci_dev获取总线/设备/号码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆