函数源码

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source File:include\asm-generic\io.h Create Date:2022-07-27 06:47:00
首页 Copyright©Brick

123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
#endif /* __LINUX_LOGIC_PIO_H */
 
/*
 * {in,out}{b,w,l}() access little endian I/O. {in,out}{b,w,l}_p() can be
 * implemented on hardware that needs an additional delay for I/O accesses to
 * take effect.
 */
 
#ifndef inb
#define inb inb
static inline u8 inb(unsigned long addr)
{
    u8 val;
 
    __io_pbr();
    val = __raw_readb(PCI_IOBASE + addr);
    __io_par(val);
    return val;
}
#endif
 
#ifndef inw
#define inw inw
static inline u16 inw(unsigned long addr)
{
    u16 val;
 
    __io_pbr();
    val = __le16_to_cpu(__raw_readw(PCI_IOBASE + addr));
    __io_par(val);
    return val;
}
#endif
 
#ifndef inl
#define inl inl
static inline u32 inl(unsigned long addr)
{
    u32 val;
 
    __io_pbr();
    val = __le32_to_cpu(__raw_readl(PCI_IOBASE + addr));
    __io_par(val);
    return val;
}
#endif
 
#ifndef outb
#define outb outb
static inline void outb(u8 value, unsigned long addr)
{
    __io_pbw();
    __raw_writeb(value, PCI_IOBASE + addr);
    __io_paw();
}
#endif
 
#ifndef outw
#define outw outw
static inline void outw(u16 value, unsigned long addr)
{
    __io_pbw();
    __raw_writew(cpu_to_le16(value), PCI_IOBASE + addr);
    __io_paw();
}
#endif
 
#ifndef outl
#define outl outl
static inline void outl(u32 value, unsigned long addr)
{
    __io_pbw();
    __raw_writel(cpu_to_le32(value), PCI_IOBASE + addr);
    __io_paw();
}
#endif
 
#ifndef inb_p
#define inb_p inb_p
static inline u8 inb_p(unsigned long addr)
{
    return inb(addr);
}
#endif
 
#ifndef inw_p
#define inw_p inw_p
static inline u16 inw_p(unsigned long addr)
{
    return inw(addr);
}
#endif
 
#ifndef inl_p
#define inl_p inl_p
static inline u32 inl_p(unsigned long addr)
{
    return inl(addr);
}
#endif
 
#ifndef outb_p
#define outb_p outb_p
static inline void outb_p(u8 value, unsigned long addr)
{
    outb(value, addr);
}
#endif
 
#ifndef outw_p
#define outw_p outw_p
static inline void outw_p(u16 value, unsigned long addr)
{
    outw(value, addr);
}
#endif
 
#ifndef outl_p
#define outl_p outl_p
static inline void outl_p(u32 value, unsigned long addr)
{
    outl(value, addr);
}
#endif
 
/*
 * {in,out}s{b,w,l}{,_p}() are variants of the above that repeatedly access a
 * single I/O port multiple times.
 */
 
#ifndef insb
#define insb insb
static inline void insb(unsigned long addr, void *buffer, unsigned int count)
{
    readsb(PCI_IOBASE + addr, buffer, count);
}
#endif
 
#ifndef insw
#define insw insw
static inline void insw(unsigned long addr, void *buffer, unsigned int count)
{
    readsw(PCI_IOBASE + addr, buffer, count);
}
#endif
 
#ifndef insl
#define insl insl
static inline void insl(unsigned long addr, void *buffer, unsigned int count)
{
    readsl(PCI_IOBASE + addr, buffer, count);
}
#endif
 
#ifndef outsb
#define outsb outsb
static inline void outsb(unsigned long addr, const void *buffer,
             unsigned int count)
{
    writesb(PCI_IOBASE + addr, buffer, count);
}
#endif
 
#ifndef outsw
#define outsw outsw
static inline void outsw(unsigned long addr, const void *buffer,
             unsigned int count)
{
    writesw(PCI_IOBASE + addr, buffer, count);
}
#endif
 
#ifndef outsl
#define outsl outsl
static inline void outsl(unsigned long addr, const void *buffer,
             unsigned int count)
{
    writesl(PCI_IOBASE + addr, buffer, count);
}
#endif
 
#ifndef insb_p
#define insb_p insb_p
static inline void insb_p(unsigned long addr, void *buffer, unsigned int count)
{
    insb(addr, buffer, count);
}