xref: /freebsd/usr.sbin/pciconf/pciconf.8 (revision adeb92a24c57f97d5cd3c3c45be239cbb23aed68)
1.\" $FreeBSD$
2.\" Copyright (c) 1997
3.\"	Stefan Esser <se@FreeBSD.org>. All rights reserved.
4.\"
5.\" Redistribution and use in source and binary forms, with or without
6.\" modification, are permitted provided that the following conditions
7.\" are met:
8.\" 1. Redistributions of source code must retain the above copyright
9.\"    notice, this list of conditions and the following disclaimer.
10.\"
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\"    notice, this list of conditions and the following disclaimer in the
13.\"    documentation and/or other materials provided with the distribution.
14.\"
15.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25.\" SUCH DAMAGE.
26.\"
27.Dd February 7, 1997
28.Dt PCICONF 8
29.Os
30.Sh NAME
31.Nm pciconf
32.Nd diagnostic utility for the PCI bus
33.Sh SYNOPSIS
34.Nm
35.Fl l Op Fl v
36.Nm
37.Fl a Ar selector
38.Nm
39.Fl r Ar selector
40.Op Fl b | Fl h
41.Ar reg Ns Op : Ns Ar reg2
42.Nm
43.Fl w Ar selector
44.Op Fl b | Fl h
45.Ar reg value
46.Sh DESCRIPTION
47The
48.Nm
49command provides a command line interface to the functionality provided by
50.Pa /dev/pci Ns 's
51.Xr ioctl 2
52interface.
53With the
54.Fl l
55option, it lists all devices found by the boot probe in the following format:
56.Bd -literal
57foo0@pci0:4:0: class=0x010000 card=0x00000000 chip=0x000f1000 rev=0x01 hdr=0x00
58bar0@pci0:5:0: class=0x000100 card=0x00000000 chip=0x88c15333 rev=0x00 hdr=0x00
59none0@pci0:6:0: class=0x020000 card=0x00000000 chip=0x802910ec rev=0x00 hdr=0x00
60.Ed
61.Pp
62If the
63.Fl v
64option is supplied,
65.Nm
66will attempt to load the vendor/device information database, and print
67vendor, device, class and subclass identification strings for each device.
68.Pp
69The first column gives the
70device name, unit number, and
71.Ar selector .
72If there is no device configured in the kernel for the
73.Tn PCI
74device in question, the device name will be
75.Dq none .
76Unit numbers for unconfigured devices start at zero and are incremented for
77each unconfigured device that is encountered.  The
78.Ar selector
79is in a form which may directly be used for the other forms of the command.
80The second column is the class code, with the class byte printed as two
81hex digits, followed by the sub-class and the interface bytes.
82The third column gives the contents of the subvendorid register, introduced
83in revision 2.1 of the
84.Tn PCI
85standard.
86It is 0 for most current (2.0)
87.Tn PCI
88cards, but is supposed to be loaded with a unique card identification code
89in newly developed
90.Tn PCI
91cards.
92The field consists of the card ID in the upper
93half and the card vendor ID in the lower half of the value.
94.Pp
95The fourth column contains the chip device ID, which identifies the chip
96this card is based on.
97It consists of two fields, identifying the chip and
98its vendor, as above.
99The fifth column prints the chip's revision.
100The sixth column describes the header type.
101Currently assigned header types are 0 for all devices except
102.Tn PCI
103to
104.Tn PCI
105bridges, and 1 for such bridge chips.
106If the most significant bit
107of the header type register is set for
108function 0 of a
109.Tn PCI
110device, it is a
111.Em multi-function
112device, which contains several (similar or independent) functions on
113one chip.
114.Pp
115The
116.Fl l
117option is the only one available to non-root users.
118All other invocations of
119.Nm
120require a
121.Ar selector
122of the form
123.Li pci Ns Va bus Ns \&: Ns Va device
124(optionally followed by
125.Li \&: Ns Va function ) .
126A final colon may be appended and
127will be ignored; this is so that the first column in the output of
128.Nm
129.Fl l
130can be used without modification.  All numbers are base 10.
131.Pp
132With the
133.Fl a
134flag,
135.Nm
136determines whether any driver has been assigned to the device
137identified by
138.Ar selector .
139An exit status of zero indicates that the device has a driver;
140non-zero indicates that it does not.
141.Pp
142The
143.Fl r
144option reads a configuration space register at byte offset
145.Ar reg
146of device
147.Ar selector
148and prints out its value in hexadecimal.
149The optional second
150.Ar reg2
151specifies a range to read.
152The
153.Fl w
154option writes the
155.Ar value
156into a configuration space register at byte offset
157.Ar reg
158of device
159.Ar selector .
160For both operations, the flags
161.Fl b
162and
163.Fl h
164select the width of the operation;
165.Fl b
166indicates a byte operation, and
167.Fl h
168indicates a halfword (two-byte) operation.  The default is to read or
169write a longword (four bytes).
170.Sh ENVIRONMENT
171The PCI vendor/device information database is normally read from
172.Pa /usr/share/misc/pci_vendors .
173This path can be overridden by setting the environment variable
174.Ev PCICONF_VENDOR_DATABASE .
175.Sh SEE ALSO
176.Xr ioctl 2 ,
177.\" .Xr pci 4 ,
178.Xr kldload 8
179.Sh HISTORY
180The
181.Nm
182command appeared first in
183.Fx 2.2 .
184The
185.Fl a
186option was added for
187.Tn PCI
188KLD support in
189.Fx 3.0 .
190.Sh AUTHORS
191.An -nosplit
192The
193.Nm
194facility was written by
195.An Stefan Esser
196and
197.An Garrett Wollman .
198.Sh BUGS
199The
200.Fl b
201and
202.Fl h
203options are implemented in
204.Nm ,
205but not in the underlying
206.Xr ioctl 2 .
207.Pp
208It might be useful to give non-root users access to the
209.Fl a
210and
211.Fl r
212options.
213But only root will be able to execute a
214.Nm kldload
215to provide the device with a driver KLD, and reading of configuration space
216registers may cause a failure in badly designed
217.Tn PCI
218chips.
219