Subject: Importing FreeBSD drivers
To: None <tech-kern@netbsd.org>
From: Peter Seebach <seebs@plethora.net>
List: tech-kern
Date: 09/15/2006 13:38:48
Hi!  I am trying to import some drivers from FreeBSD.  (The zaptel drivers
used by Asterisk, specifically).  There's a pkgsrc version which is too old
for my hardware, and the driver was refactored enough to make it easier to
redo the port.  The driver comes as kernel modules; one generic module that
manages the devices the others provide, then a number of device-specific
modules that find hardware and register with it.

The problem I'm getting is that my actual hardware driver gets weird kernel
panics when loaded; for instance, the most recent time I loaded it, it paniced
somewhere in the scsipi code.  I have formed a theory:  There is something
that should be being done during the probe to suppress interrupts, or to
account for them, which is not happening.

Is there some obvious thing I should know about importing FreeBSD drivers,
such as "oh, yes, always put dont_crash(); ... crash_if_you_must(); wrappers
around the guts of the attach routine"?

-s