Subject: Re: more questions: interrupt level, and vtophys() equivalent
To: Jeff Rizzo <>
From: Frank van der Linden <>
List: tech-kern
Date: 11/10/2004 22:29:44
On Wed, Nov 10, 2004 at 01:10:18PM -0800, Jeff Rizzo wrote:
> I'm noticing some timeouts on my ethernet card when booting with the new 
> kernel, so I suspect I may have mis-chosen the interrupt level, or 
> perhaps I'm doing something wrong in the interrupt handler.   My cursory 
> reading of the literature leads me to believe that FreeBSD 5.2's 
> interrupt levels (the freebsd driver sets INTR_TYPE_MISC) don't 
> correspond directly to NetBSD's, so I somewhat arbitrarily chose 
> IPL_BIO, knowing that in all likelihood I'd need to change it.

If you're dealing with a network interface, IPL_NET is the level of choice.
> Also, there's one other (obvious) wart in the code right now - the 
> FreeBSD code uses vtophys() to get the DMA address to write to the 
> card... I suspect this will _work_, since I'm using an i386 here, but 
> from what I can glean from the source, it's not allowed for MI code - so 
> what's the bus_space (or is it bus_dma?) equivalent?

Yep.. use bus_dma all the way. If you have data structures that are directly
accessed by the card via DMA, allocate them as bus_dma memory, map them
in, etc. The easiest way to learn this is to look at other, similar device
source code. There are plenty of examples in sys/dev/ic.

- Frank