On 8/9/06, Sebastian Haas <haas@xxxxxxxxxxxxxxxx> wrote:
On 08/08/2006 10:52 AM, srinivas bakki wrote:
> hi,
> i have this doubt regarding the addresses returned by
> ioremap.
> i mapped my devices's registers using ioremap. again when i try to
> retrieve the physical address from the virtual address got from ioremap
> using __pa(va) i see that the physical address is not the same which i
> gave to ioremap function !!
Which kind of device did you try to map? (ISA, PCI, ...)
Sebastian
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/kernelnewbies/
FAQ: http://kernelnewbies.org/faq/
hi,
Thanks for the reply . I mapped PCI device registers. i had mailed this query on arm mailing list as well and this is what i got as response.
> hi,
Hi,
> i have a strange doubt regarding the addresses returned by
ioremap.
> i mapped my devices's registers using ioremap. again when i try to
retrieve the physical address from the virtual address got from ioremap
using __pa(va) i see that the physical address is not the same which i
gave to ioremap function !!
>
> can anybody explain this please.
__pa() use __virt_to_phys and with this function we ca read:
* Physical vs virtual RAM address space conversion. These are
* private definitions which should NOT be used outside memory.h
* files. Use virt_to_phys/phys_to_virt/__pa/__va instead.
and for virt_to_phys we can also read
* These are *only* valid on the kernel direct mapped RAM memory.
* Note: Drivers should NOT use these. They are the wrong
* translation for translating DMA addresses. Use the driver
* DMA support - see dma-mapping.h .
So if you use it in driver you can't expect good result. Ioremap do
more than a __va() on physicla address. You can't expect that
__va(ioremap(x)) = x.
--
Gregory CLEMENT
Adeneo
Hi,
> i have a strange doubt regarding the addresses returned by
ioremap.
> i mapped my devices's registers using ioremap. again when i try to
retrieve the physical address from the virtual address got from ioremap
using __pa(va) i see that the physical address is not the same which i
gave to ioremap function !!
>
> can anybody explain this please.
__pa() use __virt_to_phys and with this function we ca read:
* Physical vs virtual RAM address space conversion. These are
* private definitions which should NOT be used outside memory.h
* files. Use virt_to_phys/phys_to_virt/__pa/__va instead.
and for virt_to_phys we can also read
* These are *only* valid on the kernel direct mapped RAM memory.
* Note: Drivers should NOT use these. They are the wrong
* translation for translating DMA addresses. Use the driver
* DMA support - see dma-mapping.h .
So if you use it in driver you can't expect good result. Ioremap do
more than a __va() on physicla address. You can't expect that
__va(ioremap(x)) = x.
--
Gregory CLEMENT
Adeneo