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*7d971e36SRyan Stone.Dd May 24, 2014 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 , 49*7d971e36SRyan Stone.Nm pci_iov_attach , 50*7d971e36SRyan 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 100*7d971e36SRyan Stone.Fn pci_iov_attach "device_t dev" "nvlist_t *pf_schema" "nvlist_t *vf_schema" 101*7d971e36SRyan Stone.Ft int 102*7d971e36SRyan Stone.Fn pci_iov_detach "device_t dev" 103*7d971e36SRyan Stone.Ft int 104855ed4c5SJohn Baldwin.Fn pci_msi_count "device_t dev" 105855ed4c5SJohn Baldwin.Ft int 106855ed4c5SJohn Baldwin.Fn pci_msix_count "device_t dev" 107855ed4c5SJohn Baldwin.Ft int 108855ed4c5SJohn Baldwin.Fn pci_pending_msix "device_t dev" "u_int index" 1090a9c80e5SJohn Baldwin.Ft uint32_t 1100a9c80e5SJohn Baldwin.Fn pci_read_config "device_t dev" "int reg" "int width" 111855ed4c5SJohn Baldwin.Ft int 112855ed4c5SJohn Baldwin.Fn pci_release_msi "device_t dev" 113855ed4c5SJohn Baldwin.Ft int 114855ed4c5SJohn Baldwin.Fn pci_remap_msix "device_t dev" "int count" "const u_int *vectors" 1150a9c80e5SJohn Baldwin.Ft void 1160a9c80e5SJohn Baldwin.Fn pci_restore_state "device_t dev" 1170a9c80e5SJohn Baldwin.Ft void 1180a9c80e5SJohn Baldwin.Fn pci_save_state "device_t dev" 1190a9c80e5SJohn Baldwin.Ft int 120855ed4c5SJohn Baldwin.Fn pci_set_max_read_req "device_t dev" "int size" 121855ed4c5SJohn Baldwin.Ft int 1220a9c80e5SJohn Baldwin.Fn pci_set_powerstate "device_t dev" "int state" 1230a9c80e5SJohn Baldwin.Ft void 1240a9c80e5SJohn Baldwin.Fn pci_write_config "device_t dev" "int reg" "uint32_t val" "int width" 125aac0aafaSHiten Pandya.Sh DESCRIPTION 126aac0aafaSHiten PandyaThe 127aac0aafaSHiten Pandya.Nm 128aac0aafaSHiten Pandyaset of functions are used for managing PCI devices. 129855ed4c5SJohn BaldwinThe functions are split into several groups: 130855ed4c5SJohn Baldwinraw configuration access, 131855ed4c5SJohn Baldwinlocating devices, 132855ed4c5SJohn Baldwindevice information, 133855ed4c5SJohn Baldwindevice configuration, 134855ed4c5SJohn Baldwinand 135855ed4c5SJohn Baldwinmessage signaled interrupts. 136855ed4c5SJohn Baldwin.Ss Raw Configuration Access 137aac0aafaSHiten PandyaThe 138aac0aafaSHiten Pandya.Fn pci_read_config 139aac0aafaSHiten Pandyafunction is used to read data from the PCI configuration 140aac0aafaSHiten Pandyaspace of the device 141aac0aafaSHiten Pandya.Fa dev , 142aac0aafaSHiten Pandyaat offset 143aac0aafaSHiten Pandya.Fa reg , 144aac0aafaSHiten Pandyawith 145aac0aafaSHiten Pandya.Fa width 146aac0aafaSHiten Pandyaspecifying the size of the access. 147aac0aafaSHiten Pandya.Pp 148aac0aafaSHiten PandyaThe 149aac0aafaSHiten Pandya.Fn pci_write_config 150aac0aafaSHiten Pandyafunction is used to write the value 151aac0aafaSHiten Pandya.Fa val 152aac0aafaSHiten Pandyato the PCI configuration 153aac0aafaSHiten Pandyaspace of the device 154aac0aafaSHiten Pandya.Fa dev , 155aac0aafaSHiten Pandyaat offset 156aac0aafaSHiten Pandya.Fa reg , 157aac0aafaSHiten Pandyawith 158aac0aafaSHiten Pandya.Fa width 159aac0aafaSHiten Pandyaspecifying the size of the access. 160aac0aafaSHiten Pandya.Pp 161855ed4c5SJohn Baldwin.Em NOTE : 162855ed4c5SJohn BaldwinDevice drivers should only use these functions for functionality that 163855ed4c5SJohn Baldwinis not available via another 164855ed4c5SJohn Baldwin.Fn pci 165855ed4c5SJohn Baldwinfunction. 166855ed4c5SJohn Baldwin.Ss Locating Devices 167855ed4c5SJohn BaldwinThe 168855ed4c5SJohn Baldwin.Fn pci_find_bsf 169855ed4c5SJohn Baldwinfunction looks up the 170855ed4c5SJohn Baldwin.Vt device_t 171855ed4c5SJohn Baldwinof a PCI device, given its 172855ed4c5SJohn Baldwin.Fa bus , 173855ed4c5SJohn Baldwin.Fa slot , 174855ed4c5SJohn Baldwinand 175855ed4c5SJohn Baldwin.Fa func . 176855ed4c5SJohn BaldwinThe 177855ed4c5SJohn Baldwin.Fa slot 178855ed4c5SJohn Baldwinnumber actually refers to the number of the device on the bus, 179855ed4c5SJohn Baldwinwhich does not necessarily indicate its geographic location 180855ed4c5SJohn Baldwinin terms of a physical slot. 181855ed4c5SJohn BaldwinNote that in case the system has multiple PCI domains, 182855ed4c5SJohn Baldwinthe 183855ed4c5SJohn Baldwin.Fn pci_find_bsf 184855ed4c5SJohn Baldwinfunction only searches the first one. 185855ed4c5SJohn BaldwinActually, it is equivalent to: 186855ed4c5SJohn Baldwin.Bd -literal -offset indent 187855ed4c5SJohn Baldwinpci_find_dbsf(0, bus, slot, func); 188855ed4c5SJohn Baldwin.Ed 189855ed4c5SJohn Baldwin.Pp 190855ed4c5SJohn BaldwinThe 191855ed4c5SJohn Baldwin.Fn pci_find_dbsf 192855ed4c5SJohn Baldwinfunction looks up the 193855ed4c5SJohn Baldwin.Vt device_t 194855ed4c5SJohn Baldwinof a PCI device, given its 195855ed4c5SJohn Baldwin.Fa domain , 196855ed4c5SJohn Baldwin.Fa bus , 197855ed4c5SJohn Baldwin.Fa slot , 198855ed4c5SJohn Baldwinand 199855ed4c5SJohn Baldwin.Fa func . 200855ed4c5SJohn BaldwinThe 201855ed4c5SJohn Baldwin.Fa slot 202855ed4c5SJohn Baldwinnumber actually refers to the number of the device on the bus, 203855ed4c5SJohn Baldwinwhich does not necessarily indicate its geographic location 204855ed4c5SJohn Baldwinin terms of a physical slot. 205855ed4c5SJohn Baldwin.Pp 206855ed4c5SJohn BaldwinThe 207855ed4c5SJohn Baldwin.Fn pci_find_device 208855ed4c5SJohn Baldwinfunction looks up the 209855ed4c5SJohn Baldwin.Vt device_t 210855ed4c5SJohn Baldwinof a PCI device, given its 211855ed4c5SJohn Baldwin.Fa vendor 212855ed4c5SJohn Baldwinand 213855ed4c5SJohn Baldwin.Fa device 214855ed4c5SJohn BaldwinIDs. 215855ed4c5SJohn BaldwinNote that there can be multiple matches for this search; this function 216855ed4c5SJohn Baldwinonly returns the first matching device. 217855ed4c5SJohn Baldwin.Ss Device Information 218855ed4c5SJohn BaldwinThe 219855ed4c5SJohn Baldwin.Fn pci_find_cap 220855ed4c5SJohn Baldwinfunction is used to locate the first instance of a PCI capability 221855ed4c5SJohn Baldwinregister set for the device 222855ed4c5SJohn Baldwin.Fa dev . 223855ed4c5SJohn BaldwinThe capability to locate is specified by ID via 224855ed4c5SJohn Baldwin.Fa capability . 225855ed4c5SJohn BaldwinConstant macros of the form 226855ed4c5SJohn Baldwin.Dv PCIY_xxx 227855ed4c5SJohn Baldwinfor standard capability IDs are defined in 228855ed4c5SJohn Baldwin.In dev/pci/pcireg.h . 229855ed4c5SJohn BaldwinIf the capability is found, then 230855ed4c5SJohn Baldwin.Fa *capreg 231281a359eSJohn Baldwinis set to the offset in configuration space of the capability register set, 232855ed4c5SJohn Baldwinand 233855ed4c5SJohn Baldwin.Fn pci_find_cap 234855ed4c5SJohn Baldwinreturns zero. 235855ed4c5SJohn BaldwinIf the capability is not found or the device does not support capabilities, 236855ed4c5SJohn Baldwin.Fn pci_find_cap 237855ed4c5SJohn Baldwinreturns an error. 238855ed4c5SJohn Baldwin.Pp 239855ed4c5SJohn BaldwinThe 24068bf9717SJohn Baldwin.Fn pci_find_extcap 24168bf9717SJohn Baldwinfunction is used to locate the first instance of a PCI-express 24268bf9717SJohn Baldwinextended capability register set for the device 24368bf9717SJohn Baldwin.Fa dev . 24468bf9717SJohn BaldwinThe extended capability to locate is specified by ID via 24568bf9717SJohn Baldwin.Fa capability . 24668bf9717SJohn BaldwinConstant macros of the form 24768bf9717SJohn Baldwin.Dv PCIZ_xxx 24868bf9717SJohn Baldwinfor standard extended capability IDs are defined in 24968bf9717SJohn Baldwin.In dev/pci/pcireg.h . 25068bf9717SJohn BaldwinIf the extended capability is found, then 25168bf9717SJohn Baldwin.Fa *capreg 252281a359eSJohn Baldwinis set to the offset in configuration space of the extended capability 25368bf9717SJohn Baldwinregister set, and 25468bf9717SJohn Baldwin.Fn pci_find_extcap 25568bf9717SJohn Baldwinreturns zero. 25668bf9717SJohn BaldwinIf the extended capability is not found or the device is not a 25768bf9717SJohn BaldwinPCI-express device, 25868bf9717SJohn Baldwin.Fn pci_find_extcap 25968bf9717SJohn Baldwinreturns an error. 26068bf9717SJohn Baldwin.Pp 26168bf9717SJohn BaldwinThe 26268bf9717SJohn Baldwin.Fn pci_find_htcap 26368bf9717SJohn Baldwinfunction is used to locate the first instance of a HyperTransport capability 26468bf9717SJohn Baldwinregister set for the device 26568bf9717SJohn Baldwin.Fa dev . 26668bf9717SJohn BaldwinThe capability to locate is specified by type via 26768bf9717SJohn Baldwin.Fa capability . 26868bf9717SJohn BaldwinConstant macros of the form 26968bf9717SJohn Baldwin.Dv PCIM_HTCAP_xxx 27068bf9717SJohn Baldwinfor standard HyperTransport capability types are defined in 27168bf9717SJohn Baldwin.In dev/pci/pcireg.h . 27268bf9717SJohn BaldwinIf the capability is found, then 27368bf9717SJohn Baldwin.Fa *capreg 274281a359eSJohn Baldwinis set to the offset in configuration space of the capability register set, 27568bf9717SJohn Baldwinand 27668bf9717SJohn Baldwin.Fn pci_find_htcap 27768bf9717SJohn Baldwinreturns zero. 27868bf9717SJohn BaldwinIf the capability is not found or the device is not a HyperTransport device, 27968bf9717SJohn Baldwin.Fn pci_find_htcap 28068bf9717SJohn Baldwinreturns an error. 28168bf9717SJohn Baldwin.Pp 28268bf9717SJohn BaldwinThe 283855ed4c5SJohn Baldwin.Fn pci_get_vpd_ident 284855ed4c5SJohn Baldwinfunction is used to fetch a device's Vital Product Data 285855ed4c5SJohn Baldwin.Pq VPD 286855ed4c5SJohn Baldwinidentifier string. 287855ed4c5SJohn BaldwinIf the device 288855ed4c5SJohn Baldwin.Fa dev 289855ed4c5SJohn Baldwinsupports VPD and provides an identifier string, 290855ed4c5SJohn Baldwinthen 291855ed4c5SJohn Baldwin.Fa *identptr 292855ed4c5SJohn Baldwinis set to point at a read-only, null-terminated copy of the identifier 293855ed4c5SJohn Baldwinstring, 294855ed4c5SJohn Baldwinand 295855ed4c5SJohn Baldwin.Fn pci_get_vpd_ident 296855ed4c5SJohn Baldwinreturns zero. 297855ed4c5SJohn BaldwinIf the device does not support VPD or does not provide an identifier 298855ed4c5SJohn Baldwinstring, 299855ed4c5SJohn Baldwinthen 300855ed4c5SJohn Baldwin.Fn pci_get_vpd_ident 301855ed4c5SJohn Baldwinreturns an error. 302855ed4c5SJohn Baldwin.Pp 303855ed4c5SJohn BaldwinThe 304855ed4c5SJohn Baldwin.Fn pci_get_vpd_readonly 305855ed4c5SJohn Baldwinfunction is used to fetch the value of a single VPD read-only keyword 306855ed4c5SJohn Baldwinfor the device 307855ed4c5SJohn Baldwin.Fa dev . 308855ed4c5SJohn BaldwinThe keyword to fetch is identified by the two character string 309855ed4c5SJohn Baldwin.Fa kw . 310855ed4c5SJohn BaldwinIf the device supports VPD and provides a read-only value for the 311855ed4c5SJohn Baldwinrequested keyword, 312855ed4c5SJohn Baldwinthen 313855ed4c5SJohn Baldwin.Fa *vptr 314855ed4c5SJohn Baldwinis set to point at a read-only, null-terminated copy of the value, 315855ed4c5SJohn Baldwinand 316855ed4c5SJohn Baldwin.Fn pci_get_vpd_readonly 317855ed4c5SJohn Baldwinreturns zero. 318855ed4c5SJohn BaldwinIf the device does not support VPD or does not provide the requested 319855ed4c5SJohn Baldwinkeyword, 320855ed4c5SJohn Baldwinthen 321855ed4c5SJohn Baldwin.Fn pci_get_vpd_readonly 322855ed4c5SJohn Baldwinreturns an error. 323855ed4c5SJohn Baldwin.Ss Device Configuration 324aac0aafaSHiten PandyaThe 325aac0aafaSHiten Pandya.Fn pci_enable_busmaster 326aac0aafaSHiten Pandyafunction enables PCI bus mastering for the device 327aac0aafaSHiten Pandya.Fa dev , 328aac0aafaSHiten Pandyaby setting the 329aac0aafaSHiten Pandya.Dv PCIM_CMD_BUSMASTEREN 330aac0aafaSHiten Pandyabit in the 331aac0aafaSHiten Pandya.Dv PCIR_COMMAND 332aac0aafaSHiten Pandyaregister. 333aac0aafaSHiten PandyaThe 334aac0aafaSHiten Pandya.Fn pci_disable_busmaster 335aac0aafaSHiten Pandyafunction clears this bit. 336aac0aafaSHiten Pandya.Pp 337aac0aafaSHiten PandyaThe 338aac0aafaSHiten Pandya.Fn pci_enable_io 339aac0aafaSHiten Pandyafunction enables memory or I/O port address decoding for the device 340aac0aafaSHiten Pandya.Fa dev , 341aac0aafaSHiten Pandyaby setting the 342aac0aafaSHiten Pandya.Dv PCIM_CMD_MEMEN 343aac0aafaSHiten Pandyaor 344aac0aafaSHiten Pandya.Dv PCIM_CMD_PORTEN 345aac0aafaSHiten Pandyabit in the 346aac0aafaSHiten Pandya.Dv PCIR_COMMAND 3475203edcdSRuslan Ermilovregister appropriately. 3485203edcdSRuslan ErmilovThe 349aac0aafaSHiten Pandya.Fn pci_disable_io 350aac0aafaSHiten Pandyafunction clears the appropriate bit. 351aac0aafaSHiten PandyaThe 35265bb31b8SRuslan Ermilov.Fa space 353aac0aafaSHiten Pandyaargument specifies which resource is affected; this can be either 354aac0aafaSHiten Pandya.Dv SYS_RES_MEMORY 355aac0aafaSHiten Pandyaor 356aac0aafaSHiten Pandya.Dv SYS_RES_IOPORT 357aac0aafaSHiten Pandyaas appropriate. 358855ed4c5SJohn BaldwinDevice drivers should generally not use these routines directly. 359855ed4c5SJohn BaldwinThe PCI bus will enable decoding automatically when a 360855ed4c5SJohn Baldwin.Dv SYS_RES_MEMORY 361855ed4c5SJohn Baldwinor 362855ed4c5SJohn Baldwin.Dv SYS_RES_IOPORT 363855ed4c5SJohn Baldwinresource is activated via 364855ed4c5SJohn Baldwin.Xr bus_alloc_resource 9 365855ed4c5SJohn Baldwinor 366855ed4c5SJohn Baldwin.Xr bus_activate_resource 9 . 367aac0aafaSHiten Pandya.Pp 368855ed4c5SJohn BaldwinThe 369855ed4c5SJohn Baldwin.Fn pci_get_max_read_req 370855ed4c5SJohn Baldwinfunction returns the current maximum read request size in bytes for a 371855ed4c5SJohn BaldwinPCI-express device. 372855ed4c5SJohn BaldwinIf the 373855ed4c5SJohn Baldwin.Fa dev 374855ed4c5SJohn Baldwindevice is not a PCI-express device, 375855ed4c5SJohn Baldwin.Fn pci_get_max_read_req 376855ed4c5SJohn Baldwinreturns zero. 377855ed4c5SJohn Baldwin.Pp 378855ed4c5SJohn BaldwinThe 379855ed4c5SJohn Baldwin.Fn pci_set_max_read_req 380855ed4c5SJohn Baldwinsets the PCI-express maximum read request size for 381855ed4c5SJohn Baldwin.Fa dev . 382855ed4c5SJohn BaldwinThe requested 383855ed4c5SJohn Baldwin.Fa size 384855ed4c5SJohn Baldwinmay be adjusted, 385855ed4c5SJohn Baldwinand 386855ed4c5SJohn Baldwin.Fn pci_set_max_read_req 387855ed4c5SJohn Baldwinreturns the actual size set in bytes. 388855ed4c5SJohn BaldwinIf the 389855ed4c5SJohn Baldwin.Fa dev 390855ed4c5SJohn Baldwindevice is not a PCI-express device, 391855ed4c5SJohn Baldwin.Fn pci_set_max_read_req 392855ed4c5SJohn Baldwinreturns zero. 393aac0aafaSHiten Pandya.Pp 394aac0aafaSHiten PandyaThe 395aac0aafaSHiten Pandya.Fn pci_get_powerstate 396adb63907SJohn Baldwinfunction returns the current power state of the device 397aac0aafaSHiten Pandya.Fa dev . 398aac0aafaSHiten PandyaIf the device does not support power management capabilities, then the default 399aac0aafaSHiten Pandyastate of 400aac0aafaSHiten Pandya.Dv PCI_POWERSTATE_D0 401aac0aafaSHiten Pandyais returned. 402adb63907SJohn BaldwinThe following power states are defined by PCI: 40365bb31b8SRuslan Ermilov.Bl -hang -width ".Dv PCI_POWERSTATE_UNKNOWN" 404aac0aafaSHiten Pandya.It Dv PCI_POWERSTATE_D0 405aac0aafaSHiten PandyaState in which device is on and running. 406aac0aafaSHiten PandyaIt is receiving full power from the system and delivering 407aac0aafaSHiten Pandyafull functionality to the user. 408aac0aafaSHiten Pandya.It Dv PCI_POWERSTATE_D1 409aac0aafaSHiten PandyaClass-specific low-power state in which device context may or 4105a2e3b61SDaniel Gerzomay not be lost. 41165bb31b8SRuslan ErmilovBusses in this state cannot do anything to the bus, to 4129817b894SBruce M Simpsonforce devices to lose context. 413aac0aafaSHiten Pandya.It Dv PCI_POWERSTATE_D2 414aac0aafaSHiten PandyaClass-specific low-power state in which device context may or 415aac0aafaSHiten Pandyamay not be lost. 416aac0aafaSHiten PandyaAttains greater power savings than 417aac0aafaSHiten Pandya.Dv PCI_POWERSTATE_D1 . 41865bb31b8SRuslan ErmilovBusses in this state can cause devices to lose some context. 419aac0aafaSHiten PandyaDevices 420aac0aafaSHiten Pandya.Em must 421aac0aafaSHiten Pandyabe prepared for the bus to be in this state or higher. 422aac0aafaSHiten Pandya.It Dv PCI_POWERSTATE_D3 423aac0aafaSHiten PandyaState in which the device is off and not running. 424aac0aafaSHiten PandyaDevice context is lost, and power from the device can 425aac0aafaSHiten Pandyabe removed. 426aac0aafaSHiten Pandya.It Dv PCI_POWERSTATE_UNKNOWN 427aac0aafaSHiten PandyaState of the device is unknown. 428aac0aafaSHiten Pandya.El 429aac0aafaSHiten Pandya.Pp 430aac0aafaSHiten PandyaThe 431aac0aafaSHiten Pandya.Fn pci_set_powerstate 432aac0aafaSHiten Pandyafunction is used to transition the device 433aac0aafaSHiten Pandya.Fa dev 434adb63907SJohn Baldwinto the PCI power state 435aac0aafaSHiten Pandya.Fa state . 436adb63907SJohn BaldwinIf the device does not support power management capabilities or 437adb63907SJohn Baldwinit does not support the specific power state 438adb63907SJohn Baldwin.Fa state , 439adb63907SJohn Baldwinthen the function will fail with 440adb63907SJohn Baldwin.Er EOPNOTSUPP . 441aac0aafaSHiten Pandya.Pp 442aac0aafaSHiten PandyaThe 443*7d971e36SRyan Stone.Fn pci_iov_attach 444*7d971e36SRyan Stonefunction is used to advertise that the given device 445*7d971e36SRyan Stone.Pq and associated device driver 446*7d971e36SRyan Stonesupports PCI Single-Root I/O Virtualization 447*7d971e36SRyan Stone.Po SR-IOV Pc . 448*7d971e36SRyan StoneA driver that supports SR-IOV must implement the 449*7d971e36SRyan Stone.Xr PCI_INIT_IOV 9 , 450*7d971e36SRyan Stone.Xr PCI_ADD_VF 9 451*7d971e36SRyan Stoneand 452*7d971e36SRyan Stone.Xr PCI_UNIT_IOV 9 453*7d971e36SRyan Stonemethods. 454*7d971e36SRyan StoneThis function should be called during the 455*7d971e36SRyan Stone.Xr DEVICE_ATTACH 9 456*7d971e36SRyan Stonemethod. 457*7d971e36SRyan StoneIf this function returns an error, it is recommended that the device driver 458*7d971e36SRyan Stonestill successfully attaches, but runs with SR-IOV disabled. 459*7d971e36SRyan StoneThe 460*7d971e36SRyan Stone.Fa pf_schema 461*7d971e36SRyan Stoneand 462*7d971e36SRyan Stone.Fa vf_schema 463*7d971e36SRyan Stoneparameters are used to define what device-specific configuration parameters the 464*7d971e36SRyan Stonedevice driver accepts when SR-IOV is enabled for the Physical Function 465*7d971e36SRyan Stone.Pq PF 466*7d971e36SRyan Stoneand for individual Virtual Functions 467*7d971e36SRyan Stone.Pq VFs 468*7d971e36SRyan Stonerespectively. 469*7d971e36SRyan StoneSee 470*7d971e36SRyan Stone.Xr pci_iov_schema 9 471*7d971e36SRyan Stonefor details on how to construct the schema. 472*7d971e36SRyan StoneIf either the 473*7d971e36SRyan Stone.Pa pf_schema 474*7d971e36SRyan Stoneor 475*7d971e36SRyan Stone.Pa vf_schema 476*7d971e36SRyan Stoneis invalid or specifies parameter names that conflict with parameter names that 477*7d971e36SRyan Stoneare already in use, 478*7d971e36SRyan Stone.Fn pci_iov_attach 479*7d971e36SRyan Stonewill return an error and SR-IOV will not be available on the PF device. 480*7d971e36SRyan StoneIf a driver does not accept configuration parameters for either the PF device 481*7d971e36SRyan Stoneor the VF devices, the driver must pass an empty schema for that device. 482*7d971e36SRyan StoneThe SR-IOV infrastructure takes ownership of the 483*7d971e36SRyan Stone.Fa pf_schema 484*7d971e36SRyan Stoneand 485*7d971e36SRyan Stone.Fa vf_schema 486*7d971e36SRyan Stoneand is responsible for freeing them. 487*7d971e36SRyan StoneThe driver must never free the schemas itself. 488*7d971e36SRyan Stone.Pp 489*7d971e36SRyan StoneThe 490*7d971e36SRyan Stone.Fn pci_iov_detach 491*7d971e36SRyan Stonefunction is used to advise the SR-IOV infrastructure that the driver for the 492*7d971e36SRyan Stonegiven device is attempting to detach and that all SR-IOV resources for the 493*7d971e36SRyan Stonedevice must be released. 494*7d971e36SRyan StoneThis function must be called during the 495*7d971e36SRyan Stone.Xr DEVICE_DETACH 9 496*7d971e36SRyan Stonemethod if 497*7d971e36SRyan Stone.Fn pci_iov_attach 498*7d971e36SRyan Stonewas successfully called on the device and 499*7d971e36SRyan Stone.Fn pci_iov_detach 500*7d971e36SRyan Stonehas not subsequently been called on the device and returned no error. 501*7d971e36SRyan StoneIf this function returns an error, the 502*7d971e36SRyan Stone.Xr DEVICE_DETACH 9 503*7d971e36SRyan Stonemethod must fail and return an error, as detaching the PF driver while VF 504*7d971e36SRyan Stonedevices are active would cause system instability. 505*7d971e36SRyan StoneThis function is safe to call and will always succeed if 506*7d971e36SRyan Stone.Fn pci_iov_attach 507*7d971e36SRyan Stonepreviously failed with an error on the given device, or if 508*7d971e36SRyan Stone.Fn pci_iov_attach 509*7d971e36SRyan Stonewas never called on the device. 510*7d971e36SRyan Stone.Pp 511*7d971e36SRyan StoneThe 5129415d1e0SJohn Baldwin.Fn pci_save_state 5139415d1e0SJohn Baldwinand 5149415d1e0SJohn Baldwin.Fn pci_restore_state 5159415d1e0SJohn Baldwinfunctions can be used by a device driver to save and restore standard PCI 5169415d1e0SJohn Baldwinconfig registers. 5179415d1e0SJohn BaldwinThe 5189415d1e0SJohn Baldwin.Fn pci_save_state 5199415d1e0SJohn Baldwinfunction must be invoked while the device has valid state before 5209415d1e0SJohn Baldwin.Fn pci_restore_state 5219415d1e0SJohn Baldwincan be used. 5229415d1e0SJohn BaldwinIf the device is not in the fully-powered state 5239415d1e0SJohn Baldwin.Pq Dv PCI_POWERSTATE_D0 5249415d1e0SJohn Baldwinwhen 5259415d1e0SJohn Baldwin.Fn pci_restore_state 5269415d1e0SJohn Baldwinis invoked, 5279415d1e0SJohn Baldwinthen the device will be transitioned to 5289415d1e0SJohn Baldwin.Dv PCI_POWERSTATE_D0 5299415d1e0SJohn Baldwinbefore any config registers are restored. 530855ed4c5SJohn Baldwin.Ss Message Signaled Interrupts 531855ed4c5SJohn BaldwinMessage Signaled Interrupts 532855ed4c5SJohn Baldwin.Pq MSI 533855ed4c5SJohn Baldwinand 534855ed4c5SJohn BaldwinEnhanced Message Signaled Interrupts 535855ed4c5SJohn Baldwin.Pq MSI-X 536855ed4c5SJohn Baldwinare PCI capabilities that provide an alternate method for PCI 537855ed4c5SJohn Baldwindevices to signal interrupts. 538855ed4c5SJohn BaldwinThe legacy INTx interrupt is available to PCI devices as a 539855ed4c5SJohn Baldwin.Dv SYS_RES_IRQ 540855ed4c5SJohn Baldwinresource with a resource ID of zero. 541855ed4c5SJohn BaldwinMSI and MSI-X interrupts are available to PCI devices as one or more 542855ed4c5SJohn Baldwin.Dv SYS_RES_IRQ 543855ed4c5SJohn Baldwinresources with resource IDs greater than zero. 544855ed4c5SJohn BaldwinA driver must ask the PCI bus to allocate MSI or MSI-X interrupts 545855ed4c5SJohn Baldwinusing 546855ed4c5SJohn Baldwin.Fn pci_alloc_msi 547855ed4c5SJohn Baldwinor 548855ed4c5SJohn Baldwin.Fn pci_alloc_msix 549855ed4c5SJohn Baldwinbefore it can use MSI or MSI-X 550855ed4c5SJohn Baldwin.Dv SYS_RES_IRQ 551855ed4c5SJohn Baldwinresources. 552855ed4c5SJohn BaldwinA driver is not allowed to use the legacy INTx 553855ed4c5SJohn Baldwin.Dv SYS_RES_IRQ 554855ed4c5SJohn Baldwinresource if MSI or MSI-X interrupts have been allocated, 555855ed4c5SJohn Baldwinand attempts to allocate MSI or MSI-X interrupts will fail if the 556855ed4c5SJohn Baldwindriver is currently using the legacy INTx 557855ed4c5SJohn Baldwin.Dv SYS_RES_IRQ 558855ed4c5SJohn Baldwinresource. 559855ed4c5SJohn BaldwinA driver is only allowed to use either MSI or MSI-X, 560855ed4c5SJohn Baldwinbut not both. 5619415d1e0SJohn Baldwin.Pp 5629415d1e0SJohn BaldwinThe 563563d4639SMark Johnston.Fn pci_msi_count 564855ed4c5SJohn Baldwinfunction returns the maximum number of MSI messages supported by the 565855ed4c5SJohn Baldwindevice 566855ed4c5SJohn Baldwin.Fa dev . 567855ed4c5SJohn BaldwinIf the device does not support MSI, 568855ed4c5SJohn Baldwinthen 569563d4639SMark Johnston.Fn pci_msi_count 570855ed4c5SJohn Baldwinreturns zero. 57155aaf894SMarius Strobl.Pp 57255aaf894SMarius StroblThe 573855ed4c5SJohn Baldwin.Fn pci_alloc_msi 574855ed4c5SJohn Baldwinfunction attempts to allocate 575855ed4c5SJohn Baldwin.Fa *count 576855ed4c5SJohn BaldwinMSI messages for the device 577855ed4c5SJohn Baldwin.Fa dev . 57855aaf894SMarius StroblThe 579855ed4c5SJohn Baldwin.Fn pci_alloc_msi 580855ed4c5SJohn Baldwinfunction may allocate fewer messages than requested for various 581855ed4c5SJohn Baldwinreasons including requests for more messages than the device 582855ed4c5SJohn Baldwin.Fa dev 583855ed4c5SJohn Baldwinsupports, 584855ed4c5SJohn Baldwinor if the system has a shortage of available MSI messages. 585855ed4c5SJohn BaldwinOn success, 586855ed4c5SJohn Baldwin.Fa *count 587855ed4c5SJohn Baldwinis set to the number of messages allocated and 588855ed4c5SJohn Baldwin.Fn pci_alloc_msi 589855ed4c5SJohn Baldwinreturns zero. 590855ed4c5SJohn BaldwinThe 591855ed4c5SJohn Baldwin.Dv SYS_RES_IRQ 592855ed4c5SJohn Baldwinresources for the allocated messages will be available at consecutive 593855ed4c5SJohn Baldwinresource IDs beginning with one. 594855ed4c5SJohn BaldwinIf 595855ed4c5SJohn Baldwin.Fn pci_alloc_msi 596855ed4c5SJohn Baldwinis not able to allocate any messages, 597855ed4c5SJohn Baldwinit returns an error. 598855ed4c5SJohn BaldwinNote that MSI only supports message counts that are powers of two; 599855ed4c5SJohn Baldwinrequests to allocate a non-power of two count of messages will fail. 600aac0aafaSHiten Pandya.Pp 601aac0aafaSHiten PandyaThe 602855ed4c5SJohn Baldwin.Fn pci_release_msi 603855ed4c5SJohn Baldwinfunction is used to release any allocated MSI or MSI-X messages back 604855ed4c5SJohn Baldwinto the system. 605855ed4c5SJohn BaldwinIf any MSI or MSI-X 606855ed4c5SJohn Baldwin.Dv SYS_RES_IRQ 607855ed4c5SJohn Baldwinresources are allocated by the driver or have a configured interrupt 608855ed4c5SJohn Baldwinhandler, 609855ed4c5SJohn Baldwinthis function will fail with 610855ed4c5SJohn Baldwin.Er EBUSY . 611855ed4c5SJohn BaldwinThe 612855ed4c5SJohn Baldwin.Fn pci_release_msi 613855ed4c5SJohn Baldwinfunction returns zero on success and an error on failure. 614855ed4c5SJohn Baldwin.Pp 615642c4993SSergey KandaurovThe 616563d4639SMark Johnston.Fn pci_msix_count 617855ed4c5SJohn Baldwinfunction returns the maximum number of MSI-X messages supported by the 618855ed4c5SJohn Baldwindevice 619855ed4c5SJohn Baldwin.Fa dev . 620855ed4c5SJohn BaldwinIf the device does not support MSI-X, 621855ed4c5SJohn Baldwinthen 622563d4639SMark Johnston.Fn pci_msix_count 623855ed4c5SJohn Baldwinreturns zero. 624855ed4c5SJohn Baldwin.Pp 625855ed4c5SJohn BaldwinThe 626855ed4c5SJohn Baldwin.Fn pci_alloc_msix 627855ed4c5SJohn Baldwinfunction attempts to allocate 628855ed4c5SJohn Baldwin.Fa *count 629855ed4c5SJohn BaldwinMSI-X messages for the device 630855ed4c5SJohn Baldwin.Fa dev . 631855ed4c5SJohn BaldwinThe 632855ed4c5SJohn Baldwin.Fn pci_alloc_msix 633855ed4c5SJohn Baldwinfunction may allocate fewer messages than requested for various 634855ed4c5SJohn Baldwinreasons including requests for more messages than the device 635855ed4c5SJohn Baldwin.Fa dev 636855ed4c5SJohn Baldwinsupports, 637855ed4c5SJohn Baldwinor if the system has a shortage of available MSI-X messages. 638855ed4c5SJohn BaldwinOn success, 639855ed4c5SJohn Baldwin.Fa *count 640855ed4c5SJohn Baldwinis set to the number of messages allocated and 641855ed4c5SJohn Baldwin.Fn pci_alloc_msix 642855ed4c5SJohn Baldwinreturns zero. 643855ed4c5SJohn BaldwinFor MSI-X messages, 644855ed4c5SJohn Baldwinthe resource ID for each 64573bbeaa5SGlen Barber.Dv SYS_RES_IRQ 64673bbeaa5SGlen Barberresource identifies the index in the MSI-X table of the 647855ed4c5SJohn Baldwincorresponding message. 648855ed4c5SJohn BaldwinA resource ID of one maps to the first index of the MSI-X table; 649855ed4c5SJohn Baldwina resource ID two identifies the second index in the table, etc. 650855ed4c5SJohn BaldwinThe 651855ed4c5SJohn Baldwin.Fn pci_alloc_msix 652855ed4c5SJohn Baldwinfunction assigns the 653855ed4c5SJohn Baldwin.Fa *count 654855ed4c5SJohn Baldwinmessages allocated to the first 655855ed4c5SJohn Baldwin.Fa *count 656855ed4c5SJohn Baldwintable indicies. 657855ed4c5SJohn BaldwinIf 658855ed4c5SJohn Baldwin.Fn pci_alloc_msix 659855ed4c5SJohn Baldwinis not able to allocate any messages, 660855ed4c5SJohn Baldwinit returns an error. 661855ed4c5SJohn BaldwinUnlike MSI, 662855ed4c5SJohn BaldwinMSI-X does not require message counts that are powers of two. 663855ed4c5SJohn Baldwin.Pp 664855ed4c5SJohn BaldwinThe 665855ed4c5SJohn Baldwin.Fn pci_pending_msix 666855ed4c5SJohn Baldwinfunction examines the 667855ed4c5SJohn Baldwin.Fa dev 668855ed4c5SJohn Baldwindevice's Pending Bit Array 669855ed4c5SJohn Baldwin.Pq PBA 670855ed4c5SJohn Baldwinto determine the pending status of the MSI-X message at table index 671855ed4c5SJohn Baldwin.Fa index . 672855ed4c5SJohn BaldwinIf the indicated message is pending, 673855ed4c5SJohn Baldwinthis function returns a non-zero value; 674855ed4c5SJohn Baldwinotherwise, 675855ed4c5SJohn Baldwinit returns zero. 676855ed4c5SJohn BaldwinPassing an invalid 677855ed4c5SJohn Baldwin.Fa index 678855ed4c5SJohn Baldwinto this function will result in undefined behavior. 679855ed4c5SJohn Baldwin.Pp 680855ed4c5SJohn BaldwinAs mentioned in the description of 681855ed4c5SJohn Baldwin.Fn pci_alloc_msix , 682855ed4c5SJohn BaldwinMSI-X messages are initially assigned to the first N table entries. 683855ed4c5SJohn BaldwinA driver may use a different distribution of available messages to 684855ed4c5SJohn Baldwintable entries via the 685855ed4c5SJohn Baldwin.Fn pci_remap_msix 686855ed4c5SJohn Baldwinfunction. 68773bbeaa5SGlen BarberNote that this function must be called after a successful call to 688855ed4c5SJohn Baldwin.Fn pci_alloc_msix 689855ed4c5SJohn Baldwinbut before any of the 690855ed4c5SJohn Baldwin.Dv SYS_RES_IRQ 691855ed4c5SJohn Baldwinresources are allocated. 692855ed4c5SJohn BaldwinThe 693855ed4c5SJohn Baldwin.Fn pci_remap_msix 694855ed4c5SJohn Baldwinfunction returns zero on success, 695855ed4c5SJohn Baldwinor an error on failure. 696855ed4c5SJohn Baldwin.Pp 697855ed4c5SJohn BaldwinThe 698855ed4c5SJohn Baldwin.Fa vectors 699855ed4c5SJohn Baldwinarray should contain 700855ed4c5SJohn Baldwin.Fa count 701855ed4c5SJohn Baldwinmessage vectors. 702855ed4c5SJohn BaldwinThe array maps directly to the MSI-X table in that the first entry in 703855ed4c5SJohn Baldwinthe array specifies the message used for the first entry in the MSI-X 704855ed4c5SJohn Baldwintable, 705855ed4c5SJohn Baldwinthe second entry in the array corresponds to the second entry in the 706855ed4c5SJohn BaldwinMSI-X table, 707855ed4c5SJohn Baldwinetc. 708855ed4c5SJohn BaldwinThe vector value in each array index can either be zero to indicate 709855ed4c5SJohn Baldwinthat no message should be assigned to the corresponding MSI-X table entry, 710855ed4c5SJohn Baldwinor it can be a number from one to N 711855ed4c5SJohn Baldwin.Po 712855ed4c5SJohn Baldwinwhere N is the count returned from the previous call to 713855ed4c5SJohn Baldwin.Fn pci_alloc_msix 714855ed4c5SJohn Baldwin.Pc 715855ed4c5SJohn Baldwinto indicate which of the allocated messages should be assigned to the 716855ed4c5SJohn Baldwincorresponding MSI-X table entry. 717855ed4c5SJohn Baldwin.Pp 718855ed4c5SJohn BaldwinIf 719855ed4c5SJohn Baldwin.Fn pci_remap_msix 720855ed4c5SJohn Baldwinsucceeds, 721855ed4c5SJohn Baldwineach MSI-X table entry with a non-zero vector will have an associated 722855ed4c5SJohn Baldwin.Dv SYS_RES_IRQ 723855ed4c5SJohn Baldwinresource whose resource ID corresponds to the table index as described 724855ed4c5SJohn Baldwinabove for 725855ed4c5SJohn Baldwin.Fn pci_alloc_msix . 726855ed4c5SJohn BaldwinMSI-X table entries that with a vector of zero will not have an 727855ed4c5SJohn Baldwinassociated 72873bbeaa5SGlen Barber.Dv SYS_RES_IRQ 72973bbeaa5SGlen Barberresource. 730855ed4c5SJohn BaldwinAdditionally, 731855ed4c5SJohn Baldwinif any of the original messages allocated by 732855ed4c5SJohn Baldwin.Fn pci_alloc_msix 733855ed4c5SJohn Baldwinare not used in the new distribution of messages in the MSI-X table, 734855ed4c5SJohn Baldwinthey will be released automatically. 735855ed4c5SJohn BaldwinNote that if a driver wishes to use fewer messages than were allocated by 736855ed4c5SJohn Baldwin.Fn pci_alloc_msix , 737855ed4c5SJohn Baldwinthe driver must use a single, contiguous range of messages beginning 738855ed4c5SJohn Baldwinwith one in the new distribution. 739855ed4c5SJohn BaldwinThe 740855ed4c5SJohn Baldwin.Fn pci_remap_msix 741855ed4c5SJohn Baldwinfunction will fail if this condition is not met. 742aac0aafaSHiten Pandya.Sh IMPLEMENTATION NOTES 743aac0aafaSHiten PandyaThe 744aac0aafaSHiten Pandya.Vt pci_addr_t 74565bb31b8SRuslan Ermilovtype varies according to the size of the PCI bus address 746aac0aafaSHiten Pandyaspace on the target architecture. 747aac0aafaSHiten Pandya.Sh SEE ALSO 7487c2c06f2SSheldon Hearn.Xr pci 4 , 7497c2c06f2SSheldon Hearn.Xr pciconf 8 , 750aac0aafaSHiten Pandya.Xr bus_alloc_resource 9 , 751aac0aafaSHiten Pandya.Xr bus_dma 9 , 752aac0aafaSHiten Pandya.Xr bus_release_resource 9 , 753aac0aafaSHiten Pandya.Xr bus_setup_intr 9 , 754aac0aafaSHiten Pandya.Xr bus_teardown_intr 9 , 755aac0aafaSHiten Pandya.Xr devclass 9 , 756aac0aafaSHiten Pandya.Xr device 9 , 757aac0aafaSHiten Pandya.Xr driver 9 , 758aac0aafaSHiten Pandya.Xr rman 9 759aac0aafaSHiten Pandya.Rs 760aac0aafaSHiten Pandya.%B FreeBSD Developers' Handbook 761aac0aafaSHiten Pandya.%T NewBus 762aa4a335bSRuslan Ermilov.%U http://www.FreeBSD.org/doc/en_US.ISO8859-1/books/developers-handbook/ 763aac0aafaSHiten Pandya.Re 764aac0aafaSHiten Pandya.Rs 765aac0aafaSHiten Pandya.%A Shanley 766aac0aafaSHiten Pandya.%A Anderson 767aac0aafaSHiten Pandya.%B PCI System Architecture 768aac0aafaSHiten Pandya.%N 2nd Edition 769aac0aafaSHiten Pandya.%I Addison-Wesley 770aac0aafaSHiten Pandya.%O ISBN 0-201-30974-2 771aac0aafaSHiten Pandya.Re 772aac0aafaSHiten Pandya.Sh AUTHORS 7738a7314fcSBaptiste Daroussin.An -nosplit 774571dba6eSHiten PandyaThis manual page was written by 7758a7314fcSBaptiste Daroussin.An Bruce M Simpson Aq Mt bms@FreeBSD.org 776855ed4c5SJohn Baldwinand 7778a7314fcSBaptiste Daroussin.An John Baldwin Aq Mt jhb@FreeBSD.org . 778aac0aafaSHiten Pandya.Sh BUGS 7794d80f750SBruce M SimpsonThe kernel PCI code has a number of references to 7804d80f750SBruce M Simpson.Dq "slot numbers" . 781bf1639eeSBruce M SimpsonThese do not refer to the geographic location of PCI devices, 782bf1639eeSBruce M Simpsonbut to the device number assigned by the combination of the PCI IDSEL 783bf1639eeSBruce M Simpsonmechanism and the platform firmware. 784bf1639eeSBruce M SimpsonThis should be taken note of when working with the kernel PCI code. 785