Lines Matching +full:src +full:- +full:2

1 // SPDX-License-Identifier: GPL-2.0
5 * Copyright (c) Matthew Wilcox 2001 for Hewlett-Packard
16 * Assumes the device can cope with 32-bit transfers. If it can't,
19 void memcpy_toio(volatile void __iomem *dst, const void *src, int count) in memcpy_toio() argument
21 if (((unsigned long)dst & 3) != ((unsigned long)src & 3)) in memcpy_toio()
24 writeb(*(char *)src, dst++); in memcpy_toio()
25 src++; in memcpy_toio()
26 count--; in memcpy_toio()
29 __raw_writel(*(u32 *)src, dst); in memcpy_toio()
30 src += 4; in memcpy_toio()
32 count -= 4; in memcpy_toio()
35 while (count--) { in memcpy_toio()
36 writeb(*(char *)src, dst++); in memcpy_toio()
37 src++; in memcpy_toio()
43 ** Assumes the device can cope with 32-bit transfers. If it can't,
52 ** TODO: only look at src alignment and adjust the stores to dest.
54 void memcpy_fromio(void *dst, const volatile void __iomem *src, int count) in memcpy_fromio() argument
56 /* first compare alignment of src/dst */ in memcpy_fromio()
57 if ( (((unsigned long)dst ^ (unsigned long)src) & 1) || (count < 2) ) in memcpy_fromio()
60 if ( (((unsigned long)dst ^ (unsigned long)src) & 2) || (count < 4) ) in memcpy_fromio()
64 if ((unsigned long)src & 1) { in memcpy_fromio()
65 *(u8 *)dst = readb(src); in memcpy_fromio()
66 src++; in memcpy_fromio()
68 count--; in memcpy_fromio()
69 if (count < 2) goto bytecopy; in memcpy_fromio()
72 if ((unsigned long)src & 2) { in memcpy_fromio()
73 *(u16 *)dst = __raw_readw(src); in memcpy_fromio()
74 src += 2; in memcpy_fromio()
75 dst += 2; in memcpy_fromio()
76 count -= 2; in memcpy_fromio()
80 *(u32 *)dst = __raw_readl(src); in memcpy_fromio()
82 src += 4; in memcpy_fromio()
83 count -= 4; in memcpy_fromio()
88 *(u16 *)dst = __raw_readw(src); in memcpy_fromio()
89 src += 2; in memcpy_fromio()
90 dst += 2; in memcpy_fromio()
91 count -= 2; in memcpy_fromio()
95 while (count--) { in memcpy_fromio()
96 *(char *)dst = readb(src); in memcpy_fromio()
97 src++; in memcpy_fromio()
103 * Assumes the device can cope with 32-bit transfers. If it can't,
111 count--; in memset_io()
116 count -= 4; in memset_io()
118 while (count--) { in memset_io()
124 * Read COUNT 8-bit bytes from port PORT into memory starting at
125 * SRC.
136 count--; in insb()
143 count -= 4; in insb()
153 --count; in insb()
161 * Read COUNT 16-bit words from port PORT into memory starting at
162 * SRC. SRC must be at least short aligned. This is used by the
179 case 0x00: /* Buffer 32-bit aligned */ in insw()
180 while (count>=2) { in insw()
182 count -= 2; in insw()
193 case 0x02: /* Buffer 16-bit aligned */ in insw()
195 p += 2; in insw()
196 count--; in insw()
197 while (count>=2) { in insw()
199 count -= 2; in insw()
210 case 0x01: /* Buffer 8-bit aligned */ in insw()
213 * in this case, 16bit will have to do -- DE */ in insw()
214 --count; in insw()
219 while (count--) in insw()
223 p += 2; in insw()
234 * Read COUNT 32-bit words from port PORT into memory starting at
235 * SRC. Now works with any alignment in SRC. Performance is important,
251 case 0x00: /* Buffer 32-bit aligned */ in insl()
252 while (count--) in insl()
259 case 0x02: /* Buffer 16-bit aligned */ in insl()
260 --count; in insl()
264 p += 2; in insl()
266 while (count--) in insl()
275 case 0x01: /* Buffer 8-bit aligned */ in insl()
276 --count; in insl()
282 p += 2; in insl()
283 while (count--) in insl()
292 case 0x03: /* Buffer 8-bit aligned */ in insl()
293 --count; in insl()
298 while (count--) in insl()
306 p += 2; in insl()
317 * doing byte writes the slow way (no r-m-w cycle).
319 void outsb(unsigned long port, const void * src, unsigned long count) in outsb() argument
323 p = (const unsigned char *)src; in outsb()
325 count--; in outsb()
337 void outsw (unsigned long port, const void *src, unsigned long count) in outsw() argument
342 p = (const unsigned char *)src; in outsw()
349 case 0x00: /* Buffer 32-bit aligned */ in outsw()
350 while (count>=2) { in outsw()
351 count -= 2; in outsw()
362 case 0x02: /* Buffer 16-bit aligned */ in outsw()
365 p += 2; in outsw()
366 count--; in outsw()
368 while (count>=2) { in outsw()
369 count -= 2; in outsw()
380 case 0x01: /* Buffer 8-bit aligned */ in outsw()
382 * in this case, 16bit will have to do -- DE */ in outsw()
386 count--; in outsw()
389 count--; in outsw()
391 p += 2; in outsw()
405 * driver to write disk sectors. Works with any alignment in SRC.
409 void outsl (unsigned long port, const void *src, unsigned long count) in outsl() argument
414 p = (const unsigned char *)src; in outsl()
421 case 0x00: /* Buffer 32-bit aligned */ in outsl()
422 while (count--) in outsl()
429 case 0x02: /* Buffer 16-bit aligned */ in outsl()
430 --count; in outsl()
433 p += 2; in outsl()
435 while (count--) in outsl()
445 case 0x01: /* Buffer 8-bit aligned */ in outsl()
446 --count; in outsl()
451 p += 2; in outsl()
453 while (count--) in outsl()
463 case 0x03: /* Buffer 8-bit aligned */ in outsl()
464 --count; in outsl()
469 while (count--) in outsl()
477 p += 2; in outsl()