2 .\" Stefan Esser <se@FreeBSD.org>. All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\" notice, this list of conditions and the following disclaimer.
10 .\" 2. Redistributions in binary form must reproduce the above copyright
11 .\" notice, this list of conditions and the following disclaimer in the
12 .\" documentation and/or other materials provided with the distribution.
14 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 .Nd diagnostic utility for the PCI bus
36 .Fl l Oo Fl BbceVv Oc Op Ar device
40 .Fl r Oo Fl b | h Oc Ar device addr Ns Op : Ns Ar addr2
42 .Fl w Oo Fl b | h Oc Ar device addr value
44 .Fl D Oo Fl b | h | x Oc Ar device addr Op start Ns Op : Ns Ar count
48 utility provides a command line interface to functionality provided by the
52 As such, some of the functions are only available to users with write
55 normally only the super-user.
61 lists PCI devices in the following format:
63 foo0@pci0:0:4:0: class=0x010000 card=0x00000000 chip=0x000f1000 rev=0x01 \
65 bar0@pci0:0:5:0: class=0x000100 card=0x00000000 chip=0x88c15333 rev=0x00 \
67 none0@pci0:0:6:0: class=0x020000 card=0x00000000 chip=0x802910ec rev=0x00 \
71 The first column gives the
72 driver name, unit number, and selector .
73 If there is no driver attached to the
75 device in question, the driver name will be
77 Unit numbers for detached devices start at zero and are incremented for
78 each detached device that is encountered.
80 is in a form which may directly be used for the other forms of the command.
81 The second column is the class code, with the class byte printed as two
82 hex digits, followed by the sub-class and the interface bytes.
83 The third column gives the contents of the subvendorid register, introduced
84 in revision 2.1 of the
87 Note that it will be 0 for older cards.
88 The field consists of the card ID in the upper
89 half and the card vendor ID in the lower half of the value.
91 The fourth column contains the chip device ID, which identifies the chip
92 this card is based on.
93 It consists of two fields, identifying the chip and
95 The fifth column prints the chip's revision.
96 The sixth column describes the header type.
97 Currently assigned header types include 0 for most devices,
107 If the most significant bit
108 of the header type register is set for
113 device, which contains several (similar or independent) functions on
120 will list additional information for
129 specifically the resource ranges decoded by the bridge for use by devices
131 Each bridge lists a range of bus numbers handled by the bridge and its
133 Memory and I/O port decoding windows are enumerated via a line in the
136 window[1c] = type I/O Port, range 16, addr 0x5000-0x8fff, enabled
139 The first value after the
141 prefix in the square brackets is the offset of the decoding window in
142 config space in hexadecimal.
143 The type of a window is one of
145 .Dq Prefetchable Memory ,
148 The range indicates the binary log of the maximum address the window decodes.
149 The address field indicates the start and end addresses of the decoded range.
150 Finally, the last flag indicates if the window is enabled or disabled.
156 will list any base address registers
158 that are assigned resources for each device.
159 Each BAR will be enumerated via a line in the following format:
161 bar [10] = type Memory, range 32, base 0xda060000, size 131072, enabled
164 The first value after the
166 prefix in the square brackets is the offset of the BAR in config space in
168 The type of a BAR is one of
170 .Dq Prefetchable Memory ,
173 The range indicates the binary log of the maximum address the BAR decodes.
174 The base and size indicate the start and length of the BAR's address window,
176 Finally, the last flag indicates if the BAR is enabled or disabled.
182 will list any capabilities supported by each device.
183 Each capability is enumerated via a line in the following format:
185 cap 10[40] = PCI-Express 1 root port
188 The first value after the
190 prefix is the capability ID in hexadecimal.
191 The second value in the square brackets is the offset of the capability
192 in config space in hexadecimal.
193 The format of the text after the equals sign is capability-specific.
195 Each extended capability is enumerated via a line in a similar format:
197 ecap 0002[100] = VC 1 max VC0
200 The first value after the
202 prefix is the extended capability ID in hexadecimal.
203 The second value in the square brackets is the offset of the extended
204 capability in config space in hexadecimal.
205 The format of the text after the equals sign is capability-specific.
211 will list any errors reported for this device in standard PCI error registers.
212 Errors are checked for in the PCI status register,
213 the PCI-express device status register,
214 and the Advanced Error Reporting status registers.
220 will attempt to load the vendor/device information database, and print
221 vendor, device, class and subclass identification strings for each device.
227 will list any vital product data
229 provided by each device.
230 Each VPD keyword is enumerated via a line in the following format:
232 VPD ro PN = '110114640C0 '
235 The first string after the
237 prefix indicates if the keyword is read-only
241 The second string provides the keyword name.
242 The text after the equals sign lists the value of the keyword which is
243 usually an ASCII string.
247 argument is given with the
251 will only list details about a single device instead of all devices.
259 The device can be identified either by a device name if the device is
260 attached to a driver or by a selector.
261 Selectors identify a PCI device by its address in PCI config space and
262 can take one of the following forms:
264 .Bl -bullet -offset indent -compact
266 .Li pci Ns Va domain Ns \&: Ns Va bus Ns \&: Ns Va device Ns \&: \
269 .Li pci Ns Va bus Ns \&: Ns Va device Ns \&: Ns Va function Ns
271 .Li pci Ns Va bus Ns \&: Ns Va device Ns
274 In the case of an abridged form, omitted selector components are assumed to be 0.
275 An optional leading device name followed by @ and an optional final colon
276 will be ignored; this is so that the first column in the output of
279 can be used without modification.
280 All numbers are base 10.
286 determines whether any driver has been assigned to the device
289 An exit status of zero indicates that the device has a driver;
290 non-zero indicates that it does not.
294 option reads a configuration space register at byte offset
298 and prints out its value in hexadecimal.
299 The optional second address
301 specifies a range to read.
306 into a configuration space register at byte offset
313 option request a dump of the specified BAR.
314 Dump is performed to the standard output, raw register values
318 to convert them to human-readable dump,
319 or redirect into a file to save the snapshot of the device state.
324 of the registers dumped can be specified, in multiple of the operation width,
327 For read, write, and dump operations, the flags
332 select the width of the operation;
334 indicates a byte operation, and
336 indicates a halfword (two-byte) operation.
338 indicates a quadword (four-byte) operation.
339 The default is to read or
340 write a longword (four bytes).
341 The quadword mode is only valid for BAR dump.
343 PCI vendor and device information is read from
344 .Pa /usr/local/share/pciids/pci.ids .
345 If that file is not present, it is read from
346 .Pa /usr/share/misc/pci_vendors .
347 This path can be overridden by setting the environment variable
348 .Ev PCICONF_VENDOR_DATABASE .
357 utility appeared first in
369 utility was written by
372 .An Garrett Wollman .
378 options are implemented in
380 but not in the underlying
383 It might be useful to give non-root users access to the
388 But only root will be able to execute a
390 to provide the device with a driver KLD, and reading of configuration space
391 registers may cause a failure in badly designed
395 There is currently no way to specify the caching mode for the mapping
400 always uses uncached access.
401 This is fine for control register BARs.