Please note: This project is no longer active. The website is kept online for historic purposes only.
If you´re looking for a Linux driver for your Atheros WLAN device, you should continue here .

Ticket #1371: madwifi-trunk-hallock.diff

File madwifi-trunk-hallock.diff, 67.3 kB (added by mtaylor, 12 years ago)

Initial patch for HAL locking

  • scripts/if_ath_hal_settings.pl

    old new  
     1#!/usr/bin/perl 
     2#  
     3#  
     4# This file contains settings used to generate the HAL wrapper API for MadWifi from the  
     5# binary HAL api header.  You can edit these settings to customize the behavior of the 
     6# code generator. 
     7#  
     8 
     9# 
     10# This section contains the output file paths 
     11#  
     12$path_to_ah_h = 'hal/ah.h'; 
     13$path_to_ath_hal_api_h = 'ath/if_ath_hal.h'; 
     14$path_to_ath_hal_api_c = 'ath/if_ath_hal.c'; 
     15 
     16# 
     17# This section defines the name translation from the binary HAL's function  
     18# pointers to our API names. 
     19#  
     20%hal_function_name_to_madwifi_name = ( 
     21                     "ah_beaconInit"               => "ath_hal_beaconinit" 
     22                   , "ah_disablePhyErrDiag"        => "ath_hal_disablePhyDiag" 
     23                   , "ah_enablePhyErrDiag"         => "ath_hal_enablePhyDiag" 
     24                   , "ah_enableReceive"            => "ath_hal_rxena" 
     25                   , "ah_fillTxDesc"               => "ath_hal_filltxdesc" 
     26                   , "ah_getAckCTSRate"            => "ath_hal_getackctsrate" 
     27                   , "ah_setAckCTSRate"            => "ath_hal_setackctsrate" 
     28                   , "ah_updateMibCounters"        => "ath_hal_updatemibcounters" 
     29                   , "ah_getAntennaSwitch"         => "ath_hal_getantennaswitch" 
     30                   , "ah_setAntennaSwitch"         => "ath_hal_setantennaswitch" 
     31                   , "ah_getAckTimeout"            => "ath_hal_getacktimeout" 
     32                   , "ah_getBssIdMask"             => "ath_hal_getbssidmask" 
     33                   , "ah_getCapability"            => "ath_hal_getcapability" 
     34                   , "ah_getChanNoise"             => "ath_hal_get_channel_noise" 
     35                   , "ah_getCTSTimeout"            => "ath_hal_getctstimeout" 
     36                   , "ah_getDefAntenna"            => "ath_hal_getdefantenna" 
     37                   , "ah_getDiagState"             => "ath_hal_getdiagstate" 
     38                   , "ah_getInterrupts"            => "ath_hal_intrget" 
     39                   , "ah_getKeyCacheSize"          => "ath_hal_keycachesize" 
     40                   , "ah_getMacAddress"            => "ath_hal_getmac" 
     41                   , "ah_getPendingInterrupts"     => "ath_hal_getisr" 
     42                   , "ah_getPowerMode"             => "ath_hal_getPowerMode" 
     43                   , "ah_getRateTable"             => "ath_hal_getratetable" 
     44                   , "ah_getRfGain"                => "ath_hal_getrfgain" 
     45                   , "ah_getRxDP"                  => "ath_hal_getrxbuf" 
     46                   , "ah_getRxFilter"              => "ath_hal_getrxfilter" 
     47                   , "ah_getSlotTime"              => "ath_hal_getslottime" 
     48                   , "ah_getTsf32"                 => "ath_hal_gettsf32" 
     49                   , "ah_getTsf64"                 => "ath_hal_gettsf64" 
     50                   , "ah_getTxDP"                  => "ath_hal_gettxbuf" 
     51                   , "ah_getTxIntrQueue"           => "ath_hal_gettxintrtxqs" 
     52                   , "ah_getTxQueueProps"          => "ath_hal_gettxqueueprops" 
     53                   , "ah_gpioCfgOutput"            => "ath_hal_gpioCfgOutput" 
     54                   , "ah_gpioSet"                  => "ath_hal_gpioset" 
     55                   , "ah_gpioGet"                  => "ath_hal_gpioget" 
     56                   , "ah_gpioSetIntr"              => "ath_hal_gpiosetintr" 
     57                   , "ah_gpioCfgInput"             => "ath_hal_gpiCfgInput" 
     58                   , "ah_isInterruptPending"       => "ath_hal_intrpend" 
     59                   , "ah_isKeyCacheEntryValid"     => "ath_hal_keyisvalid" 
     60                   , "ah_numTxPending"             => "ath_hal_numtxpending" 
     61                   , "ah_perCalibration"           => "ath_hal_calibrate" 
     62                   , "ah_phyDisable"               => "ath_hal_phydisable" 
     63                   , "ah_disable"                  => "ath_hal_disable" 
     64                   , "ah_procMibEvent"             => "ath_hal_mibevent" 
     65                   , "ah_procRxDesc"               => "ath_hal_rxprocdesc" 
     66                   , "ah_procTxDesc"               => "ath_hal_txprocdesc" 
     67                   , "ah_radarWait"                => "ath_hal_radar_wait" 
     68                   , "ah_releaseTxQueue"           => "ath_hal_releasetxqueue" 
     69                   , "ah_reqTxIntrDesc"            => "ath_hal_txreqintrdesc" 
     70                   , "ah_reset"                    => "ath_hal_reset" 
     71                   , "ah_resetKeyCacheEntry"       => "ath_hal_keyreset" 
     72                   , "ah_resetStationBeaconTimers" => "ath_hal_beaconreset" 
     73                   , "ah_resetTsf"                 => "ath_hal_resettsf" 
     74                   , "ah_resetTxQueue"             => "ath_hal_resettxqueue" 
     75                   , "ah_rxMonitor"                => "ath_hal_rxmonitor" 
     76                   , "ah_setAckTimeout"            => "ath_hal_setacktimeout" 
     77                   , "ah_setBssIdMask"             => "ath_hal_setbssidmask" 
     78                   , "ah_setCapability"            => "ath_hal_setcapability" 
     79                   , "ah_setChannel"               => "ath_hal_setchannel" 
     80                   , "ah_setCoverageClass"         => "ath_hal_setcoverageclass" 
     81                   , "ah_setCTSTimeout"            => "ath_hal_setctstimeout" 
     82                   , "ah_setDecompMask"            => "ath_hal_setdecompmask" 
     83                   , "ah_setDefAntenna"            => "ath_hal_setdefantenna" 
     84                   , "ah_setInterrupts"            => "ath_hal_intrset" 
     85                   , "ah_setKeyCacheEntry"         => "ath_hal_keyset" 
     86                   , "ah_setKeyCacheEntryMac"      => "ath_hal_keysetmac" 
     87                   , "ah_setLedState"              => "ath_hal_setledstate" 
     88                   , "ah_setMacAddress"            => "ath_hal_setmac" 
     89                   , "ah_setMulticastFilter"       => "ath_hal_setmcastfilter" 
     90                   , "ah_setMulticastFilterIndex"  => "ath_hal_setmcastfilterindex" 
     91                   , "ah_setPCUConfig"             => "ath_hal_setopmode" 
     92                   , "ah_setPowerMode"             => "ath_hal_setpower" 
     93                   , "ah_setRxDP"                  => "ath_hal_putrxbuf" 
     94                   , "ah_setRxFilter"              => "ath_hal_setrxfilter" 
     95                   , "ah_setRegulatoryDomain"      => "ath_hal_setregulatorydomain" 
     96                   , "ah_setSlotTime"              => "ath_hal_setslottime" 
     97                   , "ah_setStationBeaconTimers"   => "ath_hal_beacontimers" 
     98                   , "ah_setTxDP"                  => "ath_hal_puttxbuf" 
     99                   , "ah_setTxQueueProps"          => "ath_hal_settxqueueprops" 
     100                   , "ah_setTxPowerLimit"          => "ath_hal_settxpowlimit" 
     101                   , "ah_setBeaconTimers"          => "ath_hal_setbeacontimers" 
     102                   , "ah_setupRxDesc"              => "ath_hal_setuprxdesc" 
     103                   , "ah_setupTxDesc"              => "ath_hal_setuptxdesc" 
     104                   , "ah_setupTxQueue"             => "ath_hal_setuptxqueue" 
     105                   , "ah_setupXTxDesc"             => "ath_hal_setupxtxdesc" 
     106                   , "ah_startPcuReceive"          => "ath_hal_startpcurecv" 
     107                   , "ah_startTxDma"               => "ath_hal_txstart" 
     108                   , "ah_stopDmaReceive"           => "ath_hal_stopdmarecv" 
     109                   , "ah_stopPcuReceive"           => "ath_hal_stoppcurecv" 
     110                   , "ah_stopTxDma"                => "ath_hal_stoptxdma" 
     111                   , "ah_updateCTSForBursting"     => "ath_hal_updateCTSForBursting" 
     112                   , "ah_updateTxTrigLevel"        => "ath_hal_updatetxtriglevel" 
     113                   , "ah_waitForBeaconDone"        => "ath_hal_waitforbeacon" 
     114                   , "ah_writeAssocid"             => "ath_hal_setassocid"                  
     115                   , "ah_clrMulticastFilterIndex"  => "ath_hal_clearmcastfilter" 
     116                   , "ah_detectCardPresent"        => "ath_hal_detectcardpresent" 
     117                   ); 
     118# 
     119# List any functions that should NOT be generated here (such as those that conflict with  
     120# other functions, perhaps. 
     121#  
     122@hal_functions_not_to_wrap = ( "ah_detach" ); 
     123# 
     124# Boilerplate text 
     125#  
     126$header_comment = <<EOF 
     127/* 
     128 * Wrapper macros/functions for the binary HAL to comply with local coding convention. 
     129 *  
     130 * Provides function-style calling convention using either macros or wrapper functions for function pointers in the HAL. 
     131 *  
     132 * The typical convention is ath_hal_foo(ah,p1,p2,p3,...) turns into ah->ah_foo(p1,p2,p3,...) where ah_foo  
     133 * is a function pointer and a member of the struct ath_hal (usually named ah). 
     134 * 
     135 */ 
     136EOF 
     137; 
     138# 
     139# This section defines additional HAL APIs that we we want to expose.  It  
     140# is structured the way that it is so that we can parse the declaration portion 
     141# and easily turn it into function headers, inlines in headers, 
     142# implementations in .c files, etc.. 
     143#  
     144%custom_wrappers = ( 
     145          "HAL_BOOL ath_hal_burstsupported(struct ath_hal * ah)"                                => "(ath_hal_getcapability(ah, HAL_CAP_BURST, 0, NULL) == HAL_OK)" 
     146        , "HAL_BOOL ath_hal_ciphersupported(struct ath_hal * ah, u_int32_t cipher)"             => "(ath_hal_getcapability(ah, HAL_CAP_CIPHER, cipher, NULL) == HAL_OK)" 
     147        , "HAL_BOOL ath_hal_compressionsupported(struct ath_hal * ah)"                          => "(ath_hal_getcapability(ah, HAL_CAP_COMPRESSION, 0, NULL) == HAL_OK)" 
     148        , "HAL_BOOL ath_hal_fastframesupported(struct ath_hal * ah)"                            => "(ath_hal_getcapability(ah, HAL_CAP_FASTFRAME, 0, NULL) == HAL_OK)" 
     149        , "HAL_BOOL ath_hal_getcountrycode(struct ath_hal * ah, u_int32_t* destination)"        => "((*(destination) = ah->ah_countryCode), AH_TRUE)" 
     150        , "HAL_BOOL ath_hal_getdiversity(struct ath_hal * ah)"                                  => "(ath_hal_getcapability(ah, HAL_CAP_DIVERSITY, 1, NULL) == HAL_OK)" 
     151        , "HAL_BOOL ath_hal_getmaxtxpow(struct ath_hal * ah, u_int32_t* destination)"           => "(ath_hal_getcapability(ah, HAL_CAP_TXPOW, 2, destination) == HAL_OK)" 
     152        , "HAL_BOOL ath_hal_getmcastkeysearch(struct ath_hal * ah)"                             => "(ath_hal_getcapability(ah, HAL_CAP_MCAST_KEYSRCH, 1, NULL) == HAL_OK)" 
     153        , "HAL_BOOL ath_hal_getnumtxqueues(struct ath_hal * ah, u_int32_t* destination)"        => "(ath_hal_getcapability(ah, HAL_CAP_NUM_TXQUEUES, 0, destination) == HAL_OK)" 
     154        , "HAL_BOOL ath_hal_getregdomain(struct ath_hal * ah, u_int32_t* destination)"          => "(ath_hal_getcapability(ah, HAL_CAP_REG_DMN, 0, destination))" 
     155        , "HAL_BOOL ath_hal_gettkipmic(struct ath_hal * ah)"                                    => "(ath_hal_getcapability(ah, HAL_CAP_TKIP_MIC, 1, NULL) == HAL_OK)" 
     156        , "HAL_BOOL ath_hal_gettkipsplit(struct ath_hal * ah)"                                  => "(ath_hal_getcapability(ah, HAL_CAP_TKIP_SPLIT, 1, NULL) == HAL_OK)" 
     157        , "HAL_BOOL ath_hal_gettpc(struct ath_hal * ah)"                                        => "(ath_hal_getcapability(ah, HAL_CAP_TPC, 1, NULL) == HAL_OK)" 
     158        , "HAL_BOOL ath_hal_gettpscale(struct ath_hal * ah, u_int32_t* destination)"            => "(ath_hal_getcapability(ah, HAL_CAP_TXPOW, 3, destination) == HAL_OK)" 
     159        , "HAL_BOOL ath_hal_gettsfadjust(struct ath_hal * ah)"                                  => "(ath_hal_getcapability(ah, HAL_CAP_TSF_ADJUST, 1, NULL) == HAL_OK)" 
     160        , "HAL_BOOL ath_hal_gettxpowlimit(struct ath_hal * ah, u_int32_t* destination)"         => "(ath_hal_getcapability(ah, HAL_CAP_TXPOW, 1, destination) == HAL_OK)" 
     161        , "HAL_BOOL ath_hal_halfrate_chansupported(struct ath_hal * ah)"                        => "(ath_hal_getcapability(ah, HAL_CAP_CHAN_HALFRATE, 0, NULL) == HAL_OK)" 
     162        , "HAL_BOOL ath_hal_hasbssidmask(struct ath_hal * ah)"                                  => "(ath_hal_getcapability(ah, HAL_CAP_BSSIDMASK, 0, NULL) == HAL_OK)" 
     163        , "HAL_BOOL ath_hal_hasbursting(struct ath_hal * ah)"                                   => "(ath_hal_getcapability(ah, HAL_CAP_BURST, 0, NULL) == HAL_OK)" 
     164        , "HAL_BOOL ath_hal_hascompression(struct ath_hal * ah)"                                => "(ath_hal_getcapability(ah, HAL_CAP_COMPRESSION, 0, NULL) == HAL_OK)" 
     165        , "HAL_BOOL ath_hal_hasdiversity(struct ath_hal * ah)"                                  => "(ath_hal_getcapability(ah, HAL_CAP_DIVERSITY, 0, NULL) == HAL_OK)" 
     166        , "HAL_BOOL ath_hal_hasfastframes(struct ath_hal * ah)"                                 => "(ath_hal_getcapability(ah, HAL_CAP_FASTFRAME, 0, NULL) == HAL_OK)" 
     167        , "HAL_BOOL ath_hal_hasmcastkeysearch(struct ath_hal * ah)"                             => "(ath_hal_getcapability(ah, HAL_CAP_MCAST_KEYSRCH, 0, NULL) == HAL_OK)" 
     168        , "HAL_BOOL ath_hal_hasrfsilent(struct ath_hal * ah)"                                   => "(ath_hal_getcapability(ah, HAL_CAP_RFSILENT, 0, NULL) == HAL_OK)" 
     169        , "HAL_BOOL ath_hal_hastkipmic(struct ath_hal * ah)"                                    => "(ath_hal_getcapability(ah, HAL_CAP_TKIP_MIC, 0, NULL) == HAL_OK)" 
     170        , "HAL_BOOL ath_hal_hastkipsplit(struct ath_hal * ah)"                                  => "(ath_hal_getcapability(ah, HAL_CAP_TKIP_SPLIT, 0, NULL) == HAL_OK)" 
     171        , "HAL_BOOL ath_hal_hastpc(struct ath_hal * ah)"                                        => "(ath_hal_getcapability(ah, HAL_CAP_TPC, 0, NULL) == HAL_OK)" 
     172        , "HAL_BOOL ath_hal_hastsfadjust(struct ath_hal * ah)"                                  => "(ath_hal_getcapability(ah, HAL_CAP_TSF_ADJUST, 0, NULL) == HAL_OK)" 
     173        , "HAL_BOOL ath_hal_hastxpowlimit(struct ath_hal * ah)"                                 => "(ath_hal_getcapability(ah, HAL_CAP_TXPOW, 0, NULL) == HAL_OK)" 
     174        , "HAL_BOOL ath_hal_hasveol(struct ath_hal * ah)"                                       => "(ath_hal_getcapability(ah, HAL_CAP_VEOL, 0, NULL) == HAL_OK)" 
     175        , "HAL_BOOL ath_hal_hwphycounters(struct ath_hal * ah)"                                 => "(ath_hal_getcapability(ah, HAL_CAP_PHYCOUNTERS, 0, NULL) == HAL_OK)" 
     176        , "HAL_BOOL ath_hal_quarterrate_chansupported(struct ath_hal * ah)"                     => "(ath_hal_getcapability(ah, HAL_CAP_CHAN_QUARTERRATE, 0, NULL) == HAL_OK)" 
     177        , "HAL_BOOL ath_hal_setdiversity(struct ath_hal * ah, int v)"                           => "(ath_hal_setcapability(ah, HAL_CAP_DIVERSITY, 1, v, NULL))" 
     178        , "HAL_BOOL ath_hal_setrfsilent(struct ath_hal * ah, u_int32_t v)"                      => "(ath_hal_setcapability(ah, HAL_CAP_RFSILENT, 1, v, NULL))" 
     179        , "HAL_BOOL ath_hal_settkipmic(struct ath_hal * ah, u_int32_t v)"                       => "(ath_hal_setcapability(ah, HAL_CAP_TKIP_MIC, 1, v, NULL))" 
     180        , "HAL_BOOL ath_hal_settkipsplit(struct ath_hal * ah, int v)"                           => "(ath_hal_setcapability(ah, HAL_CAP_TKIP_SPLIT, 1, v, NULL))" 
     181        , "HAL_BOOL ath_hal_settpc(struct ath_hal * ah, u_int32_t v)"                           => "(ath_hal_setcapability(ah, HAL_CAP_TPC, 1, v, NULL))" 
     182        , "HAL_BOOL ath_hal_settpscale(struct ath_hal * ah, u_int32_t v)"                       => "(ath_hal_setcapability(ah, HAL_CAP_TXPOW, 3, v, NULL))" 
     183        , "HAL_BOOL ath_hal_settsfadjust(struct ath_hal * ah, u_int32_t v)"                     => "(ath_hal_setcapability(ah, HAL_CAP_TSF_ADJUST, 1, v, NULL))" 
     184        , "HAL_BOOL ath_hal_turboagsupported(struct ath_hal * ah, int countrycode)"             => "(ath_hal_getwirelessmodes(ah, countrycode) & (HAL_MODE_108G|HAL_MODE_TURBO))" 
     185        , "HAL_BOOL ath_hal_wmetkipmic(struct ath_hal * ah)"                                    => "(ath_hal_getcapability(ah, HAL_CAP_WME_TKIPMIC, 0, NULL) == HAL_OK)" 
     186        , "HAL_BOOL ath_hal_xrsupported(struct ath_hal * ah)"                                   => "(ath_hal_getcapability(ah, HAL_CAP_XR, 0, NULL) == HAL_OK)" 
     187); 
     188 
     189 
     190# 
     191# This text is generated verbatim at the top of the .h file,  
     192# before generated content is added. 
     193#  
     194$header_for_h = <<EOF 
     195$header_comment 
     196#ifndef _IF_ATH_HAL_H 
     197#define _IF_ATH_HAL_H 
     198 
     199#define GET_ATH_SOFTC(_ah)      ((struct ath_softc*)(_ah->ah_sc)) 
     200#define ATH_HAL_LOCK_INIT(_sc)  spin_lock_init(&(_sc)->sc_hal_lock) 
     201#define ATH_HAL_LOCK_DESTROY(_sc) 
     202#define ATH_HAL_LOCK_IRQ(_sc)   do { \\ 
     203   unsigned long __sc_halLockflags; \\ 
     204   spin_lock_irqsave(&(_sc)->sc_hal_lock, __sc_halLockflags);    
     205#define ATH_HAL_UNLOCK_IRQ(_sc) \\ 
     206   spin_unlock_irqrestore(&(_sc)->sc_hal_lock, __sc_halLockflags); \\ 
     207   } while(0) 
     208#define ATH_HAL_UNLOCK_IRQ_EARLY(_sc) \\ 
     209   spin_unlock_irqrestore(&(_sc)->sc_hal_lock, __sc_halLockflags); 
     210 
     211static inline void 
     212ath_reg_write(struct ath_softc *sc, u_int reg, u_int32_t val) { 
     213        ATH_HAL_LOCK_IRQ(sc); 
     214        OS_REG_WRITE(sc->sc_ah, reg, val); 
     215        ATH_HAL_UNLOCK_IRQ(sc); 
     216} 
     217 
     218static inline u_int32_t 
     219ath_reg_read(struct ath_softc *sc, u_int reg) { 
     220        u_int32_t ret; 
     221        ATH_HAL_LOCK_IRQ(sc); 
     222        ret = OS_REG_READ(sc->sc_ah, reg); 
     223        ATH_HAL_UNLOCK_IRQ(sc); 
     224        return ret; 
     225} 
     226 
     227/* 
     228These wrappers are generated by scripts/regenerate_ath_hal_api.pl and are used  
     229to protect access to the HAL with locking as well as providing improved 
     230debugging support, despite obfuscation. 
     231*/ 
     232EOF 
     233; 
     234 
     235# 
     236# This text is generated verbatim at the bottom of the .h file 
     237#  
     238$footer_for_h = <<EOF 
     239 
     240#endif /* _IF_ATH_HAL_H */ 
     241EOF 
     242; 
     243# 
     244# This text is generated verbatim at the top of the .c file 
     245#  
     246$header_for_c = <<EOF 
     247$header_comment 
     248#include "opt_ah.h" 
     249 
     250#ifdef AH_HALOPS_FUNC 
     251 
     252#ifndef AUTOCONF_INCLUDED 
     253#include <linux/config.h> 
     254#endif 
     255#include <linux/version.h> 
     256#include <linux/module.h> 
     257#include <linux/init.h> 
     258#include <linux/skbuff.h> 
     259#include <linux/netdevice.h> 
     260#include <linux/etherdevice.h> 
     261#include <linux/random.h> 
     262#include <linux/delay.h> 
     263#include <linux/cache.h> 
     264#include <linux/sysctl.h> 
     265#include <linux/proc_fs.h> 
     266#include <linux/if_arp.h> 
     267#include <linux/rtnetlink.h> 
     268#include <asm/uaccess.h> 
     269 
     270#include "ath_hal_api.h" 
     271EOF 
     272; 
     273# 
     274# This text is generated verbatim at the bottom of the .c file 
     275#  
     276$footer_for_c = <<EOF 
     277 
     278#endif /* #ifndef AH_HALOPS_FUNC */ 
     279EOF 
     280; 
     281 
  • scripts/if_ath_hal_generator.pl

    old new  
     1#!/usr/bin/perl 
     2strict; 
     3use warnings; 
     4require 'dumpvar.pl'; 
     5 
     6# 
     7# Workaround for perl's warning mechanism, avoids 'possible typo' for every setting used only one time. 
     8#  
     9  
     10$header_for_c = undef; 
     11$footer_for_c = undef; 
     12$header_for_h = undef;  
     13$footer_for_h = undef; 
     14$hal_functions_not_to_wrap = undef; 
     15require "scripts/if_ath_hal_settings.pl"; 
     16 
     17# 
     18# Parsed Function Data  
     19#  
     20 
     21# list of declarations in document order 
     22@hal_prototypes = (); 
     23# hash of string->string (hal's function name to return type) 
     24%hal_functionname_to_return_type = (); 
     25# hash of string->list of strings (ordered list of parameter names) 
     26%hal_functionname_to_parameter_name_array = (); 
     27# hash of string->list of strings (ordered list of parameter types) 
     28%hal_functionname_to_parameter_types_array = (); 
     29# hash of string->string (hal's function name to return type) 
     30%wrapper_functionname_to_return_type = (); 
     31# hash of string->string (hal's function name to expression) 
     32%wrapper_functionname_to_expression = (); 
     33# hash of string->list of strings (ordered list of wrapper function parameter names) 
     34%wrapper_functionname_to_parameter_name_array = (); 
     35# hash of string->list of strings (ordered list of wrapper function parameter types) 
     36%wrapper_functionname_to_parameter_types_array = (); 
     37 
     38# 
     39# Open the files we need 
     40#  
     41if(!open AH_H, "<$path_to_ah_h") { 
     42   die "Cannot open $path_to_ah_h: $!"; 
     43} 
     44if(!open ATH_HAL_API_H, ">$path_to_ath_hal_api_h") { 
     45   close AH_H; 
     46   die "Cannot open $path_to_ath_hal_api_h: $!"; 
     47} 
     48if(!open ATH_HAL_API_C, ">$path_to_ath_hal_api_c") { 
     49   close AH_H; 
     50   close ATH_HAL_API_H; 
     51   die "Cannot open $path_to_ath_hal_api_c: $!"; 
     52} 
     53 
     54# Parse and scrub the hal structure's member function declarations  
     55$line_continued = 0; 
     56$line_buffer = ""; 
     57foreach (<AH_H>) { 
     58   chomp($_); 
     59   s/\s+$//g; 
     60   s/^\s+//g; 
     61   s/\s+/ /g; 
     62   if (/__ahdecl\s*\(.*/ || $line_continued) { 
     63      $line_buffer .= "$_"; 
     64      if (/__ahdecl.*;/ || ($line_continued && /;/)) { 
     65         push @hal_prototypes, $line_buffer; 
     66         $line_buffer = ""; 
     67         $line_continued = 0; 
     68      } 
     69      else { 
     70         $line_buffer .= " "; 
     71         $line_continued = 1; 
     72      } 
     73   } 
     74} 
     75# 
     76# Now pick apart the return type, parameter types, and parameter names for each HAL function 
     77#  
     78foreach $proto (@hal_prototypes) { 
     79   $proto =~ /^((?:(?:const|struct)\s*)*[^\s]+[\s]*\*?)[\s]*__ahdecl\(\*([^\)]*)\)\((.*)\);/; 
     80   my $return_type   = $1; 
     81   my $member_name   = $2; 
     82   my $parameterlist = $3; 
     83   if(! grep{/$member_name/} @hal_functions_not_to_wrap ) { 
     84      $hal_functionname_to_return_type{"$member_name"} = $return_type; 
     85      @{$hal_functionname_to_parameter_name_array{"$member_name"}} = (); 
     86      @{$hal_functionname_to_parameter_types_array{"$member_name"}} = (); 
     87      my @parameters = split /,\s?/, $parameterlist; 
     88      $argnum = 0; 
     89      $first = 1; 
     90      foreach(@parameters) { 
     91         $_ =~ s/ \*/\* /; 
     92         $_ =~ /^((?:(?:const|struct|\*)\s*)*)([^\s]+\*?)\s*([^\s]*)\s*/; 
     93         my $type = "$1$2"; 
     94         my $name = "$3"; 
     95         if(0 == length($name)) { 
     96            if($argnum == 0 && $type =~ /ath_hal/) { 
     97               $name = "ah"; 
     98            } 
     99            else { 
     100               $name = "a" . $argnum; 
     101            } 
     102         } 
     103          
     104         push @{$hal_functionname_to_parameter_name_array{$member_name}}, $name; 
     105         push @{$hal_functionname_to_parameter_types_array{$member_name}}, $type; 
     106         $first = 0; 
     107         $argnum++; 
     108      } 
     109   } 
     110} 
     111 
     112# 
     113# Now pick apart the return type, parameter types, and parameter names for each HAL wrapper 
     114#  
     115foreach $proto (keys %custom_wrappers) { 
     116   $proto =~ /^((?:(?:const|struct|\*))*\s*[^\s]+)[\s]*([^\(]*)\((.*)\)/; 
     117   my $return_type   = $1; 
     118   my $wrapper_name   = $2; 
     119   my $parameterlist = $3; 
     120   $wrapper_functionname_to_return_type{$wrapper_name} = $return_type; 
     121   $wrapper_functionname_to_expression{$wrapper_name} = $custom_wrappers{$proto}; 
     122   @{$wrapper_functionname_to_parameter_name_array{$wrapper_name}} = (); 
     123   @{$wrapper_functionname_to_parameter_types_array{$wrapper_name}} = (); 
     124   my @parameters = split /,\s?/, $parameterlist; 
     125   $argnum = 0; 
     126   $first = 1; 
     127   foreach(@parameters) { 
     128      $_ =~ s/ \*/\* /; 
     129      $_ =~ /^((?:(?:const|struct|\*)\s*)*)([^\s]+\*?)\s*([^\s]*)\s*/; 
     130      my $type = "$1$2"; 
     131      my $name = "$3"; 
     132      if(0 == length($name)) { 
     133         if($argnum == 0 && $type =~ /ath_hal/) { 
     134            $name = "ah"; 
     135         } 
     136         else { 
     137            $name = "a" . $argnum; 
     138         } 
     139      } 
     140       
     141      push @{$wrapper_functionname_to_parameter_name_array{$wrapper_name}}, $name; 
     142      push @{$wrapper_functionname_to_parameter_types_array{$wrapper_name}}, $type; 
     143      $first = 0; 
     144      $argnum++; 
     145   } 
     146} 
     147 
     148# 
     149# Generate the header file 
     150#  
     151print ATH_HAL_API_H $header_for_h; 
     152 
     153for $member_name (keys %hal_functionname_to_return_type) { 
     154   my $api_return_type   = $hal_functionname_to_return_type{$member_name}; 
     155   my $api_name          = $member_name; 
     156   if(exists $hal_function_name_to_madwifi_name{$member_name}) { 
     157      $api_name = $hal_function_name_to_madwifi_name{$member_name}; 
     158   }    
     159   print ATH_HAL_API_H "static inline " . $api_return_type . " " . $api_name . "("; 
     160   my @names = @{$hal_functionname_to_parameter_name_array{$member_name}}; 
     161   my @types = @{$hal_functionname_to_parameter_types_array{$member_name}}; 
     162   for $i (0..$#names) { 
     163      if($i) { 
     164         print ATH_HAL_API_H ", "; 
     165      } 
     166      print ATH_HAL_API_H $types[$i] . " " . $names[$i]; 
     167   } 
     168   print ATH_HAL_API_H ") {"; 
     169   if(! ($api_return_type =~ /void/ )) { 
     170      print ATH_HAL_API_H "\n\t" . $api_return_type . " ret;"; 
     171   } 
     172   print ATH_HAL_API_H "\n\tATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah));"; 
     173   print ATH_HAL_API_H "\n\t"; 
     174   if(! ($api_return_type =~ /void/ )) { 
     175      print ATH_HAL_API_H "ret = "; 
     176   } 
     177 
     178   print ATH_HAL_API_H "ah->$member_name("; 
     179   for $j (0..$#names) { 
     180      if($j) { 
     181         print ATH_HAL_API_H ", "; 
     182      } 
     183      print ATH_HAL_API_H $names[$j]; 
     184   } 
     185   print ATH_HAL_API_H ");"; 
     186   print ATH_HAL_API_H "\n\tATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah));"; 
     187   if(! ($api_return_type =~ /void/ )) { 
     188      print ATH_HAL_API_H "\n\treturn ret;"; 
     189   } 
     190   print ATH_HAL_API_H "\n};\n"; 
     191} 
     192print ATH_HAL_API_H <<EOF 
     193/* 
     194These custom wrappers are defined in scripts/regenerate_ath_hal_api.pl and are used  
     195as shortcut accessors for HAL functions. 
     196*/ 
     197EOF 
     198; 
     199for $wrapper_name (keys %wrapper_functionname_to_return_type) { 
     200   my $api_return_type   = $wrapper_functionname_to_return_type{$wrapper_name}; 
     201   my $api_name      = $wrapper_name; 
     202   if(exists $hal_function_name_to_madwifi_name{$wrapper_name}) { 
     203      $api_name = $hal_function_name_to_madwifi_name{$wrapper_name}; 
     204   } 
     205   print ATH_HAL_API_H "static inline " . $api_return_type . " " . $api_name . "("; 
     206   my @names = @{$wrapper_functionname_to_parameter_name_array{$wrapper_name}}; 
     207   my @types = @{$wrapper_functionname_to_parameter_types_array{$wrapper_name}}; 
     208   for $i (0..$#names) { 
     209      if($i) { 
     210         print ATH_HAL_API_H ", "; 
     211      } 
     212      print ATH_HAL_API_H $types[$i] . " " . $names[$i]; 
     213   } 
     214   print ATH_HAL_API_H ") {"; 
     215   print ATH_HAL_API_H "\n\t"; 
     216   if(! ($api_return_type =~ /void/ )) { 
     217      print ATH_HAL_API_H "return "; 
     218   } 
     219   print ATH_HAL_API_H "(" . $wrapper_functionname_to_expression{"$wrapper_name"} . ");"; 
     220   print ATH_HAL_API_H "\n};\n"; 
     221} 
     222 
     223print ATH_HAL_API_H $footer_for_h; 
     224 
     225# 
     226# Generate the implementation file 
     227#  
     228print ATH_HAL_API_C $header_for_c; 
     229#foreach (<AH_H>) { 
     230#   print ATH_HAL_API_C "$_"; 
     231#} 
     232print ATH_HAL_API_C $footer_for_c; 
     233 
     234# Close up the files 
     235close AH_H; 
     236close ATH_HAL_API_H; 
     237close ATH_HAL_API_C; 
     238 
  • ath_rate/onoe/onoe.c

    old new  
    6161#include <net80211/ieee80211_rate.h> 
    6262 
    6363#include "if_athvar.h" 
     64#include "if_ath_hal.h" 
    6465#include "ah_desc.h" 
    6566 
    6667#include "onoe.h" 
  • ath_rate/amrr/amrr.c

    old new  
    6565#include <net80211/ieee80211_rate.h> 
    6666 
    6767#include "if_athvar.h" 
     68#include "if_ath_hal.h" 
    6869#include "ah_desc.h" 
    6970 
    7071#include "amrr.h" 
  • ath_rate/sample/sample.c

    old new  
    6363#include <net80211/ieee80211_rate.h> 
    6464 
    6565#include "if_athvar.h" 
     66#include "if_ath_hal.h" 
    6667#include "ah_desc.h" 
    6768 
    6869#include "sample.h" 
  • ath_rate/minstrel/minstrel.c

    old new  
    112112#include <net80211/ieee80211_rate.h> 
    113113 
    114114#include "if_athvar.h" 
     115#include "if_ath_hal.h" 
    115116#include "ah_desc.h" 
    116117 
    117118#include "minstrel.h" 
  • ath_hal/ah_os.h

    old new  
    3838#ifndef _ATH_AH_OS_H_ 
    3939#define _ATH_AH_OS_H_ 
    4040 
    41 #include <ah.h> 
    42  
    4341/* 
    4442 * Atheros Hardware Access Layer (HAL) OS Dependent Definitions. 
    4543 */ 
    4644 
     45/*  
     46MadWifi safe register operations: 
     47 
     48        When hacking on registers directly we need to use the macros 
     49        below, to avoid concurrent PCI access and abort mode errors. 
     50 
     51        * ath_reg_read 
     52        * ATH_REG_WRITE 
     53 
     54HAL-ONLY register operations:  
     55 
     56        * _OS_REG_READ 
     57        * _OS_REG_WRITE 
     58        * OS_REG_READ 
     59        * OS_REG_WRITE 
     60        * ath_hal_reg_read. 
     61        * ath_hal_reg_write 
     62 
     63        When compiled in HAL: 
     64                * We do not require locking overhead and function call unless user is debugging. 
     65                * All HAL operations are executed in the context of a MadWifi wrapper call which holds  
     66                  the HAL lock. 
     67                * Normally HAL is build with the non-modified version of this file so it doesnt have our  
     68                  funny macros anyway. 
     69 
     70        When compiled in MadWifi: 
     71                * The HAL wrapper API takes the HAL lock before invoking the HAL. 
     72                * HAL access is already protected, and MadWifi must NOT access the functions listed above. 
     73 
     74*/ 
     75 
    4776/* 
    4877 * When building the HAL proper we use no GPL-contaminated include 
    4978 * files and must define these types ourself.  Beware of these being 
     
    143172 * never byte-swapped by PCI chipsets or bridges, but always  
    144173 * written directly (i.e. the format defined by the manufacturer). 
    145174 */ 
    146  
    147175#if (AH_BYTE_ORDER == AH_BIG_ENDIAN) 
    148176#define _OS_REG_WRITE(_ah, _reg, _val) do {                     \ 
    149177        (0x4000 <= (_reg) && (_reg) < 0x5000) ?                 \ 
     
    164192        readl((_ah)->ah_sh + (_reg)) 
    165193#endif /* AH_BYTE_ORDER */ 
    166194 
     195/*  
     196The functions in this section are not intended to be invoked by MadWifi driver 
     197code, but by the HAL.  They are NOT safe for direct invocation when the  
     198sc->sc_hal_lock is not held.  Use ath_reg_read and ATH_REG_WRITE instead! 
     199*/ 
    167200#if defined(AH_DEBUG) || defined(AH_REGOPS_FUNC) || defined(AH_DEBUG_ALQ) 
    168 /* use functions to do register operations */ 
    169201#define OS_REG_WRITE(_ah, _reg, _val)   ath_hal_reg_write(_ah, _reg, _val) 
    170202#define OS_REG_READ(_ah, _reg)          ath_hal_reg_read(_ah, _reg) 
    171  
    172 extern  void __ahdecl ath_hal_reg_write(struct ath_hal *ah, 
    173                 u_int reg, u_int32_t val); 
     203extern  void __ahdecl ath_hal_reg_write(struct ath_hal *ah, u_int reg, u_int32_t val); 
    174204extern  u_int32_t __ahdecl ath_hal_reg_read(struct ath_hal *ah, u_int reg); 
    175205#else 
    176 /* inline register operations */ 
    177206#define OS_REG_WRITE(_ah, _reg, _val)   _OS_REG_WRITE(_ah, _reg, _val) 
    178207#define OS_REG_READ(_ah, _reg)          _OS_REG_READ(_ah, _reg) 
    179208#endif /* AH_DEBUG || AH_REGFUNC || AH_DEBUG_ALQ */ 
  • ath_hal/ah_os.c

    old new  
    223223                return ath_hal_setlogging(enable); 
    224224} 
    225225 
     226/*  
     227This should only be called while holding the lock, sc->sc_hal_lock. 
     228*/ 
    226229static struct ale * 
    227230ath_hal_alq_get(struct ath_hal *ah) 
    228231{ 
    229232        struct ale *ale; 
    230  
    231233        if (ath_hal_alq_emitdev) { 
    232234                ale = alq_get(ath_hal_alq, ALQ_NOWAIT); 
    233235                if (ale) { 
     
    247249        return ale; 
    248250} 
    249251 
     252/*  
     253This should only be called while holding the lock, sc->sc_hal_lock. 
     254*/ 
    250255void __ahdecl 
    251256ath_hal_reg_write(struct ath_hal *ah, u_int32_t reg, u_int32_t val) 
    252257{ 
     
    269274} 
    270275EXPORT_SYMBOL(ath_hal_reg_write); 
    271276 
     277/*  
     278This should only be called while holding the lock, sc->sc_hal_lock. 
     279*/ 
    272280u_int32_t __ahdecl 
    273281ath_hal_reg_read(struct ath_hal *ah, u_int32_t reg) 
    274282{ 
    275283        u_int32_t val; 
    276  
    277284        val = _OS_REG_READ(ah, reg); 
    278285        if (ath_hal_alq) { 
    279286                unsigned long flags; 
    280287                struct ale *ale; 
    281288 
    282                 local_irq_save(flags); 
    283289                ale = ath_hal_alq_get(ah); 
    284290                if (ale) { 
    285291                        struct athregrec *r = (struct athregrec *) ale->ae_data; 
     
    288294                        r->val = val; 
    289295                        alq_post(ath_hal_alq, ale); 
    290296                } 
    291                 local_irq_restore(flags); 
    292297        } 
    293298        return val; 
    294299} 
    295300EXPORT_SYMBOL(ath_hal_reg_read); 
    296301 
     302/*  
     303 * This should only be called while holding the lock, sc->sc_hal_lock. 
     304 */ 
    297305void __ahdecl 
    298306OS_MARK(struct ath_hal *ah, u_int id, u_int32_t v) 
    299307{ 
    300308        if (ath_hal_alq) { 
    301                 unsigned long flags; 
    302309                struct ale *ale; 
    303310 
    304                 local_irq_save(flags); 
    305311                ale = ath_hal_alq_get(ah); 
    306312                if (ale) { 
    307313                        struct athregrec *r = (struct athregrec *) ale->ae_data; 
     
    310316                        r->val = v; 
    311317                        alq_post(ath_hal_alq, ale); 
    312318                } 
    313                 local_irq_restore(flags); 
    314319        } 
    315320} 
    316321EXPORT_SYMBOL(OS_MARK); 
     
    322327 * for architectures that might need to do something before 
    323328 * referencing memory (e.g. remap an i/o window). 
    324329 * 
     330 * This should only be called while holding the lock, sc->sc_hal_lock. 
     331 * 
    325332 * NB: see the comments in ah_osdep.h about byte-swapping register 
    326333 *     reads and writes to understand what's going on below. 
    327334 */ 
     
    336343} 
    337344EXPORT_SYMBOL(ath_hal_reg_write); 
    338345 
     346/*  
     347This should only be called while holding the lock, sc->sc_hal_lock. 
     348*/ 
    339349u_int32_t __ahdecl 
    340350ath_hal_reg_read(struct ath_hal *ah, u_int reg) 
    341351{ 
  • ath_hal/Makefile

    old new  
    4949include $(TOP)/Makefile.inc 
    5050 
    5151obj-m           += ath_hal.o 
    52 ath_hal-objs    := ah_os.o ath_hal_api.o $(TARGET).hal.o 
     52ath_hal-objs    := ah_os.o $(TARGET).hal.o 
    5353 
    5454hostprogs-y     := uudecode 
    5555 
  • ath/if_ath_hal.c

    old new  
     1/* 
     2 * Wrapper macros/functions for the binary HAL to comply with local coding convention. 
     3 *  
     4 * Provides function-style calling convention using either macros or wrapper functions for function pointers in the HAL. 
     5 *  
     6 * The typical convention is ath_hal_foo(ah,p1,p2,p3,...) turns into ah->ah_foo(p1,p2,p3,...) where ah_foo  
     7 * is a function pointer and a member of the struct ath_hal (usually named ah). 
     8 * 
     9 */ 
     10 
     11#include "opt_ah.h" 
     12 
     13#ifdef AH_HALOPS_FUNC 
     14 
     15#ifndef AUTOCONF_INCLUDED 
     16#include <linux/config.h> 
     17#endif 
     18#include <linux/version.h> 
     19#include <linux/module.h> 
     20#include <linux/init.h> 
     21#include <linux/skbuff.h> 
     22#include <linux/netdevice.h> 
     23#include <linux/etherdevice.h> 
     24#include <linux/random.h> 
     25#include <linux/delay.h> 
     26#include <linux/cache.h> 
     27#include <linux/sysctl.h> 
     28#include <linux/proc_fs.h> 
     29#include <linux/if_arp.h> 
     30#include <linux/rtnetlink.h> 
     31#include <asm/uaccess.h> 
     32 
     33#include "ath_hal_api.h" 
     34 
     35#endif /* #ifndef AH_HALOPS_FUNC */ 
  • ath/if_ath_hal.h

    old new  
     1/* 
     2 * Wrapper macros/functions for the binary HAL to comply with local coding convention. 
     3 *  
     4 * Provides function-style calling convention using either macros or wrapper functions for function pointers in the HAL. 
     5 *  
     6 * The typical convention is ath_hal_foo(ah,p1,p2,p3,...) turns into ah->ah_foo(p1,p2,p3,...) where ah_foo  
     7 * is a function pointer and a member of the struct ath_hal (usually named ah). 
     8 * 
     9 */ 
     10 
     11#ifndef _IF_ATH_HAL_H 
     12#define _IF_ATH_HAL_H 
     13 
     14#define GET_ATH_SOFTC(_ah)      ((struct ath_softc*)(_ah->ah_sc)) 
     15#define ATH_HAL_LOCK_INIT(_sc)  spin_lock_init(&(_sc)->sc_hal_lock) 
     16#define ATH_HAL_LOCK_DESTROY(_sc) 
     17#define ATH_HAL_LOCK_IRQ(_sc)   do { \ 
     18   unsigned long __sc_halLockflags; \ 
     19   spin_lock_irqsave(&(_sc)->sc_hal_lock, __sc_halLockflags);    
     20#define ATH_HAL_UNLOCK_IRQ(_sc) \ 
     21   spin_unlock_irqrestore(&(_sc)->sc_hal_lock, __sc_halLockflags); \ 
     22   } while(0) 
     23#define ATH_HAL_UNLOCK_IRQ_EARLY(_sc) \ 
     24   spin_unlock_irqrestore(&(_sc)->sc_hal_lock, __sc_halLockflags); 
     25 
     26static inline void 
     27ath_reg_write(struct ath_softc *sc, u_int reg, u_int32_t val) { 
     28        ATH_HAL_LOCK_IRQ(sc); 
     29        OS_REG_WRITE(sc->sc_ah, reg, val); 
     30        ATH_HAL_UNLOCK_IRQ(sc); 
     31} 
     32 
     33static inline u_int32_t 
     34ath_reg_read(struct ath_softc *sc, u_int reg) { 
     35        u_int32_t ret; 
     36        ATH_HAL_LOCK_IRQ(sc); 
     37        ret = OS_REG_READ(sc->sc_ah, reg); 
     38        ATH_HAL_UNLOCK_IRQ(sc); 
     39        return ret; 
     40} 
     41 
     42/* 
     43These wrappers are generated by scripts/regenerate_ath_hal_api.pl and are used  
     44to protect access to the HAL with locking as well as providing improved 
     45debugging support, despite obfuscation. 
     46*/ 
     47static inline void  ath_hal_getmac(struct ath_hal* ah, u_int8_t* a1) { 
     48        ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah)); 
     49        ah->ah_getMacAddress(ah, a1); 
     50        ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah)); 
     51}; 
     52static inline HAL_POWER_MODE  ath_hal_getPowerMode(struct ath_hal* ah) { 
     53        HAL_POWER_MODE  ret; 
     54        ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah)); 
     55        ret = ah->ah_getPowerMode(ah); 
     56        ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah)); 
     57        return ret; 
     58}; 
     59static inline HAL_BOOL  ath_hal_getdiagstate(struct ath_hal* ah, int request, const void* args, u_int32_t argsize, void* *result, u_int32_t* resultsize) { 
     60        HAL_BOOL  ret; 
     61        ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah)); 
     62        ret = ah->ah_getDiagState(ah, request, args, argsize, *result, resultsize); 
     63        ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah)); 
     64        return ret; 
     65}; 
     66static inline void  ath_hal_beaconreset(struct ath_hal* ah) { 
     67        ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah)); 
     68        ah->ah_resetStationBeaconTimers(ah); 
     69        ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah)); 
     70}; 
     71static inline void  ath_hal_setcoverageclass(struct ath_hal* ah, u_int8_t a1, int a2) { 
     72        ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah)); 
     73        ah->ah_setCoverageClass(ah, a1, a2); 
     74        ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah)); 
     75}; 
     76static inline u_int64_t  ath_hal_gettsf64(struct ath_hal* ah) { 
     77        u_int64_t  ret; 
     78        ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah)); 
     79        ret = ah->ah_getTsf64(ah); 
     80        ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah)); 
     81        return ret; 
     82}; 
     83static inline void  ath_hal_rxena(struct ath_hal* ah) { 
     84        ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah)); 
     85        ah->ah_enableReceive(ah); 
     86        ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah)); 
     87}; 
     88static inline HAL_ANT_SETTING  ath_hal_getantennaswitch(struct ath_hal* ah) { 
     89        HAL_ANT_SETTING  ret; 
     90        ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah)); 
     91        ret = ah->ah_getAntennaSwitch(ah); 
     92        ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah)); 
     93        return ret; 
     94}; 
     95static inline HAL_BOOL  ath_hal_gpioset(struct ath_hal* ah, u_int32_t gpio, u_int32_t val) { 
     96        HAL_BOOL  ret; 
     97        ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah)); 
     98        ret = ah->ah_gpioSet(ah, gpio, val); 
     99        ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah)); 
     100        return ret; 
     101}; 
     102static inline HAL_BOOL  ath_hal_gpioCfgOutput(struct ath_hal* ah, u_int32_t gpio) { 
     103        HAL_BOOL  ret; 
     104        ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah)); 
     105        ret = ah->ah_gpioCfgOutput(ah, gpio); 
     106        ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah)); 
     107        return ret; 
     108}; 
     109static inline HAL_BOOL  ath_hal_clearmcastfilter(struct ath_hal* ah, u_int32_t index) { 
     110        HAL_BOOL  ret; 
     111        ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah)); 
     112        ret = ah->ah_clrMulticastFilterIndex(ah, index); 
     113        ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah)); 
     114        return ret; 
     115}; 
     116static inline void  ath_hal_txreqintrdesc(struct ath_hal* ah, struct ath_desc* a1) { 
     117        ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah)); 
     118        ah->ah_reqTxIntrDesc(ah, a1); 
     119        ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah)); 
     120}; 
     121static inline void  ath_hal_rxmonitor(struct ath_hal* ah, const HAL_NODE_STATS* a1, HAL_CHANNEL* a2) { 
     122        ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah)); 
     123        ah->ah_rxMonitor(ah, a1, a2); 
     124        ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah)); 
     125}; 
     126static inline HAL_BOOL  ath_hal_puttxbuf(struct ath_hal* ah, u_int a1, u_int32_t txdp) { 
     127        HAL_BOOL  ret; 
     128        ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah)); 
     129        ret = ah->ah_setTxDP(ah, a1, txdp); 
     130        ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah)); 
     131        return ret; 
     132}; 
     133static inline HAL_BOOL  ath_hal_keyset(struct ath_hal* ah, u_int16_t a1, const HAL_KEYVAL* a2, const u_int8_t* a3, int a4) { 
     134        HAL_BOOL  ret; 
     135        ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah)); 
     136        ret = ah->ah_setKeyCacheEntry(ah, a1, a2, a3, a4); 
     137        ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah)); 
     138        return ret; 
     139}; 
     140static inline void  ath_hal_setopmode(struct ath_hal* ah) { 
     141        ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah)); 
     142        ah->ah_setPCUConfig(ah); 
     143        ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah)); 
     144}; 
     145static inline HAL_RFGAIN  ath_hal_getrfgain(struct ath_hal* ah) { 
     146        HAL_RFGAIN  ret; 
     147        ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah)); 
     148        ret = ah->ah_getRfGain(ah); 
     149        ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah)); 
     150        return ret; 
     151}; 
     152static inline void  ath_hal_setmcastfilter(struct ath_hal* ah, u_int32_t filter0, u_int32_t filter1) { 
     153        ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah)); 
     154        ah->ah_setMulticastFilter(ah, filter0, filter1); 
     155        ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah)); 
     156}; 
     157static inline u_int  ath_hal_getacktimeout(struct ath_hal* ah) { 
     158        u_int  ret; 
     159        ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah)); 
     160        ret = ah->ah_getAckTimeout(ah); 
     161        ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah)); 
     162        return ret; 
     163}; 
     164static inline void  ath_hal_beacontimers(struct ath_hal* ah, const HAL_BEACON_STATE* a1) { 
     165        ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah)); 
     166        ah->ah_setStationBeaconTimers(ah, a1); 
     167        ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah)); 
     168}; 
     169static inline HAL_BOOL  ath_hal_detectcardpresent(struct ath_hal* ah) { 
     170        HAL_BOOL  ret; 
     171        ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah)); 
     172        ret = ah->ah_detectCardPresent(ah); 
     173        ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah)); 
     174        return ret; 
     175}; 
     176static inline u_int  ath_hal_getslottime(struct ath_hal* ah) { 
     177        u_int  ret; 
     178        ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah)); 
     179        ret = ah->ah_getSlotTime(ah); 
     180        ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah)); 
     181        return ret; 
     182}; 
     183static inline void  ath_hal_beaconinit(struct ath_hal* ah, u_int32_t nexttbtt, u_int32_t intval) { 
     184        ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah)); 
     185        ah->ah_beaconInit(ah, nexttbtt, intval); 
     186        ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah)); 
     187}; 
     188static inline void  ath_hal_gpiosetintr(struct ath_hal* ah, u_int a1, u_int32_t a2) { 
     189        ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah)); 
     190        ah->ah_gpioSetIntr(ah, a1, a2); 
     191        ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah)); 
     192}; 
     193static inline HAL_BOOL  ath_hal_releasetxqueue(struct ath_hal* ah, u_int q) { 
     194        HAL_BOOL  ret; 
     195        ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah)); 
     196        ret = ah->ah_releaseTxQueue(ah, q); 
     197        ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah)); 
     198        return ret; 
     199}; 
     200static inline HAL_BOOL  ath_hal_keysetmac(struct ath_hal* ah, u_int16_t a1, const u_int8_t* a2) { 
     201        HAL_BOOL  ret; 
     202        ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah)); 
     203        ret = ah->ah_setKeyCacheEntryMac(ah, a1, a2); 
     204        ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah)); 
     205        return ret; 
     206}; 
     207static inline HAL_STATUS  ath_hal_txprocdesc(struct ath_hal* ah, struct ath_desc* a1, struct ath_tx_status* a2) { 
     208        HAL_STATUS  ret; 
     209        ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah)); 
     210        ret = ah->ah_procTxDesc(ah, a1, a2); 
     211        ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah)); 
     212        return ret; 
     213}; 
     214static inline HAL_INT  ath_hal_intrget(struct ath_hal* ah) { 
     215        HAL_INT  ret; 
     216        ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah)); 
     217        ret = ah->ah_getInterrupts(ah); 
     218        ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah)); 
     219        return ret; 
     220}; 
     221static inline HAL_BOOL  ath_hal_setacktimeout(struct ath_hal* ah, u_int a1) { 
     222        HAL_BOOL  ret; 
     223        ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah)); 
     224        ret = ah->ah_setAckTimeout(ah, a1); 
     225        ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah)); 
     226        return ret; 
     227}; 
     228static inline HAL_BOOL  ath_hal_setbssidmask(struct ath_hal* ah, const u_int8_t* a1) { 
     229        HAL_BOOL  ret; 
     230        ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah)); 
     231        ret = ah->ah_setBssIdMask(ah, a1); 
     232        ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah)); 
     233        return ret; 
     234}; 
     235static inline HAL_BOOL  ath_hal_setackctsrate(struct ath_hal* ah, u_int a1) { 
     236        HAL_BOOL  ret; 
     237        ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah)); 
     238        ret = ah->ah_setAckCTSRate(ah, a1); 
     239        ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah)); 
     240        return ret; 
     241}; 
     242static inline u_int32_t  ath_hal_getrxfilter(struct ath_hal* ah) { 
     243        u_int32_t  ret; 
     244        ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah)); 
     245        ret = ah->ah_getRxFilter(ah); 
     246        ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah)); 
     247        return ret; 
     248}; 
     249static inline int16_t  ath_hal_get_channel_noise(struct ath_hal* ah, HAL_CHANNEL* a1) { 
     250        int16_t  ret; 
     251        ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah)); 
     252        ret = ah->ah_getChanNoise(ah, a1); 
     253        ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah)); 
     254        return ret; 
     255}; 
     256static inline HAL_BOOL  ath_hal_keyreset(struct ath_hal* ah, u_int16_t a1) { 
     257        HAL_BOOL  ret; 
     258        ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah)); 
     259        ret = ah->ah_resetKeyCacheEntry(ah, a1); 
     260        ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah)); 
     261        return ret; 
     262}; 
     263static inline HAL_BOOL  ath_hal_setantennaswitch(struct ath_hal* ah, HAL_ANT_SETTING a1) { 
     264        HAL_BOOL  ret; 
     265        ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah)); 
     266        ret = ah->ah_setAntennaSwitch(ah, a1); 
     267        ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah)); 
     268        return ret; 
     269}; 
     270static inline HAL_BOOL  ath_hal_settxqueueprops(struct ath_hal* ah, int q, const HAL_TXQ_INFO* qInfo) { 
     271        HAL_BOOL  ret; 
     272        ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah)); 
     273        ret = ah->ah_setTxQueueProps(ah, q, qInfo); 
     274        ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah)); 
     275        return ret; 
     276}; 
     277static inline void  ath_hal_putrxbuf(struct ath_hal* ah, u_int32_t rxdp) { 
     278        ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah)); 
     279        ah->ah_setRxDP(ah, rxdp); 
     280        ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah)); 
     281}; 
     282static inline HAL_BOOL  ath_hal_reset(struct ath_hal* ah, HAL_OPMODE a1, HAL_CHANNEL* a2, HAL_BOOL bChannelChange, HAL_STATUS* status) { 
     283        HAL_BOOL  ret; 
     284        ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah)); 
     285        ret = ah->ah_reset(ah, a1, a2, bChannelChange, status); 
     286        ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah)); 
     287        return ret; 
     288}; 
     289static inline HAL_BOOL  ath_hal_setdecompmask(struct ath_hal* ah, u_int16_t a1, int a2) { 
     290        HAL_BOOL  ret; 
     291        ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah)); 
     292        ret = ah->ah_setDecompMask(ah, a1, a2); 
     293        ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah)); 
     294        return ret; 
     295}; 
     296static inline HAL_BOOL  ath_hal_gettxqueueprops(struct ath_hal* ah, int q, HAL_TXQ_INFO* qInfo) { 
     297        HAL_BOOL  ret; 
     298        ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah)); 
     299        ret = ah->ah_getTxQueueProps(ah, q, qInfo); 
     300        ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah)); 
     301        return ret; 
     302}; 
     303static inline HAL_BOOL  ath_hal_filltxdesc(struct ath_hal* ah, struct ath_desc* a1, u_int segLen, HAL_BOOL firstSeg, HAL_BOOL lastSeg, const struct ath_desc* a5) { 
     304        HAL_BOOL  ret; 
     305        ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah)); 
     306        ret = ah->ah_fillTxDesc(ah, a1, segLen, firstSeg, lastSeg, a5); 
     307        ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah)); 
     308        return ret; 
     309}; 
     310static inline u_int32_t  ath_hal_numtxpending(struct ath_hal* ah, u_int q) { 
     311        u_int32_t  ret; 
     312        ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah)); 
     313        ret = ah->ah_numTxPending(ah, q); 
     314        ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah)); 
     315        return ret; 
     316}; 
     317static inline void  ath_hal_startpcurecv(struct ath_hal* ah) { 
     318        ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah)); 
     319        ah->ah_startPcuReceive(ah); 
     320        ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah)); 
     321}; 
     322static inline void  ath_hal_setdefantenna(struct ath_hal* ah, u_int a1) { 
     323        ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah)); 
     324        ah->ah_setDefAntenna(ah, a1); 
     325        ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah)); 
     326}; 
     327static inline HAL_BOOL  ath_hal_setpower(struct ath_hal* ah, HAL_POWER_MODE mode, int setChip) { 
     328        HAL_BOOL  ret; 
     329        ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah)); 
     330        ret = ah->ah_setPowerMode(ah, mode, setChip); 
     331        ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah)); 
     332        return ret; 
     333}; 
     334static inline HAL_STATUS  ath_hal_rxprocdesc(struct ath_hal* ah, struct ath_desc* a1, u_int32_t phyAddr, struct ath_desc* next, u_int64_t tsf, struct ath_rx_status* a5) { 
     335        HAL_STATUS  ret; 
     336        ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah)); 
     337        ret = ah->ah_procRxDesc(ah, a1, phyAddr, next, tsf, a5); 
     338        ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah)); 
     339        return ret; 
     340}; 
     341static inline u_int  ath_hal_getackctsrate(struct ath_hal* ah) { 
     342        u_int  ret; 
     343        ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah)); 
     344        ret = ah->ah_getAckCTSRate(ah); 
     345        ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah)); 
     346        return ret; 
     347}; 
     348static inline u_int32_t  ath_hal_keycachesize(struct ath_hal* ah) { 
     349        u_int32_t  ret; 
     350        ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah)); 
     351        ret = ah->ah_getKeyCacheSize(ah); 
     352        ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah)); 
     353        return ret; 
     354}; 
     355static inline HAL_BOOL  ath_hal_setupxtxdesc(struct ath_hal* ah, struct ath_desc* a1, u_int txRate1, u_int txTries1, u_int txRate2, u_int txTries2, u_int txRate3, u_int txTries3) { 
     356        HAL_BOOL  ret; 
     357        ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah)); 
     358        ret = ah->ah_setupXTxDesc(ah, a1, txRate1, txTries1, txRate2, txTries2, txRate3, txTries3); 
     359        ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah)); 
     360        return ret; 
     361}; 
     362static inline HAL_INT  ath_hal_intrset(struct ath_hal* ah, HAL_INT a1) { 
     363        HAL_INT  ret; 
     364        ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah)); 
     365        ret = ah->ah_setInterrupts(ah, a1); 
     366        ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah)); 
     367        return ret; 
     368}; 
     369static inline u_int  ath_hal_getctstimeout(struct ath_hal* ah) { 
     370        u_int  ret; 
     371        ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah)); 
     372        ret = ah->ah_getCTSTimeout(ah); 
     373        ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah)); 
     374        return ret; 
     375}; 
     376static inline void  ath_hal_updatemibcounters(struct ath_hal* ah, HAL_MIB_STATS* a1) { 
     377        ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah)); 
     378        ah->ah_updateMibCounters(ah, a1); 
     379        ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah)); 
     380}; 
     381static inline HAL_BOOL  ath_hal_calibrate(struct ath_hal* ah, HAL_CHANNEL* a1, HAL_BOOL* a2) { 
     382        HAL_BOOL  ret; 
     383        ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah)); 
     384        ret = ah->ah_perCalibration(ah, a1, a2); 
     385        ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah)); 
     386        return ret; 
     387}; 
     388static inline u_int32_t  ath_hal_getrxbuf(struct ath_hal* ah) { 
     389        u_int32_t  ret; 
     390        ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah)); 
     391        ret = ah->ah_getRxDP(ah); 
     392        ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah)); 
     393        return ret; 
     394}; 
     395static inline HAL_BOOL  ath_hal_settxpowlimit(struct ath_hal* ah, u_int32_t a1) { 
     396        HAL_BOOL  ret; 
     397        ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah)); 
     398        ret = ah->ah_setTxPowerLimit(ah, a1); 
     399        ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah)); 
     400        return ret; 
     401}; 
     402static inline HAL_BOOL  ath_hal_getisr(struct ath_hal* ah, HAL_INT* a1) { 
     403        HAL_BOOL  ret; 
     404        ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah)); 
     405        ret = ah->ah_getPendingInterrupts(ah, a1); 
     406        ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah)); 
     407        return ret; 
     408}; 
     409static inline HAL_BOOL  ath_hal_updatetxtriglevel(struct ath_hal* ah, HAL_BOOL incTrigLevel) { 
     410        HAL_BOOL  ret; 
     411        ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah)); 
     412        ret = ah->ah_updateTxTrigLevel(ah, incTrigLevel); 
     413        ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah)); 
     414        return ret; 
     415}; 
     416static inline HAL_BOOL  ath_hal_resettxqueue(struct ath_hal* ah, u_int q) { 
     417        HAL_BOOL  ret; 
     418        ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah)); 
     419        ret = ah->ah_resetTxQueue(ah, q); 
     420        ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah)); 
     421        return ret; 
     422}; 
     423static inline HAL_BOOL  ath_hal_setmac(struct ath_hal* ah, const u_int8_t* a1) { 
     424        HAL_BOOL  ret; 
     425        ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah)); 
     426        ret = ah->ah_setMacAddress(ah, a1); 
     427        ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah)); 
     428        return ret; 
     429}; 
     430static inline HAL_BOOL  ath_hal_setctstimeout(struct ath_hal* ah, u_int a1) { 
     431        HAL_BOOL  ret; 
     432        ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah)); 
     433        ret = ah->ah_setCTSTimeout(ah, a1); 
     434        ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah)); 
     435        return ret; 
     436}; 
     437static inline const HAL_RATE_TABLE * ath_hal_getratetable(struct ath_hal* ah, u_int mode) { 
     438        const HAL_RATE_TABLE * ret; 
     439        ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah)); 
     440        ret = ah->ah_getRateTable(ah, mode); 
     441        ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah)); 
     442        return ret; 
     443}; 
     444static inline u_int32_t  ath_hal_gettsf32(struct ath_hal* ah) { 
     445        u_int32_t  ret; 
     446        ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah)); 
     447        ret = ah->ah_getTsf32(ah); 
     448        ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah)); 
     449        return ret; 
     450}; 
     451static inline void  ath_hal_mibevent(struct ath_hal* ah, const HAL_NODE_STATS* a1) { 
     452        ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah)); 
     453        ah->ah_procMibEvent(ah, a1); 
     454        ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah)); 
     455}; 
     456static inline void  ath_hal_setbeacontimers(struct ath_hal* ah, const HAL_BEACON_TIMERS* a1) { 
     457        ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah)); 
     458        ah->ah_setBeaconTimers(ah, a1); 
     459        ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah)); 
     460}; 
     461static inline HAL_STATUS  ath_hal_getcapability(struct ath_hal* ah, HAL_CAPABILITY_TYPE a1, u_int32_t capability, u_int32_t* result) { 
     462        HAL_STATUS  ret; 
     463        ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah)); 
     464        ret = ah->ah_getCapability(ah, a1, capability, result); 
     465        ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah)); 
     466        return ret; 
     467}; 
     468static inline HAL_BOOL  ath_hal_radar_wait(struct ath_hal* ah, HAL_CHANNEL* a1) { 
     469        HAL_BOOL  ret; 
     470        ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah)); 
     471        ret = ah->ah_radarWait(ah, a1); 
     472        ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah)); 
     473        return ret; 
     474}; 
     475static inline HAL_BOOL  ath_hal_setmcastfilterindex(struct ath_hal* ah, u_int32_t index) { 
     476        HAL_BOOL  ret; 
     477        ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah)); 
     478        ret = ah->ah_setMulticastFilterIndex(ah, index); 
     479        ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah)); 
     480        return ret; 
     481}; 
     482static inline void  ath_hal_getbssidmask(struct ath_hal* ah, u_int8_t* a1) { 
     483        ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah)); 
     484        ah->ah_getBssIdMask(ah, a1); 
     485        ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah)); 
     486}; 
     487static inline HAL_BOOL  ath_hal_intrpend(struct ath_hal* ah) { 
     488        HAL_BOOL  ret; 
     489        ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah)); 
     490        ret = ah->ah_isInterruptPending(ah); 
     491        ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah)); 
     492        return ret; 
     493}; 
     494static inline HAL_BOOL  ath_hal_txstart(struct ath_hal* ah, u_int a1) { 
     495        HAL_BOOL  ret; 
     496        ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah)); 
     497        ret = ah->ah_startTxDma(ah, a1); 
     498        ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah)); 
     499        return ret; 
     500}; 
     501static inline void  ath_hal_gettxintrtxqs(struct ath_hal* ah, u_int32_t* a1) { 
     502        ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah)); 
     503        ah->ah_getTxIntrQueue(ah, a1); 
     504        ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah)); 
     505}; 
     506static inline HAL_BOOL  ath_hal_setslottime(struct ath_hal* ah, u_int a1) { 
     507        HAL_BOOL  ret; 
     508        ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah)); 
     509        ret = ah->ah_setSlotTime(ah, a1); 
     510        ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah)); 
     511        return ret; 
     512}; 
     513static inline void  ath_hal_setledstate(struct ath_hal* ah, HAL_LED_STATE a1) { 
     514        ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah)); 
     515        ah->ah_setLedState(ah, a1); 
     516        ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah)); 
     517}; 
     518static inline void  ath_hal_setassocid(struct ath_hal* ah, const u_int8_t* bssid, u_int16_t assocId) { 
     519        ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah)); 
     520        ah->ah_writeAssocid(ah, bssid, assocId); 
     521        ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah)); 
     522}; 
     523static inline void  ath_hal_resettsf(struct ath_hal* ah) { 
     524        ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah)); 
     525        ah->ah_resetTsf(ah); 
     526        ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah)); 
     527}; 
     528static inline HAL_BOOL  ath_hal_setuprxdesc(struct ath_hal* ah, struct ath_desc* a1, u_int32_t size, u_int flags) { 
     529        HAL_BOOL  ret; 
     530        ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah)); 
     531        ret = ah->ah_setupRxDesc(ah, a1, size, flags); 
     532        ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah)); 
     533        return ret; 
     534}; 
     535static inline void  ath_hal_setrxfilter(struct ath_hal* ah, u_int32_t a1) { 
     536        ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah)); 
     537        ah->ah_setRxFilter(ah, a1); 
     538        ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah)); 
     539}; 
     540static inline HAL_BOOL  ath_hal_keyisvalid(struct ath_hal* ah, u_int16_t a1) { 
     541        HAL_BOOL  ret; 
     542        ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah)); 
     543        ret = ah->ah_isKeyCacheEntryValid(ah, a1); 
     544        ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah)); 
     545        return ret; 
     546}; 
     547static inline void  ath_hal_stoppcurecv(struct ath_hal* ah) { 
     548        ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah)); 
     549        ah->ah_stopPcuReceive(ah); 
     550        ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah)); 
     551}; 
     552static inline HAL_BOOL  ath_hal_stoptxdma(struct ath_hal* ah, u_int a1) { 
     553        HAL_BOOL  ret; 
     554        ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah)); 
     555        ret = ah->ah_stopTxDma(ah, a1); 
     556        ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah)); 
     557        return ret; 
     558}; 
     559static inline HAL_BOOL  ath_hal_setcapability(struct ath_hal* ah, HAL_CAPABILITY_TYPE a1, u_int32_t capability, u_int32_t setting, HAL_STATUS* a4) { 
     560        HAL_BOOL  ret; 
     561        ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah)); 
     562        ret = ah->ah_setCapability(ah, a1, capability, setting, a4); 
     563        ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah)); 
     564        return ret; 
     565}; 
     566static inline HAL_BOOL  ath_hal_stopdmarecv(struct ath_hal* ah) { 
     567        HAL_BOOL  ret; 
     568        ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah)); 
     569        ret = ah->ah_stopDmaReceive(ah); 
     570        ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah)); 
     571        return ret; 
     572}; 
     573static inline u_int32_t  ath_hal_gettxbuf(struct ath_hal* ah, u_int a1) { 
     574        u_int32_t  ret; 
     575        ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah)); 
     576        ret = ah->ah_getTxDP(ah, a1); 
     577        ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah)); 
     578        return ret; 
     579}; 
     580static inline int  ath_hal_setuptxqueue(struct ath_hal* ah, HAL_TX_QUEUE a1, const HAL_TXQ_INFO* qInfo) { 
     581        int  ret; 
     582        ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah)); 
     583        ret = ah->ah_setupTxQueue(ah, a1, qInfo); 
     584        ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah)); 
     585        return ret; 
     586}; 
     587static inline u_int  ath_hal_getdefantenna(struct ath_hal* ah) { 
     588        u_int  ret; 
     589        ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah)); 
     590        ret = ah->ah_getDefAntenna(ah); 
     591        ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah)); 
     592        return ret; 
     593}; 
     594static inline HAL_BOOL  ath_hal_phydisable(struct ath_hal* ah) { 
     595        HAL_BOOL  ret; 
     596        ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah)); 
     597        ret = ah->ah_phyDisable(ah); 
     598        ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah)); 
     599        return ret; 
     600}; 
     601static inline HAL_BOOL  ath_hal_setregulatorydomain(struct ath_hal* ah, u_int16_t a1, HAL_STATUS* a2) { 
     602        HAL_BOOL  ret; 
     603        ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah)); 
     604        ret = ah->ah_setRegulatoryDomain(ah, a1, a2); 
     605        ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah)); 
     606        return ret; 
     607}; 
     608static inline HAL_BOOL  ath_hal_setuptxdesc(struct ath_hal* ah, struct ath_desc* a1, u_int pktLen, u_int hdrLen, HAL_PKT_TYPE type, u_int txPower, u_int txRate0, u_int txTries0, u_int keyIx, u_int antMode, u_int flags, u_int rtsctsRate, u_int rtsctsDuration, u_int compicvLen, u_int compivLen, u_int comp) { 
     609        HAL_BOOL  ret; 
     610        ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah)); 
     611        ret = ah->ah_setupTxDesc(ah, a1, pktLen, hdrLen, type, txPower, txRate0, txTries0, keyIx, antMode, flags, rtsctsRate, rtsctsDuration, compicvLen, compivLen, comp); 
     612        ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah)); 
     613        return ret; 
     614}; 
     615static inline HAL_BOOL  ath_hal_gpiCfgInput(struct ath_hal* ah, u_int32_t gpio) { 
     616        HAL_BOOL  ret; 
     617        ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah)); 
     618        ret = ah->ah_gpioCfgInput(ah, gpio); 
     619        ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah)); 
     620        return ret; 
     621}; 
     622static inline u_int32_t  ath_hal_gpioget(struct ath_hal* ah, u_int32_t gpio) { 
     623        u_int32_t  ret; 
     624        ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah)); 
     625        ret = ah->ah_gpioGet(ah, gpio); 
     626        ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah)); 
     627        return ret; 
     628}; 
     629static inline HAL_BOOL  ath_hal_disable(struct ath_hal* ah) { 
     630        HAL_BOOL  ret; 
     631        ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah)); 
     632        ret = ah->ah_disable(ah); 
     633        ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah)); 
     634        return ret; 
     635}; 
     636/* 
     637These custom wrappers are defined in scripts/regenerate_ath_hal_api.pl and are used  
     638as shortcut accessors for HAL functions. 
     639*/ 
     640static inline HAL_BOOL ath_hal_settpc(struct ath_hal* ah, u_int32_t v) { 
     641        return ((ath_hal_setcapability(ah, HAL_CAP_TPC, 1, v, NULL))); 
     642}; 
     643static inline HAL_BOOL ath_hal_gettsfadjust(struct ath_hal* ah) { 
     644        return ((ath_hal_getcapability(ah, HAL_CAP_TSF_ADJUST, 1, NULL) == HAL_OK)); 
     645}; 
     646static inline HAL_BOOL ath_hal_hasrfsilent(struct ath_hal* ah) { 
     647        return ((ath_hal_getcapability(ah, HAL_CAP_RFSILENT, 0, NULL) == HAL_OK)); 
     648}; 
     649static inline HAL_BOOL ath_hal_quarterrate_chansupported(struct ath_hal* ah) { 
     650        return ((ath_hal_getcapability(ah, HAL_CAP_CHAN_QUARTERRATE, 0, NULL) == HAL_OK)); 
     651}; 
     652static inline HAL_BOOL ath_hal_xrsupported(struct ath_hal* ah) { 
     653        return ((ath_hal_getcapability(ah, HAL_CAP_XR, 0, NULL) == HAL_OK)); 
     654}; 
     655static inline HAL_BOOL ath_hal_getmaxtxpow(struct ath_hal* ah, u_int32_t* destination) { 
     656        return ((ath_hal_getcapability(ah, HAL_CAP_TXPOW, 2, destination) == HAL_OK)); 
     657}; 
     658static inline HAL_BOOL ath_hal_gettkipmic(struct ath_hal* ah) { 
     659        return ((ath_hal_getcapability(ah, HAL_CAP_TKIP_MIC, 1, NULL) == HAL_OK)); 
     660}; 
     661static inline HAL_BOOL ath_hal_hasbssidmask(struct ath_hal* ah) { 
     662        return ((ath_hal_getcapability(ah, HAL_CAP_BSSIDMASK, 0, NULL) == HAL_OK)); 
     663}; 
     664static inline HAL_BOOL ath_hal_settkipmic(struct ath_hal* ah, u_int32_t v) { 
     665        return ((ath_hal_setcapability(ah, HAL_CAP_TKIP_MIC, 1, v, NULL))); 
     666}; 
     667static inline HAL_BOOL ath_hal_hasdiversity(struct ath_hal* ah) { 
     668        return ((ath_hal_getcapability(ah, HAL_CAP_DIVERSITY, 0, NULL) == HAL_OK)); 
     669}; 
     670static inline HAL_BOOL ath_hal_getregdomain(struct ath_hal* ah, u_int32_t* destination) { 
     671        return ((ath_hal_getcapability(ah, HAL_CAP_REG_DMN, 0, destination))); 
     672}; 
     673static inline HAL_BOOL ath_hal_setdiversity(struct ath_hal* ah, int v) { 
     674        return ((ath_hal_setcapability(ah, HAL_CAP_DIVERSITY, 1, v, NULL))); 
     675}; 
     676static inline HAL_BOOL ath_hal_fastframesupported(struct ath_hal* ah) { 
     677        return ((ath_hal_getcapability(ah, HAL_CAP_FASTFRAME, 0, NULL) == HAL_OK)); 
     678}; 
     679static inline HAL_BOOL ath_hal_gettpscale(struct ath_hal* ah, u_int32_t* destination) { 
     680        return ((ath_hal_getcapability(ah, HAL_CAP_TXPOW, 3, destination) == HAL_OK)); 
     681}; 
     682static inline HAL_BOOL ath_hal_settkipsplit(struct ath_hal* ah, int v) { 
     683        return ((ath_hal_setcapability(ah, HAL_CAP_TKIP_SPLIT, 1, v, NULL))); 
     684}; 
     685static inline HAL_BOOL ath_hal_getnumtxqueues(struct ath_hal* ah, u_int32_t* destination) { 
     686        return ((ath_hal_getcapability(ah, HAL_CAP_NUM_TXQUEUES, 0, destination) == HAL_OK)); 
     687}; 
     688static inline HAL_BOOL ath_hal_compressionsupported(struct ath_hal* ah) { 
     689        return ((ath_hal_getcapability(ah, HAL_CAP_COMPRESSION, 0, NULL) == HAL_OK)); 
     690}; 
     691static inline HAL_BOOL ath_hal_burstsupported(struct ath_hal* ah) { 
     692        return ((ath_hal_getcapability(ah, HAL_CAP_BURST, 0, NULL) == HAL_OK)); 
     693}; 
     694static inline HAL_BOOL ath_hal_gettpc(struct ath_hal* ah) { 
     695        return ((ath_hal_getcapability(ah, HAL_CAP_TPC, 1, NULL) == HAL_OK)); 
     696}; 
     697static inline HAL_BOOL ath_hal_gettkipsplit(struct ath_hal* ah) { 
     698        return ((ath_hal_getcapability(ah, HAL_CAP_TKIP_SPLIT, 1, NULL) == HAL_OK)); 
     699}; 
     700static inline HAL_BOOL ath_hal_hastkipsplit(struct ath_hal* ah) { 
     701        return ((ath_hal_getcapability(ah, HAL_CAP_TKIP_SPLIT, 0, NULL) == HAL_OK)); 
     702}; 
     703static inline HAL_BOOL ath_hal_halfrate_chansupported(struct ath_hal* ah) { 
     704        return ((ath_hal_getcapability(ah, HAL_CAP_CHAN_HALFRATE, 0, NULL) == HAL_OK)); 
     705}; 
     706static inline HAL_BOOL ath_hal_getdiversity(struct ath_hal* ah) { 
     707        return ((ath_hal_getcapability(ah, HAL_CAP_DIVERSITY, 1, NULL) == HAL_OK)); 
     708}; 
     709static inline HAL_BOOL ath_hal_hwphycounters(struct ath_hal* ah) { 
     710        return ((ath_hal_getcapability(ah, HAL_CAP_PHYCOUNTERS, 0, NULL) == HAL_OK)); 
     711}; 
     712static inline HAL_BOOL ath_hal_hastsfadjust(struct ath_hal* ah) { 
     713        return ((ath_hal_getcapability(ah, HAL_CAP_TSF_ADJUST, 0, NULL) == HAL_OK)); 
     714}; 
     715static inline HAL_BOOL ath_hal_settpscale(struct ath_hal* ah, u_int32_t v) { 
     716        return ((ath_hal_setcapability(ah, HAL_CAP_TXPOW, 3, v, NULL))); 
     717}; 
     718static inline HAL_BOOL ath_hal_hasbursting(struct ath_hal* ah) { 
     719        return ((ath_hal_getcapability(ah, HAL_CAP_BURST, 0, NULL) == HAL_OK)); 
     720}; 
     721static inline HAL_BOOL ath_hal_settsfadjust(struct ath_hal* ah, u_int32_t v) { 
     722        return ((ath_hal_setcapability(ah, HAL_CAP_TSF_ADJUST, 1, v, NULL))); 
     723}; 
     724static inline HAL_BOOL ath_hal_hastxpowlimit(struct ath_hal* ah) { 
     725        return ((ath_hal_getcapability(ah, HAL_CAP_TXPOW, 0, NULL) == HAL_OK)); 
     726}; 
     727static inline HAL_BOOL ath_hal_setrfsilent(struct ath_hal* ah, u_int32_t v) { 
     728        return ((ath_hal_setcapability(ah, HAL_CAP_RFSILENT, 1, v, NULL))); 
     729}; 
     730static inline HAL_BOOL ath_hal_hasfastframes(struct ath_hal* ah) { 
     731        return ((ath_hal_getcapability(ah, HAL_CAP_FASTFRAME, 0, NULL) == HAL_OK)); 
     732}; 
     733static inline HAL_BOOL ath_hal_hasmcastkeysearch(struct ath_hal* ah) { 
     734        return ((ath_hal_getcapability(ah, HAL_CAP_MCAST_KEYSRCH, 0, NULL) == HAL_OK)); 
     735}; 
     736static inline HAL_BOOL ath_hal_turboagsupported(struct ath_hal* ah, int countrycode) { 
     737        return ((ath_hal_getwirelessmodes(ah, countrycode) & (HAL_MODE_108G|HAL_MODE_TURBO))); 
     738}; 
     739static inline HAL_BOOL ath_hal_hasveol(struct ath_hal* ah) { 
     740        return ((ath_hal_getcapability(ah, HAL_CAP_VEOL, 0, NULL) == HAL_OK)); 
     741}; 
     742static inline HAL_BOOL ath_hal_wmetkipmic(struct ath_hal* ah) { 
     743        return ((ath_hal_getcapability(ah, HAL_CAP_WME_TKIPMIC, 0, NULL) == HAL_OK)); 
     744}; 
     745static inline HAL_BOOL ath_hal_hascompression(struct ath_hal* ah) { 
     746        return ((ath_hal_getcapability(ah, HAL_CAP_COMPRESSION, 0, NULL) == HAL_OK)); 
     747}; 
     748static inline HAL_BOOL ath_hal_getmcastkeysearch(struct ath_hal* ah) { 
     749        return ((ath_hal_getcapability(ah, HAL_CAP_MCAST_KEYSRCH, 1, NULL) == HAL_OK)); 
     750}; 
     751static inline HAL_BOOL ath_hal_ciphersupported(struct ath_hal* ah, u_int32_t cipher) { 
     752        return ((ath_hal_getcapability(ah, HAL_CAP_CIPHER, cipher, NULL) == HAL_OK)); 
     753}; 
     754static inline HAL_BOOL ath_hal_gettxpowlimit(struct ath_hal* ah, u_int32_t* destination) { 
     755        return ((ath_hal_getcapability(ah, HAL_CAP_TXPOW, 1, destination) == HAL_OK)); 
     756}; 
     757static inline HAL_BOOL ath_hal_hastkipmic(struct ath_hal* ah) { 
     758        return ((ath_hal_getcapability(ah, HAL_CAP_TKIP_MIC, 0, NULL) == HAL_OK)); 
     759}; 
     760static inline HAL_BOOL ath_hal_hastpc(struct ath_hal* ah) { 
     761        return ((ath_hal_getcapability(ah, HAL_CAP_TPC, 0, NULL) == HAL_OK)); 
     762}; 
     763static inline HAL_BOOL ath_hal_getcountrycode(struct ath_hal* ah, u_int32_t* destination) { 
     764        return (((*(destination) = ah->ah_countryCode), AH_TRUE)); 
     765}; 
     766 
     767#endif /* _IF_ATH_HAL_H */ 
  • ath/if_athvar.h

    old new  
    4747#include "ah_os.h" 
    4848#include "if_athioctl.h" 
    4949#include "net80211/ieee80211.h"         /* XXX for WME_NUM_AC */ 
     50#include <asm/io.h> 
    5051 
    5152/* 
    5253 * Deduce if tasklets are available.  If not then 
     
    535536        void (*sc_node_free)(struct ieee80211_node *); 
    536537        void *sc_bdev;                          /* associated bus device */ 
    537538        struct ath_hal *sc_ah;                  /* Atheros HAL */ 
     539        spinlock_t sc_hal_lock;                 /* hardware access lock */ 
    538540        struct ath_ratectrl *sc_rc;             /* tx rate control support */ 
    539541        struct ath_tx99 *sc_tx99;               /* tx99 support */ 
    540542        void (*sc_setdefantenna)(struct ath_softc *, u_int); 
     
    737739void ath_sysctl_register(void); 
    738740void ath_sysctl_unregister(void); 
    739741 
    740 #include "ath_hal_api.h" 
    741  
    742742#endif /* _DEV_ATH_ATHVAR_H */ 
  • ath/if_ath.c

    old new  
    9191#include "if_ath_ahb.h" 
    9292#endif                  /* AHB BUS */ 
    9393 
     94#include "ah.h" 
     95#include "if_ath_hal.h" 
     96 
    9497#ifdef ATH_TX99_DIAG 
    9598#include "ath_tx99.h" 
    9699#endif 
     
    440443        sc->sc_cachelsz = csz << 2;             /* convert to bytes */ 
    441444 
    442445        ATH_LOCK_INIT(sc); 
     446        ATH_HAL_LOCK_INIT(sc); 
    443447        ATH_TXBUF_LOCK_INIT(sc); 
    444448        ATH_RXBUF_LOCK_INIT(sc); 
    445449 
     
    526530        ic->ic_country_code = ath_countrycode; 
    527531        ic->ic_country_outdoor = ath_outdoor; 
    528532 
    529         if (rfkill != -1) { 
    530                 printk(KERN_INFO "ath_pci: switching rfkill capability %s\n", 
    531                         rfkill ? "on" : "off"); 
    532                 ath_hal_setrfsilent(ah, rfkill); 
    533         } 
     533        printk(KERN_INFO "ath_pci: switching rfkill capability %s\n", 
     534                rfkill ? "on" : "off"); 
     535        ath_hal_setrfsilent(ah, rfkill); 
    534536 
    535537#ifdef ATH_CAP_TPC 
    536538        printk(KERN_INFO "ath_pci: ath_pci: switching per-packet transmit power control %s\n", 
     
    965967                ath_hal_detach(ah); 
    966968        ATH_TXBUF_LOCK_DESTROY(sc); 
    967969        ATH_LOCK_DESTROY(sc); 
     970        ATH_HAL_LOCK_DESTROY(sc); 
    968971        sc->sc_invalid = 1; 
    969972 
    970973        return error; 
     
    980983        DPRINTF(sc, ATH_DEBUG_ANY, "%s: flags %x\n", __func__, dev->flags); 
    981984        ath_stop(dev); 
    982985 
    983         ath_hal_setpower(sc->sc_ah, HAL_PM_AWAKE); 
     986        ath_hal_setpower(sc->sc_ah, HAL_PM_AWAKE, AH_TRUE); 
    984987 
    985988        sc->sc_invalid = 1; 
    986989 
     
    10151018 
    10161019        ath_dynamic_sysctl_unregister(sc); 
    10171020        ATH_LOCK_DESTROY(sc); 
     1021        ATH_HAL_LOCK_DESTROY(sc); 
    10181022        dev->stop = NULL; /* prevent calling ath_stop again */ 
    10191023        unregister_netdev(dev); 
    10201024        return 0; 
     
    20082012        ATH_LOCK(sc); 
    20092013 
    20102014        if (!sc->sc_invalid) 
    2011                 ath_hal_setpower(sc->sc_ah, HAL_PM_AWAKE); 
     2015                ath_hal_setpower(sc->sc_ah, HAL_PM_AWAKE, AH_TRUE); 
    20122016 
    20132017        error = ath_stop_locked(dev); 
    20142018 
     
    20792083static int 
    20802084ath_set_ack_bitrate(struct ath_softc *sc, int high) 
    20812085{ 
    2082         struct ath_hal *ah = sc->sc_ah; 
    20832086        if (ar_device(sc->devid) == 5212 || ar_device(sc->devid) == 5213) { 
    20842087                /* set ack to be sent at low bit-rate */ 
    20852088                /* registers taken from the OpenBSD 5212 HAL */ 
     
    20882091#define AR5K_AR5212_STA_ID1_BASE_RATE_11B       0x02000000 
    20892092                u_int32_t v = AR5K_AR5212_STA_ID1_BASE_RATE_11B | AR5K_AR5212_STA_ID1_ACKCTS_6MB; 
    20902093                if (high) { 
    2091                         OS_REG_WRITE(ah, AR5K_AR5212_STA_ID1, OS_REG_READ(ah, AR5K_AR5212_STA_ID1) & ~v); 
     2094                        ath_reg_write(sc, AR5K_AR5212_STA_ID1, ath_reg_read(sc, AR5K_AR5212_STA_ID1) & ~v); 
    20922095                } else { 
    2093                         OS_REG_WRITE(ah, AR5K_AR5212_STA_ID1, OS_REG_READ(ah, AR5K_AR5212_STA_ID1) | v); 
     2096                        ath_reg_write(sc, AR5K_AR5212_STA_ID1, ath_reg_read(sc, AR5K_AR5212_STA_ID1) | v); 
    20942097                } 
    20952098#undef AR5K_AR5212_STA_ID1 
    20962099#undef AR5K_AR5212_STA_ID1_BASE_RATE_11B 
     
    28922895                         */ 
    28932896                        memcpy(hk->kv_mic, k->wk_txmic, sizeof(hk->kv_mic)); 
    28942897                        KEYPRINTF(sc, k->wk_keyix, hk, zerobssid); 
    2895                         if (!ath_hal_keyset(ah, ATH_KEY(k->wk_keyix), hk, zerobssid)) 
     2898                        if (!ath_hal_keyset(ah, ATH_KEY(k->wk_keyix), hk, zerobssid, AH_FALSE)) 
    28962899                                return 0; 
    28972900 
    28982901                        memcpy(hk->kv_mic, k->wk_rxmic, sizeof(hk->kv_mic)); 
    28992902                        KEYPRINTF(sc, k->wk_keyix + 32, hk, mac); 
    29002903                        /* XXX delete tx key on failure? */ 
    2901                         return ath_hal_keyset(ah, ATH_KEY(k->wk_keyix + 32), hk, mac); 
     2904                        return ath_hal_keyset(ah, ATH_KEY(k->wk_keyix + 32), hk, mac, AH_FALSE); 
    29022905                } else { 
    29032906                        /* 
    29042907                         * Room for both TX+RX MIC keys in one key cache 
     
    29102913                        memcpy(hk->kv_txmic, k->wk_txmic, sizeof(hk->kv_txmic)); 
    29112914#endif 
    29122915                        KEYPRINTF(sc, k->wk_keyix, hk, mac); 
    2913                         return ath_hal_keyset(ah, ATH_KEY(k->wk_keyix), hk, mac); 
     2916                        return ath_hal_keyset(ah, ATH_KEY(k->wk_keyix), hk, mac, AH_FALSE); 
    29142917                } 
    29152918        } else if (k->wk_flags & IEEE80211_KEY_XR) { 
    29162919                /* 
     
    29202923                memcpy(hk->kv_mic, k->wk_flags & IEEE80211_KEY_XMIT ? 
    29212924                        k->wk_txmic : k->wk_rxmic, sizeof(hk->kv_mic)); 
    29222925                KEYPRINTF(sc, k->wk_keyix, hk, mac); 
    2923                 return ath_hal_keyset(ah, ATH_KEY(k->wk_keyix), hk, mac); 
     2926                return ath_hal_keyset(ah, ATH_KEY(k->wk_keyix), hk, mac, AH_FALSE); 
    29242927        } 
    29252928        return 0; 
    29262929#undef IEEE80211_KEY_XR 
     
    29842987                return ath_keyset_tkip(sc, k, &hk, mac); 
    29852988        } else { 
    29862989                KEYPRINTF(sc, k->wk_keyix, &hk, mac); 
    2987                 return ath_hal_keyset(ah, ATH_KEY(k->wk_keyix), &hk, mac); 
     2990                return ath_hal_keyset(ah, ATH_KEY(k->wk_keyix), &hk, mac, AH_FALSE); 
    29882991        } 
    29892992#undef N 
    29902993} 
     
    1040810411                if (ath_regdump_filter(sc, address)) 
    1040910412                        continue; 
    1041010413                ath_lookup_register_name(sc, name, MAX_REGISTER_NAME_LEN, address); 
    10411                 value = OS_REG_READ(ah,address); 
     10414                value = ath_reg_read(sc,address); 
    1041210415                ath_print_register(name, address, value); 
    1041310416        } while ((address += 4) < MAX_REGISTER_ADDRESS); 
    1041410417} 
     
    1042910432        do { 
    1043010433                if (ath_regdump_filter(sc, address)) 
    1043110434                        continue; 
    10432                 value = OS_REG_READ(ah,address); 
     10435                value = ath_reg_read(sc,address); 
    1043310436                p_old = (unsigned int*)&sc->register_snapshot[address]; 
    1043410437                if (*p_old != value) { 
    1043510438                        ath_lookup_register_name(sc, name, MAX_REGISTER_NAME_LEN, address); 
     
    1045310456        do { 
    1045410457                *((unsigned int*)&sc->register_snapshot[address]) = 
    1045510458                        ath_regdump_filter(sc, address) ?  
    10456                         0x0 : OS_REG_READ(ah,address); 
     10459                        0x0 : ath_reg_read(sc,address); 
    1045710460        } while ((address += 4) < MAX_REGISTER_ADDRESS); 
    1045810461} 
    1045910462#endif /* #ifdef ATH_REVERSE_ENGINEERING */ 
     
    1047710480                                DEV_NAME(sc->sc_dev), __func__, address); 
    1047810481                return 1; 
    1047910482        } 
    10480         *value = OS_REG_READ(sc->sc_ah, address); 
     10483        *value = ath_reg_read(sc, address); 
    1048110484        printk(KERN_DEBUG "*0x%04x -> 0x%08x\n", address, *value); 
    1048210485        return 0; 
    1048310486} 
     
    1050710510                                DEV_NAME(sc->sc_dev), __func__, address); 
    1050810511                return 1; 
    1050910512        } 
    10510         OS_REG_WRITE(sc->sc_ah, address, value); 
     10513        ath_reg_write(sc, address, value); 
    1051110514        printk(KERN_DEBUG "*0x%04x <- 0x%08x = 0x%08x\n", address, value,  
    10512                         OS_REG_READ(sc->sc_ah, address)); 
     10515                        ath_reg_read(sc, address)); 
    1051310516        return 0; 
    1051410517} 
    1051510518#endif /* #ifdef ATH_REVERSE_ENGINEERING */ 
  • ath/Makefile

    old new  
    5757include $(TOP)/Makefile.inc 
    5858 
    5959obj-m           += ath_$(BUSNAME).o 
    60 ath_$(BUSNAME)-objs     := if_ath.o if_ath_$(BUSNAME).o 
     60ath_$(BUSNAME)-objs     := if_ath.o if_ath_hal.o if_ath_$(BUSNAME).o 
    6161 
    6262INCS += -I$(TOP) -I$(ATH_HAL) -I$(HAL) -I$(WLAN) 
    6363