lkml.org 
[lkml]   [1999]   [Nov]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Specifying properly the PCI driver model on all linux architectur es, (ioremap(), bus_to_virt() ...)
Jes Sorensen wrote:
> >>>>> "Adrian" == Adrian Cox <apc@agelectronics.co.uk> writes:
[snip]
> Adrian> 1) Using the contents of base_address[] as an offset when
> Adrian> mmapping /dev/mem from userspace?
> I would probably go for using virt_to_bus(ioremap(base_address[]))
> here.

I don't think that's going to work (except maybe on alpha).

On x86 and ppc ioremap() will allocate virtual address space somewhere,
using get_vm_area(). virt_to_bus(address) on PPC just does
return (unsigned long)address - KERNELBASE + PCI_DRAM_OFFSET;
and on x86 does (with a bit of macro expansion)
return ((unsigned long)(address) & ~PAGE_OFFSET)

It looks like virt_to_bus() and virt_to_phys() can only be safely used
on kernel virtual addresses corresponding to RAM. Which is not a
surprising design decision, as working through page tables is much
slower.

- Adrian Cox, AG Electronics

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:54    [W:0.778 / U:0.600 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site