OSDN Git Service

LDP: Update original to LDP v3.79
[linuxjm/LDP_man-pages.git] / original / man2 / pciconfig_read.2
1 .\" Contributed by Niki A. Rahimi, LTC Security Development
2 .\" narahimi@us.ibm.com
3 .\"
4 .\" %%%LICENSE_START(FREELY_REDISTRIBUTABLE)
5 .\" May be freely distributed.
6 .\" %%%LICENSE_END
7 .\"
8 .TH PCICONFIG_READ 2 2003-07-14 "Linux" "Linux Programmer's Manual"
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
15 .BI "int pciconfig_read(unsigned long " bus ", unsigned long " dfn ,
16 .BI "          unsigned long " off ", unsigned long " len ", void *" buf );
17 .BI "int pciconfig_write(unsigned long " bus ", unsigned long " dfn ,
18 .BI "          unsigned long " off ", unsigned long " len ", void *" buf );
19 .BI "int pciconfig_iobase(long " which ", unsigned long " bus ,
20 .BI "          unsigned long " devfn );
21 .fi
22 .SH DESCRIPTION
23 .PP
24 Most of the interaction with PCI devices is already handled by the
25 kernel PCI layer,
26 and thus these calls should not normally need to be accessed from user space.
27 .TP
28 .BR pciconfig_read ()
29 Reads to
30 .I buf
31 from device
32 .I dev
33 at offset
34 .I off
35 value.
36 .TP
37 .BR pciconfig_write ()
38 Writes from
39 .I buf
40 to device
41 .I dev
42 at offset
43 .I off
44 value.
45 .TP
46 .BR pciconfig_iobase ()
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.
50 .SH RETURN VALUE
51 .TP
52 .BR pciconfig_read ()
53 On success zero is returned.
54 On error, \-1 is returned and
55 .I errno
56 is set appropriately.
57 .TP
58 .BR pciconfig_write ()
59 On success zero is returned.
60 On error, \-1 is returned and
61 .I errno
62 is set appropriately.
63 .TP
64 .BR pciconfig_iobase ()
65 Returns information on locations of various I/O
66 regions in physical memory according to the
67 .I which
68 value.
69 Values for
70 .I which
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 .
77 .SH ERRORS
78 .TP
79 .B EINVAL
80 .I len
81 value is invalid.
82 This does not apply to
83 .BR pciconfig_iobase ().
84 .TP
85 .B EIO
86 I/O error.
87 .TP
88 .B ENODEV
89 For
90 .BR pciconfig_iobase (),
91 "hose" value is NULL.
92 For the other calls, could not find a slot.
93 .TP
94 .B ENOSYS
95 The system has not implemented these calls
96 .RB ( CONFIG_PCI
97 not defined).
98 .TP
99 .B EOPNOTSUPP
100 This return value is valid only for
101 .BR pciconfig_iobase ().
102 It is returned if the value for
103 .I which
104 is invalid.
105 .TP
106 .B EPERM
107 User does not have the
108 .B CAP_SYS_ADMIN
109 capability.
110 This does not apply to
111 .BR pciconfig_iobase ().
112 .SH CONFORMING TO
113 These calls are Linux-specific, available since Linux 2.0.26/2.1.11.
114 .SH SEE ALSO
115 .BR capabilities (7)
116 .SH COLOPHON
117 This page is part of release 3.79 of the Linux
118 .I man-pages
119 project.
120 A description of the project,
121 information about reporting bugs,
122 and the latest version of this page,
123 can be found at
124 \%http://www.kernel.org/doc/man\-pages/.