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;
24 __raw_writew(*(u16 *)src, addr);
29 void outsl(unsigned long __addr, const void *src, unsigned long count)
31 void __iomem *addr = (void __iomem *) __addr;
37 switch (((unsigned long)src) & 0x3) {
39 /* src is naturally aligned */
41 __raw_writel(*(u32 *)src, addr);
46 /* 2-byte alignment */
48 l = (*(u16 *)src) << 16;
49 l |= *(u16 *)(src + sizeof(u16));
50 __raw_writel(l, addr);
55 /* Hold three bytes in l each time, grab a byte from l2 */
56 l = (*(u8 *)src) << 24;
57 l |= (*(u16 *)(src + sizeof(u8))) << 8;
58 src += sizeof(u8) + sizeof(u16);
62 __raw_writel(l, addr);
68 /* Hold a byte in l each time, grab 3 bytes from l2 */
69 l = (*(u8 *)src) << 24;
74 __raw_writel(l, addr);
82 void insb(unsigned long __addr, void *dst, unsigned long count)
84 void __iomem *addr = (void __iomem *) __addr;
90 while ((((unsigned long)pb) & 0x3) && count--)
96 w = (inb(addr) << 24);
97 w |= (inb(addr) << 16);
98 w |= (inb(addr) << 8);
99 w |= (inb(addr) << 0);
109 void insw(unsigned long __addr, void *dst, unsigned long count)
111 void __iomem *addr = (void __iomem *) __addr;
117 if (((unsigned long)ps) & 0x2) {
118 *ps++ = le16_to_cpu(inw(addr));
125 w = (le16_to_cpu(inw(addr)) << 16);
126 w |= (le16_to_cpu(inw(addr)) << 0);
132 *ps = le16_to_cpu(inw(addr));
136 void insl(unsigned long __addr, void *dst, unsigned long count)
138 void __iomem *addr = (void __iomem *) __addr;
141 if ((((unsigned long)dst) & 0x3) == 0) {
144 *pi++ = le32_to_cpu(inl(addr));
150 switch (((unsigned long)dst) & 3) {
154 l = le32_to_cpu(inl(addr));
158 l2 = le32_to_cpu(inl(addr));
159 *pi++ = (l << 16) | (l2 >> 16);
169 l = le32_to_cpu(inl(addr));
172 *ps++ = ((l >> 8) & 0xffff);
175 l2 = le32_to_cpu(inl(addr));
176 *pi++ = (l << 24) | (l2 >> 8);
186 l = le32_to_cpu(inl(addr));
190 l2 = le32_to_cpu(inl(addr));
191 *pi++ = (l << 8) | (l2 >> 24);
195 *ps++ = ((l >> 8) & 0xffff);