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
31 .Nd diagnostic utility for the PCI bus
34 .Fl l Oo Fl BbceVv Oc Op Ar device
38 .Fl r Oo Fl b | h Oc Ar device addr Ns Op : Ns Ar addr2
40 .Fl w Oo Fl b | h Oc Ar device addr value
42 .Fl D Oo Fl b | h | x Oc Ar device addr Op start Ns Op : Ns Ar count
46 utility provides a command line interface to functionality provided by the
50 As such, some of the functions are only available to users with write
53 normally only the super-user.
59 lists PCI devices in the following format:
61 foo0@pci0:0:4:0: class=0x010000 rev=0x01 hdr=0x00 vendor=0x1000 device=0x000f \
62 subvendor=0x0000 subdevice=0x0000
63 bar0@pci0:0:5:0: class=0x000100 rev=0x00 hdr=0x00 vendor=0x88c1 device=0x5333 \
64 subvendor=0x0000 subdevice=0x0000
65 none0@pci0:0:6:0: class=0x020000 rev=0x00 hdr=0x00 vendor=0x10ec device=0x8029 \
66 subvendor=0x0000 subdevice=0x0000
69 The first column gives the
70 driver name, unit number, and selector.
71 If there is no driver attached to the
73 device in question, the driver name will be
75 Unit numbers for detached devices start at zero and are incremented for
76 each detached device that is encountered.
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 prints the device's revision.
82 The fourth column describes the header type.
84 Currently assigned header types include 0 for standard devices,
94 If the most significant bit
95 of the header type register is set for
100 device, which contains several (similar or independent) functions on
103 The sixth and seventh columns contain the vendor ID and the device ID of the
105 The eigth and ninth columns contain subvendor and subdevice IDs, introduced
106 in revision 2.1 of the
109 Note that they will be 0 for older cards.
113 option causes output to be in a compact columnar format, suitable for
116 drv selector class rev hdr vendor device subven subdev
117 foo0@pci0:0:4:0: 010000 01 00 1000 000f 0000 0000
118 bar0@pci0:0:5:0: 000100 00 00 88c1 5333 0000 0000
119 none0@pci0:0:6:0: 020000 00 00 10ec 8029 0000 0000
122 All fields retain the same definition as with the non-compact form.
128 will list additional information for
137 specifically the resource ranges decoded by the bridge for use by devices
139 Each bridge lists a range of bus numbers handled by the bridge and its
141 Memory and I/O port decoding windows are enumerated via a line in the
144 window[1c] = type I/O Port, range 16, addr 0x5000-0x8fff, enabled
147 The first value after the
149 prefix in the square brackets is the offset of the decoding window in
150 config space in hexadecimal.
151 The type of a window is one of
153 .Dq Prefetchable Memory ,
156 The range indicates the binary log of the maximum address the window decodes.
157 The address field indicates the start and end addresses of the decoded range.
158 Finally, the last flag indicates if the window is enabled or disabled.
164 will list any base address registers
166 that are assigned resources for each device.
167 Each BAR will be enumerated via a line in the following format:
169 bar [10] = type Memory, range 32, base 0xda060000, size 131072, enabled
172 The first value after the
174 prefix in the square brackets is the offset of the BAR in config space in
176 The type of a BAR is one of
178 .Dq Prefetchable Memory ,
181 The range indicates the binary log of the maximum address the BAR decodes.
182 The base and size indicate the start and length of the BAR's address window,
184 Finally, the last flag indicates if the BAR is enabled or disabled.
190 will list any capabilities supported by each device.
191 A second invocation of
193 will print additional data for certain capabilities.
194 Each capability is enumerated via a line in the following format:
196 cap 10[40] = PCI-Express 1 root port
199 The first value after the
201 prefix is the capability ID in hexadecimal.
202 The second value in the square brackets is the offset of the capability
203 in config space in hexadecimal.
204 The format of the text after the equals sign is capability-specific.
206 Each extended capability is enumerated via a line in a similar format:
208 ecap 0002[100] = VC 1 max VC0
211 The first value after the
213 prefix is the extended capability ID in hexadecimal.
214 The second value in the square brackets is the offset of the extended
215 capability in config space in hexadecimal.
216 The format of the text after the equals sign is capability-specific.
222 will list any errors reported for this device in standard PCI error registers.
223 Errors are checked for in the PCI status register,
224 the PCI-express device status register,
225 and the Advanced Error Reporting status registers.
231 will attempt to load the vendor/device information database, and print
232 vendor, device, class and subclass identification strings for each device.
238 will list any vital product data
240 provided by each device.
241 Each VPD keyword is enumerated via a line in the following format:
243 VPD ro PN = '110114640C0 '
246 The first string after the
248 prefix indicates if the keyword is read-only
252 The second string provides the keyword name.
253 The text after the equals sign lists the value of the keyword which is
254 usually an ASCII string.
258 argument is given with the
262 will only list details about a single device instead of all devices.
270 The device can be identified either by a device name if the device is
271 attached to a driver or by a selector.
272 Selectors identify a PCI device by its address in PCI config space and
273 can take one of the following forms:
275 .Bl -bullet -offset indent -compact
277 .Li pci Ns Va domain Ns \&: Ns Va bus Ns \&: Ns Va device Ns \&: \
280 .Li pci Ns Va bus Ns \&: Ns Va device Ns \&: Ns Va function Ns
282 .Li pci Ns Va bus Ns \&: Ns Va device Ns
285 In the case of an abridged form, omitted selector components are assumed to be 0.
286 An optional leading device name followed by @ and an optional final colon
287 will be ignored; this is so that the first column in the output of
290 can be used without modification.
291 All numbers are base 10.
297 determines whether any driver has been assigned to the device
300 An exit status of zero indicates that the device has a driver;
301 non-zero indicates that it does not.
305 option reads a configuration space register at byte offset
309 and prints out its value in hexadecimal.
310 The optional second address
312 specifies a range to read.
317 into a configuration space register at byte offset
324 option request a dump of the specified BAR.
325 Dump is performed to the standard output, raw register values
329 to convert them to human-readable dump,
330 or redirect into a file to save the snapshot of the device state.
335 of the registers dumped can be specified, in multiple of the operation width,
338 For read, write, and dump operations, the flags
343 select the width of the operation;
345 indicates a byte operation, and
347 indicates a halfword (two-byte) operation.
349 indicates a quadword (four-byte) operation.
350 The default is to read or
351 write a longword (four bytes).
352 The quadword mode is only valid for BAR dump.
354 PCI vendor and device information is read from
355 .Pa /usr/local/share/pciids/pci.ids .
356 If that file is not present, it is read from
357 .Pa /usr/share/misc/pci_vendors .
358 This path can be overridden by setting the environment variable
359 .Ev PCICONF_VENDOR_DATABASE .
368 utility appeared first in
380 utility was written by
383 .An Garrett Wollman .
389 options are implemented in
391 but not in the underlying
394 It might be useful to give non-root users access to the
399 But only root will be able to execute a
401 to provide the device with a driver KLD, and reading of configuration space
402 registers may cause a failure in badly designed
406 There is currently no way to specify the caching mode for the mapping
411 always uses uncached access.
412 This is fine for control register BARs.