On Mon, Jan 5, 2009 at 8:56 PM, Om <[email protected]> wrote:
> Andrew Sterian wrote:
>> I'm developing a driver for an embedded ARM system (2.6.24 system) and
>> have 128M of RAM which I have been given free reign over. I want to
>
> How do you define this free reign? Who is managing it ? kernel?
Whatever works...I am using mmap() to map the data from kernel to user
so I guess the kernel has to manage it.
>> I have the driver working with 8k of RAM, simply using kmalloc(). My
>> efforts to scale up to 8M have failed.
>
> what I did was ioremap.
> My case:
> 1. m/c had 256M
> 2. Passed parameter mem=128M to limit what cpu sees.
> 3. used ioremap on 0xc800_0000 (32bit processor) for 128M
> 4. used the returned virtual address.
OK, I tried this and it somewhat works (with MEM=120M in a 128M
system, 120M offset is 0xC7800000):
addr = ioremap(0xC7800000, 8*1024*1024);
printk(KERN_NOTICE "%08X\n", addr);
Strange is that the value of 'addr' when printed is 0xC7700000, or 1M
lower than I asked for.
Now in my driver's mmap() function I write:
remap_pfn_range(vma, vma->vm_start,
__pa(addr) >> PAGE_SHIFT,
// ??? right ???
vma->vm_end - vma->vm_start,
vma->vm_page_prot);
The __pa() function returns 0x87700000 which I guess is right, except
for being 1M too low.
Is this the right way to do it?
> Make sure that your PCI address space starts well above the physical address
> present, so should the vmalloc_start address. I think you can change
> #defines for these if required to suit your need.
No PCI in this system and I have no idea what vmalloc_start address is :)
Thanks for your help.
--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to [email protected]
Please read the FAQ at http://kernelnewbies.org/FAQ