从内核获取基地址寄存器的宏是如何工作的
我试图了解 pci_resource_start 函数的工作原理 所以我通过 cscope 浏览代码并搜索字符串 pci_resource_start 并在 pci.h 中得到关注,
#define pci_resource_start(dev, bar) ((dev)->resource[(bar)].start)
我无法理解上面的宏是如何工作的。 上面的宏如何获取适当的基地址寄存器 配置空间?
I am trying to understand working of pci_resource_start function
So I browsed code via cscope and searched for string pci_resource_start
and got following in pci.h
#define pci_resource_start(dev, bar) ((dev)->resource[(bar)].start)
I am not able to understand how does this above macro works.
How does it above macro gets appropriate base address register in
configuration space?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
该宏的目的只是为了提高源代码的可读性,它不会导致检索任何地址。事实上,当 PCI 总线和/或设备被扫描/初始化时,地址(由
start
成员表示)就已经被发现了。 (在这种情况下,“开始”也意味着“地址范围的开始”,而不是“开始做某事”。)有关详细信息最有可能在名为
pci.c
的文件之一中找到。The macro's purpose is merely to improve readability in source code, it does not cause any address to be retrieved. In fact, the address (denoted by the
start
member) has already been discovered earlier on when the PCI bus and/or device was scanned/initialized. ("Start" in this case also means "start of address range" rather than "begin doing something".)Details of this are most likely to be found in one of the files named
pci.c
.