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(void __iomem
*addr
, const void *src
, unsigned long count
)
18 void outsw(void __iomem
*addr
, const void *src
, unsigned long count
)
24 if(((u64
)src
) & 0x2) {
25 u16 val
= le16_to_cpup(ps
);
32 u32 w
= le32_to_cpup(pi
);
41 u16 val
= le16_to_cpup(ps
);
47 void outsl(void __iomem
*addr
, const void *src
, unsigned long count
)
50 if((((u64
)src
) & 0x3) == 0) {
53 u32 val
= cpu_to_le32p(p
);
63 switch(((u64
)src
) & 0x3) {
66 l
= cpu_to_le16p(ps
) << 16;
70 l2
= cpu_to_le32p(pi
);
72 outl(((l
>> 16) | (l2
<< 16)), addr
);
76 l2
= cpu_to_le16p(ps
);
77 outl(((l
>> 16) | (l2
<< 16)), addr
);
85 l2
= cpu_to_le16p(ps
);
90 l2
= cpu_to_le32p(pi
);
92 outl(((l
>> 8) | (l2
<< 24)), addr
);
96 outl(((l
>> 8) | (*pb
<< 24)), addr
);
105 l2
= cpu_to_le32p(pi
);
107 outl(((l
>> 24) | (l2
<< 8)), addr
);
111 l2
= cpu_to_le16p(ps
);
115 outl(((l
>> 24) | (l2
<< 8)), addr
);
122 void insb(void __iomem
*addr
, void *dst
, unsigned long count
)
128 while((((unsigned long)pb
) & 0x3) && count
--)
134 w
= (inb(addr
) << 24);
135 w
|= (inb(addr
) << 16);
136 w
|= (inb(addr
) << 8);
137 w
|= (inb(addr
) << 0);
147 void insw(void __iomem
*addr
, void *dst
, unsigned long count
)
153 if(((unsigned long)ps
) & 0x2) {
154 *ps
++ = le16_to_cpu(inw(addr
));
161 w
= (le16_to_cpu(inw(addr
)) << 16);
162 w
|= (le16_to_cpu(inw(addr
)) << 0);
168 *ps
= le16_to_cpu(inw(addr
));
172 void insl(void __iomem
*addr
, void *dst
, unsigned long count
)
175 if((((unsigned long)dst
) & 0x3) == 0) {
178 *pi
++ = le32_to_cpu(inl(addr
));
184 switch(((unsigned long)dst
) & 3) {
188 l
= le32_to_cpu(inl(addr
));
192 l2
= le32_to_cpu(inl(addr
));
193 *pi
++ = (l
<< 16) | (l2
>> 16);
203 l
= le32_to_cpu(inl(addr
));
206 *ps
++ = ((l
>> 8) & 0xffff);
209 l2
= le32_to_cpu(inl(addr
));
210 *pi
++ = (l
<< 24) | (l2
>> 8);
220 l
= le32_to_cpu(inl(addr
));
224 l2
= le32_to_cpu(inl(addr
));
225 *pi
++ = (l
<< 8) | (l2
>> 24);
229 *ps
++ = ((l
>> 8) & 0xffff);