setpci
Configure PCI device registers
SYNOPSIS
setpci [options] device param=value ...
PARAMETERS
-v
Verbose mode. Shows all configuration accesses.
-s
Specifies the PCI device using the [domain:]bus:device.function notation. For example, '00:01.0' specifies device 1, function 0, on bus 0 in domain 0. If the domain part is ommited then 0 is implied.
-d
Specifies a PCI device by vendor and device ID, both in hexadecimal. This will find the first device matching the specified vendor and device ID.
=
Specifies the PCI configuration space register to modify and the value to write. can be an offset (e.g., 3c) or a symbolic name (e.g., latency_timer).
-f
Forces access even if the device appears to be busy. Use with caution.
-i
Uses file for PCI id list. (Default: /usr/share/hwdata/pci.ids)
-D
Enable direct hardware access. Use with extreme caution.
-H
Use direct hardware access mode
-G
Enable generic access mode. Use with caution. This mode allows accessing registers beyond the standard configuration space.
-b
Read and write byte quantities.
-w
Read and write word (2-byte) quantities.
-l
Read and write long (4-byte) quantities.
DESCRIPTION
The setpci command allows users to read from and write to PCI configuration space registers. It is a powerful tool used for low-level hardware configuration and debugging. It enables direct access to the PCI configuration space of specific devices, allowing modification of device settings, enabling/disabling features, and more.
setpci is typically used by system administrators, hardware engineers, and developers who need fine-grained control over PCI devices. Incorrect usage can lead to system instability or hardware damage, so caution is advised. The command relies on the /proc/bus/pci or /sys/bus/pci filesystems for accessing the PCI configuration space. Root privileges are typically required to use setpci.
CAVEATS
Incorrect usage of setpci can lead to system instability or hardware damage. Requires root privileges.
DIRECT HARDWARE ACCESS
The -D option should be used with extreme caution. It bypasses the kernel's PCI access routines and directly accesses the hardware. This can lead to unpredictable behavior and potential system crashes if used incorrectly.
SYMBOLIC NAMES
setpci utilizes a PCI ID database (typically /usr/share/hwdata/pci.ids) to map symbolic names to PCI configuration space offsets. This makes it easier to specify registers by name rather than having to remember the numerical offsets.
HISTORY
The setpci command has been a part of the pciutils package for many years. It provides a critical tool for interacting directly with PCI devices and has evolved alongside the PCI standard to support new features and device types.
SEE ALSO
lspci(8), pciconf(8)