printk(" start = %p , end = %p \n",res->start ,res->end );
fbi->reg_base = ioremap_nocache(res->start, res->end - res->start);
printk(" fbi->reg_base = %p \n",fbi->reg_base);
printk(" virt_to_phys(fbi->reg_base) = %p \n", virt_to_phys(fbi->reg_base));
printk(" virt_to_bus(fbi->reg_base) = %p \n", virt_to_bus(fbi->reg_base));
输出是
start = 72100000 , end = 72100fff
fbi->reg_base = 70b10000
virt_to_phys(fbi->reg_base) = a0b10000
virt_to_phys(fbi->reg_base) = a0b10000
为什么不找回
0x72100000
? 最佳答案
我想您不会得到该地址,因为ioremap_nocache
返回的地址不能保证是虚拟地址,因为它说here:
ioremap_nocache执行平台特定的操作序列,以使总线内存CPU可以通过readb / readw / readl / writeb / writew / writel函数和其他mmio帮助器进行访问。返回的地址不能保证直接用作虚拟地址。
关于c - 在Linux内核中映射io设备地址?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/14725710/