Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | #include <linux/module.h> |
| 2 | #include <linux/types.h> |
| 3 | |
| 4 | #include <asm/io.h> |
| 5 | |
| 6 | /* |
| 7 | * Copy data from IO memory space to "real" memory space. |
| 8 | * This needs to be optimized. |
| 9 | */ |
Russell King | d2f6074 | 2005-09-24 10:42:06 +0100 | [diff] [blame] | 10 | void _memcpy_fromio(void *to, const volatile void __iomem *from, size_t count) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 11 | { |
| 12 | unsigned char *t = to; |
| 13 | while (count) { |
| 14 | count--; |
| 15 | *t = readb(from); |
| 16 | t++; |
| 17 | from++; |
| 18 | } |
| 19 | } |
| 20 | |
| 21 | /* |
| 22 | * Copy data from "real" memory space to IO memory space. |
| 23 | * This needs to be optimized. |
| 24 | */ |
Russell King | d2f6074 | 2005-09-24 10:42:06 +0100 | [diff] [blame] | 25 | void _memcpy_toio(volatile void __iomem *to, const void *from, size_t count) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 26 | { |
| 27 | const unsigned char *f = from; |
| 28 | while (count) { |
| 29 | count--; |
| 30 | writeb(*f, to); |
| 31 | f++; |
| 32 | to++; |
| 33 | } |
| 34 | } |
| 35 | |
| 36 | /* |
| 37 | * "memset" on IO memory space. |
| 38 | * This needs to be optimized. |
| 39 | */ |
Russell King | d2f6074 | 2005-09-24 10:42:06 +0100 | [diff] [blame] | 40 | void _memset_io(volatile void __iomem *dst, int c, size_t count) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 41 | { |
| 42 | while (count) { |
| 43 | count--; |
| 44 | writeb(c, dst); |
| 45 | dst++; |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | EXPORT_SYMBOL(_memcpy_fromio); |
| 50 | EXPORT_SYMBOL(_memcpy_toio); |
| 51 | EXPORT_SYMBOL(_memset_io); |