xref: /freebsd/usr.sbin/pciconf/pciconf.8 (revision c5e7e03a143ca33bf523994e766d62892780abcf)
197d92980SPeter Wemm.\" $FreeBSD$
2da4e0010SStefan Eßer.\" Copyright (c) 1997
3c5e7e03aSRuslan Ermilov.\"	Stefan Esser <se@FreeBSD.org>. All rights reserved.
4da4e0010SStefan Eßer.\"
5da4e0010SStefan Eßer.\" Redistribution and use in source and binary forms, with or without
6da4e0010SStefan Eßer.\" modification, are permitted provided that the following conditions
7da4e0010SStefan Eßer.\" are met:
8da4e0010SStefan Eßer.\" 1. Redistributions of source code must retain the above copyright
9da4e0010SStefan Eßer.\"    notice, this list of conditions and the following disclaimer.
10da4e0010SStefan Eßer.\"
11da4e0010SStefan Eßer.\" 2. Redistributions in binary form must reproduce the above copyright
12da4e0010SStefan Eßer.\"    notice, this list of conditions and the following disclaimer in the
13da4e0010SStefan Eßer.\"    documentation and/or other materials provided with the distribution.
14da4e0010SStefan Eßer.\"
15da4e0010SStefan Eßer.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16da4e0010SStefan Eßer.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17da4e0010SStefan Eßer.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18da4e0010SStefan Eßer.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19da4e0010SStefan Eßer.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20da4e0010SStefan Eßer.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21da4e0010SStefan Eßer.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22da4e0010SStefan Eßer.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23da4e0010SStefan Eßer.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24da4e0010SStefan Eßer.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25da4e0010SStefan Eßer.\" SUCH DAMAGE.
26da4e0010SStefan Eßer.\"
27da4e0010SStefan Eßer.Dd February 7, 1997
28da4e0010SStefan Eßer.Dt PCICONF 8
29a4c37c81SRuslan Ermilov.Os
30da4e0010SStefan Eßer.Sh NAME
31da4e0010SStefan Eßer.Nm pciconf
32da4e0010SStefan Eßer.Nd diagnostic utility for the PCI bus
33da4e0010SStefan Eßer.Sh SYNOPSIS
34e97407b4SRuslan Ermilov.Nm
35e97407b4SRuslan Ermilov.Fl l
36e97407b4SRuslan Ermilov.Nm
37e97407b4SRuslan Ermilov.Fl a Ar selector
38e97407b4SRuslan Ermilov.Nm
39e97407b4SRuslan Ermilov.Fl r Ar selector
40da4e0010SStefan Eßer.Op Fl b | Fl h
418d042147SWarner Losh.Ar reg Ns Op : Ns Ar reg2
42e97407b4SRuslan Ermilov.Nm
43e97407b4SRuslan Ermilov.Fl w Ar selector
44da4e0010SStefan Eßer.Op Fl b | Fl h
45da4e0010SStefan Eßer.Ar reg value
46da4e0010SStefan Eßer.Sh DESCRIPTION
47da4e0010SStefan EßerThe
48fbe2a70dSPhilippe Charnier.Nm
49da4e0010SStefan Eßercommand provides a command line interface to the functionality provided by
50da4e0010SStefan Eßer.Pa /dev/pci Ns 's
51da4e0010SStefan Eßer.Xr ioctl 2
52da4e0010SStefan Eßerinterface.
53da4e0010SStefan EßerWith the
54da4e0010SStefan Eßer.Fl l
55da4e0010SStefan Eßeroption, it lists all devices found by the boot probe in the following format:
56da4e0010SStefan Eßer.Bd -literal
577f054c59SKenneth D. Merryfoo0@pci0:4:0: class=0x010000 card=0x00000000 chip=0x000f1000 rev=0x01 hdr=0x00
587f054c59SKenneth D. Merrybar0@pci0:5:0: class=0x000100 card=0x00000000 chip=0x88c15333 rev=0x00 hdr=0x00
597f054c59SKenneth D. Merrynone0@pci0:6:0: class=0x020000 card=0x00000000 chip=0x802910ec rev=0x00 hdr=0x00
60da4e0010SStefan Eßer.Ed
61da4e0010SStefan Eßer.Pp
62d8134896SMike SmithIf the
63d8134896SMike Smith.Fl v
64a54bc9d0SMike Smithoption is supplied,
65a54bc9d0SMike Smith.Nm
66a54bc9d0SMike Smithwill attempt to load the vendor/device information database, and print
67a54bc9d0SMike Smithvendor, device, class and subclass identification strings for each device.
68d8134896SMike Smith.Pp
69da4e0010SStefan EßerThe first column gives the
707f054c59SKenneth D. Merrydevice name, unit number, and
717f054c59SKenneth D. Merry.Ar selector .
727f054c59SKenneth D. MerryIf there is no device configured in the kernel for the
737f054c59SKenneth D. Merry.Tn PCI
747f054c59SKenneth D. Merrydevice in question, the device name will be
757f054c59SKenneth D. Merry.Dq none .
767f054c59SKenneth D. MerryUnit numbers for unconfigured devices start at zero and are incremented for
777f054c59SKenneth D. Merryeach unconfigured device that is encountered.  The
78da4e0010SStefan Eßer.Ar selector
797f054c59SKenneth D. Merryis in a form which may directly be used for the other forms of the command.
80da4e0010SStefan EßerThe second column is the class code, with the class byte printed as two
81da4e0010SStefan Eßerhex digits, followed by the sub-class and the interface bytes.
82da4e0010SStefan EßerThe third column gives the contents of the subvendorid register, introduced
83da4e0010SStefan Eßerin revision 2.1 of the
84da4e0010SStefan Eßer.Tn PCI
85f2e366a1SSheldon Hearnstandard.
86f2e366a1SSheldon HearnIt is 0 for most current (2.0)
87da4e0010SStefan Eßer.Tn PCI
88da4e0010SStefan Eßercards, but is supposed to be loaded with a unique card identification code
89da4e0010SStefan Eßerin newly developed
90da4e0010SStefan Eßer.Tn PCI
91f2e366a1SSheldon Hearncards.
92f2e366a1SSheldon HearnThe field consists of the card ID in the upper
93da4e0010SStefan Eßerhalf and the card vendor ID in the lower half of the value.
94da4e0010SStefan Eßer.Pp
95da4e0010SStefan EßerThe fourth column contains the chip device ID, which identifies the chip
96f2e366a1SSheldon Hearnthis card is based on.
97f2e366a1SSheldon HearnIt consists of two fields, identifying the chip and
98da4e0010SStefan Eßerits vendor, as above.
99da4e0010SStefan EßerThe fifth column prints the chip's revision.
100da4e0010SStefan EßerThe sixth column describes the header type.
101da4e0010SStefan EßerCurrently assigned header types are 0 for all devices except
102da4e0010SStefan Eßer.Tn PCI
103da4e0010SStefan Eßerto
104da4e0010SStefan Eßer.Tn PCI
105f2e366a1SSheldon Hearnbridges, and 1 for such bridge chips.
106f2e366a1SSheldon HearnIf the most significant bit
107da4e0010SStefan Eßerof the header type register is set for
108da4e0010SStefan Eßerfunction 0 of a
109da4e0010SStefan Eßer.Tn PCI
110da4e0010SStefan Eßerdevice, it is a
111da4e0010SStefan Eßer.Em multi-function
112da4e0010SStefan Eßerdevice, which contains several (similar or independent) functions on
113da4e0010SStefan Eßerone chip.
114da4e0010SStefan Eßer.Pp
115da4e0010SStefan EßerThe
116da4e0010SStefan Eßer.Fl l
117da4e0010SStefan Eßeroption is the only one available to non-root users.
118da4e0010SStefan EßerAll other invocations of
119fbe2a70dSPhilippe Charnier.Nm
120da4e0010SStefan Eßerrequire a
121da4e0010SStefan Eßer.Ar selector
122da4e0010SStefan Eßerof the form
123da4e0010SStefan Eßer.Li pci Ns Va bus Ns \&: Ns Va device
124da4e0010SStefan Eßer(optionally followed by
125da4e0010SStefan Eßer.Li \&: Ns Va function ) .
126da4e0010SStefan EßerA final colon may be appended and
127da4e0010SStefan Eßerwill be ignored; this is so that the first column in the output of
128fbe2a70dSPhilippe Charnier.Nm
129da4e0010SStefan Eßer.Fl l
130da4e0010SStefan Eßercan be used without modification.  All numbers are base 10.
131da4e0010SStefan Eßer.Pp
132da4e0010SStefan EßerWith the
133da4e0010SStefan Eßer.Fl a
134da4e0010SStefan Eßerflag,
135fbe2a70dSPhilippe Charnier.Nm
136da4e0010SStefan Eßerdetermines whether any driver has been assigned to the device
137da4e0010SStefan Eßeridentified by
138da4e0010SStefan Eßer.Ar selector .
139da4e0010SStefan EßerAn exit status of zero indicates that the device has a driver;
140da4e0010SStefan Eßernon-zero indicates that it does not.
141da4e0010SStefan Eßer.Pp
142da4e0010SStefan EßerThe
143da4e0010SStefan Eßer.Fl r
144da4e0010SStefan Eßeroption reads a configuration space register at byte offset
145da4e0010SStefan Eßer.Ar reg
146da4e0010SStefan Eßerof device
147da4e0010SStefan Eßer.Ar selector
148da4e0010SStefan Eßerand prints out its value in hexadecimal.
1498d042147SWarner LoshThe optional second
1508d042147SWarner Losh.Ar reg2
1518d042147SWarner Loshspecifies a range to read.
152da4e0010SStefan EßerThe
153da4e0010SStefan Eßer.Fl w
154da4e0010SStefan Eßeroption writes the
155da4e0010SStefan Eßer.Ar value
156da4e0010SStefan Eßerinto a configuration space register at byte offset
157da4e0010SStefan Eßer.Ar reg
158da4e0010SStefan Eßerof device
159da4e0010SStefan Eßer.Ar selector .
160da4e0010SStefan EßerFor both operations, the flags
161da4e0010SStefan Eßer.Fl b
162da4e0010SStefan Eßerand
163da4e0010SStefan Eßer.Fl h
164da4e0010SStefan Eßerselect the width of the operation;
165da4e0010SStefan Eßer.Fl b
166da4e0010SStefan Eßerindicates a byte operation, and
167da4e0010SStefan Eßer.Fl h
168da4e0010SStefan Eßerindicates a halfword (two-byte) operation.  The default is to read or
169da4e0010SStefan Eßerwrite a longword (four bytes).
170a54bc9d0SMike Smith.Sh ENVIRONMENT
171a54bc9d0SMike SmithThe PCI vendor/device information database is normally read from
172a54bc9d0SMike Smith.Pa /usr/share/misc/pci_vendors .
173a54bc9d0SMike SmithThis path can be overridden by setting the environment variable
174a54bc9d0SMike Smith.Ev PCICONF_VENDOR_DATABASE .
175da4e0010SStefan Eßer.Sh SEE ALSO
176da4e0010SStefan Eßer.Xr ioctl 2 ,
177da4e0010SStefan Eßer.\" .Xr pci 4 ,
178589228bdSGuy Helmer.Xr kldload 8
179da4e0010SStefan Eßer.Sh HISTORY
180da4e0010SStefan EßerThe
181fbe2a70dSPhilippe Charnier.Nm
182da4e0010SStefan Eßercommand appeared first in
183da4e0010SStefan Eßer.Fx 2.2 .
184da4e0010SStefan EßerThe
185da4e0010SStefan Eßer.Fl a
186da4e0010SStefan Eßeroption was added for
187da4e0010SStefan Eßer.Tn PCI
188589228bdSGuy HelmerKLD support in
189da4e0010SStefan Eßer.Fx 3.0 .
190da4e0010SStefan Eßer.Sh AUTHORS
191f4d874a1SRuslan Ermilov.An -nosplit
192da4e0010SStefan EßerThe
193da4e0010SStefan Eßer.Nm
194fbe2a70dSPhilippe Charnierfacility was written by
195fbe2a70dSPhilippe Charnier.An Stefan Esser
196fbe2a70dSPhilippe Charnierand
197fbe2a70dSPhilippe Charnier.An Garrett Wollman .
198da4e0010SStefan Eßer.Sh BUGS
199da4e0010SStefan EßerThe
200da4e0010SStefan Eßer.Fl b
201da4e0010SStefan Eßerand
202da4e0010SStefan Eßer.Fl h
203da4e0010SStefan Eßeroptions are implemented in
204e97407b4SRuslan Ermilov.Nm ,
205da4e0010SStefan Eßerbut not in the underlying
206541c4ca0SPhilippe Charnier.Xr ioctl 2 .
207da4e0010SStefan Eßer.Pp
208da4e0010SStefan EßerIt might be useful to give non-root users access to the
209da4e0010SStefan Eßer.Fl a
210da4e0010SStefan Eßerand
211da4e0010SStefan Eßer.Fl r
212f2e366a1SSheldon Hearnoptions.
213f2e366a1SSheldon HearnBut only root will be able to execute a
214589228bdSGuy Helmer.Nm kldload
215589228bdSGuy Helmerto provide the device with a driver KLD, and reading of configuration space
216da4e0010SStefan Eßerregisters may cause a failure in badly designed
217da4e0010SStefan Eßer.Tn PCI
218da4e0010SStefan Eßerchips.
219