BSDCan2009 - Final Release

BSDCan 2009
The Technical BSD Conference

Speakers
John Baldwin
Schedule
Day Talks - 2 - 2009-05-09
Room MNT 201
Start time 15:00
Duration 01:00
Info
ID 118
Event type Lecture
Track Hacking
Language used for presentation English

Multiple Passes of the FreeBSD Device Tree

The existing device driver framework in FreeBSD works fairly well for many tasks. However, there are a few problems that are not easily solved with the current design. These problems include having "real" device drivers for low-level hardware such as clocks and interrupt controllers, proper resource discovery and management, and allowing most drivers to always probe and attach in an environment where interrupts are enabled. I propose extending the device driver framework to support multiple passes over the device tree during boot. This would allow certain classes of drivers to be attached earlier and perform boot-time setup before other drivers are probed and attached. This in turn can be used to develop solutions to the earlier list of problems.

A brief outline of the paper follows:

  • An overview of the existing single-pass system
  • Problems that are not easily solved in the current system
    • "Real" devices for low-level hardware such as clocks and interrupt controllers
    • Resource discovery and management (finally supporting "PnP OS = yes")
    • cold vs non-cold probing
  • Supporting multiple passes
    • Description of the current proposed passes
    • Easy to add new passes in the future similar to SYSINIT SISUB*
    • Most device drivers need no modification and attach in the final pass
    • Writing an early pass driver
    • Use EARLYDRIVERMODULE() instead of DRIVER_MODULE() to specify pass number
    • New semantics for busgenericprobe() and busgenericattach()
    • The BUSNEWPASS() method and busgenericnew_pass()
    • If the driver can be attached after boot (e.g. via kldload or hotplug) it must account for this in its attach routine
  • Possible solutions to the earlier list of problems
    • Use "early" drivers for clocks, interrupt controllers, etc.
    • Resource discovery
    • Use "early" drivers for buses and bridges
    • Possibly add new methods for determining resource requirements and assigning ranges to buses
    • Earlier scheduler start
    • Start up callouts before final pass