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