Subject: Re: LANCE (Am7990) DMA
To: Michael C. Richardson <>
From: Matthias Drochner <>
List: tech-net
Date: 10/11/1998 13:26:52
(Sorry if I missed something - have to catch up on >1000 mails.)

>   Give me an example driver that DMA directly to mbufs. I know I could pick
> one and it probably does, but I want to best example :-)

Imo dev/pci/if_fxp is a good example. I uses the bus_dma framework and
is structured in a straightforward way (and even has some comments!).

 >  I take it that a single instance of the lance driver won't have to do
> both? But that it may have to handle both a PCnet-ISA and a PCnet-PCI card
> in the same machine?

You should make sure that the common code does compile
even if the platform doesn't implement the bus_dma interface.
Whether DMA is used or not should probably be controlled
by function pointers, as the copy functions are done now.
(I wouldn't use more indirections than there are in the code

Perhaps some words to the code structure which got one more
dimension since I split the am7990 and am79900 code:
am7990 is the old LANCE chip with 16-bit descriptors (and
24-bit addressing capability). This driver part is used by all
"le" frontends in the tree except the PCI one.
am79900 handles the newer chips which can use 32-bit
descriptors and 32-bit DMA addresses. PCnet-PCI is the
only driver in the tree which uses it so far, but you can not
assume that all these chips can do direct DMA (tautology:-).
For instance: I've got some VME 68040 boards (FIC8234
from CES) which use the original am79c900 (aka ILACC)
chip. This one is not backward compatible, so it has to use
the 32-bit mode, and it uses a private memory buffer in the
FIC8234 implementation. Needless to say that I'm running
NetBSD on them...
So the "direct DMA" capability should be orthogonal to the
existing features. This looks quite like a challenge, but it is
certainly worth a try.

best regards