]>
Commit | Line | Data |
---|---|---|
fea681da MK |
1 | .\" Contributed by Niki A. Rahimi, LTC Security Development |
2 | .\" narahimi@us.ibm.com | |
2297bf0e | 3 | .\" |
2e46a6e7 | 4 | .\" %%%LICENSE_START(FREELY_REDISTRIBUTABLE) |
00538c67 | 5 | .\" May be freely distributed and modified. |
8ff7380d | 6 | .\" %%%LICENSE_END |
fea681da | 7 | .\" |
3df541c0 | 8 | .TH PCICONFIG_READ 2 2016-07-17 "Linux" "Linux Programmer's Manual" |
fea681da MK |
9 | .SH NAME |
10 | pciconfig_read, pciconfig_write, pciconfig_iobase \- pci device information handling | |
11 | .SH SYNOPSIS | |
12 | .nf | |
13 | .B #include <pci.h> | |
14 | .sp | |
c13182ef | 15 | .BI "int pciconfig_read(unsigned long " bus ", unsigned long " dfn , |
62218dc0 | 16 | .BI " unsigned long " off ", unsigned long " len ", void *" buf ); |
c13182ef | 17 | .BI "int pciconfig_write(unsigned long " bus ", unsigned long " dfn , |
62218dc0 | 18 | .BI " unsigned long " off ", unsigned long " len ", void *" buf ); |
fea681da | 19 | .BI "int pciconfig_iobase(long " which ", unsigned long " bus , |
62218dc0 | 20 | .BI " unsigned long " devfn ); |
fea681da MK |
21 | .fi |
22 | .SH DESCRIPTION | |
88210f5f | 23 | .PP |
c13182ef MK |
24 | Most of the interaction with PCI devices is already handled by the |
25 | kernel PCI layer, | |
7fac88a9 | 26 | and thus these calls should not normally need to be accessed from user space. |
fea681da | 27 | .TP |
e511ffb6 | 28 | .BR pciconfig_read () |
fea681da | 29 | Reads to |
2fadbfb5 | 30 | .I buf |
fea681da | 31 | from device |
2fadbfb5 | 32 | .I dev |
c13182ef | 33 | at offset |
2fadbfb5 | 34 | .I off |
fea681da MK |
35 | value. |
36 | .TP | |
e511ffb6 | 37 | .BR pciconfig_write () |
fea681da | 38 | Writes from |
2fadbfb5 | 39 | .I buf |
fea681da | 40 | to device |
2fadbfb5 | 41 | .I dev |
c13182ef | 42 | at offset |
2fadbfb5 | 43 | .I off |
fea681da MK |
44 | value. |
45 | .TP | |
e511ffb6 | 46 | .BR pciconfig_iobase () |
c13182ef MK |
47 | You pass it a bus/devfn pair and get a physical address for either the |
48 | memory offset (for things like prep, this is 0xc0000000), | |
49 | the IO base for PIO cycles, or the ISA holes if any. | |
47297adb | 50 | .SH RETURN VALUE |
fea681da | 51 | .TP |
e511ffb6 | 52 | .BR pciconfig_read () |
cd6e402b | 53 | On success, zero is returned. |
09b235db | 54 | On error, \-1 is returned and |
6beb1671 | 55 | .I errno |
09b235db | 56 | is set appropriately. |
fea681da | 57 | .TP |
e511ffb6 | 58 | .BR pciconfig_write () |
cd6e402b | 59 | On success, zero is returned. |
09b235db MK |
60 | On error, \-1 is returned and |
61 | .I errno | |
62 | is set appropriately. | |
fea681da | 63 | .TP |
e511ffb6 | 64 | .BR pciconfig_iobase () |
988db661 | 65 | Returns information on locations of various I/O |
099c2a59 | 66 | regions in physical memory according to the |
c13182ef MK |
67 | .I which |
68 | value. | |
69 | Values for | |
fea681da | 70 | .I which |
682edefb MK |
71 | are: |
72 | .BR IOBASE_BRIDGE_NUMBER , | |
73 | .BR IOBASE_MEMORY , | |
74 | .BR IOBASE_IO , | |
75 | .BR IOBASE_ISA_IO , | |
76 | .BR IOBASE_ISA_MEM . | |
fea681da MK |
77 | .SH ERRORS |
78 | .TP | |
79 | .B EINVAL | |
80 | .I len | |
c13182ef | 81 | value is invalid. |
5d693709 MK |
82 | This does not apply to |
83 | .BR pciconfig_iobase (). | |
fea681da MK |
84 | .TP |
85 | .B EIO | |
86 | I/O error. | |
87 | .TP | |
88 | .B ENODEV | |
5d693709 MK |
89 | For |
90 | .BR pciconfig_iobase (), | |
16d2122c | 91 | "hose" value is NULL. |
5d693709 | 92 | For the other calls, could not find a slot. |
fea681da MK |
93 | .TP |
94 | .B ENOSYS | |
682edefb MK |
95 | The system has not implemented these calls |
96 | .RB ( CONFIG_PCI | |
97 | not defined). | |
fea681da MK |
98 | .TP |
99 | .B EOPNOTSUPP | |
33a0ccb2 | 100 | This return value is valid only for |
5d693709 | 101 | .BR pciconfig_iobase (). |
5d693709 | 102 | It is returned if the value for |
2fadbfb5 | 103 | .I which |
fea681da MK |
104 | is invalid. |
105 | .TP | |
106 | .B EPERM | |
c6fa0841 MK |
107 | User does not have the |
108 | .B CAP_SYS_ADMIN | |
109 | capability. | |
c13182ef | 110 | This does not apply to |
5d693709 | 111 | .BR pciconfig_iobase (). |
47297adb | 112 | .SH CONFORMING TO |
8382f16d | 113 | These calls are Linux-specific, available since Linux 2.0.26/2.1.11. |
47297adb | 114 | .SH SEE ALSO |
fea681da | 115 | .BR capabilities (7) |