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