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 rev=0x01 hdr=0x00 vendor=0x1000 device=0x000f \
64 subvendor=0x0000 subdevice=0x0000
65 bar0@pci0:0:5:0: class=0x000100 rev=0x00 hdr=0x00 vendor=0x88c1 device=0x5333 \
66 subvendor=0x0000 subdevice=0x0000
67 none0@pci0:0:6:0: class=0x020000 rev=0x00 hdr=0x00 vendor=0x10ec device=0x8029 \
68 subvendor=0x0000 subdevice=0x0000
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 prints the device's revision.
84 The fourth column describes the header type.
86 Currently assigned header types include 0 for standard devices,
96 If the most significant bit
97 of the header type register is set for
102 device, which contains several (similar or independent) functions on
105 The sixth and seventh columns contain the vendor ID and the device ID of the
107 The eigth and ninth columns contain subvendor and subdevice IDs, introduced
108 in revision 2.1 of the
111 Note that they will be 0 for older cards.
115 option causes output to be in a compact columnar format, suitable for
118 drv selector class rev hdr vendor device subven subdev
119 foo0@pci0:0:4:0: 010000 01 00 1000 000f 0000 0000
120 bar0@pci0:0:5:0: 000100 00 00 88c1 5333 0000 0000
121 none0@pci0:0:6:0: 020000 00 00 10ec 8029 0000 0000
124 All fields retain the same definition as with the non-compact form.
130 will list additional information for
139 specifically the resource ranges decoded by the bridge for use by devices
141 Each bridge lists a range of bus numbers handled by the bridge and its
143 Memory and I/O port decoding windows are enumerated via a line in the
146 window[1c] = type I/O Port, range 16, addr 0x5000-0x8fff, enabled
149 The first value after the
151 prefix in the square brackets is the offset of the decoding window in
152 config space in hexadecimal.
153 The type of a window is one of
155 .Dq Prefetchable Memory ,
158 The range indicates the binary log of the maximum address the window decodes.
159 The address field indicates the start and end addresses of the decoded range.
160 Finally, the last flag indicates if the window is enabled or disabled.
166 will list any base address registers
168 that are assigned resources for each device.
169 Each BAR will be enumerated via a line in the following format:
171 bar [10] = type Memory, range 32, base 0xda060000, size 131072, enabled
174 The first value after the
176 prefix in the square brackets is the offset of the BAR in config space in
178 The type of a BAR is one of
180 .Dq Prefetchable Memory ,
183 The range indicates the binary log of the maximum address the BAR decodes.
184 The base and size indicate the start and length of the BAR's address window,
186 Finally, the last flag indicates if the BAR is enabled or disabled.
192 will list any capabilities supported by each device.
193 A second invocation of
195 will print additional data for certain capabilities.
196 Each capability is enumerated via a line in the following format:
198 cap 10[40] = PCI-Express 1 root port
201 The first value after the
203 prefix is the capability ID in hexadecimal.
204 The second value in the square brackets is the offset of the capability
205 in config space in hexadecimal.
206 The format of the text after the equals sign is capability-specific.
208 Each extended capability is enumerated via a line in a similar format:
210 ecap 0002[100] = VC 1 max VC0
213 The first value after the
215 prefix is the extended capability ID in hexadecimal.
216 The second value in the square brackets is the offset of the extended
217 capability in config space in hexadecimal.
218 The format of the text after the equals sign is capability-specific.
224 will list any errors reported for this device in standard PCI error registers.
225 Errors are checked for in the PCI status register,
226 the PCI-express device status register,
227 and the Advanced Error Reporting status registers.
233 will attempt to load the vendor/device information database, and print
234 vendor, device, class and subclass identification strings for each device.
240 will list any vital product data
242 provided by each device.
243 Each VPD keyword is enumerated via a line in the following format:
245 VPD ro PN = '110114640C0 '
248 The first string after the
250 prefix indicates if the keyword is read-only
254 The second string provides the keyword name.
255 The text after the equals sign lists the value of the keyword which is
256 usually an ASCII string.
260 argument is given with the
264 will only list details about a single device instead of all devices.
272 The device can be identified either by a device name if the device is
273 attached to a driver or by a selector.
274 Selectors identify a PCI device by its address in PCI config space and
275 can take one of the following forms:
277 .Bl -bullet -offset indent -compact
279 .Li pci Ns Va domain Ns \&: Ns Va bus Ns \&: Ns Va device Ns \&: \
282 .Li pci Ns Va bus Ns \&: Ns Va device Ns \&: Ns Va function Ns
284 .Li pci Ns Va bus Ns \&: Ns Va device Ns
287 In the case of an abridged form, omitted selector components are assumed to be 0.
288 An optional leading device name followed by @ and an optional final colon
289 will be ignored; this is so that the first column in the output of
292 can be used without modification.
293 All numbers are base 10.
299 determines whether any driver has been assigned to the device
302 An exit status of zero indicates that the device has a driver;
303 non-zero indicates that it does not.
307 option reads a configuration space register at byte offset
311 and prints out its value in hexadecimal.
312 The optional second address
314 specifies a range to read.
319 into a configuration space register at byte offset
326 option request a dump of the specified BAR.
327 Dump is performed to the standard output, raw register values
331 to convert them to human-readable dump,
332 or redirect into a file to save the snapshot of the device state.
337 of the registers dumped can be specified, in multiple of the operation width,
340 For read, write, and dump operations, the flags
345 select the width of the operation;
347 indicates a byte operation, and
349 indicates a halfword (two-byte) operation.
351 indicates a quadword (four-byte) operation.
352 The default is to read or
353 write a longword (four bytes).
354 The quadword mode is only valid for BAR dump.
356 PCI vendor and device information is read from
357 .Pa /usr/local/share/pciids/pci.ids .
358 If that file is not present, it is read from
359 .Pa /usr/share/misc/pci_vendors .
360 This path can be overridden by setting the environment variable
361 .Ev PCICONF_VENDOR_DATABASE .
370 utility appeared first in
382 utility was written by
385 .An Garrett Wollman .
391 options are implemented in
393 but not in the underlying
396 It might be useful to give non-root users access to the
401 But only root will be able to execute a
403 to provide the device with a driver KLD, and reading of configuration space
404 registers may cause a failure in badly designed
408 There is currently no way to specify the caching mode for the mapping
413 always uses uncached access.
414 This is fine for control register BARs.