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