Subject: Re: VS3100 memory quirk
To: None <bertram@ifib.uni-karlsruhe.de>
From: Jason Thorpe <thorpej@nas.nasa.gov>
List: port-vax
Date: 01/14/1998 02:54:29
On Wed, 14 Jan 1998 11:13:24 +0100 
 Bertram Barth <bertram@ifib.uni-karlsruhe.de> wrote:

 > > > where you locate them?  I guess my question is, does NetBSD have the
 > > > facilities to allocate buffers in physical memory where you please?  If
 > > > not, how do you get around this problem? 
 > > > 
 > > 	The kernel could allocate the buffers anywhere it chooses... :)
 > > 	It may have been cleaner or easier to allocate the buffers at the
 > > 	top of memory.

This, BTW, is exactly the same problem as ISA DMA on the i386.  I suggest
the VAX port implement bus_dma(9).  That way the driver could simply allocate
DMA-safe memory.

If you don't want to implement bus_dma(9), then you can still allocate
memory in a specific range with a specific alignment (which I believe
is what you want to do... doesn't the LANCE buffer have to be aligned
to a 128k boundary?)

Use the function vm_page_alloc_memory().  It will allocate managed pages
conforming to a set of constraints.  You can then allocate some kernel
virtual address space for the pages, and map them in.  See the i386 port's
machdep.c, specifically the functions bus_dmamem_alloc() and bus_dmamem_map()
for how to do this sort of thing.  I wrote that code, so I can answer
questions you might have.

In any case, you'll want to completely remove the static allocation of the
LANCE's buffer.

Jason R. Thorpe                                       thorpej@nas.nasa.gov
NASA Ames Research Center                            Home: +1 408 866 1912
NAS: M/S 258-6                                       Work: +1 650 604 0935
Moffett Field, CA 94035                             Pager: +1 415 428 6939