Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 2 Jan 2008 13:03:31 -0500
From:      John Baldwin <jhb@freebsd.org>
To:        Marcel Moolenaar <xcllnt@mac.com>
Cc:        freebsd-embedded@freebsd.org
Subject:   Re: ocpbus(4)
Message-ID:  <200801021303.39518.jhb@freebsd.org>
In-Reply-To: <3FAE3F14-C1B6-41BB-8DB0-A88C1DD09F66@mac.com>
References:  <CC4D41C0-7CD7-47A8-8DA0-523B38C65B9A@mac.com> <20080101.184909.195750479.imp@bsdimp.com> <3FAE3F14-C1B6-41BB-8DB0-A88C1DD09F66@mac.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200801021303.39518.jhb>