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