|
@@ -3320,43 +3320,25 @@ void tg3_write_indirect_mbox(struct tg3 *tp, u32 off, u32 val);
|
3320
|
3320
|
|
3321
|
3321
|
/* Functions & macros to verify TG3_FLAGS types */
|
3322
|
3322
|
|
3323
|
|
-static inline int variable_test_bit(int nr, volatile const unsigned long *addr)
|
3324
|
|
-{
|
3325
|
|
- int oldbit;
|
3326
|
|
-
|
3327
|
|
- asm volatile("bt %2,%1\n\t"
|
3328
|
|
- "sbb %0,%0"
|
3329
|
|
- : "=r" (oldbit)
|
3330
|
|
- : "m" (*(unsigned long *)addr), "Ir" (nr));
|
3331
|
|
-
|
3332
|
|
- return oldbit;
|
3333
|
|
-}
|
3334
|
|
-
|
3335
|
3323
|
static inline int _tg3_flag(enum TG3_FLAGS flag, unsigned long *bits)
|
3336
|
3324
|
{
|
3337
|
|
- return variable_test_bit(flag, bits);
|
3338
|
|
-}
|
3339
|
|
-
|
3340
|
|
-#define BITOP_ADDR(x) "+m" (*(volatile long *) (x))
|
3341
|
|
-
|
3342
|
|
-static inline void __set_bit(int nr, volatile unsigned long *addr)
|
3343
|
|
-{
|
3344
|
|
- asm volatile("bts %1,%0" : BITOP_ADDR(addr) : "Ir" (nr) : "memory");
|
|
3325
|
+ unsigned int index = ( flag / ( 8 * sizeof ( *bits ) ) );
|
|
3326
|
+ unsigned int bit = ( flag % ( 8 * sizeof ( *bits ) ) );
|
|
3327
|
+ return ( bits[index] & ( 1UL << bit ) );
|
3345
|
3328
|
}
|
3346
|
3329
|
|
3347
|
3330
|
static inline void _tg3_flag_set(enum TG3_FLAGS flag, unsigned long *bits)
|
3348
|
3331
|
{
|
3349
|
|
- __set_bit(flag, bits);
|
3350
|
|
-}
|
3351
|
|
-
|
3352
|
|
-static inline void __clear_bit(int nr, volatile unsigned long *addr)
|
3353
|
|
-{
|
3354
|
|
- asm volatile("btr %1,%0" : BITOP_ADDR(addr) : "Ir" (nr));
|
|
3332
|
+ unsigned int index = ( flag / ( 8 * sizeof ( *bits ) ) );
|
|
3333
|
+ unsigned int bit = ( flag % ( 8 * sizeof ( *bits ) ) );
|
|
3334
|
+ bits[index] |= ( 1UL << bit );
|
3355
|
3335
|
}
|
3356
|
3336
|
|
3357
|
3337
|
static inline void _tg3_flag_clear(enum TG3_FLAGS flag, unsigned long *bits)
|
3358
|
3338
|
{
|
3359
|
|
- __clear_bit(flag, bits);
|
|
3339
|
+ unsigned int index = ( flag / ( 8 * sizeof ( *bits ) ) );
|
|
3340
|
+ unsigned int bit = ( flag % ( 8 * sizeof ( *bits ) ) );
|
|
3341
|
+ bits[index] &= ~( 1UL << bit );
|
3360
|
3342
|
}
|
3361
|
3343
|
|
3362
|
3344
|
#define tg3_flag(tp, flag) \
|