tech-kern archive

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

GPIO revisited

NetBSD has had support for General Purpose Input/Output devices since the 4.0 release, when the GPIO framework from OpenBSD 3.6 was imported. Since the import of the GPIO framework into NetBSD, I have reworked larger parts of that subsystem in OpenBSD to address some problems and drawbacks (see for motivation and details).

I have now prepared these changes and more for NetBSD and continued to improve on them. The new GPIO framework retains backwards compatibility while adding new features: it integrates with the kauth(9) security framework, has it's own config file format gpio.conf(5), and integrates with the system startup scripts in /etc/ rc.d.

As the old API has been kept for backwards compatibility, a new API has been introduced, which means that we will loose compatibility with OpenBSD on the API level, the command line interface, however, is the same (for now).

Over the last weeks I have discussed my work with tron, tonnerre, dyoung, wiz, and jmcneill (thanks, guys!). The diff has gone through several iterations already and is commit-ready, imo. Nevertheless I want to give you an opportunity to look at it and comment on it before I finally commit it.

The most preeminent changes from a user perspective are...
... a much more natural command line syntaxt, e.g. "# gpioctl gpio0 error_led on" and a configuration file /etc/gpio.conf

The most preeminent change from a technical level is...
... that drivers using gpio pins can be attached (and detached) at runtime, no longer a custom kernel configuration is needed. e.g "# gpioctl gpio0 attach gpioow 6 1"

The most preeminent change from a security point of view is...
... that the gpio layout can be locked by integration with the kauth(9) framework, preventing layout changes at securelevel > 0 (securlevel being handled through the securelevel kauth module)

The diff itself can be found online at . I have left older versions of the diff there as well for your amusement. Apply it against NetBSD -current.

Please make sure that you also check for higher numbered gpio diffs, as I might put a new diff online if I have to change sth. Stay tuned to ;)

- Marc Balmer

Home | Main Index | Thread Index | Old Index