1setpci(8) The PCI Utilities setpci(8)
2
3
4
6 setpci - configure PCI devices
7
9 setpci [options] devices operations...
10
11
13 setpci is a utility for querying and configuring PCI devices.
14
15 All numbers are entered in hexadecimal notation.
16
17 Root privileges are necessary for almost all operations, excluding
18 reads of the standard header of the configuration space on some operat‐
19 ing systems. Please see lspci(8) for details on access rights.
20
21
23 General options
24 -v Tells setpci to be verbose and display detailed information
25 about configuration space accesses.
26
27 -f Tells setpci not to complain when there's nothing to do (when no
28 devices are selected). This option is intended for use in
29 widely-distributed configuration scripts where it's uncertain
30 whether the device in question is present in the machine or not.
31
32 -D `Demo mode' -- don't write anything to the configuration regis‐
33 ters. It's useful to try setpci -vD to verify that your complex
34 sequence of setpci operations does what you think it should do.
35
36 -r Avoids bus scan if each operation selects a specific device
37 (uses the -s selector with specific domain, bus, slot, and func‐
38 tion). This is faster, but if the device does not exist, it
39 fails instead of matching an empty set of devices.
40
41 --version
42 Show setpci version. This option should be used stand-alone.
43
44 --help Show detailed help on available options. This option should be
45 used stand-alone.
46
47 --dumpregs
48 Show a list of all known PCI registers and capabilities. This
49 option should be used stand-alone.
50
51
52 PCI access options
53 The PCI utilities use the PCI library to talk to PCI devices (see
54 pcilib(7) for details). You can use the following options to influence
55 its behavior:
56
57 -A <method>
58 The library supports a variety of methods to access the PCI
59 hardware. By default, it uses the first access method avail‐
60 able, but you can use this option to override this decision. See
61 -A help for a list of available methods and their descriptions.
62
63 -O <param>=<value>
64 The behavior of the library is controlled by several named
65 parameters. This option allows to set the value of any of the
66 parameters. Use -O help for a list of known parameters and their
67 default values.
68
69 -H1 Use direct hardware access via Intel configuration mechanism 1.
70 (This is a shorthand for -A intel-conf1.)
71
72 -H2 Use direct hardware access via Intel configuration mechanism 2.
73 (This is a shorthand for -A intel-conf2.)
74
75 -G Increase debug level of the library.
76
77
79 Before each sequence of operations you need to select which devices you
80 wish that operation to affect.
81
82 -s [[[[<domain>]:]<bus>]:][<slot>][.[<func>]]
83 Consider only devices in the specified domain (in case your
84 machine has several host bridges, they can either share a common
85 bus number space or each of them can address a PCI domain of its
86 own; domains are numbered from 0 to ffff), bus (0 to ff), slot
87 (0 to 1f) and function (0 to 7). Each component of the device
88 address can be omitted or set to "*", both meaning "any value".
89 All numbers are hexadecimal. E.g., "0:" means all devices on
90 bus 0, "0" means all functions of device 0 on any bus, "0.3"
91 selects third function of device 0 on all buses and ".4" matches
92 only the fourth function of each device.
93
94 -d [<vendor>]:[<device>]
95 Select devices with specified vendor and device ID. Both ID's
96 are given in hexadecimal and may be omitted or given as "*",
97 both meaning "any value".
98
99 When -s and -d are combined, only devices that match both criteria are
100 selected. When multiple options of the same kind are specified, the
101 rightmost one overrides the others.
102
103
105 There are two kinds of operations: reads and writes. To read a regis‐
106 ter, just specify its name. Writes have the form name=value,value...
107 where each value is either a hexadecimal number or an expression of
108 type data:mask where both data and mask are hexadecimal numbers. In the
109 latter case, only the bits corresponding to binary ones in the mask are
110 changed (technically, this is a read-modify-write operation).
111
112
113 There are several ways how to identity a register:
114
115 · Tell its address in hexadecimal.
116
117 · Spell its name. Setpci knows the names of all registers in the
118 standard configuration headers. Use `setpci --dumpregs' to get
119 the complete list. See PCI bus specifications for the precise
120 meaning of these registers or consult header.h or
121 /usr/include/pci/pci.h for a brief sketch.
122
123 · If the register is a part of a PCI capability, you can specify
124 the name of the capability to get the address of its first reg‐
125 ister. See the names starting with `CAP_' or `ECAP_' in the
126 --dumpregs output.
127
128 · If the name of the capability is not known to setpci, you can
129 refer to it by its number in the form CAPid or ECAPid, where id
130 is the numeric identifier of the capability in hexadecimal.
131
132 · Each of the previous formats can be followed by +offset to add
133 an offset (a hex number) to the address. This feature can be
134 useful for addressing of registers living within a capability,
135 or to modify parts of standard registers.
136
137 · To choose how many bytes (1, 2, or 4) should be transferred, you
138 should append a width specifier .B, .W, or .L. The width can be
139 omitted if you are referring to a register by its name and the
140 width of the register is well known.
141
142 · Finally, if a capability exists multiple times you can choose
143 which one to target using @number. Indexing starts at 0.
144
145
146 All names of registers and width specifiers are case-insensitive.
147
148
150 COMMAND
151 asks for the word-sized command register.
152
153 4.w is a numeric address of the same register.
154
155 COMMAND.l
156 asks for a 32-bit word starting at the location of the command
157 register, i.e., the command and status registers together.
158
159 VENDOR_ID+1.b
160 specifies the upper byte of the vendor ID register (remember,
161 PCI is little-endian).
162
163 CAP_PM+2.w
164 corresponds to the second word of the power management capabil‐
165 ity.
166
167 ECAP108.l
168 asks for the first 32-bit word of the extended capability with
169 ID 0x108.
170
171
173 lspci(8), pcilib(7)
174
175
177 The PCI Utilities are maintained by Martin Mares <mj@ucw.cz>.
178
179
180
181pciutils-3.7.0 31 May 2020 setpci(8)