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