0x90
0x90

Reputation: 41032

mapping io device addresses in linux kernel?

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));

The output is

start = 72100000 , end = 72100fff 
fbi->reg_base = 70b10000
virt_to_phys(fbi->reg_base) = a0b10000
virt_to_phys(fbi->reg_base) = a0b10000

Why don't I get back the 0x72100000 ?

Upvotes: 0

Views: 465

Answers (1)

Tony The Lion
Tony The Lion

Reputation: 63320

I would imagine you don't get back that address because the address that ioremap_nocache returns isn't guaranteed to be a virtual address, as it says here:

ioremap_nocache performs a platform specific sequence of operations to make bus memory CPU accessible via the readb/readw/readl/writeb/ writew/writel functions and the other mmio helpers. The returned address is not guaranteed to be usable directly as a virtual address.

Upvotes: 1

Related Questions