Subject: Re: New pseudo bus, new device
To: Gary Thorpe <gat7634@hotmail.com>
From: Bill Studenmund <wrstuden@netbsd.org>
List: tech-kern
Date: 05/08/2002 10:08:24
On Tue, 7 May 2002, Gary Thorpe wrote:

> Hi,
>
> I am currently porting the ppc driver from FreeBSD to NetBSD (this is a low

Is there another name that would work? ppc is also PowerPC, the cpu family
used in all of the arch/powerpc-based ports.

> level driver for a AT-style parallel port chipset). While this work is
> progressing nicely (device can be probed, attached and configured for
> generic chipsets), it is still ongoing (specific chipset probes are not used
> right now). The ppc driver is MI as far as I can tell (currently this ppc
> device exists on the ISA bus, because that is my machines setup). I believe
> 'AT-style' parallel ports do exist on non-x86 machines (some alphas).

Cool!

> My main concern is the next major step in porting. I am at a loss on how to
> implement the ppbus 'pseudo' bus on top of this ppc device. The ppbus bus is
> used by almost all of the higher level drivers in the FreeBSD code, so
> reusing it is critical to port these drivers over (the drivers include lpt,
> iomega zip, ieee 1248, and PLIP). The reason this code is worth porting over
> is because NetBSD's current lpt support only supports centronics mode
> printers, while the FreeBSD code can use newer standards and support faster
> devices (as well as PLIP, which may be useful for systems with limited
> communications options).
>
> I am trying to look at ATAPI and SCSI for examples of higher level buses
> which 'attach' to lower level devices, but I am wondering if there is any
> standard/specific way to accomplish this on NetBSD. I would appreciate any
> comments, suggestions or indications on how to proceed.

One of the things ATAPI and SCSI (and PCI) have going on is they are
direct-config busses. That means you know what slots/locations you have to
look in. You probe scsi target 0, then target 1, then target 2, ... Or pci
slot 0, slot 1, slot 2. Or ATA master, then slave. The way probing works
is the bus does some probe (gets scsi ident info for instance), then hands
that to the probe routines. They look at it and decide if it fits. They
return a "wuality of fit" number, and the device with the best fit wins.

I'm not sure if that's what you want. Check out man 9 autoconf. I think
you want an indirect config bus, which is like isa. In that case, each
device (lpt, plip, etc.) is supposed to figure out if it should attach or
not. Given what you're doing, they should all choose to attach.

Hope that helps.

Take care,

Bill