Skip to Content
Linux Device Drivers, Second Edition
book

Linux Device Drivers, Second Edition

by Jonathan Corbet, Alessandro Rubini
June 2001
Intermediate to advanced
592 pages
19h 20m
English
O'Reilly Media, Inc.
Content preview from Linux Device Drivers, Second Edition

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 device ID values.

int pci_present(void);

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

struct pci_dev; , struct pci_bus; , struct pci_driver; , struct pci_device_id;

These structures represent the objects involved in PCI management. The concept of pci_driver is new as of Linux 2.4, and struct pci_device_id is central to it.

struct pci_dev *pci_find_device(unsigned int vendor, unsigned int device, struct pci_dev *from); , struct pci_dev *pci_find_class(unsigned int class, struct pci_dev *from);

These functions are used to look up the device list looking for devices with a specific signature or belonging to a specific class. The return value is NULL if none is found. from is used to continue a search; it must be NULL the first time you call either function, and it must point to the device just found if you are searching for more devices.

int pci_read_config_byte(struct pci_dev *dev, int where, u8 *val); , int pci_read_config_word(struct pci_dev *dev, int where, u16 *val); , int pci_read_config_dword(struct ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Linux Device Drivers, 3rd Edition

Linux Device Drivers, 3rd Edition

Jonathan Corbet, Alessandro Rubini, Greg Kroah-Hartman

Publisher Resources

ISBN: 0596000081Supplemental ContentCatalog PageErrata