1 .\" $NetBSD: pci.3,v 1.6 2009/03/09 19:24:27 joerg Exp $
3 .\" Copyright 2001 Wasabi Systems, Inc.
4 .\" All rights reserved.
6 .\" Written by Jason R. Thorpe for Wasabi Systems, Inc.
8 .\" Redistribution and use in source and binary forms, with or without
9 .\" modification, are permitted provided that the following conditions
11 .\" 1. Redistributions of source code must retain the above copyright
12 .\" notice, this list of conditions and the following disclaimer.
13 .\" 2. Redistributions in binary form must reproduce the above copyright
14 .\" notice, this list of conditions and the following disclaimer in the
15 .\" documentation and/or other materials provided with the distribution.
16 .\" 3. All advertising materials mentioning features or use of this software
17 .\" must display the following acknowledgement:
18 .\" This product includes software developed for the NetBSD Project by
19 .\" Wasabi Systems, Inc.
20 .\" 4. The name of Wasabi Systems, Inc. may not be used to endorse
21 .\" or promote products derived from this software without specific prior
22 .\" written permission.
24 .\" THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
25 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
26 .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
27 .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC
28 .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29 .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30 .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31 .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32 .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34 .\" POSSIBILITY OF SUCH DAMAGE.
41 .Nd library interface for PCI bus access
47 .Fn pcibus_conf_read "int pcifd" "u_int bus" "u_int dev" "u_int func" \
48 "u_int reg" "pcireg_t *valp"
50 .Fn pcibus_conf_write "int pcifd" "u_int bus" "u_int dev" "u_int func" \
51 "u_int reg" "pcireg_t val"
53 .Fn pcidev_conf_read "int devfd" "u_int reg" "pcireg_t *valp"
55 .Fn pcidev_conf_write "int devfd" "u_int reg" "pcireg_t val"
57 .Fn pci_findvendor "pcireg_t id_reg"
59 .Fn pci_devinfo "pcireg_t id_reg" "pcireg_t class_reg" "char *devinfo" "size_t len"
61 .Fn pci_conf_print "int pcifd" "u_int bus" "u_int dev" "u_int func"
65 library provides support for accessing the PCI bus by user programs.
67 These functions are available in the
70 Programs should be linked with
72 .Sh CONFIGURATION SPACE FUNCTIONS
73 The following functions are used to access PCI configuration space:
75 .It Fn pcibus_conf_read
76 Access the PCI configuration register
78 on the device located at
82 and place the result in
85 must be an open file descriptor to a PCI bus within the target PCI domain.
86 .It Fn pcibus_conf_write
87 Write the value specified by
89 into the PCI configuration register
91 on the device located at
96 must be an open file descriptor to a PCI bus within the target PCI domain.
97 .It Fn pcidev_conf_read
98 Access the PCI configuration register
100 on the device associated with the open file descriptor
102 and place the result in
104 .It Fn pcidev_conf_write
105 Write the value specified by
107 into the PCI configuration register
109 on the device associated with the open file descriptor
112 .Sh MISCELLANEOUS FUNCTIONS
113 The following miscellaneous functions are available:
115 .It Fn pci_findvendor
116 Return an ASCII description of the PCI vendor in the
120 Return an ASCII description of the PCI vendor, PCI product,
121 and PCI class specified by the PCI ID register
123 and PCI class ID register
125 The description is placed into the buffer pointed to by
127 the size of that buffer is specified in
129 .It Fn pci_conf_print
130 Print the PCI configuration information for the device located
136 must be an open file descriptor to a PCI bus within the target PCI domain.
140 .Fn pcibus_conf_read ,
141 .Fn pcibus_conf_write ,
142 .Fn pcidev_conf_read ,
144 .Fn pcidev_conf_write
145 functions return 0 on success and -1 on failure.
149 function returns NULL if the PCI vendor description cannot be
155 .Fn pcibus_conf_read ,
156 .Fn pcibus_conf_write ,
157 .Fn pcidev_conf_read ,
158 .Fn pcidev_conf_write ,
163 functions first appeared in