PCI Functions Reference ======================= .. c:type:: pci_bus .. c:type:: u8 .. c:type:: u16 .. c:type:: u32 .. _pci_functions: This document provides a reference for various PCI-related functions and macros in the Linux kernel. Structures ---------- .. c:struct:: pci_dev Represents a PCI device within the kernel. .. c:struct:: pci_driver Represents a PCI driver. .. c:struct:: pci_device_id Represents a PCI device ID. Macros ------ .. c:macro:: PCI_DEVICE(vendor, device) Creates a ``pci_device_id`` structure that matches specific vendor and device IDs. :param vendor: Specific vendor ID that supports the driver. :type vendor: ``__u32`` :param device: Specific device ID that supports the driver. :type device: ``__u32`` .. c:macro:: PCI_DEVICE_CLASS(device_class, device_class_mask) Creates a ``pci_device_id`` structure that matches specific PCI class. :param device_class: Specific device class that supports the driver. :type device_class: ``__u32`` :param device_class_mask: Specific device mask that supports the driver. :type device_class_mask: ``__u32`` .. c:macro:: MODULE_DEVICE_TABLE(pci, structListAlias) Exports the ``pci_device_id`` structure to user space to allow hotplug and module loading. :param pci: Driver or module. :param structListAlias: Hardware device. Specific driver alias definition (e.g., ``intel_*``, ``amd_*``). Functions --------- .. c:function:: int pci_register_driver(pci_driver *drv) Registers a PCI driver with the kernel. .. c:function:: int pci_module_init(pci_driver *drv) Initializes a PCI module. .. c:function:: int pci_unregister_driver(pci_driver *drv) Unregisters a PCI driver from the kernel. .. c:function:: pci_dev *pci_find_device(unsigned int vendor, unsigned int device, pci_dev *from) Searches the device list for a specific device. .. c:function:: pci_dev *pci_find_device_reverse(unsigned int vendor, unsigned int device, const pci_dev *from) Searches the device list in reverse for a specific device. .. c:function:: pci_dev *pci_find_subsys(unsigned int vendor, unsigned int device, unsigned int ss_vendor, unsigned int ss_device, const pci_dev *from) Searches the device list for a specific subsystem. .. c:function:: pci_dev *pci_find_class(unsigned int class, pci_dev *from) Searches the device list for a specific class. .. c:function:: pci_dev *pci_get_device(unsigned int vendor, unsigned int device, pci_dev *from) Searches the device list for a device with a specific signature. .. c:function:: pci_dev *pci_get_subsys(unsigned int vendor, unsigned int device, unsigned int ss_vendor, unsigned int ss_device, pci_dev *from) Searches the device list for a subsystem with a specific signature. .. c:function:: pci_dev *pci_get_slot(pci_bus *bus, unsigned int devfn) Retrieves a device from a specific slot. .. c:function:: int pci_user_read_config_byte(pci_dev *dev, int where, u8 *val) Reads a byte from a PCI configuration register. .. c:function:: int pci_user_read_config_word(pci_dev *dev, int where, u16 *val) Reads a word from a PCI configuration register. .. c:function:: int pci_user_read_config_dword(pci_dev *dev, int where, u32 *val) Reads a double word from a PCI configuration register. .. c:function:: int pci_user_write_config_byte(pci_dev *dev, int where, u8 *val) Writes a byte to a PCI configuration register. .. c:function:: int pci_user_write_config_word(pci_dev *dev, int where, u16 *val) Writes a word to a PCI configuration register. .. c:function:: int pci_user_write_config_dword(pci_dev *dev, int where, u32 *val) Writes a double word to a PCI configuration register. .. c:function:: int pci_enable_device(pci_dev *dev) Enables a PCI device. .. c:function:: unsigned long pci_resource_start(pci_dev *dev, int bar) Retrieves the start address of a PCI resource. .. c:function:: unsigned long pci_resource_end(pci_dev *dev, int bar) Retrieves the end address of a PCI resource. .. c:function:: unsigned long pci_resource_flags(pci_dev *dev, int bar) Retrieves the flags of a PCI resource.