Re: Specifying properly the PCI driver model on all linux architectur es, (ioremap(), bus_to_virt()

Peter Desnoyers (pjd@fred001.dynip.com)
Wed, 3 Nov 1999 07:11:02 -0500 (EST)


Jes Sorensen wrote:
>
> >>>>> "Adrian" == Adrian Cox <apc@agelectronics.co.uk> writes:
>
> Adrian> But with multiple PCI buses, the base_address cannot be a
> Adrian> simple bus address, because the PCI bus number must be coded
> Adrian> in there. For example, on alpha the PCI_HANDLE from
> Adrian> include/asm-alpha/pci.h is or'ed into the base_address.
>
> Adrian> As far as I can tell, the base_address[] is always correct for
> Adrian> ioremap. But are the following two tricks valid:
>
> Thats my assumption and at least thats what I have been telling people
> so far ;-)
>
> 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.

virt_to_phys, perhaps? /dev/mem isn't indexed by bus addresses. Of
course you've got to code them yourself, since they're kernel functions...

I suppose the X source would be definitive here.

For mmaping in the kernel, fbmem seems to be definitive - you use
io_remap_page_range, and pass in the *input* to ioremap, not the
output.

> Adrian> 2) Using the contents of base_address[] as a target address
> Adrian> for peer to peer DMA on PCI?
>
> Hmmm, interesting, I would say same answer as for 1).

I think the raw contents of the config registers would be appropriate here -
if you think about it, it's the actual address that the device is going to
decode. If you do various transforms and end up with another address (e.g.
if you have independent PCI buses) then all that tells you is that device-
to-device DMA isn't going to work.

-- 
............................................................................
 Peter Desnoyers 
 162 Pleasant St.         (617) 661-1979          pjd@fred.cambridge.ma.us
 Cambridge, Mass. 02139   (978) 461-0402 (work)   pjd@giga-net.com 

- 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/