Re: Specifying properly the PCI driver model on all linux architectur

Adrian Cox (apc@agelectronics.co.uk)
Wed, 03 Nov 1999 11:27:24 +0000


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/