tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Inter-driver #if dependencies



On Thu, May 21, 2015 at 11:25:03AM +0800, Paul Goyette wrote:
> On Tue, 19 May 2015, Quentin Garnier wrote:
> 
> > On Tue, May 19, 2015 at 12:12:17AM +0000, Taylor R Campbell wrote:
> >>    Date: Tue, 19 May 2015 06:57:44 +0800 (PHT)
> >>    From: Paul Goyette <paul%vps1.whooppee.com@localhost>
[...]
> >> But I'm not sure a generic autoconf mechanism is warranted for such
> >> glue.  Better to identify working solutions for specific cases and
> >> then generalize, rather than start with a super-generic mechanism
> >> before it has been demonstrated to work well in any specific case.
> >
> > I think a generic autoconf mechanism would be welcome to be able to
> > discover devices and walk down a firmware-provided device tree at the
> > same time.  That would save a lot of the register_device(9) (or
> > whatever that API is called) magic where every time the arch-specific
> > code has to enumerate the device tree to find the matching device and
> > get information.
> 
> register_device(9) == config_found_ia() perhaps

I meant device_register().  It's an arch-dependent callback called after
each attach.  Look at what the archs that implement it do with it.  If
somehow autoconf(9) could interface with an essentially MD device tree,
it would simplify a lot all that code.

Back when I was thinking about autoconf(9), I had 3 main goals:
  - don't do recursion, which means that instead of having
    config_found(9) try and attach a driver, the parent will just get
    a device_t back, which is all it needs, and later autoconf(9) will
    see if it can attach a driver to it, and so on.  It makes direct
    configuration buses a lot saner (and think in terms of loadable
    modules too).  And of course it's easier on the stack.
  - allow for something you could call a co-driver.  A piece of code
    that would attach to an aspect of a piece of hardware.  Look at all
    the PCI-to-PCI or LPC bridges in the x86 world to see where that
    comes from.
  - allow descending a MD device tree along with the device discovery
    done by drivers through autoconf(9)

-- 
Quentin Garnier - cube%cubidou.net@localhost
"See the look on my face from staying too long in one place
[...] every time the morning breaks I know I'm closer to falling"
KT Tunstall, Saving My Face, Drastic Fantastic, 2007.

Attachment: pgpD4E8aOix9J.pgp
Description: PGP signature



Home | Main Index | Thread Index | Old Index