readv2: Note preadv2(..., RWF_NOWAIT) bug in BUGS section
[man-pages.git] / man2 / pciconfig_read.2
blobae2731ae73edf68f2f69235d951c53a8ec71a1f8
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 and modified.
6 .\" %%%LICENSE_END
7 .\"
8 .TH PCICONFIG_READ 2 2021-03-22 "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 .PP
15 .BI "int pciconfig_read(unsigned long " bus ", unsigned long " dfn ,
16 .BI "                   unsigned long " off ", unsigned long " len ,
17 .BI "                   unsigned char *" buf );
18 .BI "int pciconfig_write(unsigned long " bus ", unsigned long " dfn ,
19 .BI "                   unsigned long " off ", unsigned long " len ,
20 .BI "                   unsigned char *" buf );
21 .BI "int pciconfig_iobase(int " which ", unsigned long " bus ,
22 .BI "                   unsigned long " devfn );
23 .fi
24 .SH DESCRIPTION
25 Most of the interaction with PCI devices is already handled by the
26 kernel PCI layer,
27 and thus these calls should not normally need to be accessed from user space.
28 .TP
29 .BR pciconfig_read ()
30 Reads to
31 .I buf
32 from device
33 .I dev
34 at offset
35 .I off
36 value.
37 .TP
38 .BR pciconfig_write ()
39 Writes from
40 .I buf
41 to device
42 .I dev
43 at offset
44 .I off
45 value.
46 .TP
47 .BR pciconfig_iobase ()
48 You pass it a bus/devfn pair and get a physical address for either the
49 memory offset (for things like prep, this is 0xc0000000),
50 the IO base for PIO cycles, or the ISA holes if any.
51 .SH RETURN VALUE
52 .TP
53 .BR pciconfig_read ()
54 On success, zero is returned.
55 On error, \-1 is returned and
56 .I errno
57 is set to indicate the error.
58 .TP
59 .BR pciconfig_write ()
60 On success, zero is returned.
61 On error, \-1 is returned and
62 .I errno
63 is set to indicate the error.
64 .TP
65 .BR pciconfig_iobase ()
66 Returns information on locations of various I/O
67 regions in physical memory according to the
68 .I which
69 value.
70 Values for
71 .I which
72 are:
73 .BR IOBASE_BRIDGE_NUMBER ,
74 .BR IOBASE_MEMORY ,
75 .BR IOBASE_IO ,
76 .BR IOBASE_ISA_IO ,
77 .BR IOBASE_ISA_MEM .
78 .SH ERRORS
79 .TP
80 .B EINVAL
81 .I len
82 value is invalid.
83 This does not apply to
84 .BR pciconfig_iobase ().
85 .TP
86 .B EIO
87 I/O error.
88 .TP
89 .B ENODEV
90 For
91 .BR pciconfig_iobase (),
92 "hose" value is NULL.
93 For the other calls, could not find a slot.
94 .TP
95 .B ENOSYS
96 The system has not implemented these calls
97 .RB ( CONFIG_PCI
98 not defined).
99 .TP
100 .B EOPNOTSUPP
101 This return value is valid only for
102 .BR pciconfig_iobase ().
103 It is returned if the value for
104 .I which
105 is invalid.
107 .B EPERM
108 User does not have the
109 .B CAP_SYS_ADMIN
110 capability.
111 This does not apply to
112 .BR pciconfig_iobase ().
113 .SH CONFORMING TO
114 These calls are Linux-specific, available since Linux 2.0.26/2.1.11.
115 .SH SEE ALSO
116 .BR capabilities (7)