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