Fix some typos/wording in our manual pages.
[dragonfly.git] / usr.sbin / pciconf / pciconf.8
1 .\" $FreeBSD: src/usr.sbin/pciconf/pciconf.8,v 1.30.2.2.2.1 2009/04/15 03:14:26 kensmith Exp $
2 .\" $DragonFly: src/usr.sbin/pciconf/pciconf.8,v 1.4 2008/09/30 12:20:29 hasso Exp $
3 .\" Copyright (c) 1997
4 .\"     Stefan Esser <se@FreeBSD.org>. All rights reserved.
5 .\"
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that the following conditions
8 .\" are met:
9 .\" 1. Redistributions of source code must retain the above copyright
10 .\"    notice, this list of conditions and the following disclaimer.
11 .\"
12 .\" 2. Redistributions in binary form must reproduce the above copyright
13 .\"    notice, this list of conditions and the following disclaimer in the
14 .\"    documentation and/or other materials provided with the distribution.
15 .\"
16 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 .\" SUCH DAMAGE.
27 .\"
28 .Dd July 5, 2009
29 .Dt PCICONF 8
30 .Os
31 .Sh NAME
32 .Nm pciconf
33 .Nd diagnostic utility for the PCI bus
34 .Sh SYNOPSIS
35 .Nm
36 .Fl l Op Fl bcv
37 .Nm
38 .Fl a Ar selector
39 .Nm
40 .Fl r Oo Fl b | h Oc Ar selector addr Ns Op : Ns Ar addr2
41 .Nm
42 .Fl w Oo Fl b | h Oc Ar selector addr value
43 .Sh DESCRIPTION
44 The
45 .Nm
46 utility provides a command line interface to functionality provided by the
47 .Xr pci 4
48 .Xr ioctl 2
49 interface.
50 As such, some of the functions are only available to users with write
51 access to
52 .Pa /dev/pci ,
53 normally only the super-user.
54 .Pp
55 With the
56 .Fl l
57 option, it lists all devices found by the boot probe in the following format:
58 .Bd -literal
59 foo0@pci0:0:4:0: class=0x010000 card=0x00000000 chip=0x000f1000 rev=0x01 \
60 hdr=0x00
61 bar0@pci0:0:5:0: class=0x000100 card=0x00000000 chip=0x88c15333 rev=0x00 \
62 hdr=0x00
63 none0@pci0:0:6:0: class=0x020000 card=0x00000000 chip=0x802910ec rev=0x00 \
64 hdr=0x00
65 .Ed
66 .Pp
67 The first column gives the
68 device name, unit number, and
69 .Ar selector .
70 If there is no device configured in the kernel for the
71 .Tn PCI
72 device in question, the device name will be
73 .Dq none .
74 Unit numbers for unconfigured devices start at zero and are incremented for
75 each unconfigured device that is encountered.
76 The
77 .Ar selector
78 is in a form which may directly be used for the other forms of the command.
79 The second column is the class code, with the class byte printed as two
80 hex digits, followed by the sub-class and the interface bytes.
81 The third column gives the contents of the subvendorid register, introduced
82 in revision 2.1 of the
83 .Tn PCI
84 standard.
85 Note that it will be 0 for older cards.
86 The field consists of the card ID in the upper
87 half and the card vendor ID in the lower half of the value.
88 .Pp
89 The fourth column contains the chip device ID, which identifies the chip
90 this card is based on.
91 It consists of two fields, identifying the chip and
92 its vendor, as above.
93 The fifth column prints the chip's revision.
94 The sixth column describes the header type.
95 Currently assigned header types include 0 for most devices,
96 1 for
97 .Tn PCI
98 to
99 .Tn PCI
100 bridges, and 2 for
101 .Tn PCI
102 to
103 .Tn CardBus
104 bridges.
105 If the most significant bit
106 of the header type register is set for
107 function 0 of a
108 .Tn PCI
109 device, it is a
110 .Em multi-function
111 device, which contains several (similar or independent) functions on
112 one chip.
113 .Pp
114 If the
115 .Fl b
116 option is supplied,
117 .Nm
118 will list any base address registers
119 .Pq BARs
120 that are assigned resources for each device.
121 Each BAR will be enumerated via a line in the following format:
122 .Bd -literal
123     bar   [10] = type Memory, range 32, base 0xda060000, size 131072, enabled
124 .Ed
125 .Pp
126 The first value after the
127 .Dq Li bar
128 prefix in the square brackets is the offset of the BAR in config space in
129 hexadecimal.
130 The type of a BAR is one of
131 .Dq Memory ,
132 .Dq Prefetchable Memory ,
133 or
134 .Dq I/O Port .
135 The range indicates the maximum address the BAR decodes.
136 The base and size indicate the start and length of the BAR's address window,
137 respectively.
138 Finally, the last flag indicates if the BAR is enabled or disabled.
139 .Pp
140 If the
141 .Fl c
142 option is supplied,
143 .Nm
144 will list any capabilities supported by each device.
145 Each capability will be enumerated via a line in the following format:
146 .Bd -literal
147     cap 10[40] = PCI-Express 1 root port
148 .Ed
149 .Pp
150 The first value after the
151 .Dq Li cap
152 prefix is the capability ID in hexadecimal.
153 The second value in the square brackets is the offset of the capability
154 in config space in hexadecimal.
155 The format of the text after the equals sign is capability-specific.
156 .Pp
157 If the
158 .Fl v
159 option is supplied,
160 .Nm
161 will attempt to load the vendor/device information database, and print
162 vendor, device, class and subclass identification strings for each device.
163 .Pp
164 All invocations of
165 .Nm
166 except for
167 .Fl l
168 require a
169 .Ar selector
170 of the form
171 .Li pci Ns Va domain Ns \&: Ns Va bus Ns \&: Ns Va device Ns \&: \
172 Ns Va function Ns ,
173 .Li pci Ns Va bus Ns \&: Ns Va device Ns \&: Ns Va function Ns , or
174 .Li pci Ns Va bus Ns \&: Ns Va device Ns .
175 In case of an abrigded form, omitted selector components are assumed to be 0.
176 An optional leading device name followed by @ and an optional final colon
177 will be ignored; this is so that the first column in the output of
178 .Nm
179 .Fl l
180 can be used without modification.
181 All numbers are base 10.
182 .Pp
183 With the
184 .Fl a
185 flag,
186 .Nm
187 determines whether any driver has been assigned to the device
188 identified by
189 .Ar selector .
190 An exit status of zero indicates that the device has a driver;
191 non-zero indicates that it does not.
192 .Pp
193 The
194 .Fl r
195 option reads a configuration space register at byte offset
196 .Ar addr
197 of device
198 .Ar selector
199 and prints out its value in hexadecimal.
200 The optional second address
201 .Ar addr2
202 specifies a range to read.
203 The
204 .Fl w
205 option writes the
206 .Ar value
207 into a configuration space register at byte offset
208 .Ar addr
209 of device
210 .Ar selector .
211 For both operations, the flags
212 .Fl b
213 and
214 .Fl h
215 select the width of the operation;
216 .Fl b
217 indicates a byte operation, and
218 .Fl h
219 indicates a halfword (two-byte) operation.
220 The default is to read or
221 write a longword (four bytes).
222 .Sh ENVIRONMENT
223 The PCI vendor/device information database is normally read from
224 .Pa /usr/share/misc/pci_vendors .
225 This path can be overridden by setting the environment variable
226 .Ev PCICONF_VENDOR_DATABASE .
227 .Sh SEE ALSO
228 .Xr ioctl 2 ,
229 .Xr pci 4 ,
230 .Xr devinfo 8 ,
231 .Xr kldload 8
232 .Sh HISTORY
233 The
234 .Nm
235 utility appeared first in
236 .Fx 2.2 .
237 The
238 .Fl a
239 option was added for
240 .Tn PCI
241 KLD support in
242 .Fx 3.0 .
243 .Sh AUTHORS
244 .An -nosplit
245 The
246 .Nm
247 utility was written by
248 .An Stefan Esser
249 and
250 .An Garrett Wollman .
251 .Sh BUGS
252 The
253 .Fl b
254 and
255 .Fl h
256 options are implemented in
257 .Nm ,
258 but not in the underlying
259 .Xr ioctl 2 .
260 .Pp
261 It might be useful to give non-root users access to the
262 .Fl a
263 and
264 .Fl r
265 options.
266 But only root will be able to execute a
267 .Nm kldload
268 to provide the device with a driver KLD, and reading of configuration space
269 registers may cause a failure in badly designed
270 .Tn PCI
271 chips.