diff options
Diffstat (limited to 'arch/alpha/lib/io.c')
-rw-r--r-- | arch/alpha/lib/io.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/arch/alpha/lib/io.c b/arch/alpha/lib/io.c index 25de0f871..de592ff08 100644 --- a/arch/alpha/lib/io.c +++ b/arch/alpha/lib/io.c @@ -2,8 +2,11 @@ * Alpha IO and memory functions.. Just expand the inlines in the header * files.. */ + #include <linux/kernel.h> #include <linux/types.h> +#include <linux/string.h> + #include <asm/io.h> unsigned int _inb(unsigned long addr) @@ -562,3 +565,28 @@ void _memset_c_io(unsigned long to, unsigned long c, long count) } mb(); } + +void +scr_memcpyw(u16 *d, const u16 *s, unsigned int count) +{ + if (! __is_ioaddr((unsigned long) s)) { + /* Source is memory. */ + if (! __is_ioaddr((unsigned long) d)) + memcpy(d, s, count); + else + memcpy_toio(d, s, count); + } else { + /* Source is screen. */ + if (! __is_ioaddr((unsigned long) d)) + memcpy_fromio(d, s, count); + else { + /* FIXME: Should handle unaligned ops and + operation widening. */ + count /= 2; + while (count--) { + u16 tmp = __raw_readw((unsigned long)(s++)); + __raw_writew(tmp, (unsigned long)(d++)); + } + } + } +} |