PCI bus support in Linux kernel

โšฒ Most used API edit

๐Ÿ—๏ธ Acronyms:

  • ACPI - Advanced Configuration and Power Interface
  • ACS - Access Control Service
  • AER - Advanced Error Reporting port service
  • ASPM - Active State Power Management
  • EDR - Error Disconnect Recover
  • FLR - function level reset
  • HT - Hypertransport
  • BAR - Base Address Registers
  • BW - Bandwidth
  • DPC - Downstream Port Containment port service
  • EP - Endpoint
  • mmrbc - maximum memory read byte count
  • mps - maximum payload size
  • MWI - Memory-Write-Invalidate
  • PM - Power Management
  • PMC - ... ... Controller
  • PME - ... ... Event, port service
  • SR-IOV - Single-root input/output virtualization
  • VF - virtual functions

โšฒ User space API:

Querying information from a shell:

โšฒ Kernel space API:

๐Ÿ‘ Examples:

โš™๏ธ Internals edit

linux/pci_ids.h inc
drivers/pci src
pci_ops id

๐Ÿ“š Mainline documents with summary edit

PCI driver API doc

PCI Support Library edit

PCI Support Library doc

pci_bus_max_busnr doc, pci_status_get_and_clear_errors doc, pci_find_capability doc, pci_bus_find_capability doc, pci_find_next_ext_capability doc, pci_find_ext_capability doc, pci_get_dsn doc, pci_find_next_ht_capability doc, pci_find_ht_capability doc, pci_find_parent_resource doc, pci_find_resource doc, pci_platform_power_transition doc, pci_set_power_state doc, pci_choose_state doc, pci_save_state doc, pci_restore_state doc, pci_store_saved_state doc, pci_load_saved_state doc, pci_load_and_free_saved_state doc, pci_reenable_device doc, pci_enable_device_io doc, pci_enable_device_mem doc, pci_enable_device doc, pcim_enable_device doc, pcim_pin_device doc, pci_disable_device doc, pci_set_pcie_reset_state doc, pci_pme_capable doc, pci_pme_active doc, pci_enable_wake doc, pci_wake_from_d3 doc, pci_prepare_to_sleep doc, pci_back_from_sleep doc, pci_dev_run_wake doc, pci_d3cold_enable doc, pci_d3cold_disable doc, pci_enable_atomic_ops_to_root doc, pci_common_swizzle doc, pci_release_region doc, pci_request_region doc, pci_release_selected_regions doc, pci_request_selected_regions doc, pci_release_regions doc, pci_request_regions doc, pci_request_regions_exclusive doc, pci_remap_iospace doc, pci_unmap_iospace doc, devm_pci_remap_iospace doc, devm_pci_remap_cfgspace doc, devm_pci_remap_cfg_resource doc, pci_set_master doc, pci_clear_master doc, pci_set_cacheline_size doc, pci_set_mwi doc, pcim_set_mwi doc, pci_try_set_mwi doc, pci_clear_mwi doc, pci_intx doc, pci_check_and_mask_intx doc, pci_check_and_unmask_intx doc, pci_wait_for_pending_transaction doc, pcie_has_flr doc, pcie_flr doc, pci_bridge_secondary_bus_reset doc, __pci_reset_function_locked doc, pci_reset_function doc, pci_reset_function_locked doc, pci_try_reset_function doc, pci_probe_reset_slot doc, pci_probe_reset_bus doc, pci_reset_bus doc, pcix_get_max_mmrbc doc, pcix_get_mmrbc doc, pcix_set_mmrbc doc, pcie_get_readrq doc, pcie_set_readrq doc, pcie_get_mps doc, pcie_set_mps doc, pcie_bandwidth_available doc, pcie_get_speed_cap doc, pcie_get_width_cap doc, pcie_print_link_status doc, pci_select_bars doc, pci_add_dynid doc, pci_match_id doc, __pci_register_driver doc, pci_unregister_driver doc, pci_dev_driver doc, pci_dev_get doc, pci_dev_put doc, pci_stop_and_remove_bus_device doc, pci_find_bus doc, pci_find_next_bus doc, pci_get_slot doc, pci_get_domain_bus_and_slot doc, pci_get_subsys doc, pci_get_device doc, pci_get_class doc, pci_dev_present doc, pci_msi_mask_irq doc, pci_msi_unmask_irq doc, pci_msi_vec_count doc, pci_msix_vec_count doc, pci_msi_enabled doc, pci_enable_msix_range doc, pci_alloc_irq_vectors_affinity doc, pci_free_irq_vectors doc, pci_irq_vector doc, pci_irq_get_affinity doc, pci_msi_create_irq_domain doc, pci_bus_alloc_resource doc, pci_bus_add_device doc, pci_bus_add_devices doc, pci_bus_set_ops doc, pci_cfg_access_lock doc, pci_cfg_access_trylock doc, pci_cfg_access_unlock doc, pci_request_irq doc, pci_free_irq doc, pcie_relaxed_ordering_enabled doc, pci_scan_slot doc, pci_scan_child_bus doc, pci_rescan_bus doc, pci_create_slot doc, pci_destroy_slot doc, pci_hp_create_module_link doc, pci_hp_remove_module_link doc, pci_enable_rom doc, pci_disable_rom doc, pci_map_rom doc, pci_unmap_rom doc, pci_enable_sriov doc, pci_disable_sriov doc, pci_num_vf doc, pci_vfs_assigned doc, pci_sriov_set_totalvfs doc, pci_sriov_get_totalvfs doc, pci_sriov_configure_simple doc, pci_read_legacy_io doc, pci_write_legacy_io doc, pci_mmap_legacy_mem doc, pci_mmap_legacy_io doc, pci_adjust_legacy_attr doc, pci_create_legacy_files doc, pci_mmap_resource doc, pci_remove_resource_files doc, pci_create_resource_files doc, pci_write_rom doc, pci_read_rom doc, pci_remove_sysfs_dev_files doc,

PCI Hotplug Support Library doc

__pci_hp_register doc, __pci_hp_initialize doc, pci_hp_add doc, pci_hp_deregister doc, pci_hp_del doc, pci_hp_destroy doc,

PCI Peer-to-Peer DMA Support edit

PCI Peer-to-Peer DMA Support doc

ient-drivers doc, pci_p2pdma_add_resource doc, device doc, pci_p2pdma_distance_many doc, pci_has_p2pmem doc, device doc, pci_p2pmem_find_many doc, pci_alloc_p2pmem doc, pci_free_p2pmem doc, pci_p2pmem_virt_to_bus doc, pci_p2pmem_alloc_sgl doc, pci_p2pmem_free_sgl doc, pci_p2pmem_publish doc, device doc, pci_p2pdma_map_sg_attrs doc, device doc, pci_p2pdma_unmap_sg_attrs doc, pci_p2pdma_enable_store doc, pci_p2pdma_enable_show doc,

๐Ÿ“š PCI subsystem docs edit

PCI subsystem doc, newer on the top:

Boot Interrupts reroute doc


Kernel parameters docpci=ioapicreroute

EP - Endpoint Framework doc

Querying information from shell:

find /sys/kernel/config/pci_ep/

EPC - EP Controller:

linux/pci-epc.h inc pci_epc_create id, devm_pci_epc_create id

EPF - EP Function:

linux/pci-epf.h inc pci_epf_create id

Internals: drivers/pci/endpoint/ src

Driver to test endpoint functionality: drivers/pci/endpoint/functions/pci-epf-test.c src

PCIe virtualization, SR-IOV doc, 2009

API: pci_enable_sriov id, pci_disable_sriov id, sriov_configure id

MSI - Message Signaled Interrupts doc, 2008

MSI Example:

vectors = pci_alloc_irq_vectors id(pci_dev, 1, 1, PCI_IRQ_MSI | PCI_IRQ_MSIX);
irq = pci_irq_vector id(pci_dev, 0);

AER - Advanced Error Reporting doc, 2006

API: linux/aer.h inc, pci_enable_pcie_error_reporting id, pci_disable_pcie_error_reporting id, pci_aer_clear_nonfatal_status id

ERS - Error Recovery System doc:

API: pci_error_handlers id, pci_ers_result id, pci_channel_state_t id

PCIe - PCI Express Port Bus Driver doc, 2004

API: pcie_port_service_driver id,pcie_port_service_register id, pcie_port_service_unregister id

Old manual PCI API doc

pci_get_device id, pci_get_class id, pci_get_subsys id, pci_dev_put id

๐Ÿ’พ Historical:

๐Ÿ“š References