从内核获取基地址寄存器的宏是如何工作的

发布于 2024-10-03 07:42:01 字数 248 浏览 0 评论 0原文

我试图了解 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

笑红尘 2024-10-10 07:42:01

该宏的目的只是为了提高源代码的可读性,它不会导致检索任何地址。事实上,当 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文