Linux Kernel Architecture

(Jacob Rumans) #1

Device Drivers


Device drivers are a key area of the kernel as many users judge operating system performance
primarily by the number of peripherals for which drivers are available and how effectively they are
supported. Consequently, large parts of the kernel sources are devoted to the implementation of
device drivers.

Device drivers build on many different mechanisms provided by the central kernel (this is why
drivers are sometimes referred to as kernel ‘‘applications‘‘). The immense number of drivers in the
Linux kernel means that it is impossible to discuss all (or even a few) in detail. Fortunately, this
is not necessary. The structures of the drivers are generally very similar — regardless of device
— so that in this chapter we need only discuss a few key aspects common to all drivers. Since the
objective of this book is to cover all important parts of the kernel, this chapter omits some of the
more specific points of driver writing which would require a book of its own. However, two books
that focus solely on driver writing are currently available. The classic text in this area isLinux Device
Driversby Corbet et al. [CRKH05]. We can recommend it wholeheartedly to anyone interested
in or charged with writing a device driver. A recent addition to kernel hackers’ bookshelves is
Essential Linux Device Driversby Venkateswaran [Ven08]. Developers who are able to read German
will certainly also enjoyLinux Geratetreiber ̈ by Quade and Kunst [QK06]. The quoted references
are complementary to this book. Here, we documenthowthe kernel sets up and manages data
structures and generic infrastructure for device drivers. Also, we discuss routines that are provided
to support device drivers. Device driver books, on the other hand, focus on how tousethese routines
to actually create new drivers, but are not so muchinterested in how the underlying foundations
are implemented.

6.1 I/O Architecture


Communication with peripherals is usually referred to asinputandoutput, abbreviated I/O in the
literature. The kernel must deal with three problem areas when implementing I/O for peripherals.
Firstly, the hardware must be addressed using a variety of methods depending on the specific
Free download pdf