Quick Reference

This section, as usual, summarizes the symbols introduced in the chapter.

#include <linux/config.h> , CONFIG_PCI

This macro should be used to conditionally compile PCI-related code. When a PCI module is loaded to a non-PCI kernel, insmod complains about several symbols being unresolved.

#include <linux/pci.h>

This header includes symbolic names for the PCI registers and several vendor and deviceID values.

#include <linux/bios32.h>

All the pcibios_ functions listed below are prototyped in this header.

int pcibios_present(void);

This function returns a boolean value that tell whether the computer we’re running on has PCI capabilities or not.

int pcibios_find_device (unsigned short vendor, ,                          unsigned short id, ,                          unsigned short index, ,                          unsigned char *bus, ,                          unsigned char *function); , int pcibios_find_class (unsigned int class_code, ,                         unsigned short index, ,                         unsigned char *bus, ,                         unsigned char *function);

These functions are used to query the PCI firmware about the availability of devices featuring a particular signature or belonging to a particular class. The return value is an error indication, and in case of success, bus and function are used to store the position of the device. index must be passed as 0 the first time and incremented each time a new device is looked for.

PCIBIOS_SUCCESSFUL ...

Get Linux Device Drivers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.