Linux Kernel Architecture

(Jacob Rumans) #1

Chapter 6: Device Drivers


❑ Mass storage (PCI_BASE_CLASS_STORAGE)

❑ SCSI controller (PCI_CLASS_STORAGE_SCSI)
❑ IDE controller (PCI_CLASS_STORAGE_IDE)
❑ RAID controller (to combine multiple disk drives) (PCI_CLASS_STORAGE_RAID)

❑ Network (PCI_BASE_CLASS_NETWORK)

❑ Ethernet (PCI_BASE_NETWORK_ETHERNET)
❑ FDDI (PCI_BASE_NETWORK_FDDI)

❑ System components (PCI_BASE_CLASS_SYSTEM)

❑ DMA controller (PCI_CLASS_SYSTEM_DMA)
❑ Real-time clock (PCI_CLASS_SYSTEM_RTC)

The six base address fields each comprise 32 bits and are used to define the addresses for communication
between the PCI device and the rest of the system. When 64-bit devices are involved (as can happen
on Alpha and Sparc64 systems), two base address fields are always merged to describe the position in
memory; this halves the number of possible base addresses to three. As far as the kernel is concerned, the
only remaining field of any relevance is the IRQ number, which can accept any value between 0 and 255
to specify the interrupt used by the device. A value of 0 indicates that the device does not use interrupts.

Even though the PCI standard supports up to 255 interrupts, the number that can
actually be used is generally limited by thespecific architecture. Methods such as
interrupt sharing (discussed in Chapter 5) must then be employed on such systems
to support the use of more devices than there are IRQ lines.

The remaining fields are used by the hardware and not by the software so I won’t bother explaining their
meanings.

Implementationin the Kernel


The kernel provides an extensive framework for PCI drivers that can be roughly divided into two cate-
gories.

❑ Initialization of the PCI system (and, depending on system, the assignment of resources)
together with the provision of corresponding data structures to reflect the contents and
capabilities of the individual buses and devices so that they can be manipulated easily
❑ Standardized function interfaces to support access to all PCI options

PCI system initialization sometimes differs greatly between the individual system types. For example,
IA-32 systems allocate all relevant PCI resources themselves with the help of the BIOS at boot time so
that there’s little left for the kernel to do. As Alpha systems have no BIOS nor any suitable equivalent,
this must be done manually by the kernel. Consequently, when describing the relevant data structures
in kernel memory, I shall make the assumption that all PCI devices and buses have already been fully
initialized.
Free download pdf