diff options
author | Roman Yeryomin <roman@advem.lv> | 2013-05-17 20:40:24 +0300 |
---|---|---|
committer | Roman Yeryomin <roman@advem.lv> | 2013-05-17 20:40:24 +0300 |
commit | e6d87036412b952cb083eff2dc716aee97a771f2 (patch) | |
tree | 273dd3daaa85553832d3cc6d48276229dc7fbe09 /target/linux/realtek/files/arch/rlx/include/asm | |
parent | a18fec42221baa52fff4c5ffd45ec8f32e3add36 (diff) |
Move to rsdk 3.2.4. Compiles cleanly.
Signed-off-by: Roman Yeryomin <roman@advem.lv>
Diffstat (limited to 'target/linux/realtek/files/arch/rlx/include/asm')
8 files changed, 102 insertions, 94 deletions
diff --git a/target/linux/realtek/files/arch/rlx/include/asm/atomic.h b/target/linux/realtek/files/arch/rlx/include/asm/atomic.h index b042aa26b..3cd0c4b47 100644 --- a/target/linux/realtek/files/arch/rlx/include/asm/atomic.h +++ b/target/linux/realtek/files/arch/rlx/include/asm/atomic.h @@ -47,36 +47,35 @@ * * Atomically adds @i to @v. */ + static __inline__ void atomic_add(int i, atomic_t * v) { #ifdef CONFIG_CPU_HAS_LLSC - int temp; + int temp; smp_llsc_mb(); - __asm__ __volatile__( - " .set mips3 \n" - "1: ll %0, %1 # atomic_add \n" + __asm__ __volatile__( + "1: ll %0, %1 # atomic_add \n" #if defined(CONFIG_CPU_RLX4181) || defined(CONFIG_CPU_RLX5181) || defined(CONFIG_CPU_RLX5281) " nop \n" #endif " addu %0, %2 \n" - " sc %0, %1 \n" + " sc %0, %1 \n" " beqz %0, 2f \n" " .subsection 2 \n" - "2: b 1b \n" - " .previous \n" - " .set mips0 \n" + "2: b 1b \n" + " .previous \n" : "=&r" (temp), "=m" (v->counter) : "Ir" (i), "m" (v->counter)); smp_llsc_mb(); #else - unsigned long flags; + unsigned long flags; - raw_local_irq_save(flags); - v->counter += i; - raw_local_irq_restore(flags); + raw_local_irq_save(flags); + v->counter += i; + raw_local_irq_restore(flags); #endif } @@ -90,11 +89,11 @@ static __inline__ void atomic_add(int i, atomic_t * v) static __inline__ void atomic_sub(int i, atomic_t * v) { #ifdef CONFIG_CPU_HAS_LLSC - int temp; + int temp; smp_llsc_mb(); - __asm__ __volatile__( + __asm__ __volatile__( "1: ll %0, %1 # atomic_sub \n" #if defined(CONFIG_CPU_RLX4181) || defined(CONFIG_CPU_RLX5181) || defined(CONFIG_CPU_RLX5281) " nop \n" @@ -110,11 +109,11 @@ static __inline__ void atomic_sub(int i, atomic_t * v) smp_llsc_mb(); #else - unsigned long flags; + unsigned long flags; - raw_local_irq_save(flags); - v->counter -= i; - raw_local_irq_restore(flags); + raw_local_irq_save(flags); + v->counter -= i; + raw_local_irq_restore(flags); #endif } @@ -128,7 +127,7 @@ static __inline__ int atomic_add_return(int i, atomic_t * v) int temp; smp_llsc_mb(); - __asm__ __volatile__( + __asm__ __volatile__( "1: ll %1, %2 # atomic_add_return \n" #if defined(CONFIG_CPU_RLX4181) || defined(CONFIG_CPU_RLX5181) || defined(CONFIG_CPU_RLX5281) " nop \n" @@ -149,11 +148,11 @@ static __inline__ int atomic_add_return(int i, atomic_t * v) int result; unsigned long flags; - raw_local_irq_save(flags); - result = v->counter; - result += i; - v->counter = result; - raw_local_irq_restore(flags); + raw_local_irq_save(flags); + result = v->counter; + result += i; + v->counter = result; + raw_local_irq_restore(flags); #endif return result; @@ -167,7 +166,7 @@ static __inline__ int atomic_sub_return(int i, atomic_t * v) smp_llsc_mb(); - __asm__ __volatile__( + __asm__ __volatile__( "1: ll %1, %2 # atomic_sub_return \n" #if defined(CONFIG_CPU_RLX4181) || defined(CONFIG_CPU_RLX5181) || defined(CONFIG_CPU_RLX5281) " nop \n" @@ -188,11 +187,11 @@ static __inline__ int atomic_sub_return(int i, atomic_t * v) unsigned long flags; int result; - raw_local_irq_save(flags); - result = v->counter; - result -= i; - v->counter = result; - raw_local_irq_restore(flags); + raw_local_irq_save(flags); + result = v->counter; + result -= i; + v->counter = result; + raw_local_irq_restore(flags); #endif @@ -215,7 +214,7 @@ static __inline__ int atomic_sub_if_positive(int i, atomic_t * v) smp_llsc_mb(); - __asm__ __volatile__( + __asm__ __volatile__( "1: ll %1, %2 # atomic_sub_if_positive\n" #if defined(CONFIG_CPU_RLX4181) || defined(CONFIG_CPU_RLX5181) || defined(CONFIG_CPU_RLX5281) " nop \n" @@ -240,12 +239,12 @@ static __inline__ int atomic_sub_if_positive(int i, atomic_t * v) unsigned long flags; int result; - raw_local_irq_save(flags); - result = v->counter; - result -= i; - if (result >= 0) - v->counter = result; - raw_local_irq_restore(flags); + raw_local_irq_save(flags); + result = v->counter; + result -= i; + if (result >= 0) + v->counter = result; + raw_local_irq_restore(flags); #endif return result; diff --git a/target/linux/realtek/files/arch/rlx/include/asm/barrier.h b/target/linux/realtek/files/arch/rlx/include/asm/barrier.h index 0d897ceae..8ae6695a6 100644 --- a/target/linux/realtek/files/arch/rlx/include/asm/barrier.h +++ b/target/linux/realtek/files/arch/rlx/include/asm/barrier.h @@ -74,7 +74,7 @@ : /* no input */ \ : "memory") #else -#define __sync() do { } while(0) +#define __sync() __asm__ __volatile__("" : : :"memory") #endif #define __fast_iob() \ diff --git a/target/linux/realtek/files/arch/rlx/include/asm/cmpxchg.h b/target/linux/realtek/files/arch/rlx/include/asm/cmpxchg.h index dbf73e889..ea95fdb85 100644 --- a/target/linux/realtek/files/arch/rlx/include/asm/cmpxchg.h +++ b/target/linux/realtek/files/arch/rlx/include/asm/cmpxchg.h @@ -21,13 +21,10 @@ __asm__ __volatile__( \ " .set push \n" \ " .set noat \n" \ - " .set mips3 \n" \ "1: " ld " %0, %2 # __cmpxchg_asm \n" \ " nop \n" \ " bne %0, %z3, 2f \n" \ - " .set mips0 \n" \ " move $1, %z4 \n" \ - " .set mips3 \n" \ " " st " $1, %1 \n" \ " beqz $1, 3f \n" \ "2: \n" \ @@ -48,12 +45,9 @@ __asm__ __volatile__( \ " .set push \n" \ " .set noat \n" \ - " .set mips3 \n" \ "1: " ld " %0, %2 # __cmpxchg_asm \n" \ " bne %0, %z3, 2f \n" \ - " .set mips0 \n" \ " move $1, %z4 \n" \ - " .set mips3 \n" \ " " st " $1, %1 \n" \ " beqz $1, 3f \n" \ "2: \n" \ @@ -71,13 +65,13 @@ #define __cmpxchg_asm(ld, st, m, old, new) \ ({ \ __typeof(*(m)) __ret; \ - unsigned long __flags; \ + unsigned long __flags; \ \ - raw_local_irq_save(__flags); \ - __ret = *m; \ - if (__ret == old) \ - *m = new; \ - raw_local_irq_restore(__flags); \ + raw_local_irq_save(__flags); \ + __ret = *m; \ + if (__ret == old) \ + *m = new; \ + raw_local_irq_restore(__flags); \ \ __ret; \ }) diff --git a/target/linux/realtek/files/arch/rlx/include/asm/futex.h b/target/linux/realtek/files/arch/rlx/include/asm/futex.h index bab40d064..17cdbc905 100644 --- a/target/linux/realtek/files/arch/rlx/include/asm/futex.h +++ b/target/linux/realtek/files/arch/rlx/include/asm/futex.h @@ -21,23 +21,19 @@ __asm__ __volatile__( \ " .set push \n" \ " .set noat \n" \ - " .set mips3 \n" \ - "1: ll %1, %4 # __futex_atomic_op \n" \ + "1: ll %1, %4 # __futex_atomic_op \n" \ #if defined(CONFIG_CPU_RLX4181) || defined(CONFIG_CPU_RLX5181) || defined(CONFIG_CPU_RLX5281) " nop \n" \ #endif - " .set mips0 \n" \ " " insn " \n" \ - " .set mips3 \n" \ - "2: sc $1, %2 \n" \ + "2: sc $1, %2 \n" \ " beqz $1, 1b \n" \ __WEAK_LLSC_MB \ "3: \n" \ " .set pop \n" \ - " .set mips0 \n" \ " .section .fixup,\"ax\" \n" \ - "4: li %0, %6 \n" \ - " j 3b \n" \ + "4: li %0, %6 \n" \ + " j 3b \n" \ " .previous \n" \ " .section __ex_table,\"a\" \n" \ " "__UA_ADDR "\t1b, 4b \n" \ @@ -50,7 +46,7 @@ #else #define __futex_atomic_op(insn, ret, oldval, uaddr, oparg) \ { \ - ret = -ENOSYS; \ + ret = -ENOSYS; \ } #endif @@ -124,15 +120,12 @@ futex_atomic_cmpxchg_inatomic(int __user *uaddr, int oldval, int newval) "# futex_atomic_cmpxchg_inatomic \n" " .set push \n" " .set noat \n" - " .set mips3 \n" "1: ll %0, %2 \n" #if defined(CONFIG_CPU_RLX4181) || defined(CONFIG_CPU_RLX5181) || defined(CONFIG_CPU_RLX5281) " nop \n" #endif " bne %0, %z3, 3f \n" - " .set mips0 \n" " move $1, %z4 \n" - " .set mips3 \n" "2: sc $1, %1 \n" " beqz $1, 1b \n" __WEAK_LLSC_MB diff --git a/target/linux/realtek/files/arch/rlx/include/asm/local.h b/target/linux/realtek/files/arch/rlx/include/asm/local.h index 889cc4a15..797a87e63 100644 --- a/target/linux/realtek/files/arch/rlx/include/asm/local.h +++ b/target/linux/realtek/files/arch/rlx/include/asm/local.h @@ -26,13 +26,11 @@ typedef struct */ static __inline__ long local_add_return(long i, local_t * l) { - unsigned long result; - #ifdef CONFIG_CPU_HAS_LLSC - unsigned long temp; + unsigned long result; + unsigned long temp; - __asm__ __volatile__( - " .set mips3 \n" + __asm__ __volatile__( "1: ll %1, %2 # local_add_return \n" #if defined(CONFIG_CPU_RLX4181) || defined(CONFIG_CPU_RLX5181) || defined(CONFIG_CPU_RLX5281) " nop \n" @@ -41,18 +39,18 @@ static __inline__ long local_add_return(long i, local_t * l) " sc %0, %2 \n" " beqz %0, 1b \n" " addu %0, %1, %3 \n" - " .set mips0 \n" : "=&r" (result), "=&r" (temp), "=m" (l->a.counter) : "Ir" (i), "m" (l->a.counter) : "memory"); #else - unsigned long flags; + unsigned long result; + unsigned long flags; - local_irq_save(flags); - result = l->a.counter; - result += i; - l->a.counter = result; - local_irq_restore(flags); + local_irq_save(flags); + result = l->a.counter; + result += i; + l->a.counter = result; + local_irq_restore(flags); #endif return result; @@ -60,13 +58,11 @@ static __inline__ long local_add_return(long i, local_t * l) static __inline__ long local_sub_return(long i, local_t * l) { - unsigned long result; - #ifdef CONFIG_CPU_HAS_LLSC - unsigned long temp; + unsigned long result; + unsigned long temp; - __asm__ __volatile__( - " .set mips3 \n" + __asm__ __volatile__( "1: ll %1, %2 # local_sub_return \n" #if defined(CONFIG_CPU_RLX4181) || defined(CONFIG_CPU_RLX5181) || defined(CONFIG_CPU_RLX5281) " nop \n" @@ -75,18 +71,18 @@ static __inline__ long local_sub_return(long i, local_t * l) " sc %0, %2 \n" " beqz %0, 1b \n" " subu %0, %1, %3 \n" - " .set mips0 \n" : "=&r" (result), "=&r" (temp), "=m" (l->a.counter) : "Ir" (i), "m" (l->a.counter) : "memory"); #else - unsigned long flags; + unsigned long result; + unsigned long flags; - local_irq_save(flags); - result = l->a.counter; - result -= i; - l->a.counter = result; - local_irq_restore(flags); + local_irq_save(flags); + result = l->a.counter; + result -= i; + l->a.counter = result; + local_irq_restore(flags); #endif return result; diff --git a/target/linux/realtek/files/arch/rlx/include/asm/processor.h b/target/linux/realtek/files/arch/rlx/include/asm/processor.h index 909c7b868..b4644f7eb 100644 --- a/target/linux/realtek/files/arch/rlx/include/asm/processor.h +++ b/target/linux/realtek/files/arch/rlx/include/asm/processor.h @@ -65,9 +65,8 @@ static inline void cpu_wait(void) * ==> only apply to RTL865X, it still need to check the WLAN throughput in RTL8196B */ -#ifdef CONFIG_RTL_8196C //michaelxxx -#define CONFIG_RTL819X_SUSPEND_CHECK_INTERRUPT -#ifdef CONFIG_RTL819X_SUSPEND_CHECK_INTERRUPT +#if defined(CONFIG_RTL_8196C) || defined(CONFIG_RTL_819XD) || defined(CONFIG_RTL_8196E) +#ifdef CONFIG_CPU_HAS_SLEEP extern int cpu_can_suspend, cpu_can_suspend_check_init; extern void suspend_check_interrupt_init(void); @@ -80,8 +79,8 @@ static inline void cpu_wait(void) suspend_check_interrupt_init(); cpu_can_suspend_check_init = 1; } -#endif //CONFIG_RTL819X_SUSPEND_CHECK_INTERRUPT -#endif //CONFIG_RTL8196C +#endif +#endif /* We stop the CPU to conserve power */ __cpu_wait(); diff --git a/target/linux/realtek/files/arch/rlx/include/asm/spinlock.h b/target/linux/realtek/files/arch/rlx/include/asm/spinlock.h index fc33c7878..996c825c9 100644 --- a/target/linux/realtek/files/arch/rlx/include/asm/spinlock.h +++ b/target/linux/realtek/files/arch/rlx/include/asm/spinlock.h @@ -63,6 +63,9 @@ static inline void __raw_spin_lock(raw_spinlock_t *lock) " .set noreorder \n" " \n" " ll %[ticket], %[ticket_ptr] \n" +#if defined(CONFIG_CPU_RLX4181) || defined(CONFIG_CPU_RLX5181) + " nop \n" +#endif "1: addiu %[my_ticket], %[ticket], 0x4000 \n" " sc %[my_ticket], %[ticket_ptr] \n" " beqz %[my_ticket], 3f \n" @@ -134,6 +137,9 @@ static inline unsigned int __raw_spin_trylock(raw_spinlock_t *lock) " .set noreorder \n" " \n" " ll %[ticket], %[ticket_ptr] \n" +#if defined(CONFIG_CPU_RLX4181) || defined(CONFIG_CPU_RLX5181) + " nop \n" +#endif "1: srl %[my_ticket], %[ticket], 14 \n" " andi %[my_ticket], %[my_ticket], 0x1fff \n" " andi %[now_serving], %[ticket], 0x1fff \n" @@ -188,6 +194,9 @@ static inline void __raw_read_lock(raw_rwlock_t *rw) __asm__ __volatile__( " .set noreorder # __raw_read_lock \n" "1: ll %1, %2 \n" +#if defined(CONFIG_CPU_RLX4181) || defined(CONFIG_CPU_RLX5181) + " nop \n" +#endif " bltz %1, 2f \n" " addu %1, 1 \n" " sc %1, %0 \n" @@ -195,6 +204,9 @@ static inline void __raw_read_lock(raw_rwlock_t *rw) " nop \n" " .subsection 2 \n" "2: ll %1, %2 \n" +#if defined(CONFIG_CPU_RLX4181) || defined(CONFIG_CPU_RLX5181) + " nop \n" +#endif " bltz %1, 2b \n" " addu %1, 1 \n" " b 1b \n" @@ -220,6 +232,9 @@ static inline void __raw_read_unlock(raw_rwlock_t *rw) __asm__ __volatile__( " .set noreorder # __raw_read_unlock \n" "1: ll %1, %2 \n" +#if defined(CONFIG_CPU_RLX4181) || defined(CONFIG_CPU_RLX5181) + " nop \n" +#endif " sub %1, 1 \n" " sc %1, %0 \n" " beqz %1, 2f \n" @@ -241,6 +256,9 @@ static inline void __raw_write_lock(raw_rwlock_t *rw) __asm__ __volatile__( " .set noreorder # __raw_write_lock \n" "1: ll %1, %2 \n" +#if defined(CONFIG_CPU_RLX4181) || defined(CONFIG_CPU_RLX5181) + " nop \n" +#endif " bnez %1, 2f \n" " lui %1, 0x8000 \n" " sc %1, %0 \n" @@ -248,6 +266,9 @@ static inline void __raw_write_lock(raw_rwlock_t *rw) " nop \n" " .subsection 2 \n" "2: ll %1, %2 \n" +#if defined(CONFIG_CPU_RLX4181) || defined(CONFIG_CPU_RLX5181) + " nop \n" +#endif " bnez %1, 2b \n" " lui %1, 0x8000 \n" " b 1b \n" @@ -282,6 +303,9 @@ static inline int __raw_read_trylock(raw_rwlock_t *rw) " .set noreorder # __raw_read_trylock \n" " li %2, 0 \n" "1: ll %1, %3 \n" +#if defined(CONFIG_CPU_RLX4181) || defined(CONFIG_CPU_RLX5181) + " nop \n" +#endif " bltz %1, 2f \n" " addu %1, 1 \n" " sc %1, %0 \n" @@ -307,6 +331,9 @@ static inline int __raw_write_trylock(raw_rwlock_t *rw) " .set noreorder # __raw_write_trylock \n" " li %2, 0 \n" "1: ll %1, %3 \n" +#if defined(CONFIG_CPU_RLX4181) || defined(CONFIG_CPU_RLX5181) + " nop \n" +#endif " bnez %1, 2f \n" " lui %1, 0x8000 \n" " sc %1, %0 \n" diff --git a/target/linux/realtek/files/arch/rlx/include/asm/string.h b/target/linux/realtek/files/arch/rlx/include/asm/string.h index a25225fda..4a587f74e 100644 --- a/target/linux/realtek/files/arch/rlx/include/asm/string.h +++ b/target/linux/realtek/files/arch/rlx/include/asm/string.h @@ -82,7 +82,7 @@ static __inline__ int strcmp(__const__ char *__cs, __const__ char *__ct) "addiu\t%1,1\n\t" "bnez\t%2,1b\n\t" "lbu\t%2,(%0)\n\t" -#if defined(CONFIG_CPU_RLX4180) || defined(CONFIG_CPU_RLX4181) || defined(CONFIG_CPU_RLX5181) +#if defined(CONFIG_CPU_RLX4181) || defined(CONFIG_CPU_RLX5181) "nop\n\t" #endif "move\t%2,$1\n" @@ -115,7 +115,7 @@ strncmp(__const__ char *__cs, __const__ char *__ct, size_t __count) "bnez\t%3,1b\n\t" "addiu\t%1,1\n" "2:\n\t" -#if defined(CONFIG_CPU_RLX4180) || defined(CONFIG_CPU_RLX4181) || defined(CONFIG_CPU_RLX5181) +#if defined(CONFIG_CPU_RLX4181) || defined(CONFIG_CPU_RLX5181) "nop\n\t" #endif "move\t%3,$1\n" @@ -123,7 +123,7 @@ strncmp(__const__ char *__cs, __const__ char *__ct, size_t __count) ".set\tat\n\t" ".set\treorder" : "=r" (__cs), "=r" (__ct), "=r" (__count), "=r" (__res) - : "0" (__cs), "1" (__ct), "2" (__count), "m" (*__cs), "m" (*__ct)); + : "0" (__cs), "1" (__ct), "2" (__count), "m" (*__cs), "m" (*__ct)); return __res; } |