Subject: Re: how to allocate physically contiguous memory?
To: None <gallatin@cs.duke.edu, port-alpha@NetBSD.ORG>
From: Ross Harvey <ross@teraflop.com>
List: port-alpha
Date: 05/07/1997 17:33:48
> Andrew Gallatin writes:
>
> ...allocating physically contiguous memory
>
>> Jason R. Thorpe writes:
>>
>> Eventually, you will call bus_dmamem_alloc() with the appropriate
>> constraints, and then bus_dmamem_map() to map it into kva space
>> (or allow the driver's mmap entry point to call bus_dmamem_mmap() to
>> map it into user space :-)
>>
>> ...but for now, you'll be calling vm_page_alloc_memory() and then
>> a loop around pmap_enter() (note, I don't call it contig anything,
>> since the API allows the caller to specifiy a maximum segment
>> count...)
Yes, you really do want the coming bus_dmamem_alloc() and other busdma
stuff. But given that you use a "but for now" technique in the present,
you could just grab it off the top of ram using an alpha-specific
procedure and take advantage of the kernel superpage. It takes about
three lines of code and uses no system (pmap) resources. Go see:
arch/alpha/alpha/machdep.c file
alpha_init() function
valloc() macro
And put a couple of goto's in while you are at it to annoy the purists. :)
------------------------------
Ross Harvey Avalon Computer Systems, Inc.
ross@teraflop.com