| 1 |
.\" Copyright, Niki A. Rahimi <[email protected]> |
| 2 |
.\" Copyright, LTC Security Development |
| 3 |
.\" Copyright, the authors of the Linux man-pages project |
| 4 |
.\" |
| 5 |
.\" %%%LICENSE_START(FREELY_REDISTRIBUTABLE) |
| 6 |
.\" May be freely distributed and modified. |
| 7 |
.\" %%%LICENSE_END |
| 8 |
.\" |
| 9 |
.TH pciconfig_read 2 2026-02-08 "Linux man-pages 6.18" |
| 10 |
.SH NAME |
| 11 |
pciconfig_read, pciconfig_write, pciconfig_iobase \- |
| 12 |
pci device information handling |
| 13 |
.SH LIBRARY |
| 14 |
Standard C library |
| 15 |
.RI ( libc ,\~ \-lc ) |
| 16 |
.SH SYNOPSIS |
| 17 |
.nf |
| 18 |
.B #include <pci.h> |
| 19 |
.P |
| 20 |
.BI "int pciconfig_read(unsigned long " bus ", unsigned long " dfn , |
| 21 |
.BI " unsigned long " off ", unsigned long " size , |
| 22 |
.BI " unsigned char *" buf ); |
| 23 |
.BI "int pciconfig_write(unsigned long " bus ", unsigned long " dfn , |
| 24 |
.BI " unsigned long " off ", unsigned long " size , |
| 25 |
.BI " unsigned char *" buf ); |
| 26 |
.BI "int pciconfig_iobase(int " which ", unsigned long " bus , |
| 27 |
.BI " unsigned long " devfn ); |
| 28 |
.fi |
| 29 |
.SH DESCRIPTION |
| 30 |
Most of the interaction with PCI devices is already handled by the |
| 31 |
kernel PCI layer, |
| 32 |
and thus these calls should not normally need to be accessed from user space. |
| 33 |
.TP |
| 34 |
.BR pciconfig_read () |
| 35 |
Reads to |
| 36 |
.I buf |
| 37 |
from device |
| 38 |
.I dev |
| 39 |
at offset |
| 40 |
.I off |
| 41 |
value. |
| 42 |
.TP |
| 43 |
.BR pciconfig_write () |
| 44 |
Writes from |
| 45 |
.I buf |
| 46 |
to device |
| 47 |
.I dev |
| 48 |
at offset |
| 49 |
.I off |
| 50 |
value. |
| 51 |
.TP |
| 52 |
.BR pciconfig_iobase () |
| 53 |
You pass it a bus/devfn pair and get a physical address for either the |
| 54 |
memory offset (for things like prep, this is 0xc0000000), |
| 55 |
the IO base for PIO cycles, or the ISA holes if any. |
| 56 |
.SH RETURN VALUE |
| 57 |
.TP |
| 58 |
.BR pciconfig_read () |
| 59 |
On success, zero is returned. |
| 60 |
On error, \-1 is returned and |
| 61 |
.I errno |
| 62 |
is set to indicate the error. |
| 63 |
.TP |
| 64 |
.BR pciconfig_write () |
| 65 |
On success, zero is returned. |
| 66 |
On error, \-1 is returned and |
| 67 |
.I errno |
| 68 |
is set to indicate the error. |
| 69 |
.TP |
| 70 |
.BR pciconfig_iobase () |
| 71 |
Returns information on locations of various I/O |
| 72 |
regions in physical memory according to the |
| 73 |
.I which |
| 74 |
value. |
| 75 |
Values for |
| 76 |
.I which |
| 77 |
are: |
| 78 |
.BR IOBASE_BRIDGE_NUMBER , |
| 79 |
.BR IOBASE_MEMORY , |
| 80 |
.BR IOBASE_IO , |
| 81 |
.BR IOBASE_ISA_IO , |
| 82 |
.BR IOBASE_ISA_MEM . |
| 83 |
.SH ERRORS |
| 84 |
.TP |
| 85 |
.B EINVAL |
| 86 |
.I size |
| 87 |
value is invalid. |
| 88 |
This does not apply to |
| 89 |
.BR pciconfig_iobase (). |
| 90 |
.TP |
| 91 |
.B EIO |
| 92 |
I/O error. |
| 93 |
.TP |
| 94 |
.B ENODEV |
| 95 |
For |
| 96 |
.BR pciconfig_iobase (), |
| 97 |
"hose" value is NULL. |
| 98 |
For the other calls, could not find a slot. |
| 99 |
.TP |
| 100 |
.B ENOSYS |
| 101 |
The system has not implemented these calls |
| 102 |
.RB ( CONFIG_PCI |
| 103 |
not defined). |
| 104 |
.TP |
| 105 |
.B EOPNOTSUPP |
| 106 |
This return value is valid only for |
| 107 |
.BR pciconfig_iobase (). |
| 108 |
It is returned if the value for |
| 109 |
.I which |
| 110 |
is invalid. |
| 111 |
.TP |
| 112 |
.B EPERM |
| 113 |
User does not have the |
| 114 |
.B CAP_SYS_ADMIN |
| 115 |
capability. |
| 116 |
This does not apply to |
| 117 |
.BR pciconfig_iobase (). |
| 118 |
.SH STANDARDS |
| 119 |
Linux. |
| 120 |
.SH HISTORY |
| 121 |
Linux 2.0.26/2.1.11. |
| 122 |
.SH SEE ALSO |
| 123 |
.BR capabilities (7) |