Subject: Re: How do I allocate physically contiguous RAM?
To: None <thorpej@nas.nasa.gov>
From: Bill Studenmund <wrstuden@loki.stanford.edu>
List: tech-kern
Date: 10/29/1997 20:34:44
> 
> On Wed, 29 Oct 97 12:37:28 WET 
>  Dave Huang <khym@bga.com> wrote:
> 
>  > I'm trying to write an ethernet driver, and would like to get a 32K
>  > chunk or so of page-aligned, physically contiguous memory (for DMA
>  > porpoises). Is there an easy way to do this? I took a look at the
>  > bus_dma stuff, but it looks like it's unimplemented on mac68k. I doubt
>  > if I have the skills to implement the bus_dma interface, so I'm
>  > looking for another way :)
> 
> You _really_ ought to implement bus_dma... For the mac68k port, you can
> probably steal the i386 _bus_dma_* functions (the ones that don't implement
> bounce buffers) and frob them only slightly.  If you want help with this,
> I would be more than happy to answer any questions you might have.
> 
> I'm encouraging you to do this because the interfaces to do what you
> want already exist, vm_page_alloc_memory() to allocate the raw unmapped
> memory, and kmem_alloc_pageable() and pmap_enter() to map it into virtual
> address space.  But, if you implemented this for your driver, you will
> have nearly implemented what bus_dma does!

I think Dave's hesitancy stemmed from the fact that any DMA engine
he's using is on the card, not on the motherboard. It's like bus
mastering in ISA (I think). How does one make such things re-usable
across a port? There are some serial cards which could use such support
if it ever gets in. :-)

Take care,

Bill