PCI Server Overview

Updated: April 19, 2023

The PCI server manages the hierarchy of PCI devices attached to a system.

This server uses a modular design that consists of the following main components:

pci-server
A resource manager that's responsible for enumerating and optionally configuring all PCI/PCIe devices, providing access control to some device information and settings, and for all configuration space writes. It's located in ${QNX_TARGET}/processor/sbin/ on your development host, and normally installed in /sbin on your target.
libpci.so
A linkable library of APIs is located in ${QNX_TARGET}/processor/lib on your development host and normally installed in /lib on your target. See the API Reference chapter.
Note: Some of these functions require that the calling thread has I/O privileges, which you can get by successfully calling:
ThreadCtl( _NTO_TCTL_IO, 0);

For more information, see ThreadCtl() in the C Library Reference.

pci-tool
A utility that lets you view devices and the bus/link topology.
rsrcdb_query
A utility that lets you view the resource database entries for PCI-related resources, namely available address spaces and vectors for MSI/MSI-X interrupts.

For more information, see the Utilities Reference.

There are additional modules (some required, some optional) located in ${QNX_TARGET}/processor/lib/dll/pci/ on your development host and in /lib/dll/pci/ on your target. You must add the latter path to your LD_LIBRARY_PATH environment variable. The modules include the following:

File name Description In the Design Details chapter, see:
pci_cap-* PCI capabilities Capability modules
pci_debug.so, pci_debug2.so Debug logging modules. On systems that support slogger2, use pci_debug2.so.  
pci_hw-* Hardware-specific modules; you must use one of these Hardware-dependent modules
pci_server-* Server configuration modules The PCI server
pci_slog.so, pci_slog2.so PCI system logger modules. On systems that support slogger2, use pci_slog2.so.  
pci_strings.so A module that defines commonly used strings Strings module
pcie_xcap-* PCIe extended capabilities Capability modules

The PCI server architecture uses optional configuration files (see ${QNX_TARGET}/etc/system/config/pci/*-template.cfg for templates) and environment variables (some optional, some not; see Environment variables). The environment variables need to be present in the environment of each executable that uses the PCI server as well as the PCI server itself.

With the exception of the hardware-dependent module (which is required by all executables), you can choose which modules to use.

For example, if you want debug logs only for a driver that you're currently working on, make sure that the PCI_DEBUG_MODULE environment variable of every other executable is unset. If you want to test a new capability module but don't want other executables to use it (even though they may support that capability), then you could blacklist the module for every other executable. Or, you could create a private capability module directory and set the PCI_CAP_MODULE_DIR environment variable to that directory only for the executable you're testing; remember to symlink the other capability modules to your private directory.