Ticket #684: madwifi.pci-register.diff

File madwifi.pci-register.diff, 2.5 kB (added by mentor, 6 years ago)
  • hal/linux/ah_osdep.h

    old new  
    163163 * platforms we have to byte-swap thoese registers specifically. 
    164164 * Most of this code is collapsed at compile time because the 
    165165 * register values are constants. 
     166 * 
     167 * Presumably when talking about hardware byte-swapping, the above 
     168 * text is referring to the Atheros chipset, as the registers  
     169 * referred to are in the PCI memory address space, and these are 
     170 * never byte-swapped by PCI chipsets or bridges, but always  
     171 * written directly (as in the format defined by the manufacturer). 
    166172 */ 
    167173#if AH_BYTE_ORDER == AH_BIG_ENDIAN 
    168 #define _OS_REG_WRITE(_ah, _reg, _val) do {                                 \ 
    169         if ( (_reg) >= 0x4000 && (_reg) < 0x5000)                           \ 
    170                 *((volatile u_int32_t *)((_ah)->ah_sh + (_reg))) =          \ 
    171                         __bswap32((_val));                                  \ 
    172         else                                                                \ 
    173                 *((volatile u_int32_t *)((_ah)->ah_sh + (_reg))) = (_val);  \ 
     174#define _OS_REG_WRITE(_ah, _reg, _val) do {             \ 
     175        writel((0x4000 <= (_reg) && (_reg) < 0x5000) ?  \  
     176                __bswap32(_val) : _val,                 \ 
     177                (_ah)->ah_sh + (_reg));                 \ 
    174178} while (0) 
    175 #define _OS_REG_READ(_ah, _reg) 
    176         (((_reg) >= 0x4000 && (_reg) < 0x5000) ?
    177                 __bswap32(*((volatile u_int32_t *)((_ah)->ah_sh + (_reg)))) :
    178                 *((volatile u_int32_t *)((_ah)->ah_sh + (_reg)))) 
     179#define _OS_REG_READ(_ah, _reg)                                       
     180        ((0x4000 <= (_reg) && (_reg) < 0x5000) ?               
     181                __bswap32(readl((_ah)->ah_sh + (_reg))) :     
     182                readl((_ah)->ah_sh + (_reg))) 
    179183#else /* AH_LITTLE_ENDIAN */ 
    180 #define _OS_REG_WRITE(_ah, _reg, _val) do { 
    181         *((volatile u_int32_t *)((_ah)->ah_sh + (_reg))) = (_val);
     184#define _OS_REG_WRITE(_ah, _reg, _val) do {   
     185        writel(_val, (_ah)->ah_sh + (_reg));   
    182186} while (0) 
    183 #define _OS_REG_READ(_ah, _reg) 
    184         *((volatile u_int32_t *)((_ah)->ah_sh + (_reg))) 
     187#define _OS_REG_READ(_ah, _reg)       
     188        readl((_ah)->ah_sh + (_reg)) 
    185189#endif /* AH_BYTE_ORDER */ 
    186190 
    187191#if defined(AH_DEBUG) || defined(AH_REGOPS_FUNC) || defined(AH_DEBUG_ALQ) 
  • hal/ah.h

    old new  
    610610        u_int16_t       ah_subvendorid; /* PCI subvendor ID */ 
    611611        HAL_SOFTC       ah_sc;          /* back pointer to driver/os state */ 
    612612        HAL_BUS_TAG     ah_st;          /* params for register r+w */ 
     613        /* It's uselss having an opaque type if we have to use it in the OS specific code, right? */ 
    613614        HAL_BUS_HANDLE  ah_sh; 
    614615        HAL_CTRY_CODE   ah_countryCode; 
    615616