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