xref: /freebsd/usr.sbin/pciconf/pciconf.8 (revision b28624fde638caadd4a89f50c9b7e7da0f98c4d2)
1.\" Copyright (c) 1997
2.\"	Stefan Esser <se@FreeBSD.org>. All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice, this list of conditions and the following disclaimer.
9.\"
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.
13.\"
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
24.\" SUCH DAMAGE.
25.\"
26.\" $FreeBSD$
27.\"
28.Dd February 2, 2007
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 cv
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
44The
45.Nm
46utility provides a command line interface to functionality provided by the
47.Xr pci 4
48.Xr ioctl 2
49interface.
50As such, some of the functions are only available to users with write
51access to
52.Pa /dev/pci ,
53normally only the super-user.
54.Pp
55With the
56.Fl l
57option, it lists all devices found by the boot probe in the following format:
58.Bd -literal
59foo0@pci0:4:0: class=0x010000 card=0x00000000 chip=0x000f1000 rev=0x01 hdr=0x00
60bar0@pci0:5:0: class=0x000100 card=0x00000000 chip=0x88c15333 rev=0x00 hdr=0x00
61none0@pci0:6:0: class=0x020000 card=0x00000000 chip=0x802910ec rev=0x00 hdr=0x00
62.Ed
63.Pp
64The first column gives the
65device name, unit number, and
66.Ar selector .
67If there is no device configured in the kernel for the
68.Tn PCI
69device in question, the device name will be
70.Dq none .
71Unit numbers for unconfigured devices start at zero and are incremented for
72each unconfigured device that is encountered.
73The
74.Ar selector
75is in a form which may directly be used for the other forms of the command.
76The second column is the class code, with the class byte printed as two
77hex digits, followed by the sub-class and the interface bytes.
78The third column gives the contents of the subvendorid register, introduced
79in revision 2.1 of the
80.Tn PCI
81standard.
82Note that it will be 0 for older cards.
83The field consists of the card ID in the upper
84half and the card vendor ID in the lower half of the value.
85.Pp
86The fourth column contains the chip device ID, which identifies the chip
87this card is based on.
88It consists of two fields, identifying the chip and
89its vendor, as above.
90The fifth column prints the chip's revision.
91The sixth column describes the header type.
92Currently assigned header types include 0 for most devices,
931 for
94.Tn PCI
95to
96.Tn PCI
97bridges, and 2 for
98.Tn PCI
99to
100.Tn CardBus
101bridges.
102If the most significant bit
103of the header type register is set for
104function 0 of a
105.Tn PCI
106device, it is a
107.Em multi-function
108device, which contains several (similar or independent) functions on
109one chip.
110.Pp
111If the
112.Fl c
113option is supplied,
114.Nm
115will list any capabilities supported by each device.
116Each capability will be enumerated via a line in the following format:
117.Bd -literal
118    cap 10[40] = PCI-Express 1 root port
119.Ed
120.Pp
121The first value after the
122.Dq Li cap
123prefix is the capability ID in hexadecimal.
124The second value in the square brackets is the offset of the capability
125in config space in hexadecimal.
126The format of the text after the equals sign is capability-specific.
127.Pp
128If the
129.Fl v
130option is supplied,
131.Nm
132will attempt to load the vendor/device information database, and print
133vendor, device, class and subclass identification strings for each device.
134.Pp
135All invocations of
136.Nm
137except for
138.Fl l
139require a
140.Ar selector
141of the form
142.Li pci Ns Va bus Ns \&: Ns Va device
143(optionally followed by
144.Li \&: Ns Va function ) .
145A final colon may be appended and
146will be ignored; this is so that the first column in the output of
147.Nm
148.Fl l
149can be used without modification.
150All numbers are base 10.
151.Pp
152With the
153.Fl a
154flag,
155.Nm
156determines whether any driver has been assigned to the device
157identified by
158.Ar selector .
159An exit status of zero indicates that the device has a driver;
160non-zero indicates that it does not.
161.Pp
162The
163.Fl r
164option reads a configuration space register at byte offset
165.Ar addr
166of device
167.Ar selector
168and prints out its value in hexadecimal.
169The optional second address
170.Ar addr2
171specifies a range to read.
172The
173.Fl w
174option writes the
175.Ar value
176into a configuration space register at byte offset
177.Ar addr
178of device
179.Ar selector .
180For both operations, the flags
181.Fl b
182and
183.Fl h
184select the width of the operation;
185.Fl b
186indicates a byte operation, and
187.Fl h
188indicates a halfword (two-byte) operation.
189The default is to read or
190write a longword (four bytes).
191.Sh ENVIRONMENT
192The PCI vendor/device information database is normally read from
193.Pa /usr/share/misc/pci_vendors .
194This path can be overridden by setting the environment variable
195.Ev PCICONF_VENDOR_DATABASE .
196.Sh SEE ALSO
197.Xr ioctl 2 ,
198.\" .Xr pci 4 ,
199.Xr kldload 8
200.Sh HISTORY
201The
202.Nm
203utility appeared first in
204.Fx 2.2 .
205The
206.Fl a
207option was added for
208.Tn PCI
209KLD support in
210.Fx 3.0 .
211.Sh AUTHORS
212.An -nosplit
213The
214.Nm
215utility was written by
216.An Stefan Esser
217and
218.An Garrett Wollman .
219.Sh BUGS
220The
221.Fl b
222and
223.Fl h
224options are implemented in
225.Nm ,
226but not in the underlying
227.Xr ioctl 2 .
228.Pp
229It might be useful to give non-root users access to the
230.Fl a
231and
232.Fl r
233options.
234But only root will be able to execute a
235.Nm kldload
236to provide the device with a driver KLD, and reading of configuration space
237registers may cause a failure in badly designed
238.Tn PCI
239chips.
240