ocpbus(4)

John Baldwin jhb at freebsd.org
Wed Jan 2 10:05:36 PST 2008


On Tuesday 01 January 2008 11:47:59 pm Marcel Moolenaar wrote:
> On Jan 1, 2008, at 5:49 PM, M. Warner Losh wrote:
> > See devinfo -v on my system:
> >          isa0
> >            ppc0
> >            sc0
> >            sio1
> >            sio2
> >            sio3
> >            vga0
> >            orm0
> >
> > I do not have the sio or ppc drivers in my kernel at all, yet they
> > appear to be bound to nodes in the tree by virtue of the hints that
> > are present in device.hints.  This is what allows the drivers to
> > attach to nodes in the system if I were to dynamically load them.
> 
> Let me use the above to better express my philosophical approach:
> 
> The fact that that devinfo shows you that non-existent drivers are
> bound to newbus nodes is exactly the problem with hints. Pre-newbus
> the kernel configuration defined the instantiations and as such the
> list of drivers that were needed. Both (i.e. the drivers and their
> instantiations) came from a single description and could never be
> out of sync.
> Nowadays we have the drivers coming from the kernel configuration
> (or dynamically through module loading) and instantiations coming
> from the hints file. These two are typically out of sync with each
> other. If hints were tentative, then we wouldn't have newbus nodes
> for driver instantiations if the driver in question didn't exist.
> 
> It's fundamentally wrong to instantiate a driver that doesn't exist.
> I mean, what does that mean anyway?

Agreed, and device.FOO would create an unknownX device (much like unprobed 
PNPBIOS or ACPI-enumerated devices) with a set of properties (if the bus impl 
uses properties to create devices and doesn't use them purely as additional 
metadata).  For example, I actually figured that the default device.hints type 
stuff for COM1 would look like this:

device.COM1.at="isa"
device.COM1.port="0x3f8-0x3ff"
device.COM1.irq=4
device.COM1.pnpid="PNP0500"

which is what you get with ACPI/PnPBIOS.  On i386/amd64 users would probably 
wish to bind it using something like:

device.COM1.driver="sio"
device.COM1.unit=0

but it wouldn't be required.  Note that it would be nice to just 
say 'device.COM1.unit=0' and not specify a driver at all, but that would not 
be easy to implement in new-bus.

-- 
John Baldwin


More information about the freebsd-embedded mailing list