xref: /freebsd/usr.sbin/pciconf/pciconf.8 (revision daf1cffce2e07931f27c6c6998652e90df6ba87e)
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 FreeBSD
30.Sh NAME
31.Nm pciconf
32.Nd diagnostic utility for the PCI bus
33.Sh SYNOPSIS
34.Nm pciconf Fl l
35.Nm pciconf Fl a Ar selector
36.Nm pciconf Fl r Ar selector
37.Op Fl b | Fl h
38.Ar reg
39.Nm pciconf Fl w Ar selector
40.Op Fl b | Fl h
41.Ar reg value
42.Sh DESCRIPTION
43The
44.Nm
45command provides a command line interface to the functionality provided by
46.Pa /dev/pci Ns 's
47.Xr ioctl 2
48interface.
49With the
50.Fl l
51option, it lists all devices found by the boot probe in the following format:
52.Bd -literal
53foo0@pci0:4:0: class=0x010000 card=0x00000000 chip=0x000f1000 rev=0x01 hdr=0x00
54bar0@pci0:5:0: class=0x000100 card=0x00000000 chip=0x88c15333 rev=0x00 hdr=0x00
55none0@pci0:6:0: class=0x020000 card=0x00000000 chip=0x802910ec rev=0x00 hdr=0x00
56.Ed
57.Pp
58The first column gives the
59device name, unit number, and
60.Ar selector .
61If there is no device configured in the kernel for the
62.Tn PCI
63device in question, the device name will be
64.Dq none .
65Unit numbers for unconfigured devices start at zero and are incremented for
66each unconfigured device that is encountered.  The
67.Ar selector
68is in a form which may directly be used for the other forms of the command.
69The second column is the class code, with the class byte printed as two
70hex digits, followed by the sub-class and the interface bytes.
71The third column gives the contents of the subvendorid register, introduced
72in revision 2.1 of the
73.Tn PCI
74standard. It is 0 for most current (2.0)
75.Tn PCI
76cards, but is supposed to be loaded with a unique card identification code
77in newly developed
78.Tn PCI
79cards. The field consists of the card ID in the upper
80half and the card vendor ID in the lower half of the value.
81.Pp
82The fourth column contains the chip device ID, which identifies the chip
83this card is based on. It consists of two fields, identifying the chip and
84its vendor, as above.
85The fifth column prints the chip's revision.
86The sixth column describes the header type.
87Currently assigned header types are 0 for all devices except
88.Tn PCI
89to
90.Tn PCI
91bridges, and 1 for such bridge chips. If the most significant bit
92of the header type register is set for
93function 0 of a
94.Tn PCI
95device, it is a
96.Em multi-function
97device, which contains several (similar or independent) functions on
98one chip.
99.Pp
100The
101.Fl l
102option is the only one available to non-root users.
103All other invocations of
104.Nm
105require a
106.Ar selector
107of the form
108.Li pci Ns Va bus Ns \&: Ns Va device
109(optionally followed by
110.Li \&: Ns Va function ) .
111A final colon may be appended and
112will be ignored; this is so that the first column in the output of
113.Nm
114.Fl l
115can be used without modification.  All numbers are base 10.
116.Pp
117With the
118.Fl a
119flag,
120.Nm
121determines whether any driver has been assigned to the device
122identified by
123.Ar selector .
124An exit status of zero indicates that the device has a driver;
125non-zero indicates that it does not.
126.Pp
127The
128.Fl r
129option reads a configuration space register at byte offset
130.Ar reg
131of device
132.Ar selector
133and prints out its value in hexadecimal.
134The
135.Fl w
136option writes the
137.Ar value
138into a configuration space register at byte offset
139.Ar reg
140of device
141.Ar selector .
142For both operations, the flags
143.Fl b
144and
145.Fl h
146select the width of the operation;
147.Fl b
148indicates a byte operation, and
149.Fl h
150indicates a halfword (two-byte) operation.  The default is to read or
151write a longword (four bytes).
152.Sh SEE ALSO
153.Xr ioctl 2 ,
154.\" .Xr pci 4 ,
155.Xr kldload 8
156.Sh HISTORY
157The
158.Nm
159command appeared first in
160.Fx 2.2 .
161The
162.Fl a
163option was added for
164.Tn PCI
165KLD support in
166.Fx 3.0 .
167.Sh AUTHORS
168The
169.Nm
170facility was written by
171.An Stefan Esser
172and
173.An Garrett Wollman .
174.Sh BUGS
175The
176.Fl b
177and
178.Fl h
179options are implemented in
180.Nm Ns ,
181but not in the underlying
182.Xr ioctl 2 .
183.Pp
184It might be useful to give non-root users access to the
185.Fl a
186and
187.Fl r
188options. But only root will be able to execute a
189.Nm kldload
190to provide the device with a driver KLD, and reading of configuration space
191registers may cause a failure in badly designed
192.Tn PCI
193chips.
194