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 pa‐
65 rameters. This option allows one 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 ma‐
84 chine 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" se‐
91 lects third function of device 0 on all buses and ".4" matches
92 only the fourth function of each device.
93
94 -d [<vendor>]:[<device>][:<class>[:<prog-if>]]
95 Select devices with specified vendor, device, class ID, and pro‐
96 gramming interface. The ID's are given in hexadecimal and may
97 be omitted or given as "*", both meaning "any value". The class
98 ID can contain "x" characters which stand for "any digit".
99
100 When -s and -d are combined, only devices that match both criteria are
101 selected. When multiple options of the same kind are specified, the
102 rightmost one overrides the others.
103
104
106 There are two kinds of operations: reads and writes. To read a regis‐
107 ter, just specify its name. Writes have the form name=value,value...
108 where each value is either a hexadecimal number or an expression of
109 type data:mask where both data and mask are hexadecimal numbers. In the
110 latter case, only the bits corresponding to binary ones in the mask are
111 changed (technically, this is a read-modify-write operation).
112
113
114 There are several ways how to identity a register:
115
116 • Tell its address in hexadecimal.
117
118 • Spell its name. Setpci knows the names of all registers in the
119 standard configuration headers. Use `setpci --dumpregs' to get
120 the complete list. See PCI bus specifications for the precise
121 meaning of these registers or consult header.h or /usr/in‐
122 clude/pci/pci.h for a brief sketch.
123
124 • If the register is a part of a PCI capability, you can specify
125 the name of the capability to get the address of its first reg‐
126 ister. See the names starting with `CAP_' or `ECAP_' in the
127 --dumpregs output.
128
129 • If the name of the capability is not known to setpci, you can
130 refer to it by its number in the form CAPid or ECAPid, where id
131 is the numeric identifier of the capability in hexadecimal.
132
133 • Each of the previous formats can be followed by +offset to add
134 an offset (a hex number) to the address. This feature can be
135 useful for addressing of registers living within a capability,
136 or to modify parts of standard registers.
137
138 • To choose how many bytes (1, 2, or 4) should be transferred, you
139 should append a width specifier .B, .W, or .L. The width can be
140 omitted if you are referring to a register by its name and the
141 width of the register is well known.
142
143 • Finally, if a capability exists multiple times you can choose
144 which one to target using @number. Indexing starts at 0.
145
146
147 All names of registers and width specifiers are case-insensitive.
148
149
151 COMMAND
152 asks for the word-sized command register.
153
154 4.w is a numeric address of the same register.
155
156 COMMAND.l
157 asks for a 32-bit word starting at the location of the command
158 register, i.e., the command and status registers together.
159
160 VENDOR_ID+1.b
161 specifies the upper byte of the vendor ID register (remember,
162 PCI is little-endian).
163
164 CAP_PM+2.w
165 corresponds to the second word of the power management capabil‐
166 ity.
167
168 ECAP108.l
169 asks for the first 32-bit word of the extended capability with
170 ID 0x108.
171
172
174 lspci(8), pcilib(7)
175
176
178 The PCI Utilities are maintained by Martin Mares <mj@ucw.cz>.
179
180
181
182pciutils-3.9.0 20 November 2022 setpci(8)