Subject: Re: Various NetBSD kernel questions to help with port of FreeBSD "zaptel" drivers.
To: Jeff Rizzo <riz@redcrowgroup.com>
From: Greg Troxel <gdt@ir.bbn.com>
List: tech-kern
Date: 11/08/2004 08:44:30
  Under FreeBSD (and I assume Linux, though I haven't worked directly
  with the Linux drivers), the drivers are in kernel modules which get
  loaded; the zaptel module first, then the hardware drivers (like the
  "wcfxs," which is the one I'm working with now). If I'm
  understanding the setup correctly, the hardware drivers (wcfxs, etc)
  don't actually have their own cdevsw structures, since they register
  with zaptel, and zaptel dispatches the various calls (open, close,
  ioctl, etc), to the appropriate hardware.  I've initially tried to
  set "zaptel" up as a pseudo-device, but now I'm running into trouble
  because pseudo-devices attach _after_ all the hardware has probed,
  so my hardware isn't being attached.

This sounds like it is asking for trouble and not aligned with how
NetBSD would like to do this.  I can see two ways that might work:

The cleanest way: make the actual lower-level drivers have softcs, and
make the upper layer into a pseudo-driver kind of like scsibus, usb,
audio, atabus, pcmcia, etc.

The expedient way: Mark the upper driver as a real device, and have it
pretend it always has hardware, but marked not present at attach time.
Then the other ones can mark it present and dispatch the calls.
You may have to bugger something up to get the probe order to be
right, since there won't be a device attachment tree reason to force
it.

-- 
        Greg Troxel <gdt@ir.bbn.com>