2 .\" Copyright (c) 2003 Bruce M Simpson <bms@spc.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.2.2.1 2003/06/13 01:04:17 hmp Exp $
27 .\" $DragonFly: src/share/man/man9/pci.9,v 1.4 2006/10/14 23:46:23 swildner 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 ,
49 .In machine/pci_cfgreg.h
52 .Fn pci_write_config "device_t dev" "int reg" "u_int32_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 "u_int8_t" "u_int8_t" "u_int8_t"
70 .Fn pci_find_device "u_int16_t" "u_int16_t"
74 set of functions are used for managing PCI devices.
78 function is used to read data from the PCI configuration
85 specifying the size of the access.
89 function is used to write the value
91 to the PCI configuration
98 specifying the size of the access.
101 .Fn pci_enable_busmaster
102 function enables PCI bus mastering for the device
105 .Dv PCIM_CMD_BUSMASTEREN
110 .Fn pci_disable_busmaster
111 function clears this bit.
115 function enables memory or I/O port address decoding for the device
123 register appropriately. The
125 function clears the appropriate bit.
128 argument specifies which resource is affected; this can be either
135 These functions should be used in preference to manually manipulating
136 the configuration space.
139 .Fn pci_get_powerstate
140 function returns the current ACPI power state of the device
142 If the device does not support power management capabilities, then the default
144 .Dv PCI_POWERSTATE_D0
146 The following power states are defined by ACPI:
147 .Bl -hang -width PCI_POWERSTATE_UNKNOWN
148 .It Dv PCI_POWERSTATE_D0
149 State in which device is on and running.
150 It is receiving full power from the system and delivering
151 full functionality to the user.
152 .It Dv PCI_POWERSTATE_D1
153 Class-specific low-power state in which device context may or
155 Buses in this state cannot do anything to the bus, to
156 force devices to loose context.
157 .It Dv PCI_POWERSTATE_D2
158 Class-specific low-power state in which device context may or
160 Attains greater power savings than
161 .Dv PCI_POWERSTATE_D1 .
162 Buses in this state can cause devices to loose some context.
165 be prepared for the bus to be in this state or higher.
166 .It Dv PCI_POWERSTATE_D3
167 State in which the device is off and not running.
168 Device context is lost, and power from the device can
170 .It Dv PCI_POWERSTATE_UNKNOWN
171 State of the device is unknown.
175 .Fn pci_set_powerstate
176 function is used to transition the device
178 to the ACPI power state
180 It checks to see if the device is PCI 2.2 compliant.
182 capabilities pointer to determine which power states the device supports.
183 If the device does not have power management capabilities, the default state
185 .Dv PCI_POWERSTATE_D0
190 function looks up the
192 of a PCI device, given its
200 function looks up the
202 of a PCI device, given its
206 IDs. Note that there can be multiple matches for this search; this function
207 only returns the first matching device.
208 .Sh IMPLEMENTATION NOTES
211 type is varies according to the size of the PCI bus address
212 space on the target architecture.
216 .Xr bus_alloc_resource 9 ,
218 .Xr bus_release_resource 9 ,
219 .Xr BUS_SETUP_INTR 9 ,
220 .Xr BUS_TEARDOWN_INTR 9 ,
226 .%B FreeBSD Developers' Handbook
228 .%O http://www.FreeBSD.org/doc/en_US.ISO8859-1/books/developers-handbook/
233 .%B PCI System Architecture
236 .%O ISBN 0-201-30974-2
239 This man page was written by
240 .An Bruce M Simpson Aq bms@spc.org .
242 This manual page does not yet document PAE and how it affects memory-space
243 mapping of PCI devices.