2 * I/O string operations
3 * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
4 * Copyright (C) 2006 IBM Corporation
6 * Largely rewritten by Cort Dougan (cort@cs.nmt.edu)
9 * Adapted for iSeries by Mike Corrigan (mikejc@us.ibm.com)
10 * PPC64 updates by Dave Engebretsen (engebret@us.ibm.com)
12 * Rewritten in C by Stephen Rothwell.
14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU General Public License
16 * as published by the Free Software Foundation; either version
17 * 2 of the License, or (at your option) any later version.
19 #include <linux/kernel.h>
20 #include <linux/types.h>
21 #include <linux/compiler.h>
22 #include <linux/module.h>
26 void _insb(volatile u8 __iomem *port, void *buf, long count)
31 if (unlikely(count <= 0))
36 asm volatile("eieio");
38 } while (--count != 0);
39 asm volatile("twi 0,%0,0; isync" : : "r" (tmp));
43 void _outsb(volatile u8 __iomem *port, const void *buf, long count)
47 if (unlikely(count <= 0))
52 } while (--count != 0);
55 EXPORT_SYMBOL(_outsb);
57 void _insw_ns(volatile u16 __iomem *port, void *buf, long count)
62 if (unlikely(count <= 0))
67 asm volatile("eieio");
69 } while (--count != 0);
70 asm volatile("twi 0,%0,0; isync" : : "r" (tmp));
72 EXPORT_SYMBOL(_insw_ns);
74 void _outsw_ns(volatile u16 __iomem *port, const void *buf, long count)
76 const u16 *tbuf = buf;
78 if (unlikely(count <= 0))
83 } while (--count != 0);
86 EXPORT_SYMBOL(_outsw_ns);
88 void _insl_ns(volatile u32 __iomem *port, void *buf, long count)
93 if (unlikely(count <= 0))
98 asm volatile("eieio");
100 } while (--count != 0);
101 asm volatile("twi 0,%0,0; isync" : : "r" (tmp));
103 EXPORT_SYMBOL(_insl_ns);
105 void _outsl_ns(volatile u32 __iomem *port, const void *buf, long count)
107 const u32 *tbuf = buf;
109 if (unlikely(count <= 0))
111 asm volatile("sync");
114 } while (--count != 0);
115 asm volatile("sync");
117 EXPORT_SYMBOL(_outsl_ns);