aboutsummaryrefslogtreecommitdiff
path: root/sys
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
parent8816c0bb48c2b46e4fde06af2c672909980d07f5 (diff)
Notes
Diffstat (limited to 'sys')
-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
-rw-r--r--sys/modules/Makefile9
-rw-r--r--sys/modules/ath/Makefile129
-rw-r--r--sys/modules/ath_dfs/Makefile47
-rw-r--r--sys/modules/ath_hal/Makefile47
-rw-r--r--sys/modules/ath_hal_ar5210/Makefile53
-rw-r--r--sys/modules/ath_hal_ar5211/Makefile55
-rw-r--r--sys/modules/ath_hal_ar5212/Makefile60
-rw-r--r--sys/modules/ath_hal_ar5416/Makefile94
-rw-r--r--sys/modules/ath_hal_ar9300/Makefile59
-rw-r--r--sys/modules/ath_main/Makefile51
-rw-r--r--sys/modules/ath_rate/Makefile57
27 files changed, 1343 insertions, 145 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);
diff --git a/sys/modules/Makefile b/sys/modules/Makefile
index 09ec8a702ec4a..1897bee3ca1bf 100644
--- a/sys/modules/Makefile
+++ b/sys/modules/Makefile
@@ -46,6 +46,15 @@ SUBDIR= \
${_asmc} \
ata \
ath \
+ ath_dfs \
+ ath_hal \
+ ath_hal_ar5210 \
+ ath_hal_ar5211 \
+ ath_hal_ar5212 \
+ ath_hal_ar5416 \
+ ath_hal_ar9300 \
+ ath_main \
+ ath_rate \
ath_pci \
${_autofs} \
${_auxio} \
diff --git a/sys/modules/ath/Makefile b/sys/modules/ath/Makefile
index 9bfc29c15f5ef..cf46550b5f809 100644
--- a/sys/modules/ath/Makefile
+++ b/sys/modules/ath/Makefile
@@ -29,140 +29,15 @@
# $FreeBSD$
#
-ATH_RATE?= sample # tx rate control algorithm
-
.PATH: ${SRCTOP}/sys/dev/ath
.PATH: ${SRCTOP}/sys/dev/ath/ath_hal
KMOD= if_ath
-SRCS= if_ath.c if_ath_alq.c if_ath_debug.c if_ath_keycache.c if_ath_sysctl.c
-SRCS+= if_ath_tx.c if_ath_tx_ht.c if_ath_led.c if_ath_rx.c if_ath_tdma.c
-SRCS+= if_ath_beacon.c if_ath_rx_edma.c if_ath_tx_edma.c if_ath_spectral.c
-SRCS+= if_ath_btcoex.c if_ath_btcoex_mci.c if_ath_lna_div.c if_ath_ioctl.c if_ath_descdma.c
-# NB: v3 eeprom support used by both AR5211 and AR5212; just include it
-SRCS+= ah_osdep.c ah.c ah_regdomain.c ah_eeprom_v3.c
-SRCS+= device_if.h bus_if.h pci_if.h opt_inet.h opt_ath.h opt_ah.h opt_wlan.h
-
-#
-# AR5210 support; these are first generation 11a-only devices.
-#
-.PATH: ${SRCTOP}/sys/dev/ath/ath_hal/ar5210
-SRCS+= ah_eeprom_v1.c \
- ar5210_attach.c ar5210_beacon.c ar5210_interrupts.c \
- ar5210_keycache.c ar5210_misc.c ar5210_phy.c ar5210_power.c \
- ar5210_recv.c ar5210_reset.c ar5210_xmit.c
-
-#
-# AR5211 support; these are second generation 11b/g/a devices
-# (but 11g was OFDM only and is not supported).
-#
-.PATH: ${SRCTOP}/sys/dev/ath/ath_hal/ar5211
-SRCS+= ar5211_attach.c ar5211_beacon.c ar5211_interrupts.c \
- ar5211_keycache.c ar5211_misc.c ar5211_phy.c ar5211_power.c \
- ar5211_recv.c ar5211_reset.c ar5211_xmit.c
+SRCS= if_ath_drv.c
-#
-# AR5212 support; this covers all other pci/cardbus legacy parts.
-#
-.PATH: ${SRCTOP}/sys/dev/ath/ath_hal/ar5212
-SRCS+= ar5212_ani.c ar5212_attach.c ar5212_beacon.c ar5212_eeprom.c \
- ar5212_gpio.c ar5212_interrupts.c ar5212_keycache.c ar5212_misc.c \
- ar5212_phy.c ar5212_power.c ar5212_recv.c ar5212_reset.c \
- ar5212_rfgain.c ar5212_xmit.c
-# RF backends
-SRCS+= ar5111.c
-SRCS+= ar5112.c
-SRCS+= ar2413.c
-SRCS+= ar2425.c
-SRCS+= ar5413.c
-
-#
-# AR5416, AR9130, AR9160, AR9220, AR9280, AR9285, AR9287 support.
-
-# Note enabling this support requires defining AH_SUPPORT_AR5416
-# in opt_ah.h so the 11n tx/rx descriptor format is handled.
-#
-# NB: 9160 depends on 5416 but 5416 does not require 9160
-#
-# + 5416 (Owl)
-.PATH: ${SRCTOP}/sys/dev/ath/ath_hal/ar5416
-SRCS+= ah_eeprom_v14.c ah_eeprom_v4k.c \
- ar5416_ani.c ar5416_attach.c ar5416_beacon.c ar5416_btcoex.c \
- ar5416_cal.c ar5416_cal_iq.c ar5416_cal_adcgain.c ar5416_cal_adcdc.c \
- ar5416_eeprom.c ar5416_gpio.c ar5416_interrupts.c ar5416_keycache.c \
- ar5416_misc.c ar5416_phy.c ar5416_power.c ar5416_radar.c ar5416_spectral.c \
- ar5416_recv.c ar5416_reset.c ar5416_xmit.c
-
-# RF backend for 5416, 9130 and 9160
-SRCS+= ar2133.c
-
-# + AR9160 (Sowl)
-.PATH: ${SRCTOP}/sys/dev/ath/ath_hal/ar9001
-SRCS+= ar9160_attach.c
-
-# + AR9130 - (Sowl) - Embedded (AR913x SoC)
-#
-# This requires AH_SUPPORT_AR9130 in order to function as some
-# register values have shifted for this chipset. Definig this however
-# (currently) breaks non-AR9130 chipsets - since this is an embedded
-# chipset and no other radios are glued to it, this shouldn't pose a
-# problem.
-SRCS+= ar9130_attach.c ar9130_eeprom.c ar9130_phy.c
-
-# AR9002 series chips
-# + AR9220/AR9280 - Merlin
-.PATH: ${SRCTOP}/sys/dev/ath/ath_hal/ar9002
-SRCS+= ar9280.c ar9280_attach.c ar9280_olc.c
-
-# + AR9285 - Kite
-SRCS+= ar9285.c ar9285_reset.c ar9285_attach.c ar9285_cal.c ar9285_phy.c
-SRCS+= ar9285_diversity.c ar9285_btcoex.c
-
-# + AR9287 - Kiwi
-.PATH: ${SRCTOP}/sys/dev/ath/ath_hal
-SRCS+= ah_eeprom_9287.c
-.PATH: ${SRCTOP}/sys/dev/ath/ath_hal/ar9002
-SRCS+= ar9287.c ar9287_reset.c ar9287_attach.c ar9287_cal.c ar9287_olc.c
-
-# + AR9300 HAL
-.PATH: ${SRCTOP}/sys/contrib/dev/ath/ath_hal/ar9300
-SRCS+= ar9300_interrupts.c ar9300_radar.c ar9300_ani.c ar9300_keycache.c
-SRCS+= ar9300_radio.c ar9300_xmit.c ar9300_attach.c ar9300_mci.c ar9300_stub.c
-SRCS+= ar9300_xmit_ds.c ar9300_beacon.c ar9300_misc.c ar9300_recv.c
-SRCS+= ar9300_stub_funcs.c ar9300_eeprom.c ar9300_paprd.c ar9300_recv_ds.c
-SRCS+= ar9300_freebsd.c ar9300_phy.c ar9300_reset.c ar9300_gpio.c
-SRCS+= ar9300_power.c ar9300_timer.c ar9300_spectral.c
-
-# NB: rate control is bound to the driver by symbol names so only pick one
-.if ${ATH_RATE} == "sample"
-.PATH: ${SRCTOP}/sys/dev/ath/ath_rate/sample
-SRCS+= sample.c
-.elif ${ATH_RATE} == "onoe"
-.PATH: ${SRCTOP}/sys/dev/ath/ath_rate/onoe
-SRCS+= onoe.c
-.elif ${ATH_RATE} == "amrr"
-.PATH: ${SRCTOP}/sys/dev/ath/ath_rate/amrr
-SRCS+= amrr.c
-.endif
-
-# DFS
-.PATH: ${SRCTOP}/sys/dev/ath/ath_dfs/null
-SRCS+= dfs_null.c
+SRCS+= device_if.h bus_if.h pci_if.h opt_inet.h opt_ath.h opt_ah.h opt_wlan.h
CFLAGS+= -I. -I${SRCTOP}/sys/dev/ath -I${SRCTOP}/sys/dev/ath/ath_hal
CFLAGS+= -I. -I${SRCTOP}/sys/contrib/dev/ath/ath_hal/
-.if !defined(KERNBUILDDIR)
-opt_ah.h:
- echo '#define AH_SUPPORT_AR5416 1' > $@
-.endif
-
.include <bsd.kmod.mk>
-
-CWARNFLAGS.ah_regdomain.c= ${NO_WSHIFT_COUNT_NEGATIVE} ${NO_WSHIFT_COUNT_OVERFLOW}
-# XXX Work around clang warnings, until maintainer approves fix.
-CWARNFLAGS.if_ath.c= ${NO_WSOMETIMES_UNINITIALIZED}
-
-# AR9300 HAL build overrides, as there's still some code to tidy up
-CWARNFLAGS.ar9300_eeprom.c= ${NO_WCONSTANT_CONVERSION}
-CWARNFLAGS.ar9300_reset.c= ${NO_WSOMETIMES_UNINITIALIZED} -Wno-unused-function
diff --git a/sys/modules/ath_dfs/Makefile b/sys/modules/ath_dfs/Makefile
new file mode 100644
index 0000000000000..3e561eddf607d
--- /dev/null
+++ b/sys/modules/ath_dfs/Makefile
@@ -0,0 +1,47 @@
+#
+# Copyright (c) 2002-2008 Sam Leffler, Errno Consulting
+# 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$
+#
+
+.PATH: ${SRCTOP}/sys/dev/ath
+
+KMOD= ath_dfs
+
+SRCS= if_ath_dfs.c
+
+# DFS
+.PATH: ${SRCTOP}/sys/dev/ath/ath_dfs/null
+SRCS+= dfs_null.c
+
+SRCS+= device_if.h bus_if.h pci_if.h opt_inet.h opt_ath.h opt_ah.h opt_wlan.h
+
+CFLAGS+= -I. -I${SRCTOP}/sys/dev/ath -I${SRCTOP}/sys/dev/ath/ath_hal
+CFLAGS+= -I. -I${SRCTOP}/sys/contrib/dev/ath/ath_hal/
+
+.include <bsd.kmod.mk>
diff --git a/sys/modules/ath_hal/Makefile b/sys/modules/ath_hal/Makefile
new file mode 100644
index 0000000000000..6b604c6e9dbbc
--- /dev/null
+++ b/sys/modules/ath_hal/Makefile
@@ -0,0 +1,47 @@
+#
+# Copyright (c) 2002-2008 Sam Leffler, Errno Consulting
+# 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$
+#
+
+.PATH: ${SRCTOP}/sys/dev/ath
+.PATH: ${SRCTOP}/sys/dev/ath/ath_hal
+
+KMOD= ath_hal
+
+SRCS= ah_osdep.c ah.c ah_regdomain.c
+SRCS+= ah_eeprom_v1.c ah_eeprom_v3.c ah_eeprom_v14.c ah_eeprom_v4k.c
+
+SRCS+= device_if.h bus_if.h pci_if.h opt_inet.h opt_ath.h opt_ah.h opt_wlan.h
+
+CFLAGS+= -I. -I${SRCTOP}/sys/dev/ath -I${SRCTOP}/sys/dev/ath/ath_hal
+CFLAGS+= -I. -I${SRCTOP}/sys/contrib/dev/ath/ath_hal/
+
+.include <bsd.kmod.mk>
+
+CWARNFLAGS.ah_regdomain.c= ${NO_WSHIFT_COUNT_NEGATIVE} ${NO_WSHIFT_COUNT_OVERFLOW}
diff --git a/sys/modules/ath_hal_ar5210/Makefile b/sys/modules/ath_hal_ar5210/Makefile
new file mode 100644
index 0000000000000..9dac60cd96fed
--- /dev/null
+++ b/sys/modules/ath_hal_ar5210/Makefile
@@ -0,0 +1,53 @@
+#
+# Copyright (c) 2002-2008 Sam Leffler, Errno Consulting
+# 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$
+#
+
+.PATH: ${SRCTOP}/sys/dev/ath
+
+KMOD= ath_hal_ar5210
+
+# FreeBSD module loading pieces
+.PATH: ${SRCTOP}/sys/dev/ath/
+SRCS= ah_osdep_ar5210.c
+
+#
+# AR5210 support; these are first generation 11a-only devices.
+#
+.PATH: ${SRCTOP}/sys/dev/ath/ath_hal/ar5210
+SRCS+= ar5210_attach.c ar5210_beacon.c ar5210_interrupts.c \
+ ar5210_keycache.c ar5210_misc.c ar5210_phy.c ar5210_power.c \
+ ar5210_recv.c ar5210_reset.c ar5210_xmit.c
+
+SRCS+= device_if.h bus_if.h pci_if.h opt_inet.h opt_ath.h opt_ah.h opt_wlan.h
+
+CFLAGS+= -I. -I${SRCTOP}/sys/dev/ath -I${SRCTOP}/sys/dev/ath/ath_hal
+CFLAGS+= -I. -I${SRCTOP}/sys/contrib/dev/ath/ath_hal/
+
+.include <bsd.kmod.mk>
diff --git a/sys/modules/ath_hal_ar5211/Makefile b/sys/modules/ath_hal_ar5211/Makefile
new file mode 100644
index 0000000000000..c922828e212bf
--- /dev/null
+++ b/sys/modules/ath_hal_ar5211/Makefile
@@ -0,0 +1,55 @@
+#
+# Copyright (c) 2002-2008 Sam Leffler, Errno Consulting
+# 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$
+#
+
+.PATH: ${SRCTOP}/sys/dev/ath
+.PATH: ${SRCTOP}/sys/dev/ath/ath_hal
+
+KMOD= ath_hal_ar5211
+
+# FreeBSD module loading pieces
+.PATH: ${SRCTOP}/sys/dev/ath/
+SRCS= ah_osdep_ar5211.c
+
+#
+# AR5211 support; these are second generation 11b/g/a devices
+# (but 11g was OFDM only and is not supported).
+#
+.PATH: ${SRCTOP}/sys/dev/ath/ath_hal/ar5211
+SRCS+= ar5211_attach.c ar5211_beacon.c ar5211_interrupts.c \
+ ar5211_keycache.c ar5211_misc.c ar5211_phy.c ar5211_power.c \
+ ar5211_recv.c ar5211_reset.c ar5211_xmit.c
+
+SRCS+= device_if.h bus_if.h pci_if.h opt_inet.h opt_ath.h opt_ah.h opt_wlan.h
+
+CFLAGS+= -I. -I${SRCTOP}/sys/dev/ath -I${SRCTOP}/sys/dev/ath/ath_hal
+CFLAGS+= -I. -I${SRCTOP}/sys/contrib/dev/ath/ath_hal/
+
+.include <bsd.kmod.mk>
diff --git a/sys/modules/ath_hal_ar5212/Makefile b/sys/modules/ath_hal_ar5212/Makefile
new file mode 100644
index 0000000000000..c9cc1ae5f0673
--- /dev/null
+++ b/sys/modules/ath_hal_ar5212/Makefile
@@ -0,0 +1,60 @@
+#
+# Copyright (c) 2002-2008 Sam Leffler, Errno Consulting
+# 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$
+#
+
+.PATH: ${SRCTOP}/sys/dev/ath
+.PATH: ${SRCTOP}/sys/dev/ath/ath_hal
+
+KMOD= ath_hal_ar5212
+
+# FreeBSD module loading pieces
+.PATH: ${SRCTOP}/sys/dev/ath/
+SRCS= ah_osdep_ar5212.c
+
+#
+# AR5212 support; this covers almost all other pci/cardbus legacy parts.
+#
+.PATH: ${SRCTOP}/sys/dev/ath/ath_hal/ar5212
+SRCS+= ar5212_ani.c ar5212_attach.c ar5212_beacon.c ar5212_eeprom.c \
+ ar5212_gpio.c ar5212_interrupts.c ar5212_keycache.c ar5212_misc.c \
+ ar5212_phy.c ar5212_power.c ar5212_recv.c ar5212_reset.c \
+ ar5212_rfgain.c ar5212_xmit.c
+SRCS+= device_if.h bus_if.h pci_if.h opt_inet.h opt_ath.h opt_ah.h opt_wlan.h
+# RF backends
+SRCS+= ar5111.c
+SRCS+= ar5112.c
+SRCS+= ar2413.c
+SRCS+= ar2425.c
+SRCS+= ar5413.c
+
+CFLAGS+= -I. -I${SRCTOP}/sys/dev/ath -I${SRCTOP}/sys/dev/ath/ath_hal
+CFLAGS+= -I. -I${SRCTOP}/sys/contrib/dev/ath/ath_hal/
+
+.include <bsd.kmod.mk>
diff --git a/sys/modules/ath_hal_ar5416/Makefile b/sys/modules/ath_hal_ar5416/Makefile
new file mode 100644
index 0000000000000..b687827378935
--- /dev/null
+++ b/sys/modules/ath_hal_ar5416/Makefile
@@ -0,0 +1,94 @@
+#
+# Copyright (c) 2002-2008 Sam Leffler, Errno Consulting
+# 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$
+#
+
+.PATH: ${SRCTOP}/sys/dev/ath
+.PATH: ${SRCTOP}/sys/dev/ath/ath_hal
+
+KMOD= ath_hal_ar5416
+
+# FreeBSD module loading pieces
+.PATH: ${SRCTOP}/sys/dev/ath/
+SRCS= ah_osdep_ar5416.c
+
+#
+# AR5416, AR9130, AR9160, AR9220, AR9280, AR9285, AR9287 support.
+
+# Note enabling this support requires defining AH_SUPPORT_AR5416
+# in opt_ah.h so the 11n tx/rx descriptor format is handled.
+#
+# NB: 9160 depends on 5416 but 5416 does not require 9160
+#
+# + 5416 (Owl)
+.PATH: ${SRCTOP}/sys/dev/ath/ath_hal/ar5416
+
+SRCS+= ar5416_ani.c ar5416_attach.c ar5416_beacon.c ar5416_btcoex.c \
+ ar5416_cal.c ar5416_cal_iq.c ar5416_cal_adcgain.c ar5416_cal_adcdc.c \
+ ar5416_eeprom.c ar5416_gpio.c ar5416_interrupts.c ar5416_keycache.c \
+ ar5416_misc.c ar5416_phy.c ar5416_power.c ar5416_radar.c ar5416_spectral.c \
+ ar5416_recv.c ar5416_reset.c ar5416_xmit.c
+
+SRCS+= device_if.h bus_if.h pci_if.h opt_inet.h opt_ath.h opt_ah.h opt_wlan.h
+
+# RF backend for 5416, 9130 and 9160
+SRCS+= ar2133.c
+
+# + AR9160 (Sowl)
+.PATH: ${SRCTOP}/sys/dev/ath/ath_hal/ar9001
+SRCS+= ar9160_attach.c
+
+# + AR9130 - (Sowl) - Embedded (AR913x SoC)
+#
+# This requires AH_SUPPORT_AR9130 in order to function as some
+# register values have shifted for this chipset. Definig this however
+# (currently) breaks non-AR9130 chipsets - since this is an embedded
+# chipset and no other radios are glued to it, this shouldn't pose a
+# problem.
+SRCS+= ar9130_attach.c ar9130_eeprom.c ar9130_phy.c
+
+# AR9002 series chips
+# + AR9220/AR9280 - Merlin
+.PATH: ${SRCTOP}/sys/dev/ath/ath_hal/ar9002
+SRCS+= ar9280.c ar9280_attach.c ar9280_olc.c
+
+# + AR9285 - Kite
+SRCS+= ar9285.c ar9285_reset.c ar9285_attach.c ar9285_cal.c ar9285_phy.c
+SRCS+= ar9285_diversity.c ar9285_btcoex.c
+
+# + AR9287 - Kiwi
+.PATH: ${SRCTOP}/sys/dev/ath/ath_hal
+SRCS+= ah_eeprom_9287.c
+.PATH: ${SRCTOP}/sys/dev/ath/ath_hal/ar9002
+SRCS+= ar9287.c ar9287_reset.c ar9287_attach.c ar9287_cal.c ar9287_olc.c
+
+CFLAGS+= -I. -I${SRCTOP}/sys/dev/ath -I${SRCTOP}/sys/dev/ath/ath_hal
+CFLAGS+= -I. -I${SRCTOP}/sys/contrib/dev/ath/ath_hal/
+
+.include <bsd.kmod.mk>
diff --git a/sys/modules/ath_hal_ar9300/Makefile b/sys/modules/ath_hal_ar9300/Makefile
new file mode 100644
index 0000000000000..c8c5a9c33c6fb
--- /dev/null
+++ b/sys/modules/ath_hal_ar9300/Makefile
@@ -0,0 +1,59 @@
+#
+# Copyright (c) 2002-2008 Sam Leffler, Errno Consulting
+# 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$
+#
+
+.PATH: ${SRCTOP}/sys/dev/ath
+.PATH: ${SRCTOP}/sys/dev/ath/ath_hal
+
+KMOD= ath_hal_ar9300
+
+# FreeBSD module loading pieces
+.PATH: ${SRCTOP}/sys/dev/ath/
+SRCS= ah_osdep_ar9300.c
+
+# + AR9300 HAL
+.PATH: ${SRCTOP}/sys/contrib/dev/ath/ath_hal/ar9300
+SRCS+= ar9300_interrupts.c ar9300_radar.c ar9300_ani.c ar9300_keycache.c
+SRCS+= ar9300_radio.c ar9300_xmit.c ar9300_attach.c ar9300_mci.c ar9300_stub.c
+SRCS+= ar9300_xmit_ds.c ar9300_beacon.c ar9300_misc.c ar9300_recv.c
+SRCS+= ar9300_stub_funcs.c ar9300_eeprom.c ar9300_paprd.c ar9300_recv_ds.c
+SRCS+= ar9300_freebsd.c ar9300_phy.c ar9300_reset.c ar9300_gpio.c
+SRCS+= ar9300_power.c ar9300_timer.c ar9300_spectral.c
+
+SRCS+= device_if.h bus_if.h pci_if.h opt_inet.h opt_ath.h opt_ah.h opt_wlan.h
+
+CFLAGS+= -I. -I${SRCTOP}/sys/dev/ath -I${SRCTOP}/sys/dev/ath/ath_hal
+CFLAGS+= -I. -I${SRCTOP}/sys/contrib/dev/ath/ath_hal/
+
+.include <bsd.kmod.mk>
+
+# AR9300 HAL build overrides, as there's still some code to tidy up
+CWARNFLAGS.ar9300_eeprom.c= ${NO_WCONSTANT_CONVERSION}
+CWARNFLAGS.ar9300_reset.c= ${NO_WSOMETIMES_UNINITIALIZED} -Wno-unused-function
diff --git a/sys/modules/ath_main/Makefile b/sys/modules/ath_main/Makefile
new file mode 100644
index 0000000000000..99cd18d5b2650
--- /dev/null
+++ b/sys/modules/ath_main/Makefile
@@ -0,0 +1,51 @@
+#
+# Copyright (c) 2002-2008 Sam Leffler, Errno Consulting
+# 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$
+#
+
+ATH_RATE?= sample # tx rate control algorithm
+
+.PATH: ${SRCTOP}/sys/dev/ath
+.PATH: ${SRCTOP}/sys/dev/ath/ath_hal
+
+KMOD= ath_main
+SRCS= if_ath.c if_ath_alq.c if_ath_debug.c if_ath_keycache.c if_ath_sysctl.c
+SRCS+= if_ath_tx.c if_ath_tx_ht.c if_ath_led.c if_ath_rx.c if_ath_tdma.c
+SRCS+= if_ath_beacon.c if_ath_rx_edma.c if_ath_tx_edma.c if_ath_spectral.c
+SRCS+= if_ath_btcoex.c if_ath_btcoex_mci.c if_ath_lna_div.c if_ath_ioctl.c if_ath_descdma.c
+
+SRCS+= device_if.h bus_if.h pci_if.h opt_inet.h opt_ath.h opt_ah.h opt_wlan.h
+
+CFLAGS+= -I. -I${SRCTOP}/sys/dev/ath -I${SRCTOP}/sys/dev/ath/ath_hal
+CFLAGS+= -I. -I${SRCTOP}/sys/contrib/dev/ath/ath_hal/
+
+.include <bsd.kmod.mk>
+
+# XXX Work around clang warnings, until maintainer approves fix.
+CWARNFLAGS.if_ath.c= ${NO_WSOMETIMES_UNINITIALIZED}
diff --git a/sys/modules/ath_rate/Makefile b/sys/modules/ath_rate/Makefile
new file mode 100644
index 0000000000000..2b36ecf948c0a
--- /dev/null
+++ b/sys/modules/ath_rate/Makefile
@@ -0,0 +1,57 @@
+#
+# Copyright (c) 2002-2008 Sam Leffler, Errno Consulting
+# 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$
+#
+
+ATH_RATE?= sample # tx rate control algorithm
+
+.PATH: ${SRCTOP}/sys/dev/ath
+
+KMOD= ath_rate
+
+SRCS= if_ath_rate.c
+
+# NB: rate control is bound to the driver by symbol names so only pick one
+.if ${ATH_RATE} == "sample"
+.PATH: ${SRCTOP}/sys/dev/ath/ath_rate/sample
+SRCS+= sample.c
+.elif ${ATH_RATE} == "onoe"
+.PATH: ${SRCTOP}/sys/dev/ath/ath_rate/onoe
+SRCS+= onoe.c
+.elif ${ATH_RATE} == "amrr"
+.PATH: ${SRCTOP}/sys/dev/ath/ath_rate/amrr
+SRCS+= amrr.c
+.endif
+
+SRCS+= device_if.h bus_if.h pci_if.h opt_inet.h opt_ath.h opt_ah.h opt_wlan.h
+
+CFLAGS+= -I. -I${SRCTOP}/sys/dev/ath -I${SRCTOP}/sys/dev/ath/ath_hal
+CFLAGS+= -I. -I${SRCTOP}/sys/contrib/dev/ath/ath_hal/
+
+.include <bsd.kmod.mk>