Chapter 14. Newbus
_Special thanks to Matthew N. Dodd, Warner Losh, Bill Paul, Doug Rabson, Mike Smith, Peter Wemm and Scott Long_.
This chapter explains the Newbus device framework in detail.
Device Drivers
Purpose of a Device Driver
A device driver is a software component which provides the interface between the kernel's generic view of a peripheral (e.g., disk, network adapter) and the actual implementation of the peripheral. The _device driver interface (DDI)_ is the defined interface between the kernel and the device driver component.
Types of Device Drivers
There used to be days in UNIX(R), and thus FreeBSD, in which there were four types of devices defined:
block device drivers
character device drivers
network device drivers
pseudo-device drivers
_Block devices_ performed in a way that used fixed size blocks [of data]. This type of driver depended on the so-called _buffer cache_, which had cached accessed blocks of data in a dedicated part of memory. Often this buffer cache was based on write-behind, which meant that when data was modified in memory it got synced to disk whenever the system did its periodical disk flushing, thus optimizing writes.
Character Devices
However, in the versions of FreeBSD 4.0 and onward the distinction between block and character devices became non-existent.
Overview of Newbus
_Newbus_ is the implementation of a new bus architecture based on abstraction layers which saw its introduction in FreeBSD 3.0 when the Alpha port was imported into the source tree. It was not until 4.0 before it became the default system to use for device drivers. Its goals are to provide a more object-oriented means of interconnecting the various busses and devices which a host system provides to the _Operating System_.
Its main features include amongst others:
dynamic attaching