X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=lib%2Fiomap.c;h=55689c5d3379dbde2013f8cf3509bef6e9d74598;hb=f7f1b0f1e2fbadeab12d24236000e778aa9b1ead;hp=d30ff1a8edee2737638e77ae32d2dc32f06d45c9;hpb=a2c21200f1c81b08cb55e417b68150bba439b646;p=linux-2.6.git diff --git a/lib/iomap.c b/lib/iomap.c index d30ff1a8e..55689c5d3 100644 --- a/lib/iomap.c +++ b/lib/iomap.c @@ -1,5 +1,7 @@ /* * Implement the default iomap interfaces + * + * (C) Copyright 2004 Linus Torvalds */ #include #include @@ -17,7 +19,10 @@ * * Architectures for which this is not true can't use this generic * implementation and should do their own copy. - * + */ + +#ifndef HAVE_ARCH_PIO_SIZE +/* * We encode the physical PIO addresses (0-0xffff) into the * pointer by offsetting them with a constant (0x10000) and * assuming that all the low addresses are always PIO. That means @@ -27,6 +32,7 @@ #define PIO_OFFSET 0x10000UL #define PIO_MASK 0x0ffffUL #define PIO_RESERVED 0x40000UL +#endif /* * Ugly macros are a way of life. @@ -52,13 +58,23 @@ unsigned int fastcall ioread16(void __iomem *addr) { IO_COND(addr, return inw(port), return readw(addr)); } +unsigned int fastcall ioread16be(void __iomem *addr) +{ + IO_COND(addr, return inw(port), return be16_to_cpu(__raw_readw(addr))); +} unsigned int fastcall ioread32(void __iomem *addr) { IO_COND(addr, return inl(port), return readl(addr)); } +unsigned int fastcall ioread32be(void __iomem *addr) +{ + IO_COND(addr, return inl(port), return be32_to_cpu(__raw_readl(addr))); +} EXPORT_SYMBOL(ioread8); EXPORT_SYMBOL(ioread16); +EXPORT_SYMBOL(ioread16be); EXPORT_SYMBOL(ioread32); +EXPORT_SYMBOL(ioread32be); void fastcall iowrite8(u8 val, void __iomem *addr) { @@ -68,13 +84,23 @@ void fastcall iowrite16(u16 val, void __iomem *addr) { IO_COND(addr, outw(val,port), writew(val, addr)); } +void fastcall iowrite16be(u16 val, void __iomem *addr) +{ + IO_COND(addr, outw(val,port), __raw_writew(cpu_to_be16(val), addr)); +} void fastcall iowrite32(u32 val, void __iomem *addr) { IO_COND(addr, outl(val,port), writel(val, addr)); } +void fastcall iowrite32be(u32 val, void __iomem *addr) +{ + IO_COND(addr, outl(val,port), __raw_writel(cpu_to_be32(val), addr)); +} EXPORT_SYMBOL(iowrite8); EXPORT_SYMBOL(iowrite16); +EXPORT_SYMBOL(iowrite16be); EXPORT_SYMBOL(iowrite32); +EXPORT_SYMBOL(iowrite32be); /* * These are the "repeat MMIO read/write" functions.