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