Ticket #1280: xscale-be-descriptor-swap.patch

File xscale-be-descriptor-swap.patch, 3.3 kB (added by rudger@hopling.com, 5 years ago)

Patch fixing byte swap for xscale be platforms.

  • madwifi/ath_hal/ah_os.h

    old new  
    145145 */ 
    146146 
    147147#if (AH_BYTE_ORDER == AH_BIG_ENDIAN) 
    148 #define _OS_REG_WRITE(_ah, _reg, _val) do {                             \ 
    149         (0x4000 <= (_reg) && (_reg) < 0x5000) ?                         \ 
    150          writel((_val), (_ah)->ah_sh + (_reg)) :        \ 
    151          __raw_writel((_val), (_ah)->ah_sh + (_reg));   \ 
    152 } while (0) 
    153 #define _OS_REG_READ(_ah, _reg)                                 \ 
    154         ((0x4000 <= (_reg) && (_reg) < 0x5000) ?                \ 
    155          readl((_ah)->ah_sh + (_reg)) : \ 
    156          __raw_readl((_ah)->ah_sh + (_reg))) 
     148 
     149#if defined (AH_XSCALE_BE_SWAP) 
     150    /* 
     151     * Somehow there is no byte swap in the arm-xscale arch 
     152     * so let's byteswap the atheros registers here... 
     153     */ 
     154    static __inline__ u_int32_t 
     155    __bswap32(u_int32_t _x) 
     156    { 
     157        return ((u_int32_t)( 
     158              (((const u_int8_t *)(&_x))[0]    ) | 
     159              (((const u_int8_t *)(&_x))[1]<< 8) | 
     160              (((const u_int8_t *)(&_x))[2]<<16) | 
     161              (((const u_int8_t *)(&_x))[3]<<24)) 
     162        ); 
     163    } 
     164    #define _OS_REG_WRITE(_ah, _reg, _val) do {                 \ 
     165        if ( (_reg) >= 0x4000 && (_reg) < 0x5000)               \ 
     166            *((volatile u_int32_t *)((_ah)->ah_sh + (_reg))) =      \ 
     167                __bswap32((_val));                  \ 
     168        else                                    \ 
     169            *((volatile u_int32_t *)((_ah)->ah_sh + (_reg))) = (_val);  \ 
     170    } while (0) 
     171    #define _OS_REG_READ(_ah, _reg) \ 
     172        (((_reg) >= 0x4000 && (_reg) < 0x5000) ? \ 
     173            __bswap32(*((volatile u_int32_t *)((_ah)->ah_sh + (_reg)))) : \ 
     174            *((volatile u_int32_t *)((_ah)->ah_sh + (_reg)))) 
     175#else 
     176    #define _OS_REG_WRITE(_ah, _reg, _val) do {                  \ 
     177       (0x4000 <= (_reg) && (_reg) < 0x5000) ?                 \ 
     178        writel((_val), (_ah)->ah_sh + (_reg)) :        \ 
     179        __raw_writel((_val), (_ah)->ah_sh + (_reg));   \ 
     180    } while (0) 
     181    #define _OS_REG_READ(_ah, _reg)                            \ 
     182           ((0x4000 <= (_reg) && (_reg) < 0x5000) ?       \ 
     183            readl((_ah)->ah_sh + (_reg)) :     \ 
     184            __raw_readl((_ah)->ah_sh + (_reg))) 
     185#endif /* if defined AH_XSCALE_BE_SWAP */ 
     186 
    157187#else /* AH_LITTLE_ENDIAN */ 
    158188#define _OS_REG_WRITE(_ah, _reg, _val) do {                     \ 
    159189        writel(_val, (_ah)->ah_sh + (_reg));                    \ 
  • madwifi/hal/public/xscale-be-elf.inc

    old new  
    7474# Force register read/write operations to go through a function. 
    7575# 
    7676AH_REGOPS_FUNC=1 
     77# 
     78# Since the big endian xscale kernel doesn't swap PCI registers 
     79# the madwifi code needs to swap those. 
     80# When this isn't done the tx_complete descriptiors will not  
     81# contain any valid (usefull) information. 
     82# 
     83AH_XSCALE_BE_SWAP=1 
    7784 
    7885LDOPTS= -EB 
    7986COPTS+= -DAH_BYTE_ORDER=AH_BIG_ENDIAN 
  • madwifi/hal/public/xscale-be-elf.opt_ah.h

    old new  
    66#define AH_SUPPORT_2413 1 
    77#define AH_SUPPORT_5413 1 
    88#define AH_REGOPS_FUNC 1 
     9#define AH_XSCALE_BE_SWAP 1