Lines Matching +full:port +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,
26 count--; in memcpy_toio()
32 count -= 4; in memcpy_toio()
35 while (count--) { in memcpy_toio()
43 ** Assumes the device can cope with 32-bit transfers. If it can't,
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()
68 count--; in memcpy_fromio()
69 if (count < 2) goto bytecopy; in memcpy_fromio()
72 if ((unsigned long)src & 2) { in memcpy_fromio()
74 src += 2; in memcpy_fromio()
75 dst += 2; in memcpy_fromio()
76 count -= 2; in memcpy_fromio()
83 count -= 4; 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()
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
127 void insb (unsigned long port, void *dst, unsigned long count) in insb() argument
136 count--; in insb()
137 *p = inb(port); in insb()
143 count -= 4; in insb()
144 w = inb(port) << 24; in insb()
145 w |= inb(port) << 16; in insb()
146 w |= inb(port) << 8; in insb()
147 w |= inb(port); in insb()
153 --count; in insb()
154 *p = inb(port); in insb()
161 * Read COUNT 16-bit words from port PORT into memory starting at
167 void insw (unsigned long port, void *dst, unsigned long count) in insw() argument
179 case 0x00: /* Buffer 32-bit aligned */ in insw()
180 while (count>=2) { in insw()
182 count -= 2; in insw()
183 l = cpu_to_le16(inw(port)) << 16; in insw()
184 l |= cpu_to_le16(inw(port)); in insw()
189 *(unsigned short *)p = cpu_to_le16(inw(port)); in insw()
193 case 0x02: /* Buffer 16-bit aligned */ in insw()
194 *(unsigned short *)p = cpu_to_le16(inw(port)); in insw()
195 p += 2; in insw()
196 count--; in insw()
197 while (count>=2) { in insw()
199 count -= 2; in insw()
200 l = cpu_to_le16(inw(port)) << 16; in insw()
201 l |= cpu_to_le16(inw(port)); in insw()
206 *(unsigned short *)p = cpu_to_le16(inw(port)); 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()
216 l = cpu_to_le16(inw(port)); in insw()
219 while (count--) in insw()
221 l2 = cpu_to_le16(inw(port)); in insw()
223 p += 2; in insw()
234 * Read COUNT 32-bit words from port PORT into memory starting at
239 void insl (unsigned long port, void *dst, unsigned long count) in insl() argument
251 case 0x00: /* Buffer 32-bit aligned */ in insl()
252 while (count--) in insl()
254 *(unsigned int *)p = cpu_to_le32(inl(port)); in insl()
259 case 0x02: /* Buffer 16-bit aligned */ in insl()
260 --count; in insl()
262 l = cpu_to_le32(inl(port)); in insl()
264 p += 2; in insl()
266 while (count--) in insl()
268 l2 = cpu_to_le32(inl(port)); in insl()
275 case 0x01: /* Buffer 8-bit aligned */ in insl()
276 --count; in insl()
278 l = cpu_to_le32(inl(port)); in insl()
282 p += 2; in insl()
283 while (count--) in insl()
285 l2 = cpu_to_le32(inl(port)); in insl()
292 case 0x03: /* Buffer 8-bit aligned */ in insl()
293 --count; in insl()
295 l = cpu_to_le32(inl(port)); in insl()
298 while (count--) in insl()
300 l2 = cpu_to_le32(inl(port)); 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
325 count--; in outsb()
326 outb(*p, port); in outsb()
337 void outsw (unsigned long port, const void *src, unsigned long count) in outsw() argument
349 case 0x00: /* Buffer 32-bit aligned */ in outsw()
350 while (count>=2) { in outsw()
351 count -= 2; in outsw()
354 outw(le16_to_cpu(l >> 16), port); in outsw()
355 outw(le16_to_cpu(l & 0xffff), port); in outsw()
358 outw(le16_to_cpu(*(unsigned short*)p), port); in outsw()
362 case 0x02: /* Buffer 16-bit aligned */ in outsw()
364 outw(le16_to_cpu(*(unsigned short*)p), port); in outsw()
365 p += 2; in outsw()
366 count--; in outsw()
368 while (count>=2) { in outsw()
369 count -= 2; in outsw()
372 outw(le16_to_cpu(l >> 16), port); in outsw()
373 outw(le16_to_cpu(l & 0xffff), port); in outsw()
376 outw(le16_to_cpu(*(unsigned short *)p), port); 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()
392 outw(le16_to_cpu(l | l2 >> 8), port); in outsw()
396 outw (le16_to_cpu(l | l2>>8), port); in outsw()
409 void outsl (unsigned long port, const void *src, unsigned long count) in outsl() argument
421 case 0x00: /* Buffer 32-bit aligned */ in outsl()
422 while (count--) in outsl()
424 outl(le32_to_cpu(*(unsigned int *)p), port); 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()
439 outl (le32_to_cpu(l << 16 | l2 >> 16), port); in outsl()
443 outl (le32_to_cpu(l << 16 | l2), port); 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()
457 outl (le32_to_cpu(l | l2 >> 24), port); in outsl()
461 outl (le32_to_cpu(l | l2), port); in outsl()
463 case 0x03: /* Buffer 8-bit aligned */ in outsl()
464 --count; in outsl()
469 while (count--) in outsl()
473 outl (le32_to_cpu(l | l2 >> 8), port); in outsl()
477 p += 2; in outsl()
479 outl (le32_to_cpu(l | l2), port); in outsl()