1 /* $Id: PeeCeeI.c,v 1.4 1999/09/06 01:17:35 davem Exp $
2 * PeeCeeI.c: The emerging standard...
4 * Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu)
8 #include <asm/byteorder.h>
10 void outsb(unsigned long __addr
, const void *src
, unsigned long count
)
12 void __iomem
*addr
= (void __iomem
*) __addr
;
19 void outsw(unsigned long __addr
, const void *src
, unsigned long count
)
21 void __iomem
*addr
= (void __iomem
*) __addr
;
27 if (((u64
)src
) & 0x2) {
28 u16 val
= le16_to_cpup(ps
);
35 u32 w
= le32_to_cpup(pi
);
44 u16 val
= le16_to_cpup(ps
);
50 void outsl(unsigned long __addr
, const void *src
, unsigned long count
)
52 void __iomem
*addr
= (void __iomem
*) __addr
;
55 if ((((u64
)src
) & 0x3) == 0) {
58 u32 val
= cpu_to_le32p(p
);
68 switch (((u64
)src
) & 0x3) {
71 l
= cpu_to_le16p(ps
) << 16;
75 l2
= cpu_to_le32p(pi
);
77 outl(((l
>> 16) | (l2
<< 16)), addr
);
81 l2
= cpu_to_le16p(ps
);
82 outl(((l
>> 16) | (l2
<< 16)), addr
);
90 l2
= cpu_to_le16p(ps
);
95 l2
= cpu_to_le32p(pi
);
97 outl(((l
>> 8) | (l2
<< 24)), addr
);
101 outl(((l
>> 8) | (*pb
<< 24)), addr
);
110 l2
= cpu_to_le32p(pi
);
112 outl(((l
>> 24) | (l2
<< 8)), addr
);
116 l2
= cpu_to_le16p(ps
);
120 outl(((l
>> 24) | (l2
<< 8)), addr
);
127 void insb(unsigned long __addr
, void *dst
, unsigned long count
)
129 void __iomem
*addr
= (void __iomem
*) __addr
;
135 while ((((unsigned long)pb
) & 0x3) && count
--)
141 w
= (inb(addr
) << 24);
142 w
|= (inb(addr
) << 16);
143 w
|= (inb(addr
) << 8);
144 w
|= (inb(addr
) << 0);
154 void insw(unsigned long __addr
, void *dst
, unsigned long count
)
156 void __iomem
*addr
= (void __iomem
*) __addr
;
162 if (((unsigned long)ps
) & 0x2) {
163 *ps
++ = le16_to_cpu(inw(addr
));
170 w
= (le16_to_cpu(inw(addr
)) << 16);
171 w
|= (le16_to_cpu(inw(addr
)) << 0);
177 *ps
= le16_to_cpu(inw(addr
));
181 void insl(unsigned long __addr
, void *dst
, unsigned long count
)
183 void __iomem
*addr
= (void __iomem
*) __addr
;
186 if ((((unsigned long)dst
) & 0x3) == 0) {
189 *pi
++ = le32_to_cpu(inl(addr
));
195 switch (((unsigned long)dst
) & 3) {
199 l
= le32_to_cpu(inl(addr
));
203 l2
= le32_to_cpu(inl(addr
));
204 *pi
++ = (l
<< 16) | (l2
>> 16);
214 l
= le32_to_cpu(inl(addr
));
217 *ps
++ = ((l
>> 8) & 0xffff);
220 l2
= le32_to_cpu(inl(addr
));
221 *pi
++ = (l
<< 24) | (l2
>> 8);
231 l
= le32_to_cpu(inl(addr
));
235 l2
= le32_to_cpu(inl(addr
));
236 *pi
++ = (l
<< 8) | (l2
>> 24);
240 *ps
++ = ((l
>> 8) & 0xffff);