aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/ath
diff options
context:
space:
mode:
authorBruce M Simpson <bms@FreeBSD.org>2009-03-12 03:09:11 +0000
committerBruce M Simpson <bms@FreeBSD.org>2009-03-12 03:09:11 +0000
commit0722f1ca8ec3d30c051ac4877dd35145258e3e24 (patch)
tree8ad53aa21fe0ded712e40aefefd196d4481e3140 /sys/dev/ath
parent34ceee1f5dc31d51bfbd0d6fd1b4863d103ea8b6 (diff)
Notes
Diffstat (limited to 'sys/dev/ath')
-rw-r--r--sys/dev/ath/ah_osdep.c70
-rw-r--r--sys/dev/ath/ah_osdep.h18
-rw-r--r--sys/dev/ath/ath_rate/amrr/amrr.c29
-rw-r--r--sys/dev/ath/ath_rate/onoe/onoe.c29
-rw-r--r--sys/dev/ath/ath_rate/sample/sample.c30
-rw-r--r--sys/dev/ath/if_ath.c72
-rw-r--r--sys/dev/ath/if_ath_pci.c3
-rw-r--r--sys/dev/ath/if_athvar.h10
8 files changed, 57 insertions, 204 deletions
diff --git a/sys/dev/ath/ah_osdep.c b/sys/dev/ath/ah_osdep.c
index dcc57650752e..c124772771c8 100644
--- a/sys/dev/ath/ah_osdep.c
+++ b/sys/dev/ath/ah_osdep.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2002-2007 Sam Leffler, Errno Consulting
+ * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -43,7 +43,7 @@
#include <net/ethernet.h> /* XXX for ether_sprintf */
-#include <contrib/dev/ath/ah.h>
+#include <dev/ath/ath_hal/ah.h>
/*
* WiSoC boards overload the bus tag with information about the
@@ -56,7 +56,7 @@
#define BUSTAG(ah) \
((bus_space_tag_t) ((struct ar531x_config *)((ah)->ah_st))->tag)
#else
-#define BUSTAG(ah) ((bus_space_tag_t) (ah)->ah_st)
+#define BUSTAG(ah) ((ah)->ah_st)
#endif
extern void ath_hal_printf(struct ath_hal *, const char*, ...)
@@ -71,8 +71,12 @@ extern void ath_hal_assert_failed(const char* filename,
int lineno, const char* msg);
#endif
#ifdef AH_DEBUG
+#if HAL_ABI_VERSION >= 0x08090101
+extern void HALDEBUG(struct ath_hal *ah, u_int mask, const char* fmt, ...);
+#else
extern void HALDEBUG(struct ath_hal *ah, const char* fmt, ...);
extern void HALDEBUGn(struct ath_hal *ah, u_int level, const char* fmt, ...);
+#endif
#endif /* AH_DEBUG */
/* NB: put this here instead of the driver to avoid circular references */
@@ -86,9 +90,6 @@ SYSCTL_INT(_hw_ath_hal, OID_AUTO, debug, CTLFLAG_RW, &ath_hal_debug,
TUNABLE_INT("hw.ath.hal.debug", &ath_hal_debug);
#endif /* AH_DEBUG */
-SYSCTL_STRING(_hw_ath_hal, OID_AUTO, version, CTLFLAG_RD, ath_hal_version, 0,
- "Atheros HAL version");
-
/* NB: these are deprecated; they exist for now for compatibility */
int ath_hal_dma_beacon_response_time = 2; /* in TU's */
SYSCTL_INT(_hw_ath_hal, OID_AUTO, dma_brt, CTLFLAG_RW,
@@ -139,6 +140,18 @@ ath_hal_ether_sprintf(const u_int8_t *mac)
}
#ifdef AH_DEBUG
+#if HAL_ABI_VERSION >= 0x08090101
+void
+HALDEBUG(struct ath_hal *ah, u_int mask, const char* fmt, ...)
+{
+ if (ath_hal_debug & mask) {
+ __va_list ap;
+ va_start(ap, fmt);
+ ath_hal_vprintf(ah, fmt, ap);
+ va_end(ap);
+ }
+}
+#else
void
HALDEBUG(struct ath_hal *ah, const char* fmt, ...)
{
@@ -160,6 +173,7 @@ HALDEBUGn(struct ath_hal *ah, u_int level, const char* fmt, ...)
va_end(ap);
}
}
+#endif
#endif /* AH_DEBUG */
#ifdef AH_DEBUG_ALQ
@@ -178,7 +192,7 @@ HALDEBUGn(struct ath_hal *ah, u_int level, const char* fmt, ...)
*/
#include <sys/alq.h>
#include <sys/pcpu.h>
-#include <contrib/dev/ath/ah_decode.h>
+#include <dev/ath/ath_hal/ah_decode.h>
static struct alq *ath_hal_alq;
static int ath_hal_alq_emitdev; /* need to emit DEVICE record */
@@ -256,7 +270,7 @@ void
ath_hal_reg_write(struct ath_hal *ah, u_int32_t reg, u_int32_t val)
{
bus_space_tag_t tag = BUSTAG(ah);
- bus_space_handle_t h = (bus_space_handle_t) ah->ah_sh;
+ bus_space_handle_t h = ah->ah_sh;
if (ath_hal_alq) {
struct ale *ale = ath_hal_alq_get(ah);
@@ -280,7 +294,7 @@ u_int32_t
ath_hal_reg_read(struct ath_hal *ah, u_int32_t reg)
{
bus_space_tag_t tag = BUSTAG(ah);
- bus_space_handle_t h = (bus_space_handle_t) ah->ah_sh;
+ bus_space_handle_t h = ah->ah_sh;
u_int32_t val;
#if _BYTE_ORDER == _BIG_ENDIAN
@@ -332,7 +346,7 @@ void
ath_hal_reg_write(struct ath_hal *ah, u_int32_t reg, u_int32_t val)
{
bus_space_tag_t tag = BUSTAG(ah);
- bus_space_handle_t h = (bus_space_handle_t) ah->ah_sh;
+ bus_space_handle_t h = ah->ah_sh;
#if _BYTE_ORDER == _BIG_ENDIAN
if (reg >= 0x4000 && reg < 0x5000)
@@ -346,7 +360,7 @@ u_int32_t
ath_hal_reg_read(struct ath_hal *ah, u_int32_t reg)
{
bus_space_tag_t tag = BUSTAG(ah);
- bus_space_handle_t h = (bus_space_handle_t) ah->ah_sh;
+ bus_space_handle_t h = ah->ah_sh;
u_int32_t val;
#if _BYTE_ORDER == _BIG_ENDIAN
@@ -398,37 +412,3 @@ ath_hal_memcpy(void *dst, const void *src, size_t n)
{
return memcpy(dst, src, n);
}
-
-/*
- * Module glue.
- */
-
-static int
-ath_hal_modevent(module_t mod, int type, void *unused)
-{
- const char *sep;
- int i;
-
- switch (type) {
- case MOD_LOAD:
- printf("ath_hal: %s (", ath_hal_version);
- sep = "";
- for (i = 0; ath_hal_buildopts[i] != NULL; i++) {
- printf("%s%s", sep, ath_hal_buildopts[i]);
- sep = ", ";
- }
- printf(")\n");
- return 0;
- case MOD_UNLOAD:
- return 0;
- }
- return EINVAL;
-}
-
-static moduledata_t ath_hal_mod = {
- "ath_hal",
- ath_hal_modevent,
- 0
-};
-DECLARE_MODULE(ath_hal, ath_hal_mod, SI_SUB_DRIVERS, SI_ORDER_ANY);
-MODULE_VERSION(ath_hal, 1);
diff --git a/sys/dev/ath/ah_osdep.h b/sys/dev/ath/ah_osdep.h
index 062d149e5f98..32f2796289c2 100644
--- a/sys/dev/ath/ah_osdep.h
+++ b/sys/dev/ath/ah_osdep.h
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2002-2007 Sam Leffler, Errno Consulting
+ * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -33,13 +33,29 @@
/*
* Atheros Hardware Access Layer (HAL) OS Dependent Definitions.
*/
+#include <sys/cdefs.h>
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/endian.h>
+#include <sys/linker_set.h>
#include <machine/bus.h>
/*
+ * Bus i/o type definitions.
+ */
+typedef void *HAL_SOFTC;
+typedef bus_space_tag_t HAL_BUS_TAG;
+typedef bus_space_handle_t HAL_BUS_HANDLE;
+
+/*
+ * Linker set writearounds for chip and RF backend registration.
+ */
+#define OS_DATA_SET(set, item) DATA_SET(set, item)
+#define OS_SET_DECLARE(set, ptype) SET_DECLARE(set, ptype)
+#define OS_SET_FOREACH(pvar, set) SET_FOREACH(pvar, set)
+
+/*
* Delay n microseconds.
*/
extern void ath_hal_delay(int);
diff --git a/sys/dev/ath/ath_rate/amrr/amrr.c b/sys/dev/ath/ath_rate/amrr/amrr.c
index 00ae5688a386..0db25cb44bc7 100644
--- a/sys/dev/ath/ath_rate/amrr/amrr.c
+++ b/sys/dev/ath/ath_rate/amrr/amrr.c
@@ -50,7 +50,6 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/sysctl.h>
-#include <sys/module.h>
#include <sys/kernel.h>
#include <sys/lock.h>
#include <sys/mutex.h>
@@ -78,7 +77,7 @@ __FBSDID("$FreeBSD$");
#include <dev/ath/if_athvar.h>
#include <dev/ath/ath_rate/amrr/amrr.h>
-#include <contrib/dev/ath/ah_desc.h>
+#include <dev/ath/ath_hal/ah_desc.h>
#define AMRR_DEBUG
#ifdef AMRR_DEBUG
@@ -518,29 +517,3 @@ ath_rate_detach(struct ath_ratectrl *arc)
callout_drain(&asc->timer);
free(asc, M_DEVBUF);
}
-
-/*
- * Module glue.
- */
-static int
-amrr_modevent(module_t mod, int type, void *unused)
-{
- switch (type) {
- case MOD_LOAD:
- if (bootverbose)
- printf("ath_rate: <AMRR rate control algorithm> version 0.1\n");
- return 0;
- case MOD_UNLOAD:
- return 0;
- }
- return EINVAL;
-}
-
-static moduledata_t amrr_mod = {
- "ath_rate",
- amrr_modevent,
- 0
-};
-DECLARE_MODULE(ath_rate, amrr_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST);
-MODULE_VERSION(ath_rate, 1);
-MODULE_DEPEND(ath_rate, wlan, 1, 1, 1);
diff --git a/sys/dev/ath/ath_rate/onoe/onoe.c b/sys/dev/ath/ath_rate/onoe/onoe.c
index eb5759e98b45..a75bcad7dc3f 100644
--- a/sys/dev/ath/ath_rate/onoe/onoe.c
+++ b/sys/dev/ath/ath_rate/onoe/onoe.c
@@ -38,7 +38,6 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/sysctl.h>
-#include <sys/module.h>
#include <sys/kernel.h>
#include <sys/lock.h>
#include <sys/mutex.h>
@@ -66,7 +65,7 @@ __FBSDID("$FreeBSD$");
#include <dev/ath/if_athvar.h>
#include <dev/ath/ath_rate/onoe/onoe.h>
-#include <contrib/dev/ath/ah_desc.h>
+#include <dev/ath/ath_hal/ah_desc.h>
#define ONOE_DEBUG
#ifdef ONOE_DEBUG
@@ -492,29 +491,3 @@ ath_rate_detach(struct ath_ratectrl *arc)
callout_drain(&osc->timer);
free(osc, M_DEVBUF);
}
-
-/*
- * Module glue.
- */
-static int
-onoe_modevent(module_t mod, int type, void *unused)
-{
- switch (type) {
- case MOD_LOAD:
- if (bootverbose)
- printf("ath_rate: <Atsushi Onoe's rate control algorithm>\n");
- return 0;
- case MOD_UNLOAD:
- return 0;
- }
- return EINVAL;
-}
-
-static moduledata_t onoe_mod = {
- "ath_rate",
- onoe_modevent,
- 0
-};
-DECLARE_MODULE(ath_rate, onoe_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST);
-MODULE_VERSION(ath_rate, 1);
-MODULE_DEPEND(ath_rate, wlan, 1, 1, 1);
diff --git a/sys/dev/ath/ath_rate/sample/sample.c b/sys/dev/ath/ath_rate/sample/sample.c
index 180ef82f851b..f791668eed4a 100644
--- a/sys/dev/ath/ath_rate/sample/sample.c
+++ b/sys/dev/ath/ath_rate/sample/sample.c
@@ -46,7 +46,6 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/sysctl.h>
-#include <sys/module.h>
#include <sys/kernel.h>
#include <sys/lock.h>
#include <sys/mutex.h>
@@ -74,7 +73,7 @@ __FBSDID("$FreeBSD$");
#include <dev/ath/if_athvar.h>
#include <dev/ath/ath_rate/sample/sample.h>
-#include <contrib/dev/ath/ah_desc.h>
+#include <dev/ath/ath_hal/ah_desc.h>
#define SAMPLE_DEBUG
#ifdef SAMPLE_DEBUG
@@ -840,30 +839,3 @@ ath_rate_detach(struct ath_ratectrl *arc)
free(osc, M_DEVBUF);
}
-
-/*
- * Module glue.
- */
-static int
-sample_modevent(module_t mod, int type, void *unused)
-{
- switch (type) {
- case MOD_LOAD:
- if (bootverbose)
- printf("ath_rate: version 1.2 <SampleRate bit-rate selection algorithm>\n");
- return 0;
- case MOD_UNLOAD:
- return 0;
- }
- return EINVAL;
-}
-
-static moduledata_t sample_mod = {
- "ath_rate",
- sample_modevent,
- 0
-};
-DECLARE_MODULE(ath_rate, sample_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST);
-MODULE_VERSION(ath_rate, 1);
-MODULE_DEPEND(ath_rate, ath_hal, 1, 1, 1); /* Atheros HAL */
-MODULE_DEPEND(ath_rate, wlan, 1, 1, 1);
diff --git a/sys/dev/ath/if_ath.c b/sys/dev/ath/if_ath.c
index fd02770071d0..98231b7dfcf6 100644
--- a/sys/dev/ath/if_ath.c
+++ b/sys/dev/ath/if_ath.c
@@ -77,13 +77,17 @@ __FBSDID("$FreeBSD$");
#endif
#include <dev/ath/if_athvar.h>
-#include <contrib/dev/ath/ah_desc.h>
-#include <contrib/dev/ath/ah_devid.h> /* XXX for softled */
+#include <dev/ath/ath_hal/ah_devid.h> /* XXX for softled */
#ifdef ATH_TX99_DIAG
#include <dev/ath/ath_tx99/ath_tx99.h>
#endif
+/*
+ * We require a HAL w/ the changes for split tx/rx MIC.
+ */
+CTASSERT(HAL_ABI_VERSION > 0x06052200);
+
/* unaligned little endian access */
#define LE_READ_2(p) \
((u_int16_t) \
@@ -378,7 +382,6 @@ ath_attach(u_int16_t devid, struct ath_softc *sc)
goto bad;
}
callout_init(&sc->sc_cal_ch, CALLOUT_MPSAFE);
- callout_init(&sc->sc_dfs_ch, CALLOUT_MPSAFE);
ATH_TXBUF_LOCK_INIT(sc);
@@ -2250,14 +2253,13 @@ ath_key_update_end(struct ieee80211com *ic)
static u_int32_t
ath_calcrxfilter(struct ath_softc *sc)
{
-#define RX_FILTER_PRESERVE (HAL_RX_FILTER_PHYERR | HAL_RX_FILTER_PHYRADAR)
struct ieee80211com *ic = &sc->sc_ic;
- struct ath_hal *ah = sc->sc_ah;
struct ifnet *ifp = sc->sc_ifp;
u_int32_t rfilt;
- rfilt = (ath_hal_getrxfilter(ah) & RX_FILTER_PRESERVE)
- | HAL_RX_FILTER_UCAST | HAL_RX_FILTER_BCAST | HAL_RX_FILTER_MCAST;
+ rfilt = HAL_RX_FILTER_UCAST | HAL_RX_FILTER_BCAST | HAL_RX_FILTER_MCAST;
+ if (!sc->sc_needmib && !sc->sc_scanning)
+ rfilt |= HAL_RX_FILTER_PHYERR;
if (ic->ic_opmode != IEEE80211_M_STA)
rfilt |= HAL_RX_FILTER_PROBEREQ;
if (ic->ic_opmode != IEEE80211_M_HOSTAP &&
@@ -4890,42 +4892,6 @@ ath_chan_change(struct ath_softc *sc, struct ieee80211_channel *chan)
}
/*
- * Poll for a channel clear indication; this is required
- * for channels requiring DFS and not previously visited
- * and/or with a recent radar detection.
- */
-static void
-ath_dfswait(void *arg)
-{
- struct ath_softc *sc = arg;
- struct ath_hal *ah = sc->sc_ah;
- HAL_CHANNEL hchan;
-
- ath_hal_radar_wait(ah, &hchan);
- DPRINTF(sc, ATH_DEBUG_DFS, "%s: radar_wait %u/%x/%x\n",
- __func__, hchan.channel, hchan.channelFlags, hchan.privFlags);
-
- if (hchan.privFlags & CHANNEL_INTERFERENCE) {
- if_printf(sc->sc_ifp,
- "channel %u/0x%x/0x%x has interference\n",
- hchan.channel, hchan.channelFlags, hchan.privFlags);
- return;
- }
- if ((hchan.privFlags & CHANNEL_DFS) == 0) {
- /* XXX should not happen */
- return;
- }
- if (hchan.privFlags & CHANNEL_DFS_CLEAR) {
- sc->sc_curchan.privFlags |= CHANNEL_DFS_CLEAR;
- sc->sc_ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
- if_printf(sc->sc_ifp,
- "channel %u/0x%x/0x%x marked clear\n",
- hchan.channel, hchan.channelFlags, hchan.privFlags);
- } else
- callout_reset(&sc->sc_dfs_ch, 2 * hz, ath_dfswait, sc);
-}
-
-/*
* Set/change channels. If the channel is really being changed,
* it's done by reseting the chip. To accomplish this we must
* first cleanup any pending DMA, then restart stuff after a la
@@ -4996,25 +4962,6 @@ ath_chan_set(struct ath_softc *sc, struct ieee80211_channel *chan)
ath_chan_change(sc, chan);
/*
- * Handle DFS required waiting period to determine
- * if channel is clear of radar traffic.
- */
- if (ic->ic_opmode == IEEE80211_M_HOSTAP) {
-#define DFS_AND_NOT_CLEAR(_c) \
- (((_c)->privFlags & (CHANNEL_DFS | CHANNEL_DFS_CLEAR)) == CHANNEL_DFS)
- if (DFS_AND_NOT_CLEAR(&sc->sc_curchan)) {
- if_printf(sc->sc_ifp,
- "wait for DFS clear channel signal\n");
- /* XXX stop sndq */
- sc->sc_ifp->if_drv_flags |= IFF_DRV_OACTIVE;
- callout_reset(&sc->sc_dfs_ch,
- 2 * hz, ath_dfswait, sc);
- } else
- callout_stop(&sc->sc_dfs_ch);
-#undef DFS_NOT_CLEAR
- }
-
- /*
* Re-enable interrupts.
*/
ath_hal_intrset(ah, sc->sc_imask);
@@ -5163,7 +5110,6 @@ ath_newstate(struct ieee80211com *ic, enum ieee80211_state nstate, int arg)
ieee80211_state_name[nstate]);
callout_stop(&sc->sc_cal_ch);
- callout_stop(&sc->sc_dfs_ch);
ath_hal_setledstate(ah, leds[nstate]); /* set LED */
if (nstate == IEEE80211_S_INIT) {
diff --git a/sys/dev/ath/if_ath_pci.c b/sys/dev/ath/if_ath_pci.c
index 277a74d702cc..260b2bf44146 100644
--- a/sys/dev/ath/if_ath_pci.c
+++ b/sys/dev/ath/if_ath_pci.c
@@ -56,7 +56,6 @@ __FBSDID("$FreeBSD$");
#include <net80211/ieee80211_var.h>
#include <dev/ath/if_athvar.h>
-#include <contrib/dev/ath/ah.h>
#include <dev/pci/pcivar.h>
#include <dev/pci/pcireg.h>
@@ -279,6 +278,4 @@ static devclass_t ath_devclass;
DRIVER_MODULE(if_ath, pci, ath_pci_driver, ath_devclass, 0, 0);
DRIVER_MODULE(if_ath, cardbus, ath_pci_driver, ath_devclass, 0, 0);
MODULE_VERSION(if_ath, 1);
-MODULE_DEPEND(if_ath, ath_hal, 1, 1, 1); /* Atheros HAL */
MODULE_DEPEND(if_ath, wlan, 1, 1, 1); /* 802.11 media layer */
-MODULE_DEPEND(if_ath, ath_rate, 1, 1, 1); /* rate control algorithm */
diff --git a/sys/dev/ath/if_athvar.h b/sys/dev/ath/if_athvar.h
index af1045d10857..53223628b3dd 100644
--- a/sys/dev/ath/if_athvar.h
+++ b/sys/dev/ath/if_athvar.h
@@ -35,8 +35,8 @@
#ifndef _DEV_ATH_ATHVAR_H
#define _DEV_ATH_ATHVAR_H
-#include <contrib/dev/ath/ah.h>
-#include <contrib/dev/ath/ah_desc.h>
+#include <dev/ath/ath_hal/ah.h>
+#include <dev/ath/ath_hal/ah_desc.h>
#include <net80211/ieee80211_radiotap.h>
#include <dev/ath/if_athioctl.h>
#include <dev/ath/if_athrate.h>
@@ -315,7 +315,6 @@ struct ath_softc {
int sc_calinterval; /* current polling interval */
int sc_caltries; /* cals at current interval */
HAL_NODE_STATS sc_halstats; /* station-mode rssi stats */
- struct callout sc_dfs_ch; /* callout handle for dfs */
};
#define sc_tx_th u_tx_rt.th
#define sc_rx_th u_rx_rt.th
@@ -483,7 +482,7 @@ void ath_intr(void *);
#define ath_hal_getregdomain(_ah, _prd) \
(ath_hal_getcapability(_ah, HAL_CAP_REG_DMN, 0, (_prd)) == HAL_OK)
#define ath_hal_setregdomain(_ah, _rd) \
- ((*(_ah)->ah_setRegulatoryDomain)((_ah), (_rd), NULL))
+ ath_hal_setcapability(_ah, HAL_CAP_REG_DMN, 0, _rd, NULL)
#define ath_hal_getcountrycode(_ah, _pcc) \
(*(_pcc) = (_ah)->ah_countryCode)
#define ath_hal_hastkipsplit(_ah) \
@@ -618,7 +617,4 @@ void ath_intr(void *);
#define ath_hal_gpiosetintr(_ah, _gpio, _b) \
((*(_ah)->ah_gpioSetIntr)((_ah), (_gpio), (_b)))
-#define ath_hal_radar_wait(_ah, _chan) \
- ((*(_ah)->ah_radarWait)((_ah), (_chan)))
-
#endif /* _DEV_ATH_ATHVAR_H */