Virtual To Physical Address - Embedded

This is a discussion on Virtual To Physical Address - Embedded ; Hello, I am writing one wireless AP driver for Atheros board with AR5312 processor which is having mips 4kc core running on linux,where AR5212 controller is used to drive the ROCs. Here in xmit part I need to put the ...

+ Reply to Thread
Results 1 to 4 of 4

Thread: Virtual To Physical Address

  1. Virtual To Physical Address

    Hello,
    I am writing one wireless AP driver for Atheros board with AR5312
    processor which is having mips 4kc core running on linux,where AR5212
    controller is used to drive the ROCs. Here in xmit part I need to put
    the Descriptor Queue header in to the QCU block of the AR5212 MAC. The
    address I supposed to put is physical address of Descriptor Head
    Queue. I need help to convert the virtual address to physical address.
    thanks in advance
    Prakash

  2. Re: Virtual To Physical Address

    In article , prakash_bunks@rediffmail.com (prakash B) writes:
    > Hello,
    > I am writing one wireless AP driver for Atheros board with AR5312
    > processor which is having mips 4kc core running on linux,where AR5212
    > controller is used to drive the ROCs. Here in xmit part I need to put
    > the Descriptor Queue header in to the QCU block of the AR5212 MAC. The
    > address I supposed to put is physical address of Descriptor Head
    > Queue. I need help to convert the virtual address to physical address.
    > thanks in advance


    Is virt_to_bus() not giving you what you need ?

    Don't forget to pass a virtual address that's suitable for DMA operations.
    On x86, I use __get_free_page() for this purpose.

    You can find the LDD book online at:

    http://www.xml.com/ldd/chapter/book/

    Simon.

    --
    Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP
    Microsoft: The Standard Oil Company of the 21st century

  3. Re: Virtual To Physical Address

    clubley@remove_me.eisner.decus.org-Earth.UFP (Simon Clubley) wrote in message news:...
    > In article , prakash_bunks@rediffmail.com (prakash B) writes:
    > > Hello,
    > > I am writing one wireless AP driver for Atheros board with AR5312
    > > processor which is having mips 4kc core running on linux,where AR5212
    > > controller is used to drive the ROCs. Here in xmit part I need to put
    > > the Descriptor Queue header in to the QCU block of the AR5212 MAC. The
    > > address I supposed to put is physical address of Descriptor Head
    > > Queue. I need help to convert the virtual address to physical address.
    > > thanks in advance

    >
    > Is virt_to_bus() not giving you what you need ?
    >
    > Don't forget to pass a virtual address that's suitable for DMA operations.
    > On x86, I use __get_free_page() for this purpose.
    >
    > You can find the LDD book online at:



    Thanks Simon,
    I have used one function pci_alloc_consistent() which does the the
    same functionality what u have said above. But I didn't understand
    that DMA needs virtual address that's suitable for DMA operation,
    please give me detail's abt it. Here I am using Mips processor.

    Prakash.
    >
    > http://www.xml.com/ldd/chapter/book/
    >
    > Simon.


  4. Re: Virtual To Physical Address

    In article , prakash_bunks@rediffmail.com (prakash B) writes:
    > clubley@remove_me.eisner.decus.org-Earth.UFP (Simon Clubley) wrote in message news:...
    >>
    >> Is virt_to_bus() not giving you what you need ?
    >>
    >> Don't forget to pass a virtual address that's suitable for DMA operations.
    >> On x86, I use __get_free_page() for this purpose.
    >>

    >
    > Thanks Simon,
    > I have used one function pci_alloc_consistent() which does the the
    > same functionality what u have said above. But I didn't understand
    > that DMA needs virtual address that's suitable for DMA operation,
    > please give me detail's abt it. Here I am using Mips processor.
    >


    Some devices require that the DMA buffers be aligned on some boundary
    (for example page aligned). For example, UHCI controllers require that
    the frame page be aligned on a 4096 byte boundary, and the transfer
    descriptors/queue headers to be aligned on 16 byte boundaries.

    If the device doing DMA needs to transfer more than one page of memory at
    a time, it can also require that the pages be physically contiguous instead
    of just virtually contiguous. That requires operating system support, (in
    the case of Linux that's by using routines such as __get_free_pages()) and
    means that you cannot, for example, just define a large array within your
    driver and take the physical address of the array's base.

    Finally, assuming that you have taken care of alignment and any possible
    contiguous memory issues, you still need to pass an address that will not
    be paged out by the kernel while the DMA is in progress. (You can't, for
    example, DMA directly into a user space buffer unless you have locked down
    the buffer.)

    The pci_alloc_consistent()/__get_free_page[s]() routines handle all this
    for you.

    Simon.

    --
    Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP
    Microsoft: The Standard Oil Company of the 21st century

+ Reply to Thread