[lkml]   [1999]   [Oct]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: ioremap(), bus_to_virt() and PCI devices on different Linux archi
    Pete Zaitcev wrote:
    > > I don't know the correct and universal way on all linux architecture to map
    > > PCI memory. Some drivers
    > > in the kernel use ioremap, other use bus_to_virt() ...
    > I smell a poor wording or understanding here.
    > Typically "PCI memory" means a memory located in a PCI board.
    > Memory located on the other side of a north bridge is a
    > "normal" or "CPU" memory.

    I've got a related question - how do you portably mmap() PCI memory space?
    I know that some people will argue this is a contradiction in terms, but with
    the right limitations (e.g. only 32-bit access) and a conforming PCI
    implementation (non of this non-cache-coherent nonsense) it should be

    As an example, here's my 2.2 x86 code:

    pci_read_config_dword(dev->pci_dev, PCI_BASE_ADDRESS_2,

    my_mmap(struct file *filp, struct vm_area_struct *vma) {
    addr = (unsigned long)(dev->bus_addrs[2] + x);
    // make sure the page is non cacheable
    mod_pgprot.pgprot = (vma->vm_page_prot.pgprot | _PAGE_PCD);
    if (remap_page_range(vma->vm_start, addr, DOORBELL_SIZE, mod_pgprot))
    return -EAGAIN;

    My belief is that remap_page_range always takes a host physical address, and
    so this works because PCI addresses are mapped directly into CPU physical
    addresses on x86. However, this would suggest that you could fix this code
    on alpha by adding 'addr = virt_to_phys(bus_to_virt(addr))', but you can't.

    I currently have a really gross hack someone gave me for alpha:

    #define BASE2PHYS(a) __pa(dense_mem(a)+((a)&0xffffffffUL))
    addr = BASE2PHYS(dev->bus_addrs[2] + x);

    (actually, as I type this I'm wondering if the problem is that I'm using
    pci_read_config_dword instead of pci_dev->base_address[2]...)

    Peter Desnoyers
    162 Pleasant St. (617) 661-1979
    Cambridge, Mass. 02139 (978) 461-0402 (work)

    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to
    Please read the FAQ at

     \ /
      Last update: 2005-03-22 13:54    [W:0.021 / U:7.864 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site