xref: /freebsd/share/man/man9/pci.9 (revision fe3ff217dd5c53ef0b0a5cd7a1142095ba4ecf63)
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.\"
28*fe3ff217SPatrick Kelsey.Dd July 8, 2015
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 ,
45855ed4c5SJohn Baldwin.Nm pci_get_max_read_req ,
460a9c80e5SJohn Baldwin.Nm pci_get_powerstate ,
47855ed4c5SJohn Baldwin.Nm pci_get_vpd_ident ,
48855ed4c5SJohn Baldwin.Nm pci_get_vpd_readonly ,
497d971e36SRyan Stone.Nm pci_iov_attach ,
507d971e36SRyan Stone.Nm pci_iov_detach ,
51855ed4c5SJohn Baldwin.Nm pci_msi_count ,
52855ed4c5SJohn Baldwin.Nm pci_msix_count ,
53855ed4c5SJohn Baldwin.Nm pci_pending_msix ,
540a9c80e5SJohn Baldwin.Nm pci_read_config ,
55855ed4c5SJohn Baldwin.Nm pci_release_msi ,
56855ed4c5SJohn Baldwin.Nm pci_remap_msix ,
570a9c80e5SJohn Baldwin.Nm pci_restore_state ,
580a9c80e5SJohn Baldwin.Nm pci_save_state ,
59855ed4c5SJohn Baldwin.Nm pci_set_max_read_req ,
600a9c80e5SJohn Baldwin.Nm pci_set_powerstate ,
610a9c80e5SJohn Baldwin.Nm pci_write_config
62aac0aafaSHiten Pandya.Nd PCI bus interface
63aac0aafaSHiten Pandya.Sh SYNOPSIS
64aac0aafaSHiten Pandya.In sys/bus.h
65aac0aafaSHiten Pandya.In dev/pci/pcireg.h
66855ed4c5SJohn Baldwin.In dev/pci/pcivar.h
67855ed4c5SJohn Baldwin.Ft int
68855ed4c5SJohn Baldwin.Fn pci_alloc_msi "device_t dev" "int *count"
69855ed4c5SJohn Baldwin.Ft int
70855ed4c5SJohn Baldwin.Fn pci_alloc_msix "device_t dev" "int *count"
71aac0aafaSHiten Pandya.Ft int
72aac0aafaSHiten Pandya.Fn pci_disable_busmaster "device_t dev"
73aac0aafaSHiten Pandya.Ft int
74aac0aafaSHiten Pandya.Fn pci_disable_io "device_t dev" "int space"
75aac0aafaSHiten Pandya.Ft int
760a9c80e5SJohn Baldwin.Fn pci_enable_busmaster "device_t dev"
77aac0aafaSHiten Pandya.Ft int
780a9c80e5SJohn Baldwin.Fn pci_enable_io "device_t dev" "int space"
79aac0aafaSHiten Pandya.Ft device_t
8065bb31b8SRuslan Ermilov.Fn pci_find_bsf "uint8_t bus" "uint8_t slot" "uint8_t func"
81855ed4c5SJohn Baldwin.Ft int
82855ed4c5SJohn Baldwin.Fn pci_find_cap "device_t dev" "int capability" "int *capreg"
83aac0aafaSHiten Pandya.Ft device_t
8455aaf894SMarius Strobl.Fn pci_find_dbsf "uint32_t domain" "uint8_t bus" "uint8_t slot" "uint8_t func"
8555aaf894SMarius Strobl.Ft device_t
8665bb31b8SRuslan Ermilov.Fn pci_find_device "uint16_t vendor" "uint16_t device"
870a9c80e5SJohn Baldwin.Ft int
8868bf9717SJohn Baldwin.Fn pci_find_extcap "device_t dev" "int capability" "int *capreg"
8968bf9717SJohn Baldwin.Ft int
9068bf9717SJohn Baldwin.Fn pci_find_htcap "device_t dev" "int capability" "int *capreg"
9168bf9717SJohn Baldwin.Ft int
92855ed4c5SJohn Baldwin.Fn pci_get_max_read_req "device_t dev"
93855ed4c5SJohn Baldwin.Ft int
940a9c80e5SJohn Baldwin.Fn pci_get_powerstate "device_t dev"
95855ed4c5SJohn Baldwin.Ft int
96855ed4c5SJohn Baldwin.Fn pci_get_vpd_ident "device_t dev" "const char **identptr"
97855ed4c5SJohn Baldwin.Ft int
98855ed4c5SJohn Baldwin.Fn pci_get_vpd_readonly "device_t dev" "const char *kw" "const char **vptr"
99855ed4c5SJohn Baldwin.Ft int
100855ed4c5SJohn Baldwin.Fn pci_msi_count "device_t dev"
101855ed4c5SJohn Baldwin.Ft int
102855ed4c5SJohn Baldwin.Fn pci_msix_count "device_t dev"
103855ed4c5SJohn Baldwin.Ft int
104855ed4c5SJohn Baldwin.Fn pci_pending_msix "device_t dev" "u_int index"
1050a9c80e5SJohn Baldwin.Ft uint32_t
1060a9c80e5SJohn Baldwin.Fn pci_read_config "device_t dev" "int reg" "int width"
107855ed4c5SJohn Baldwin.Ft int
108855ed4c5SJohn Baldwin.Fn pci_release_msi "device_t dev"
109855ed4c5SJohn Baldwin.Ft int
110855ed4c5SJohn Baldwin.Fn pci_remap_msix "device_t dev" "int count" "const u_int *vectors"
1110a9c80e5SJohn Baldwin.Ft void
1120a9c80e5SJohn Baldwin.Fn pci_restore_state "device_t dev"
1130a9c80e5SJohn Baldwin.Ft void
1140a9c80e5SJohn Baldwin.Fn pci_save_state "device_t dev"
1150a9c80e5SJohn Baldwin.Ft int
116855ed4c5SJohn Baldwin.Fn pci_set_max_read_req "device_t dev" "int size"
117855ed4c5SJohn Baldwin.Ft int
1180a9c80e5SJohn Baldwin.Fn pci_set_powerstate "device_t dev" "int state"
1190a9c80e5SJohn Baldwin.Ft void
1200a9c80e5SJohn Baldwin.Fn pci_write_config "device_t dev" "int reg" "uint32_t val" "int width"
121f3bb9251SJohn Baldwin.In dev/pci/pci_iov.h
122f3bb9251SJohn Baldwin.Ft int
123f3bb9251SJohn Baldwin.Fn pci_iov_attach "device_t dev" "nvlist_t *pf_schema" "nvlist_t *vf_schema"
124f3bb9251SJohn Baldwin.Ft int
125f3bb9251SJohn Baldwin.Fn pci_iov_detach "device_t dev"
126aac0aafaSHiten Pandya.Sh DESCRIPTION
127aac0aafaSHiten PandyaThe
128aac0aafaSHiten Pandya.Nm
129aac0aafaSHiten Pandyaset of functions are used for managing PCI devices.
130855ed4c5SJohn BaldwinThe functions are split into several groups:
131855ed4c5SJohn Baldwinraw configuration access,
132855ed4c5SJohn Baldwinlocating devices,
133855ed4c5SJohn Baldwindevice information,
134855ed4c5SJohn Baldwindevice configuration,
135855ed4c5SJohn Baldwinand
136855ed4c5SJohn Baldwinmessage signaled interrupts.
137855ed4c5SJohn Baldwin.Ss Raw Configuration Access
138aac0aafaSHiten PandyaThe
139aac0aafaSHiten Pandya.Fn pci_read_config
140aac0aafaSHiten Pandyafunction is used to read data from the PCI configuration
141aac0aafaSHiten Pandyaspace of the device
142aac0aafaSHiten Pandya.Fa dev ,
143aac0aafaSHiten Pandyaat offset
144aac0aafaSHiten Pandya.Fa reg ,
145aac0aafaSHiten Pandyawith
146aac0aafaSHiten Pandya.Fa width
147aac0aafaSHiten Pandyaspecifying the size of the access.
148aac0aafaSHiten Pandya.Pp
149aac0aafaSHiten PandyaThe
150aac0aafaSHiten Pandya.Fn pci_write_config
151aac0aafaSHiten Pandyafunction is used to write the value
152aac0aafaSHiten Pandya.Fa val
153aac0aafaSHiten Pandyato the PCI configuration
154aac0aafaSHiten Pandyaspace of the device
155aac0aafaSHiten Pandya.Fa dev ,
156aac0aafaSHiten Pandyaat offset
157aac0aafaSHiten Pandya.Fa reg ,
158aac0aafaSHiten Pandyawith
159aac0aafaSHiten Pandya.Fa width
160aac0aafaSHiten Pandyaspecifying the size of the access.
161aac0aafaSHiten Pandya.Pp
162855ed4c5SJohn Baldwin.Em NOTE :
163855ed4c5SJohn BaldwinDevice drivers should only use these functions for functionality that
164855ed4c5SJohn Baldwinis not available via another
165855ed4c5SJohn Baldwin.Fn pci
166855ed4c5SJohn Baldwinfunction.
167855ed4c5SJohn Baldwin.Ss Locating Devices
168855ed4c5SJohn BaldwinThe
169855ed4c5SJohn Baldwin.Fn pci_find_bsf
170855ed4c5SJohn Baldwinfunction looks up the
171855ed4c5SJohn Baldwin.Vt device_t
172855ed4c5SJohn Baldwinof a PCI device, given its
173855ed4c5SJohn Baldwin.Fa bus ,
174855ed4c5SJohn Baldwin.Fa slot ,
175855ed4c5SJohn Baldwinand
176855ed4c5SJohn Baldwin.Fa func .
177855ed4c5SJohn BaldwinThe
178855ed4c5SJohn Baldwin.Fa slot
179855ed4c5SJohn Baldwinnumber actually refers to the number of the device on the bus,
180855ed4c5SJohn Baldwinwhich does not necessarily indicate its geographic location
181855ed4c5SJohn Baldwinin terms of a physical slot.
182855ed4c5SJohn BaldwinNote that in case the system has multiple PCI domains,
183855ed4c5SJohn Baldwinthe
184855ed4c5SJohn Baldwin.Fn pci_find_bsf
185855ed4c5SJohn Baldwinfunction only searches the first one.
186855ed4c5SJohn BaldwinActually, it is equivalent to:
187855ed4c5SJohn Baldwin.Bd -literal -offset indent
188855ed4c5SJohn Baldwinpci_find_dbsf(0, bus, slot, func);
189855ed4c5SJohn Baldwin.Ed
190855ed4c5SJohn Baldwin.Pp
191855ed4c5SJohn BaldwinThe
192855ed4c5SJohn Baldwin.Fn pci_find_dbsf
193855ed4c5SJohn Baldwinfunction looks up the
194855ed4c5SJohn Baldwin.Vt device_t
195855ed4c5SJohn Baldwinof a PCI device, given its
196855ed4c5SJohn Baldwin.Fa domain ,
197855ed4c5SJohn Baldwin.Fa bus ,
198855ed4c5SJohn Baldwin.Fa slot ,
199855ed4c5SJohn Baldwinand
200855ed4c5SJohn Baldwin.Fa func .
201855ed4c5SJohn BaldwinThe
202855ed4c5SJohn Baldwin.Fa slot
203855ed4c5SJohn Baldwinnumber actually refers to the number of the device on the bus,
204855ed4c5SJohn Baldwinwhich does not necessarily indicate its geographic location
205855ed4c5SJohn Baldwinin terms of a physical slot.
206855ed4c5SJohn Baldwin.Pp
207855ed4c5SJohn BaldwinThe
208855ed4c5SJohn Baldwin.Fn pci_find_device
209855ed4c5SJohn Baldwinfunction looks up the
210855ed4c5SJohn Baldwin.Vt device_t
211855ed4c5SJohn Baldwinof a PCI device, given its
212855ed4c5SJohn Baldwin.Fa vendor
213855ed4c5SJohn Baldwinand
214855ed4c5SJohn Baldwin.Fa device
215855ed4c5SJohn BaldwinIDs.
216855ed4c5SJohn BaldwinNote that there can be multiple matches for this search; this function
217855ed4c5SJohn Baldwinonly returns the first matching device.
218855ed4c5SJohn Baldwin.Ss Device Information
219855ed4c5SJohn BaldwinThe
220855ed4c5SJohn Baldwin.Fn pci_find_cap
221855ed4c5SJohn Baldwinfunction is used to locate the first instance of a PCI capability
222855ed4c5SJohn Baldwinregister set for the device
223855ed4c5SJohn Baldwin.Fa dev .
224855ed4c5SJohn BaldwinThe capability to locate is specified by ID via
225855ed4c5SJohn Baldwin.Fa capability .
226855ed4c5SJohn BaldwinConstant macros of the form
227855ed4c5SJohn Baldwin.Dv PCIY_xxx
228855ed4c5SJohn Baldwinfor standard capability IDs are defined in
229855ed4c5SJohn Baldwin.In dev/pci/pcireg.h .
230855ed4c5SJohn BaldwinIf the capability is found, then
231855ed4c5SJohn Baldwin.Fa *capreg
232281a359eSJohn Baldwinis set to the offset in configuration space of the capability register set,
233855ed4c5SJohn Baldwinand
234855ed4c5SJohn Baldwin.Fn pci_find_cap
235855ed4c5SJohn Baldwinreturns zero.
236855ed4c5SJohn BaldwinIf the capability is not found or the device does not support capabilities,
237855ed4c5SJohn Baldwin.Fn pci_find_cap
238855ed4c5SJohn Baldwinreturns an error.
239855ed4c5SJohn Baldwin.Pp
240855ed4c5SJohn BaldwinThe
24168bf9717SJohn Baldwin.Fn pci_find_extcap
24268bf9717SJohn Baldwinfunction is used to locate the first instance of a PCI-express
24368bf9717SJohn Baldwinextended capability register set for the device
24468bf9717SJohn Baldwin.Fa dev .
24568bf9717SJohn BaldwinThe extended capability to locate is specified by ID via
24668bf9717SJohn Baldwin.Fa capability .
24768bf9717SJohn BaldwinConstant macros of the form
24868bf9717SJohn Baldwin.Dv PCIZ_xxx
24968bf9717SJohn Baldwinfor standard extended capability IDs are defined in
25068bf9717SJohn Baldwin.In dev/pci/pcireg.h .
25168bf9717SJohn BaldwinIf the extended capability is found, then
25268bf9717SJohn Baldwin.Fa *capreg
253281a359eSJohn Baldwinis set to the offset in configuration space of the extended capability
25468bf9717SJohn Baldwinregister set, and
25568bf9717SJohn Baldwin.Fn pci_find_extcap
25668bf9717SJohn Baldwinreturns zero.
25768bf9717SJohn BaldwinIf the extended capability is not found or the device is not a
25868bf9717SJohn BaldwinPCI-express device,
25968bf9717SJohn Baldwin.Fn pci_find_extcap
26068bf9717SJohn Baldwinreturns an error.
26168bf9717SJohn Baldwin.Pp
26268bf9717SJohn BaldwinThe
26368bf9717SJohn Baldwin.Fn pci_find_htcap
26468bf9717SJohn Baldwinfunction is used to locate the first instance of a HyperTransport capability
26568bf9717SJohn Baldwinregister set for the device
26668bf9717SJohn Baldwin.Fa dev .
26768bf9717SJohn BaldwinThe capability to locate is specified by type via
26868bf9717SJohn Baldwin.Fa capability .
26968bf9717SJohn BaldwinConstant macros of the form
27068bf9717SJohn Baldwin.Dv PCIM_HTCAP_xxx
27168bf9717SJohn Baldwinfor standard HyperTransport capability types are defined in
27268bf9717SJohn Baldwin.In dev/pci/pcireg.h .
27368bf9717SJohn BaldwinIf the capability is found, then
27468bf9717SJohn Baldwin.Fa *capreg
275281a359eSJohn Baldwinis set to the offset in configuration space of the capability register set,
27668bf9717SJohn Baldwinand
27768bf9717SJohn Baldwin.Fn pci_find_htcap
27868bf9717SJohn Baldwinreturns zero.
27968bf9717SJohn BaldwinIf the capability is not found or the device is not a HyperTransport device,
28068bf9717SJohn Baldwin.Fn pci_find_htcap
28168bf9717SJohn Baldwinreturns an error.
28268bf9717SJohn Baldwin.Pp
28368bf9717SJohn BaldwinThe
284855ed4c5SJohn Baldwin.Fn pci_get_vpd_ident
285855ed4c5SJohn Baldwinfunction is used to fetch a device's Vital Product Data
286855ed4c5SJohn Baldwin.Pq VPD
287855ed4c5SJohn Baldwinidentifier string.
288855ed4c5SJohn BaldwinIf the device
289855ed4c5SJohn Baldwin.Fa dev
290855ed4c5SJohn Baldwinsupports VPD and provides an identifier string,
291855ed4c5SJohn Baldwinthen
292855ed4c5SJohn Baldwin.Fa *identptr
293855ed4c5SJohn Baldwinis set to point at a read-only, null-terminated copy of the identifier
294855ed4c5SJohn Baldwinstring,
295855ed4c5SJohn Baldwinand
296855ed4c5SJohn Baldwin.Fn pci_get_vpd_ident
297855ed4c5SJohn Baldwinreturns zero.
298855ed4c5SJohn BaldwinIf the device does not support VPD or does not provide an identifier
299855ed4c5SJohn Baldwinstring,
300855ed4c5SJohn Baldwinthen
301855ed4c5SJohn Baldwin.Fn pci_get_vpd_ident
302855ed4c5SJohn Baldwinreturns an error.
303855ed4c5SJohn Baldwin.Pp
304855ed4c5SJohn BaldwinThe
305855ed4c5SJohn Baldwin.Fn pci_get_vpd_readonly
306855ed4c5SJohn Baldwinfunction is used to fetch the value of a single VPD read-only keyword
307855ed4c5SJohn Baldwinfor the device
308855ed4c5SJohn Baldwin.Fa dev .
309855ed4c5SJohn BaldwinThe keyword to fetch is identified by the two character string
310855ed4c5SJohn Baldwin.Fa kw .
311855ed4c5SJohn BaldwinIf the device supports VPD and provides a read-only value for the
312855ed4c5SJohn Baldwinrequested keyword,
313855ed4c5SJohn Baldwinthen
314855ed4c5SJohn Baldwin.Fa *vptr
315855ed4c5SJohn Baldwinis set to point at a read-only, null-terminated copy of the value,
316855ed4c5SJohn Baldwinand
317855ed4c5SJohn Baldwin.Fn pci_get_vpd_readonly
318855ed4c5SJohn Baldwinreturns zero.
319855ed4c5SJohn BaldwinIf the device does not support VPD or does not provide the requested
320855ed4c5SJohn Baldwinkeyword,
321855ed4c5SJohn Baldwinthen
322855ed4c5SJohn Baldwin.Fn pci_get_vpd_readonly
323855ed4c5SJohn Baldwinreturns an error.
324855ed4c5SJohn Baldwin.Ss Device Configuration
325aac0aafaSHiten PandyaThe
326aac0aafaSHiten Pandya.Fn pci_enable_busmaster
327aac0aafaSHiten Pandyafunction enables PCI bus mastering for the device
328aac0aafaSHiten Pandya.Fa dev ,
329aac0aafaSHiten Pandyaby setting the
330aac0aafaSHiten Pandya.Dv PCIM_CMD_BUSMASTEREN
331aac0aafaSHiten Pandyabit in the
332aac0aafaSHiten Pandya.Dv PCIR_COMMAND
333aac0aafaSHiten Pandyaregister.
334aac0aafaSHiten PandyaThe
335aac0aafaSHiten Pandya.Fn pci_disable_busmaster
336aac0aafaSHiten Pandyafunction clears this bit.
337aac0aafaSHiten Pandya.Pp
338aac0aafaSHiten PandyaThe
339aac0aafaSHiten Pandya.Fn pci_enable_io
340aac0aafaSHiten Pandyafunction enables memory or I/O port address decoding for the device
341aac0aafaSHiten Pandya.Fa dev ,
342aac0aafaSHiten Pandyaby setting the
343aac0aafaSHiten Pandya.Dv PCIM_CMD_MEMEN
344aac0aafaSHiten Pandyaor
345aac0aafaSHiten Pandya.Dv PCIM_CMD_PORTEN
346aac0aafaSHiten Pandyabit in the
347aac0aafaSHiten Pandya.Dv PCIR_COMMAND
3485203edcdSRuslan Ermilovregister appropriately.
3495203edcdSRuslan ErmilovThe
350aac0aafaSHiten Pandya.Fn pci_disable_io
351aac0aafaSHiten Pandyafunction clears the appropriate bit.
352aac0aafaSHiten PandyaThe
35365bb31b8SRuslan Ermilov.Fa space
354aac0aafaSHiten Pandyaargument specifies which resource is affected; this can be either
355aac0aafaSHiten Pandya.Dv SYS_RES_MEMORY
356aac0aafaSHiten Pandyaor
357aac0aafaSHiten Pandya.Dv SYS_RES_IOPORT
358aac0aafaSHiten Pandyaas appropriate.
359855ed4c5SJohn BaldwinDevice drivers should generally not use these routines directly.
360855ed4c5SJohn BaldwinThe PCI bus will enable decoding automatically when a
361855ed4c5SJohn Baldwin.Dv SYS_RES_MEMORY
362855ed4c5SJohn Baldwinor
363855ed4c5SJohn Baldwin.Dv SYS_RES_IOPORT
364855ed4c5SJohn Baldwinresource is activated via
365855ed4c5SJohn Baldwin.Xr bus_alloc_resource 9
366855ed4c5SJohn Baldwinor
367855ed4c5SJohn Baldwin.Xr bus_activate_resource 9 .
368aac0aafaSHiten Pandya.Pp
369855ed4c5SJohn BaldwinThe
370855ed4c5SJohn Baldwin.Fn pci_get_max_read_req
371855ed4c5SJohn Baldwinfunction returns the current maximum read request size in bytes for a
372855ed4c5SJohn BaldwinPCI-express device.
373855ed4c5SJohn BaldwinIf the
374855ed4c5SJohn Baldwin.Fa dev
375855ed4c5SJohn Baldwindevice is not a PCI-express device,
376855ed4c5SJohn Baldwin.Fn pci_get_max_read_req
377855ed4c5SJohn Baldwinreturns zero.
378855ed4c5SJohn Baldwin.Pp
379855ed4c5SJohn BaldwinThe
380855ed4c5SJohn Baldwin.Fn pci_set_max_read_req
381855ed4c5SJohn Baldwinsets the PCI-express maximum read request size for
382855ed4c5SJohn Baldwin.Fa dev .
383855ed4c5SJohn BaldwinThe requested
384855ed4c5SJohn Baldwin.Fa size
385855ed4c5SJohn Baldwinmay be adjusted,
386855ed4c5SJohn Baldwinand
387855ed4c5SJohn Baldwin.Fn pci_set_max_read_req
388855ed4c5SJohn Baldwinreturns the actual size set in bytes.
389855ed4c5SJohn BaldwinIf the
390855ed4c5SJohn Baldwin.Fa dev
391855ed4c5SJohn Baldwindevice is not a PCI-express device,
392855ed4c5SJohn Baldwin.Fn pci_set_max_read_req
393855ed4c5SJohn Baldwinreturns zero.
394aac0aafaSHiten Pandya.Pp
395aac0aafaSHiten PandyaThe
396aac0aafaSHiten Pandya.Fn pci_get_powerstate
397adb63907SJohn Baldwinfunction returns the current power state of the device
398aac0aafaSHiten Pandya.Fa dev .
399aac0aafaSHiten PandyaIf the device does not support power management capabilities, then the default
400aac0aafaSHiten Pandyastate of
401aac0aafaSHiten Pandya.Dv PCI_POWERSTATE_D0
402aac0aafaSHiten Pandyais returned.
403adb63907SJohn BaldwinThe following power states are defined by PCI:
40465bb31b8SRuslan Ermilov.Bl -hang -width ".Dv PCI_POWERSTATE_UNKNOWN"
405aac0aafaSHiten Pandya.It Dv PCI_POWERSTATE_D0
406aac0aafaSHiten PandyaState in which device is on and running.
407aac0aafaSHiten PandyaIt is receiving full power from the system and delivering
408aac0aafaSHiten Pandyafull functionality to the user.
409aac0aafaSHiten Pandya.It Dv PCI_POWERSTATE_D1
410aac0aafaSHiten PandyaClass-specific low-power state in which device context may or
4115a2e3b61SDaniel Gerzomay not be lost.
41265bb31b8SRuslan ErmilovBusses in this state cannot do anything to the bus, to
4139817b894SBruce M Simpsonforce devices to lose context.
414aac0aafaSHiten Pandya.It Dv PCI_POWERSTATE_D2
415aac0aafaSHiten PandyaClass-specific low-power state in which device context may or
416aac0aafaSHiten Pandyamay not be lost.
417aac0aafaSHiten PandyaAttains greater power savings than
418aac0aafaSHiten Pandya.Dv PCI_POWERSTATE_D1 .
41965bb31b8SRuslan ErmilovBusses in this state can cause devices to lose some context.
420aac0aafaSHiten PandyaDevices
421aac0aafaSHiten Pandya.Em must
422aac0aafaSHiten Pandyabe prepared for the bus to be in this state or higher.
423aac0aafaSHiten Pandya.It Dv PCI_POWERSTATE_D3
424aac0aafaSHiten PandyaState in which the device is off and not running.
425aac0aafaSHiten PandyaDevice context is lost, and power from the device can
426aac0aafaSHiten Pandyabe removed.
427aac0aafaSHiten Pandya.It Dv PCI_POWERSTATE_UNKNOWN
428aac0aafaSHiten PandyaState of the device is unknown.
429aac0aafaSHiten Pandya.El
430aac0aafaSHiten Pandya.Pp
431aac0aafaSHiten PandyaThe
432aac0aafaSHiten Pandya.Fn pci_set_powerstate
433aac0aafaSHiten Pandyafunction is used to transition the device
434aac0aafaSHiten Pandya.Fa dev
435adb63907SJohn Baldwinto the PCI power state
436aac0aafaSHiten Pandya.Fa state .
437adb63907SJohn BaldwinIf the device does not support power management capabilities or
438adb63907SJohn Baldwinit does not support the specific power state
439adb63907SJohn Baldwin.Fa state ,
440adb63907SJohn Baldwinthen the function will fail with
441adb63907SJohn Baldwin.Er EOPNOTSUPP .
442aac0aafaSHiten Pandya.Pp
443aac0aafaSHiten PandyaThe
4447d971e36SRyan Stone.Fn pci_iov_attach
4457d971e36SRyan Stonefunction is used to advertise that the given device
4467d971e36SRyan Stone.Pq and associated device driver
4477d971e36SRyan Stonesupports PCI Single-Root I/O Virtualization
448*fe3ff217SPatrick Kelsey.Pq SR-IOV .
4497d971e36SRyan StoneA driver that supports SR-IOV must implement the
450f3bb9251SJohn Baldwin.Xr PCI_IOV_INIT 9 ,
451f3bb9251SJohn Baldwin.Xr PCI_IOV_ADD_VF 9
4527d971e36SRyan Stoneand
453f3bb9251SJohn Baldwin.Xr PCI_IOV_UNINIT 9
4547d971e36SRyan Stonemethods.
4557d971e36SRyan StoneThis function should be called during the
4567d971e36SRyan Stone.Xr DEVICE_ATTACH 9
4577d971e36SRyan Stonemethod.
4587d971e36SRyan StoneIf this function returns an error, it is recommended that the device driver
4597d971e36SRyan Stonestill successfully attaches, but runs with SR-IOV disabled.
4607d971e36SRyan StoneThe
4617d971e36SRyan Stone.Fa pf_schema
4627d971e36SRyan Stoneand
4637d971e36SRyan Stone.Fa vf_schema
4647d971e36SRyan Stoneparameters are used to define what device-specific configuration parameters the
4657d971e36SRyan Stonedevice driver accepts when SR-IOV is enabled for the Physical Function
4667d971e36SRyan Stone.Pq PF
4677d971e36SRyan Stoneand for individual Virtual Functions
4687d971e36SRyan Stone.Pq VFs
4697d971e36SRyan Stonerespectively.
4707d971e36SRyan StoneSee
4717d971e36SRyan Stone.Xr pci_iov_schema 9
4727d971e36SRyan Stonefor details on how to construct the schema.
4737d971e36SRyan StoneIf either the
4747d971e36SRyan Stone.Pa pf_schema
4757d971e36SRyan Stoneor
4767d971e36SRyan Stone.Pa vf_schema
4777d971e36SRyan Stoneis invalid or specifies parameter names that conflict with parameter names that
4787d971e36SRyan Stoneare already in use,
4797d971e36SRyan Stone.Fn pci_iov_attach
4807d971e36SRyan Stonewill return an error and SR-IOV will not be available on the PF device.
4817d971e36SRyan StoneIf a driver does not accept configuration parameters for either the PF device
4827d971e36SRyan Stoneor the VF devices, the driver must pass an empty schema for that device.
4837d971e36SRyan StoneThe SR-IOV infrastructure takes ownership of the
4847d971e36SRyan Stone.Fa pf_schema
4857d971e36SRyan Stoneand
4867d971e36SRyan Stone.Fa vf_schema
4877d971e36SRyan Stoneand is responsible for freeing them.
4887d971e36SRyan StoneThe driver must never free the schemas itself.
4897d971e36SRyan Stone.Pp
4907d971e36SRyan StoneThe
4917d971e36SRyan Stone.Fn pci_iov_detach
4927d971e36SRyan Stonefunction is used to advise the SR-IOV infrastructure that the driver for the
4937d971e36SRyan Stonegiven device is attempting to detach and that all SR-IOV resources for the
4947d971e36SRyan Stonedevice must be released.
4957d971e36SRyan StoneThis function must be called during the
4967d971e36SRyan Stone.Xr DEVICE_DETACH 9
4977d971e36SRyan Stonemethod if
4987d971e36SRyan Stone.Fn pci_iov_attach
4997d971e36SRyan Stonewas successfully called on the device and
5007d971e36SRyan Stone.Fn pci_iov_detach
5017d971e36SRyan Stonehas not subsequently been called on the device and returned no error.
5027d971e36SRyan StoneIf this function returns an error, the
5037d971e36SRyan Stone.Xr DEVICE_DETACH 9
5047d971e36SRyan Stonemethod must fail and return an error, as detaching the PF driver while VF
5057d971e36SRyan Stonedevices are active would cause system instability.
5067d971e36SRyan StoneThis function is safe to call and will always succeed if
5077d971e36SRyan Stone.Fn pci_iov_attach
5087d971e36SRyan Stonepreviously failed with an error on the given device, or if
5097d971e36SRyan Stone.Fn pci_iov_attach
5107d971e36SRyan Stonewas never called on the device.
5117d971e36SRyan Stone.Pp
5127d971e36SRyan StoneThe
5139415d1e0SJohn Baldwin.Fn pci_save_state
5149415d1e0SJohn Baldwinand
5159415d1e0SJohn Baldwin.Fn pci_restore_state
5169415d1e0SJohn Baldwinfunctions can be used by a device driver to save and restore standard PCI
5179415d1e0SJohn Baldwinconfig registers.
5189415d1e0SJohn BaldwinThe
5199415d1e0SJohn Baldwin.Fn pci_save_state
5209415d1e0SJohn Baldwinfunction must be invoked while the device has valid state before
5219415d1e0SJohn Baldwin.Fn pci_restore_state
5229415d1e0SJohn Baldwincan be used.
5239415d1e0SJohn BaldwinIf the device is not in the fully-powered state
5249415d1e0SJohn Baldwin.Pq Dv PCI_POWERSTATE_D0
5259415d1e0SJohn Baldwinwhen
5269415d1e0SJohn Baldwin.Fn pci_restore_state
5279415d1e0SJohn Baldwinis invoked,
5289415d1e0SJohn Baldwinthen the device will be transitioned to
5299415d1e0SJohn Baldwin.Dv PCI_POWERSTATE_D0
5309415d1e0SJohn Baldwinbefore any config registers are restored.
531855ed4c5SJohn Baldwin.Ss Message Signaled Interrupts
532855ed4c5SJohn BaldwinMessage Signaled Interrupts
533855ed4c5SJohn Baldwin.Pq MSI
534855ed4c5SJohn Baldwinand
535855ed4c5SJohn BaldwinEnhanced Message Signaled Interrupts
536855ed4c5SJohn Baldwin.Pq MSI-X
537855ed4c5SJohn Baldwinare PCI capabilities that provide an alternate method for PCI
538855ed4c5SJohn Baldwindevices to signal interrupts.
539855ed4c5SJohn BaldwinThe legacy INTx interrupt is available to PCI devices as a
540855ed4c5SJohn Baldwin.Dv SYS_RES_IRQ
541855ed4c5SJohn Baldwinresource with a resource ID of zero.
542855ed4c5SJohn BaldwinMSI and MSI-X interrupts are available to PCI devices as one or more
543855ed4c5SJohn Baldwin.Dv SYS_RES_IRQ
544855ed4c5SJohn Baldwinresources with resource IDs greater than zero.
545855ed4c5SJohn BaldwinA driver must ask the PCI bus to allocate MSI or MSI-X interrupts
546855ed4c5SJohn Baldwinusing
547855ed4c5SJohn Baldwin.Fn pci_alloc_msi
548855ed4c5SJohn Baldwinor
549855ed4c5SJohn Baldwin.Fn pci_alloc_msix
550855ed4c5SJohn Baldwinbefore it can use MSI or MSI-X
551855ed4c5SJohn Baldwin.Dv SYS_RES_IRQ
552855ed4c5SJohn Baldwinresources.
553855ed4c5SJohn BaldwinA driver is not allowed to use the legacy INTx
554855ed4c5SJohn Baldwin.Dv SYS_RES_IRQ
555855ed4c5SJohn Baldwinresource if MSI or MSI-X interrupts have been allocated,
556855ed4c5SJohn Baldwinand attempts to allocate MSI or MSI-X interrupts will fail if the
557855ed4c5SJohn Baldwindriver is currently using the legacy INTx
558855ed4c5SJohn Baldwin.Dv SYS_RES_IRQ
559855ed4c5SJohn Baldwinresource.
560855ed4c5SJohn BaldwinA driver is only allowed to use either MSI or MSI-X,
561855ed4c5SJohn Baldwinbut not both.
5629415d1e0SJohn Baldwin.Pp
5639415d1e0SJohn BaldwinThe
564563d4639SMark Johnston.Fn pci_msi_count
565855ed4c5SJohn Baldwinfunction returns the maximum number of MSI messages supported by the
566855ed4c5SJohn Baldwindevice
567855ed4c5SJohn Baldwin.Fa dev .
568855ed4c5SJohn BaldwinIf the device does not support MSI,
569855ed4c5SJohn Baldwinthen
570563d4639SMark Johnston.Fn pci_msi_count
571855ed4c5SJohn Baldwinreturns zero.
57255aaf894SMarius Strobl.Pp
57355aaf894SMarius StroblThe
574855ed4c5SJohn Baldwin.Fn pci_alloc_msi
575855ed4c5SJohn Baldwinfunction attempts to allocate
576855ed4c5SJohn Baldwin.Fa *count
577855ed4c5SJohn BaldwinMSI messages for the device
578855ed4c5SJohn Baldwin.Fa dev .
57955aaf894SMarius StroblThe
580855ed4c5SJohn Baldwin.Fn pci_alloc_msi
581855ed4c5SJohn Baldwinfunction may allocate fewer messages than requested for various
582855ed4c5SJohn Baldwinreasons including requests for more messages than the device
583855ed4c5SJohn Baldwin.Fa dev
584855ed4c5SJohn Baldwinsupports,
585855ed4c5SJohn Baldwinor if the system has a shortage of available MSI messages.
586855ed4c5SJohn BaldwinOn success,
587855ed4c5SJohn Baldwin.Fa *count
588855ed4c5SJohn Baldwinis set to the number of messages allocated and
589855ed4c5SJohn Baldwin.Fn pci_alloc_msi
590855ed4c5SJohn Baldwinreturns zero.
591855ed4c5SJohn BaldwinThe
592855ed4c5SJohn Baldwin.Dv SYS_RES_IRQ
593855ed4c5SJohn Baldwinresources for the allocated messages will be available at consecutive
594855ed4c5SJohn Baldwinresource IDs beginning with one.
595855ed4c5SJohn BaldwinIf
596855ed4c5SJohn Baldwin.Fn pci_alloc_msi
597855ed4c5SJohn Baldwinis not able to allocate any messages,
598855ed4c5SJohn Baldwinit returns an error.
599855ed4c5SJohn BaldwinNote that MSI only supports message counts that are powers of two;
600855ed4c5SJohn Baldwinrequests to allocate a non-power of two count of messages will fail.
601aac0aafaSHiten Pandya.Pp
602aac0aafaSHiten PandyaThe
603855ed4c5SJohn Baldwin.Fn pci_release_msi
604855ed4c5SJohn Baldwinfunction is used to release any allocated MSI or MSI-X messages back
605855ed4c5SJohn Baldwinto the system.
606855ed4c5SJohn BaldwinIf any MSI or MSI-X
607855ed4c5SJohn Baldwin.Dv SYS_RES_IRQ
608855ed4c5SJohn Baldwinresources are allocated by the driver or have a configured interrupt
609855ed4c5SJohn Baldwinhandler,
610855ed4c5SJohn Baldwinthis function will fail with
611855ed4c5SJohn Baldwin.Er EBUSY .
612855ed4c5SJohn BaldwinThe
613855ed4c5SJohn Baldwin.Fn pci_release_msi
614855ed4c5SJohn Baldwinfunction returns zero on success and an error on failure.
615855ed4c5SJohn Baldwin.Pp
616642c4993SSergey KandaurovThe
617563d4639SMark Johnston.Fn pci_msix_count
618855ed4c5SJohn Baldwinfunction returns the maximum number of MSI-X messages supported by the
619855ed4c5SJohn Baldwindevice
620855ed4c5SJohn Baldwin.Fa dev .
621855ed4c5SJohn BaldwinIf the device does not support MSI-X,
622855ed4c5SJohn Baldwinthen
623563d4639SMark Johnston.Fn pci_msix_count
624855ed4c5SJohn Baldwinreturns zero.
625855ed4c5SJohn Baldwin.Pp
626855ed4c5SJohn BaldwinThe
627855ed4c5SJohn Baldwin.Fn pci_alloc_msix
628855ed4c5SJohn Baldwinfunction attempts to allocate
629855ed4c5SJohn Baldwin.Fa *count
630855ed4c5SJohn BaldwinMSI-X messages for the device
631855ed4c5SJohn Baldwin.Fa dev .
632855ed4c5SJohn BaldwinThe
633855ed4c5SJohn Baldwin.Fn pci_alloc_msix
634855ed4c5SJohn Baldwinfunction may allocate fewer messages than requested for various
635855ed4c5SJohn Baldwinreasons including requests for more messages than the device
636855ed4c5SJohn Baldwin.Fa dev
637855ed4c5SJohn Baldwinsupports,
638855ed4c5SJohn Baldwinor if the system has a shortage of available MSI-X messages.
639855ed4c5SJohn BaldwinOn success,
640855ed4c5SJohn Baldwin.Fa *count
641855ed4c5SJohn Baldwinis set to the number of messages allocated and
642855ed4c5SJohn Baldwin.Fn pci_alloc_msix
643855ed4c5SJohn Baldwinreturns zero.
644855ed4c5SJohn BaldwinFor MSI-X messages,
645855ed4c5SJohn Baldwinthe resource ID for each
64673bbeaa5SGlen Barber.Dv SYS_RES_IRQ
64773bbeaa5SGlen Barberresource identifies the index in the MSI-X table of the
648855ed4c5SJohn Baldwincorresponding message.
649855ed4c5SJohn BaldwinA resource ID of one maps to the first index of the MSI-X table;
650855ed4c5SJohn Baldwina resource ID two identifies the second index in the table, etc.
651855ed4c5SJohn BaldwinThe
652855ed4c5SJohn Baldwin.Fn pci_alloc_msix
653855ed4c5SJohn Baldwinfunction assigns the
654855ed4c5SJohn Baldwin.Fa *count
655855ed4c5SJohn Baldwinmessages allocated to the first
656855ed4c5SJohn Baldwin.Fa *count
657855ed4c5SJohn Baldwintable indicies.
658855ed4c5SJohn BaldwinIf
659855ed4c5SJohn Baldwin.Fn pci_alloc_msix
660855ed4c5SJohn Baldwinis not able to allocate any messages,
661855ed4c5SJohn Baldwinit returns an error.
662855ed4c5SJohn BaldwinUnlike MSI,
663855ed4c5SJohn BaldwinMSI-X does not require message counts that are powers of two.
664855ed4c5SJohn Baldwin.Pp
665855ed4c5SJohn BaldwinThe
666855ed4c5SJohn Baldwin.Fn pci_pending_msix
667855ed4c5SJohn Baldwinfunction examines the
668855ed4c5SJohn Baldwin.Fa dev
669855ed4c5SJohn Baldwindevice's Pending Bit Array
670855ed4c5SJohn Baldwin.Pq PBA
671855ed4c5SJohn Baldwinto determine the pending status of the MSI-X message at table index
672855ed4c5SJohn Baldwin.Fa index .
673855ed4c5SJohn BaldwinIf the indicated message is pending,
674855ed4c5SJohn Baldwinthis function returns a non-zero value;
675855ed4c5SJohn Baldwinotherwise,
676855ed4c5SJohn Baldwinit returns zero.
677855ed4c5SJohn BaldwinPassing an invalid
678855ed4c5SJohn Baldwin.Fa index
679855ed4c5SJohn Baldwinto this function will result in undefined behavior.
680855ed4c5SJohn Baldwin.Pp
681855ed4c5SJohn BaldwinAs mentioned in the description of
682855ed4c5SJohn Baldwin.Fn pci_alloc_msix ,
683855ed4c5SJohn BaldwinMSI-X messages are initially assigned to the first N table entries.
684855ed4c5SJohn BaldwinA driver may use a different distribution of available messages to
685855ed4c5SJohn Baldwintable entries via the
686855ed4c5SJohn Baldwin.Fn pci_remap_msix
687855ed4c5SJohn Baldwinfunction.
68873bbeaa5SGlen BarberNote that this function must be called after a successful call to
689855ed4c5SJohn Baldwin.Fn pci_alloc_msix
690855ed4c5SJohn Baldwinbut before any of the
691855ed4c5SJohn Baldwin.Dv SYS_RES_IRQ
692855ed4c5SJohn Baldwinresources are allocated.
693855ed4c5SJohn BaldwinThe
694855ed4c5SJohn Baldwin.Fn pci_remap_msix
695855ed4c5SJohn Baldwinfunction returns zero on success,
696855ed4c5SJohn Baldwinor an error on failure.
697855ed4c5SJohn Baldwin.Pp
698855ed4c5SJohn BaldwinThe
699855ed4c5SJohn Baldwin.Fa vectors
700855ed4c5SJohn Baldwinarray should contain
701855ed4c5SJohn Baldwin.Fa count
702855ed4c5SJohn Baldwinmessage vectors.
703855ed4c5SJohn BaldwinThe array maps directly to the MSI-X table in that the first entry in
704855ed4c5SJohn Baldwinthe array specifies the message used for the first entry in the MSI-X
705855ed4c5SJohn Baldwintable,
706855ed4c5SJohn Baldwinthe second entry in the array corresponds to the second entry in the
707855ed4c5SJohn BaldwinMSI-X table,
708855ed4c5SJohn Baldwinetc.
709855ed4c5SJohn BaldwinThe vector value in each array index can either be zero to indicate
710855ed4c5SJohn Baldwinthat no message should be assigned to the corresponding MSI-X table entry,
711855ed4c5SJohn Baldwinor it can be a number from one to N
712855ed4c5SJohn Baldwin.Po
713855ed4c5SJohn Baldwinwhere N is the count returned from the previous call to
714855ed4c5SJohn Baldwin.Fn pci_alloc_msix
715855ed4c5SJohn Baldwin.Pc
716855ed4c5SJohn Baldwinto indicate which of the allocated messages should be assigned to the
717855ed4c5SJohn Baldwincorresponding MSI-X table entry.
718855ed4c5SJohn Baldwin.Pp
719855ed4c5SJohn BaldwinIf
720855ed4c5SJohn Baldwin.Fn pci_remap_msix
721855ed4c5SJohn Baldwinsucceeds,
722855ed4c5SJohn Baldwineach MSI-X table entry with a non-zero vector will have an associated
723855ed4c5SJohn Baldwin.Dv SYS_RES_IRQ
724855ed4c5SJohn Baldwinresource whose resource ID corresponds to the table index as described
725855ed4c5SJohn Baldwinabove for
726855ed4c5SJohn Baldwin.Fn pci_alloc_msix .
727855ed4c5SJohn BaldwinMSI-X table entries that with a vector of zero will not have an
728855ed4c5SJohn Baldwinassociated
72973bbeaa5SGlen Barber.Dv SYS_RES_IRQ
73073bbeaa5SGlen Barberresource.
731855ed4c5SJohn BaldwinAdditionally,
732855ed4c5SJohn Baldwinif any of the original messages allocated by
733855ed4c5SJohn Baldwin.Fn pci_alloc_msix
734855ed4c5SJohn Baldwinare not used in the new distribution of messages in the MSI-X table,
735855ed4c5SJohn Baldwinthey will be released automatically.
736855ed4c5SJohn BaldwinNote that if a driver wishes to use fewer messages than were allocated by
737855ed4c5SJohn Baldwin.Fn pci_alloc_msix ,
738855ed4c5SJohn Baldwinthe driver must use a single, contiguous range of messages beginning
739855ed4c5SJohn Baldwinwith one in the new distribution.
740855ed4c5SJohn BaldwinThe
741855ed4c5SJohn Baldwin.Fn pci_remap_msix
742855ed4c5SJohn Baldwinfunction will fail if this condition is not met.
743aac0aafaSHiten Pandya.Sh IMPLEMENTATION NOTES
744aac0aafaSHiten PandyaThe
745aac0aafaSHiten Pandya.Vt pci_addr_t
74665bb31b8SRuslan Ermilovtype varies according to the size of the PCI bus address
747aac0aafaSHiten Pandyaspace on the target architecture.
748aac0aafaSHiten Pandya.Sh SEE ALSO
7497c2c06f2SSheldon Hearn.Xr pci 4 ,
7507c2c06f2SSheldon Hearn.Xr pciconf 8 ,
751aac0aafaSHiten Pandya.Xr bus_alloc_resource 9 ,
752aac0aafaSHiten Pandya.Xr bus_dma 9 ,
753aac0aafaSHiten Pandya.Xr bus_release_resource 9 ,
754aac0aafaSHiten Pandya.Xr bus_setup_intr 9 ,
755aac0aafaSHiten Pandya.Xr bus_teardown_intr 9 ,
756aac0aafaSHiten Pandya.Xr devclass 9 ,
757aac0aafaSHiten Pandya.Xr device 9 ,
758aac0aafaSHiten Pandya.Xr driver 9 ,
759aac0aafaSHiten Pandya.Xr rman 9
760aac0aafaSHiten Pandya.Rs
761aac0aafaSHiten Pandya.%B FreeBSD Developers' Handbook
762aac0aafaSHiten Pandya.%T NewBus
763aa4a335bSRuslan Ermilov.%U http://www.FreeBSD.org/doc/en_US.ISO8859-1/books/developers-handbook/
764aac0aafaSHiten Pandya.Re
765aac0aafaSHiten Pandya.Rs
766aac0aafaSHiten Pandya.%A Shanley
767aac0aafaSHiten Pandya.%A Anderson
768aac0aafaSHiten Pandya.%B PCI System Architecture
769aac0aafaSHiten Pandya.%N 2nd Edition
770aac0aafaSHiten Pandya.%I Addison-Wesley
771aac0aafaSHiten Pandya.%O ISBN 0-201-30974-2
772aac0aafaSHiten Pandya.Re
773aac0aafaSHiten Pandya.Sh AUTHORS
7748a7314fcSBaptiste Daroussin.An -nosplit
775571dba6eSHiten PandyaThis manual page was written by
7768a7314fcSBaptiste Daroussin.An Bruce M Simpson Aq Mt bms@FreeBSD.org
777855ed4c5SJohn Baldwinand
7788a7314fcSBaptiste Daroussin.An John Baldwin Aq Mt jhb@FreeBSD.org .
779aac0aafaSHiten Pandya.Sh BUGS
7804d80f750SBruce M SimpsonThe kernel PCI code has a number of references to
7814d80f750SBruce M Simpson.Dq "slot numbers" .
782bf1639eeSBruce M SimpsonThese do not refer to the geographic location of PCI devices,
783bf1639eeSBruce M Simpsonbut to the device number assigned by the combination of the PCI IDSEL
784bf1639eeSBruce M Simpsonmechanism and the platform firmware.
785bf1639eeSBruce M SimpsonThis should be taken note of when working with the kernel PCI code.
786