From 41059135ce931c0f1014a999ffabc6bc470ce856 Mon Sep 17 00:00:00 2001 From: Adrian Chadd Date: Thu, 25 May 2017 04:18:46 +0000 Subject: [PATCH] [ath] [ath_hal] (etc, etc) - begin the task of re-modularising the HAL. In the deep past, when this code compiled as a binary module, ath_hal built as a module. This allowed custom, smaller HAL modules to be built. This was especially beneficial for small embedded platforms where you didn't require /everything/ just to run. However, sometime around the HAL opening fanfare, the HAL landed here as one big driver+HAL thing, and a lot of the (dirty) infrastructure (ie, #ifdef AH_SUPPORT_XXX) to build specific subsets of the HAL went away. This was retained in sys/conf/files as "ath_hal_XXX" but it wasn't really floated up to the modules themselves. I'm now in a position where for the reaaaaaly embedded boards (both the really old and the last couple generation of QCA MIPS boards) having a cut down HAL module and driver loaded at runtime is /actually/ beneficial. This reduces the kernel size down by quite a bit. The MIPS modules look like this: adrian@gertrude:~/work/freebsd/head-embedded/src % ls -l ../root/mips_ap/boot/kernel.CARAMBOLA2/ath*ko -r-xr-xr-x 1 adrian adrian 5076 May 23 23:45 ../root/mips_ap/boot/kernel.CARAMBOLA2/ath_dfs.ko -r-xr-xr-x 1 adrian adrian 100588 May 23 23:45 ../root/mips_ap/boot/kernel.CARAMBOLA2/ath_hal.ko -r-xr-xr-x 1 adrian adrian 627324 May 23 23:45 ../root/mips_ap/boot/kernel.CARAMBOLA2/ath_hal_ar9300.ko -r-xr-xr-x 1 adrian adrian 314588 May 23 23:45 ../root/mips_ap/boot/kernel.CARAMBOLA2/ath_main.ko -r-xr-xr-x 1 adrian adrian 23472 May 23 23:45 ../root/mips_ap/boot/kernel.CARAMBOLA2/ath_rate.ko And the x86 versions, like this: root@gertrude:/home/adrian # ls -l /boot/kernel/ath*ko -r-xr-xr-x 1 root wheel 36632 May 24 18:32 /boot/kernel/ath_dfs.ko -r-xr-xr-x 1 root wheel 134440 May 24 18:32 /boot/kernel/ath_hal.ko -r-xr-xr-x 1 root wheel 82320 May 24 18:32 /boot/kernel/ath_hal_ar5210.ko -r-xr-xr-x 1 root wheel 104976 May 24 18:32 /boot/kernel/ath_hal_ar5211.ko -r-xr-xr-x 1 root wheel 236144 May 24 18:32 /boot/kernel/ath_hal_ar5212.ko -r-xr-xr-x 1 root wheel 336104 May 24 18:32 /boot/kernel/ath_hal_ar5416.ko -r-xr-xr-x 1 root wheel 598336 May 24 18:32 /boot/kernel/ath_hal_ar9300.ko -r-xr-xr-x 1 root wheel 406144 May 24 18:32 /boot/kernel/ath_main.ko -r-xr-xr-x 1 root wheel 55352 May 24 18:32 /boot/kernel/ath_rate.ko .. so you can see, not building the whole HAL can save quite a bit. For example, if you don't need AR9300 support, you can actually avoid wasting half a megabyte of RAM. On embedded routers this is quite a big deal. The AR9300 HAL can be later further shrunk because, hilariously, it indeed supports AH_SUPPORT_ for optionally adding chipset support. (I'll chase that down later as it's quite a big savings if you're only building for a single embedded target.) So: * Create a very hackish way to load/unload HAL modules * Create module metadata for each HAL subtype - ah_osdep_arXXXX.c * Create module metadata for ath_rate and ath_dfs (bluetooth is currently just built as part of it) * .. yes, this means we could actually build multiple rate control modules and pick one at load time, but I'd rather just glue this into net80211's rate control code. Oh well, baby steps. * Main driver is now "ath_main" * Create an "if_ath" module that does what the ye olde one did - load PCI glue, main driver, HAL and all child modules. In this way, if you have "if_ath_load=YES" in /boot/modules.conf it will load everything the old way and stuff should still work. * For module autoloading purposes, I actually /did/ fix up the name of the modules in if_ath_pci and if_ath_ahb. If you want to selectively load things (eg on ye cheape ARM/MIPS platforms where RAM is at a premium) you should: * load ath_hal * load the chip modules in question * load ath_rate, ath_dfs * load ath_main * load if_ath_pci and/or if_ath_ahb depending upon your particular bus bind type - this is where probe/attach is done. TODO: * AR5312 module and associated pieces - yes, we have the SoC side support now so the wifi support would be good to "round things out"; * Just nuke AH_SUPPORT_AR5416 for now and always bloat the packet structures; this'll simplify other things. * Should add a simple refcnt thing to the HAL RF/chip modules so you can't unload them whilst you're using them. * Manpage updates, UPDATING if appropriate, etc. --- sys/dev/ath/ah_osdep.c | 29 ++++++ sys/dev/ath/ah_osdep_ar5210.c | 74 +++++++++++++++ sys/dev/ath/ah_osdep_ar5211.c | 74 +++++++++++++++ sys/dev/ath/ah_osdep_ar5212.c | 95 ++++++++++++++++++++ sys/dev/ath/ah_osdep_ar5416.c | 103 +++++++++++++++++++++ sys/dev/ath/ah_osdep_ar9300.c | 74 +++++++++++++++ sys/dev/ath/ath_dfs/null/dfs_null.c | 4 +- sys/dev/ath/ath_hal/ah.c | 75 ++++++++++++++++ sys/dev/ath/ath_hal/ah_internal.h | 29 +++++- sys/dev/ath/ath_rate/sample/sample.c | 4 + sys/dev/ath/if_ath.c | 9 +- sys/dev/ath/if_ath_ahb.c | 11 +-- sys/dev/ath/if_ath_dfs.c | 74 +++++++++++++++ sys/dev/ath/if_ath_drv.c | 89 ++++++++++++++++++ sys/dev/ath/if_ath_pci.c | 9 +- sys/dev/ath/if_ath_rate.c | 74 +++++++++++++++ sys/modules/Makefile | 9 ++ sys/modules/ath/Makefile | 129 +-------------------------- sys/modules/ath_dfs/Makefile | 47 ++++++++++ sys/modules/ath_hal/Makefile | 47 ++++++++++ sys/modules/ath_hal_ar5210/Makefile | 53 +++++++++++ sys/modules/ath_hal_ar5211/Makefile | 55 ++++++++++++ sys/modules/ath_hal_ar5212/Makefile | 60 +++++++++++++ sys/modules/ath_hal_ar5416/Makefile | 94 +++++++++++++++++++ sys/modules/ath_hal_ar9300/Makefile | 59 ++++++++++++ sys/modules/ath_main/Makefile | 51 +++++++++++ sys/modules/ath_rate/Makefile | 57 ++++++++++++ 27 files changed, 1343 insertions(+), 145 deletions(-) create mode 100644 sys/dev/ath/ah_osdep_ar5210.c create mode 100644 sys/dev/ath/ah_osdep_ar5211.c create mode 100644 sys/dev/ath/ah_osdep_ar5212.c create mode 100644 sys/dev/ath/ah_osdep_ar5416.c create mode 100644 sys/dev/ath/ah_osdep_ar9300.c create mode 100644 sys/dev/ath/if_ath_dfs.c create mode 100644 sys/dev/ath/if_ath_drv.c create mode 100644 sys/dev/ath/if_ath_rate.c create mode 100644 sys/modules/ath_dfs/Makefile create mode 100644 sys/modules/ath_hal/Makefile create mode 100644 sys/modules/ath_hal_ar5210/Makefile create mode 100644 sys/modules/ath_hal_ar5211/Makefile create mode 100644 sys/modules/ath_hal_ar5212/Makefile create mode 100644 sys/modules/ath_hal_ar5416/Makefile create mode 100644 sys/modules/ath_hal_ar9300/Makefile create mode 100644 sys/modules/ath_main/Makefile create mode 100644 sys/modules/ath_rate/Makefile diff --git a/sys/dev/ath/ah_osdep.c b/sys/dev/ath/ah_osdep.c index 3d633a44adda..ecd928c59e88 100644 --- a/sys/dev/ath/ah_osdep.c +++ b/sys/dev/ath/ah_osdep.c @@ -41,6 +41,7 @@ #include #include #include +#include #include @@ -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 000000000000..905befe9ca95 --- /dev/null +++ b/sys/dev/ath/ah_osdep_ar5210.c @@ -0,0 +1,74 @@ +/*- + * Copyright 2017 Adrian Chadd . + * + * 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 +#include +#include +#include +#include +#include +#include + +#include +#include + +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 000000000000..92400965e55b --- /dev/null +++ b/sys/dev/ath/ah_osdep_ar5211.c @@ -0,0 +1,74 @@ +/*- + * Copyright 2017 Adrian Chadd . + * + * 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 +#include +#include +#include +#include +#include +#include + +#include +#include + +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 000000000000..3bc21ef803ec --- /dev/null +++ b/sys/dev/ath/ah_osdep_ar5212.c @@ -0,0 +1,95 @@ +/*- + * Copyright 2017 Adrian Chadd . + * + * 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 +#include +#include +#include +#include +#include +#include + +#include +#include + +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 000000000000..a735838068b6 --- /dev/null +++ b/sys/dev/ath/ah_osdep_ar5416.c @@ -0,0 +1,103 @@ +/*- + * Copyright 2017 Adrian Chadd . + * + * 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 +#include +#include +#include +#include +#include +#include + +#include +#include + +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 000000000000..f481d7ea2a2d --- /dev/null +++ b/sys/dev/ath/ah_osdep_ar9300.c @@ -0,0 +1,74 @@ +/*- + * Copyright 2017 Adrian Chadd . + * + * 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 +#include +#include +#include +#include +#include +#include + +#include +#include + +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 e31a61d85758..6f9ed41d81a9 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 11d0ca314903..70a489cf0d31 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 0d650ded7587..ec15b46c8aad 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 +#include /* 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 815c68b7a245..23f24f05e869 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 31f2b9dcc564..87e97109db76 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 09a72346f48b..137d8fca5df6 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 000000000000..2078f154981c --- /dev/null +++ b/sys/dev/ath/if_ath_dfs.c @@ -0,0 +1,74 @@ +/*- + * Copyright (c) 2017 Adrian Chadd . + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +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 000000000000..cc7b9162fb2c --- /dev/null +++ b/sys/dev/ath/if_ath_drv.c @@ -0,0 +1,89 @@ +/*- + * Copyright (c) 2017 Adrian Chadd + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * 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 88cbaffb1f5c..1ebcf074d552 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 000000000000..8eb7a518c2a4 --- /dev/null +++ b/sys/dev/ath/if_ath_rate.c @@ -0,0 +1,74 @@ +/*- + * Copyright (c) 2017 Adrian Chadd . + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +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 09ec8a702ec4..1897bee3ca1b 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 9bfc29c15f5e..cf46550b5f80 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= if_ath_drv.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 - -# -# 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 - 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 - -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 000000000000..3e561eddf607 --- /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 diff --git a/sys/modules/ath_hal/Makefile b/sys/modules/ath_hal/Makefile new file mode 100644 index 000000000000..6b604c6e9dbb --- /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 + +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 000000000000..9dac60cd96fe --- /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 diff --git a/sys/modules/ath_hal_ar5211/Makefile b/sys/modules/ath_hal_ar5211/Makefile new file mode 100644 index 000000000000..c922828e212b --- /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 diff --git a/sys/modules/ath_hal_ar5212/Makefile b/sys/modules/ath_hal_ar5212/Makefile new file mode 100644 index 000000000000..c9cc1ae5f067 --- /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 diff --git a/sys/modules/ath_hal_ar5416/Makefile b/sys/modules/ath_hal_ar5416/Makefile new file mode 100644 index 000000000000..b68782737893 --- /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 diff --git a/sys/modules/ath_hal_ar9300/Makefile b/sys/modules/ath_hal_ar9300/Makefile new file mode 100644 index 000000000000..c8c5a9c33c6f --- /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 + +# 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 000000000000..99cd18d5b265 --- /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 + +# 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 000000000000..2b36ecf948c0 --- /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