Subject: Re: more questions: interrupt level, and vtophys() equivalent
To: Jeff Rizzo <>
From: Jochen Kunz <>
List: tech-kern
Date: 11/11/2004 10:48:23
On Wed, 10 Nov 2004 13:10:18 -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.=20
The general rule is to block interrupts in the driver only for a small
amount of time. Try to keep the time the interrupt handler needs for
processing the interrupt as short as possible. A running interrupt
handler blocks all other interrupts of this and lower levels. If you
need lots of time for processing data in the interrupt handler I sugest
to split the interrupt handler. One small part that services the
hardware and puts requests into a queue and the larger part that
processes this requests out of the queue as a software interrupt.
Network interface card drivers do this.

> so I somewhat arbitrarily chose=20
> IPL_BIO, knowing that in all likelihood I'd need to change it.
IPL_AUDIO looks OK to me, as this is more or less some type of audio
interface and thus needs high priority.

> Also, there's one other (obvious) wart in the code right now - the=20
> FreeBSD code uses vtophys() to get the DMA address to write to the=20
> card...
Does it write to DMA descriptors in RAM or does it use vtophys() to get
the address of the registers of the chip, so that it can write to the
chip registers directely? Most likely you want to convert this to proper
bus_space_read/write(9) calls. Or you can use bus_space_map(9) with
BUS_SPACE_MAP_LINEAR and later bus_space_vaddr(9) instead vtophys().