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

1 // SPDX-License-Identifier: GPL-2.0
5 * Copyright (c) Matthew Wilcox 2001 for Hewlett-Packard
17 ** Assumes the device can cope with 32-bit transfers. If it can't,
26 ** TODO: only look at src alignment and adjust the stores to dest.
28 void memcpy_fromio(void *dst, const volatile void __iomem *src, int count) in memcpy_fromio() argument
30 /* first compare alignment of src/dst */ in memcpy_fromio()
31 if ( (((unsigned long)dst ^ (unsigned long)src) & 1) || (count < 2) ) in memcpy_fromio()
34 if ( (((unsigned long)dst ^ (unsigned long)src) & 2) || (count < 4) ) in memcpy_fromio()
38 if ((unsigned long)src & 1) { in memcpy_fromio()
39 *(u8 *)dst = readb(src); in memcpy_fromio()
40 src++; in memcpy_fromio()
42 count--; in memcpy_fromio()
43 if (count < 2) goto bytecopy; in memcpy_fromio()
46 if ((unsigned long)src & 2) { in memcpy_fromio()
47 *(u16 *)dst = __raw_readw(src); in memcpy_fromio()
48 src += 2; in memcpy_fromio()
49 dst += 2; in memcpy_fromio()
50 count -= 2; in memcpy_fromio()
54 *(u32 *)dst = __raw_readl(src); in memcpy_fromio()
56 src += 4; in memcpy_fromio()
57 count -= 4; in memcpy_fromio()
62 *(u16 *)dst = __raw_readw(src); in memcpy_fromio()
63 src += 2; in memcpy_fromio()
64 dst += 2; in memcpy_fromio()
65 count -= 2; in memcpy_fromio()
69 while (count--) { in memcpy_fromio()
70 *(char *)dst = readb(src); in memcpy_fromio()
71 src++; in memcpy_fromio()
77 * Read COUNT 8-bit bytes from port PORT into memory starting at
78 * SRC.
89 count--; in insb()
96 count -= 4; in insb()
106 --count; in insb()
114 * Read COUNT 16-bit words from port PORT into memory starting at
115 * SRC. SRC must be at least short aligned. This is used by the
132 case 0x00: /* Buffer 32-bit aligned */ in insw()
133 while (count>=2) { in insw()
135 count -= 2; in insw()
146 case 0x02: /* Buffer 16-bit aligned */ in insw()
148 p += 2; in insw()
149 count--; in insw()
150 while (count>=2) { in insw()
152 count -= 2; in insw()
163 case 0x01: /* Buffer 8-bit aligned */ in insw()
166 * in this case, 16bit will have to do -- DE */ in insw()
167 --count; in insw()
172 while (count--) in insw()
176 p += 2; in insw()
187 * Read COUNT 32-bit words from port PORT into memory starting at
188 * SRC. Now works with any alignment in SRC. Performance is important,
204 case 0x00: /* Buffer 32-bit aligned */ in insl()
205 while (count--) in insl()
212 case 0x02: /* Buffer 16-bit aligned */ in insl()
213 --count; in insl()
217 p += 2; in insl()
219 while (count--) in insl()
228 case 0x01: /* Buffer 8-bit aligned */ in insl()
229 --count; in insl()
235 p += 2; in insl()
236 while (count--) in insl()
245 case 0x03: /* Buffer 8-bit aligned */ in insl()
246 --count; in insl()
251 while (count--) in insl()
259 p += 2; in insl()
270 * doing byte writes the slow way (no r-m-w cycle).
272 void outsb(unsigned long port, const void * src, unsigned long count) in outsb() argument
276 p = (const unsigned char *)src; in outsb()
278 count--; in outsb()
290 void outsw (unsigned long port, const void *src, unsigned long count) in outsw() argument
295 p = (const unsigned char *)src; in outsw()
302 case 0x00: /* Buffer 32-bit aligned */ in outsw()
303 while (count>=2) { in outsw()
304 count -= 2; in outsw()
315 case 0x02: /* Buffer 16-bit aligned */ in outsw()
318 p += 2; in outsw()
319 count--; in outsw()
321 while (count>=2) { in outsw()
322 count -= 2; in outsw()
333 case 0x01: /* Buffer 8-bit aligned */ in outsw()
335 * in this case, 16bit will have to do -- DE */ in outsw()
339 count--; in outsw()
342 count--; in outsw()
344 p += 2; in outsw()
358 * driver to write disk sectors. Works with any alignment in SRC.
362 void outsl (unsigned long port, const void *src, unsigned long count) in outsl() argument
367 p = (const unsigned char *)src; in outsl()
374 case 0x00: /* Buffer 32-bit aligned */ in outsl()
375 while (count--) in outsl()
382 case 0x02: /* Buffer 16-bit aligned */ in outsl()
383 --count; in outsl()
386 p += 2; in outsl()
388 while (count--) in outsl()
398 case 0x01: /* Buffer 8-bit aligned */ in outsl()
399 --count; in outsl()
404 p += 2; in outsl()
406 while (count--) in outsl()
416 case 0x03: /* Buffer 8-bit aligned */ in outsl()
417 --count; in outsl()
422 while (count--) in outsl()
430 p += 2; in outsl()