简体   繁体   English

宏如何从内核获取基址寄存器

[英]how does macro to get base address register from kernel works

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 我试图了解pci_resource_start函数的工作,所以我通过cscope浏览了代码,并搜索了字符串pci_resource_start,并在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? 上面的宏如何在配置空间中获取适当的基址寄存器?

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. 实际上,早在扫描/初始化PCI总线和/或设备时就已经发现了该地址(由start成员表示)。 ("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 . (在这种情况下,“开始”也表示“地址范围的开始”,而不是“开始做某事”。)有关此操作的详细信息最有可能在名为pci.c的文件之一中找到。

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

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