diff options
author | Michael Brown <mcb30@ipxe.org> | 2016-03-12 21:15:43 +0000 |
---|---|---|
committer | Michael Brown <mcb30@ipxe.org> | 2016-03-12 21:15:43 +0000 |
commit | 86f96a40f490b1f10662a2d94a86a01276d2a125 (patch) | |
tree | 70e262f827b9a5f6e47fe31bfd19070ae2476a84 | |
parent | 7e78cdddc8a2d6446659ee2ceef45bfeea0a8285 (diff) | |
download | ipxe-86f96a40f490b1f10662a2d94a86a01276d2a125.zip ipxe-86f96a40f490b1f10662a2d94a86a01276d2a125.tar.gz ipxe-86f96a40f490b1f10662a2d94a86a01276d2a125.tar.bz2 |
[tg3] Remove x86-specific inline assembly
Signed-off-by: Michael Brown <mcb30@ipxe.org>
-rw-r--r-- | src/drivers/net/tg3/tg3.h | 36 |
1 files changed, 9 insertions, 27 deletions
diff --git a/src/drivers/net/tg3/tg3.h b/src/drivers/net/tg3/tg3.h index bfabad0..d29523a 100644 --- a/src/drivers/net/tg3/tg3.h +++ b/src/drivers/net/tg3/tg3.h @@ -3320,43 +3320,25 @@ void tg3_write_indirect_mbox(struct tg3 *tp, u32 off, u32 val); /* Functions & macros to verify TG3_FLAGS types */ -static inline int variable_test_bit(int nr, volatile const unsigned long *addr) -{ - int oldbit; - - asm volatile("bt %2,%1\n\t" - "sbb %0,%0" - : "=r" (oldbit) - : "m" (*(unsigned long *)addr), "Ir" (nr)); - - return oldbit; -} - static inline int _tg3_flag(enum TG3_FLAGS flag, unsigned long *bits) { - return variable_test_bit(flag, bits); -} - -#define BITOP_ADDR(x) "+m" (*(volatile long *) (x)) - -static inline void __set_bit(int nr, volatile unsigned long *addr) -{ - asm volatile("bts %1,%0" : BITOP_ADDR(addr) : "Ir" (nr) : "memory"); + unsigned int index = ( flag / ( 8 * sizeof ( *bits ) ) ); + unsigned int bit = ( flag % ( 8 * sizeof ( *bits ) ) ); + return ( bits[index] & ( 1UL << bit ) ); } static inline void _tg3_flag_set(enum TG3_FLAGS flag, unsigned long *bits) { - __set_bit(flag, bits); -} - -static inline void __clear_bit(int nr, volatile unsigned long *addr) -{ - asm volatile("btr %1,%0" : BITOP_ADDR(addr) : "Ir" (nr)); + unsigned int index = ( flag / ( 8 * sizeof ( *bits ) ) ); + unsigned int bit = ( flag % ( 8 * sizeof ( *bits ) ) ); + bits[index] |= ( 1UL << bit ); } static inline void _tg3_flag_clear(enum TG3_FLAGS flag, unsigned long *bits) { - __clear_bit(flag, bits); + unsigned int index = ( flag / ( 8 * sizeof ( *bits ) ) ); + unsigned int bit = ( flag % ( 8 * sizeof ( *bits ) ) ); + bits[index] &= ~( 1UL << bit ); } #define tg3_flag(tp, flag) \ |