Linux Kernel Architecture

(Jacob Rumans) #1

Chapter 6: Device Drivers


Configuration Information


In contrast to many of its predecessors, the PCI bus is a jumper-free system. In other words, expansion
devices can be fully configured by software means and without user intervention.^22 To support such
configuration, each PCI device has a 256-byte-long configuration space with information on the special
characteristics and requirements of the device. Even though 256 bytes may at first appear to be a paltry
figure given current memory configuration levels, a large amount of information can be stored, as shown
in Figure 6-23, which illustrates the layout of the configuration space as required by the PCI specification.

BIST

Base address 0 Base address 1 Base address 2 Base address 3

Base address 4 Base address 5 CardBus CISPointer SubsystemVendor ID SubsystemDevice ID

Expansion ROM
base address Reserved

IRQ
Line

IRQ
Pin

Min
Gnt

Max
Lat

Vendor
ID

Device
ID

Cmd
Reg

Status
Reg RevIDClass Code CacheLineLatencyTimerHeaderType

012 345 678 910111213141516

0–16

16–32

32– 45

48– 64

Figure 6-23: Layout of the PCI configuration space.

Although the structure must be 256 bytes in length, only the first 64 bytes are
standardized. The remainder are freely available and are typically used to exchange
additional information between the device and the driver. The structure of this
information is (or should be) defined in thehardware documentation. It should also
be noted that not all information in the first 64 bytes is mandatory; some items are
optional and may be filled with zeros if they are not required by a device. The
mandatory items are highlighted in darker gray in the figure.

Thevendor IDanddevice IDuniquely identify the vendor and device type. Whereas the former is assigned
by the PCI Special Interest Group (an industry consortium) to identify individual companies,^23 the latter
can be freely selected by the vendors — they alone are responsible for ensuring that there are no overlaps
in their address space. Taken together the two IDs are often referred to as thesignatureof a device. Two
additional fields with similar names —subsystem vendor IDandsubsystem device ID — may also be used
to more accurately describe generic interfaces. Therevision IDenables a distinction to be made between
various device revision levels. This helps users select device driver versions where known hardware
faults have been eliminated or where new features have been added.

Theclass codefield is used to assign devices to various function groups and is split into two parts. The
first 8 bits indicate the base class and the remaining 16 bits a subclass of the base class. Examples of
base classes and their subclasses are given below (I use the names of the corresponding constants in
<pci_ids.h>).

(^22) Some readers may well remember the ISA ‘‘game‘‘ where the cards, mostly miserably documented, were configured by manually
adjusting resources by means of jumpers.
(^23) The ID for Intel is0x8086...

Free download pdf