X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=include%2Fasm-alpha%2Fcore_t2.h;h=5c1c40338c82a1180478af35aac2df995e98231a;hb=82ba8664b914f9985d674bd8773799cd734d9835;hp=ce5ae2a5c896eda36c5dd5c0a345158aa0cdfbb7;hpb=a91482bdcc2e0f6035702e46f1b99043a0893346;p=linux-2.6.git diff --git a/include/asm-alpha/core_t2.h b/include/asm-alpha/core_t2.h index ce5ae2a5c..5c1c40338 100644 --- a/include/asm-alpha/core_t2.h +++ b/include/asm-alpha/core_t2.h @@ -199,8 +199,8 @@ struct el_t2_procdata_mcheck { struct el_t2_logout_header { unsigned int elfl_size; /* size in bytes of logout area. */ - int elfl_sbz1:31; /* Should be zero. */ - char elfl_retry:1; /* Retry flag. */ + unsigned int elfl_sbz1:31; /* Should be zero. */ + unsigned int elfl_retry:1; /* Retry flag. */ unsigned int elfl_procoffset; /* Processor-specific offset. */ unsigned int elfl_sysoffset; /* Offset of system-specific. */ unsigned int elfl_error_type; /* PAL error type code. */ @@ -357,13 +357,13 @@ struct el_t2_frame_corrected { #define vip volatile int * #define vuip volatile unsigned int * -__EXTERN_INLINE u8 t2_inb(unsigned long addr) +static inline u8 t2_inb(unsigned long addr) { long result = *(vip) ((addr << 5) + T2_IO + 0x00); return __kernel_extbl(result, addr & 3); } -__EXTERN_INLINE void t2_outb(u8 b, unsigned long addr) +static inline void t2_outb(u8 b, unsigned long addr) { unsigned long w; @@ -372,13 +372,13 @@ __EXTERN_INLINE void t2_outb(u8 b, unsigned long addr) mb(); } -__EXTERN_INLINE u16 t2_inw(unsigned long addr) +static inline u16 t2_inw(unsigned long addr) { long result = *(vip) ((addr << 5) + T2_IO + 0x08); return __kernel_extwl(result, addr & 3); } -__EXTERN_INLINE void t2_outw(u16 b, unsigned long addr) +static inline void t2_outw(u16 b, unsigned long addr) { unsigned long w; @@ -387,12 +387,12 @@ __EXTERN_INLINE void t2_outw(u16 b, unsigned long addr) mb(); } -__EXTERN_INLINE u32 t2_inl(unsigned long addr) +static inline u32 t2_inl(unsigned long addr) { return *(vuip) ((addr << 5) + T2_IO + 0x18); } -__EXTERN_INLINE void t2_outl(u32 b, unsigned long addr) +static inline void t2_outl(u32 b, unsigned long addr) { *(vuip) ((addr << 5) + T2_IO + 0x18) = b; mb(); @@ -438,8 +438,9 @@ __EXTERN_INLINE void t2_outl(u32 b, unsigned long addr) static spinlock_t t2_hae_lock = SPIN_LOCK_UNLOCKED; -__EXTERN_INLINE u8 t2_readb(unsigned long addr) +__EXTERN_INLINE u8 t2_readb(const volatile void __iomem *xaddr) { + unsigned long addr = (unsigned long) xaddr; unsigned long result, msb; unsigned long flags; spin_lock_irqsave(&t2_hae_lock, flags); @@ -451,8 +452,9 @@ __EXTERN_INLINE u8 t2_readb(unsigned long addr) return __kernel_extbl(result, addr & 3); } -__EXTERN_INLINE u16 t2_readw(unsigned long addr) +__EXTERN_INLINE u16 t2_readw(const volatile void __iomem *xaddr) { + unsigned long addr = (unsigned long) xaddr; unsigned long result, msb; unsigned long flags; spin_lock_irqsave(&t2_hae_lock, flags); @@ -468,8 +470,9 @@ __EXTERN_INLINE u16 t2_readw(unsigned long addr) * On SABLE with T2, we must use SPARSE memory even for 32-bit access, * because we cannot access all of DENSE without changing its HAE. */ -__EXTERN_INLINE u32 t2_readl(unsigned long addr) +__EXTERN_INLINE u32 t2_readl(const volatile void __iomem *xaddr) { + unsigned long addr = (unsigned long) xaddr; unsigned long result, msb; unsigned long flags; spin_lock_irqsave(&t2_hae_lock, flags); @@ -481,8 +484,9 @@ __EXTERN_INLINE u32 t2_readl(unsigned long addr) return result & 0xffffffffUL; } -__EXTERN_INLINE u64 t2_readq(unsigned long addr) +__EXTERN_INLINE u64 t2_readq(const volatile void __iomem *xaddr) { + unsigned long addr = (unsigned long) xaddr; unsigned long r0, r1, work, msb; unsigned long flags; spin_lock_irqsave(&t2_hae_lock, flags); @@ -496,8 +500,9 @@ __EXTERN_INLINE u64 t2_readq(unsigned long addr) return r1 << 32 | r0; } -__EXTERN_INLINE void t2_writeb(u8 b, unsigned long addr) +__EXTERN_INLINE void t2_writeb(u8 b, volatile void __iomem *xaddr) { + unsigned long addr = (unsigned long) xaddr; unsigned long msb, w; unsigned long flags; spin_lock_irqsave(&t2_hae_lock, flags); @@ -509,8 +514,9 @@ __EXTERN_INLINE void t2_writeb(u8 b, unsigned long addr) spin_unlock_irqrestore(&t2_hae_lock, flags); } -__EXTERN_INLINE void t2_writew(u16 b, unsigned long addr) +__EXTERN_INLINE void t2_writew(u16 b, volatile void __iomem *xaddr) { + unsigned long addr = (unsigned long) xaddr; unsigned long msb, w; unsigned long flags; spin_lock_irqsave(&t2_hae_lock, flags); @@ -526,8 +532,9 @@ __EXTERN_INLINE void t2_writew(u16 b, unsigned long addr) * On SABLE with T2, we must use SPARSE memory even for 32-bit access, * because we cannot access all of DENSE without changing its HAE. */ -__EXTERN_INLINE void t2_writel(u32 b, unsigned long addr) +__EXTERN_INLINE void t2_writel(u32 b, volatile void __iomem *xaddr) { + unsigned long addr = (unsigned long) xaddr; unsigned long msb; unsigned long flags; spin_lock_irqsave(&t2_hae_lock, flags); @@ -538,8 +545,9 @@ __EXTERN_INLINE void t2_writel(u32 b, unsigned long addr) spin_unlock_irqrestore(&t2_hae_lock, flags); } -__EXTERN_INLINE void t2_writeq(u64 b, unsigned long addr) +__EXTERN_INLINE void t2_writeq(u64 b, volatile void __iomem *xaddr) { + unsigned long addr = (unsigned long) xaddr; unsigned long msb, work; unsigned long flags; spin_lock_irqsave(&t2_hae_lock, flags); @@ -552,16 +560,15 @@ __EXTERN_INLINE void t2_writeq(u64 b, unsigned long addr) spin_unlock_irqrestore(&t2_hae_lock, flags); } -__EXTERN_INLINE unsigned long t2_ioremap(unsigned long addr, - unsigned long size - __attribute__((unused))) +__EXTERN_INLINE void __iomem *t2_ioportmap(unsigned long addr) { - return addr; + return (void __iomem *)(addr + T2_IO); } -__EXTERN_INLINE void t2_iounmap(unsigned long addr) +__EXTERN_INLINE void __iomem *t2_ioremap(unsigned long addr, + unsigned long size) { - return; + return (void __iomem *)(addr + T2_DENSE_MEM); } __EXTERN_INLINE int t2_is_ioaddr(unsigned long addr) @@ -569,30 +576,47 @@ __EXTERN_INLINE int t2_is_ioaddr(unsigned long addr) return (long)addr >= 0; } +__EXTERN_INLINE int t2_is_mmio(const volatile void __iomem *addr) +{ + return (unsigned long)addr >= T2_DENSE_MEM; +} + +/* New-style ioread interface. The mmio routines are so ugly for T2 that + it doesn't make sense to merge the pio and mmio routines. */ + +#define IOPORT(OS, NS) \ +__EXTERN_INLINE unsigned int t2_ioread##NS(void __iomem *xaddr) \ +{ \ + if (t2_is_mmio(xaddr)) \ + return t2_read##OS(xaddr - T2_DENSE_MEM); \ + else \ + return t2_in##OS((unsigned long)xaddr - T2_IO); \ +} \ +__EXTERN_INLINE void t2_iowrite##NS(u##NS b, void __iomem *xaddr) \ +{ \ + if (t2_is_mmio(xaddr)) \ + t2_write##OS(b, xaddr - T2_DENSE_MEM); \ + else \ + t2_out##OS(b, (unsigned long)xaddr - T2_IO); \ +} + +IOPORT(b, 8) +IOPORT(w, 16) +IOPORT(l, 32) + +#undef IOPORT + #undef vip #undef vuip -#ifdef __WANT_IO_DEF - -#define __inb(p) t2_inb((unsigned long)(p)) -#define __inw(p) t2_inw((unsigned long)(p)) -#define __inl(p) t2_inl((unsigned long)(p)) -#define __outb(x,p) t2_outb((x),(unsigned long)(p)) -#define __outw(x,p) t2_outw((x),(unsigned long)(p)) -#define __outl(x,p) t2_outl((x),(unsigned long)(p)) -#define __readb(a) t2_readb((unsigned long)(a)) -#define __readw(a) t2_readw((unsigned long)(a)) -#define __readl(a) t2_readl((unsigned long)(a)) -#define __readq(a) t2_readq((unsigned long)(a)) -#define __writeb(x,a) t2_writeb((x),(unsigned long)(a)) -#define __writew(x,a) t2_writew((x),(unsigned long)(a)) -#define __writel(x,a) t2_writel((x),(unsigned long)(a)) -#define __writeq(x,a) t2_writeq((x),(unsigned long)(a)) -#define __ioremap(a,s) t2_ioremap((unsigned long)(a),(s)) -#define __iounmap(a) t2_iounmap((unsigned long)(a)) -#define __is_ioaddr(a) t2_is_ioaddr((unsigned long)(a)) - -#endif /* __WANT_IO_DEF */ +#undef __IO_PREFIX +#define __IO_PREFIX t2 +#define t2_trivial_rw_bw 0 +#define t2_trivial_rw_lq 0 +#define t2_trivial_io_bw 0 +#define t2_trivial_io_lq 0 +#define t2_trivial_iounmap 1 +#include #ifdef __IO_EXTERN_INLINE #undef __EXTERN_INLINE