The
gpio device attaches to the GPIO controller and provides a uniform programming interface to its pins.
Each GPIO controller with an attached
gpio device has an associated device file under the
/dev directory, e.g.
/dev/gpio0. Access from userland is performed through
ioctl(2) calls on these devices.
Whether the layout of the GPIO device can be configured is subject to authorization by the
kauth(9) framework.
If for example
secmodel_securelevel(9) is active, the layout of the GPIO device is defined at a securelevel less than 1, i.e. typically during system boot, and cannot be changed later. GPIO pins can be configured and given a symbolic name and device drivers that use GPIO pins can be attached to the
gpio device at a securelevel less than 1. All other pins will not be accessible once the runlevel has been raised.