tech-kern archive

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

Some changes to autoconfiguration APIs

I’ve been noodling on some changes to the autoconfiguration APIs on the “thorpej-cfargs” branch for a little bit now, and I think it’s ready to merge in.  These changes simplify the API by removing a jumble of config_{search,found}_this_that_and_the_other_thing() and going back to just having config_search() and config_found(), but adding tag-value variadic arguments to pass along additional information when necessary.  This makes it easier to simplify the vast majority of call sites, while also making it easier to add additional parameters later as needed.

While there, I went though and cleaned up a bunch of cargo-culted code that was using more complex APIs than necessary, and added a config_probe() function to make it much more visibly clear then indirect vs direct configuration is happening (right now, config_probe() is just a wrapper of config_match(), but that is considered an implementation detail).

In addition to the general cleanup, I have other goals, here…

==> Make it easier to associate the device’s handle provided by OFW, API, FDT, whatever with the actual device that’s attached, in a generic, platform-neutral way.  I’ve included examples in thorpej-cfargs for ACPI and FDT platforms, macppc, and shark.

==> Make it easier to use those platform description schemes to enumerate devices in a platform-neutral way (SUPER useful for e.g. i2c and spi).

==> Make it possible for drivers to query properties in a way that’s much more generic than the thing that’s done with device_properties() today (which can only fetch properties that have been set in the properties dictionary).

This first round is pretty mechanical, although I have put some additional sanity checks into subr_autoconf.c to catch rule-breakers.  I’ve locally test-build just about everything, and booted several test systems.

-- thorpej

Home | Main Index | Thread Index | Old Index