Project : madwifi
Revision : 2460
Author : mtaylor (Michael Taylor)
Date : 2007-06-15 23:46:34 +0200 (Fri, 15 Jun 2007)
Log Message :
This patch makes the following changes:
1. Replaces statically created ath_hal_api.h/ath_hal_api.c with a perl
generated one.
See scripts/if_ath_hal_generator.pl and scripts/if_ath_hal_settings.pl.
2. New HAL wrappers are done with static inline rather than maintaining both
macros and functions.
3. New spinlock and macros added to protect all HAL access, sc_hal_lock.
4. New MadWifi safe register access [static inline] functions ath_reg_read
and ath_reg_write added.
5. This fixes many race conditions between iwpriv/iwconfig commands and the
HAL, including the dreaded abort on ath_hal_reg_read.
Thanks,
Mike
Affected Files:
* trunk/Makefile.inc updated
* trunk/ath/Makefile updated
* trunk/ath/if_ath.c updated
* trunk/ath/if_ath_hal.c added
* trunk/ath/if_ath_hal.h added
* trunk/ath/if_athvar.h updated
* trunk/ath_hal/Makefile updated
* trunk/ath_hal/ah_os.c updated
* trunk/ath_hal/ah_os.h updated
* trunk/ath_hal/ath_hal_api.c deleted
* trunk/ath_hal/ath_hal_api.h deleted
* trunk/ath_rate/amrr/amrr.c updated
* trunk/ath_rate/minstrel/minstrel.c updated
* trunk/ath_rate/onoe/onoe.c updated
* trunk/ath_rate/sample/sample.c updated
* trunk/scripts/if_ath_hal_generator.pl added
* trunk/scripts/if_ath_hal_settings.pl added
Modified: trunk/Makefile.inc
===================================================================
--- trunk/Makefile.inc 2007-06-15 04:53:44 UTC (rev 2459)
+++ trunk/Makefile.inc 2007-06-15 21:46:34 UTC (rev 2460)
@@ -165,7 +165,7 @@
# stack traces are more decipherable.
ifdef HAL_DEBUG
-COPTS+= -DAH_HALOPS_FUNC -DAH_DEBUG -fno-inline
+COPTS+= -DAH_HALOPS_TRACEABLE -fno-inline
endif
# Don't let HAL mess with the toolchain - save toolchain variables
Modified: trunk/ath/Makefile
===================================================================
--- trunk/ath/Makefile 2007-06-15 04:53:44 UTC (rev 2459)
+++ trunk/ath/Makefile 2007-06-15 21:46:34 UTC (rev 2460)
@@ -57,7 +57,7 @@
include $(TOP)/Makefile.inc
obj-m += ath_$(BUSNAME).o
-ath_$(BUSNAME)-objs := if_ath.o if_ath_$(BUSNAME).o
+ath_$(BUSNAME)-objs := if_ath.o if_ath_hal.o if_ath_$(BUSNAME).o
INCS += -I$(TOP) -I$(ATH_HAL) -I$(HAL) -I$(WLAN)
Modified: trunk/ath/if_ath.c
===================================================================
--- trunk/ath/if_ath.c 2007-06-15 04:53:44 UTC (rev 2459)
+++ trunk/ath/if_ath.c 2007-06-15 21:46:34 UTC (rev 2460)
@@ -91,6 +91,9 @@
#include "if_ath_ahb.h"
#endif /* AHB BUS */
+#include "ah.h"
+#include "if_ath_hal.h"
+
#ifdef ATH_TX99_DIAG
#include "ath_tx99.h"
#endif
@@ -440,6 +443,7 @@
sc->sc_cachelsz = csz << 2; /* convert to bytes */
ATH_LOCK_INIT(sc);
+ ATH_HAL_LOCK_INIT(sc);
ATH_TXBUF_LOCK_INIT(sc);
ATH_RXBUF_LOCK_INIT(sc);
@@ -526,11 +530,9 @@
ic->ic_country_code = ath_countrycode;
ic->ic_country_outdoor = ath_outdoor;
- if (rfkill != -1) {
- printk(KERN_INFO "ath_pci: switching rfkill capability %s\n",
- rfkill ? "on" : "off");
- ath_hal_setrfsilent(ah, rfkill);
- }
+ printk(KERN_INFO "ath_pci: switching rfkill capability %s\n",
+ rfkill ? "on" : "off");
+ ath_hal_setrfsilent(ah, rfkill);
#ifdef ATH_CAP_TPC
printk(KERN_INFO "ath_pci: ath_pci: switching per-packet transmit power
control %s\n",
@@ -965,6 +967,7 @@
ath_hal_detach(ah);
ATH_TXBUF_LOCK_DESTROY(sc);
ATH_LOCK_DESTROY(sc);
+ ATH_HAL_LOCK_DESTROY(sc);
sc->sc_invalid = 1;
return error;
@@ -980,7 +983,7 @@
DPRINTF(sc, ATH_DEBUG_ANY, "%s: flags %x\n", __func__, dev->flags);
ath_stop(dev);
- ath_hal_setpower(sc->sc_ah, HAL_PM_AWAKE);
+ ath_hal_setpower(sc->sc_ah, HAL_PM_AWAKE, AH_TRUE);
sc->sc_invalid = 1;
@@ -1015,6 +1018,7 @@
ath_dynamic_sysctl_unregister(sc);
ATH_LOCK_DESTROY(sc);
+ ATH_HAL_LOCK_DESTROY(sc);
dev->stop = NULL; /* prevent calling ath_stop again */
unregister_netdev(dev);
return 0;
@@ -2008,7 +2012,7 @@
ATH_LOCK(sc);
if (!sc->sc_invalid)
- ath_hal_setpower(sc->sc_ah, HAL_PM_AWAKE);
+ ath_hal_setpower(sc->sc_ah, HAL_PM_AWAKE, AH_TRUE);
error = ath_stop_locked(dev);
@@ -2079,7 +2083,6 @@
static int
ath_set_ack_bitrate(struct ath_softc *sc, int high)
{
- struct ath_hal *ah = sc->sc_ah;
if (ar_device(sc->devid) == 5212 || ar_device(sc->devid) == 5213) {
/* set ack to be sent at low bit-rate */
/* registers taken from the OpenBSD 5212 HAL */
@@ -2088,9 +2091,9 @@
#define AR5K_AR5212_STA_ID1_BASE_RATE_11B 0x02000000
u_int32_t v = AR5K_AR5212_STA_ID1_BASE_RATE_11B |
AR5K_AR5212_STA_ID1_ACKCTS_6MB;
if (high) {
- OS_REG_WRITE(ah, AR5K_AR5212_STA_ID1, OS_REG_READ(ah,
AR5K_AR5212_STA_ID1) & ~v);
+ ath_reg_write(sc, AR5K_AR5212_STA_ID1, ath_reg_read(sc,
AR5K_AR5212_STA_ID1) & ~v);
} else {
- OS_REG_WRITE(ah, AR5K_AR5212_STA_ID1, OS_REG_READ(ah,
AR5K_AR5212_STA_ID1) | v);
+ ath_reg_write(sc, AR5K_AR5212_STA_ID1, ath_reg_read(sc,
AR5K_AR5212_STA_ID1) | v);
}
#undef AR5K_AR5212_STA_ID1
#undef AR5K_AR5212_STA_ID1_BASE_RATE_11B
@@ -2892,13 +2895,13 @@
*/
memcpy(hk->kv_mic, k->wk_txmic, sizeof(hk->kv_mic));
KEYPRINTF(sc, k->wk_keyix, hk, zerobssid);
- if (!ath_hal_keyset(ah, ATH_KEY(k->wk_keyix), hk,
zerobssid))
+ if (!ath_hal_keyset(ah, ATH_KEY(k->wk_keyix), hk,
zerobssid, AH_FALSE))
return 0;
memcpy(hk->kv_mic, k->wk_rxmic, sizeof(hk->kv_mic));
KEYPRINTF(sc, k->wk_keyix + 32, hk, mac);
/* XXX delete tx key on failure? */
- return ath_hal_keyset(ah, ATH_KEY(k->wk_keyix + 32),
hk, mac);
+ return ath_hal_keyset(ah, ATH_KEY(k->wk_keyix + 32),
hk, mac, AH_FALSE);
} else {
/*
* Room for both TX+RX MIC keys in one key cache
@@ -2910,7 +2913,7 @@
memcpy(hk->kv_txmic, k->wk_txmic, sizeof(hk->kv_txmic));
#endif
KEYPRINTF(sc, k->wk_keyix, hk, mac);
- return ath_hal_keyset(ah, ATH_KEY(k->wk_keyix), hk,
mac);
+ return ath_hal_keyset(ah, ATH_KEY(k->wk_keyix), hk,
mac, AH_FALSE);
}
} else if (k->wk_flags & IEEE80211_KEY_XR) {
/*
@@ -2920,7 +2923,7 @@
memcpy(hk->kv_mic, k->wk_flags & IEEE80211_KEY_XMIT ?
k->wk_txmic : k->wk_rxmic, sizeof(hk->kv_mic));
KEYPRINTF(sc, k->wk_keyix, hk, mac);
- return ath_hal_keyset(ah, ATH_KEY(k->wk_keyix), hk, mac);
+ return ath_hal_keyset(ah, ATH_KEY(k->wk_keyix), hk, mac,
AH_FALSE);
}
return 0;
#undef IEEE80211_KEY_XR
@@ -2984,7 +2987,7 @@
return ath_keyset_tkip(sc, k, &hk, mac);
} else {
KEYPRINTF(sc, k->wk_keyix, &hk, mac);
- return ath_hal_keyset(ah, ATH_KEY(k->wk_keyix), &hk, mac);
+ return ath_hal_keyset(ah, ATH_KEY(k->wk_keyix), &hk, mac,
AH_FALSE);
}
#undef N
}
@@ -10408,7 +10411,7 @@
if (ath_regdump_filter(sc, address))
continue;
ath_lookup_register_name(sc, name, MAX_REGISTER_NAME_LEN,
address);
- value = OS_REG_READ(ah,address);
+ value = ath_reg_read(sc,address);
ath_print_register(name, address, value);
} while ((address += 4) < MAX_REGISTER_ADDRESS);
}
@@ -10429,7 +10432,7 @@
do {
if (ath_regdump_filter(sc, address))
continue;
- value = OS_REG_READ(ah,address);
+ value = ath_reg_read(sc,address);
p_old = (unsigned int*)&sc->register_snapshot[address];
if (*p_old != value) {
ath_lookup_register_name(sc, name,
MAX_REGISTER_NAME_LEN, address);
@@ -10453,7 +10456,7 @@
do {
*((unsigned int*)&sc->register_snapshot[address]) =
ath_regdump_filter(sc, address) ?
- 0x0 : OS_REG_READ(ah,address);
+ 0x0 : ath_reg_read(sc,address);
} while ((address += 4) < MAX_REGISTER_ADDRESS);
}
#endif /* #ifdef ATH_REVERSE_ENGINEERING */
@@ -10477,7 +10480,7 @@
DEV_NAME(sc->sc_dev), __func__, address);
return 1;
}
- *value = OS_REG_READ(sc->sc_ah, address);
+ *value = ath_reg_read(sc, address);
printk(KERN_DEBUG "*0x%04x -> 0x%08x\n", address, *value);
return 0;
}
@@ -10507,9 +10510,9 @@
DEV_NAME(sc->sc_dev), __func__, address);
return 1;
}
- OS_REG_WRITE(sc->sc_ah, address, value);
+ ath_reg_write(sc, address, value);
printk(KERN_DEBUG "*0x%04x <- 0x%08x = 0x%08x\n", address, value,
- OS_REG_READ(sc->sc_ah, address));
+ ath_reg_read(sc, address));
return 0;
}
#endif /* #ifdef ATH_REVERSE_ENGINEERING */
Added: trunk/ath/if_ath_hal.c
===================================================================
--- trunk/ath/if_ath_hal.c (rev 0)
+++ trunk/ath/if_ath_hal.c 2007-06-15 21:46:34 UTC (rev 2460)
@@ -0,0 +1,38 @@
+/* Wrapper macros/functions for the binary HAL to comply with local coding
+ * convention. Provides function-style calling convention using either macros
+ * or wrapper functions for function pointers in the HAL.
+ *
+ * The typical convention is ath_hal_foo(ah,p1,p2,p3,...) turns into
+ * ah->ah_foo(p1,p2,p3,...) where ah_foo is a function pointer and a member
+ * of the struct ath_hal (usually named ah). */
+
+#include "opt_ah.h"
+
+#ifdef ATH_HALOPS_TRACEABLE
+
+#ifndef AUTOCONF_INCLUDED
+#include <linux/config.h>
+#endif
+#include <linux/version.h>
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/skbuff.h>
+#include <linux/netdevice.h>
+#include <linux/etherdevice.h>
+#include <linux/random.h>
+#include <linux/delay.h>
+#include <linux/cache.h>
+#include <linux/sysctl.h>
+#include <linux/proc_fs.h>
+#include <linux/if_arp.h>
+#include <linux/rtnetlink.h>
+#include <asm/uaccess.h>
+/* Include header file for declarations */
+#include "ath/if_ath_hal.h"
+
+/* Include header file for implementations (if necessary) */
+#define TRACEABLE_IMPL
+#include "ath/if_ath_hal.h"
+#undef TRACEABLE_IMPL
+
+#endif /* #ifdef ATH_HALOPS_TRACEABLE */
Property changes on: trunk/ath/if_ath_hal.c
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/ath/if_ath_hal.h
===================================================================
--- trunk/ath/if_ath_hal.h (rev 0)
+++ trunk/ath/if_ath_hal.h 2007-06-15 21:46:34 UTC (rev 2460)
@@ -0,0 +1,819 @@
+/* Wrapper macros/functions for the binary HAL to comply with local coding
+ * convention. Provides function-style calling convention using either macros
+ * or wrapper functions for function pointers in the HAL.
+ *
+ * The typical convention is ath_hal_foo(ah,p1,p2,p3,...) turns into
+ * ah->ah_foo(p1,p2,p3,...) where ah_foo is a function pointer and a member
+ * of the struct ath_hal (usually named ah). */
+
+
+#ifndef _IF_ATH_HAL_H
+#define _IF_ATH_HAL_H
+
+#define GET_ATH_SOFTC(_ah) ((struct ath_softc*)(_ah->ah_sc))
+#define ATH_HAL_LOCK_INIT(_sc) spin_lock_init(&(_sc)->sc_hal_lock)
+#define ATH_HAL_LOCK_DESTROY(_sc)
+#define ATH_HAL_LOCK_IRQ(_sc) do { \
+ unsigned long __sc_halLockflags; \
+ spin_lock_irqsave(&(_sc)->sc_hal_lock, __sc_halLockflags);
+#define ATH_HAL_UNLOCK_IRQ(_sc) \
+ spin_unlock_irqrestore(&(_sc)->sc_hal_lock, __sc_halLockflags); \
+ } while(0)
+#define ATH_HAL_UNLOCK_IRQ_EARLY(_sc) \
+ spin_unlock_irqrestore(&(_sc)->sc_hal_lock, __sc_halLockflags);
+
+#ifdef ATH_HALOPS_TRACEABLE
+#define __hal_wrapper
+#ifdef TRACEABLE_IMPL
+#define IMPLEMENTATION(_CODEBLOCK) _CODEBLOCK
+#else /* #ifdef TRACEABLE_IMPL */
+#define IMPLEMENTATION(_CODEBLOCK)
+#endif /* #ifdef TRACEABLE_IMPL */
+#else /* #ifdef ATH_HALOPS_TRACEABLE */
+#define __hal_wrapper static inline
+#define IMPLEMENTATION(_CODEBLOCK) _CODEBLOCK
+#endif /* #ifdef ATH_HALOPS_TRACEABLE */
+
+__hal_wrapper void ath_reg_write(struct ath_softc *sc, u_int reg, u_int32_t
val)
+IMPLEMENTATION({
+ ATH_HAL_LOCK_IRQ(sc);
+ OS_REG_WRITE(sc->sc_ah, reg, val);
+ ATH_HAL_UNLOCK_IRQ(sc);
+ })
+
+__hal_wrapper u_int32_t ath_reg_read(struct ath_softc *sc, u_int reg)
+IMPLEMENTATION({
+ u_int32_t ret;
+ ATH_HAL_LOCK_IRQ(sc);
+ ret = OS_REG_READ(sc->sc_ah, reg);
+ ATH_HAL_UNLOCK_IRQ(sc);
+ return ret;
+ })
+__hal_wrapper void ath_hal_getmac(struct ath_hal* ah, u_int8_t* a1)
+ IMPLEMENTATION({
+ ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah));
+ ah->ah_getMacAddress(ah, a1);
+ ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah));
+ })
+__hal_wrapper HAL_POWER_MODE ath_hal_getPowerMode(struct ath_hal* ah)
+ IMPLEMENTATION({
+ HAL_POWER_MODE ret;
+ ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah));
+ ret = ah->ah_getPowerMode(ah);
+ ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah));
+ return ret;
+ })
+__hal_wrapper HAL_BOOL ath_hal_getdiagstate(struct ath_hal* ah, int request,
const void* args, u_int32_t argsize, void* *result, u_int32_t* resultsize)
+ IMPLEMENTATION({
+ HAL_BOOL ret;
+ ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah));
+ ret = ah->ah_getDiagState(ah, request, args, argsize, *result,
resultsize);
+ ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah));
+ return ret;
+ })
+__hal_wrapper void ath_hal_beaconreset(struct ath_hal* ah)
+ IMPLEMENTATION({
+ ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah));
+ ah->ah_resetStationBeaconTimers(ah);
+ ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah));
+ })
+__hal_wrapper void ath_hal_setcoverageclass(struct ath_hal* ah, u_int8_t a1,
int a2)
+ IMPLEMENTATION({
+ ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah));
+ ah->ah_setCoverageClass(ah, a1, a2);
+ ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah));
+ })
+__hal_wrapper u_int64_t ath_hal_gettsf64(struct ath_hal* ah)
+ IMPLEMENTATION({
+ u_int64_t ret;
+ ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah));
+ ret = ah->ah_getTsf64(ah);
+ ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah));
+ return ret;
+ })
+__hal_wrapper void ath_hal_rxena(struct ath_hal* ah)
+ IMPLEMENTATION({
+ ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah));
+ ah->ah_enableReceive(ah);
+ ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah));
+ })
+__hal_wrapper HAL_ANT_SETTING ath_hal_getantennaswitch(struct ath_hal* ah)
+ IMPLEMENTATION({
+ HAL_ANT_SETTING ret;
+ ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah));
+ ret = ah->ah_getAntennaSwitch(ah);
+ ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah));
+ return ret;
+ })
+__hal_wrapper HAL_BOOL ath_hal_gpioset(struct ath_hal* ah, u_int32_t gpio,
u_int32_t val)
+ IMPLEMENTATION({
+ HAL_BOOL ret;
+ ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah));
+ ret = ah->ah_gpioSet(ah, gpio, val);
+ ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah));
+ return ret;
+ })
+__hal_wrapper HAL_BOOL ath_hal_gpioCfgOutput(struct ath_hal* ah, u_int32_t
gpio)
+ IMPLEMENTATION({
+ HAL_BOOL ret;
+ ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah));
+ ret = ah->ah_gpioCfgOutput(ah, gpio);
+ ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah));
+ return ret;
+ })
+__hal_wrapper HAL_BOOL ath_hal_clearmcastfilter(struct ath_hal* ah, u_int32_t
index)
+ IMPLEMENTATION({
+ HAL_BOOL ret;
+ ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah));
+ ret = ah->ah_clrMulticastFilterIndex(ah, index);
+ ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah));
+ return ret;
+ })
+__hal_wrapper void ath_hal_txreqintrdesc(struct ath_hal* ah, struct ath_desc*
a1)
+ IMPLEMENTATION({
+ ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah));
+ ah->ah_reqTxIntrDesc(ah, a1);
+ ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah));
+ })
+__hal_wrapper void ath_hal_rxmonitor(struct ath_hal* ah, const
HAL_NODE_STATS* a1, HAL_CHANNEL* a2)
+ IMPLEMENTATION({
+ ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah));
+ ah->ah_rxMonitor(ah, a1, a2);
+ ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah));
+ })
+__hal_wrapper HAL_BOOL ath_hal_puttxbuf(struct ath_hal* ah, u_int a1,
u_int32_t txdp)
+ IMPLEMENTATION({
+ HAL_BOOL ret;
+ ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah));
+ ret = ah->ah_setTxDP(ah, a1, txdp);
+ ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah));
+ return ret;
+ })
+__hal_wrapper HAL_BOOL ath_hal_keyset(struct ath_hal* ah, u_int16_t a1, const
HAL_KEYVAL* a2, const u_int8_t* a3, int a4)
+ IMPLEMENTATION({
+ HAL_BOOL ret;
+ ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah));
+ ret = ah->ah_setKeyCacheEntry(ah, a1, a2, a3, a4);
+ ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah));
+ return ret;
+ })
+__hal_wrapper void ath_hal_setopmode(struct ath_hal* ah)
+ IMPLEMENTATION({
+ ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah));
+ ah->ah_setPCUConfig(ah);
+ ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah));
+ })
+__hal_wrapper HAL_RFGAIN ath_hal_getrfgain(struct ath_hal* ah)
+ IMPLEMENTATION({
+ HAL_RFGAIN ret;
+ ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah));
+ ret = ah->ah_getRfGain(ah);
+ ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah));
+ return ret;
+ })
+__hal_wrapper void ath_hal_setmcastfilter(struct ath_hal* ah, u_int32_t
filter0, u_int32_t filter1)
+ IMPLEMENTATION({
+ ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah));
+ ah->ah_setMulticastFilter(ah, filter0, filter1);
+ ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah));
+ })
+__hal_wrapper u_int ath_hal_getacktimeout(struct ath_hal* ah)
+ IMPLEMENTATION({
+ u_int ret;
+ ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah));
+ ret = ah->ah_getAckTimeout(ah);
+ ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah));
+ return ret;
+ })
+__hal_wrapper void ath_hal_beacontimers(struct ath_hal* ah, const
HAL_BEACON_STATE* a1)
+ IMPLEMENTATION({
+ ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah));
+ ah->ah_setStationBeaconTimers(ah, a1);
+ ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah));
+ })
+__hal_wrapper HAL_BOOL ath_hal_detectcardpresent(struct ath_hal* ah)
+ IMPLEMENTATION({
+ HAL_BOOL ret;
+ ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah));
+ ret = ah->ah_detectCardPresent(ah);
+ ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah));
+ return ret;
+ })
+__hal_wrapper u_int ath_hal_getslottime(struct ath_hal* ah)
+ IMPLEMENTATION({
+ u_int ret;
+ ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah));
+ ret = ah->ah_getSlotTime(ah);
+ ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah));
+ return ret;
+ })
+__hal_wrapper void ath_hal_beaconinit(struct ath_hal* ah, u_int32_t nexttbtt,
u_int32_t intval)
+ IMPLEMENTATION({
+ ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah));
+ ah->ah_beaconInit(ah, nexttbtt, intval);
+ ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah));
+ })
+__hal_wrapper void ath_hal_gpiosetintr(struct ath_hal* ah, u_int a1,
u_int32_t a2)
+ IMPLEMENTATION({
+ ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah));
+ ah->ah_gpioSetIntr(ah, a1, a2);
+ ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah));
+ })
+__hal_wrapper HAL_BOOL ath_hal_releasetxqueue(struct ath_hal* ah, u_int q)
+ IMPLEMENTATION({
+ HAL_BOOL ret;
+ ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah));
+ ret = ah->ah_releaseTxQueue(ah, q);
+ ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah));
+ return ret;
+ })
+__hal_wrapper HAL_BOOL ath_hal_keysetmac(struct ath_hal* ah, u_int16_t a1,
const u_int8_t* a2)
+ IMPLEMENTATION({
+ HAL_BOOL ret;
+ ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah));
+ ret = ah->ah_setKeyCacheEntryMac(ah, a1, a2);
+ ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah));
+ return ret;
+ })
+__hal_wrapper HAL_STATUS ath_hal_txprocdesc(struct ath_hal* ah, struct
ath_desc* a1, struct ath_tx_status* a2)
+ IMPLEMENTATION({
+ HAL_STATUS ret;
+ ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah));
+ ret = ah->ah_procTxDesc(ah, a1, a2);
+ ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah));
+ return ret;
+ })
+__hal_wrapper HAL_INT ath_hal_intrget(struct ath_hal* ah)
+ IMPLEMENTATION({
+ HAL_INT ret;
+ ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah));
+ ret = ah->ah_getInterrupts(ah);
+ ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah));
+ return ret;
+ })
+__hal_wrapper HAL_BOOL ath_hal_setacktimeout(struct ath_hal* ah, u_int a1)
+ IMPLEMENTATION({
+ HAL_BOOL ret;
+ ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah));
+ ret = ah->ah_setAckTimeout(ah, a1);
+ ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah));
+ return ret;
+ })
+__hal_wrapper HAL_BOOL ath_hal_setbssidmask(struct ath_hal* ah, const
u_int8_t* a1)
+ IMPLEMENTATION({
+ HAL_BOOL ret;
+ ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah));
+ ret = ah->ah_setBssIdMask(ah, a1);
+ ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah));
+ return ret;
+ })
+__hal_wrapper HAL_BOOL ath_hal_setackctsrate(struct ath_hal* ah, u_int a1)
+ IMPLEMENTATION({
+ HAL_BOOL ret;
+ ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah));
+ ret = ah->ah_setAckCTSRate(ah, a1);
+ ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah));
+ return ret;
+ })
+__hal_wrapper u_int32_t ath_hal_getrxfilter(struct ath_hal* ah)
+ IMPLEMENTATION({
+ u_int32_t ret;
+ ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah));
+ ret = ah->ah_getRxFilter(ah);
+ ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah));
+ return ret;
+ })
+__hal_wrapper int16_t ath_hal_get_channel_noise(struct ath_hal* ah,
HAL_CHANNEL* a1)
+ IMPLEMENTATION({
+ int16_t ret;
+ ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah));
+ ret = ah->ah_getChanNoise(ah, a1);
+ ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah));
+ return ret;
+ })
+__hal_wrapper HAL_BOOL ath_hal_keyreset(struct ath_hal* ah, u_int16_t a1)
+ IMPLEMENTATION({
+ HAL_BOOL ret;
+ ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah));
+ ret = ah->ah_resetKeyCacheEntry(ah, a1);
+ ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah));
+ return ret;
+ })
+__hal_wrapper HAL_BOOL ath_hal_setantennaswitch(struct ath_hal* ah,
HAL_ANT_SETTING a1)
+ IMPLEMENTATION({
+ HAL_BOOL ret;
+ ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah));
+ ret = ah->ah_setAntennaSwitch(ah, a1);
+ ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah));
+ return ret;
+ })
+__hal_wrapper HAL_BOOL ath_hal_settxqueueprops(struct ath_hal* ah, int q,
const HAL_TXQ_INFO* qInfo)
+ IMPLEMENTATION({
+ HAL_BOOL ret;
+ ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah));
+ ret = ah->ah_setTxQueueProps(ah, q, qInfo);
+ ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah));
+ return ret;
+ })
+__hal_wrapper void ath_hal_putrxbuf(struct ath_hal* ah, u_int32_t rxdp)
+ IMPLEMENTATION({
+ ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah));
+ ah->ah_setRxDP(ah, rxdp);
+ ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah));
+ })
+__hal_wrapper HAL_BOOL ath_hal_reset(struct ath_hal* ah, HAL_OPMODE a1,
HAL_CHANNEL* a2, HAL_BOOL bChannelChange, HAL_STATUS* status)
+ IMPLEMENTATION({
+ HAL_BOOL ret;
+ ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah));
+ ret = ah->ah_reset(ah, a1, a2, bChannelChange, status);
+ ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah));
+ return ret;
+ })
+__hal_wrapper HAL_BOOL ath_hal_setdecompmask(struct ath_hal* ah, u_int16_t
a1, int a2)
+ IMPLEMENTATION({
+ HAL_BOOL ret;
+ ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah));
+ ret = ah->ah_setDecompMask(ah, a1, a2);
+ ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah));
+ return ret;
+ })
+__hal_wrapper HAL_BOOL ath_hal_gettxqueueprops(struct ath_hal* ah, int q,
HAL_TXQ_INFO* qInfo)
+ IMPLEMENTATION({
+ HAL_BOOL ret;
+ ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah));
+ ret = ah->ah_getTxQueueProps(ah, q, qInfo);
+ ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah));
+ return ret;
+ })
+__hal_wrapper 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)
+ IMPLEMENTATION({
+ HAL_BOOL ret;
+ ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah));
+ ret = ah->ah_fillTxDesc(ah, a1, segLen, firstSeg, lastSeg, a5);
+ ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah));
+ return ret;
+ })
+__hal_wrapper u_int32_t ath_hal_numtxpending(struct ath_hal* ah, u_int q)
+ IMPLEMENTATION({
+ u_int32_t ret;
+ ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah));
+ ret = ah->ah_numTxPending(ah, q);
+ ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah));
+ return ret;
+ })
+__hal_wrapper void ath_hal_startpcurecv(struct ath_hal* ah)
+ IMPLEMENTATION({
+ ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah));
+ ah->ah_startPcuReceive(ah);
+ ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah));
+ })
+__hal_wrapper void ath_hal_setdefantenna(struct ath_hal* ah, u_int a1)
+ IMPLEMENTATION({
+ ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah));
+ ah->ah_setDefAntenna(ah, a1);
+ ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah));
+ })
+__hal_wrapper HAL_BOOL ath_hal_setpower(struct ath_hal* ah, HAL_POWER_MODE
mode, int setChip)
+ IMPLEMENTATION({
+ HAL_BOOL ret;
+ ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah));
+ ret = ah->ah_setPowerMode(ah, mode, setChip);
+ ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah));
+ return ret;
+ })
+__hal_wrapper 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)
+ IMPLEMENTATION({
+ HAL_STATUS ret;
+ ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah));
+ ret = ah->ah_procRxDesc(ah, a1, phyAddr, next, tsf, a5);
+ ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah));
+ return ret;
+ })
+__hal_wrapper u_int ath_hal_getackctsrate(struct ath_hal* ah)
+ IMPLEMENTATION({
+ u_int ret;
+ ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah));
+ ret = ah->ah_getAckCTSRate(ah);
+ ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah));
+ return ret;
+ })
+__hal_wrapper u_int32_t ath_hal_keycachesize(struct ath_hal* ah)
+ IMPLEMENTATION({
+ u_int32_t ret;
+ ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah));
+ ret = ah->ah_getKeyCacheSize(ah);
+ ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah));
+ return ret;
+ })
+__hal_wrapper 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)
+ IMPLEMENTATION({
+ HAL_BOOL ret;
+ ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah));
+ ret = ah->ah_setupXTxDesc(ah, a1, txRate1, txTries1, txRate2, txTries2,
txRate3, txTries3);
+ ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah));
+ return ret;
+ })
+__hal_wrapper HAL_INT ath_hal_intrset(struct ath_hal* ah, HAL_INT a1)
+ IMPLEMENTATION({
+ HAL_INT ret;
+ ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah));
+ ret = ah->ah_setInterrupts(ah, a1);
+ ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah));
+ return ret;
+ })
+__hal_wrapper u_int ath_hal_getctstimeout(struct ath_hal* ah)
+ IMPLEMENTATION({
+ u_int ret;
+ ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah));
+ ret = ah->ah_getCTSTimeout(ah);
+ ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah));
+ return ret;
+ })
+__hal_wrapper void ath_hal_updatemibcounters(struct ath_hal* ah,
HAL_MIB_STATS* a1)
+ IMPLEMENTATION({
+ ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah));
+ ah->ah_updateMibCounters(ah, a1);
+ ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah));
+ })
+__hal_wrapper HAL_BOOL ath_hal_calibrate(struct ath_hal* ah, HAL_CHANNEL* a1,
HAL_BOOL* a2)
+ IMPLEMENTATION({
+ HAL_BOOL ret;
+ ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah));
+ ret = ah->ah_perCalibration(ah, a1, a2);
+ ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah));
+ return ret;
+ })
+__hal_wrapper u_int32_t ath_hal_getrxbuf(struct ath_hal* ah)
+ IMPLEMENTATION({
+ u_int32_t ret;
+ ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah));
+ ret = ah->ah_getRxDP(ah);
+ ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah));
+ return ret;
+ })
+__hal_wrapper HAL_BOOL ath_hal_settxpowlimit(struct ath_hal* ah, u_int32_t a1)
+ IMPLEMENTATION({
+ HAL_BOOL ret;
+ ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah));
+ ret = ah->ah_setTxPowerLimit(ah, a1);
+ ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah));
+ return ret;
+ })
+__hal_wrapper HAL_BOOL ath_hal_getisr(struct ath_hal* ah, HAL_INT* a1)
+ IMPLEMENTATION({
+ HAL_BOOL ret;
+ ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah));
+ ret = ah->ah_getPendingInterrupts(ah, a1);
+ ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah));
+ return ret;
+ })
+__hal_wrapper HAL_BOOL ath_hal_updatetxtriglevel(struct ath_hal* ah, HAL_BOOL
incTrigLevel)
+ IMPLEMENTATION({
+ HAL_BOOL ret;
+ ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah));
+ ret = ah->ah_updateTxTrigLevel(ah, incTrigLevel);
+ ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah));
+ return ret;
+ })
+__hal_wrapper HAL_BOOL ath_hal_resettxqueue(struct ath_hal* ah, u_int q)
+ IMPLEMENTATION({
+ HAL_BOOL ret;
+ ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah));
+ ret = ah->ah_resetTxQueue(ah, q);
+ ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah));
+ return ret;
+ })
+__hal_wrapper HAL_BOOL ath_hal_setmac(struct ath_hal* ah, const u_int8_t* a1)
+ IMPLEMENTATION({
+ HAL_BOOL ret;
+ ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah));
+ ret = ah->ah_setMacAddress(ah, a1);
+ ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah));
+ return ret;
+ })
+__hal_wrapper HAL_BOOL ath_hal_setctstimeout(struct ath_hal* ah, u_int a1)
+ IMPLEMENTATION({
+ HAL_BOOL ret;
+ ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah));
+ ret = ah->ah_setCTSTimeout(ah, a1);
+ ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah));
+ return ret;
+ })
+__hal_wrapper const HAL_RATE_TABLE * ath_hal_getratetable(struct ath_hal* ah,
u_int mode)
+ IMPLEMENTATION({
+ const HAL_RATE_TABLE * ret;
+ ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah));
+ ret = ah->ah_getRateTable(ah, mode);
+ ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah));
+ return ret;
+ })
+__hal_wrapper u_int32_t ath_hal_gettsf32(struct ath_hal* ah)
+ IMPLEMENTATION({
+ u_int32_t ret;
+ ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah));
+ ret = ah->ah_getTsf32(ah);
+ ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah));
+ return ret;
+ })
+__hal_wrapper void ath_hal_mibevent(struct ath_hal* ah, const HAL_NODE_STATS*
a1)
+ IMPLEMENTATION({
+ ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah));
+ ah->ah_procMibEvent(ah, a1);
+ ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah));
+ })
+__hal_wrapper void ath_hal_setbeacontimers(struct ath_hal* ah, const
HAL_BEACON_TIMERS* a1)
+ IMPLEMENTATION({
+ ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah));
+ ah->ah_setBeaconTimers(ah, a1);
+ ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah));
+ })
+__hal_wrapper HAL_STATUS ath_hal_getcapability(struct ath_hal* ah,
HAL_CAPABILITY_TYPE a1, u_int32_t capability, u_int32_t* result)
+ IMPLEMENTATION({
+ HAL_STATUS ret;
+ ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah));
+ ret = ah->ah_getCapability(ah, a1, capability, result);
+ ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah));
+ return ret;
+ })
+__hal_wrapper HAL_BOOL ath_hal_radar_wait(struct ath_hal* ah, HAL_CHANNEL* a1)
+ IMPLEMENTATION({
+ HAL_BOOL ret;
+ ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah));
+ ret = ah->ah_radarWait(ah, a1);
+ ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah));
+ return ret;
+ })
+__hal_wrapper HAL_BOOL ath_hal_setmcastfilterindex(struct ath_hal* ah,
u_int32_t index)
+ IMPLEMENTATION({
+ HAL_BOOL ret;
+ ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah));
+ ret = ah->ah_setMulticastFilterIndex(ah, index);
+ ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah));
+ return ret;
+ })
+__hal_wrapper void ath_hal_getbssidmask(struct ath_hal* ah, u_int8_t* a1)
+ IMPLEMENTATION({
+ ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah));
+ ah->ah_getBssIdMask(ah, a1);
+ ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah));
+ })
+__hal_wrapper HAL_BOOL ath_hal_intrpend(struct ath_hal* ah)
+ IMPLEMENTATION({
+ HAL_BOOL ret;
+ ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah));
+ ret = ah->ah_isInterruptPending(ah);
+ ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah));
+ return ret;
+ })
+__hal_wrapper HAL_BOOL ath_hal_txstart(struct ath_hal* ah, u_int a1)
+ IMPLEMENTATION({
+ HAL_BOOL ret;
+ ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah));
+ ret = ah->ah_startTxDma(ah, a1);
+ ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah));
+ return ret;
+ })
+__hal_wrapper void ath_hal_gettxintrtxqs(struct ath_hal* ah, u_int32_t* a1)
+ IMPLEMENTATION({
+ ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah));
+ ah->ah_getTxIntrQueue(ah, a1);
+ ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah));
+ })
+__hal_wrapper HAL_BOOL ath_hal_setslottime(struct ath_hal* ah, u_int a1)
+ IMPLEMENTATION({
+ HAL_BOOL ret;
+ ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah));
+ ret = ah->ah_setSlotTime(ah, a1);
+ ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah));
+ return ret;
+ })
+__hal_wrapper void ath_hal_setledstate(struct ath_hal* ah, HAL_LED_STATE a1)
+ IMPLEMENTATION({
+ ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah));
+ ah->ah_setLedState(ah, a1);
+ ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah));
+ })
+__hal_wrapper void ath_hal_setassocid(struct ath_hal* ah, const u_int8_t*
bssid, u_int16_t assocId)
+ IMPLEMENTATION({
+ ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah));
+ ah->ah_writeAssocid(ah, bssid, assocId);
+ ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah));
+ })
+__hal_wrapper void ath_hal_resettsf(struct ath_hal* ah)
+ IMPLEMENTATION({
+ ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah));
+ ah->ah_resetTsf(ah);
+ ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah));
+ })
+__hal_wrapper HAL_BOOL ath_hal_setuprxdesc(struct ath_hal* ah, struct
ath_desc* a1, u_int32_t size, u_int flags)
+ IMPLEMENTATION({
+ HAL_BOOL ret;
+ ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah));
+ ret = ah->ah_setupRxDesc(ah, a1, size, flags);
+ ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah));
+ return ret;
+ })
+__hal_wrapper void ath_hal_setrxfilter(struct ath_hal* ah, u_int32_t a1)
+ IMPLEMENTATION({
+ ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah));
+ ah->ah_setRxFilter(ah, a1);
+ ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah));
+ })
+__hal_wrapper HAL_BOOL ath_hal_keyisvalid(struct ath_hal* ah, u_int16_t a1)
+ IMPLEMENTATION({
+ HAL_BOOL ret;
+ ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah));
+ ret = ah->ah_isKeyCacheEntryValid(ah, a1);
+ ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah));
+ return ret;
+ })
+__hal_wrapper void ath_hal_stoppcurecv(struct ath_hal* ah)
+ IMPLEMENTATION({
+ ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah));
+ ah->ah_stopPcuReceive(ah);
+ ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah));
+ })
+__hal_wrapper HAL_BOOL ath_hal_stoptxdma(struct ath_hal* ah, u_int a1)
+ IMPLEMENTATION({
+ HAL_BOOL ret;
+ ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah));
+ ret = ah->ah_stopTxDma(ah, a1);
+ ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah));
+ return ret;
+ })
+__hal_wrapper HAL_BOOL ath_hal_setcapability(struct ath_hal* ah,
HAL_CAPABILITY_TYPE a1, u_int32_t capability, u_int32_t setting, HAL_STATUS* a4)
+ IMPLEMENTATION({
+ HAL_BOOL ret;
+ ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah));
+ ret = ah->ah_setCapability(ah, a1, capability, setting, a4);
+ ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah));
+ return ret;
+ })
+__hal_wrapper HAL_BOOL ath_hal_stopdmarecv(struct ath_hal* ah)
+ IMPLEMENTATION({
+ HAL_BOOL ret;
+ ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah));
+ ret = ah->ah_stopDmaReceive(ah);
+ ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah));
+ return ret;
+ })
+__hal_wrapper u_int32_t ath_hal_gettxbuf(struct ath_hal* ah, u_int a1)
+ IMPLEMENTATION({
+ u_int32_t ret;
+ ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah));
+ ret = ah->ah_getTxDP(ah, a1);
+ ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah));
+ return ret;
+ })
+__hal_wrapper int ath_hal_setuptxqueue(struct ath_hal* ah, HAL_TX_QUEUE a1,
const HAL_TXQ_INFO* qInfo)
+ IMPLEMENTATION({
+ int ret;
+ ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah));
+ ret = ah->ah_setupTxQueue(ah, a1, qInfo);
+ ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah));
+ return ret;
+ })
+__hal_wrapper u_int ath_hal_getdefantenna(struct ath_hal* ah)
+ IMPLEMENTATION({
+ u_int ret;
+ ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah));
+ ret = ah->ah_getDefAntenna(ah);
+ ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah));
+ return ret;
+ })
+__hal_wrapper HAL_BOOL ath_hal_phydisable(struct ath_hal* ah)
+ IMPLEMENTATION({
+ HAL_BOOL ret;
+ ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah));
+ ret = ah->ah_phyDisable(ah);
+ ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah));
+ return ret;
+ })
+__hal_wrapper HAL_BOOL ath_hal_setregulatorydomain(struct ath_hal* ah,
u_int16_t a1, HAL_STATUS* a2)
+ IMPLEMENTATION({
+ HAL_BOOL ret;
+ ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah));
+ ret = ah->ah_setRegulatoryDomain(ah, a1, a2);
+ ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah));
+ return ret;
+ })
+__hal_wrapper 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)
+ IMPLEMENTATION({
+ HAL_BOOL ret;
+ ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah));
+ ret = ah->ah_setupTxDesc(ah, a1, pktLen, hdrLen, type, txPower,
txRate0, txTries0, keyIx, antMode, flags, rtsctsRate, rtsctsDuration,
compicvLen, compivLen, comp);
+ ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah));
+ return ret;
+ })
+__hal_wrapper HAL_BOOL ath_hal_gpiCfgInput(struct ath_hal* ah, u_int32_t gpio)
+ IMPLEMENTATION({
+ HAL_BOOL ret;
+ ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah));
+ ret = ah->ah_gpioCfgInput(ah, gpio);
+ ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah));
+ return ret;
+ })
+__hal_wrapper u_int32_t ath_hal_gpioget(struct ath_hal* ah, u_int32_t gpio)
+ IMPLEMENTATION({
+ u_int32_t ret;
+ ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah));
+ ret = ah->ah_gpioGet(ah, gpio);
+ ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah));
+ return ret;
+ })
+__hal_wrapper HAL_BOOL ath_hal_disable(struct ath_hal* ah)
+ IMPLEMENTATION({
+ HAL_BOOL ret;
+ ATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah));
+ ret = ah->ah_disable(ah);
+ ATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah));
+ return ret;
+ })
+/* These custom wrappers are defined in scripts/regenerate_ath_hal_api.pl and
+ * are used as shortcut accessors for HAL functions. */
+__hal_wrapper HAL_BOOL ath_hal_settpc(struct ath_hal* ah, u_int32_t v)
+ IMPLEMENTATION({ return ((ath_hal_setcapability(ah, HAL_CAP_TPC, 1, v,
NULL))); })
+__hal_wrapper HAL_BOOL ath_hal_gettsfadjust(struct ath_hal* ah)
+ IMPLEMENTATION({ return ((ath_hal_getcapability(ah, HAL_CAP_TSF_ADJUST,
1, NULL) == HAL_OK)); })
+__hal_wrapper HAL_BOOL ath_hal_hasrfsilent(struct ath_hal* ah)
+ IMPLEMENTATION({ return ((ath_hal_getcapability(ah, HAL_CAP_RFSILENT,
0, NULL) == HAL_OK)); })
+__hal_wrapper HAL_BOOL ath_hal_quarterrate_chansupported(struct ath_hal* ah)
+ IMPLEMENTATION({ return ((ath_hal_getcapability(ah,
HAL_CAP_CHAN_QUARTERRATE, 0, NULL) == HAL_OK)); })
+__hal_wrapper HAL_BOOL ath_hal_xrsupported(struct ath_hal* ah)
+ IMPLEMENTATION({ return ((ath_hal_getcapability(ah, HAL_CAP_XR, 0,
NULL) == HAL_OK)); })
+__hal_wrapper HAL_BOOL ath_hal_getmaxtxpow(struct ath_hal* ah, u_int32_t*
destination)
+ IMPLEMENTATION({ return ((ath_hal_getcapability(ah, HAL_CAP_TXPOW, 2,
destination) == HAL_OK)); })
+__hal_wrapper HAL_BOOL ath_hal_gettkipmic(struct ath_hal* ah)
+ IMPLEMENTATION({ return ((ath_hal_getcapability(ah, HAL_CAP_TKIP_MIC,
1, NULL) == HAL_OK)); })
+__hal_wrapper HAL_BOOL ath_hal_hasbssidmask(struct ath_hal* ah)
+ IMPLEMENTATION({ return ((ath_hal_getcapability(ah, HAL_CAP_BSSIDMASK,
0, NULL) == HAL_OK)); })
+__hal_wrapper HAL_BOOL ath_hal_settkipmic(struct ath_hal* ah, u_int32_t v)
+ IMPLEMENTATION({ return ((ath_hal_setcapability(ah, HAL_CAP_TKIP_MIC,
1, v, NULL))); })
+__hal_wrapper HAL_BOOL ath_hal_hasdiversity(struct ath_hal* ah)
+ IMPLEMENTATION({ return ((ath_hal_getcapability(ah, HAL_CAP_DIVERSITY,
0, NULL) == HAL_OK)); })
+__hal_wrapper HAL_BOOL ath_hal_getregdomain(struct ath_hal* ah, u_int32_t*
destination)
+ IMPLEMENTATION({ return ((ath_hal_getcapability(ah, HAL_CAP_REG_DMN, 0,
destination))); })
+__hal_wrapper HAL_BOOL ath_hal_setdiversity(struct ath_hal* ah, int v)
+ IMPLEMENTATION({ return ((ath_hal_setcapability(ah, HAL_CAP_DIVERSITY,
1, v, NULL))); })
+__hal_wrapper HAL_BOOL ath_hal_fastframesupported(struct ath_hal* ah)
+ IMPLEMENTATION({ return ((ath_hal_getcapability(ah, HAL_CAP_FASTFRAME,
0, NULL) == HAL_OK)); })
+__hal_wrapper HAL_BOOL ath_hal_gettpscale(struct ath_hal* ah, u_int32_t*
destination)
+ IMPLEMENTATION({ return ((ath_hal_getcapability(ah, HAL_CAP_TXPOW, 3,
destination) == HAL_OK)); })
+__hal_wrapper HAL_BOOL ath_hal_settkipsplit(struct ath_hal* ah, int v)
+ IMPLEMENTATION({ return ((ath_hal_setcapability(ah, HAL_CAP_TKIP_SPLIT,
1, v, NULL))); })
+__hal_wrapper HAL_BOOL ath_hal_getnumtxqueues(struct ath_hal* ah, u_int32_t*
destination)
+ IMPLEMENTATION({ return ((ath_hal_getcapability(ah,
HAL_CAP_NUM_TXQUEUES, 0, destination) == HAL_OK)); })
+__hal_wrapper HAL_BOOL ath_hal_compressionsupported(struct ath_hal* ah)
+ IMPLEMENTATION({ return ((ath_hal_getcapability(ah,
HAL_CAP_COMPRESSION, 0, NULL) == HAL_OK)); })
+__hal_wrapper HAL_BOOL ath_hal_burstsupported(struct ath_hal* ah)
+ IMPLEMENTATION({ return ((ath_hal_getcapability(ah, HAL_CAP_BURST, 0,
NULL) == HAL_OK)); })
+__hal_wrapper HAL_BOOL ath_hal_gettpc(struct ath_hal* ah)
+ IMPLEMENTATION({ return ((ath_hal_getcapability(ah, HAL_CAP_TPC, 1,
NULL) == HAL_OK)); })
+__hal_wrapper HAL_BOOL ath_hal_gettkipsplit(struct ath_hal* ah)
+ IMPLEMENTATION({ return ((ath_hal_getcapability(ah, HAL_CAP_TKIP_SPLIT,
1, NULL) == HAL_OK)); })
+__hal_wrapper HAL_BOOL ath_hal_hastkipsplit(struct ath_hal* ah)
+ IMPLEMENTATION({ return ((ath_hal_getcapability(ah, HAL_CAP_TKIP_SPLIT,
0, NULL) == HAL_OK)); })
+__hal_wrapper HAL_BOOL ath_hal_halfrate_chansupported(struct ath_hal* ah)
+ IMPLEMENTATION({ return ((ath_hal_getcapability(ah,
HAL_CAP_CHAN_HALFRATE, 0, NULL) == HAL_OK)); })
+__hal_wrapper HAL_BOOL ath_hal_getdiversity(struct ath_hal* ah)
+ IMPLEMENTATION({ return ((ath_hal_getcapability(ah, HAL_CAP_DIVERSITY,
1, NULL) == HAL_OK)); })
+__hal_wrapper HAL_BOOL ath_hal_hwphycounters(struct ath_hal* ah)
+ IMPLEMENTATION({ return ((ath_hal_getcapability(ah,
HAL_CAP_PHYCOUNTERS, 0, NULL) == HAL_OK)); })
+__hal_wrapper HAL_BOOL ath_hal_hastsfadjust(struct ath_hal* ah)
+ IMPLEMENTATION({ return ((ath_hal_getcapability(ah, HAL_CAP_TSF_ADJUST,
0, NULL) == HAL_OK)); })
+__hal_wrapper HAL_BOOL ath_hal_settpscale(struct ath_hal* ah, u_int32_t v)
+ IMPLEMENTATION({ return ((ath_hal_setcapability(ah, HAL_CAP_TXPOW, 3,
v, NULL))); })
+__hal_wrapper HAL_BOOL ath_hal_hasbursting(struct ath_hal* ah)
+ IMPLEMENTATION({ return ((ath_hal_getcapability(ah, HAL_CAP_BURST, 0,
NULL) == HAL_OK)); })
+__hal_wrapper HAL_BOOL ath_hal_settsfadjust(struct ath_hal* ah, u_int32_t v)
+ IMPLEMENTATION({ return ((ath_hal_setcapability(ah, HAL_CAP_TSF_ADJUST,
1, v, NULL))); })
+__hal_wrapper HAL_BOOL ath_hal_hastxpowlimit(struct ath_hal* ah)
+ IMPLEMENTATION({ return ((ath_hal_getcapability(ah, HAL_CAP_TXPOW, 0,
NULL) == HAL_OK)); })
+__hal_wrapper HAL_BOOL ath_hal_setrfsilent(struct ath_hal* ah, u_int32_t v)
+ IMPLEMENTATION({ return ((ath_hal_setcapability(ah, HAL_CAP_RFSILENT,
1, v, NULL))); })
+__hal_wrapper HAL_BOOL ath_hal_hasfastframes(struct ath_hal* ah)
+ IMPLEMENTATION({ return ((ath_hal_getcapability(ah, HAL_CAP_FASTFRAME,
0, NULL) == HAL_OK)); })
+__hal_wrapper HAL_BOOL ath_hal_hasmcastkeysearch(struct ath_hal* ah)
+ IMPLEMENTATION({ return ((ath_hal_getcapability(ah,
HAL_CAP_MCAST_KEYSRCH, 0, NULL) == HAL_OK)); })
+__hal_wrapper HAL_BOOL ath_hal_turboagsupported(struct ath_hal* ah, int
countrycode)
+ IMPLEMENTATION({ return ((ath_hal_getwirelessmodes(ah, countrycode) &
(HAL_MODE_108G|HAL_MODE_TURBO))); })
+__hal_wrapper HAL_BOOL ath_hal_hasveol(struct ath_hal* ah)
+ IMPLEMENTATION({ return ((ath_hal_getcapability(ah, HAL_CAP_VEOL, 0,
NULL) == HAL_OK)); })
+__hal_wrapper HAL_BOOL ath_hal_wmetkipmic(struct ath_hal* ah)
+ IMPLEMENTATION({ return ((ath_hal_getcapability(ah,
HAL_CAP_WME_TKIPMIC, 0, NULL) == HAL_OK)); })
+__hal_wrapper HAL_BOOL ath_hal_hascompression(struct ath_hal* ah)
+ IMPLEMENTATION({ return ((ath_hal_getcapability(ah,
HAL_CAP_COMPRESSION, 0, NULL) == HAL_OK)); })
+__hal_wrapper HAL_BOOL ath_hal_getmcastkeysearch(struct ath_hal* ah)
+ IMPLEMENTATION({ return ((ath_hal_getcapability(ah,
HAL_CAP_MCAST_KEYSRCH, 1, NULL) == HAL_OK)); })
+__hal_wrapper HAL_BOOL ath_hal_ciphersupported(struct ath_hal* ah, u_int32_t
cipher)
+ IMPLEMENTATION({ return ((ath_hal_getcapability(ah, HAL_CAP_CIPHER,
cipher, NULL) == HAL_OK)); })
+__hal_wrapper HAL_BOOL ath_hal_gettxpowlimit(struct ath_hal* ah, u_int32_t*
destination)
+ IMPLEMENTATION({ return ((ath_hal_getcapability(ah, HAL_CAP_TXPOW, 1,
destination) == HAL_OK)); })
+__hal_wrapper HAL_BOOL ath_hal_hastkipmic(struct ath_hal* ah)
+ IMPLEMENTATION({ return ((ath_hal_getcapability(ah, HAL_CAP_TKIP_MIC,
0, NULL) == HAL_OK)); })
+__hal_wrapper HAL_BOOL ath_hal_hastpc(struct ath_hal* ah)
+ IMPLEMENTATION({ return ((ath_hal_getcapability(ah, HAL_CAP_TPC, 0,
NULL) == HAL_OK)); })
+__hal_wrapper HAL_BOOL ath_hal_getcountrycode(struct ath_hal* ah, u_int32_t*
destination)
+ IMPLEMENTATION({ return (((*(destination) = ah->ah_countryCode),
AH_TRUE)); })
+
+#endif /* _IF_ATH_HAL_H */
Property changes on: trunk/ath/if_ath_hal.h
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/ath/if_athvar.h
===================================================================
--- trunk/ath/if_athvar.h 2007-06-15 04:53:44 UTC (rev 2459)
+++ trunk/ath/if_athvar.h 2007-06-15 21:46:34 UTC (rev 2460)
@@ -47,6 +47,7 @@
#include "ah_os.h"
#include "if_athioctl.h"
#include "net80211/ieee80211.h" /* XXX for WME_NUM_AC */
+#include <asm/io.h>
/*
* Deduce if tasklets are available. If not then
@@ -535,6 +536,7 @@
void (*sc_node_free)(struct ieee80211_node *);
void *sc_bdev; /* associated bus device */
struct ath_hal *sc_ah; /* Atheros HAL */
+ spinlock_t sc_hal_lock; /* hardware access lock */
struct ath_ratectrl *sc_rc; /* tx rate control support */
struct ath_tx99 *sc_tx99; /* tx99 support */
void (*sc_setdefantenna)(struct ath_softc *, u_int);
@@ -737,6 +739,4 @@
void ath_sysctl_register(void);
void ath_sysctl_unregister(void);
-#include "ath_hal_api.h"
-
#endif /* _DEV_ATH_ATHVAR_H */
Modified: trunk/ath_hal/Makefile
===================================================================
--- trunk/ath_hal/Makefile 2007-06-15 04:53:44 UTC (rev 2459)
+++ trunk/ath_hal/Makefile 2007-06-15 21:46:34 UTC (rev 2460)
@@ -49,7 +49,7 @@
include $(TOP)/Makefile.inc
obj-m += ath_hal.o
-ath_hal-objs := ah_os.o ath_hal_api.o $(TARGET).hal.o
+ath_hal-objs := ah_os.o $(TARGET).hal.o
hostprogs-y := uudecode
Modified: trunk/ath_hal/ah_os.c
===================================================================
--- trunk/ath_hal/ah_os.c 2007-06-15 04:53:44 UTC (rev 2459)
+++ trunk/ath_hal/ah_os.c 2007-06-15 21:46:34 UTC (rev 2460)
@@ -223,11 +223,13 @@
return ath_hal_setlogging(enable);
}
+/*
+This should only be called while holding the lock, sc->sc_hal_lock.
+*/
static struct ale *
ath_hal_alq_get(struct ath_hal *ah)
{
struct ale *ale;
-
if (ath_hal_alq_emitdev) {
ale = alq_get(ath_hal_alq, ALQ_NOWAIT);
if (ale) {
@@ -247,6 +249,9 @@
return ale;
}
+/*
+This should only be called while holding the lock, sc->sc_hal_lock.
+*/
void __ahdecl
ath_hal_reg_write(struct ath_hal *ah, u_int32_t reg, u_int32_t val)
{
@@ -269,17 +274,18 @@
}
EXPORT_SYMBOL(ath_hal_reg_write);
+/*
+This should only be called while holding the lock, sc->sc_hal_lock.
+*/
u_int32_t __ahdecl
ath_hal_reg_read(struct ath_hal *ah, u_int32_t reg)
{
u_int32_t val;
-
val = _OS_REG_READ(ah, reg);
if (ath_hal_alq) {
unsigned long flags;
struct ale *ale;
- local_irq_save(flags);
ale = ath_hal_alq_get(ah);
if (ale) {
struct athregrec *r = (struct athregrec *) ale->ae_data;
@@ -288,20 +294,20 @@
r->val = val;
alq_post(ath_hal_alq, ale);
}
- local_irq_restore(flags);
}
return val;
}
EXPORT_SYMBOL(ath_hal_reg_read);
+/*
+ * This should only be called while holding the lock, sc->sc_hal_lock.
+ */
void __ahdecl
OS_MARK(struct ath_hal *ah, u_int id, u_int32_t v)
{
if (ath_hal_alq) {
- unsigned long flags;
struct ale *ale;
- local_irq_save(flags);
ale = ath_hal_alq_get(ah);
if (ale) {
struct athregrec *r = (struct athregrec *) ale->ae_data;
@@ -310,7 +316,6 @@
r->val = v;
alq_post(ath_hal_alq, ale);
}
- local_irq_restore(flags);
}
}
EXPORT_SYMBOL(OS_MARK);
@@ -322,6 +327,8 @@
* for architectures that might need to do something before
* referencing memory (e.g. remap an i/o window).
*
+ * This should only be called while holding the lock, sc->sc_hal_lock.
+ *
* NB: see the comments in ah_osdep.h about byte-swapping register
* reads and writes to understand what's going on below.
*/
@@ -336,6 +343,9 @@
}
EXPORT_SYMBOL(ath_hal_reg_write);
+/*
+This should only be called while holding the lock, sc->sc_hal_lock.
+*/
u_int32_t __ahdecl
ath_hal_reg_read(struct ath_hal *ah, u_int reg)
{
Modified: trunk/ath_hal/ah_os.h
===================================================================
--- trunk/ath_hal/ah_os.h 2007-06-15 04:53:44 UTC (rev 2459)
+++ trunk/ath_hal/ah_os.h 2007-06-15 21:46:34 UTC (rev 2460)
@@ -38,12 +38,41 @@
#ifndef _ATH_AH_OS_H_
#define _ATH_AH_OS_H_
-#include <ah.h>
-
/*
* Atheros Hardware Access Layer (HAL) OS Dependent Definitions.
*/
+/*
+MadWifi safe register operations:
+
+ When hacking on registers directly we need to use the macros
+ below, to avoid concurrent PCI access and abort mode errors.
+
+ * ath_reg_read
+ * ATH_REG_WRITE
+
+HAL-ONLY register operations:
+
+ * _OS_REG_READ
+ * _OS_REG_WRITE
+ * OS_REG_READ
+ * OS_REG_WRITE
+ * ath_hal_reg_read.
+ * ath_hal_reg_write
+
+ When compiled in HAL:
+ * We do not require locking overhead and function call unless
user is debugging.
+ * All HAL operations are executed in the context of a MadWifi
wrapper call which holds
+ the HAL lock.
+ * Normally HAL is build with the non-modified version of this
file so it doesnt have our
+ funny macros anyway.
+
+ When compiled in MadWifi:
+ * The HAL wrapper API takes the HAL lock before invoking the
HAL.
+ * HAL access is already protected, and MadWifi must NOT access
the functions listed above.
+
+*/
+
/*
* When building the HAL proper we use no GPL-contaminated include
* files and must define these types ourself. Beware of these being
@@ -143,7 +172,6 @@
* never byte-swapped by PCI chipsets or bridges, but always
* written directly (i.e. the format defined by the manufacturer).
*/
-
#if (AH_BYTE_ORDER == AH_BIG_ENDIAN)
#define _OS_REG_WRITE(_ah, _reg, _val) do { \
(0x4000 <= (_reg) && (_reg) < 0x5000) ? \
@@ -164,16 +192,17 @@
readl((_ah)->ah_sh + (_reg))
#endif /* AH_BYTE_ORDER */
+/*
+The functions in this section are not intended to be invoked by MadWifi driver
+code, but by the HAL. They are NOT safe for direct invocation when the
+sc->sc_hal_lock is not held. Use ath_reg_read and ATH_REG_WRITE instead!
+*/
#if defined(AH_DEBUG) || defined(AH_REGOPS_FUNC) || defined(AH_DEBUG_ALQ)
-/* use functions to do register operations */
#define OS_REG_WRITE(_ah, _reg, _val) ath_hal_reg_write(_ah, _reg,
_val)
#define OS_REG_READ(_ah, _reg) ath_hal_reg_read(_ah, _reg)
-
-extern void __ahdecl ath_hal_reg_write(struct ath_hal *ah,
- u_int reg, u_int32_t val);
+extern void __ahdecl ath_hal_reg_write(struct ath_hal *ah, u_int reg,
u_int32_t val);
extern u_int32_t __ahdecl ath_hal_reg_read(struct ath_hal *ah, u_int reg);
#else
-/* inline register operations */
#define OS_REG_WRITE(_ah, _reg, _val) _OS_REG_WRITE(_ah, _reg, _val)
#define OS_REG_READ(_ah, _reg) _OS_REG_READ(_ah, _reg)
#endif /* AH_DEBUG || AH_REGFUNC || AH_DEBUG_ALQ */
Deleted: trunk/ath_hal/ath_hal_api.c
Deleted: trunk/ath_hal/ath_hal_api.h
Modified: trunk/ath_rate/amrr/amrr.c
===================================================================
--- trunk/ath_rate/amrr/amrr.c 2007-06-15 04:53:44 UTC (rev 2459)
+++ trunk/ath_rate/amrr/amrr.c 2007-06-15 21:46:34 UTC (rev 2460)
@@ -65,6 +65,7 @@
#include <net80211/ieee80211_rate.h>
#include "if_athvar.h"
+#include "if_ath_hal.h"
#include "ah_desc.h"
#include "amrr.h"
Modified: trunk/ath_rate/minstrel/minstrel.c
===================================================================
--- trunk/ath_rate/minstrel/minstrel.c 2007-06-15 04:53:44 UTC (rev 2459)
+++ trunk/ath_rate/minstrel/minstrel.c 2007-06-15 21:46:34 UTC (rev 2460)
@@ -112,6 +112,7 @@
#include <net80211/ieee80211_rate.h>
#include "if_athvar.h"
+#include "if_ath_hal.h"
#include "ah_desc.h"
#include "minstrel.h"
Modified: trunk/ath_rate/onoe/onoe.c
===================================================================
--- trunk/ath_rate/onoe/onoe.c 2007-06-15 04:53:44 UTC (rev 2459)
+++ trunk/ath_rate/onoe/onoe.c 2007-06-15 21:46:34 UTC (rev 2460)
@@ -61,6 +61,7 @@
#include <net80211/ieee80211_rate.h>
#include "if_athvar.h"
+#include "if_ath_hal.h"
#include "ah_desc.h"
#include "onoe.h"
Modified: trunk/ath_rate/sample/sample.c
===================================================================
--- trunk/ath_rate/sample/sample.c 2007-06-15 04:53:44 UTC (rev 2459)
+++ trunk/ath_rate/sample/sample.c 2007-06-15 21:46:34 UTC (rev 2460)
@@ -63,6 +63,7 @@
#include <net80211/ieee80211_rate.h>
#include "if_athvar.h"
+#include "if_ath_hal.h"
#include "ah_desc.h"
#include "sample.h"
Added: trunk/scripts/if_ath_hal_generator.pl
===================================================================
--- trunk/scripts/if_ath_hal_generator.pl (rev 0)
+++ trunk/scripts/if_ath_hal_generator.pl 2007-06-15 21:46:34 UTC (rev
2460)
@@ -0,0 +1,237 @@
+#!/usr/bin/perl
+strict;
+use warnings;
+require 'dumpvar.pl';
+
+# Workaround for perl's warning mechanism, avoids 'possible typo' for every
setting used only one time.
+$header_for_c = undef;
+$footer_for_c = undef;
+$header_for_h = undef;
+$footer_for_h = undef;
+$if_ath_hal_c = undef;
+$if_ath_hal_h = undef;
+$path_to_hal = undef;
+$hal_functions_not_to_wrap = undef;
+$hal_h = undef;
+
+# Include settings, calculate a few new ones
+require "scripts/if_ath_hal_settings.pl";
+$path_to_ah_h = "$path_to_hal/$hal_h";
+$path_to_if_ath_hal_h = "$path_to_ath/$if_ath_hal_h";
+$path_to_if_ath_hal_c = "$path_to_ath/$if_ath_hal_c";
+
+# Parsed Function Data
+
+# list of declarations in document order
+@hal_prototypes = ();
+# hash of string->string (hal's function name to return type)
+%hal_functionname_to_return_type = ();
+# hash of string->list of strings (ordered list of parameter names)
+%hal_functionname_to_parameter_name_array = ();
+# hash of string->list of strings (ordered list of parameter types)
+%hal_functionname_to_parameter_types_array = ();
+# hash of string->string (hal's function name to return type)
+%wrapper_functionname_to_return_type = ();
+# hash of string->string (hal's function name to expression)
+%wrapper_functionname_to_expression = ();
+# hash of string->list of strings (ordered list of wrapper function parameter
names)
+%wrapper_functionname_to_parameter_name_array = ();
+# hash of string->list of strings (ordered list of wrapper function parameter
types)
+%wrapper_functionname_to_parameter_types_array = ();
+
+# Open the files we need
+if(!open AH_H, "<$path_to_ah_h") {
+ die "Cannot open $path_to_ah_h: $!";
+}
+if(!open ATH_HAL_API_H, ">$path_to_if_ath_hal_h") {
+ close AH_H;
+ die "Cannot open $path_to_if_ath_hal_h: $!";
+}
+if(!open ATH_HAL_API_C, ">$path_to_if_ath_hal_c") {
+ close AH_H;
+ close ATH_HAL_API_H;
+ die "Cannot open $path_to_if_ath_hal_c: $!";
+}
+
+# Parse and scrub the hal structure's member function declarations
+$line_continued = 0;
+$line_buffer = "";
+foreach (<AH_H>) {
+ chomp($_);
+ s/\s+$//g;
+ s/^\s+//g;
+ s/\s+/ /g;
+ if (/__ahdecl\s*\(.*/ || $line_continued) {
+ $line_buffer .= "$_";
+ if (/__ahdecl.*;/ || ($line_continued && /;/)) {
+ push @hal_prototypes, $line_buffer;
+ $line_buffer = "";
+ $line_continued = 0;
+ }
+ else {
+ $line_buffer .= " ";
+ $line_continued = 1;
+ }
+ }
+}
+
+# Now pick apart the return type, parameter types, and parameter names for
each HAL function
+foreach $proto (@hal_prototypes) {
+ $proto =~
/^((?:(?:const|struct)\s*)*[^\s]+[\s]*\*?)[\s]*__ahdecl\(\*([^\)]*)\)\((.*)\);/;
+ my $return_type = $1;
+ my $member_name = $2;
+ my $parameterlist = $3;
+ if(! grep{/$member_name/} @hal_functions_not_to_wrap ) {
+ $hal_functionname_to_return_type{"$member_name"} = $return_type;
+ @{$hal_functionname_to_parameter_name_array{"$member_name"}} = ();
+ @{$hal_functionname_to_parameter_types_array{"$member_name"}} = ();
+ my @parameters = split /,\s?/, $parameterlist;
+ $argnum = 0;
+ $first = 1;
+ foreach(@parameters) {
+ $_ =~ s/ \*/\* /;
+ $_ =~ /^((?:(?:const|struct|\*)\s*)*)([^\s]+\*?)\s*([^\s]*)\s*/;
+ my $type = "$1$2";
+ my $name = "$3";
+ if(0 == length($name)) {
+ if($argnum == 0 && $type =~ /ath_hal/) {
+ $name = "ah";
+ }
+ else {
+ $name = "a" . $argnum;
+ }
+ }
+
+ push @{$hal_functionname_to_parameter_name_array{$member_name}}, $name;
+ push @{$hal_functionname_to_parameter_types_array{$member_name}},
$type;
+ $first = 0;
+ $argnum++;
+ }
+ }
+}
+
+# Now pick apart the return type, parameter types, and parameter names for
each HAL wrapper
+foreach $proto (keys %custom_wrappers) {
+ $proto =~ /^((?:(?:const|struct|\*))*\s*[^\s]+)[\s]*([^\(]*)\((.*)\)/;
+ my $return_type = $1;
+ my $wrapper_name = $2;
+ my $parameterlist = $3;
+ $wrapper_functionname_to_return_type{$wrapper_name} = $return_type;
+ $wrapper_functionname_to_expression{$wrapper_name} =
$custom_wrappers{$proto};
+ @{$wrapper_functionname_to_parameter_name_array{$wrapper_name}} = ();
+ @{$wrapper_functionname_to_parameter_types_array{$wrapper_name}} = ();
+ my @parameters = split /,\s?/, $parameterlist;
+ $argnum = 0;
+ $first = 1;
+ foreach(@parameters) {
+ $_ =~ s/ \*/\* /;
+ $_ =~ /^((?:(?:const|struct|\*)\s*)*)([^\s]+\*?)\s*([^\s]*)\s*/;
+ my $type = "$1$2";
+ my $name = "$3";
+ if(0 == length($name)) {
+ if($argnum == 0 && $type =~ /ath_hal/) {
+ $name = "ah";
+ }
+ else {
+ $name = "a" . $argnum;
+ }
+ }
+
+ push @{$wrapper_functionname_to_parameter_name_array{$wrapper_name}},
$name;
+ push @{$wrapper_functionname_to_parameter_types_array{$wrapper_name}},
$type;
+ $first = 0;
+ $argnum++;
+ }
+}
+
+# Generate the header file
+print ATH_HAL_API_H $header_for_h;
+
+for $member_name (keys %hal_functionname_to_return_type) {
+ my $api_return_type = $hal_functionname_to_return_type{$member_name};
+ my $api_name = $member_name;
+ if(exists $hal_function_name_to_madwifi_name{$member_name}) {
+ $api_name = $hal_function_name_to_madwifi_name{$member_name};
+ }
+ print ATH_HAL_API_H "__hal_wrapper " . $api_return_type . " " . $api_name .
"(";
+ my @names = @{$hal_functionname_to_parameter_name_array{$member_name}};
+ my @types = @{$hal_functionname_to_parameter_types_array{$member_name}};
+ for $i (0..$#names) {
+ if($i) {
+ print ATH_HAL_API_H ", ";
+ }
+ print ATH_HAL_API_H $types[$i] . " " . $names[$i];
+ }
+ print ATH_HAL_API_H ")\n\tIMPLEMENTATION({";
+ if(! ($api_return_type =~ /void/ )) {
+ print ATH_HAL_API_H "\n\t" . $api_return_type . " ret;";
+ }
+ print ATH_HAL_API_H "\n\tATH_HAL_LOCK_IRQ(GET_ATH_SOFTC(ah));";
+ print ATH_HAL_API_H "\n\t";
+ if(! ($api_return_type =~ /void/ )) {
+ print ATH_HAL_API_H "ret = ";
+ }
+
+ print ATH_HAL_API_H "ah->$member_name(";
+ for $j (0..$#names) {
+ if($j) {
+ print ATH_HAL_API_H ", ";
+ }
+ print ATH_HAL_API_H $names[$j];
+ }
+ print ATH_HAL_API_H ");";
+ print ATH_HAL_API_H "\n\tATH_HAL_UNLOCK_IRQ(GET_ATH_SOFTC(ah));";
+ if(! ($api_return_type =~ /void/ )) {
+ print ATH_HAL_API_H "\n\treturn ret;";
+ }
+ print ATH_HAL_API_H "\n\t})\n";
+}
+print ATH_HAL_API_H <<EOF
+/* These custom wrappers are defined in scripts/regenerate_ath_hal_api.pl and
+ * are used as shortcut accessors for HAL functions. */
+EOF
+;
+for $wrapper_name (keys %wrapper_functionname_to_return_type) {
+ my $api_return_type = $wrapper_functionname_to_return_type{$wrapper_name};
+ my $api_name = $wrapper_name;
+ if(exists $hal_function_name_to_madwifi_name{$wrapper_name}) {
+ $api_name = $hal_function_name_to_madwifi_name{$wrapper_name};
+ }
+ print ATH_HAL_API_H "__hal_wrapper " . $api_return_type . " " . $api_name .
"(";
+ my @names = @{$wrapper_functionname_to_parameter_name_array{$wrapper_name}};
+ my @types =
@{$wrapper_functionname_to_parameter_types_array{$wrapper_name}};
+ for $i (0..$#names) {
+ if($i) {
+ print ATH_HAL_API_H ", ";
+ }
+ print ATH_HAL_API_H $types[$i] . " " . $names[$i];
+ }
+ print ATH_HAL_API_H ")";
+ print ATH_HAL_API_H "\n\tIMPLEMENTATION({ ";
+ if(! ($api_return_type =~ /void/ )) {
+ print ATH_HAL_API_H "return ";
+ }
+ print ATH_HAL_API_H "(" .
$wrapper_functionname_to_expression{"$wrapper_name"} . "); })\n";
+}
+
+print ATH_HAL_API_H $footer_for_h;
+
+#
+# Generate the implementation file
+#
+print ATH_HAL_API_C $header_for_c;
+print ATH_HAL_API_C "/* Include header file for declarations */\n";
+print ATH_HAL_API_C "#include \"$path_to_if_ath_hal_h\"\n";
+print ATH_HAL_API_C "\n";
+print ATH_HAL_API_C "/* Include header file for implementations (if necessary)
*/\n";
+print ATH_HAL_API_C "#define TRACEABLE_IMPL\n";
+print ATH_HAL_API_C "#include \"$path_to_if_ath_hal_h\"\n";
+print ATH_HAL_API_C "#undef TRACEABLE_IMPL\n";
+print ATH_HAL_API_C "\n";
+print ATH_HAL_API_C $footer_for_c;
+
+# Close up the files
+close AH_H;
+close ATH_HAL_API_H;
+close ATH_HAL_API_C;
+
Property changes on: trunk/scripts/if_ath_hal_generator.pl
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/scripts/if_ath_hal_settings.pl
===================================================================
--- trunk/scripts/if_ath_hal_settings.pl (rev 0)
+++ trunk/scripts/if_ath_hal_settings.pl 2007-06-15 21:46:34 UTC (rev
2460)
@@ -0,0 +1,324 @@
+#!/usr/bin/perl
+#
+#
+# This file contains settings used to generate the HAL wrapper API for MadWifi
from the
+# binary HAL api header. You can edit these settings to customize the
behavior of the
+# code generator.
+#
+
+#
+# This section contains the output file paths
+#
+$path_to_hal = 'hal';
+$path_to_ath = 'ath';
+$hal_h = 'ah.h';
+$if_ath_hal_c = 'if_ath_hal.c';
+$if_ath_hal_h = 'if_ath_hal.h';
+
+#
+# This section defines the name translation from the binary HAL's function
+# pointers to our API names.
+#
+%hal_function_name_to_madwifi_name = (
+ "ah_beaconInit" => "ath_hal_beaconinit",
+ "ah_disablePhyErrDiag" => "ath_hal_disablePhyDiag",
+ "ah_enablePhyErrDiag" => "ath_hal_enablePhyDiag",
+ "ah_enableReceive" => "ath_hal_rxena",
+ "ah_fillTxDesc" => "ath_hal_filltxdesc",
+ "ah_getAckCTSRate" => "ath_hal_getackctsrate",
+ "ah_setAckCTSRate" => "ath_hal_setackctsrate",
+ "ah_updateMibCounters" => "ath_hal_updatemibcounters",
+ "ah_getAntennaSwitch" => "ath_hal_getantennaswitch",
+ "ah_setAntennaSwitch" => "ath_hal_setantennaswitch",
+ "ah_getAckTimeout" => "ath_hal_getacktimeout",
+ "ah_getBssIdMask" => "ath_hal_getbssidmask",
+ "ah_getCapability" => "ath_hal_getcapability",
+ "ah_getChanNoise" => "ath_hal_get_channel_noise",
+ "ah_getCTSTimeout" => "ath_hal_getctstimeout",
+ "ah_getDefAntenna" => "ath_hal_getdefantenna",
+ "ah_getDiagState" => "ath_hal_getdiagstate",
+ "ah_getInterrupts" => "ath_hal_intrget",
+ "ah_getKeyCacheSize" => "ath_hal_keycachesize",
+ "ah_getMacAddress" => "ath_hal_getmac",
+ "ah_getPendingInterrupts" => "ath_hal_getisr",
+ "ah_getPowerMode" => "ath_hal_getPowerMode",
+ "ah_getRateTable" => "ath_hal_getratetable",
+ "ah_getRfGain" => "ath_hal_getrfgain",
+ "ah_getRxDP" => "ath_hal_getrxbuf",
+ "ah_getRxFilter" => "ath_hal_getrxfilter",
+ "ah_getSlotTime" => "ath_hal_getslottime",
+ "ah_getTsf32" => "ath_hal_gettsf32",
+ "ah_getTsf64" => "ath_hal_gettsf64",
+ "ah_getTxDP" => "ath_hal_gettxbuf",
+ "ah_getTxIntrQueue" => "ath_hal_gettxintrtxqs",
+ "ah_getTxQueueProps" => "ath_hal_gettxqueueprops",
+ "ah_gpioCfgOutput" => "ath_hal_gpioCfgOutput",
+ "ah_gpioSet" => "ath_hal_gpioset",
+ "ah_gpioGet" => "ath_hal_gpioget",
+ "ah_gpioSetIntr" => "ath_hal_gpiosetintr",
+ "ah_gpioCfgInput" => "ath_hal_gpiCfgInput",
+ "ah_isInterruptPending" => "ath_hal_intrpend",
+ "ah_isKeyCacheEntryValid" => "ath_hal_keyisvalid",
+ "ah_numTxPending" => "ath_hal_numtxpending",
+ "ah_perCalibration" => "ath_hal_calibrate",
+ "ah_phyDisable" => "ath_hal_phydisable",
+ "ah_disable" => "ath_hal_disable",
+ "ah_procMibEvent" => "ath_hal_mibevent",
+ "ah_procRxDesc" => "ath_hal_rxprocdesc",
+ "ah_procTxDesc" => "ath_hal_txprocdesc",
+ "ah_radarWait" => "ath_hal_radar_wait",
+ "ah_releaseTxQueue" => "ath_hal_releasetxqueue",
+ "ah_reqTxIntrDesc" => "ath_hal_txreqintrdesc",
+ "ah_reset" => "ath_hal_reset",
+ "ah_resetKeyCacheEntry" => "ath_hal_keyreset",
+ "ah_resetStationBeaconTimers" => "ath_hal_beaconreset",
+ "ah_resetTsf" => "ath_hal_resettsf",
+ "ah_resetTxQueue" => "ath_hal_resettxqueue",
+ "ah_rxMonitor" => "ath_hal_rxmonitor",
+ "ah_setAckTimeout" => "ath_hal_setacktimeout",
+ "ah_setBssIdMask" => "ath_hal_setbssidmask",
+ "ah_setCapability" => "ath_hal_setcapability",
+ "ah_setChannel" => "ath_hal_setchannel",
+ "ah_setCoverageClass" => "ath_hal_setcoverageclass",
+ "ah_setCTSTimeout" => "ath_hal_setctstimeout",
+ "ah_setDecompMask" => "ath_hal_setdecompmask",
+ "ah_setDefAntenna" => "ath_hal_setdefantenna",
+ "ah_setInterrupts" => "ath_hal_intrset",
+ "ah_setKeyCacheEntry" => "ath_hal_keyset",
+ "ah_setKeyCacheEntryMac" => "ath_hal_keysetmac",
+ "ah_setLedState" => "ath_hal_setledstate",
+ "ah_setMacAddress" => "ath_hal_setmac",
+ "ah_setMulticastFilter" => "ath_hal_setmcastfilter",
+ "ah_setMulticastFilterIndex" => "ath_hal_setmcastfilterindex",
+ "ah_setPCUConfig" => "ath_hal_setopmode",
+ "ah_setPowerMode" => "ath_hal_setpower",
+ "ah_setRxDP" => "ath_hal_putrxbuf",
+ "ah_setRxFilter" => "ath_hal_setrxfilter",
+ "ah_setRegulatoryDomain" => "ath_hal_setregulatorydomain",
+ "ah_setSlotTime" => "ath_hal_setslottime",
+ "ah_setStationBeaconTimers" => "ath_hal_beacontimers",
+ "ah_setTxDP" => "ath_hal_puttxbuf",
+ "ah_setTxQueueProps" => "ath_hal_settxqueueprops",
+ "ah_setTxPowerLimit" => "ath_hal_settxpowlimit",
+ "ah_setBeaconTimers" => "ath_hal_setbeacontimers",
+ "ah_setupRxDesc" => "ath_hal_setuprxdesc",
+ "ah_setupTxDesc" => "ath_hal_setuptxdesc",
+ "ah_setupTxQueue" => "ath_hal_setuptxqueue",
+ "ah_setupXTxDesc" => "ath_hal_setupxtxdesc",
+ "ah_startPcuReceive" => "ath_hal_startpcurecv",
+ "ah_startTxDma" => "ath_hal_txstart",
+ "ah_stopDmaReceive" => "ath_hal_stopdmarecv",
+ "ah_stopPcuReceive" => "ath_hal_stoppcurecv",
+ "ah_stopTxDma" => "ath_hal_stoptxdma",
+ "ah_updateCTSForBursting" => "ath_hal_updateCTSForBursting",
+ "ah_updateTxTrigLevel" => "ath_hal_updatetxtriglevel",
+ "ah_waitForBeaconDone" => "ath_hal_waitforbeacon",
+ "ah_writeAssocid" => "ath_hal_setassocid",
+ "ah_clrMulticastFilterIndex" => "ath_hal_clearmcastfilter",
+ "ah_detectCardPresent" => "ath_hal_detectcardpresent" );
+#
+# List any functions that should NOT be generated here (such as those that
conflict with
+# other functions, perhaps.
+#
+@hal_functions_not_to_wrap = ( "ah_detach" );
+#
+# Boilerplate text
+#
+$header_comment = <<EOF
+/* Wrapper macros/functions for the binary HAL to comply with local coding
+ * convention. Provides function-style calling convention using either macros
+ * or wrapper functions for function pointers in the HAL.
+ *
+ * The typical convention is ath_hal_foo(ah,p1,p2,p3,...) turns into
+ * ah->ah_foo(p1,p2,p3,...) where ah_foo is a function pointer and a member
+ * of the struct ath_hal (usually named ah). */
+EOF
+;
+# This section defines additional HAL APIs that we we want to expose. It
+# is structured the way that it is so that we can parse the declaration portion
+# and easily turn it into function headers, inlines in headers,
+# implementations in .c files, etc..
+%custom_wrappers = (
+ "HAL_BOOL ath_hal_burstsupported(struct ath_hal * ah)" =>
+ "(ath_hal_getcapability(ah, HAL_CAP_BURST, 0, NULL) == HAL_OK)",
+ "HAL_BOOL ath_hal_ciphersupported(struct ath_hal * ah, u_int32_t
cipher)" =>
+ "(ath_hal_getcapability(ah, HAL_CAP_CIPHER, cipher, NULL) ==
HAL_OK)",
+ "HAL_BOOL ath_hal_compressionsupported(struct ath_hal * ah)" =>
+ "(ath_hal_getcapability(ah, HAL_CAP_COMPRESSION, 0, NULL) ==
HAL_OK)",
+ "HAL_BOOL ath_hal_fastframesupported(struct ath_hal * ah)" =>
+ "(ath_hal_getcapability(ah, HAL_CAP_FASTFRAME, 0, NULL) ==
HAL_OK)",
+ "HAL_BOOL ath_hal_getcountrycode(struct ath_hal * ah, u_int32_t*
destination)" =>
+ "((*(destination) = ah->ah_countryCode), AH_TRUE)",
+ "HAL_BOOL ath_hal_getdiversity(struct ath_hal * ah)" =>
+ "(ath_hal_getcapability(ah, HAL_CAP_DIVERSITY, 1, NULL) ==
HAL_OK)",
+ "HAL_BOOL ath_hal_getmaxtxpow(struct ath_hal * ah, u_int32_t*
destination)" =>
+ "(ath_hal_getcapability(ah, HAL_CAP_TXPOW, 2, destination) ==
HAL_OK)",
+ "HAL_BOOL ath_hal_getmcastkeysearch(struct ath_hal * ah)" =>
+ "(ath_hal_getcapability(ah, HAL_CAP_MCAST_KEYSRCH, 1, NULL) ==
HAL_OK)",
+ "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)",
+ "HAL_BOOL ath_hal_getregdomain(struct ath_hal * ah, u_int32_t*
destination)" =>
+ "(ath_hal_getcapability(ah, HAL_CAP_REG_DMN, 0, destination))",
+ "HAL_BOOL ath_hal_gettkipmic(struct ath_hal * ah)" =>
+ "(ath_hal_getcapability(ah, HAL_CAP_TKIP_MIC, 1, NULL) ==
HAL_OK)",
+ "HAL_BOOL ath_hal_gettkipsplit(struct ath_hal * ah)" =>
+ "(ath_hal_getcapability(ah, HAL_CAP_TKIP_SPLIT, 1, NULL) ==
HAL_OK)",
+ "HAL_BOOL ath_hal_gettpc(struct ath_hal * ah)" =>
+ "(ath_hal_getcapability(ah, HAL_CAP_TPC, 1, NULL) == HAL_OK)",
+ "HAL_BOOL ath_hal_gettpscale(struct ath_hal * ah, u_int32_t*
destination)" =>
+ "(ath_hal_getcapability(ah, HAL_CAP_TXPOW, 3, destination) ==
HAL_OK)",
+ "HAL_BOOL ath_hal_gettsfadjust(struct ath_hal * ah)" =>
+ "(ath_hal_getcapability(ah, HAL_CAP_TSF_ADJUST, 1, NULL) ==
HAL_OK)",
+ "HAL_BOOL ath_hal_gettxpowlimit(struct ath_hal * ah, u_int32_t*
destination)" =>
+ "(ath_hal_getcapability(ah, HAL_CAP_TXPOW, 1, destination) ==
HAL_OK)",
+ "HAL_BOOL ath_hal_halfrate_chansupported(struct ath_hal * ah)" =>
+ "(ath_hal_getcapability(ah, HAL_CAP_CHAN_HALFRATE, 0, NULL) ==
HAL_OK)",
+ "HAL_BOOL ath_hal_hasbssidmask(struct ath_hal * ah)" =>
+ "(ath_hal_getcapability(ah, HAL_CAP_BSSIDMASK, 0, NULL) ==
HAL_OK)",
+ "HAL_BOOL ath_hal_hasbursting(struct ath_hal * ah)" =>
+ "(ath_hal_getcapability(ah, HAL_CAP_BURST, 0, NULL) == HAL_OK)",
+ "HAL_BOOL ath_hal_hascompression(struct ath_hal * ah)" =>
+ "(ath_hal_getcapability(ah, HAL_CAP_COMPRESSION, 0, NULL) ==
HAL_OK)",
+ "HAL_BOOL ath_hal_hasdiversity(struct ath_hal * ah)" =>
+ "(ath_hal_getcapability(ah, HAL_CAP_DIVERSITY, 0, NULL) ==
HAL_OK)",
+ "HAL_BOOL ath_hal_hasfastframes(struct ath_hal * ah)" =>
+ "(ath_hal_getcapability(ah, HAL_CAP_FASTFRAME, 0, NULL) ==
HAL_OK)",
+ "HAL_BOOL ath_hal_hasmcastkeysearch(struct ath_hal * ah)" =>
+ "(ath_hal_getcapability(ah, HAL_CAP_MCAST_KEYSRCH, 0, NULL) ==
HAL_OK)",
+ "HAL_BOOL ath_hal_hasrfsilent(struct ath_hal * ah)" =>
+ "(ath_hal_getcapability(ah, HAL_CAP_RFSILENT, 0, NULL) ==
HAL_OK)",
+ "HAL_BOOL ath_hal_hastkipmic(struct ath_hal * ah)" =>
+ "(ath_hal_getcapability(ah, HAL_CAP_TKIP_MIC, 0, NULL) ==
HAL_OK)",
+ "HAL_BOOL ath_hal_hastkipsplit(struct ath_hal * ah)" =>
+ "(ath_hal_getcapability(ah, HAL_CAP_TKIP_SPLIT, 0, NULL) ==
HAL_OK)",
+ "HAL_BOOL ath_hal_hastpc(struct ath_hal * ah)" =>
+ "(ath_hal_getcapability(ah, HAL_CAP_TPC, 0, NULL) == HAL_OK)",
+ "HAL_BOOL ath_hal_hastsfadjust(struct ath_hal * ah)" =>
+ "(ath_hal_getcapability(ah, HAL_CAP_TSF_ADJUST, 0, NULL) ==
HAL_OK)",
+ "HAL_BOOL ath_hal_hastxpowlimit(struct ath_hal * ah)" =>
+ "(ath_hal_getcapability(ah, HAL_CAP_TXPOW, 0, NULL) == HAL_OK)",
+ "HAL_BOOL ath_hal_hasveol(struct ath_hal * ah)" =>
+ "(ath_hal_getcapability(ah, HAL_CAP_VEOL, 0, NULL) == HAL_OK)",
+ "HAL_BOOL ath_hal_hwphycounters(struct ath_hal * ah)" =>
+ "(ath_hal_getcapability(ah, HAL_CAP_PHYCOUNTERS, 0, NULL) ==
HAL_OK)",
+ "HAL_BOOL ath_hal_quarterrate_chansupported(struct ath_hal * ah)" =>
+ "(ath_hal_getcapability(ah, HAL_CAP_CHAN_QUARTERRATE, 0, NULL)
== HAL_OK)",
+ "HAL_BOOL ath_hal_setdiversity(struct ath_hal * ah, int v)" =>
+ "(ath_hal_setcapability(ah, HAL_CAP_DIVERSITY, 1, v, NULL))",
+ "HAL_BOOL ath_hal_setrfsilent(struct ath_hal * ah, u_int32_t v)" =>
+ "(ath_hal_setcapability(ah, HAL_CAP_RFSILENT, 1, v, NULL))",
+ "HAL_BOOL ath_hal_settkipmic(struct ath_hal * ah, u_int32_t v)" =>
+ "(ath_hal_setcapability(ah, HAL_CAP_TKIP_MIC, 1, v, NULL))",
+ "HAL_BOOL ath_hal_settkipsplit(struct ath_hal * ah, int v)" =>
+ "(ath_hal_setcapability(ah, HAL_CAP_TKIP_SPLIT, 1, v, NULL))",
+ "HAL_BOOL ath_hal_settpc(struct ath_hal * ah, u_int32_t v)" =>
+ "(ath_hal_setcapability(ah, HAL_CAP_TPC, 1, v, NULL))",
+ "HAL_BOOL ath_hal_settpscale(struct ath_hal * ah, u_int32_t v)" =>
+ "(ath_hal_setcapability(ah, HAL_CAP_TXPOW, 3, v, NULL))",
+ "HAL_BOOL ath_hal_settsfadjust(struct ath_hal * ah, u_int32_t v)" =>
+ "(ath_hal_setcapability(ah, HAL_CAP_TSF_ADJUST, 1, v, NULL))",
+ "HAL_BOOL ath_hal_turboagsupported(struct ath_hal * ah, int
countrycode)" =>
+ "(ath_hal_getwirelessmodes(ah, countrycode) &
(HAL_MODE_108G|HAL_MODE_TURBO))",
+ "HAL_BOOL ath_hal_wmetkipmic(struct ath_hal * ah)" =>
+ "(ath_hal_getcapability(ah, HAL_CAP_WME_TKIPMIC, 0, NULL) ==
HAL_OK)",
+ "HAL_BOOL ath_hal_xrsupported(struct ath_hal * ah)" =>
+ "(ath_hal_getcapability(ah, HAL_CAP_XR, 0, NULL) == HAL_OK)"
+ );
+
+
+#
+# This text is generated verbatim at the top of the .h file,
+# before generated content is added.
+#
+$header_for_h = <<EOF
+$header_comment
+
+#ifndef _IF_ATH_HAL_H
+#define _IF_ATH_HAL_H
+
+#define GET_ATH_SOFTC(_ah) ((struct ath_softc*)(_ah->ah_sc))
+#define ATH_HAL_LOCK_INIT(_sc) spin_lock_init(&(_sc)->sc_hal_lock)
+#define ATH_HAL_LOCK_DESTROY(_sc)
+#define ATH_HAL_LOCK_IRQ(_sc) do { \\
+ unsigned long __sc_halLockflags; \\
+ spin_lock_irqsave(&(_sc)->sc_hal_lock, __sc_halLockflags);
+#define ATH_HAL_UNLOCK_IRQ(_sc) \\
+ spin_unlock_irqrestore(&(_sc)->sc_hal_lock, __sc_halLockflags); \\
+ } while(0)
+#define ATH_HAL_UNLOCK_IRQ_EARLY(_sc) \\
+ spin_unlock_irqrestore(&(_sc)->sc_hal_lock, __sc_halLockflags);
+
+#ifdef ATH_HALOPS_TRACEABLE
+#define __hal_wrapper
+#ifdef TRACEABLE_IMPL
+#define IMPLEMENTATION(_CODEBLOCK) _CODEBLOCK
+#else /* #ifdef TRACEABLE_IMPL */
+#define IMPLEMENTATION(_CODEBLOCK)
+#endif /* #ifdef TRACEABLE_IMPL */
+#else /* #ifdef ATH_HALOPS_TRACEABLE */
+#define __hal_wrapper static inline
+#define IMPLEMENTATION(_CODEBLOCK) _CODEBLOCK
+#endif /* #ifdef ATH_HALOPS_TRACEABLE */
+
+__hal_wrapper void ath_reg_write(struct ath_softc *sc, u_int reg, u_int32_t
val)
+IMPLEMENTATION({
+ ATH_HAL_LOCK_IRQ(sc);
+ OS_REG_WRITE(sc->sc_ah, reg, val);
+ ATH_HAL_UNLOCK_IRQ(sc);
+ })
+
+__hal_wrapper u_int32_t ath_reg_read(struct ath_softc *sc, u_int reg)
+IMPLEMENTATION({
+ u_int32_t ret;
+ ATH_HAL_LOCK_IRQ(sc);
+ ret = OS_REG_READ(sc->sc_ah, reg);
+ ATH_HAL_UNLOCK_IRQ(sc);
+ return ret;
+ })
+EOF
+;
+
+#
+# This text is generated verbatim at the bottom of the .h file
+#
+$footer_for_h = <<EOF
+
+#endif /* _IF_ATH_HAL_H */
+EOF
+;
+#
+# This text is generated verbatim at the top of the .c file
+#
+$header_for_c = <<EOF
+$header_comment
+#include "opt_ah.h"
+
+#ifdef ATH_HALOPS_TRACEABLE
+
+#ifndef AUTOCONF_INCLUDED
+#include <linux/config.h>
+#endif
+#include <linux/version.h>
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/skbuff.h>
+#include <linux/netdevice.h>
+#include <linux/etherdevice.h>
+#include <linux/random.h>
+#include <linux/delay.h>
+#include <linux/cache.h>
+#include <linux/sysctl.h>
+#include <linux/proc_fs.h>
+#include <linux/if_arp.h>
+#include <linux/rtnetlink.h>
+#include <asm/uaccess.h>
+EOF
+;
+#
+# This text is generated verbatim at the bottom of the .c file
+#
+$footer_for_c = <<EOF
+#endif /* #ifdef ATH_HALOPS_TRACEABLE */
+EOF
+;
+
Property changes on: trunk/scripts/if_ath_hal_settings.pl
___________________________________________________________________
Name: svn:executable
+ *
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
|