diff options
| author | David S. Miller <davem@nuts.davemloft.net> | 2004-02-19 07:08:54 -0800 |
|---|---|---|
| committer | David S. Miller <davem@nuts.davemloft.net> | 2004-02-19 07:08:54 -0800 |
| commit | 5aff06e586de1429ff0b4a1a3072ebc7a97a73c1 (patch) | |
| tree | b84bf339fcbf692236031f7f9f69f2a90e1d1792 /include | |
| parent | 59db583040a3f0629c21b0dea425e4df1a9c9676 (diff) | |
| parent | c75b4c2a0d73a6e45c650474a2a34158807d1cc6 (diff) | |
Merge nuts.davemloft.net:/disk1/BK/sparcwork-2.6
into nuts.davemloft.net:/disk1/BK/sparc-2.6
Diffstat (limited to 'include')
| -rw-r--r-- | include/asm-sparc/atomic.h | 39 | ||||
| -rw-r--r-- | include/asm-sparc64/io.h | 31 |
2 files changed, 22 insertions, 48 deletions
diff --git a/include/asm-sparc/atomic.h b/include/asm-sparc/atomic.h index 873f806fc678..14b5a8e4da19 100644 --- a/include/asm-sparc/atomic.h +++ b/include/asm-sparc/atomic.h @@ -11,49 +11,16 @@ #define __ARCH_SPARC_ATOMIC__ #include <linux/config.h> -#include <linux/spinlock.h> typedef struct { volatile int counter; } atomic_t; #ifdef __KERNEL__ -#ifdef CONFIG_SMP - -#define ATOMIC_HASH_SIZE 4 -#define ATOMIC_HASH(a) (&__atomic_hash[(((unsigned long)a)>>8) & (ATOMIC_HASH_SIZE-1)]) -extern spinlock_t __atomic_hash[ATOMIC_HASH_SIZE]; - -#else /* SMP */ - -#define ATOMIC_HASH_SIZE 1 -#define ATOMIC_HASH(a) 0 - -#endif /* SMP */ - -static inline int __atomic_add_return(int i, atomic_t *v) -{ - int ret; - unsigned long flags; - spin_lock_irqsave(ATOMIC_HASH(v), flags); - - ret = (v->counter += i); - - spin_unlock_irqrestore(ATOMIC_HASH(v), flags); - return ret; -} - -static inline void atomic_set(atomic_t *v, int i) -{ - unsigned long flags; - spin_lock_irqsave(ATOMIC_HASH(v), flags); - - v->counter = i; - - spin_unlock_irqrestore(ATOMIC_HASH(v), flags); -} - #define ATOMIC_INIT(i) { (i) } +extern int __atomic_add_return(int, atomic_t *); +extern void atomic_set(atomic_t *, int); + #define atomic_read(v) ((v)->counter) #define atomic_add(i, v) ((void)__atomic_add_return( (int)(i), (v))) diff --git a/include/asm-sparc64/io.h b/include/asm-sparc64/io.h index 3d842cae6562..da716a21f3d0 100644 --- a/include/asm-sparc64/io.h +++ b/include/asm-sparc64/io.h @@ -31,7 +31,7 @@ extern unsigned long pci_memspace_mask; #define bus_dvma_to_mem(__vaddr) ((__vaddr) & pci_memspace_mask) -static __inline__ u8 inb(unsigned long addr) +static __inline__ u8 _inb(unsigned long addr) { u8 ret; @@ -42,7 +42,7 @@ static __inline__ u8 inb(unsigned long addr) return ret; } -static __inline__ u16 inw(unsigned long addr) +static __inline__ u16 _inw(unsigned long addr) { u16 ret; @@ -53,7 +53,7 @@ static __inline__ u16 inw(unsigned long addr) return ret; } -static __inline__ u32 inl(unsigned long addr) +static __inline__ u32 _inl(unsigned long addr) { u32 ret; @@ -64,33 +64,40 @@ static __inline__ u32 inl(unsigned long addr) return ret; } -static __inline__ void outb(u8 b, unsigned long addr) +static __inline__ void _outb(u8 b, unsigned long addr) { __asm__ __volatile__("stba\t%r0, [%1] %2\t/* pci_outb */" : /* no outputs */ : "Jr" (b), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E_L)); } -static __inline__ void outw(u16 w, unsigned long addr) +static __inline__ void _outw(u16 w, unsigned long addr) { __asm__ __volatile__("stha\t%r0, [%1] %2\t/* pci_outw */" : /* no outputs */ : "Jr" (w), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E_L)); } -static __inline__ void outl(u32 l, unsigned long addr) +static __inline__ void _outl(u32 l, unsigned long addr) { __asm__ __volatile__("stwa\t%r0, [%1] %2\t/* pci_outl */" : /* no outputs */ : "Jr" (l), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E_L)); } -#define inb_p inb -#define outb_p outb -#define inw_p inw -#define outw_p outw -#define inl_p inl -#define outl_p outl +#define inb(__addr) (_inb((unsigned long)(__addr))) +#define inw(__addr) (_inw((unsigned long)(__addr))) +#define inl(__addr) (_inl((unsigned long)(__addr))) +#define outb(__b, __addr) (_outb((u8)(__b), (unsigned long)(__addr))) +#define outw(__w, __addr) (_outw((u16)(__w), (unsigned long)(__addr))) +#define outl(__l, __addr) (_outl((u32)(__l), (unsigned long)(__addr))) + +#define inb_p(__addr) inb(__addr) +#define outb_p(__b, __addr) outb(__b, __addr) +#define inw_p(__addr) inw(__addr) +#define outw_p(__w, __addr) outw(__w, __addr) +#define inl_p(__addr) inl(__addr) +#define outl_p(__l, __addr) outl(__l, __addr) extern void outsb(unsigned long addr, const void *src, unsigned long count); extern void outsw(unsigned long addr, const void *src, unsigned long count); |
