Linux驱动开发杂记(0x05) - 从pci_dev中获取总线、插槽、功能号 发表于 2018-11-08 更新于 2023-09-18 分类于 Linux驱动开发杂记 1234567891011/* * The PCI interface treats multi-function devices as independent * devices. The slot/function address of each device is encoded * in a single byte as follows: * * 7:3 = slot * 2:0 = function */ #define PCI_DEVFN(slot, func) ((((slot) & 0x1f) << 3) | ((func) & 0x07)) #define PCI_SLOT(devfn) (((devfn) >> 3) & 0x1f) #define PCI_FUNC(devfn) ((devfn) & 0x07) 12345struct pci_dev *devBusNumber = dev->bus->number;SlotNumber = PCI_SLOT(dev->devfn);FuncNumber = PCI_FUNC(dev->devfn); -------------本文结束感谢您的阅读------------- 本文标题:Linux驱动开发杂记(0x05) - 从pci_dev中获取总线、插槽、功能号 文章作者:Vinx 发布时间:2018年11月08日 - 17:10 最后更新:2023年09月18日 - 11:10 原始链接:https://blog.vinkvin.com/post/5/ 许可协议: 署名-非商业性使用-禁止演绎 4.0 国际 转载请保留原文链接及作者。