xref: /freebsd/usr.sbin/pciconf/pciconf.8 (revision 87569f75a91f298c52a71823c04d41cf53c88889)
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 7, 1997
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 v
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
64If the
65.Fl v
66option is supplied,
67.Nm
68will attempt to load the vendor/device information database, and print
69vendor, device, class and subclass identification strings for each device.
70.Pp
71The first column gives the
72device name, unit number, and
73.Ar selector .
74If there is no device configured in the kernel for the
75.Tn PCI
76device in question, the device name will be
77.Dq none .
78Unit numbers for unconfigured devices start at zero and are incremented for
79each unconfigured device that is encountered.
80The
81.Ar selector
82is in a form which may directly be used for the other forms of the command.
83The second column is the class code, with the class byte printed as two
84hex digits, followed by the sub-class and the interface bytes.
85The third column gives the contents of the subvendorid register, introduced
86in revision 2.1 of the
87.Tn PCI
88standard.
89It is 0 for most current (2.0)
90.Tn PCI
91cards, but is supposed to be loaded with a unique card identification code
92in newly developed
93.Tn PCI
94cards.
95The field consists of the card ID in the upper
96half and the card vendor ID in the lower half of the value.
97.Pp
98The fourth column contains the chip device ID, which identifies the chip
99this card is based on.
100It consists of two fields, identifying the chip and
101its vendor, as above.
102The fifth column prints the chip's revision.
103The sixth column describes the header type.
104Currently assigned header types are 0 for all devices except
105.Tn PCI
106to
107.Tn PCI
108bridges, and 1 for such bridge chips.
109If the most significant bit
110of the header type register is set for
111function 0 of a
112.Tn PCI
113device, it is a
114.Em multi-function
115device, which contains several (similar or independent) functions on
116one chip.
117.Pp
118All invocations of
119.Nm
120except for
121.Fl l
122require a
123.Ar selector
124of the form
125.Li pci Ns Va bus Ns \&: Ns Va device
126(optionally followed by
127.Li \&: Ns Va function ) .
128A final colon may be appended and
129will be ignored; this is so that the first column in the output of
130.Nm
131.Fl l
132can be used without modification.
133All numbers are base 10.
134.Pp
135With the
136.Fl a
137flag,
138.Nm
139determines whether any driver has been assigned to the device
140identified by
141.Ar selector .
142An exit status of zero indicates that the device has a driver;
143non-zero indicates that it does not.
144.Pp
145The
146.Fl r
147option reads a configuration space register at byte offset
148.Ar addr
149of device
150.Ar selector
151and prints out its value in hexadecimal.
152The optional second address
153.Ar addr2
154specifies a range to read.
155The
156.Fl w
157option writes the
158.Ar value
159into a configuration space register at byte offset
160.Ar addr
161of device
162.Ar selector .
163For both operations, the flags
164.Fl b
165and
166.Fl h
167select the width of the operation;
168.Fl b
169indicates a byte operation, and
170.Fl h
171indicates a halfword (two-byte) operation.
172The default is to read or
173write a longword (four bytes).
174.Sh ENVIRONMENT
175The PCI vendor/device information database is normally read from
176.Pa /usr/share/misc/pci_vendors .
177This path can be overridden by setting the environment variable
178.Ev PCICONF_VENDOR_DATABASE .
179.Sh SEE ALSO
180.Xr ioctl 2 ,
181.\" .Xr pci 4 ,
182.Xr kldload 8
183.Sh HISTORY
184The
185.Nm
186utility appeared first in
187.Fx 2.2 .
188The
189.Fl a
190option was added for
191.Tn PCI
192KLD support in
193.Fx 3.0 .
194.Sh AUTHORS
195.An -nosplit
196The
197.Nm
198utility was written by
199.An Stefan Esser
200and
201.An Garrett Wollman .
202.Sh BUGS
203The
204.Fl b
205and
206.Fl h
207options are implemented in
208.Nm ,
209but not in the underlying
210.Xr ioctl 2 .
211.Pp
212It might be useful to give non-root users access to the
213.Fl a
214and
215.Fl r
216options.
217But only root will be able to execute a
218.Nm kldload
219to provide the device with a driver KLD, and reading of configuration space
220registers may cause a failure in badly designed
221.Tn PCI
222chips.
223