xref: /freebsd/share/man/man9/pci.9 (revision 7a16dacdfac54cea9ffc37a85e4c42e73d080a4e)
1aac0aafaSHiten Pandya.\"
2bf1639eeSBruce M Simpson.\" Copyright (c) 2005 Bruce M Simpson <bms@FreeBSD.org>
3aac0aafaSHiten Pandya.\" All rights reserved.
4aac0aafaSHiten Pandya.\"
5aac0aafaSHiten Pandya.\" Redistribution and use in source and binary forms, with or without
6aac0aafaSHiten Pandya.\" modification, are permitted provided that the following conditions
7aac0aafaSHiten Pandya.\" are met:
8aac0aafaSHiten Pandya.\" 1. Redistributions of source code must retain the above copyright
9aac0aafaSHiten Pandya.\"    notice, this list of conditions and the following disclaimer.
10aac0aafaSHiten Pandya.\" 2. Redistributions in binary form must reproduce the above copyright
11aac0aafaSHiten Pandya.\"    notice, this list of conditions and the following disclaimer in the
12aac0aafaSHiten Pandya.\"    documentation and/or other materials provided with the distribution.
13aac0aafaSHiten Pandya.\"
14aac0aafaSHiten Pandya.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15aac0aafaSHiten Pandya.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16aac0aafaSHiten Pandya.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17aac0aafaSHiten Pandya.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18aac0aafaSHiten Pandya.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19aac0aafaSHiten Pandya.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20aac0aafaSHiten Pandya.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21aac0aafaSHiten Pandya.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22aac0aafaSHiten Pandya.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23aac0aafaSHiten Pandya.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24aac0aafaSHiten Pandya.\" SUCH DAMAGE.
25aac0aafaSHiten Pandya.\"
26aac0aafaSHiten Pandya.\" $FreeBSD$
27aac0aafaSHiten Pandya.\"
28db4fcadfSConrad Meyer.Dd January 15, 2017
29aac0aafaSHiten Pandya.Dt PCI 9
30aac0aafaSHiten Pandya.Os
31aac0aafaSHiten Pandya.Sh NAME
32aac0aafaSHiten Pandya.Nm pci ,
33855ed4c5SJohn Baldwin.Nm pci_alloc_msi ,
34855ed4c5SJohn Baldwin.Nm pci_alloc_msix ,
35aac0aafaSHiten Pandya.Nm pci_disable_busmaster ,
36aac0aafaSHiten Pandya.Nm pci_disable_io ,
370a9c80e5SJohn Baldwin.Nm pci_enable_busmaster ,
380a9c80e5SJohn Baldwin.Nm pci_enable_io ,
39aac0aafaSHiten Pandya.Nm pci_find_bsf ,
40855ed4c5SJohn Baldwin.Nm pci_find_cap ,
4155aaf894SMarius Strobl.Nm pci_find_dbsf ,
420a9c80e5SJohn Baldwin.Nm pci_find_device ,
4368bf9717SJohn Baldwin.Nm pci_find_extcap ,
4468bf9717SJohn Baldwin.Nm pci_find_htcap ,
45*7a16dacdSBryan Venteicher.Nm pci_find_next_cap ,
46*7a16dacdSBryan Venteicher.Nm pci_find_next_extcap ,
47*7a16dacdSBryan Venteicher.Nm pci_find_next_htcap ,
4887dd2f95SJohn Baldwin.Nm pci_find_pcie_root_port ,
49d7be980dSAndrew Turner.Nm pci_get_id ,
502ab0398dSJohn Baldwin.Nm pci_get_max_payload ,
51855ed4c5SJohn Baldwin.Nm pci_get_max_read_req ,
520a9c80e5SJohn Baldwin.Nm pci_get_powerstate ,
53855ed4c5SJohn Baldwin.Nm pci_get_vpd_ident ,
54855ed4c5SJohn Baldwin.Nm pci_get_vpd_readonly ,
557d971e36SRyan Stone.Nm pci_iov_attach ,
560aee83ccSJohn Baldwin.Nm pci_iov_attach_name ,
577d971e36SRyan Stone.Nm pci_iov_detach ,
58855ed4c5SJohn Baldwin.Nm pci_msi_count ,
59855ed4c5SJohn Baldwin.Nm pci_msix_count ,
60ce204e1bSJohn Baldwin.Nm pci_msix_pba_bar ,
61ce204e1bSJohn Baldwin.Nm pci_msix_table_bar ,
62855ed4c5SJohn Baldwin.Nm pci_pending_msix ,
630a9c80e5SJohn Baldwin.Nm pci_read_config ,
64855ed4c5SJohn Baldwin.Nm pci_release_msi ,
65855ed4c5SJohn Baldwin.Nm pci_remap_msix ,
660a9c80e5SJohn Baldwin.Nm pci_restore_state ,
670a9c80e5SJohn Baldwin.Nm pci_save_state ,
68855ed4c5SJohn Baldwin.Nm pci_set_max_read_req ,
690a9c80e5SJohn Baldwin.Nm pci_set_powerstate ,
70ec603c72SJohn Baldwin.Nm pci_write_config ,
71ec603c72SJohn Baldwin.Nm pcie_adjust_config ,
72da0fc925SJohn Baldwin.Nm pcie_flr ,
73da0fc925SJohn Baldwin.Nm pcie_get_max_completion_timeout ,
74ec603c72SJohn Baldwin.Nm pcie_read_config ,
75da0fc925SJohn Baldwin.Nm pcie_wait_for_pending_transactions ,
76ec603c72SJohn Baldwin.Nm pcie_write_config
77aac0aafaSHiten Pandya.Nd PCI bus interface
78aac0aafaSHiten Pandya.Sh SYNOPSIS
79aac0aafaSHiten Pandya.In sys/bus.h
80aac0aafaSHiten Pandya.In dev/pci/pcireg.h
81855ed4c5SJohn Baldwin.In dev/pci/pcivar.h
82855ed4c5SJohn Baldwin.Ft int
83855ed4c5SJohn Baldwin.Fn pci_alloc_msi "device_t dev" "int *count"
84855ed4c5SJohn Baldwin.Ft int
85855ed4c5SJohn Baldwin.Fn pci_alloc_msix "device_t dev" "int *count"
86aac0aafaSHiten Pandya.Ft int
87aac0aafaSHiten Pandya.Fn pci_disable_busmaster "device_t dev"
88aac0aafaSHiten Pandya.Ft int
89aac0aafaSHiten Pandya.Fn pci_disable_io "device_t dev" "int space"
90aac0aafaSHiten Pandya.Ft int
910a9c80e5SJohn Baldwin.Fn pci_enable_busmaster "device_t dev"
92aac0aafaSHiten Pandya.Ft int
930a9c80e5SJohn Baldwin.Fn pci_enable_io "device_t dev" "int space"
94aac0aafaSHiten Pandya.Ft device_t
9565bb31b8SRuslan Ermilov.Fn pci_find_bsf "uint8_t bus" "uint8_t slot" "uint8_t func"
96855ed4c5SJohn Baldwin.Ft int
97855ed4c5SJohn Baldwin.Fn pci_find_cap "device_t dev" "int capability" "int *capreg"
98aac0aafaSHiten Pandya.Ft device_t
9955aaf894SMarius Strobl.Fn pci_find_dbsf "uint32_t domain" "uint8_t bus" "uint8_t slot" "uint8_t func"
10055aaf894SMarius Strobl.Ft device_t
10165bb31b8SRuslan Ermilov.Fn pci_find_device "uint16_t vendor" "uint16_t device"
1020a9c80e5SJohn Baldwin.Ft int
10368bf9717SJohn Baldwin.Fn pci_find_extcap "device_t dev" "int capability" "int *capreg"
10468bf9717SJohn Baldwin.Ft int
10568bf9717SJohn Baldwin.Fn pci_find_htcap "device_t dev" "int capability" "int *capreg"
106*7a16dacdSBryan Venteicher.Ft int
107*7a16dacdSBryan Venteicher.Fn pci_find_next_cap "device_t dev" "int capability" "int start" "int *capreg"
108*7a16dacdSBryan Venteicher.Ft int
109*7a16dacdSBryan Venteicher.Fn pci_find_next_extcap "device_t dev" "int capability" "int start" "int *capreg"
110*7a16dacdSBryan Venteicher.Ft int
111*7a16dacdSBryan Venteicher.Fn pci_find_next_htcap "device_t dev" "int capability" "int start" "int *capreg"
11287dd2f95SJohn Baldwin.Ft device_t
11387dd2f95SJohn Baldwin.Fn pci_find_pcie_root_port "device_t dev"
11468bf9717SJohn Baldwin.Ft int
115d7be980dSAndrew Turner.Fn pci_get_id "device_t dev" "enum pci_id_type type" "uintptr_t *id"
116d7be980dSAndrew Turner.Ft int
1172ab0398dSJohn Baldwin.Fn pci_get_max_payload "device_t dev"
1182ab0398dSJohn Baldwin.Ft int
119855ed4c5SJohn Baldwin.Fn pci_get_max_read_req "device_t dev"
120855ed4c5SJohn Baldwin.Ft int
1210a9c80e5SJohn Baldwin.Fn pci_get_powerstate "device_t dev"
122855ed4c5SJohn Baldwin.Ft int
123855ed4c5SJohn Baldwin.Fn pci_get_vpd_ident "device_t dev" "const char **identptr"
124855ed4c5SJohn Baldwin.Ft int
125855ed4c5SJohn Baldwin.Fn pci_get_vpd_readonly "device_t dev" "const char *kw" "const char **vptr"
126855ed4c5SJohn Baldwin.Ft int
127855ed4c5SJohn Baldwin.Fn pci_msi_count "device_t dev"
128855ed4c5SJohn Baldwin.Ft int
129855ed4c5SJohn Baldwin.Fn pci_msix_count "device_t dev"
130855ed4c5SJohn Baldwin.Ft int
131ce204e1bSJohn Baldwin.Fn pci_msix_pba_bar "device_t dev"
132ce204e1bSJohn Baldwin.Ft int
133ce204e1bSJohn Baldwin.Fn pci_msix_table_bar "device_t dev"
134ce204e1bSJohn Baldwin.Ft int
135855ed4c5SJohn Baldwin.Fn pci_pending_msix "device_t dev" "u_int index"
1360a9c80e5SJohn Baldwin.Ft uint32_t
1370a9c80e5SJohn Baldwin.Fn pci_read_config "device_t dev" "int reg" "int width"
138855ed4c5SJohn Baldwin.Ft int
139855ed4c5SJohn Baldwin.Fn pci_release_msi "device_t dev"
140855ed4c5SJohn Baldwin.Ft int
141855ed4c5SJohn Baldwin.Fn pci_remap_msix "device_t dev" "int count" "const u_int *vectors"
1420a9c80e5SJohn Baldwin.Ft void
1430a9c80e5SJohn Baldwin.Fn pci_restore_state "device_t dev"
1440a9c80e5SJohn Baldwin.Ft void
1450a9c80e5SJohn Baldwin.Fn pci_save_state "device_t dev"
1460a9c80e5SJohn Baldwin.Ft int
147855ed4c5SJohn Baldwin.Fn pci_set_max_read_req "device_t dev" "int size"
148855ed4c5SJohn Baldwin.Ft int
1490a9c80e5SJohn Baldwin.Fn pci_set_powerstate "device_t dev" "int state"
1500a9c80e5SJohn Baldwin.Ft void
1510a9c80e5SJohn Baldwin.Fn pci_write_config "device_t dev" "int reg" "uint32_t val" "int width"
152ec603c72SJohn Baldwin.Ft uint32_t
153ec603c72SJohn Baldwin.Fo pcie_adjust_config
154ec603c72SJohn Baldwin.Fa "device_t dev"
155ec603c72SJohn Baldwin.Fa "int reg"
156ec603c72SJohn Baldwin.Fa "uint32_t mask"
157ec603c72SJohn Baldwin.Fa "uint32_t val"
158ec603c72SJohn Baldwin.Fa "int width"
159ec603c72SJohn Baldwin.Fc
160da0fc925SJohn Baldwin.Ft bool
161da0fc925SJohn Baldwin.Fn pcie_flr "device_t dev" "u_int max_delay" "bool force"
162da0fc925SJohn Baldwin.Ft int
163da0fc925SJohn Baldwin.Fn pcie_get_max_completion_timeout "device_t dev"
164ec603c72SJohn Baldwin.Ft uint32_t
165ec603c72SJohn Baldwin.Fn pcie_read_config "device_t dev" "int reg" "int width"
166da0fc925SJohn Baldwin.Ft bool
167da0fc925SJohn Baldwin.Fn pcie_wait_for_pending_transactions "device_t dev" "u_int max_delay"
168ec603c72SJohn Baldwin.Ft void
169ec603c72SJohn Baldwin.Fn pcie_write_config "device_t dev" "int reg" "uint32_t val" "int width"
17064414cc0SJohn Baldwin.Ft void
17164414cc0SJohn Baldwin.Fn pci_event_fn "void *arg" "device_t dev"
17264414cc0SJohn Baldwin.Fn EVENTHANDLER_REGISTER "pci_add_device" "pci_event_fn"
17364414cc0SJohn Baldwin.Fn EVENTHANDLER_DEREGISTER "pci_delete_resource" "pci_event_fn"
174f3bb9251SJohn Baldwin.In dev/pci/pci_iov.h
175f3bb9251SJohn Baldwin.Ft int
176f3bb9251SJohn Baldwin.Fn pci_iov_attach "device_t dev" "nvlist_t *pf_schema" "nvlist_t *vf_schema"
177f3bb9251SJohn Baldwin.Ft int
1780aee83ccSJohn Baldwin.Fo pci_iov_attach_name
1790aee83ccSJohn Baldwin.Fa "device_t dev"
1800aee83ccSJohn Baldwin.Fa "nvlist_t *pf_schema"
1810aee83ccSJohn Baldwin.Fa "nvlist_t *vf_schema"
1820aee83ccSJohn Baldwin.Fa "const char *fmt"
1830aee83ccSJohn Baldwin.Fa "..."
1840aee83ccSJohn Baldwin.Fc
1850aee83ccSJohn Baldwin.Ft int
186f3bb9251SJohn Baldwin.Fn pci_iov_detach "device_t dev"
187aac0aafaSHiten Pandya.Sh DESCRIPTION
188aac0aafaSHiten PandyaThe
189aac0aafaSHiten Pandya.Nm
190aac0aafaSHiten Pandyaset of functions are used for managing PCI devices.
191855ed4c5SJohn BaldwinThe functions are split into several groups:
192855ed4c5SJohn Baldwinraw configuration access,
193855ed4c5SJohn Baldwinlocating devices,
194855ed4c5SJohn Baldwindevice information,
195855ed4c5SJohn Baldwindevice configuration,
196855ed4c5SJohn Baldwinand
197855ed4c5SJohn Baldwinmessage signaled interrupts.
198855ed4c5SJohn Baldwin.Ss Raw Configuration Access
199aac0aafaSHiten PandyaThe
200aac0aafaSHiten Pandya.Fn pci_read_config
201aac0aafaSHiten Pandyafunction is used to read data from the PCI configuration
202aac0aafaSHiten Pandyaspace of the device
203aac0aafaSHiten Pandya.Fa dev ,
204aac0aafaSHiten Pandyaat offset
205aac0aafaSHiten Pandya.Fa reg ,
206aac0aafaSHiten Pandyawith
207aac0aafaSHiten Pandya.Fa width
208aac0aafaSHiten Pandyaspecifying the size of the access.
209aac0aafaSHiten Pandya.Pp
210aac0aafaSHiten PandyaThe
211aac0aafaSHiten Pandya.Fn pci_write_config
212aac0aafaSHiten Pandyafunction is used to write the value
213aac0aafaSHiten Pandya.Fa val
214aac0aafaSHiten Pandyato the PCI configuration
215aac0aafaSHiten Pandyaspace of the device
216aac0aafaSHiten Pandya.Fa dev ,
217aac0aafaSHiten Pandyaat offset
218aac0aafaSHiten Pandya.Fa reg ,
219aac0aafaSHiten Pandyawith
220aac0aafaSHiten Pandya.Fa width
221aac0aafaSHiten Pandyaspecifying the size of the access.
222aac0aafaSHiten Pandya.Pp
223ec603c72SJohn BaldwinThe
224ec603c72SJohn Baldwin.Fn pcie_adjust_config
225ec603c72SJohn Baldwinfunction is used to modify the value of a register in the PCI-express
226ec603c72SJohn Baldwincapability register set of device
227ec603c72SJohn Baldwin.Fa dev .
228ec603c72SJohn BaldwinThe offset
229ec603c72SJohn Baldwin.Fa reg
230ec603c72SJohn Baldwinspecifies a relative offset in the register set with
231ec603c72SJohn Baldwin.Fa width
232ec603c72SJohn Baldwinspecifying the size of the access.
233ec603c72SJohn BaldwinThe new value of the register is computed by modifying bits set in
234ec603c72SJohn Baldwin.Fa mask
235ec603c72SJohn Baldwinto the value in
236ec603c72SJohn Baldwin.Fa val .
237ec603c72SJohn BaldwinAny bits not specified in
238ec603c72SJohn Baldwin.Fa mask
239ec603c72SJohn Baldwinare preserved.
240ec603c72SJohn BaldwinThe previous value of the register is returned.
241ec603c72SJohn Baldwin.Pp
242ec603c72SJohn BaldwinThe
243ec603c72SJohn Baldwin.Fn pcie_read_config
244ec603c72SJohn Baldwinfunction is used to read the value of a register in the PCI-express
245ec603c72SJohn Baldwincapability register set of device
246ec603c72SJohn Baldwin.Fa dev .
247ec603c72SJohn BaldwinThe offset
248ec603c72SJohn Baldwin.Fa reg
249ec603c72SJohn Baldwinspecifies a relative offset in the register set with
250ec603c72SJohn Baldwin.Fa width
251ec603c72SJohn Baldwinspecifying the size of the access.
252ec603c72SJohn Baldwin.Pp
253ec603c72SJohn BaldwinThe
254ec603c72SJohn Baldwin.Fn pcie_write_config
255ec603c72SJohn Baldwinfunction is used to write the value
256ec603c72SJohn Baldwin.Fa val
257ec603c72SJohn Baldwinto a register in the PCI-express capability register set of device
258ec603c72SJohn Baldwin.Fa dev .
259ec603c72SJohn BaldwinThe offset
260ec603c72SJohn Baldwin.Fa reg
261ec603c72SJohn Baldwinspecifies a relative offset in the register set with
262ec603c72SJohn Baldwin.Fa width
263ec603c72SJohn Baldwinspecifying the size of the access.
264ec603c72SJohn Baldwin.Pp
265855ed4c5SJohn Baldwin.Em NOTE :
266855ed4c5SJohn BaldwinDevice drivers should only use these functions for functionality that
267855ed4c5SJohn Baldwinis not available via another
268855ed4c5SJohn Baldwin.Fn pci
269855ed4c5SJohn Baldwinfunction.
270855ed4c5SJohn Baldwin.Ss Locating Devices
271855ed4c5SJohn BaldwinThe
272855ed4c5SJohn Baldwin.Fn pci_find_bsf
273855ed4c5SJohn Baldwinfunction looks up the
274855ed4c5SJohn Baldwin.Vt device_t
275855ed4c5SJohn Baldwinof a PCI device, given its
276855ed4c5SJohn Baldwin.Fa bus ,
277855ed4c5SJohn Baldwin.Fa slot ,
278855ed4c5SJohn Baldwinand
279855ed4c5SJohn Baldwin.Fa func .
280855ed4c5SJohn BaldwinThe
281855ed4c5SJohn Baldwin.Fa slot
282855ed4c5SJohn Baldwinnumber actually refers to the number of the device on the bus,
283855ed4c5SJohn Baldwinwhich does not necessarily indicate its geographic location
284855ed4c5SJohn Baldwinin terms of a physical slot.
285855ed4c5SJohn BaldwinNote that in case the system has multiple PCI domains,
286855ed4c5SJohn Baldwinthe
287855ed4c5SJohn Baldwin.Fn pci_find_bsf
288855ed4c5SJohn Baldwinfunction only searches the first one.
289855ed4c5SJohn BaldwinActually, it is equivalent to:
290855ed4c5SJohn Baldwin.Bd -literal -offset indent
291855ed4c5SJohn Baldwinpci_find_dbsf(0, bus, slot, func);
292855ed4c5SJohn Baldwin.Ed
293855ed4c5SJohn Baldwin.Pp
294855ed4c5SJohn BaldwinThe
295855ed4c5SJohn Baldwin.Fn pci_find_dbsf
296855ed4c5SJohn Baldwinfunction looks up the
297855ed4c5SJohn Baldwin.Vt device_t
298855ed4c5SJohn Baldwinof a PCI device, given its
299855ed4c5SJohn Baldwin.Fa domain ,
300855ed4c5SJohn Baldwin.Fa bus ,
301855ed4c5SJohn Baldwin.Fa slot ,
302855ed4c5SJohn Baldwinand
303855ed4c5SJohn Baldwin.Fa func .
304855ed4c5SJohn BaldwinThe
305855ed4c5SJohn Baldwin.Fa slot
306855ed4c5SJohn Baldwinnumber actually refers to the number of the device on the bus,
307855ed4c5SJohn Baldwinwhich does not necessarily indicate its geographic location
308855ed4c5SJohn Baldwinin terms of a physical slot.
309855ed4c5SJohn Baldwin.Pp
310855ed4c5SJohn BaldwinThe
311855ed4c5SJohn Baldwin.Fn pci_find_device
312855ed4c5SJohn Baldwinfunction looks up the
313855ed4c5SJohn Baldwin.Vt device_t
314855ed4c5SJohn Baldwinof a PCI device, given its
315855ed4c5SJohn Baldwin.Fa vendor
316855ed4c5SJohn Baldwinand
317855ed4c5SJohn Baldwin.Fa device
318855ed4c5SJohn BaldwinIDs.
319855ed4c5SJohn BaldwinNote that there can be multiple matches for this search; this function
320855ed4c5SJohn Baldwinonly returns the first matching device.
321855ed4c5SJohn Baldwin.Ss Device Information
322855ed4c5SJohn BaldwinThe
323855ed4c5SJohn Baldwin.Fn pci_find_cap
324855ed4c5SJohn Baldwinfunction is used to locate the first instance of a PCI capability
325855ed4c5SJohn Baldwinregister set for the device
326855ed4c5SJohn Baldwin.Fa dev .
327855ed4c5SJohn BaldwinThe capability to locate is specified by ID via
328855ed4c5SJohn Baldwin.Fa capability .
329855ed4c5SJohn BaldwinConstant macros of the form
330855ed4c5SJohn Baldwin.Dv PCIY_xxx
331855ed4c5SJohn Baldwinfor standard capability IDs are defined in
332855ed4c5SJohn Baldwin.In dev/pci/pcireg.h .
333855ed4c5SJohn BaldwinIf the capability is found, then
334855ed4c5SJohn Baldwin.Fa *capreg
335281a359eSJohn Baldwinis set to the offset in configuration space of the capability register set,
336855ed4c5SJohn Baldwinand
337855ed4c5SJohn Baldwin.Fn pci_find_cap
338855ed4c5SJohn Baldwinreturns zero.
339855ed4c5SJohn BaldwinIf the capability is not found or the device does not support capabilities,
340855ed4c5SJohn Baldwin.Fn pci_find_cap
341855ed4c5SJohn Baldwinreturns an error.
342*7a16dacdSBryan VenteicherThe
343*7a16dacdSBryan Venteicher.Fn pci_find_next_cap
344*7a16dacdSBryan Venteicherfunction is used to locate the next instance of a PCI capability
345*7a16dacdSBryan Venteicherregister set for the device
346*7a16dacdSBryan Venteicher.Fa dev .
347*7a16dacdSBryan VenteicherThe
348*7a16dacdSBryan Venteicher.Fa start
349*7a16dacdSBryan Venteichershould be the
350*7a16dacdSBryan Venteicher.Fa *capreg
351*7a16dacdSBryan Venteicherreturned by a prior
352*7a16dacdSBryan Venteicher.Fn pci_find_cap
353*7a16dacdSBryan Venteicheror
354*7a16dacdSBryan Venteicher.Fn pci_find_next_cap .
355*7a16dacdSBryan VenteicherWhen no more instances are located
356*7a16dacdSBryan Venteicher.Fn pci_find_next_cap
357*7a16dacdSBryan Venteicherreturns an error.
358855ed4c5SJohn Baldwin.Pp
359855ed4c5SJohn BaldwinThe
36068bf9717SJohn Baldwin.Fn pci_find_extcap
36168bf9717SJohn Baldwinfunction is used to locate the first instance of a PCI-express
36268bf9717SJohn Baldwinextended capability register set for the device
36368bf9717SJohn Baldwin.Fa dev .
36468bf9717SJohn BaldwinThe extended capability to locate is specified by ID via
36568bf9717SJohn Baldwin.Fa capability .
36668bf9717SJohn BaldwinConstant macros of the form
36768bf9717SJohn Baldwin.Dv PCIZ_xxx
36868bf9717SJohn Baldwinfor standard extended capability IDs are defined in
36968bf9717SJohn Baldwin.In dev/pci/pcireg.h .
37068bf9717SJohn BaldwinIf the extended capability is found, then
37168bf9717SJohn Baldwin.Fa *capreg
372281a359eSJohn Baldwinis set to the offset in configuration space of the extended capability
37368bf9717SJohn Baldwinregister set, and
37468bf9717SJohn Baldwin.Fn pci_find_extcap
37568bf9717SJohn Baldwinreturns zero.
37668bf9717SJohn BaldwinIf the extended capability is not found or the device is not a
37768bf9717SJohn BaldwinPCI-express device,
37868bf9717SJohn Baldwin.Fn pci_find_extcap
37968bf9717SJohn Baldwinreturns an error.
380*7a16dacdSBryan VenteicherThe
381*7a16dacdSBryan Venteicher.Fn pci_find_next_extcap
382*7a16dacdSBryan Venteicherfunction is used to locate the next instance of a PCI-express
383*7a16dacdSBryan Venteicherextended capability register set for the device
384*7a16dacdSBryan Venteicher.Fa dev .
385*7a16dacdSBryan VenteicherThe
386*7a16dacdSBryan Venteicher.Fa start
387*7a16dacdSBryan Venteichershould be the
388*7a16dacdSBryan Venteicher.Fa *capreg
389*7a16dacdSBryan Venteicherreturned by a prior
390*7a16dacdSBryan Venteicher.Fn pci_find_extcap
391*7a16dacdSBryan Venteicheror
392*7a16dacdSBryan Venteicher.Fn pci_find_next_extcap .
393*7a16dacdSBryan VenteicherWhen no more instances are located
394*7a16dacdSBryan Venteicher.Fn pci_find_next_extcap
395*7a16dacdSBryan Venteicherreturns an error.
39668bf9717SJohn Baldwin.Pp
39768bf9717SJohn BaldwinThe
39868bf9717SJohn Baldwin.Fn pci_find_htcap
39968bf9717SJohn Baldwinfunction is used to locate the first instance of a HyperTransport capability
40068bf9717SJohn Baldwinregister set for the device
40168bf9717SJohn Baldwin.Fa dev .
40268bf9717SJohn BaldwinThe capability to locate is specified by type via
40368bf9717SJohn Baldwin.Fa capability .
40468bf9717SJohn BaldwinConstant macros of the form
40568bf9717SJohn Baldwin.Dv PCIM_HTCAP_xxx
40668bf9717SJohn Baldwinfor standard HyperTransport capability types are defined in
40768bf9717SJohn Baldwin.In dev/pci/pcireg.h .
40868bf9717SJohn BaldwinIf the capability is found, then
40968bf9717SJohn Baldwin.Fa *capreg
410281a359eSJohn Baldwinis set to the offset in configuration space of the capability register set,
41168bf9717SJohn Baldwinand
41268bf9717SJohn Baldwin.Fn pci_find_htcap
41368bf9717SJohn Baldwinreturns zero.
41468bf9717SJohn BaldwinIf the capability is not found or the device is not a HyperTransport device,
41568bf9717SJohn Baldwin.Fn pci_find_htcap
41668bf9717SJohn Baldwinreturns an error.
417*7a16dacdSBryan VenteicherThe
418*7a16dacdSBryan Venteicher.Fn pci_find_next_htcap
419*7a16dacdSBryan Venteicherfunction is used to locate the next instance of a HyperTransport capability
420*7a16dacdSBryan Venteicherregister set for the device
421*7a16dacdSBryan Venteicher.Fa dev .
422*7a16dacdSBryan VenteicherThe
423*7a16dacdSBryan Venteicher.Fa start
424*7a16dacdSBryan Venteichershould be the
425*7a16dacdSBryan Venteicher.Fa *capreg
426*7a16dacdSBryan Venteicherreturned by a prior
427*7a16dacdSBryan Venteicher.Fn pci_find_htcap
428*7a16dacdSBryan Venteicheror
429*7a16dacdSBryan Venteicher.Fn pci_find_next_htcap .
430*7a16dacdSBryan VenteicherWhen no more instances are located
431*7a16dacdSBryan Venteicher.Fn pci_find_next_htcap
432*7a16dacdSBryan Venteicherreturns an error.
43368bf9717SJohn Baldwin.Pp
43468bf9717SJohn BaldwinThe
43587dd2f95SJohn Baldwin.Fn pci_find_pcie_root_port
43687dd2f95SJohn Baldwinfunction walks up the PCI device hierarchy to locate the PCI-express root
43787dd2f95SJohn Baldwinport upstream of
43887dd2f95SJohn Baldwin.Fa dev .
43987dd2f95SJohn BaldwinIf a root port is not found,
44087dd2f95SJohn Baldwin.Fn pci_find_pcie_root_port
44187dd2f95SJohn Baldwinreturns
44287dd2f95SJohn Baldwin.Dv NULL .
44387dd2f95SJohn Baldwin.Pp
44487dd2f95SJohn BaldwinThe
445d7be980dSAndrew Turner.Fn pci_get_id
446d7be980dSAndrew Turnerfunction is used to read an identifier from a device.
447d7be980dSAndrew TurnerThe
448d7be980dSAndrew Turner.Fa type
449d7be980dSAndrew Turnerflag is used to specify which identifier to read.
450d7be980dSAndrew TurnerThe following flags are supported:
451d7be980dSAndrew Turner.Bl -hang -width ".Dv PCI_ID_RID"
452d7be980dSAndrew Turner.It Dv PCI_ID_RID
453d7be980dSAndrew TurnerRead the routing identifier for the device.
4541e43b18cSAndrew Turner.It Dv PCI_ID_MSI
4551e43b18cSAndrew TurnerRead the MSI routing ID.
4561e43b18cSAndrew TurnerThis is needed by some interrupt controllers to route MSI and MSI-X interrupts.
457d7be980dSAndrew Turner.El
458d7be980dSAndrew Turner.Pp
459d7be980dSAndrew TurnerThe
460855ed4c5SJohn Baldwin.Fn pci_get_vpd_ident
461855ed4c5SJohn Baldwinfunction is used to fetch a device's Vital Product Data
462855ed4c5SJohn Baldwin.Pq VPD
463855ed4c5SJohn Baldwinidentifier string.
464855ed4c5SJohn BaldwinIf the device
465855ed4c5SJohn Baldwin.Fa dev
466855ed4c5SJohn Baldwinsupports VPD and provides an identifier string,
467855ed4c5SJohn Baldwinthen
468855ed4c5SJohn Baldwin.Fa *identptr
469855ed4c5SJohn Baldwinis set to point at a read-only, null-terminated copy of the identifier
470855ed4c5SJohn Baldwinstring,
471855ed4c5SJohn Baldwinand
472855ed4c5SJohn Baldwin.Fn pci_get_vpd_ident
473855ed4c5SJohn Baldwinreturns zero.
474855ed4c5SJohn BaldwinIf the device does not support VPD or does not provide an identifier
475855ed4c5SJohn Baldwinstring,
476855ed4c5SJohn Baldwinthen
477855ed4c5SJohn Baldwin.Fn pci_get_vpd_ident
478855ed4c5SJohn Baldwinreturns an error.
479855ed4c5SJohn Baldwin.Pp
480855ed4c5SJohn BaldwinThe
481855ed4c5SJohn Baldwin.Fn pci_get_vpd_readonly
482855ed4c5SJohn Baldwinfunction is used to fetch the value of a single VPD read-only keyword
483855ed4c5SJohn Baldwinfor the device
484855ed4c5SJohn Baldwin.Fa dev .
485855ed4c5SJohn BaldwinThe keyword to fetch is identified by the two character string
486855ed4c5SJohn Baldwin.Fa kw .
487855ed4c5SJohn BaldwinIf the device supports VPD and provides a read-only value for the
488855ed4c5SJohn Baldwinrequested keyword,
489855ed4c5SJohn Baldwinthen
490855ed4c5SJohn Baldwin.Fa *vptr
491855ed4c5SJohn Baldwinis set to point at a read-only, null-terminated copy of the value,
492855ed4c5SJohn Baldwinand
493855ed4c5SJohn Baldwin.Fn pci_get_vpd_readonly
494855ed4c5SJohn Baldwinreturns zero.
495855ed4c5SJohn BaldwinIf the device does not support VPD or does not provide the requested
496855ed4c5SJohn Baldwinkeyword,
497855ed4c5SJohn Baldwinthen
498855ed4c5SJohn Baldwin.Fn pci_get_vpd_readonly
499855ed4c5SJohn Baldwinreturns an error.
500da0fc925SJohn Baldwin.Pp
501da0fc925SJohn BaldwinThe
502da0fc925SJohn Baldwin.Fn pcie_get_max_completion_timeout
503da0fc925SJohn Baldwinfunction returns the maximum completion timeout configured for the device
504da0fc925SJohn Baldwin.Fa dev
505da0fc925SJohn Baldwinin microseconds.
506da0fc925SJohn BaldwinIf the
507da0fc925SJohn Baldwin.Fa dev
508da0fc925SJohn Baldwindevice is not a PCI-express device,
509da0fc925SJohn Baldwin.Fn pcie_get_max_completion_timeout
510da0fc925SJohn Baldwinreturns zero.
511da0fc925SJohn BaldwinWhen completion timeouts are disabled for
512da0fc925SJohn Baldwin.Fa dev ,
513da0fc925SJohn Baldwinthis function returns the maxmimum timeout that would be used if timeouts
514da0fc925SJohn Baldwinwere enabled.
515da0fc925SJohn Baldwin.Pp
516da0fc925SJohn BaldwinThe
517da0fc925SJohn Baldwin.Fn pcie_wait_for_pending_transactions
518da0fc925SJohn Baldwinfunction waits for any pending transactions initiated by the
519da0fc925SJohn Baldwin.Fa dev
520da0fc925SJohn Baldwindevice to complete.
521da0fc925SJohn BaldwinThe function checks for pending transactions by polling the transactions
522da0fc925SJohn Baldwinpending flag in the PCI-express device status register.
523da0fc925SJohn BaldwinIt returns
524da0fc925SJohn Baldwin.Dv true
525da0fc925SJohn Baldwinonce the transaction pending flag is clear.
526da0fc925SJohn BaldwinIf transactions are still pending after
527da0fc925SJohn Baldwin.Fa max_delay
528da0fc925SJohn Baldwinmilliseconds,
529da0fc925SJohn Baldwin.Fn pcie_wait_for_pending_transactions
530da0fc925SJohn Baldwinreturns
531da0fc925SJohn Baldwin.Dv false .
532da0fc925SJohn BaldwinIf
533da0fc925SJohn Baldwin.Fa max_delay
534da0fc925SJohn Baldwinis set to zero,
535da0fc925SJohn Baldwin.Fn pcie_wait_for_pending_transactions
536da0fc925SJohn Baldwinperforms a single check;
537da0fc925SJohn Baldwinotherwise,
538da0fc925SJohn Baldwinthis function may sleep while polling the transactions pending flag.
539da0fc925SJohn Baldwin.Nm pcie_wait_for_pending_transactions
540da0fc925SJohn Baldwinreturns
541da0fc925SJohn Baldwin.Dv true
542da0fc925SJohn Baldwinif
543da0fc925SJohn Baldwin.Fa dev
544da0fc925SJohn Baldwinis not a PCI-express device.
545855ed4c5SJohn Baldwin.Ss Device Configuration
546aac0aafaSHiten PandyaThe
547aac0aafaSHiten Pandya.Fn pci_enable_busmaster
548aac0aafaSHiten Pandyafunction enables PCI bus mastering for the device
549aac0aafaSHiten Pandya.Fa dev ,
550aac0aafaSHiten Pandyaby setting the
551aac0aafaSHiten Pandya.Dv PCIM_CMD_BUSMASTEREN
552aac0aafaSHiten Pandyabit in the
553aac0aafaSHiten Pandya.Dv PCIR_COMMAND
554aac0aafaSHiten Pandyaregister.
555aac0aafaSHiten PandyaThe
556aac0aafaSHiten Pandya.Fn pci_disable_busmaster
557aac0aafaSHiten Pandyafunction clears this bit.
558aac0aafaSHiten Pandya.Pp
559aac0aafaSHiten PandyaThe
560aac0aafaSHiten Pandya.Fn pci_enable_io
561aac0aafaSHiten Pandyafunction enables memory or I/O port address decoding for the device
562aac0aafaSHiten Pandya.Fa dev ,
563aac0aafaSHiten Pandyaby setting the
564aac0aafaSHiten Pandya.Dv PCIM_CMD_MEMEN
565aac0aafaSHiten Pandyaor
566aac0aafaSHiten Pandya.Dv PCIM_CMD_PORTEN
567aac0aafaSHiten Pandyabit in the
568aac0aafaSHiten Pandya.Dv PCIR_COMMAND
5695203edcdSRuslan Ermilovregister appropriately.
5705203edcdSRuslan ErmilovThe
571aac0aafaSHiten Pandya.Fn pci_disable_io
572aac0aafaSHiten Pandyafunction clears the appropriate bit.
573aac0aafaSHiten PandyaThe
57465bb31b8SRuslan Ermilov.Fa space
575aac0aafaSHiten Pandyaargument specifies which resource is affected; this can be either
576aac0aafaSHiten Pandya.Dv SYS_RES_MEMORY
577aac0aafaSHiten Pandyaor
578aac0aafaSHiten Pandya.Dv SYS_RES_IOPORT
579aac0aafaSHiten Pandyaas appropriate.
580855ed4c5SJohn BaldwinDevice drivers should generally not use these routines directly.
581855ed4c5SJohn BaldwinThe PCI bus will enable decoding automatically when a
582855ed4c5SJohn Baldwin.Dv SYS_RES_MEMORY
583855ed4c5SJohn Baldwinor
584855ed4c5SJohn Baldwin.Dv SYS_RES_IOPORT
585855ed4c5SJohn Baldwinresource is activated via
586855ed4c5SJohn Baldwin.Xr bus_alloc_resource 9
587855ed4c5SJohn Baldwinor
588855ed4c5SJohn Baldwin.Xr bus_activate_resource 9 .
589aac0aafaSHiten Pandya.Pp
590855ed4c5SJohn BaldwinThe
5912ab0398dSJohn Baldwin.Fn pci_get_max_payload
5922ab0398dSJohn Baldwinfunction returns the current maximum TLP payload size in bytes for a
5932ab0398dSJohn BaldwinPCI-express device.
5942ab0398dSJohn BaldwinIf the
5952ab0398dSJohn Baldwin.Fa dev
5962ab0398dSJohn Baldwindevice is not a PCI-express device,
5972ab0398dSJohn Baldwin.Fn pci_get_max_payload
5982ab0398dSJohn Baldwinreturns zero.
5992ab0398dSJohn Baldwin.Pp
6002ab0398dSJohn BaldwinThe
601855ed4c5SJohn Baldwin.Fn pci_get_max_read_req
602855ed4c5SJohn Baldwinfunction returns the current maximum read request size in bytes for a
603855ed4c5SJohn BaldwinPCI-express device.
604855ed4c5SJohn BaldwinIf the
605855ed4c5SJohn Baldwin.Fa dev
606855ed4c5SJohn Baldwindevice is not a PCI-express device,
607855ed4c5SJohn Baldwin.Fn pci_get_max_read_req
608855ed4c5SJohn Baldwinreturns zero.
609855ed4c5SJohn Baldwin.Pp
610855ed4c5SJohn BaldwinThe
611855ed4c5SJohn Baldwin.Fn pci_set_max_read_req
612855ed4c5SJohn Baldwinsets the PCI-express maximum read request size for
613855ed4c5SJohn Baldwin.Fa dev .
614855ed4c5SJohn BaldwinThe requested
615855ed4c5SJohn Baldwin.Fa size
616855ed4c5SJohn Baldwinmay be adjusted,
617855ed4c5SJohn Baldwinand
618855ed4c5SJohn Baldwin.Fn pci_set_max_read_req
619855ed4c5SJohn Baldwinreturns the actual size set in bytes.
620855ed4c5SJohn BaldwinIf the
621855ed4c5SJohn Baldwin.Fa dev
622855ed4c5SJohn Baldwindevice is not a PCI-express device,
623855ed4c5SJohn Baldwin.Fn pci_set_max_read_req
624855ed4c5SJohn Baldwinreturns zero.
625aac0aafaSHiten Pandya.Pp
626aac0aafaSHiten PandyaThe
627aac0aafaSHiten Pandya.Fn pci_get_powerstate
628adb63907SJohn Baldwinfunction returns the current power state of the device
629aac0aafaSHiten Pandya.Fa dev .
630aac0aafaSHiten PandyaIf the device does not support power management capabilities, then the default
631aac0aafaSHiten Pandyastate of
632aac0aafaSHiten Pandya.Dv PCI_POWERSTATE_D0
633aac0aafaSHiten Pandyais returned.
634adb63907SJohn BaldwinThe following power states are defined by PCI:
63565bb31b8SRuslan Ermilov.Bl -hang -width ".Dv PCI_POWERSTATE_UNKNOWN"
636aac0aafaSHiten Pandya.It Dv PCI_POWERSTATE_D0
637aac0aafaSHiten PandyaState in which device is on and running.
638aac0aafaSHiten PandyaIt is receiving full power from the system and delivering
639aac0aafaSHiten Pandyafull functionality to the user.
640aac0aafaSHiten Pandya.It Dv PCI_POWERSTATE_D1
641aac0aafaSHiten PandyaClass-specific low-power state in which device context may or
6425a2e3b61SDaniel Gerzomay not be lost.
643db4fcadfSConrad MeyerBuses in this state cannot do anything to the bus, to
6449817b894SBruce M Simpsonforce devices to lose context.
645aac0aafaSHiten Pandya.It Dv PCI_POWERSTATE_D2
646aac0aafaSHiten PandyaClass-specific low-power state in which device context may or
647aac0aafaSHiten Pandyamay not be lost.
648aac0aafaSHiten PandyaAttains greater power savings than
649aac0aafaSHiten Pandya.Dv PCI_POWERSTATE_D1 .
650db4fcadfSConrad MeyerBuses in this state can cause devices to lose some context.
651aac0aafaSHiten PandyaDevices
652aac0aafaSHiten Pandya.Em must
653aac0aafaSHiten Pandyabe prepared for the bus to be in this state or higher.
654aac0aafaSHiten Pandya.It Dv PCI_POWERSTATE_D3
655aac0aafaSHiten PandyaState in which the device is off and not running.
656aac0aafaSHiten PandyaDevice context is lost, and power from the device can
657aac0aafaSHiten Pandyabe removed.
658aac0aafaSHiten Pandya.It Dv PCI_POWERSTATE_UNKNOWN
659aac0aafaSHiten PandyaState of the device is unknown.
660aac0aafaSHiten Pandya.El
661aac0aafaSHiten Pandya.Pp
662aac0aafaSHiten PandyaThe
663aac0aafaSHiten Pandya.Fn pci_set_powerstate
664aac0aafaSHiten Pandyafunction is used to transition the device
665aac0aafaSHiten Pandya.Fa dev
666adb63907SJohn Baldwinto the PCI power state
667aac0aafaSHiten Pandya.Fa state .
668adb63907SJohn BaldwinIf the device does not support power management capabilities or
669adb63907SJohn Baldwinit does not support the specific power state
670adb63907SJohn Baldwin.Fa state ,
671adb63907SJohn Baldwinthen the function will fail with
672adb63907SJohn Baldwin.Er EOPNOTSUPP .
673aac0aafaSHiten Pandya.Pp
674aac0aafaSHiten PandyaThe
6757d971e36SRyan Stone.Fn pci_iov_attach
6767d971e36SRyan Stonefunction is used to advertise that the given device
6777d971e36SRyan Stone.Pq and associated device driver
6787d971e36SRyan Stonesupports PCI Single-Root I/O Virtualization
679fe3ff217SPatrick Kelsey.Pq SR-IOV .
6807d971e36SRyan StoneA driver that supports SR-IOV must implement the
681f3bb9251SJohn Baldwin.Xr PCI_IOV_INIT 9 ,
682f3bb9251SJohn Baldwin.Xr PCI_IOV_ADD_VF 9
6837d971e36SRyan Stoneand
684f3bb9251SJohn Baldwin.Xr PCI_IOV_UNINIT 9
6857d971e36SRyan Stonemethods.
6867d971e36SRyan StoneThis function should be called during the
6877d971e36SRyan Stone.Xr DEVICE_ATTACH 9
6887d971e36SRyan Stonemethod.
6897d971e36SRyan StoneIf this function returns an error, it is recommended that the device driver
6907d971e36SRyan Stonestill successfully attaches, but runs with SR-IOV disabled.
6917d971e36SRyan StoneThe
6927d971e36SRyan Stone.Fa pf_schema
6937d971e36SRyan Stoneand
6947d971e36SRyan Stone.Fa vf_schema
6957d971e36SRyan Stoneparameters are used to define what device-specific configuration parameters the
6967d971e36SRyan Stonedevice driver accepts when SR-IOV is enabled for the Physical Function
6977d971e36SRyan Stone.Pq PF
6987d971e36SRyan Stoneand for individual Virtual Functions
6997d971e36SRyan Stone.Pq VFs
7007d971e36SRyan Stonerespectively.
7017d971e36SRyan StoneSee
7027d971e36SRyan Stone.Xr pci_iov_schema 9
7037d971e36SRyan Stonefor details on how to construct the schema.
7047d971e36SRyan StoneIf either the
7057d971e36SRyan Stone.Pa pf_schema
7067d971e36SRyan Stoneor
7077d971e36SRyan Stone.Pa vf_schema
7087d971e36SRyan Stoneis invalid or specifies parameter names that conflict with parameter names that
7097d971e36SRyan Stoneare already in use,
7107d971e36SRyan Stone.Fn pci_iov_attach
7117d971e36SRyan Stonewill return an error and SR-IOV will not be available on the PF device.
7127d971e36SRyan StoneIf a driver does not accept configuration parameters for either the PF device
7137d971e36SRyan Stoneor the VF devices, the driver must pass an empty schema for that device.
7147d971e36SRyan StoneThe SR-IOV infrastructure takes ownership of the
7157d971e36SRyan Stone.Fa pf_schema
7167d971e36SRyan Stoneand
7177d971e36SRyan Stone.Fa vf_schema
7187d971e36SRyan Stoneand is responsible for freeing them.
7197d971e36SRyan StoneThe driver must never free the schemas itself.
7207d971e36SRyan Stone.Pp
7217d971e36SRyan StoneThe
7220aee83ccSJohn Baldwin.Fn pci_iov_attach_name
7230aee83ccSJohn Baldwinfunction is a variant of
7240aee83ccSJohn Baldwin.Fn pci_iov_attach
7250aee83ccSJohn Baldwinthat allows the name of the associated character device in
7260aee83ccSJohn Baldwin.Pa /dev/iov
7270aee83ccSJohn Baldwinto be specified by
7280aee83ccSJohn Baldwin.Fa fmt .
7290aee83ccSJohn BaldwinThe
7300aee83ccSJohn Baldwin.Fn pci_iov_attach
7310aee83ccSJohn Baldwinfunction uses the name of
7320aee83ccSJohn Baldwin.Fa dev
7330aee83ccSJohn Baldwinas the device name.
7340aee83ccSJohn Baldwin.Pp
7350aee83ccSJohn BaldwinThe
7367d971e36SRyan Stone.Fn pci_iov_detach
7377d971e36SRyan Stonefunction is used to advise the SR-IOV infrastructure that the driver for the
7387d971e36SRyan Stonegiven device is attempting to detach and that all SR-IOV resources for the
7397d971e36SRyan Stonedevice must be released.
7407d971e36SRyan StoneThis function must be called during the
7417d971e36SRyan Stone.Xr DEVICE_DETACH 9
7427d971e36SRyan Stonemethod if
7437d971e36SRyan Stone.Fn pci_iov_attach
7447d971e36SRyan Stonewas successfully called on the device and
7457d971e36SRyan Stone.Fn pci_iov_detach
7467d971e36SRyan Stonehas not subsequently been called on the device and returned no error.
7477d971e36SRyan StoneIf this function returns an error, the
7487d971e36SRyan Stone.Xr DEVICE_DETACH 9
7497d971e36SRyan Stonemethod must fail and return an error, as detaching the PF driver while VF
7507d971e36SRyan Stonedevices are active would cause system instability.
7517d971e36SRyan StoneThis function is safe to call and will always succeed if
7527d971e36SRyan Stone.Fn pci_iov_attach
7537d971e36SRyan Stonepreviously failed with an error on the given device, or if
7547d971e36SRyan Stone.Fn pci_iov_attach
7557d971e36SRyan Stonewas never called on the device.
7567d971e36SRyan Stone.Pp
7577d971e36SRyan StoneThe
7589415d1e0SJohn Baldwin.Fn pci_save_state
7599415d1e0SJohn Baldwinand
7609415d1e0SJohn Baldwin.Fn pci_restore_state
7619415d1e0SJohn Baldwinfunctions can be used by a device driver to save and restore standard PCI
7629415d1e0SJohn Baldwinconfig registers.
7639415d1e0SJohn BaldwinThe
7649415d1e0SJohn Baldwin.Fn pci_save_state
7659415d1e0SJohn Baldwinfunction must be invoked while the device has valid state before
7669415d1e0SJohn Baldwin.Fn pci_restore_state
7679415d1e0SJohn Baldwincan be used.
7689415d1e0SJohn BaldwinIf the device is not in the fully-powered state
7699415d1e0SJohn Baldwin.Pq Dv PCI_POWERSTATE_D0
7709415d1e0SJohn Baldwinwhen
7719415d1e0SJohn Baldwin.Fn pci_restore_state
7729415d1e0SJohn Baldwinis invoked,
7739415d1e0SJohn Baldwinthen the device will be transitioned to
7749415d1e0SJohn Baldwin.Dv PCI_POWERSTATE_D0
7759415d1e0SJohn Baldwinbefore any config registers are restored.
776da0fc925SJohn Baldwin.Pp
777da0fc925SJohn BaldwinThe
778da0fc925SJohn Baldwin.Fn pcie_flr
779da0fc925SJohn Baldwinfunction requests a Function Level Reset
780da0fc925SJohn Baldwin.Pq FLR
781da0fc925SJohn Baldwinof
782da0fc925SJohn Baldwin.Fa dev .
783da0fc925SJohn BaldwinIf
784da0fc925SJohn Baldwin.Fa dev
785da0fc925SJohn Baldwinis not a PCI-express device or does not support Function Level Resets via
786da0fc925SJohn Baldwinthe PCI-express device control register,
787da0fc925SJohn Baldwin.Dv false
788da0fc925SJohn Baldwinis returned.
789da0fc925SJohn BaldwinPending transactions are drained by disabling busmastering and calling
790da0fc925SJohn Baldwin.Fn pcie_wait_for_pending_transactions
791da0fc925SJohn Baldwinbefore resetting the device.
792da0fc925SJohn BaldwinThe
793da0fc925SJohn Baldwin.Fa max_delay
794da0fc925SJohn Baldwinargument specifies the maximum timeout to wait for pending transactions as
795da0fc925SJohn Baldwindescribed for
796da0fc925SJohn Baldwin.Fn pcie_wait_for_pending_transactions .
797da0fc925SJohn BaldwinIf
798da0fc925SJohn Baldwin.Fn pcie_wait_for_pending_transactions
799da0fc925SJohn Baldwinfails with a timeout and
800da0fc925SJohn Baldwin.Fa force
801da0fc925SJohn Baldwinis
802da0fc925SJohn Baldwin.Dv false ,
803da0fc925SJohn Baldwinbusmastering is re-enabled and
804da0fc925SJohn Baldwin.Dv false
805da0fc925SJohn Baldwinis returned.
806da0fc925SJohn BaldwinIf
807da0fc925SJohn Baldwin.Fn pcie_wait_for_pending_transactions
808da0fc925SJohn Baldwinfails with a timeout and
809da0fc925SJohn Baldwin.Fa force
810da0fc925SJohn Baldwinis
811da0fc925SJohn Baldwin.Dv true ,
812da0fc925SJohn Baldwinthe device is reset despite the timeout.
813da0fc925SJohn BaldwinAfter the reset has been requested,
814da0fc925SJohn Baldwin.Nm pcie_flr
815da0fc925SJohn Baldwinsleeps for at least 100 milliseconds before returning
816da0fc925SJohn Baldwin.Dv true .
817da0fc925SJohn BaldwinNote that
818da0fc925SJohn Baldwin.Nm pcie_flr
819da0fc925SJohn Baldwindoes not save and restore any state around the reset.
820da0fc925SJohn BaldwinThe caller should save and restore state as needed.
821855ed4c5SJohn Baldwin.Ss Message Signaled Interrupts
822855ed4c5SJohn BaldwinMessage Signaled Interrupts
823855ed4c5SJohn Baldwin.Pq MSI
824855ed4c5SJohn Baldwinand
825855ed4c5SJohn BaldwinEnhanced Message Signaled Interrupts
826855ed4c5SJohn Baldwin.Pq MSI-X
827855ed4c5SJohn Baldwinare PCI capabilities that provide an alternate method for PCI
828855ed4c5SJohn Baldwindevices to signal interrupts.
829855ed4c5SJohn BaldwinThe legacy INTx interrupt is available to PCI devices as a
830855ed4c5SJohn Baldwin.Dv SYS_RES_IRQ
831855ed4c5SJohn Baldwinresource with a resource ID of zero.
832855ed4c5SJohn BaldwinMSI and MSI-X interrupts are available to PCI devices as one or more
833855ed4c5SJohn Baldwin.Dv SYS_RES_IRQ
834855ed4c5SJohn Baldwinresources with resource IDs greater than zero.
835855ed4c5SJohn BaldwinA driver must ask the PCI bus to allocate MSI or MSI-X interrupts
836855ed4c5SJohn Baldwinusing
837855ed4c5SJohn Baldwin.Fn pci_alloc_msi
838855ed4c5SJohn Baldwinor
839855ed4c5SJohn Baldwin.Fn pci_alloc_msix
840855ed4c5SJohn Baldwinbefore it can use MSI or MSI-X
841855ed4c5SJohn Baldwin.Dv SYS_RES_IRQ
842855ed4c5SJohn Baldwinresources.
843855ed4c5SJohn BaldwinA driver is not allowed to use the legacy INTx
844855ed4c5SJohn Baldwin.Dv SYS_RES_IRQ
845855ed4c5SJohn Baldwinresource if MSI or MSI-X interrupts have been allocated,
846855ed4c5SJohn Baldwinand attempts to allocate MSI or MSI-X interrupts will fail if the
847855ed4c5SJohn Baldwindriver is currently using the legacy INTx
848855ed4c5SJohn Baldwin.Dv SYS_RES_IRQ
849855ed4c5SJohn Baldwinresource.
850855ed4c5SJohn BaldwinA driver is only allowed to use either MSI or MSI-X,
851855ed4c5SJohn Baldwinbut not both.
8529415d1e0SJohn Baldwin.Pp
8539415d1e0SJohn BaldwinThe
854563d4639SMark Johnston.Fn pci_msi_count
855855ed4c5SJohn Baldwinfunction returns the maximum number of MSI messages supported by the
856855ed4c5SJohn Baldwindevice
857855ed4c5SJohn Baldwin.Fa dev .
858855ed4c5SJohn BaldwinIf the device does not support MSI,
859855ed4c5SJohn Baldwinthen
860563d4639SMark Johnston.Fn pci_msi_count
861855ed4c5SJohn Baldwinreturns zero.
86255aaf894SMarius Strobl.Pp
86355aaf894SMarius StroblThe
864855ed4c5SJohn Baldwin.Fn pci_alloc_msi
865855ed4c5SJohn Baldwinfunction attempts to allocate
866855ed4c5SJohn Baldwin.Fa *count
867855ed4c5SJohn BaldwinMSI messages for the device
868855ed4c5SJohn Baldwin.Fa dev .
86955aaf894SMarius StroblThe
870855ed4c5SJohn Baldwin.Fn pci_alloc_msi
871855ed4c5SJohn Baldwinfunction may allocate fewer messages than requested for various
872855ed4c5SJohn Baldwinreasons including requests for more messages than the device
873855ed4c5SJohn Baldwin.Fa dev
874855ed4c5SJohn Baldwinsupports,
875855ed4c5SJohn Baldwinor if the system has a shortage of available MSI messages.
876855ed4c5SJohn BaldwinOn success,
877855ed4c5SJohn Baldwin.Fa *count
878855ed4c5SJohn Baldwinis set to the number of messages allocated and
879855ed4c5SJohn Baldwin.Fn pci_alloc_msi
880855ed4c5SJohn Baldwinreturns zero.
881855ed4c5SJohn BaldwinThe
882855ed4c5SJohn Baldwin.Dv SYS_RES_IRQ
883855ed4c5SJohn Baldwinresources for the allocated messages will be available at consecutive
884855ed4c5SJohn Baldwinresource IDs beginning with one.
885855ed4c5SJohn BaldwinIf
886855ed4c5SJohn Baldwin.Fn pci_alloc_msi
887855ed4c5SJohn Baldwinis not able to allocate any messages,
888855ed4c5SJohn Baldwinit returns an error.
889855ed4c5SJohn BaldwinNote that MSI only supports message counts that are powers of two;
890855ed4c5SJohn Baldwinrequests to allocate a non-power of two count of messages will fail.
891aac0aafaSHiten Pandya.Pp
892aac0aafaSHiten PandyaThe
893855ed4c5SJohn Baldwin.Fn pci_release_msi
894855ed4c5SJohn Baldwinfunction is used to release any allocated MSI or MSI-X messages back
895855ed4c5SJohn Baldwinto the system.
896855ed4c5SJohn BaldwinIf any MSI or MSI-X
897855ed4c5SJohn Baldwin.Dv SYS_RES_IRQ
898855ed4c5SJohn Baldwinresources are allocated by the driver or have a configured interrupt
899855ed4c5SJohn Baldwinhandler,
900855ed4c5SJohn Baldwinthis function will fail with
901855ed4c5SJohn Baldwin.Er EBUSY .
902855ed4c5SJohn BaldwinThe
903855ed4c5SJohn Baldwin.Fn pci_release_msi
904855ed4c5SJohn Baldwinfunction returns zero on success and an error on failure.
905855ed4c5SJohn Baldwin.Pp
906642c4993SSergey KandaurovThe
907563d4639SMark Johnston.Fn pci_msix_count
908855ed4c5SJohn Baldwinfunction returns the maximum number of MSI-X messages supported by the
909855ed4c5SJohn Baldwindevice
910855ed4c5SJohn Baldwin.Fa dev .
911855ed4c5SJohn BaldwinIf the device does not support MSI-X,
912855ed4c5SJohn Baldwinthen
913563d4639SMark Johnston.Fn pci_msix_count
914855ed4c5SJohn Baldwinreturns zero.
915855ed4c5SJohn Baldwin.Pp
916855ed4c5SJohn BaldwinThe
917ce204e1bSJohn Baldwin.Fn pci_msix_pba_bar
918ce204e1bSJohn Baldwinfunction returns the offset in configuration space of the Base Address Register
919ce204e1bSJohn Baldwin.Pq BAR
920ce204e1bSJohn Baldwincontaining the MSI-X Pending Bit Array (PBA) for device
921ce204e1bSJohn Baldwin.Fa dev .
922ce204e1bSJohn BaldwinThe returned value can be used as the resource ID with
923ce204e1bSJohn Baldwin.Xr bus_alloc_resource 9
924ce204e1bSJohn Baldwinand
925ce204e1bSJohn Baldwin.Xr bus_release_resource 9
926ce204e1bSJohn Baldwinto allocate the BAR.
927ce204e1bSJohn BaldwinIf the device does not support MSI-X,
928ce204e1bSJohn Baldwinthen
929ce204e1bSJohn Baldwin.Fn pci_msix_pba_bar
930ce204e1bSJohn Baldwinreturns -1.
931ce204e1bSJohn Baldwin.Pp
932ce204e1bSJohn BaldwinThe
933ce204e1bSJohn Baldwin.Fn pci_msix_table_bar
934ce204e1bSJohn Baldwinfunction returns the offset in configuration space of the BAR
935ce204e1bSJohn Baldwincontaining the MSI-X vector table for device
936ce204e1bSJohn Baldwin.Fa dev .
937ce204e1bSJohn BaldwinThe returned value can be used as the resource ID with
938ce204e1bSJohn Baldwin.Xr bus_alloc_resource 9
939ce204e1bSJohn Baldwinand
940ce204e1bSJohn Baldwin.Xr bus_release_resource 9
941ce204e1bSJohn Baldwinto allocate the BAR.
942ce204e1bSJohn BaldwinIf the device does not support MSI-X,
943ce204e1bSJohn Baldwinthen
944ce204e1bSJohn Baldwin.Fn pci_msix_table_bar
945ce204e1bSJohn Baldwinreturns -1.
946ce204e1bSJohn Baldwin.Pp
947ce204e1bSJohn BaldwinThe
948855ed4c5SJohn Baldwin.Fn pci_alloc_msix
949855ed4c5SJohn Baldwinfunction attempts to allocate
950855ed4c5SJohn Baldwin.Fa *count
951855ed4c5SJohn BaldwinMSI-X messages for the device
952855ed4c5SJohn Baldwin.Fa dev .
953855ed4c5SJohn BaldwinThe
954855ed4c5SJohn Baldwin.Fn pci_alloc_msix
955855ed4c5SJohn Baldwinfunction may allocate fewer messages than requested for various
956855ed4c5SJohn Baldwinreasons including requests for more messages than the device
957855ed4c5SJohn Baldwin.Fa dev
958855ed4c5SJohn Baldwinsupports,
959855ed4c5SJohn Baldwinor if the system has a shortage of available MSI-X messages.
960855ed4c5SJohn BaldwinOn success,
961855ed4c5SJohn Baldwin.Fa *count
962855ed4c5SJohn Baldwinis set to the number of messages allocated and
963855ed4c5SJohn Baldwin.Fn pci_alloc_msix
964855ed4c5SJohn Baldwinreturns zero.
965855ed4c5SJohn BaldwinFor MSI-X messages,
966855ed4c5SJohn Baldwinthe resource ID for each
96773bbeaa5SGlen Barber.Dv SYS_RES_IRQ
96873bbeaa5SGlen Barberresource identifies the index in the MSI-X table of the
969855ed4c5SJohn Baldwincorresponding message.
970855ed4c5SJohn BaldwinA resource ID of one maps to the first index of the MSI-X table;
971855ed4c5SJohn Baldwina resource ID two identifies the second index in the table, etc.
972855ed4c5SJohn BaldwinThe
973855ed4c5SJohn Baldwin.Fn pci_alloc_msix
974855ed4c5SJohn Baldwinfunction assigns the
975855ed4c5SJohn Baldwin.Fa *count
976855ed4c5SJohn Baldwinmessages allocated to the first
977855ed4c5SJohn Baldwin.Fa *count
9787c64ddd5SWarren Blocktable indices.
979855ed4c5SJohn BaldwinIf
980855ed4c5SJohn Baldwin.Fn pci_alloc_msix
981855ed4c5SJohn Baldwinis not able to allocate any messages,
982855ed4c5SJohn Baldwinit returns an error.
983855ed4c5SJohn BaldwinUnlike MSI,
984855ed4c5SJohn BaldwinMSI-X does not require message counts that are powers of two.
985855ed4c5SJohn Baldwin.Pp
986ce204e1bSJohn BaldwinThe BARs containing the MSI-X vector table and PBA must be
987ce204e1bSJohn Baldwinallocated via
988ce204e1bSJohn Baldwin.Xr bus_alloc_resource 9
989ce204e1bSJohn Baldwinbefore calling
990ce204e1bSJohn Baldwin.Fn pci_alloc_msix
991ce204e1bSJohn Baldwinand must not be released until after calling
992ce204e1bSJohn Baldwin.Fn pci_release_msi .
993ce204e1bSJohn BaldwinNote that the vector table and PBA may be stored in the same BAR or in
994ce204e1bSJohn Baldwindifferent BARs.
995ce204e1bSJohn Baldwin.Pp
996855ed4c5SJohn BaldwinThe
997855ed4c5SJohn Baldwin.Fn pci_pending_msix
998855ed4c5SJohn Baldwinfunction examines the
999855ed4c5SJohn Baldwin.Fa dev
1000ce204e1bSJohn Baldwindevice's PBA
1001855ed4c5SJohn Baldwinto determine the pending status of the MSI-X message at table index
1002855ed4c5SJohn Baldwin.Fa index .
1003855ed4c5SJohn BaldwinIf the indicated message is pending,
1004855ed4c5SJohn Baldwinthis function returns a non-zero value;
1005855ed4c5SJohn Baldwinotherwise,
1006855ed4c5SJohn Baldwinit returns zero.
1007855ed4c5SJohn BaldwinPassing an invalid
1008855ed4c5SJohn Baldwin.Fa index
1009855ed4c5SJohn Baldwinto this function will result in undefined behavior.
1010855ed4c5SJohn Baldwin.Pp
1011855ed4c5SJohn BaldwinAs mentioned in the description of
1012855ed4c5SJohn Baldwin.Fn pci_alloc_msix ,
1013855ed4c5SJohn BaldwinMSI-X messages are initially assigned to the first N table entries.
1014855ed4c5SJohn BaldwinA driver may use a different distribution of available messages to
1015855ed4c5SJohn Baldwintable entries via the
1016855ed4c5SJohn Baldwin.Fn pci_remap_msix
1017855ed4c5SJohn Baldwinfunction.
101873bbeaa5SGlen BarberNote that this function must be called after a successful call to
1019855ed4c5SJohn Baldwin.Fn pci_alloc_msix
1020855ed4c5SJohn Baldwinbut before any of the
1021855ed4c5SJohn Baldwin.Dv SYS_RES_IRQ
1022855ed4c5SJohn Baldwinresources are allocated.
1023855ed4c5SJohn BaldwinThe
1024855ed4c5SJohn Baldwin.Fn pci_remap_msix
1025855ed4c5SJohn Baldwinfunction returns zero on success,
1026855ed4c5SJohn Baldwinor an error on failure.
1027855ed4c5SJohn Baldwin.Pp
1028855ed4c5SJohn BaldwinThe
1029855ed4c5SJohn Baldwin.Fa vectors
1030855ed4c5SJohn Baldwinarray should contain
1031855ed4c5SJohn Baldwin.Fa count
1032855ed4c5SJohn Baldwinmessage vectors.
1033855ed4c5SJohn BaldwinThe array maps directly to the MSI-X table in that the first entry in
1034855ed4c5SJohn Baldwinthe array specifies the message used for the first entry in the MSI-X
1035855ed4c5SJohn Baldwintable,
1036855ed4c5SJohn Baldwinthe second entry in the array corresponds to the second entry in the
1037855ed4c5SJohn BaldwinMSI-X table,
1038855ed4c5SJohn Baldwinetc.
1039855ed4c5SJohn BaldwinThe vector value in each array index can either be zero to indicate
1040855ed4c5SJohn Baldwinthat no message should be assigned to the corresponding MSI-X table entry,
1041855ed4c5SJohn Baldwinor it can be a number from one to N
1042855ed4c5SJohn Baldwin.Po
1043855ed4c5SJohn Baldwinwhere N is the count returned from the previous call to
1044855ed4c5SJohn Baldwin.Fn pci_alloc_msix
1045855ed4c5SJohn Baldwin.Pc
1046855ed4c5SJohn Baldwinto indicate which of the allocated messages should be assigned to the
1047855ed4c5SJohn Baldwincorresponding MSI-X table entry.
1048855ed4c5SJohn Baldwin.Pp
1049855ed4c5SJohn BaldwinIf
1050855ed4c5SJohn Baldwin.Fn pci_remap_msix
1051855ed4c5SJohn Baldwinsucceeds,
1052855ed4c5SJohn Baldwineach MSI-X table entry with a non-zero vector will have an associated
1053855ed4c5SJohn Baldwin.Dv SYS_RES_IRQ
1054855ed4c5SJohn Baldwinresource whose resource ID corresponds to the table index as described
1055855ed4c5SJohn Baldwinabove for
1056855ed4c5SJohn Baldwin.Fn pci_alloc_msix .
1057855ed4c5SJohn BaldwinMSI-X table entries that with a vector of zero will not have an
1058855ed4c5SJohn Baldwinassociated
105973bbeaa5SGlen Barber.Dv SYS_RES_IRQ
106073bbeaa5SGlen Barberresource.
1061855ed4c5SJohn BaldwinAdditionally,
1062855ed4c5SJohn Baldwinif any of the original messages allocated by
1063855ed4c5SJohn Baldwin.Fn pci_alloc_msix
1064855ed4c5SJohn Baldwinare not used in the new distribution of messages in the MSI-X table,
1065855ed4c5SJohn Baldwinthey will be released automatically.
1066855ed4c5SJohn BaldwinNote that if a driver wishes to use fewer messages than were allocated by
1067855ed4c5SJohn Baldwin.Fn pci_alloc_msix ,
1068855ed4c5SJohn Baldwinthe driver must use a single, contiguous range of messages beginning
1069855ed4c5SJohn Baldwinwith one in the new distribution.
1070855ed4c5SJohn BaldwinThe
1071855ed4c5SJohn Baldwin.Fn pci_remap_msix
1072855ed4c5SJohn Baldwinfunction will fail if this condition is not met.
107364414cc0SJohn Baldwin.Ss Device Events
107464414cc0SJohn BaldwinThe
107564414cc0SJohn Baldwin.Va pci_add_device
107664414cc0SJohn Baldwinevent handler is invoked every time a new PCI device is added to the system.
107764414cc0SJohn BaldwinThis includes the creation of Virtual Functions via SR-IOV.
107864414cc0SJohn Baldwin.Pp
107964414cc0SJohn BaldwinThe
108064414cc0SJohn Baldwin.Va pci_delete_device
108164414cc0SJohn Baldwinevent handler is invoked every time a PCI device is removed from the system.
108264414cc0SJohn Baldwin.Pp
108364414cc0SJohn BaldwinBoth event handlers pass the
108464414cc0SJohn Baldwin.Vt device_t
108564414cc0SJohn Baldwinobject of the relevant PCI device as
108664414cc0SJohn Baldwin.Fa dev
108764414cc0SJohn Baldwinto each callback function.
108864414cc0SJohn BaldwinBoth event handlers are invoked while
108964414cc0SJohn Baldwin.Fa dev
109064414cc0SJohn Baldwinis unattached but with valid instance variables.
1091aac0aafaSHiten Pandya.Sh SEE ALSO
10927c2c06f2SSheldon Hearn.Xr pci 4 ,
10937c2c06f2SSheldon Hearn.Xr pciconf 8 ,
1094aac0aafaSHiten Pandya.Xr bus_alloc_resource 9 ,
1095aac0aafaSHiten Pandya.Xr bus_dma 9 ,
1096aac0aafaSHiten Pandya.Xr bus_release_resource 9 ,
1097aac0aafaSHiten Pandya.Xr bus_setup_intr 9 ,
1098aac0aafaSHiten Pandya.Xr bus_teardown_intr 9 ,
1099aac0aafaSHiten Pandya.Xr devclass 9 ,
1100aac0aafaSHiten Pandya.Xr device 9 ,
1101aac0aafaSHiten Pandya.Xr driver 9 ,
110264414cc0SJohn Baldwin.Xr eventhandler 9 ,
1103aac0aafaSHiten Pandya.Xr rman 9
1104aac0aafaSHiten Pandya.Rs
1105aac0aafaSHiten Pandya.%B FreeBSD Developers' Handbook
1106aac0aafaSHiten Pandya.%T NewBus
1107a2aef24aSEitan Adler.%U https://www.FreeBSD.org/doc/en_US.ISO8859-1/books/developers-handbook/
1108aac0aafaSHiten Pandya.Re
1109aac0aafaSHiten Pandya.Rs
1110aac0aafaSHiten Pandya.%A Shanley
1111aac0aafaSHiten Pandya.%A Anderson
1112aac0aafaSHiten Pandya.%B PCI System Architecture
1113aac0aafaSHiten Pandya.%N 2nd Edition
1114aac0aafaSHiten Pandya.%I Addison-Wesley
1115aac0aafaSHiten Pandya.%O ISBN 0-201-30974-2
1116aac0aafaSHiten Pandya.Re
1117aac0aafaSHiten Pandya.Sh AUTHORS
11188a7314fcSBaptiste Daroussin.An -nosplit
1119571dba6eSHiten PandyaThis manual page was written by
11208a7314fcSBaptiste Daroussin.An Bruce M Simpson Aq Mt bms@FreeBSD.org
1121855ed4c5SJohn Baldwinand
11228a7314fcSBaptiste Daroussin.An John Baldwin Aq Mt jhb@FreeBSD.org .
1123aac0aafaSHiten Pandya.Sh BUGS
11244d80f750SBruce M SimpsonThe kernel PCI code has a number of references to
11254d80f750SBruce M Simpson.Dq "slot numbers" .
1126bf1639eeSBruce M SimpsonThese do not refer to the geographic location of PCI devices,
1127bf1639eeSBruce M Simpsonbut to the device number assigned by the combination of the PCI IDSEL
1128bf1639eeSBruce M Simpsonmechanism and the platform firmware.
1129bf1639eeSBruce M SimpsonThis should be taken note of when working with the kernel PCI code.
1130ce204e1bSJohn Baldwin.Pp
1131ce204e1bSJohn BaldwinThe PCI bus driver should allocate the MSI-X vector table and PBA internally
1132ce204e1bSJohn Baldwinas necessary rather than requiring the caller to do so.
1133