The problem is , why do..." /> The problem is , why do..." /> The problem is , why do..."/>

what is the meaning of mapping virtual address to physical address?

608 Views Asked by At

I am using "ioremap" to map the address of a GPIO port in the datasheet of Ti AM3359 . The code is running fine.

Problem:

1> The problem is , why do we need to map the virtual address to physical address? Is it because physical address is the real address of the hardware that we want to access?

2> If above is true then, why don't the datasheets directly give the physical address .

3> Is the physical address returned by "ioremap" would be different in different Boards with different amount of RAM?

2

There are 2 best solutions below

4
On

As for your first question, the reason you use ioremap is because the kernel's address space does not correspond to the physical address space. You need to map the physical pages into the virtual address space to be able to address them at all. This is what ioremap does.

As for your second and third questions, I wouldn't know what your datasheets give or do not give. :)

Normally, I would expect hardware datasheets to give physical addresses, unless it is that the physical address must be either found out or configured via bus-specific mechanisms. What is it that yours actually specify, if not that?

You may want to read this for further information.

0
On
  1. because kernel operates on virtual addresses not on physical ones
  2. in my datasheets there are only physical addresses
  3. afaik ioremap returns virtual address mapping your physical address