2 .\" Copyright (c) 2005 Bruce M Simpson <bms@FreeBSD.org>
3 .\" All rights reserved.
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
8 .\" 1. Redistributions of source code must retain the above copyright
9 .\" notice, this list of conditions and the following disclaimer.
10 .\" 2. Redistributions in binary form must reproduce the above copyright
11 .\" notice, this list of conditions and the following disclaimer in the
12 .\" documentation and/or other materials provided with the distribution.
14 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 .\" $FreeBSD: src/share/man/man9/pci.9,v 1.11 2008/02/15 23:56:33 danger Exp $
27 .\" $DragonFly: src/share/man/man9/pci.9,v 1.6 2008/08/02 01:14:36 dillon Exp $
35 .Nm pci_write_config ,
36 .Nm pci_enable_busmaster ,
37 .Nm pci_disable_busmaster ,
40 .Nm pci_set_powerstate ,
41 .Nm pci_get_powerstate ,
50 .In bus/pci/pci_cfgreg.h
52 .Fn pci_write_config "device_t dev" "int reg" "uint32_t val" "int width"
54 .Fn pci_enable_busmaster "device_t dev"
56 .Fn pci_disable_busmaster "device_t dev"
58 .Fn pci_enable_io "device_t dev" "int space"
60 .Fn pci_disable_io "device_t dev" "int space"
62 .Fn pci_set_powerstate "device_t dev" "int state"
64 .Fn pci_get_powerstate "device_t dev"
66 .Fn pci_read_config "device_t dev" "int reg" "int width"
68 .Fn pci_find_bsf "uint8_t bus" "uint8_t slot" "uint8_t func"
70 .Fn pci_find_dbsf "uint32_t domain" "uint8_t bus" "uint8_t slot" "uint8_t func"
72 .Fn pci_find_device "uint16_t vendor" "uint16_t device"
76 set of functions are used for managing PCI devices.
80 function is used to read data from the PCI configuration
87 specifying the size of the access.
91 function is used to write the value
93 to the PCI configuration
100 specifying the size of the access.
103 .Fn pci_enable_busmaster
104 function enables PCI bus mastering for the device
107 .Dv PCIM_CMD_BUSMASTEREN
112 .Fn pci_disable_busmaster
113 function clears this bit.
117 function enables memory or I/O port address decoding for the device
125 register appropriately.
128 function clears the appropriate bit.
131 argument specifies which resource is affected; this can be either
138 These functions should be used in preference to manually manipulating
139 the configuration space.
142 .Fn pci_get_powerstate
143 function returns the current ACPI power state of the device
145 If the device does not support power management capabilities, then the default
147 .Dv PCI_POWERSTATE_D0
149 The following power states are defined by ACPI:
150 .Bl -hang -width ".Dv PCI_POWERSTATE_UNKNOWN"
151 .It Dv PCI_POWERSTATE_D0
152 State in which device is on and running.
153 It is receiving full power from the system and delivering
154 full functionality to the user.
155 .It Dv PCI_POWERSTATE_D1
156 Class-specific low-power state in which device context may or
158 Busses in this state cannot do anything to the bus, to
159 force devices to lose context.
160 .It Dv PCI_POWERSTATE_D2
161 Class-specific low-power state in which device context may or
163 Attains greater power savings than
164 .Dv PCI_POWERSTATE_D1 .
165 Busses in this state can cause devices to lose some context.
168 be prepared for the bus to be in this state or higher.
169 .It Dv PCI_POWERSTATE_D3
170 State in which the device is off and not running.
171 Device context is lost, and power from the device can
173 .It Dv PCI_POWERSTATE_UNKNOWN
174 State of the device is unknown.
178 .Fn pci_set_powerstate
179 function is used to transition the device
181 to the ACPI power state
183 It checks to see if the device is PCI 2.2 compliant.
185 capabilities pointer to determine which power states the device supports.
186 If the device does not have power management capabilities, the default state
188 .Dv PCI_POWERSTATE_D0
193 function looks up the
195 of a PCI device, given its
202 number actually refers to the number of the device on the bus,
203 which does not necessarily indicate its geographic location
204 in terms of a physical slot.
205 Note that in case the system has multiple PCI domains,
208 function only searches the first one.
209 Actually, it is equivalent to:
210 .Bd -literal -offset indent
211 pci_find_dbsf(0, bus, slot, func);
216 function looks up the
218 of a PCI device, given its
226 number actually refers to the number of the device on the bus,
227 which does not necessarily indicate its geographic location
228 in terms of a physical slot.
232 function looks up the
234 of a PCI device, given its
239 Note that there can be multiple matches for this search; this function
240 only returns the first matching device.
241 .Sh IMPLEMENTATION NOTES
244 type varies according to the size of the PCI bus address
245 space on the target architecture.
249 .Xr bus_alloc_resource 9 ,
251 .Xr bus_release_resource 9 ,
252 .Xr bus_setup_intr 9 ,
253 .Xr bus_teardown_intr 9 ,
259 .%B FreeBSD Developers' Handbook
261 .%O http://www.FreeBSD.org/doc/en_US.ISO8859-1/books/developers-handbook/
266 .%B PCI System Architecture
269 .%O ISBN 0-201-30974-2
272 This manual page was written by
273 .An Bruce M Simpson Aq bms@FreeBSD.org .
275 The kernel PCI code has a number of references to
277 These do not refer to the geographic location of PCI devices,
278 but to the device number assigned by the combination of the PCI IDSEL
279 mechanism and the platform firmware.
280 This should be taken note of when working with the kernel PCI code.