General porting question

Jacky Lam jackylam at astri.org
Fri Oct 10 01:36:07 EST 2003


> Almost.
>
> You can not use virt_to_* on the address returned by
> pci_alloc_consistent().

    Why?

    By the way, this problem will only affect the consistency of dma buffer.
In my case, it will only cause wrong output sound. But my card seems don't
consume the dma and doesn't give any interrupt in return. It's fine on PC
and I can receive interrupt if I write to the card's register to force an
interrupt. What other possible porting problem can be here? Really
strange....

>
> You need to hold on to the dma_addr_t returned, perform
> a bus_to_virt(dma_addr_t) and then a virt_to_* will work
> on that address.

    umm....then does   virt_to_phys(bus_to_virt(dma_addr_t))==dma_addr_t
                    or
                bus_to_virt(dma_addr_t)==pci_alloc_consistent() ?
>
> However, I'm not sure of the "PCI related memory space" you
> are referring to.  "PCI memory space" has a distinct meaning
> and the virt_to_*/*_to_bus APIs don't work there.  Those APIs
> are only valid for system memory that is accessible through
> inbound transactions by a PCI bus master.
>
> You can use virt_to_* on an address returned from kmalloc
> or __get_free_pages.

    I also don't understand....Could you or someone "invent" these things
kindly give some brief explaination here (especially for the reason how
consistent_alloc() is implemented)? I think it will benefit many PPC
beginner. Thanks very much.

Best regards,
Jacky


** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/





More information about the Linuxppc-embedded mailing list