Linux Kernel Architecture

(Jacob Rumans) #1

Chapter 6: Device Drivers


Table 6-4: Functions for Accessing I/O Ports.

Function Meaning

insb(port, addr, num)

insl(port, addr, num)

insw(port, addr, num) Readsnumbytes, words, or longs from portportto the addressaddr
of the regular address space.

outsb(port, addr, num)

outsb(port, addr, num)

outsb(port, addr, num) Writesnumbytes, words, or longs from the virtual addressaddrto the
portport.

The functions are declared and implemented (usually by means of access to
‘‘normal‘‘ I/O memory) even on architectures that make no use of ports in order to
simplify driver development for various architectures.

6.7 Bus Systems


Whereas expansion devices are addressed by device drivers that communicate with the remaining code
only via a fixed set of interfaces and therefore have no effect on the core kernel sources, the kernel is
also responsible for a more basic issue —howdevices are attached to the rest of the system by means of
buses.

Bus drivers are much more closely linked with the central kernel code than drivers for specific devices can
ever be. Also, there is no standardized interface via which a bus driver makes its functions and options
available to associated drivers. This is because the hardware techniques used differ greatly between the
various bus systems. However, this does not mean that the code responsible for managing the different
buses has no commonalities. Similar buses adopt similar concepts, and the genericdriver modelhas been
introduced to manage all system buses in a collection of central data structures, reducing them as far as
possible to the smallest common denominator.

The kernel supports a large number of buses, sometimes on several hardware platforms, sometimes on
just a single platform. It is therefore impossible to discuss all versions in detail. I shall therefore limit us
to a close examination of the PCI bus since its design is relatively modern, it features all the common and
key elements of a powerful system bus, and it is used on most architectures supported by Linux. I shall
also discuss the widely used and system-independent USB for external peripherals.^18

(^18) Whether this is a classical bus is a matter of controversy because USB does not offer the functionality of asystembus but is reliant
on an additional distribution mechanism ‘‘within the computer.’’ I take a pragmatic approach and am little concerned with this con-
troversial issue.

Free download pdf