DMA'ing into physical memory set aside during boot

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I am looking into a driver that works fine on 2.4, and
trying to port it to 2.6.

Allow me to explain the part of the driver that is
relevant to my posting.  The linux system has 512 MB. 
Through kernel command line (mem=448M), the kernel is
using only 448 MB (setting aside 64 MB).  The driver
uses the 64 MB to do DMA to/from.  

Following is the assumption and technique it uses:

0x1c000000 = 448 MB  = start address of 64 MB memory
Size = 64 MB
int * cpuAddr = ioremap ( 0x1c000000)

Assuming the driver wants to DMA from offset 0x1000 of
the 64MB memory, of size 0x400.  Before doing DMA, it
initializes varable of type scatterlist as follows:

scatterlist.address =  cpuAddr + 0x400   <----------
scatterlist.size = 0x400
scatterlist.dma_address = 0x1c000000 + 0x400

>From the above, I am guessing the code makes the
assumption (and correctly so, as it works fine) that
the starting DMA address of the 64 MB memory is
0x1c000000.  Ofcourse the code assuemes that the 64MB
is set aside in low memory.  Please note that the
above code is not my code, just code I am looking
into.

On 2.6, there is no more scatterlist.address.  To port
the driver to 2.6, I replaced the line above with the
arrow as follows:

scatterlist.page  = virt_to_page(cpuAddr + 0x400)
scatterlist.ofset = (cpuAddr + 0x400) & (~PAGE_MASK)
 
And I am guessing the assumption of 0x1c000000 as the
starting DMA address of the 64 MB is not right.  When
the the device that is trying to DMA from this
address, it crashes.

Can someone please help me with the following:

1. The device does not always fail when doing reads,
but fails very soon after a few transactions?  Any
idea as to why the drivers evens works sometimes on
2.6.

2. How can I find out the DMA address of offset 0x1000
into the 64 MB memory?  Should I use pci_map_single()
?  If so, what do I pass it?

3. How can I properly initialize the scatterlist
element?

Thank you,
Ahmed.



		
__________________________________ 
Do you Yahoo!? 
All your favorites on one personal page ? Try My Yahoo!
http://my.yahoo.com 

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/




[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux