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