aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/ath
diff options
context:
space:
mode:
authorAdrian Chadd <adrian@FreeBSD.org>2017-05-25 04:18:46 +0000
committerAdrian Chadd <adrian@FreeBSD.org>2017-05-25 04:18:46 +0000
commit41059135ce931c0f1014a999ffabc6bc470ce856 (patch)
tree19e207857834db8d7eb7a77b2017e7735c4860a1 /sys/dev/ath
parent8816c0bb48c2b46e4fde06af2c672909980d07f5 (diff)
Notes
Diffstat (limited to 'sys/dev/ath')
-rw-r--r--sys/dev/ath/ah_osdep.c29
-rw-r--r--sys/dev/ath/ah_osdep_ar5210.c74
-rw-r--r--sys/dev/ath/ah_osdep_ar5211.c74
-rw-r--r--sys/dev/ath/ah_osdep_ar5212.c95
-rw-r--r--sys/dev/ath/ah_osdep_ar5416.c103
-rw-r--r--sys/dev/ath/ah_osdep_ar9300.c74
-rw-r--r--sys/dev/ath/ath_dfs/null/dfs_null.c4
-rw-r--r--sys/dev/ath/ath_hal/ah.c75
-rw-r--r--sys/dev/ath/ath_hal/ah_internal.h29
-rw-r--r--sys/dev/ath/ath_rate/sample/sample.c4
-rw-r--r--sys/dev/ath/if_ath.c9
-rw-r--r--sys/dev/ath/if_ath_ahb.c11
-rw-r--r--sys/dev/ath/if_ath_dfs.c74
-rw-r--r--sys/dev/ath/if_ath_drv.c89
-rw-r--r--sys/dev/ath/if_ath_pci.c9
-rw-r--r--sys/dev/ath/if_ath_rate.c74
16 files changed, 809 insertions, 18 deletions
diff --git a/sys/dev/ath/ah_osdep.c b/sys/dev/ath/ah_osdep.c
index 3d633a44adda3..ecd928c59e885 100644
--- a/sys/dev/ath/ah_osdep.c
+++ b/sys/dev/ath/ah_osdep.c
@@ -41,6 +41,7 @@
#include <sys/pcpu.h>
#include <sys/lock.h>
#include <sys/mutex.h>
+#include <sys/conf.h>
#include <machine/stdarg.h>
@@ -420,3 +421,31 @@ ath_hal_assert_failed(const char* filename, int lineno, const char *msg)
panic("ath_hal_assert");
}
#endif /* AH_ASSERT */
+
+static int
+ath_hal_modevent(module_t mod __unused, int type, void *data __unused)
+{
+ int error = 0;
+
+ switch (type) {
+ case MOD_LOAD:
+ printf("[ath_hal] loaded\n");
+ break;
+
+ case MOD_UNLOAD:
+ printf("[ath_hal] unloaded\n");
+ break;
+
+ case MOD_SHUTDOWN:
+ break;
+
+ default:
+ error = EOPNOTSUPP;
+ break;
+
+ }
+ return (error);
+}
+
+DEV_MODULE(ath_hal, ath_hal_modevent, NULL);
+MODULE_VERSION(ath_hal, 1);
diff --git a/sys/dev/ath/ah_osdep_ar5210.c b/sys/dev/ath/ah_osdep_ar5210.c
new file mode 100644
index 0000000000000..905befe9ca950
--- /dev/null
+++ b/sys/dev/ath/ah_osdep_ar5210.c
@@ -0,0 +1,74 @@
+/*-
+ * Copyright 2017 Adrian Chadd <adrian@FreeBSD.org>.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ *
+ */
+
+#include "opt_ah.h"
+#include "opt_wlan.h"
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+#include <sys/systm.h>
+#include <sys/conf.h>
+#include <sys/errno.h>
+#include <sys/kernel.h>
+#include <sys/module.h>
+
+#include <dev/ath/ath_hal/ah.h>
+#include <dev/ath/ath_hal/ah_internal.h>
+
+extern struct ath_hal_chip AR5210_chip;
+
+static int
+ath_hal_ar5210_modevent(module_t mod __unused, int type, void *data __unused)
+{
+ int error = 0;
+
+ switch (type) {
+ case MOD_LOAD:
+ ath_hal_add_chip(&AR5210_chip);
+ printf("[ar5210] loaded\n");
+ break;
+
+ case MOD_UNLOAD:
+ ath_hal_remove_chip(&AR5210_chip);
+ printf("[ar5210] unloaded\n");
+ break;
+
+ case MOD_SHUTDOWN:
+ break;
+
+ default:
+ error = EOPNOTSUPP;
+ break;
+
+ }
+ return (error);
+}
+
+DEV_MODULE(ath_hal_ar5210, ath_hal_ar5210_modevent, NULL);
+MODULE_VERSION(ath_hal_ar5210, 1);
+MODULE_DEPEND(ath_hal_ar5210, ath_hal, 1, 1, 1);
diff --git a/sys/dev/ath/ah_osdep_ar5211.c b/sys/dev/ath/ah_osdep_ar5211.c
new file mode 100644
index 0000000000000..92400965e55b2
--- /dev/null
+++ b/sys/dev/ath/ah_osdep_ar5211.c
@@ -0,0 +1,74 @@
+/*-
+ * Copyright 2017 Adrian Chadd <adrian@FreeBSD.org>.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ *
+ */
+
+#include "opt_ah.h"
+#include "opt_wlan.h"
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+#include <sys/systm.h>
+#include <sys/conf.h>
+#include <sys/errno.h>
+#include <sys/kernel.h>
+#include <sys/module.h>
+
+#include <dev/ath/ath_hal/ah.h>
+#include <dev/ath/ath_hal/ah_internal.h>
+
+extern struct ath_hal_chip AR5211_chip;
+
+static int
+ath_hal_ar5211_modevent(module_t mod __unused, int type, void *data __unused)
+{
+ int error = 0;
+
+ switch (type) {
+ case MOD_LOAD:
+ ath_hal_add_chip(&AR5211_chip);
+ printf("[ar5211] loaded\n");
+ break;
+
+ case MOD_UNLOAD:
+ ath_hal_remove_chip(&AR5211_chip);
+ printf("[ar5211] unloaded\n");
+ break;
+
+ case MOD_SHUTDOWN:
+ break;
+
+ default:
+ error = EOPNOTSUPP;
+ break;
+
+ }
+ return (error);
+}
+
+DEV_MODULE(ath_hal_ar5211, ath_hal_ar5211_modevent, NULL);
+MODULE_VERSION(ath_hal_ar5211, 1);
+MODULE_DEPEND(ath_hal_ar5211, ath_hal, 1, 1, 1);
diff --git a/sys/dev/ath/ah_osdep_ar5212.c b/sys/dev/ath/ah_osdep_ar5212.c
new file mode 100644
index 0000000000000..3bc21ef803ecc
--- /dev/null
+++ b/sys/dev/ath/ah_osdep_ar5212.c
@@ -0,0 +1,95 @@
+/*-
+ * Copyright 2017 Adrian Chadd <adrian@FreeBSD.org>.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ *
+ */
+
+#include "opt_ah.h"
+#include "opt_wlan.h"
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+#include <sys/systm.h>
+#include <sys/conf.h>
+#include <sys/errno.h>
+#include <sys/kernel.h>
+#include <sys/module.h>
+
+#include <dev/ath/ath_hal/ah.h>
+#include <dev/ath/ath_hal/ah_internal.h>
+
+extern struct ath_hal_chip AR5212_chip;
+//extern struct ath_hal_rf RF2316_rf;
+//extern struct ath_hal_rf RF2317_rf;
+extern struct ath_hal_rf RF2413_rf;
+extern struct ath_hal_rf RF2425_rf;
+extern struct ath_hal_rf RF5111_rf;
+extern struct ath_hal_rf RF5112_rf;
+extern struct ath_hal_rf RF5413_rf;
+
+static int
+ath_hal_ar5212_modevent(module_t mod __unused, int type, void *data __unused)
+{
+ int error = 0;
+
+ switch (type) {
+ case MOD_LOAD:
+ ath_hal_add_chip(&AR5212_chip);
+// ath_hal_add_rf(&RF2316_rf);
+// ath_hal_add_rf(&RF2317_rf);
+ ath_hal_add_rf(&RF2413_rf);
+ ath_hal_add_rf(&RF2425_rf);
+ ath_hal_add_rf(&RF5111_rf);
+ ath_hal_add_rf(&RF5112_rf);
+ ath_hal_add_rf(&RF5413_rf);
+ printf("[ar5212] loaded\n");
+ break;
+
+ case MOD_UNLOAD:
+ ath_hal_remove_chip(&AR5212_chip);
+// ath_hal_remove_rf(&RF2316_rf);
+// ath_hal_remove_rf(&RF2317_rf);
+ ath_hal_remove_rf(&RF2413_rf);
+ ath_hal_remove_rf(&RF2425_rf);
+ ath_hal_remove_rf(&RF5111_rf);
+ ath_hal_remove_rf(&RF5112_rf);
+ ath_hal_remove_rf(&RF5413_rf);
+ printf("[ar5212] unloaded\n");
+ break;
+
+ case MOD_SHUTDOWN:
+ break;
+
+ default:
+ error = EOPNOTSUPP;
+ break;
+
+ }
+ return (error);
+}
+
+DEV_MODULE(ath_hal_ar5212, ath_hal_ar5212_modevent, NULL);
+MODULE_VERSION(ath_hal_ar5212, 1);
+MODULE_DEPEND(ath_hal_ar5212, ath_hal, 1, 1, 1);
diff --git a/sys/dev/ath/ah_osdep_ar5416.c b/sys/dev/ath/ah_osdep_ar5416.c
new file mode 100644
index 0000000000000..a735838068b62
--- /dev/null
+++ b/sys/dev/ath/ah_osdep_ar5416.c
@@ -0,0 +1,103 @@
+/*-
+ * Copyright 2017 Adrian Chadd <adrian@FreeBSD.org>.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ *
+ */
+
+#include "opt_ah.h"
+#include "opt_wlan.h"
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+#include <sys/systm.h>
+#include <sys/conf.h>
+#include <sys/errno.h>
+#include <sys/kernel.h>
+#include <sys/module.h>
+
+#include <dev/ath/ath_hal/ah.h>
+#include <dev/ath/ath_hal/ah_internal.h>
+
+extern struct ath_hal_chip AR5416_chip;
+extern struct ath_hal_chip AR9130_chip;
+extern struct ath_hal_chip AR9160_chip;
+extern struct ath_hal_chip AR9280_chip;
+extern struct ath_hal_chip AR9285_chip;
+extern struct ath_hal_chip AR9287_chip;
+
+extern struct ath_hal_rf RF2133_rf;
+extern struct ath_hal_rf RF9280_rf;
+extern struct ath_hal_rf RF9285_rf;
+extern struct ath_hal_rf RF9287_rf;
+
+static int
+ath_hal_ar5416_modevent(module_t mod __unused, int type, void *data __unused)
+{
+ int error = 0;
+
+ switch (type) {
+ case MOD_LOAD:
+ ath_hal_add_chip(&AR5416_chip);
+ ath_hal_add_chip(&AR9130_chip);
+ ath_hal_add_chip(&AR9160_chip);
+ ath_hal_add_chip(&AR9280_chip);
+ ath_hal_add_chip(&AR9285_chip);
+ ath_hal_add_chip(&AR9287_chip);
+ ath_hal_add_rf(&RF2133_rf);
+ ath_hal_add_rf(&RF9280_rf);
+ ath_hal_add_rf(&RF9285_rf);
+ ath_hal_add_rf(&RF9287_rf);
+ printf("[ar5416] loaded\n");
+ break;
+
+ case MOD_UNLOAD:
+ ath_hal_remove_chip(&AR5416_chip);
+ ath_hal_remove_chip(&AR9130_chip);
+ ath_hal_remove_chip(&AR9160_chip);
+ ath_hal_remove_chip(&AR9280_chip);
+ ath_hal_remove_chip(&AR9285_chip);
+ ath_hal_remove_chip(&AR9287_chip);
+ ath_hal_remove_rf(&RF2133_rf);
+ ath_hal_remove_rf(&RF9280_rf);
+ ath_hal_remove_rf(&RF9285_rf);
+ ath_hal_remove_rf(&RF9287_rf);
+ printf("[ar5416] unloaded\n");
+ break;
+
+ case MOD_SHUTDOWN:
+ break;
+
+ default:
+ error = EOPNOTSUPP;
+ break;
+
+ }
+ return (error);
+}
+
+DEV_MODULE(ath_hal_ar5416, ath_hal_ar5416_modevent, NULL);
+MODULE_VERSION(ath_hal_ar5416, 1);
+MODULE_DEPEND(ath_hal_ar5416, ath_hal, 1, 1, 1);
+MODULE_DEPEND(ath_hal_ar5416, ath_hal_ar5212, 1, 1, 1);
diff --git a/sys/dev/ath/ah_osdep_ar9300.c b/sys/dev/ath/ah_osdep_ar9300.c
new file mode 100644
index 0000000000000..f481d7ea2a2db
--- /dev/null
+++ b/sys/dev/ath/ah_osdep_ar9300.c
@@ -0,0 +1,74 @@
+/*-
+ * Copyright 2017 Adrian Chadd <adrian@FreeBSD.org>.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ *
+ */
+
+#include "opt_ah.h"
+#include "opt_wlan.h"
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+#include <sys/systm.h>
+#include <sys/conf.h>
+#include <sys/errno.h>
+#include <sys/kernel.h>
+#include <sys/module.h>
+
+#include <dev/ath/ath_hal/ah.h>
+#include <dev/ath/ath_hal/ah_internal.h>
+
+extern struct ath_hal_chip AR9300_chip;
+
+static int
+ath_hal_ar9300_modevent(module_t mod __unused, int type, void *data __unused)
+{
+ int error = 0;
+
+ switch (type) {
+ case MOD_LOAD:
+ ath_hal_add_chip(&AR9300_chip);
+ printf("[ar9300] loaded\n");
+ break;
+
+ case MOD_UNLOAD:
+ ath_hal_remove_chip(&AR9300_chip);
+ printf("[ar9300] unloaded\n");
+ break;
+
+ case MOD_SHUTDOWN:
+ break;
+
+ default:
+ error = EOPNOTSUPP;
+ break;
+
+ }
+ return (error);
+}
+
+DEV_MODULE(ath_hal_ar9300, ath_hal_ar9300_modevent, NULL);
+MODULE_VERSION(ath_hal_ar9300, 1);
+MODULE_DEPEND(ath_hal_ar9300, ath_hal, 1, 1, 1);
diff --git a/sys/dev/ath/ath_dfs/null/dfs_null.c b/sys/dev/ath/ath_dfs/null/dfs_null.c
index e31a61d85758c..6f9ed41d81a99 100644
--- a/sys/dev/ath/ath_dfs/null/dfs_null.c
+++ b/sys/dev/ath/ath_dfs/null/dfs_null.c
@@ -102,7 +102,7 @@ ath_dfs_detach(struct ath_softc *sc)
int
ath_dfs_radar_enable(struct ath_softc *sc, struct ieee80211_channel *chan)
{
-#if 0
+#if 1
HAL_PHYERR_PARAM pe;
/* Check if the hardware supports radar reporting */
@@ -155,7 +155,7 @@ ath_dfs_radar_enable(struct ath_softc *sc, struct ieee80211_channel *chan)
int
ath_dfs_radar_disable(struct ath_softc *sc)
{
-#if 0
+#if 1
HAL_PHYERR_PARAM pe;
(void) ath_hal_getdfsthresh(sc->sc_ah, &pe);
diff --git a/sys/dev/ath/ath_hal/ah.c b/sys/dev/ath/ath_hal/ah.c
index 11d0ca314903f..70a489cf0d314 100644
--- a/sys/dev/ath/ath_hal/ah.c
+++ b/sys/dev/ath/ath_hal/ah.c
@@ -28,6 +28,23 @@
/* linker set of registered chips */
OS_SET_DECLARE(ah_chips, struct ath_hal_chip);
+TAILQ_HEAD(, ath_hal_chip) ah_chip_list = TAILQ_HEAD_INITIALIZER(ah_chip_list);
+
+int
+ath_hal_add_chip(struct ath_hal_chip *ahc)
+{
+
+ TAILQ_INSERT_TAIL(&ah_chip_list, ahc, node);
+ return (0);
+}
+
+int
+ath_hal_remove_chip(struct ath_hal_chip *ahc)
+{
+
+ TAILQ_REMOVE(&ah_chip_list, ahc, node);
+ return (0);
+}
/*
* Check the set of registered chips to see if any recognize
@@ -37,12 +54,22 @@ const char*
ath_hal_probe(uint16_t vendorid, uint16_t devid)
{
struct ath_hal_chip * const *pchip;
+ struct ath_hal_chip *pc;
+ /* Linker set */
OS_SET_FOREACH(pchip, ah_chips) {
const char *name = (*pchip)->probe(vendorid, devid);
if (name != AH_NULL)
return name;
}
+
+ /* List */
+ TAILQ_FOREACH(pc, &ah_chip_list, node) {
+ const char *name = pc->probe(vendorid, devid);
+ if (name != AH_NULL)
+ return name;
+ }
+
return AH_NULL;
}
@@ -60,6 +87,7 @@ ath_hal_attach(uint16_t devid, HAL_SOFTC sc,
HAL_STATUS *error)
{
struct ath_hal_chip * const *pchip;
+ struct ath_hal_chip *pc;
OS_SET_FOREACH(pchip, ah_chips) {
struct ath_hal_chip *chip = *pchip;
@@ -82,6 +110,30 @@ ath_hal_attach(uint16_t devid, HAL_SOFTC sc,
return ah;
}
}
+
+ /* List */
+ TAILQ_FOREACH(pc, &ah_chip_list, node) {
+ struct ath_hal_chip *chip = pc;
+ struct ath_hal *ah;
+
+ /* XXX don't have vendorid, assume atheros one works */
+ if (chip->probe(ATHEROS_VENDOR_ID, devid) == AH_NULL)
+ continue;
+ ah = chip->attach(devid, sc, st, sh, eepromdata, ah_config,
+ error);
+ if (ah != AH_NULL) {
+ /* copy back private state to public area */
+ ah->ah_devid = AH_PRIVATE(ah)->ah_devid;
+ ah->ah_subvendorid = AH_PRIVATE(ah)->ah_subvendorid;
+ ah->ah_macVersion = AH_PRIVATE(ah)->ah_macVersion;
+ ah->ah_macRev = AH_PRIVATE(ah)->ah_macRev;
+ ah->ah_phyRev = AH_PRIVATE(ah)->ah_phyRev;
+ ah->ah_analog5GhzRev = AH_PRIVATE(ah)->ah_analog5GhzRev;
+ ah->ah_analog2GhzRev = AH_PRIVATE(ah)->ah_analog2GhzRev;
+ return ah;
+ }
+ }
+
return AH_NULL;
}
@@ -160,6 +212,23 @@ ath_hal_getwirelessmodes(struct ath_hal*ah)
/* linker set of registered RF backends */
OS_SET_DECLARE(ah_rfs, struct ath_hal_rf);
+TAILQ_HEAD(, ath_hal_rf) ah_rf_list = TAILQ_HEAD_INITIALIZER(ah_rf_list);
+
+int
+ath_hal_add_rf(struct ath_hal_rf *arf)
+{
+
+ TAILQ_INSERT_TAIL(&ah_rf_list, arf, node);
+ return (0);
+}
+
+int
+ath_hal_remove_rf(struct ath_hal_rf *arf)
+{
+
+ TAILQ_REMOVE(&ah_rf_list, arf, node);
+ return (0);
+}
/*
* Check the set of registered RF backends to see if
@@ -169,12 +238,18 @@ struct ath_hal_rf *
ath_hal_rfprobe(struct ath_hal *ah, HAL_STATUS *ecode)
{
struct ath_hal_rf * const *prf;
+ struct ath_hal_rf * rf;
OS_SET_FOREACH(prf, ah_rfs) {
struct ath_hal_rf *rf = *prf;
if (rf->probe(ah))
return rf;
}
+
+ TAILQ_FOREACH(rf, &ah_rf_list, node) {
+ if (rf->probe(ah))
+ return rf;
+ }
*ecode = HAL_ENOTSUPP;
return AH_NULL;
}
diff --git a/sys/dev/ath/ath_hal/ah_internal.h b/sys/dev/ath/ath_hal/ah_internal.h
index 0d650ded7587a..ec15b46c8aada 100644
--- a/sys/dev/ath/ath_hal/ah_internal.h
+++ b/sys/dev/ath/ath_hal/ah_internal.h
@@ -28,6 +28,7 @@
#define AH_MAX(a,b) ((a)>(b)?(a):(b))
#include <net80211/_ieee80211.h>
+#include <sys/queue.h> /* XXX for reasons */
#include "opt_ah.h" /* needed for AH_SUPPORT_AR5416 */
#ifndef AH_SUPPORT_AR5416
@@ -85,6 +86,11 @@ typedef enum {
/*
* Each chip or class of chips registers to offer support.
+ *
+ * Compiled-in versions will include a linker set to iterate through the
+ * linked in code.
+ *
+ * Modules will have to register HAL backends separately.
*/
struct ath_hal_chip {
const char *name;
@@ -93,13 +99,14 @@ struct ath_hal_chip {
HAL_BUS_TAG, HAL_BUS_HANDLE, uint16_t *eepromdata,
HAL_OPS_CONFIG *ah,
HAL_STATUS *error);
+ TAILQ_ENTRY(ath_hal_chip) node;
};
#ifndef AH_CHIP
#define AH_CHIP(_name, _probe, _attach) \
-static struct ath_hal_chip _name##_chip = { \
+struct ath_hal_chip _name##_chip = { \
.name = #_name, \
.probe = _probe, \
- .attach = _attach \
+ .attach = _attach, \
}; \
OS_DATA_SET(ah_chips, _name##_chip)
#endif
@@ -108,18 +115,24 @@ OS_DATA_SET(ah_chips, _name##_chip)
* Each RF backend registers to offer support; this is mostly
* used by multi-chip 5212 solutions. Single-chip solutions
* have a fixed idea about which RF to use.
+ *
+ * Compiled in versions will include this linker set to iterate through
+ * the linked in code.
+ *
+ * Modules will have to register RF backends separately.
*/
struct ath_hal_rf {
const char *name;
HAL_BOOL (*probe)(struct ath_hal *ah);
HAL_BOOL (*attach)(struct ath_hal *ah, HAL_STATUS *ecode);
+ TAILQ_ENTRY(ath_hal_rf) node;
};
#ifndef AH_RF
#define AH_RF(_name, _probe, _attach) \
-static struct ath_hal_rf _name##_rf = { \
+struct ath_hal_rf _name##_rf = { \
.name = __STRING(_name), \
.probe = _probe, \
- .attach = _attach \
+ .attach = _attach, \
}; \
OS_DATA_SET(ah_rfs, _name##_rf)
#endif
@@ -1038,4 +1051,12 @@ extern void ath_hal_survey_clear(struct ath_hal *ah);
extern void ath_hal_survey_add_sample(struct ath_hal *ah,
HAL_SURVEY_SAMPLE *hs);
+/*
+ * Chip registration - for modules.
+ */
+extern int ath_hal_add_chip(struct ath_hal_chip *ahc);
+extern int ath_hal_remove_chip(struct ath_hal_chip *ahc);
+extern int ath_hal_add_rf(struct ath_hal_rf *arf);
+extern int ath_hal_remove_rf(struct ath_hal_rf *arf);
+
#endif /* _ATH_AH_INTERAL_H_ */
diff --git a/sys/dev/ath/ath_rate/sample/sample.c b/sys/dev/ath/ath_rate/sample/sample.c
index 815c68b7a2450..23f24f05e8693 100644
--- a/sys/dev/ath/ath_rate/sample/sample.c
+++ b/sys/dev/ath/ath_rate/sample/sample.c
@@ -775,6 +775,10 @@ update_stats(struct ath_softc *sc, struct ath_node *an,
* XXX Don't mark the higher bit rates as also having failed; as this
* unfortunately stops those rates from being tasted when trying to
* TX. This happens with 11n aggregation.
+ *
+ * This is valid for higher CCK rates, higher OFDM rates, and higher
+ * HT rates within the current number of streams (eg MCS0..7, 8..15,
+ * etc.)
*/
if (nframes == nbad) {
#if 0
diff --git a/sys/dev/ath/if_ath.c b/sys/dev/ath/if_ath.c
index 31f2b9dcc564d..87e97109db76c 100644
--- a/sys/dev/ath/if_ath.c
+++ b/sys/dev/ath/if_ath.c
@@ -6989,8 +6989,11 @@ ath_node_recv_pspoll(struct ieee80211_node *ni, struct mbuf *m)
#endif /* ATH_SW_PSQ */
}
-MODULE_VERSION(if_ath, 1);
-MODULE_DEPEND(if_ath, wlan, 1, 1, 1); /* 802.11 media layer */
+MODULE_VERSION(ath_main, 1);
+MODULE_DEPEND(ath_main, wlan, 1, 1, 1); /* 802.11 media layer */
+MODULE_DEPEND(ath_main, ath_rate, 1, 1, 1);
+MODULE_DEPEND(ath_main, ath_dfs, 1, 1, 1);
+MODULE_DEPEND(ath_main, ath_hal, 1, 1, 1);
#if defined(IEEE80211_ALQ) || defined(AH_DEBUG_ALQ) || defined(ATH_DEBUG_ALQ)
-MODULE_DEPEND(if_ath, alq, 1, 1, 1);
+MODULE_DEPEND(ath_main, alq, 1, 1, 1);
#endif
diff --git a/sys/dev/ath/if_ath_ahb.c b/sys/dev/ath/if_ath_ahb.c
index 09a72346f48b9..137d8fca5df66 100644
--- a/sys/dev/ath/if_ath_ahb.c
+++ b/sys/dev/ath/if_ath_ahb.c
@@ -343,8 +343,9 @@ static driver_t ath_ahb_driver = {
sizeof (struct ath_ahb_softc)
};
static devclass_t ath_devclass;
-DRIVER_MODULE(ath, nexus, ath_ahb_driver, ath_devclass, 0, 0);
-DRIVER_MODULE(ath, apb, ath_ahb_driver, ath_devclass, 0, 0);
-MODULE_VERSION(ath, 1);
-MODULE_DEPEND(ath, wlan, 1, 1, 1); /* 802.11 media layer */
-MODULE_DEPEND(ath, if_ath, 1, 1, 1); /* if_ath driver */
+DRIVER_MODULE(if_ath_ahb, nexus, ath_ahb_driver, ath_devclass, 0, 0);
+DRIVER_MODULE(if_ath_ahb, apb, ath_ahb_driver, ath_devclass, 0, 0);
+MODULE_VERSION(if_ath_ahb, 1);
+MODULE_DEPEND(if_ath_ahb, wlan, 1, 1, 1); /* 802.11 media layer */
+MODULE_DEPEND(if_ath_ahb, ath_main, 1, 1, 1); /* if_ath driver */
+MODULE_DEPEND(if_ath_ahb, ath_hal, 1, 1, 1); /* ath HAL */
diff --git a/sys/dev/ath/if_ath_dfs.c b/sys/dev/ath/if_ath_dfs.c
new file mode 100644
index 0000000000000..2078f154981cb
--- /dev/null
+++ b/sys/dev/ath/if_ath_dfs.c
@@ -0,0 +1,74 @@
+/*-
+ * Copyright (c) 2017 Adrian Chadd <adrian@FreeBSD.org>.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer,
+ * without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
+ * redistribution must be conditioned upon including a substantially
+ * similar Disclaimer requirement for further binary redistribution.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY
+ * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY,
+ * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGES.
+ *
+ * $FreeBSD$
+ */
+#include "opt_ah.h"
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/kernel.h>
+#include <sys/module.h>
+#include <sys/sysctl.h>
+#include <sys/bus.h>
+#include <sys/malloc.h>
+#include <sys/proc.h>
+#include <sys/pcpu.h>
+#include <sys/lock.h>
+#include <sys/mutex.h>
+#include <sys/conf.h>
+
+static int
+ath_dfs_modevent(module_t mod __unused, int type, void *data __unused)
+{
+ int error = 0;
+
+ switch (type) {
+ case MOD_LOAD:
+ printf("[ath_dfs] loaded\n");
+ break;
+
+ case MOD_UNLOAD:
+ printf("[ath_dfs] unloaded\n");
+ break;
+
+ case MOD_SHUTDOWN:
+ break;
+
+ default:
+ error = EOPNOTSUPP;
+ break;
+
+ }
+ return (error);
+}
+
+DEV_MODULE(ath_dfs, ath_dfs_modevent, NULL);
+MODULE_VERSION(ath_dfs, 1);
+MODULE_DEPEND(ath_dfs, ath_hal, 1, 1, 1);
+MODULE_DEPEND(ath_dfs, wlan, 1, 1, 1);
diff --git a/sys/dev/ath/if_ath_drv.c b/sys/dev/ath/if_ath_drv.c
new file mode 100644
index 0000000000000..cc7b9162fb2c4
--- /dev/null
+++ b/sys/dev/ath/if_ath_drv.c
@@ -0,0 +1,89 @@
+/*-
+ * Copyright (c) 2017 Adrian Chadd <adrian@FreeBSD.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer,
+ * without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
+ * redistribution must be conditioned upon including a substantially
+ * similar Disclaimer requirement for further binary redistribution.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY
+ * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY,
+ * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGES.
+ *
+ * $FreeBSD$
+ */
+#include "opt_ah.h"
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/kernel.h>
+#include <sys/module.h>
+#include <sys/sysctl.h>
+#include <sys/bus.h>
+#include <sys/malloc.h>
+#include <sys/proc.h>
+#include <sys/pcpu.h>
+#include <sys/lock.h>
+#include <sys/mutex.h>
+#include <sys/conf.h>
+
+/*
+ * This implements the "old" style ath(4) module behaviour, which loaded the
+ * driver, HAL and PCI glue.
+ */
+
+static int
+ath_modevent(module_t mod __unused, int type, void *data __unused)
+{
+ int error = 0;
+
+ switch (type) {
+ case MOD_LOAD:
+ printf("[ath] loaded\n");
+ break;
+
+ case MOD_UNLOAD:
+ printf("[ath] unloaded\n");
+ break;
+
+ case MOD_SHUTDOWN:
+ break;
+
+ default:
+ error = EOPNOTSUPP;
+ break;
+
+ }
+ return (error);
+}
+
+DEV_MODULE(if_ath, ath_modevent, NULL);
+
+MODULE_VERSION(if_ath, 1);
+MODULE_DEPEND(if_ath, ath_hal, 1, 1, 1);
+MODULE_DEPEND(if_ath, ath_hal_ar5210, 1, 1, 1);
+MODULE_DEPEND(if_ath, ath_hal_ar5211, 1, 1, 1);
+MODULE_DEPEND(if_ath, ath_hal_ar5212, 1, 1, 1);
+MODULE_DEPEND(if_ath, ath_hal_ar5416, 1, 1, 1);
+MODULE_DEPEND(if_ath, ath_hal_ar9300, 1, 1, 1);
+MODULE_DEPEND(if_ath, ath_rate, 1, 1, 1);
+MODULE_DEPEND(if_ath, ath_dfs, 1, 1, 1);
+MODULE_DEPEND(if_ath, wlan, 1, 1, 1);
+MODULE_DEPEND(if_ath, ath_main, 1, 1, 1);
+MODULE_DEPEND(if_ath, if_ath_pci, 1, 1, 1);
diff --git a/sys/dev/ath/if_ath_pci.c b/sys/dev/ath/if_ath_pci.c
index 88cbaffb1f5c9..1ebcf074d5521 100644
--- a/sys/dev/ath/if_ath_pci.c
+++ b/sys/dev/ath/if_ath_pci.c
@@ -463,7 +463,8 @@ static driver_t ath_pci_driver = {
sizeof (struct ath_pci_softc)
};
static devclass_t ath_devclass;
-DRIVER_MODULE(ath_pci, pci, ath_pci_driver, ath_devclass, 0, 0);
-MODULE_VERSION(ath_pci, 1);
-MODULE_DEPEND(ath_pci, wlan, 1, 1, 1); /* 802.11 media layer */
-MODULE_DEPEND(ath_pci, if_ath, 1, 1, 1); /* if_ath driver */
+DRIVER_MODULE(if_ath_pci, pci, ath_pci_driver, ath_devclass, 0, 0);
+MODULE_VERSION(if_ath_pci, 1);
+MODULE_DEPEND(if_ath_pci, wlan, 1, 1, 1); /* 802.11 media layer */
+MODULE_DEPEND(if_ath_pci, ath_main, 1, 1, 1); /* if_ath driver */
+MODULE_DEPEND(if_ath_pci, ath_hal, 1, 1, 1); /* ath HAL */
diff --git a/sys/dev/ath/if_ath_rate.c b/sys/dev/ath/if_ath_rate.c
new file mode 100644
index 0000000000000..8eb7a518c2a49
--- /dev/null
+++ b/sys/dev/ath/if_ath_rate.c
@@ -0,0 +1,74 @@
+/*-
+ * Copyright (c) 2017 Adrian Chadd <adrian@FreeBSD.org>.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer,
+ * without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
+ * redistribution must be conditioned upon including a substantially
+ * similar Disclaimer requirement for further binary redistribution.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY
+ * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY,
+ * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGES.
+ *
+ * $FreeBSD$
+ */
+#include "opt_ah.h"
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/kernel.h>
+#include <sys/module.h>
+#include <sys/sysctl.h>
+#include <sys/bus.h>
+#include <sys/malloc.h>
+#include <sys/proc.h>
+#include <sys/pcpu.h>
+#include <sys/lock.h>
+#include <sys/mutex.h>
+#include <sys/conf.h>
+
+static int
+ath_rate_modevent(module_t mod __unused, int type, void *data __unused)
+{
+ int error = 0;
+
+ switch (type) {
+ case MOD_LOAD:
+ printf("[ath_rate] loaded\n");
+ break;
+
+ case MOD_UNLOAD:
+ printf("[ath_rate] unloaded\n");
+ break;
+
+ case MOD_SHUTDOWN:
+ break;
+
+ default:
+ error = EOPNOTSUPP;
+ break;
+
+ }
+ return (error);
+}
+
+DEV_MODULE(ath_rate, ath_rate_modevent, NULL);
+MODULE_VERSION(ath_rate, 1);
+MODULE_DEPEND(ath_rate, ath_hal, 1, 1, 1);
+MODULE_DEPEND(ath_rate, wlan, 1, 1, 1);