setpci command – configure PCI device

There are lots of different I/O ports in use on the Linux system at any time, so your output will most likely differ from this example. With PnP, I/O port conflicts aren’t very common, but it is possible that two devices are assigned the same I/O port. In that case, you can manually override the settings automatically assigned by using the setpci command.

The setpci command is a utility to query and configure PCI devices. The numbers used in the command are all hexadecimal numbers. Because the setpci command needs to modify the configuration parameters of the hardware, it must have the “root” user authority. Before using the setpci command to configure PCI devices, in order to prevent problems with the operating system, always use the “setpci -vD” command to view the operation process of the setpci command.

Syntax:

setpci [parameter] [PCI device/operation]

Command parameters:

  • -v: Display detailed information about the execution of instructions
  • -f: When there is no operation to complete, no information is displayed
  • -D: Test mode, does not actually write configuration information to the register.
  • -d: Only display information for a given manufacturer and device.
  • -s: Only display the information of the device on the specified bus, slot, or function block on the device.

Examples of setpci Command

1. Is the device 0: 14.0 device, the PCI configuration space is cheap to 0x60, write a new byte variable 6:

# setpci -s 0:14.0 60.B=6

2. Set the timer of the PCI device:

# setpci -d : latency_time=40

3. List PCI devices and adjust them:

# lspci
00:0f.0 VGA compatible controller: VMware SVGA II Adapter

# setpci -s 00:0f.0 F4.B=FF
# setpci -s 00:0f.0 F4.B=CC

Conclusion

You can use the setpci utility to directly query and adjust PCI devices’ configurations. This tool is most likely to be useful if you know enough about the hardware to fine-tune its low-level configuration; it’s not often used to tweak the hardware’s basic IRQ, I/O port, or DMA options.

Related Post