Merge tag 'v3.3.7' into 3.3/master
[zen-stable.git] / arch / xtensa / kernel / io.c
blob5b65269b1d2f7ada133f8f2fcd3008176ea9cb7d
1 /*
2 * arch/xtensa/io.c
4 * IO primitives
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
11 * Copied from sparc.
13 * Chris Zankel <chris@zankel.net>
17 #include <asm/io.h>
18 #include <asm/byteorder.h>
20 void outsb(unsigned long addr, const void *src, unsigned long count) {
21 while (count) {
22 count -= 1;
23 writeb(*(const char *)src, addr);
24 src += 1;
25 addr += 1;
29 void outsw(unsigned long addr, const void *src, unsigned long count) {
30 while (count) {
31 count -= 2;
32 writew(*(const short *)src, addr);
33 src += 2;
34 addr += 2;
38 void outsl(unsigned long addr, const void *src, unsigned long count) {
39 while (count) {
40 count -= 4;
41 writel(*(const long *)src, addr);
42 src += 4;
43 addr += 4;
47 void insb(unsigned long addr, void *dst, unsigned long count) {
48 while (count) {
49 count -= 1;
50 *(unsigned char *)dst = readb(addr);
51 dst += 1;
52 addr += 1;
56 void insw(unsigned long addr, void *dst, unsigned long count) {
57 while (count) {
58 count -= 2;
59 *(unsigned short *)dst = readw(addr);
60 dst += 2;
61 addr += 2;
65 void insl(unsigned long addr, void *dst, unsigned long count) {
66 while (count) {
67 count -= 4;
69 * XXX I am sure we are in for an unaligned trap here.
71 *(unsigned long *)dst = readl(addr);
72 dst += 4;
73 addr += 4;