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 sel 38.Nm 39.Fl r Oo Fl b | h Oc Ar sel addr Ns Op : Ns Ar addr 40.Nm 41.Fl w Oo Fl b | h Oc Ar sel addr Op Ar value 42.Sh DESCRIPTION 43The 44.Nm 45utility 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 58If the 59.Fl v 60option is supplied, 61.Nm 62will attempt to load the vendor/device information database, and print 63vendor, device, class and subclass identification strings for each device. 64.Pp 65The first column gives the 66device name, unit number, and 67.Ar selector . 68If there is no device configured in the kernel for the 69.Tn PCI 70device in question, the device name will be 71.Dq none . 72Unit numbers for unconfigured devices start at zero and are incremented for 73each unconfigured device that is encountered. The 74.Ar selector 75is in a form which may directly be used for the other forms of the command. 76The second column is the class code, with the class byte printed as two 77hex digits, followed by the sub-class and the interface bytes. 78The third column gives the contents of the subvendorid register, introduced 79in revision 2.1 of the 80.Tn PCI 81standard. 82It is 0 for most current (2.0) 83.Tn PCI 84cards, but is supposed to be loaded with a unique card identification code 85in newly developed 86.Tn PCI 87cards. 88The field consists of the card ID in the upper 89half and the card vendor ID in the lower half of the value. 90.Pp 91The fourth column contains the chip device ID, which identifies the chip 92this card is based on. 93It consists of two fields, identifying the chip and 94its vendor, as above. 95The fifth column prints the chip's revision. 96The sixth column describes the header type. 97Currently assigned header types are 0 for all devices except 98.Tn PCI 99to 100.Tn PCI 101bridges, and 1 for such bridge chips. 102If the most significant bit 103of the header type register is set for 104function 0 of a 105.Tn PCI 106device, it is a 107.Em multi-function 108device, which contains several (similar or independent) functions on 109one chip. 110.Pp 111The 112.Fl l 113option is the only one available to non-root users. 114All other invocations of 115.Nm 116require a 117.Ar selector 118of the form 119.Li pci Ns Va bus Ns \&: Ns Va device 120(optionally followed by 121.Li \&: Ns Va function ) . 122A final colon may be appended and 123will be ignored; this is so that the first column in the output of 124.Nm 125.Fl l 126can be used without modification. All numbers are base 10. 127.Pp 128With the 129.Fl a 130flag, 131.Nm 132determines whether any driver has been assigned to the device 133identified by 134.Ar selector . 135An exit status of zero indicates that the device has a driver; 136non-zero indicates that it does not. 137.Pp 138The 139.Fl r 140option reads a configuration space register at byte offset 141.Ar reg 142of device 143.Ar selector 144and prints out its value in hexadecimal. 145The optional second 146.Ar reg2 147specifies a range to read. 148The 149.Fl w 150option writes the 151.Ar value 152into a configuration space register at byte offset 153.Ar reg 154of device 155.Ar selector . 156For both operations, the flags 157.Fl b 158and 159.Fl h 160select the width of the operation; 161.Fl b 162indicates a byte operation, and 163.Fl h 164indicates a halfword (two-byte) operation. The default is to read or 165write a longword (four bytes). 166.Sh ENVIRONMENT 167The PCI vendor/device information database is normally read from 168.Pa /usr/share/misc/pci_vendors . 169This path can be overridden by setting the environment variable 170.Ev PCICONF_VENDOR_DATABASE . 171.Sh SEE ALSO 172.Xr ioctl 2 , 173.\" .Xr pci 4 , 174.Xr kldload 8 175.Sh HISTORY 176The 177.Nm 178utility appeared first in 179.Fx 2.2 . 180The 181.Fl a 182option was added for 183.Tn PCI 184KLD support in 185.Fx 3.0 . 186.Sh AUTHORS 187.An -nosplit 188The 189.Nm 190utility was written by 191.An Stefan Esser 192and 193.An Garrett Wollman . 194.Sh BUGS 195The 196.Fl b 197and 198.Fl h 199options are implemented in 200.Nm Ns , 201but not in the underlying 202.Xr ioctl 2 . 203.Pp 204It might be useful to give non-root users access to the 205.Fl a 206and 207.Fl r 208options. 209But only root will be able to execute a 210.Nm kldload 211to provide the device with a driver KLD, and reading of configuration space 212registers may cause a failure in badly designed 213.Tn PCI 214chips. 215