Writing Device Drivers

Exclusive Use of DDI Access Handles

All programmed I/O (PIO) access by a hardened driver must use DDI access functions from the ddi_get, ddi_put, ddi_rep_get, and ddi_rep_put families of routines. It should not directly access the mapped registers by the address returned from ddi_regs_map_setup(9F). Using an access handle ensures that an I/O fault is controlled and its effects confined to the returned value, rather than possibly corrupting other parts of the machine state. (Avoid the ddi_peek(9F) and ddi_poke(9F) routines because they do not use access handles.)

The DDI access mechanism is important because it provides an opportunity to control how data is read into the kernel. DDI access routines provide protection by constraining the effect of bus timeout traps.