diff options
author | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-25 08:39:55 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-25 08:39:55 -0800 |
commit | d71eecf3b8e893757cc3dec560c96a32ac090890 (patch) | |
tree | 5ca3ce995f506c8659753d24b911f5502b36e201 /include/asm-sparc | |
parent | b55813a2e50088ca30df33fa62aeed5d3adb1796 (diff) | |
parent | a54123e27779049d27d21e6c8adfee73aa2c0734 (diff) | |
download | kernel_samsung_crespo-d71eecf3b8e893757cc3dec560c96a32ac090890.zip kernel_samsung_crespo-d71eecf3b8e893757cc3dec560c96a32ac090890.tar.gz kernel_samsung_crespo-d71eecf3b8e893757cc3dec560c96a32ac090890.tar.bz2 |
Merge master.kernel.org:/pub/scm/linux/kernel/git/davem/sparc-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/davem/sparc-2.6:
[SPARC]: Try to start getting SMP back into shape.
Diffstat (limited to 'include/asm-sparc')
-rw-r--r-- | include/asm-sparc/cpudata.h | 1 | ||||
-rw-r--r-- | include/asm-sparc/smp.h | 9 | ||||
-rw-r--r-- | include/asm-sparc/spinlock.h | 25 |
3 files changed, 24 insertions, 11 deletions
diff --git a/include/asm-sparc/cpudata.h b/include/asm-sparc/cpudata.h index ec0d9ef..a2c4d51 100644 --- a/include/asm-sparc/cpudata.h +++ b/include/asm-sparc/cpudata.h @@ -18,6 +18,7 @@ typedef struct { unsigned int counter; int prom_node; int mid; + int next; } cpuinfo_sparc; DECLARE_PER_CPU(cpuinfo_sparc, __cpu_data); diff --git a/include/asm-sparc/smp.h b/include/asm-sparc/smp.h index 580c51d..98c46e3 100644 --- a/include/asm-sparc/smp.h +++ b/include/asm-sparc/smp.h @@ -81,16 +81,9 @@ static inline int smp_call_function(void (*func)(void *info), void *info, int no return 0; } -extern __volatile__ int __cpu_number_map[NR_CPUS]; -extern __volatile__ int __cpu_logical_map[NR_CPUS]; - static inline int cpu_logical_map(int cpu) { - return __cpu_logical_map[cpu]; -} -static inline int cpu_number_map(int cpu) -{ - return __cpu_number_map[cpu]; + return cpu; } static inline int hard_smp4m_processor_id(void) diff --git a/include/asm-sparc/spinlock.h b/include/asm-sparc/spinlock.h index e344c98..3350c90 100644 --- a/include/asm-sparc/spinlock.h +++ b/include/asm-sparc/spinlock.h @@ -94,7 +94,7 @@ static inline void __read_lock(raw_rwlock_t *rw) #define __raw_read_lock(lock) \ do { unsigned long flags; \ local_irq_save(flags); \ - __raw_read_lock(lock); \ + __read_lock(lock); \ local_irq_restore(flags); \ } while(0) @@ -114,11 +114,11 @@ static inline void __read_unlock(raw_rwlock_t *rw) #define __raw_read_unlock(lock) \ do { unsigned long flags; \ local_irq_save(flags); \ - __raw_read_unlock(lock); \ + __read_unlock(lock); \ local_irq_restore(flags); \ } while(0) -extern __inline__ void __raw_write_lock(raw_rwlock_t *rw) +static inline void __raw_write_lock(raw_rwlock_t *rw) { register raw_rwlock_t *lp asm("g1"); lp = rw; @@ -131,9 +131,28 @@ extern __inline__ void __raw_write_lock(raw_rwlock_t *rw) : "g2", "g4", "memory", "cc"); } +static inline int __raw_write_trylock(raw_rwlock_t *rw) +{ + unsigned int val; + + __asm__ __volatile__("ldstub [%1 + 3], %0" + : "=r" (val) + : "r" (&rw->lock) + : "memory"); + + if (val == 0) { + val = rw->lock & ~0xff; + if (val) + ((volatile u8*)&rw->lock)[3] = 0; + } + + return (val == 0); +} + #define __raw_write_unlock(rw) do { (rw)->lock = 0; } while(0) #define __raw_spin_lock_flags(lock, flags) __raw_spin_lock(lock) +#define __raw_read_trylock(lock) generic__raw_read_trylock(lock) #endif /* !(__ASSEMBLY__) */ |