From: Christian Lamparter Date: Tue, 25 Aug 2015 21:21:21 +0000 (+0200) Subject: Merge branch 'master' into radar X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=ed51f317816e1fe0dc13ef356d9a9a07056d06b0;hp=1739e9d7c5d581c15d1ae331d83352f8998a6a83;p=carl9170fw.git Merge branch 'master' into radar --- diff --git a/COPYRIGHT b/COPYRIGHT index b1d3e77..d64b7ea 100644 --- a/COPYRIGHT +++ b/COPYRIGHT @@ -15,5 +15,4 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along -with this program; if not, write to the Free Software Foundation, Inc., -51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +with this program; If not, see . diff --git a/README b/README deleted file mode 100644 index 10f8e94..0000000 --- a/README +++ /dev/null @@ -1,39 +0,0 @@ -Community AR9170 Linux firmware ------------------------ - -This is the firmware for the Atheros ar9170 802.11n devices. - -To build the firmware you will need an SH-2 toolchain. -You can build your own toolchain: - -make -C toolchain - -but be aware that this will take some time and requires -about 2.4 GiB disk space. - -The resulting firmware, carl9170.fw, can be used only -with the carl9170 Linux driver. - -After getting a toolchain, you will need to get more -tools & libs: - - * gcc 4.7+ - - * gperf, bison/flex - - * cmake 2.8.4+ - -afterwards, simply execute: - -autogen.sh - -to start the configuration and build process. - -if you want to "install" your own firmware, you can either -do this manually, or by executing: - -autogen.sh install - -This will place a copy with the right filename [adds API rev] -into /lib/firmware/[the default path on most Distributions]. - diff --git a/README.md b/README.md new file mode 100644 index 0000000..e5c95ad --- /dev/null +++ b/README.md @@ -0,0 +1,56 @@ +# Community AR9170 Linux firmware + +## Introduction + +This is the firmware for the Atheros ar9170 802.11n devices. +The firmware, carl9170.fw, can be used with the carl9170 Linux +driver or the tools supplied in the repository. + +## Build + +### Build Toolchain + +To build the firmware you will need an SH-2 toolchain. +You can use the makefile in this repository to build +your own toolchain: + +`# make -C toolchain` + +but be aware that this will take some time and requires +about 3-4 GiB disk space. + +### Build Firmware Image + +The firmware configuration and build process requires the following +tools and libraries: + + * gcc 4.8 + + * gperf, bison/flex + + * cmake 2.8.4+ + +to start the configuration, run: + +`# autogen.sh` + +The configuration is based on the Linux's KConfig utility CLI. +For each configurable option, a prompt will appear. To choose +the default/previous option simply hit ``-key on your +keyboard. + +### Install Firmware + +if you want to "install" your own firmware, you can either +do this manually, or by executing: + +`# autogen.sh install` + +This will place a copy with the right filename [adds API rev] +into /lib/firmware/[the default path on most Distributions]. + +## Contact + +If you have any questions, reports or patches, you should write +to and include "carl9170" in +the subject line. diff --git a/carlfw/CMakeLists.txt b/carlfw/CMakeLists.txt index cacccd9..1ca0961 100644 --- a/carlfw/CMakeLists.txt +++ b/carlfw/CMakeLists.txt @@ -42,21 +42,21 @@ set_target_properties(carl9170.elf PROPERTIES LINK_FLAGS "${CARLFW_CFLAGS} -Wl,- add_custom_target(firmware ALL) add_custom_command( - SOURCE carl9170.elf + DEPENDS carl9170.elf COMMAND ${OBJCOPY} ARGS --strip-unneeded -O binary -R .sram -R .eeprom -R .fwdsc carl9170.elf carl9170.bin TARGET firmware OUTPUTS carl9170.bin) add_custom_command( - SOURCE carl9170.elf + DEPENDS carl9170.elf COMMAND ${OBJCOPY} ARGS --strip-unneeded -O binary -j .fwdsc carl9170.elf carl9170.dsc TARGET firmware OUTPUTS carl9170.dsc) add_custom_command( - SOURCE firmware + DEPENDS firmware TARGET firmware COMMAND cat ARGS "carl9170.bin" "carl9170.dsc" > "carl9170.fw" diff --git a/carlfw/Kconfig b/carlfw/Kconfig index 1612973..8583903 100644 --- a/carlfw/Kconfig +++ b/carlfw/Kconfig @@ -148,9 +148,19 @@ config CARL9170FW_NOISY_MAC_RESET prompt "Notify MAC RESET events" depends on CARL9170FW_FW_MAC_RESET +config CARL9170FW_80MHZ_CLOCK + def_bool n + prompt "Allow 80/88MHz clock for HT40" + depends on CARL9170FW_EXPERIMENTAL + ---help--- + The SoC can run up to 80/88MHz in HT40 mode. This improves + throughput and timing accuracy over the 40/44MHz clock. + However some devices don't have heat shields and they with + this option enabled, they become unstable under load. + config CARL9170FW_BROKEN_FEATURES def_bool n - prompt "Broken Featurs" + prompt "Broken Features" config CARL9170FW_DEBUG def_bool n diff --git a/carlfw/include/cam.h b/carlfw/include/cam.h index 33afe03..fa65130 100644 --- a/carlfw/include/cam.h +++ b/carlfw/include/cam.h @@ -19,8 +19,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * with this program; If not, see . */ #ifndef __CARL9170FW_CAM_H diff --git a/carlfw/include/carl9170.h b/carlfw/include/carl9170.h index d12bb98..d17b896 100644 --- a/carlfw/include/carl9170.h +++ b/carlfw/include/carl9170.h @@ -16,8 +16,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * with this program; If not, see . */ #ifndef __CARL9170FW_CARL9170_H diff --git a/carlfw/include/cmd.h b/carlfw/include/cmd.h index 54dd350..f8a2605 100644 --- a/carlfw/include/cmd.h +++ b/carlfw/include/cmd.h @@ -19,8 +19,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * with this program; If not, see . */ #ifndef __CARL9170FW_CMD_H diff --git a/carlfw/include/config.h b/carlfw/include/config.h index e7c358d..ccaf5f4 100644 --- a/carlfw/include/config.h +++ b/carlfw/include/config.h @@ -10,8 +10,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * with this program; If not, see . */ #include "generated/autoconf.h" diff --git a/carlfw/include/dma.h b/carlfw/include/dma.h index 7ecdfb9..477c2a2 100644 --- a/carlfw/include/dma.h +++ b/carlfw/include/dma.h @@ -19,8 +19,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * with this program; If not, see . */ #ifndef __CARL9170FW_DMA_H diff --git a/carlfw/include/fwdsc.h b/carlfw/include/fwdsc.h index 2e1d1dd..ce9ae8f 100644 --- a/carlfw/include/fwdsc.h +++ b/carlfw/include/fwdsc.h @@ -16,8 +16,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * with this program; If not, see . */ #ifndef __CARL9170FW_FWDSC_H diff --git a/carlfw/include/gpio.h b/carlfw/include/gpio.h index 97c1927..a9c0b88 100644 --- a/carlfw/include/gpio.h +++ b/carlfw/include/gpio.h @@ -16,8 +16,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * with this program; If not, see . */ #ifndef __CARL9170FW_GPIO_H diff --git a/carlfw/include/hostif.h b/carlfw/include/hostif.h index 8f9f139..6bda478 100644 --- a/carlfw/include/hostif.h +++ b/carlfw/include/hostif.h @@ -19,8 +19,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * with this program; If not, see . */ #ifndef __CARL9170FW_HOSTIF_H diff --git a/carlfw/include/io.h b/carlfw/include/io.h index 4ccdc6e..d480594 100644 --- a/carlfw/include/io.h +++ b/carlfw/include/io.h @@ -10,8 +10,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * with this program; If not, see . */ #ifndef __CARL9170FW_IO_H diff --git a/carlfw/include/printf.h b/carlfw/include/printf.h index dd4559e..2678cfc 100644 --- a/carlfw/include/printf.h +++ b/carlfw/include/printf.h @@ -19,8 +19,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * with this program; If not, see . */ #ifndef __CARL9170FW_PRINTF_H diff --git a/carlfw/include/rf.h b/carlfw/include/rf.h index 4419bcb..102d5de 100644 --- a/carlfw/include/rf.h +++ b/carlfw/include/rf.h @@ -19,8 +19,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * with this program; If not, see . */ #ifndef __CARL9170FW_RF_H diff --git a/carlfw/include/rom.h b/carlfw/include/rom.h index 922c5c8..f9ff8b5 100644 --- a/carlfw/include/rom.h +++ b/carlfw/include/rom.h @@ -19,8 +19,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * with this program; If not, see . */ #ifndef __CARL9170FW_ROM_H @@ -77,6 +76,6 @@ struct ar9170_rom { struct ar9170_eeprom sys; } __packed; -static const struct ar9170_rom rom __section(eeprom); +static const struct ar9170_rom rom __in_section(eeprom); #endif /* __CARL9170FW_ROM_H */ diff --git a/carlfw/include/timer.h b/carlfw/include/timer.h index d9eee7a..f15e6fb 100644 --- a/carlfw/include/timer.h +++ b/carlfw/include/timer.h @@ -19,8 +19,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * with this program; If not, see . */ #ifndef __CARL9170FW_TIMER_H diff --git a/carlfw/include/uart.h b/carlfw/include/uart.h index 1cfa29d..5c02a07 100644 --- a/carlfw/include/uart.h +++ b/carlfw/include/uart.h @@ -19,8 +19,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * with this program; If not, see . */ #ifndef __CARL9170FW_UART_H diff --git a/carlfw/include/usb.h b/carlfw/include/usb.h index 1066fe0..67a3830 100644 --- a/carlfw/include/usb.h +++ b/carlfw/include/usb.h @@ -19,8 +19,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * with this program; If not, see . */ #ifndef __CARL9170FW_USB_H diff --git a/carlfw/include/usb_fifo.h b/carlfw/include/usb_fifo.h index 5d84c88..f8f0d64 100644 --- a/carlfw/include/usb_fifo.h +++ b/carlfw/include/usb_fifo.h @@ -19,8 +19,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * with this program; If not, see . */ #ifndef __CARL9170FW_USB_FIFO_H diff --git a/carlfw/include/wl.h b/carlfw/include/wl.h index 50fee61..5def1cf 100644 --- a/carlfw/include/wl.h +++ b/carlfw/include/wl.h @@ -19,8 +19,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * with this program; If not, see . */ #ifndef __CARL9170FW_WLAN_H diff --git a/carlfw/include/wol.h b/carlfw/include/wol.h index 829400a..20f0af6 100644 --- a/carlfw/include/wol.h +++ b/carlfw/include/wol.h @@ -19,8 +19,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * with this program; If not, see . */ #ifndef __CARL9170FW_WOL_H diff --git a/carlfw/src/cam.c b/carlfw/src/cam.c index 7c0e61c..44cbddd 100644 --- a/carlfw/src/cam.c +++ b/carlfw/src/cam.c @@ -19,8 +19,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * with this program; If not, see . */ #include "carl9170.h" diff --git a/carlfw/src/dma.c b/carlfw/src/dma.c index 9945f3e..9a6cc0c 100644 --- a/carlfw/src/dma.c +++ b/carlfw/src/dma.c @@ -19,15 +19,14 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * with this program; If not, see . */ #include "carl9170.h" #include "wl.h" #include "printf.h" -struct ar9170_dma_memory dma_mem __section(sram); +struct ar9170_dma_memory dma_mem __in_section(sram); static void copy_dma_desc(struct dma_desc *dst, struct dma_desc *src) diff --git a/carlfw/src/fw.c b/carlfw/src/fw.c index a98b735..85a03fe 100644 --- a/carlfw/src/fw.c +++ b/carlfw/src/fw.c @@ -16,8 +16,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * with this program; If not, see . */ #include "carl9170.h" #include "fwdsc.h" @@ -32,7 +31,7 @@ more \ } -const struct carl9170_firmware_descriptor __section(fwdsc) __visible carl9170fw_desc = { +const struct carl9170_firmware_descriptor __in_section(fwdsc) __visible carl9170fw_desc = { FILL(otus, OTUS, .feature_set = cpu_to_le32(BIT(CARL9170FW_DUMMY_FEATURE) | BIT(CARL9170FW_USB_RESP_EP2) | @@ -41,6 +40,7 @@ const struct carl9170_firmware_descriptor __section(fwdsc) __visible carl9170fw_ BIT(CARL9170FW_HW_COUNTERS) | BIT(CARL9170FW_RX_BA_FILTER) | BIT(CARL9170FW_USB_INIT_FIRMWARE) | + BIT(CARL9170FW_HAS_WREGB_CMD) | #ifdef CONFIG_CARL9170FW_USB_UP_STREAM BIT(CARL9170FW_USB_UP_STREAM) | #endif /* CONFIG_CARL9170FW_USB_UP_STREAM */ diff --git a/carlfw/src/gpio.c b/carlfw/src/gpio.c index 85cd81f..94abdc9 100644 --- a/carlfw/src/gpio.c +++ b/carlfw/src/gpio.c @@ -19,8 +19,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * with this program; If not, see . */ #include "carl9170.h" diff --git a/carlfw/src/hostif.c b/carlfw/src/hostif.c index 5726860..73e89c7 100644 --- a/carlfw/src/hostif.c +++ b/carlfw/src/hostif.c @@ -19,8 +19,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * with this program; If not, see . */ #include "carl9170.h" @@ -235,6 +234,12 @@ void handle_cmd(struct carl9170_rsp *resp) memset(&fw.tally, 0, sizeof(struct carl9170_tally_rsp)); break; + case CARL9170_CMD_WREGB: + resp->hdr.len = 0; + for (i = 0; i < MIN(cmd->wregb.count, cmd->hdr.len - 8); i++) + setb(cmd->wregb.addr + i, cmd->wregb.val[i]); + break; + case CARL9170_CMD_BCN_CTRL: resp->hdr.len = 0; diff --git a/carlfw/src/main.c b/carlfw/src/main.c index b24d905..8cb5fc1 100644 --- a/carlfw/src/main.c +++ b/carlfw/src/main.c @@ -19,8 +19,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * with this program; If not, see . */ #include "carl9170.h" @@ -141,7 +140,7 @@ static void __noreturn main_loop(void) * we put _start() there with the linker script carl9170.lds. */ -void __section(boot) __noreturn __visible start(void) +void __in_section(boot) __noreturn __visible start(void) { clock_set(AHB_40MHZ_OSC, true); diff --git a/carlfw/src/printf.c b/carlfw/src/printf.c index 3ff05c4..33de46e 100755 --- a/carlfw/src/printf.c +++ b/carlfw/src/printf.c @@ -12,8 +12,7 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * with this program; If not, see . */ #include "carl9170.h" diff --git a/carlfw/src/rf.c b/carlfw/src/rf.c index e031dd8..5e8d3d8 100644 --- a/carlfw/src/rf.c +++ b/carlfw/src/rf.c @@ -19,8 +19,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * with this program; If not, see . */ #include "carl9170.h" @@ -205,10 +204,14 @@ void rf_cmd(const struct carl9170_cmd *cmd, struct carl9170_rsp *resp) /* * Is the clock controlled by the PHY? */ +#ifdef CONFIG_CARL9170FW_80MHZ_CLOCK if ((fw.phy.ht_settings & EIGHTY_FLAG) == EIGHTY_FLAG) clock_set(AHB_80_88MHZ, true); else clock_set(AHB_40_44MHZ, true); +#else + clock_set(AHB_40_44MHZ, true); +#endif ret = rf_init(le32_to_cpu(cmd->rf_init.delta_slope_coeff_exp), le32_to_cpu(cmd->rf_init.delta_slope_coeff_man), diff --git a/carlfw/src/timer.c b/carlfw/src/timer.c index 9505818..9b62530 100644 --- a/carlfw/src/timer.c +++ b/carlfw/src/timer.c @@ -19,8 +19,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * with this program; If not, see . */ #include "carl9170.h" diff --git a/carlfw/src/uart.c b/carlfw/src/uart.c index 919e683..2a0a76a 100644 --- a/carlfw/src/uart.c +++ b/carlfw/src/uart.c @@ -19,8 +19,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * with this program; If not, see . */ #include "carl9170.h" diff --git a/carlfw/src/udivsi3_i4i-Os.S b/carlfw/src/udivsi3_i4i-Os.S index 191bf2e..ac82196 100644 --- a/carlfw/src/udivsi3_i4i-Os.S +++ b/carlfw/src/udivsi3_i4i-Os.S @@ -21,8 +21,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to -the Free Software Foundation, 51 Franklin Street, Fifth Floor, -Boston, MA 02110-1301, USA. */ +with this program; If not, see . */ /* Moderately Space-optimized libgcc routines for the Renesas SH / STMicroelectronics ST40 CPUs. diff --git a/carlfw/src/wlan.c b/carlfw/src/wlan.c index 384d8d1..4e73a2b 100644 --- a/carlfw/src/wlan.c +++ b/carlfw/src/wlan.c @@ -19,8 +19,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * with this program; If not, see . */ #include "carl9170.h" diff --git a/carlfw/src/wlanrx.c b/carlfw/src/wlanrx.c index 02cbce5..3ff9d54 100644 --- a/carlfw/src/wlanrx.c +++ b/carlfw/src/wlanrx.c @@ -19,8 +19,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * with this program; If not, see . */ #include "carl9170.h" diff --git a/carlfw/src/wlantx.c b/carlfw/src/wlantx.c index a421c4c..474c040 100644 --- a/carlfw/src/wlantx.c +++ b/carlfw/src/wlantx.c @@ -19,8 +19,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * with this program; If not, see . */ #include "carl9170.h" diff --git a/carlfw/src/wol.c b/carlfw/src/wol.c index 7afb8e5..47508be 100644 --- a/carlfw/src/wol.c +++ b/carlfw/src/wol.c @@ -16,8 +16,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * with this program; If not, see . */ #include "carl9170.h" diff --git a/carlfw/usb/fifo.c b/carlfw/usb/fifo.c index 3d8e354..01c2d0c 100644 --- a/carlfw/usb/fifo.c +++ b/carlfw/usb/fifo.c @@ -17,8 +17,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * with this program; If not, see . */ #include "carl9170.h" diff --git a/carlfw/usb/main.c b/carlfw/usb/main.c index 1fb119e..4199a21 100644 --- a/carlfw/usb/main.c +++ b/carlfw/usb/main.c @@ -17,8 +17,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * with this program; If not, see . */ #include "carl9170.h" diff --git a/carlfw/usb/usb.c b/carlfw/usb/usb.c index d7bc432..6142dcd 100644 --- a/carlfw/usb/usb.c +++ b/carlfw/usb/usb.c @@ -19,8 +19,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * with this program; If not, see . */ #include "carl9170.h" #include "usb.h" @@ -159,7 +158,7 @@ static struct ar9170_usb_config usb_config_fullspeed = { .bLength = USB_DT_ENDPOINT_SIZE, .bDescriptorType = USB_DT_ENDPOINT, .bEndpointAddress = USB_DIR_OUT | AR9170_USB_EP_CMD, - .bmAttributes = USB_ENDPOINT_XFER_INT, + .bmAttributes = USB_ENDPOINT_XFER_BULK, .wMaxPacketSize = cpu_to_le16(64), .bInterval = 1, }, diff --git a/config/conf.c b/config/conf.c index e308f5b..6b6cba5 100644 --- a/config/conf.c +++ b/config/conf.c @@ -459,7 +459,7 @@ static struct option long_opts[] = { static void conf_usage(const char *progname) { - printf("Usage: %s [option] \n", progname); + printf("Usage: %s [-s] [option] \n", progname); printf("[option] is _one_ of the following:\n"); printf(" --listnewconfig List new options\n"); printf(" --askconfig Start a new configuration using a line-oriented program\n"); @@ -488,7 +488,11 @@ int main(int ac, char **av) tty_stdio = isatty(0) && isatty(1) && isatty(2); - while ((opt = getopt_long(ac, av, "", long_opts, NULL)) != -1) { + while ((opt = getopt_long(ac, av, "s", long_opts, NULL)) != -1) { + if (opt == 's') { + conf_set_message_callback(NULL); + continue; + } input_mode = (enum input_mode)opt; switch (opt) { case defconfig: @@ -644,7 +648,7 @@ int main(int ac, char **av) if (input_mode == savedefconfig) { if (conf_write_defconfig(defconfig_file)) { fprintf(stderr, _("n*** Error while saving defconfig to: %s\n\n"), - defconfig_file); + defconfig_file); return 1; } } else if (input_mode != listnewconfig) { diff --git a/config/confdata.c b/config/confdata.c index a856c19..75a6372 100644 --- a/config/confdata.c +++ b/config/confdata.c @@ -16,6 +16,11 @@ #include "lkc.h" +struct conf_printer { + void (*print_symbol)(FILE *, struct symbol *, const char *, void *); + void (*print_comment)(FILE *, const char *, void *); +}; + static void conf_warning(const char *fmt, ...) __attribute__ ((format (printf, 1, 2))); @@ -59,6 +64,7 @@ static void conf_message(const char *fmt, ...) va_start(ap, fmt); if (conf_message_callback) conf_message_callback(fmt, ap); + va_end(ap); } const char *conf_get_configname(void) @@ -1241,7 +1247,10 @@ bool conf_set_all_new_symbols(enum conf_def_mode mode) sym->def[S_DEF_USER].tri = mod; break; case def_no: - sym->def[S_DEF_USER].tri = no; + if (sym->flags & SYMBOL_ALLNOCONFIG_Y) + sym->def[S_DEF_USER].tri = yes; + else + sym->def[S_DEF_USER].tri = no; break; case def_random: sym->def[S_DEF_USER].tri = no; diff --git a/config/expr.c b/config/expr.c index d662652..fb0a2a2 100644 --- a/config/expr.c +++ b/config/expr.c @@ -11,6 +11,12 @@ #define DEBUG_EXPR 0 +static int expr_eq(struct expr *e1, struct expr *e2); +static struct expr *expr_eliminate_yn(struct expr *e); +static struct expr *expr_extract_eq_and(struct expr **ep1, struct expr **ep2); +static struct expr *expr_extract_eq_or(struct expr **ep1, struct expr **ep2); +static void expr_extract_eq(enum expr_type type, struct expr **ep, struct expr **ep1, struct expr **ep2); + struct expr *expr_alloc_symbol(struct symbol *sym) { struct expr *e = xcalloc(1, sizeof(*e)); @@ -186,7 +192,7 @@ void expr_eliminate_eq(struct expr **ep1, struct expr **ep2) #undef e1 #undef e2 -int expr_eq(struct expr *e1, struct expr *e2) +static int expr_eq(struct expr *e1, struct expr *e2) { int res, old_count; @@ -228,7 +234,7 @@ int expr_eq(struct expr *e1, struct expr *e2) return 0; } -struct expr *expr_eliminate_yn(struct expr *e) +static struct expr *expr_eliminate_yn(struct expr *e) { struct expr *tmp; @@ -823,7 +829,7 @@ bool expr_depends_symbol(struct expr *dep, struct symbol *sym) return false; } -struct expr *expr_extract_eq_and(struct expr **ep1, struct expr **ep2) +static struct expr *expr_extract_eq_and(struct expr **ep1, struct expr **ep2) { struct expr *tmp = NULL; expr_extract_eq(E_AND, &tmp, ep1, ep2); @@ -834,7 +840,7 @@ struct expr *expr_extract_eq_and(struct expr **ep1, struct expr **ep2) return tmp; } -struct expr *expr_extract_eq_or(struct expr **ep1, struct expr **ep2) +static struct expr *expr_extract_eq_or(struct expr **ep1, struct expr **ep2) { struct expr *tmp = NULL; expr_extract_eq(E_OR, &tmp, ep1, ep2); @@ -845,7 +851,7 @@ struct expr *expr_extract_eq_or(struct expr **ep1, struct expr **ep2) return tmp; } -void expr_extract_eq(enum expr_type type, struct expr **ep, struct expr **ep1, struct expr **ep2) +static void expr_extract_eq(enum expr_type type, struct expr **ep, struct expr **ep1, struct expr **ep2) { #define e1 (*ep1) #define e2 (*ep2) @@ -976,11 +982,8 @@ tristate expr_calc_value(struct expr *e) } } -int expr_compare_type(enum expr_type t1, enum expr_type t2) +static int expr_compare_type(enum expr_type t1, enum expr_type t2) { -#if 0 - return 1; -#else if (t1 == t2) return 0; switch (t1) { @@ -1005,7 +1008,6 @@ int expr_compare_type(enum expr_type t1, enum expr_type t2) } printf("[%dgt%d?]", t1, t2); return 0; -#endif } static inline struct expr * diff --git a/config/expr.h b/config/expr.h index ba663e1..a2fc96a 100644 --- a/config/expr.h +++ b/config/expr.h @@ -109,6 +109,9 @@ struct symbol { /* choice values need to be set before calculating this symbol value */ #define SYMBOL_NEED_SET_CHOICE_VALUES 0x100000 +/* Set symbol to y if allnoconfig; used for symbols that hide others */ +#define SYMBOL_ALLNOCONFIG_Y 0x200000 + #define SYMBOL_MAXLENGTH 256 #define SYMBOL_HASHSIZE 9973 @@ -202,18 +205,13 @@ struct expr *expr_alloc_and(struct expr *e1, struct expr *e2); struct expr *expr_alloc_or(struct expr *e1, struct expr *e2); struct expr *expr_copy(const struct expr *org); void expr_free(struct expr *e); -int expr_eq(struct expr *e1, struct expr *e2); void expr_eliminate_eq(struct expr **ep1, struct expr **ep2); tristate expr_calc_value(struct expr *e); -struct expr *expr_eliminate_yn(struct expr *e); struct expr *expr_trans_bool(struct expr *e); struct expr *expr_eliminate_dups(struct expr *e); struct expr *expr_transform(struct expr *e); int expr_contains_symbol(struct expr *dep, struct symbol *sym); bool expr_depends_symbol(struct expr *dep, struct symbol *sym); -struct expr *expr_extract_eq_and(struct expr **ep1, struct expr **ep2); -struct expr *expr_extract_eq_or(struct expr **ep1, struct expr **ep2); -void expr_extract_eq(enum expr_type type, struct expr **ep, struct expr **ep1, struct expr **ep2); struct expr *expr_trans_compare(struct expr *e, enum expr_type type, struct symbol *sym); struct expr *expr_simplify_unmet_dep(struct expr *e1, struct expr *e2); diff --git a/config/list.h b/config/list.h index 685d80e..2cf23f0 100644 --- a/config/list.h +++ b/config/list.h @@ -34,7 +34,7 @@ struct list_head { * list_entry - get the struct for this entry * @ptr: the &struct list_head pointer. * @type: the type of the struct this is embedded in. - * @member: the name of the list_struct within the struct. + * @member: the name of the list_head within the struct. */ #define list_entry(ptr, type, member) \ container_of(ptr, type, member) @@ -43,7 +43,7 @@ struct list_head { * list_for_each_entry - iterate over list of given type * @pos: the type * to use as a loop cursor. * @head: the head for your list. - * @member: the name of the list_struct within the struct. + * @member: the name of the list_head within the struct. */ #define list_for_each_entry(pos, head, member) \ for (pos = list_entry((head)->next, typeof(*pos), member); \ @@ -55,7 +55,7 @@ struct list_head { * @pos: the type * to use as a loop cursor. * @n: another type * to use as temporary storage * @head: the head for your list. - * @member: the name of the list_struct within the struct. + * @member: the name of the list_head within the struct. */ #define list_for_each_entry_safe(pos, n, head, member) \ for (pos = list_entry((head)->next, typeof(*pos), member), \ diff --git a/config/lkc.h b/config/lkc.h index 09f4edf..91ca126 100644 --- a/config/lkc.h +++ b/config/lkc.h @@ -21,9 +21,7 @@ static inline char *bind_textdomain_codeset(const char *dn, char *c) { return c; extern "C" { #endif -#define P(name,type,arg) extern type name arg #include "lkc_proto.h" -#undef P #define SRCTREE "srctree" @@ -61,6 +59,7 @@ enum conf_def_mode { #define T_OPT_MODULES 1 #define T_OPT_DEFCONFIG_LIST 2 #define T_OPT_ENV 3 +#define T_OPT_ALLNOCONFIG_Y 4 struct kconf_id { int name; @@ -69,9 +68,6 @@ struct kconf_id { enum symbol_type stype; }; -extern int zconfdebug; - -int zconfparse(void); void zconfdump(FILE *out); void zconf_starthelp(void); FILE *zconf_fopen(const char *name); @@ -89,11 +85,6 @@ void sym_add_change_count(int count); bool conf_set_all_new_symbols(enum conf_def_mode mode); void set_all_choice_values(struct symbol *csym); -struct conf_printer { - void (*print_symbol)(FILE *, struct symbol *, const char *, void *); - void (*print_comment)(FILE *, const char *, void *); -}; - /* confdata.c and expr.c */ static inline void xfwrite(const void *str, size_t len, size_t count, FILE *out) { @@ -112,7 +103,6 @@ void menu_add_entry(struct symbol *sym); void menu_end_entry(void); void menu_add_dep(struct expr *dep); void menu_add_visibility(struct expr *dep); -struct property *menu_add_prop(enum prop_type type, char *prompt, struct expr *expr, struct expr *dep); struct property *menu_add_prompt(enum prop_type type, char *prompt, struct expr *dep); void menu_add_expr(enum prop_type type, struct expr *expr, struct expr *dep); void menu_add_symbol(enum prop_type type, struct symbol *sym, struct expr *dep); @@ -136,7 +126,6 @@ struct gstr { int max_width; }; struct gstr str_new(void); -struct gstr str_assign(const char *s); void str_free(struct gstr *gs); void str_append(struct gstr *gs, const char *s); void str_printf(struct gstr *gs, const char *fmt, ...); @@ -147,8 +136,6 @@ extern struct expr *sym_env_list; void sym_init(void); void sym_clear_all_valid(void); -void sym_set_all_changed(void); -void sym_set_changed(struct symbol *sym); struct symbol *sym_choice_default(struct symbol *sym); const char *sym_get_string_default(struct symbol *sym); struct symbol *sym_check_deps(struct symbol *sym); diff --git a/config/lkc_proto.h b/config/lkc_proto.h index ecdb965..d539871 100644 --- a/config/lkc_proto.h +++ b/config/lkc_proto.h @@ -1,57 +1,52 @@ #include /* confdata.c */ -P(conf_parse,void,(const char *name)); -P(conf_read,int,(const char *name)); -P(conf_read_simple,int,(const char *name, int)); -P(conf_write_defconfig,int,(const char *name)); -P(conf_write,int,(const char *name)); -P(conf_write_autoconf,int,(void)); -P(conf_get_changed,bool,(void)); -P(conf_set_changed_callback, void,(void (*fn)(void))); -P(conf_set_message_callback, void,(void (*fn)(const char *fmt, va_list ap))); +void conf_parse(const char *name); +int conf_read(const char *name); +int conf_read_simple(const char *name, int); +int conf_write_defconfig(const char *name); +int conf_write(const char *name); +int conf_write_autoconf(void); +bool conf_get_changed(void); +void conf_set_changed_callback(void (*fn)(void)); +void conf_set_message_callback(void (*fn)(const char *fmt, va_list ap)); /* menu.c */ -P(rootmenu,struct menu,); +extern struct menu rootmenu; -P(menu_is_empty, bool, (struct menu *menu)); -P(menu_is_visible, bool, (struct menu *menu)); -P(menu_has_prompt, bool, (struct menu *menu)); -P(menu_get_prompt,const char *,(struct menu *menu)); -P(menu_get_root_menu,struct menu *,(struct menu *menu)); -P(menu_get_parent_menu,struct menu *,(struct menu *menu)); -P(menu_has_help,bool,(struct menu *menu)); -P(menu_get_help,const char *,(struct menu *menu)); -P(get_symbol_str, void, (struct gstr *r, struct symbol *sym, struct list_head - *head)); -P(get_relations_str, struct gstr, (struct symbol **sym_arr, struct list_head - *head)); -P(menu_get_ext_help,void,(struct menu *menu, struct gstr *help)); +bool menu_is_empty(struct menu *menu); +bool menu_is_visible(struct menu *menu); +bool menu_has_prompt(struct menu *menu); +const char * menu_get_prompt(struct menu *menu); +struct menu * menu_get_root_menu(struct menu *menu); +struct menu * menu_get_parent_menu(struct menu *menu); +bool menu_has_help(struct menu *menu); +const char * menu_get_help(struct menu *menu); +struct gstr get_relations_str(struct symbol **sym_arr, struct list_head *head); +void menu_get_ext_help(struct menu *menu, struct gstr *help); /* symbol.c */ -P(symbol_hash,struct symbol *,[SYMBOL_HASHSIZE]); +extern struct symbol * symbol_hash[SYMBOL_HASHSIZE]; -P(sym_lookup,struct symbol *,(const char *name, int flags)); -P(sym_find,struct symbol *,(const char *name)); -P(sym_expand_string_value,const char *,(const char *in)); -P(sym_escape_string_value, const char *,(const char *in)); -P(sym_re_search,struct symbol **,(const char *pattern)); -P(sym_type_name,const char *,(enum symbol_type type)); -P(sym_calc_value,void,(struct symbol *sym)); -P(sym_get_type,enum symbol_type,(struct symbol *sym)); -P(sym_tristate_within_range,bool,(struct symbol *sym,tristate tri)); -P(sym_set_tristate_value,bool,(struct symbol *sym,tristate tri)); -P(sym_toggle_tristate_value,tristate,(struct symbol *sym)); -P(sym_string_valid,bool,(struct symbol *sym, const char *newval)); -P(sym_string_within_range,bool,(struct symbol *sym, const char *str)); -P(sym_set_string_value,bool,(struct symbol *sym, const char *newval)); -P(sym_is_changable,bool,(struct symbol *sym)); -P(sym_get_choice_prop,struct property *,(struct symbol *sym)); -P(sym_get_default_prop,struct property *,(struct symbol *sym)); -P(sym_get_string_value,const char *,(struct symbol *sym)); +struct symbol * sym_lookup(const char *name, int flags); +struct symbol * sym_find(const char *name); +const char * sym_expand_string_value(const char *in); +const char * sym_escape_string_value(const char *in); +struct symbol ** sym_re_search(const char *pattern); +const char * sym_type_name(enum symbol_type type); +void sym_calc_value(struct symbol *sym); +enum symbol_type sym_get_type(struct symbol *sym); +bool sym_tristate_within_range(struct symbol *sym,tristate tri); +bool sym_set_tristate_value(struct symbol *sym,tristate tri); +tristate sym_toggle_tristate_value(struct symbol *sym); +bool sym_string_valid(struct symbol *sym, const char *newval); +bool sym_string_within_range(struct symbol *sym, const char *str); +bool sym_set_string_value(struct symbol *sym, const char *newval); +bool sym_is_changable(struct symbol *sym); +struct property * sym_get_choice_prop(struct symbol *sym); +const char * sym_get_string_value(struct symbol *sym); -P(prop_get_type_name,const char *,(enum prop_type type)); +const char * prop_get_type_name(enum prop_type type); /* expr.c */ -P(expr_compare_type,int,(enum expr_type t1, enum expr_type t2)); -P(expr_print,void,(struct expr *e, void (*fn)(void *, struct symbol *, const char *), void *data, int prevtoken)); +void expr_print(struct expr *e, void (*fn)(void *, struct symbol *, const char *), void *data, int prevtoken); diff --git a/config/menu.c b/config/menu.c index db1512a..b05cc3d 100644 --- a/config/menu.c +++ b/config/menu.c @@ -125,7 +125,7 @@ void menu_set_type(int type) sym_type_name(sym->type), sym_type_name(type)); } -struct property *menu_add_prop(enum prop_type type, char *prompt, struct expr *expr, struct expr *dep) +static struct property *menu_add_prop(enum prop_type type, char *prompt, struct expr *expr, struct expr *dep) { struct property *prop = prop_alloc(type, current_entry->sym); @@ -217,6 +217,9 @@ void menu_add_option(int token, char *arg) case T_OPT_ENV: prop_add_env(arg); break; + case T_OPT_ALLNOCONFIG_Y: + current_entry->sym->flags |= SYMBOL_ALLNOCONFIG_Y; + break; } } @@ -255,8 +258,8 @@ static void sym_check_prop(struct symbol *sym) "config symbol '%s' uses select, but is " "not boolean or tristate", sym->name); else if (sym2->type != S_UNKNOWN && - sym2->type != S_BOOLEAN && - sym2->type != S_TRISTATE) + sym2->type != S_BOOLEAN && + sym2->type != S_TRISTATE) prop_warn(prop, "'%s' has wrong type. 'select' only " "accept arguments of boolean and " @@ -265,7 +268,7 @@ static void sym_check_prop(struct symbol *sym) case P_RANGE: if (sym->type != S_INT && sym->type != S_HEX) prop_warn(prop, "range is only allowed " - "for int or hex symbols"); + "for int or hex symbols"); if (!menu_validate_number(sym, prop->expr->left.sym) || !menu_validate_number(sym, prop->expr->right.sym)) prop_warn(prop, "range is invalid"); @@ -545,7 +548,7 @@ static void get_prompt_str(struct gstr *r, struct property *prop, { int i, j; struct menu *submenu[8], *menu, *location = NULL; - struct jump_key *jump; + struct jump_key *jump = NULL; str_printf(r, _("Prompt: %s\n"), _(prop->text)); menu = prop->menu->parent; @@ -583,7 +586,7 @@ static void get_prompt_str(struct gstr *r, struct property *prop, str_printf(r, _(" Location:\n")); for (j = 4; --i >= 0; j += 2) { menu = submenu[i]; - if (head && location && menu == location) + if (jump && menu == location) jump->offset = strlen(r->s); str_printf(r, "%*c-> %s", j, ' ', _(menu_get_prompt(menu))); @@ -612,7 +615,7 @@ static struct property *get_symbol_prop(struct symbol *sym) /* * head is optional and may be NULL */ -void get_symbol_str(struct gstr *r, struct symbol *sym, +static void get_symbol_str(struct gstr *r, struct symbol *sym, struct list_head *head) { bool hit; diff --git a/config/symbol.c b/config/symbol.c index 7caabdb..6731377 100644 --- a/config/symbol.c +++ b/config/symbol.c @@ -112,7 +112,7 @@ struct property *sym_get_env_prop(struct symbol *sym) return NULL; } -struct property *sym_get_default_prop(struct symbol *sym) +static struct property *sym_get_default_prop(struct symbol *sym) { struct property *prop; @@ -186,6 +186,26 @@ static void sym_validate_range(struct symbol *sym) sym->curr.val = strdup(str); } +static void sym_set_changed(struct symbol *sym) +{ + struct property *prop; + + sym->flags |= SYMBOL_CHANGED; + for (prop = sym->prop; prop; prop = prop->next) { + if (prop->menu) + prop->menu->flags |= MENU_CHANGED; + } +} + +static void sym_set_all_changed(void) +{ + struct symbol *sym; + int i; + + for_all_symbols(i, sym) + sym_set_changed(sym); +} + static void sym_calc_visibility(struct symbol *sym) { struct property *prop; @@ -451,26 +471,6 @@ void sym_clear_all_valid(void) sym_calc_value(modules_sym); } -void sym_set_changed(struct symbol *sym) -{ - struct property *prop; - - sym->flags |= SYMBOL_CHANGED; - for (prop = sym->prop; prop; prop = prop->next) { - if (prop->menu) - prop->menu->flags |= MENU_CHANGED; - } -} - -void sym_set_all_changed(void) -{ - struct symbol *sym; - int i; - - for_all_symbols(i, sym) - sym_set_changed(sym); -} - bool sym_tristate_within_range(struct symbol *sym, tristate val) { int type = sym_get_type(sym); diff --git a/config/util.c b/config/util.c index 6e7fbf1..0e76042 100644 --- a/config/util.c +++ b/config/util.c @@ -88,16 +88,6 @@ struct gstr str_new(void) return gs; } -/* Allocate and assign growable string */ -struct gstr str_assign(const char *s) -{ - struct gstr gs; - gs.s = strdup(s); - gs.len = strlen(s) + 1; - gs.max_width = 0; - return gs; -} - /* Free storage for growable string */ void str_free(struct gstr *gs) { @@ -155,5 +145,3 @@ void *xcalloc(size_t nmemb, size_t size) fprintf(stderr, "Out of memory.\n"); exit(1); } - - diff --git a/config/zconf.gperf b/config/zconf.gperf index dd8ec26..f639adb 100644 --- a/config/zconf.gperf +++ b/config/zconf.gperf @@ -44,4 +44,5 @@ on, T_ON, TF_PARAM modules, T_OPT_MODULES, TF_OPTION defconfig_list, T_OPT_DEFCONFIG_LIST,TF_OPTION env, T_OPT_ENV, TF_OPTION +allnoconfig_y, T_OPT_ALLNOCONFIG_Y,TF_OPTION %% diff --git a/config/zconf.l b/config/zconf.l index a0eec5a..54058e0 100644 --- a/config/zconf.l +++ b/config/zconf.l @@ -27,8 +27,8 @@ static char *text; static int text_size, text_asize; struct buffer { - struct buffer *parent; - YY_BUFFER_STATE state; + struct buffer *parent; + YY_BUFFER_STATE state; }; struct buffer *current_buf; diff --git a/config/zconf.y b/config/zconf.y index 992fa55..bd2c500 100644 --- a/config/zconf.y +++ b/config/zconf.y @@ -510,7 +510,7 @@ void conf_parse(const char *name) for_all_symbols(i, sym) { if (sym_check_deps(sym)) zconfnerrs++; - } + } if (zconfnerrs) exit(1); sym_set_change_count(1); diff --git a/include/linux/compiler.h b/include/linux/compiler.h index b81bf14..9ef76ec 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h @@ -17,16 +17,12 @@ #ifndef __SHARED_COMPILER_H #define __SHARED_COMPILER_H -#define __noinline __attribute__((noinline)) #define __noreturn __attribute__((noreturn)) #define __inline __attribute__((always_inline)) #define __hot __attribute__((hot)) #define __cold __attribute__((cold)) -#define __unused __attribute__((unused)) #define __force __attribute__((force)) -#define __section(s) __attribute__((section("." # s))) -#define __aligned(a) __attribute__((aligned(a))) -#define __packed __attribute__((packed)) +#define __in_section(s) __attribute__((section("." # s))) #define __visible __attribute__((externally_visible)) #define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)])) diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h index 9fb09d8..9ec7061 100644 --- a/include/linux/ieee80211.h +++ b/include/linux/ieee80211.h @@ -6,6 +6,7 @@ * Copyright (c) 2002-2003, Jouni Malinen * Copyright (c) 2005, Devicescape Software, Inc. * Copyright (c) 2006, Michael Wu + * Copyright (c) 2013 - 2014 Intel Mobile Communications GmbH * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as @@ -150,6 +151,10 @@ static inline u16 ieee80211_sn_sub(u16 sn1, u16 sn2) 802.11e clarifies the figure in section 7.1.2. The frame body is up to 2304 octets long (maximum MSDU size) plus any crypt overhead. */ #define IEEE80211_MAX_DATA_LEN 2304 +/* 802.11ad extends maximum MSDU size for DMG (freq > 40Ghz) networks + * to 7920 bytes, see 8.2.3 General frame format + */ +#define IEEE80211_MAX_DATA_LEN_DMG 7920 /* 30 byte 4 addr hdr, 2 byte QoS, 2304 byte MSDU, 12 byte crypt, 4 byte FCS */ #define IEEE80211_MAX_FRAME_LEN 2352 @@ -157,8 +162,12 @@ static inline u16 ieee80211_sn_sub(u16 sn1, u16 sn2) #define IEEE80211_MAX_MESH_ID_LEN 32 +#define IEEE80211_FIRST_TSPEC_TSID 8 #define IEEE80211_NUM_TIDS 16 +/* number of user priorities 802.11 uses */ +#define IEEE80211_NUM_UPS 8 + #define IEEE80211_QOS_CTL_LEN 2 /* 1d tag mask */ #define IEEE80211_QOS_CTL_TAG1D_MASK 0x0007 @@ -603,6 +612,20 @@ static inline unsigned int ieee80211_hdrlen(__le16 fc) return hdrlen; } +/** + * ieee80211_is_bufferable_mmpdu - check if frame is bufferable MMPDU + * @fc: frame control field in little-endian byteorder + */ +static inline bool ieee80211_is_bufferable_mmpdu(__le16 fc) +{ + /* IEEE 802.11-2012, definition of "bufferable management frame"; + * note that this ignores the IBSS special case. */ + return ieee80211_is_mgmt(fc) && + (ieee80211_is_action(fc) || + ieee80211_is_disassoc(fc) || + ieee80211_is_deauth(fc)); +} + /** * ieee80211_is_first_frag - check if IEEE80211_SCTL_FRAG is not set * @seq_ctrl: frame sequence control bytes in little-endian byteorder @@ -824,6 +847,16 @@ enum ieee80211_vht_opmode_bits { #define WLAN_SA_QUERY_TR_ID_LEN 2 +/** + * struct ieee80211_tpc_report_ie + * + * This structure refers to "TPC Report element" + */ +struct ieee80211_tpc_report_ie { + u8 tx_power; + u8 link_margin; +} __packed; + struct ieee80211_mgmt { __le16 frame_control; __le16 duration; @@ -959,6 +992,13 @@ struct ieee80211_mgmt { u8 action_code; u8 operating_mode; } __packed vht_opmode_notif; + struct { + u8 action_code; + u8 dialog_token; + u8 tpc_elem_id; + u8 tpc_elem_length; + struct ieee80211_tpc_report_ie tpc; + } __packed tpc_report; } u; } __packed action; } u; @@ -980,6 +1020,15 @@ struct ieee80211_mmie { u8 mic[8]; } __packed; +/* Management MIC information element (IEEE 802.11w) for GMAC and CMAC-256 */ +struct ieee80211_mmie_16 { + u8 element_id; + u8 length; + __le16 key_id; + u8 sequence_number[6]; + u8 mic[16]; +} __packed; + struct ieee80211_vendor_ie { u8 element_id; u8 len; @@ -987,6 +1036,26 @@ struct ieee80211_vendor_ie { u8 oui_type; } __packed; +struct ieee80211_wmm_ac_param { + u8 aci_aifsn; /* AIFSN, ACM, ACI */ + u8 cw; /* ECWmin, ECWmax (CW = 2^ECW - 1) */ + __le16 txop_limit; +} __packed; + +struct ieee80211_wmm_param_ie { + u8 element_id; /* Element ID: 221 (0xdd); */ + u8 len; /* Length: 24 */ + /* required fields for WMM version 1 */ + u8 oui[3]; /* 00:50:f2 */ + u8 oui_type; /* 2 */ + u8 oui_subtype; /* 1 */ + u8 version; /* 1 for WMM version 1.0 */ + u8 qos_info; /* AP/STA specific QoS info */ + u8 reserved; /* 0 */ + /* AC_BE, AC_BK, AC_VI, AC_VO */ + struct ieee80211_wmm_ac_param ac[4]; +} __packed; + /* Control frames */ struct ieee80211_rts { __le16 frame_control; @@ -1010,6 +1079,12 @@ struct ieee80211_pspoll { /* TDLS */ +/* Channel switch timing */ +struct ieee80211_ch_switch_timing { + __le16 switch_time; + __le16 switch_timeout; +} __packed; + /* Link-id information element */ struct ieee80211_tdls_lnkie { u8 ie_type; /* Link Identifier IE */ @@ -1051,6 +1126,15 @@ struct ieee80211_tdls_data { u8 dialog_token; u8 variable[0]; } __packed discover_req; + struct { + u8 target_channel; + u8 oper_class; + u8 variable[0]; + } __packed chan_switch_req; + struct { + __le16 status_code; + u8 variable[0]; + } __packed chan_switch_resp; } u; } __packed; @@ -1235,7 +1319,7 @@ struct ieee80211_ht_cap { #define IEEE80211_HT_AMPDU_PARM_DENSITY_SHIFT 2 /* - * Maximum length of AMPDU that the STA can receive. + * Maximum length of AMPDU that the STA can receive in high-throughput (HT). * Length = 2 ^ (13 + max_ampdu_length_exp) - 1 (octets) */ enum ieee80211_max_ampdu_length_exp { @@ -1245,6 +1329,21 @@ enum ieee80211_max_ampdu_length_exp { IEEE80211_HT_MAX_AMPDU_64K = 3 }; +/* + * Maximum length of AMPDU that the STA can receive in VHT. + * Length = 2 ^ (13 + max_ampdu_length_exp) - 1 (octets) + */ +enum ieee80211_vht_max_ampdu_length_exp { + IEEE80211_VHT_MAX_AMPDU_8K = 0, + IEEE80211_VHT_MAX_AMPDU_16K = 1, + IEEE80211_VHT_MAX_AMPDU_32K = 2, + IEEE80211_VHT_MAX_AMPDU_64K = 3, + IEEE80211_VHT_MAX_AMPDU_128K = 4, + IEEE80211_VHT_MAX_AMPDU_256K = 5, + IEEE80211_VHT_MAX_AMPDU_512K = 6, + IEEE80211_VHT_MAX_AMPDU_1024K = 7 +}; + #define IEEE80211_HT_MAX_AMPDU_FACTOR 13 /* Minimum MPDU start spacing */ @@ -1431,8 +1530,12 @@ struct ieee80211_vht_operation { #define IEEE80211_VHT_CAP_RXSTBC_MASK 0x00000700 #define IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE 0x00000800 #define IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE 0x00001000 -#define IEEE80211_VHT_CAP_BEAMFORMEE_STS_MAX 0x0000e000 -#define IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_MAX 0x00070000 +#define IEEE80211_VHT_CAP_BEAMFORMEE_STS_SHIFT 13 +#define IEEE80211_VHT_CAP_BEAMFORMEE_STS_MASK \ + (7 << IEEE80211_VHT_CAP_BEAMFORMEE_STS_SHIFT) +#define IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_SHIFT 16 +#define IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_MASK \ + (7 << IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_SHIFT) #define IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE 0x00080000 #define IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE 0x00100000 #define IEEE80211_VHT_CAP_VHT_TXOP_PS 0x00200000 @@ -1619,6 +1722,9 @@ enum ieee80211_reasoncode { WLAN_REASON_INVALID_RSN_IE_CAP = 22, WLAN_REASON_IEEE8021X_FAILED = 23, WLAN_REASON_CIPHER_SUITE_REJECTED = 24, + /* TDLS (802.11z) */ + WLAN_REASON_TDLS_TEARDOWN_UNREACHABLE = 25, + WLAN_REASON_TDLS_TEARDOWN_UNSPECIFIED = 26, /* 802.11e */ WLAN_REASON_DISASSOC_UNSPECIFIED_QOS = 32, WLAN_REASON_DISASSOC_QAP_NO_BANDWIDTH = 33, @@ -1652,51 +1758,22 @@ enum ieee80211_reasoncode { enum ieee80211_eid { WLAN_EID_SSID = 0, WLAN_EID_SUPP_RATES = 1, - WLAN_EID_FH_PARAMS = 2, + WLAN_EID_FH_PARAMS = 2, /* reserved now */ WLAN_EID_DS_PARAMS = 3, WLAN_EID_CF_PARAMS = 4, WLAN_EID_TIM = 5, WLAN_EID_IBSS_PARAMS = 6, - WLAN_EID_CHALLENGE = 16, - WLAN_EID_COUNTRY = 7, WLAN_EID_HP_PARAMS = 8, WLAN_EID_HP_TABLE = 9, WLAN_EID_REQUEST = 10, - WLAN_EID_QBSS_LOAD = 11, WLAN_EID_EDCA_PARAM_SET = 12, WLAN_EID_TSPEC = 13, WLAN_EID_TCLAS = 14, WLAN_EID_SCHEDULE = 15, - WLAN_EID_TS_DELAY = 43, - WLAN_EID_TCLAS_PROCESSING = 44, - WLAN_EID_QOS_CAPA = 46, - /* 802.11z */ - WLAN_EID_LINK_ID = 101, - /* 802.11s */ - WLAN_EID_MESH_CONFIG = 113, - WLAN_EID_MESH_ID = 114, - WLAN_EID_LINK_METRIC_REPORT = 115, - WLAN_EID_CONGESTION_NOTIFICATION = 116, - WLAN_EID_PEER_MGMT = 117, - WLAN_EID_CHAN_SWITCH_PARAM = 118, - WLAN_EID_MESH_AWAKE_WINDOW = 119, - WLAN_EID_BEACON_TIMING = 120, - WLAN_EID_MCCAOP_SETUP_REQ = 121, - WLAN_EID_MCCAOP_SETUP_RESP = 122, - WLAN_EID_MCCAOP_ADVERT = 123, - WLAN_EID_MCCAOP_TEARDOWN = 124, - WLAN_EID_GANN = 125, - WLAN_EID_RANN = 126, - WLAN_EID_PREQ = 130, - WLAN_EID_PREP = 131, - WLAN_EID_PERR = 132, - WLAN_EID_PXU = 137, - WLAN_EID_PXUC = 138, - WLAN_EID_AUTH_MESH_PEER_EXCH = 139, - WLAN_EID_MIC = 140, - + WLAN_EID_CHALLENGE = 16, + /* 17-31 reserved for challenge text extension */ WLAN_EID_PWR_CONSTRAINT = 32, WLAN_EID_PWR_CAPABILITY = 33, WLAN_EID_TPC_REQUEST = 34, @@ -1707,66 +1784,116 @@ enum ieee80211_eid { WLAN_EID_MEASURE_REPORT = 39, WLAN_EID_QUIET = 40, WLAN_EID_IBSS_DFS = 41, - WLAN_EID_ERP_INFO = 42, - WLAN_EID_EXT_SUPP_RATES = 50, - + WLAN_EID_TS_DELAY = 43, + WLAN_EID_TCLAS_PROCESSING = 44, WLAN_EID_HT_CAPABILITY = 45, - WLAN_EID_HT_OPERATION = 61, - WLAN_EID_SECONDARY_CHANNEL_OFFSET = 62, - + WLAN_EID_QOS_CAPA = 46, + /* 47 reserved for Broadcom */ WLAN_EID_RSN = 48, - WLAN_EID_MMIE = 76, - WLAN_EID_VENDOR_SPECIFIC = 221, - WLAN_EID_QOS_PARAMETER = 222, - + WLAN_EID_802_15_COEX = 49, + WLAN_EID_EXT_SUPP_RATES = 50, WLAN_EID_AP_CHAN_REPORT = 51, WLAN_EID_NEIGHBOR_REPORT = 52, WLAN_EID_RCPI = 53, + WLAN_EID_MOBILITY_DOMAIN = 54, + WLAN_EID_FAST_BSS_TRANSITION = 55, + WLAN_EID_TIMEOUT_INTERVAL = 56, + WLAN_EID_RIC_DATA = 57, + WLAN_EID_DSE_REGISTERED_LOCATION = 58, + WLAN_EID_SUPPORTED_REGULATORY_CLASSES = 59, + WLAN_EID_EXT_CHANSWITCH_ANN = 60, + WLAN_EID_HT_OPERATION = 61, + WLAN_EID_SECONDARY_CHANNEL_OFFSET = 62, WLAN_EID_BSS_AVG_ACCESS_DELAY = 63, WLAN_EID_ANTENNA_INFO = 64, WLAN_EID_RSNI = 65, WLAN_EID_MEASUREMENT_PILOT_TX_INFO = 66, WLAN_EID_BSS_AVAILABLE_CAPACITY = 67, WLAN_EID_BSS_AC_ACCESS_DELAY = 68, + WLAN_EID_TIME_ADVERTISEMENT = 69, WLAN_EID_RRM_ENABLED_CAPABILITIES = 70, WLAN_EID_MULTIPLE_BSSID = 71, WLAN_EID_BSS_COEX_2040 = 72, + WLAN_EID_BSS_INTOLERANT_CHL_REPORT = 73, WLAN_EID_OVERLAP_BSS_SCAN_PARAM = 74, - WLAN_EID_EXT_CAPABILITY = 127, - - WLAN_EID_MOBILITY_DOMAIN = 54, - WLAN_EID_FAST_BSS_TRANSITION = 55, - WLAN_EID_TIMEOUT_INTERVAL = 56, - WLAN_EID_RIC_DATA = 57, WLAN_EID_RIC_DESCRIPTOR = 75, - - WLAN_EID_DSE_REGISTERED_LOCATION = 58, - WLAN_EID_SUPPORTED_REGULATORY_CLASSES = 59, - WLAN_EID_EXT_CHANSWITCH_ANN = 60, - - WLAN_EID_VHT_CAPABILITY = 191, - WLAN_EID_VHT_OPERATION = 192, - WLAN_EID_OPMODE_NOTIF = 199, - WLAN_EID_WIDE_BW_CHANNEL_SWITCH = 194, - WLAN_EID_CHANNEL_SWITCH_WRAPPER = 196, - WLAN_EID_EXTENDED_BSS_LOAD = 193, - WLAN_EID_VHT_TX_POWER_ENVELOPE = 195, - WLAN_EID_AID = 197, - WLAN_EID_QUIET_CHANNEL = 198, - - /* 802.11ad */ + WLAN_EID_MMIE = 76, + WLAN_EID_ASSOC_COMEBACK_TIME = 77, + WLAN_EID_EVENT_REQUEST = 78, + WLAN_EID_EVENT_REPORT = 79, + WLAN_EID_DIAGNOSTIC_REQUEST = 80, + WLAN_EID_DIAGNOSTIC_REPORT = 81, + WLAN_EID_LOCATION_PARAMS = 82, WLAN_EID_NON_TX_BSSID_CAP = 83, + WLAN_EID_SSID_LIST = 84, + WLAN_EID_MULTI_BSSID_IDX = 85, + WLAN_EID_FMS_DESCRIPTOR = 86, + WLAN_EID_FMS_REQUEST = 87, + WLAN_EID_FMS_RESPONSE = 88, + WLAN_EID_QOS_TRAFFIC_CAPA = 89, + WLAN_EID_BSS_MAX_IDLE_PERIOD = 90, + WLAN_EID_TSF_REQUEST = 91, + WLAN_EID_TSF_RESPOSNE = 92, + WLAN_EID_WNM_SLEEP_MODE = 93, + WLAN_EID_TIM_BCAST_REQ = 94, + WLAN_EID_TIM_BCAST_RESP = 95, + WLAN_EID_COLL_IF_REPORT = 96, + WLAN_EID_CHANNEL_USAGE = 97, + WLAN_EID_TIME_ZONE = 98, + WLAN_EID_DMS_REQUEST = 99, + WLAN_EID_DMS_RESPONSE = 100, + WLAN_EID_LINK_ID = 101, + WLAN_EID_WAKEUP_SCHEDUL = 102, + /* 103 reserved */ + WLAN_EID_CHAN_SWITCH_TIMING = 104, + WLAN_EID_PTI_CONTROL = 105, + WLAN_EID_PU_BUFFER_STATUS = 106, + WLAN_EID_INTERWORKING = 107, + WLAN_EID_ADVERTISEMENT_PROTOCOL = 108, + WLAN_EID_EXPEDITED_BW_REQ = 109, + WLAN_EID_QOS_MAP_SET = 110, + WLAN_EID_ROAMING_CONSORTIUM = 111, + WLAN_EID_EMERGENCY_ALERT = 112, + WLAN_EID_MESH_CONFIG = 113, + WLAN_EID_MESH_ID = 114, + WLAN_EID_LINK_METRIC_REPORT = 115, + WLAN_EID_CONGESTION_NOTIFICATION = 116, + WLAN_EID_PEER_MGMT = 117, + WLAN_EID_CHAN_SWITCH_PARAM = 118, + WLAN_EID_MESH_AWAKE_WINDOW = 119, + WLAN_EID_BEACON_TIMING = 120, + WLAN_EID_MCCAOP_SETUP_REQ = 121, + WLAN_EID_MCCAOP_SETUP_RESP = 122, + WLAN_EID_MCCAOP_ADVERT = 123, + WLAN_EID_MCCAOP_TEARDOWN = 124, + WLAN_EID_GANN = 125, + WLAN_EID_RANN = 126, + WLAN_EID_EXT_CAPABILITY = 127, + /* 128, 129 reserved for Agere */ + WLAN_EID_PREQ = 130, + WLAN_EID_PREP = 131, + WLAN_EID_PERR = 132, + /* 133-136 reserved for Cisco */ + WLAN_EID_PXU = 137, + WLAN_EID_PXUC = 138, + WLAN_EID_AUTH_MESH_PEER_EXCH = 139, + WLAN_EID_MIC = 140, + WLAN_EID_DESTINATION_URI = 141, + WLAN_EID_UAPSD_COEX = 142, WLAN_EID_WAKEUP_SCHEDULE = 143, WLAN_EID_EXT_SCHEDULE = 144, WLAN_EID_STA_AVAILABILITY = 145, WLAN_EID_DMG_TSPEC = 146, WLAN_EID_DMG_AT = 147, WLAN_EID_DMG_CAP = 148, + /* 149 reserved for Cisco */ + WLAN_EID_CISCO_VENDOR_SPECIFIC = 150, WLAN_EID_DMG_OPERATION = 151, WLAN_EID_DMG_BSS_PARAM_CHANGE = 152, WLAN_EID_DMG_BEAM_REFINEMENT = 153, WLAN_EID_CHANNEL_MEASURE_FEEDBACK = 154, + /* 155-156 reserved for Cisco */ WLAN_EID_AWAKE_WINDOW = 157, WLAN_EID_MULTI_BAND = 158, WLAN_EID_ADDBA_EXT = 159, @@ -1783,11 +1910,34 @@ enum ieee80211_eid { WLAN_EID_MULTIPLE_MAC_ADDR = 170, WLAN_EID_U_PID = 171, WLAN_EID_DMG_LINK_ADAPT_ACK = 172, + /* 173 reserved for Symbol */ + WLAN_EID_MCCAOP_ADV_OVERVIEW = 174, WLAN_EID_QUIET_PERIOD_REQ = 175, + /* 176 reserved for Symbol */ WLAN_EID_QUIET_PERIOD_RESP = 177, + /* 178-179 reserved for Symbol */ + /* 180 reserved for ISO/IEC 20011 */ WLAN_EID_EPAC_POLICY = 182, WLAN_EID_CLISTER_TIME_OFF = 183, + WLAN_EID_INTER_AC_PRIO = 184, + WLAN_EID_SCS_DESCRIPTOR = 185, + WLAN_EID_QLOAD_REPORT = 186, + WLAN_EID_HCCA_TXOP_UPDATE_COUNT = 187, + WLAN_EID_HL_STREAM_ID = 188, + WLAN_EID_GCR_GROUP_ADDR = 189, WLAN_EID_ANTENNA_SECTOR_ID_PATTERN = 190, + WLAN_EID_VHT_CAPABILITY = 191, + WLAN_EID_VHT_OPERATION = 192, + WLAN_EID_EXTENDED_BSS_LOAD = 193, + WLAN_EID_WIDE_BW_CHANNEL_SWITCH = 194, + WLAN_EID_VHT_TX_POWER_ENVELOPE = 195, + WLAN_EID_CHANNEL_SWITCH_WRAPPER = 196, + WLAN_EID_AID = 197, + WLAN_EID_QUIET_CHANNEL = 198, + WLAN_EID_OPMODE_NOTIF = 199, + + WLAN_EID_VENDOR_SPECIFIC = 221, + WLAN_EID_QOS_PARAMETER = 222, }; /* Action category code */ @@ -1797,6 +1947,7 @@ enum ieee80211_category { WLAN_CATEGORY_DLS = 2, WLAN_CATEGORY_BACK = 3, WLAN_CATEGORY_PUBLIC = 4, + WLAN_CATEGORY_RADIO_MEASUREMENT = 5, WLAN_CATEGORY_HT = 7, WLAN_CATEGORY_SA_QUERY = 8, WLAN_CATEGORY_PROTECTED_DUAL_OF_ACTION = 9, @@ -1871,8 +2022,15 @@ enum ieee80211_key_len { WLAN_KEY_LEN_WEP40 = 5, WLAN_KEY_LEN_WEP104 = 13, WLAN_KEY_LEN_CCMP = 16, + WLAN_KEY_LEN_CCMP_256 = 32, WLAN_KEY_LEN_TKIP = 32, WLAN_KEY_LEN_AES_CMAC = 16, + WLAN_KEY_LEN_SMS4 = 32, + WLAN_KEY_LEN_GCMP = 16, + WLAN_KEY_LEN_GCMP_256 = 32, + WLAN_KEY_LEN_BIP_CMAC_256 = 32, + WLAN_KEY_LEN_BIP_GMAC_128 = 16, + WLAN_KEY_LEN_BIP_GMAC_256 = 32, }; #define IEEE80211_WEP_IV_LEN 4 @@ -1880,9 +2038,16 @@ enum ieee80211_key_len { #define IEEE80211_CCMP_HDR_LEN 8 #define IEEE80211_CCMP_MIC_LEN 8 #define IEEE80211_CCMP_PN_LEN 6 +#define IEEE80211_CCMP_256_HDR_LEN 8 +#define IEEE80211_CCMP_256_MIC_LEN 16 +#define IEEE80211_CCMP_256_PN_LEN 6 #define IEEE80211_TKIP_IV_LEN 8 #define IEEE80211_TKIP_ICV_LEN 4 #define IEEE80211_CMAC_PN_LEN 6 +#define IEEE80211_GMAC_PN_LEN 6 +#define IEEE80211_GCMP_HDR_LEN 8 +#define IEEE80211_GCMP_MIC_LEN 16 +#define IEEE80211_GCMP_PN_LEN 6 /* Public action codes */ enum ieee80211_pub_actioncode { @@ -1905,6 +2070,16 @@ enum ieee80211_tdls_actioncode { WLAN_TDLS_DISCOVERY_REQUEST = 10, }; +/* Extended Channel Switching capability to be set in the 1st byte of + * the @WLAN_EID_EXT_CAPABILITY information element + */ +#define WLAN_EXT_CAPA1_EXT_CHANNEL_SWITCHING BIT(2) + +/* TDLS capabilities in the the 4th byte of @WLAN_EID_EXT_CAPABILITY */ +#define WLAN_EXT_CAPA4_TDLS_BUFFER_STA BIT(4) +#define WLAN_EXT_CAPA4_TDLS_PEER_PSM BIT(5) +#define WLAN_EXT_CAPA4_TDLS_CHAN_SWITCH BIT(6) + /* Interworking capabilities are set in 7th bit of 4th byte of the * @WLAN_EID_EXT_CAPABILITY information element */ @@ -1916,12 +2091,17 @@ enum ieee80211_tdls_actioncode { */ #define WLAN_EXT_CAPA5_TDLS_ENABLED BIT(5) #define WLAN_EXT_CAPA5_TDLS_PROHIBITED BIT(6) +#define WLAN_EXT_CAPA5_TDLS_CH_SW_PROHIBITED BIT(7) #define WLAN_EXT_CAPA8_OPMODE_NOTIF BIT(6) +#define WLAN_EXT_CAPA8_TDLS_WIDE_BW_ENABLED BIT(7) /* TDLS specific payload type in the LLC/SNAP header */ #define WLAN_TDLS_SNAP_RFTYPE 0x2 +/* BSS Coex IE information field bits */ +#define WLAN_BSS_COEX_INFORMATION_REQUEST BIT(0) + /** * enum - mesh synchronization method identifier * @@ -2091,6 +2271,11 @@ enum ieee80211_sa_query_action { #define WLAN_CIPHER_SUITE_WEP104 0x000FAC05 #define WLAN_CIPHER_SUITE_AES_CMAC 0x000FAC06 #define WLAN_CIPHER_SUITE_GCMP 0x000FAC08 +#define WLAN_CIPHER_SUITE_GCMP_256 0x000FAC09 +#define WLAN_CIPHER_SUITE_CCMP_256 0x000FAC0A +#define WLAN_CIPHER_SUITE_BIP_GMAC_128 0x000FAC0B +#define WLAN_CIPHER_SUITE_BIP_GMAC_256 0x000FAC0C +#define WLAN_CIPHER_SUITE_BIP_CMAC_256 0x000FAC0D #define WLAN_CIPHER_SUITE_SMS4 0x00147201 @@ -2251,42 +2436,6 @@ static inline bool ieee80211_is_public_action(struct ieee80211_hdr *hdr, return mgmt->u.action.category == WLAN_CATEGORY_PUBLIC; } -/** - * ieee80211_dsss_chan_to_freq - get channel center frequency - * @channel: the DSSS channel - * - * Convert IEEE802.11 DSSS channel to the center frequency (MHz). - * Ref IEEE 802.11-2007 section 15.6 - */ -static inline int ieee80211_dsss_chan_to_freq(int channel) -{ - if ((channel > 0) && (channel < 14)) - return 2407 + (channel * 5); - else if (channel == 14) - return 2484; - else - return -1; -} - -/** - * ieee80211_freq_to_dsss_chan - get channel - * @freq: the frequency - * - * Convert frequency (MHz) to IEEE802.11 DSSS channel - * Ref IEEE 802.11-2007 section 15.6 - * - * This routine selects the channel with the closest center frequency. - */ -static inline int ieee80211_freq_to_dsss_chan(int freq) -{ - if ((freq >= 2410) && (freq < 2475)) - return (freq - 2405) / 5; - else if ((freq >= 2482) && (freq < 2487)) - return 14; - else - return -1; -} - /** * ieee80211_tu_to_usec - convert time units (TU) to microseconds * @tu: the TUs diff --git a/include/pattern.h b/include/pattern.h index ba9e88f..9f06923 100644 --- a/include/pattern.h +++ b/include/pattern.h @@ -60,8 +60,8 @@ static const struct pattern_pulse_info pattern_ONE_KHZ[] = { { .pulse_width = 1, .pulse_interval = 1000, - .pulse_pattern = 0xa7438080, - .pulse_mode = 0x5f01, + .pulse_pattern = 0xaa55, + .pulse_mode = 0x17f01, }, }; @@ -69,8 +69,8 @@ static const struct pattern_pulse_info pattern_TEN_KHZ[] = { { .pulse_width = 1, .pulse_interval = 100, - .pulse_pattern = 0x436f0001, - .pulse_mode = 0x5f01, + .pulse_pattern = 0xaa55, + .pulse_mode = 0x17f01, }, }; @@ -78,15 +78,15 @@ static const struct pattern_pulse_info pattern_ONE_TWO_KHZ[] = { { .pulse_width = 1, .pulse_interval = 1000, - .pulse_pattern = 0xa7438080, - .pulse_mode = 0x5f01, + .pulse_pattern = 0xaa55, + .pulse_mode = 0x17f01, }, { .pulse_width = 10, .pulse_interval = 500, - .pulse_pattern = 0xa7431001, - .pulse_mode = 0x5f01, + .pulse_pattern = 0xaa55, + .pulse_mode = 0x17f01, }, }; @@ -100,8 +100,8 @@ static const struct pattern_pulse_info pattern_FCC1[] = { { .pulse_width = 1, .pulse_interval = 1428, - .pulse_pattern = 0xa7438080, - .pulse_mode = 0x5f01, + .pulse_pattern = 0xaa55, + .pulse_mode = 0x17f01, }, }; @@ -110,8 +110,8 @@ static const struct pattern_pulse_info pattern_FCC4[] = { { .pulse_width = 11, .pulse_interval = 200, - .pulse_pattern = 0xf3128008, - .pulse_mode = 0x5f01, + .pulse_pattern = 0xaa55, + .pulse_mode = 0x7f01, }, }; @@ -120,8 +120,8 @@ static const struct pattern_pulse_info pattern_ETSIFIXED[] = { { .pulse_width = 1, .pulse_interval = 750, - .pulse_pattern = 0x8a5f8080, - .pulse_mode = 0x5f01, + .pulse_pattern = 0xaa55, + .pulse_mode = 0x7f01, }, }; diff --git a/include/shared/fwcmd.h b/include/shared/fwcmd.h index 9111d4f..ea1d80f 100644 --- a/include/shared/fwcmd.h +++ b/include/shared/fwcmd.h @@ -56,6 +56,7 @@ enum carl9170_cmd_oids { CARL9170_CMD_RX_FILTER = 0x07, CARL9170_CMD_WOL = 0x08, CARL9170_CMD_TALLY = 0x09, + CARL9170_CMD_WREGB = 0x0a, /* CAM */ CARL9170_CMD_EKEY = 0x10, @@ -123,6 +124,12 @@ struct carl9170_write_reg { } regs[0] __packed; } __packed; +struct carl9170_write_reg_byte { + __le32 addr; + __le32 count; + u8 val[0]; +} __packed; + #define CARL9170FW_PHY_HT_ENABLE 0x4 #define CARL9170FW_PHY_HT_DYN2040 0x8 #define CARL9170FW_PHY_HT_EXT_CHAN_OFF 0x3 @@ -226,6 +233,7 @@ struct carl9170_cmd { struct carl9170_u32_list echo; struct carl9170_reg_list rreg; struct carl9170_write_reg wreg; + struct carl9170_write_reg_byte wregb; struct carl9170_rf_init rf_init; struct carl9170_psm psm; struct carl9170_wol_cmd wol; diff --git a/include/shared/fwdesc.h b/include/shared/fwdesc.h index 424a4e7..10327a7 100644 --- a/include/shared/fwdesc.h +++ b/include/shared/fwdesc.h @@ -84,6 +84,9 @@ enum carl9170fw_feature_list { /* Firmware will pass BA when BARs are queued */ CARL9170FW_RX_BA_FILTER, + /* Firmware has support to write a byte at a time */ + CARL9170FW_HAS_WREGB_CMD, + /* KEEP LAST */ __CARL9170FW_FEATURE_NUM }; diff --git a/include/shared/hw.h b/include/shared/hw.h index 139ded8..08e0ae9 100644 --- a/include/shared/hw.h +++ b/include/shared/hw.h @@ -453,9 +453,74 @@ #define AR9170_MC_REG_BASE 0x1d1000 #define AR9170_MC_REG_FLASH_WAIT_STATE (AR9170_MC_REG_BASE + 0x000) -#define AR9170_MC_REG_SEEPROM_WP0 (AR9170_MC_REG_BASE + 0x400) -#define AR9170_MC_REG_SEEPROM_WP1 (AR9170_MC_REG_BASE + 0x404) -#define AR9170_MC_REG_SEEPROM_WP2 (AR9170_MC_REG_BASE + 0x408) + +#define AR9170_SPI_REG_BASE (AR9170_MC_REG_BASE + 0x200) +#define AR9170_SPI_REG_CONTROL0 (AR9170_SPI_REG_BASE + 0x000) +#define AR9170_SPI_CONTROL0_BUSY BIT(0) +#define AR9170_SPI_CONTROL0_CMD_GO BIT(1) +#define AR9170_SPI_CONTROL0_PAGE_WR BIT(2) +#define AR9170_SPI_CONTROL0_SEQ_RD BIT(3) +#define AR9170_SPI_CONTROL0_CMD_ABORT BIT(4) +#define AR9170_SPI_CONTROL0_CMD_LEN_S 8 +#define AR9170_SPI_CONTROL0_CMD_LEN 0x00000f00 +#define AR9170_SPI_CONTROL0_RD_LEN_S 12 +#define AR9170_SPI_CONTROL0_RD_LEN 0x00007000 + +#define AR9170_SPI_REG_CONTROL1 (AR9170_SPI_REG_BASE + 0x004) +#define AR9170_SPI_CONTROL1_SCK_RATE BIT(0) +#define AR9170_SPI_CONTROL1_DRIVE_SDO BIT(1) +#define AR9170_SPI_CONTROL1_MODE_SEL_S 2 +#define AR9170_SPI_CONTROL1_MODE_SEL 0x000000c0 +#define AR9170_SPI_CONTROL1_WRITE_PROTECT BIT(4) + +#define AR9170_SPI_REG_COMMAND_PORT0 (AR9170_SPI_REG_BASE + 0x008) +#define AR9170_SPI_COMMAND_PORT0_CMD0_S 0 +#define AR9170_SPI_COMMAND_PORT0_CMD0 0x000000ff +#define AR9170_SPI_COMMAND_PORT0_CMD1_S 8 +#define AR9170_SPI_COMMAND_PORT0_CMD1 0x0000ff00 +#define AR9170_SPI_COMMAND_PORT0_CMD2_S 16 +#define AR9170_SPI_COMMAND_PORT0_CMD2 0x00ff0000 +#define AR9170_SPI_COMMAND_PORT0_CMD3_S 24 +#define AR9170_SPI_COMMAND_PORT0_CMD3 0xff000000 + +#define AR9170_SPI_REG_COMMAND_PORT1 (AR9170_SPI_REG_BASE + 0x00C) +#define AR9170_SPI_COMMAND_PORT1_CMD4_S 0 +#define AR9170_SPI_COMMAND_PORT1_CMD4 0x000000ff +#define AR9170_SPI_COMMAND_PORT1_CMD5_S 8 +#define AR9170_SPI_COMMAND_PORT1_CMD5 0x0000ff00 +#define AR9170_SPI_COMMAND_PORT1_CMD6_S 16 +#define AR9170_SPI_COMMAND_PORT1_CMD6 0x00ff0000 +#define AR9170_SPI_COMMAND_PORT1_CMD7_S 24 +#define AR9170_SPI_COMMAND_PORT1_CMD7 0xff000000 + +#define AR9170_SPI_REG_DATA_PORT (AR9170_SPI_REG_BASE + 0x010) +#define AR9170_SPI_REG_PAGE_WRITE_LEN (AR9170_SPI_REG_BASE + 0x014) + +#define AR9170_EEPROM_REG_BASE (AR9170_MC_REG_BASE + 0x400) +#define AR9170_EEPROM_REG_WP_MAGIC1 (AR9170_EEPROM_REG_BASE + 0x000) +#define AR9170_EEPROM_WP_MAGIC1 0x12345678 + +#define AR9170_EEPROM_REG_WP_MAGIC2 (AR9170_EEPROM_REG_BASE + 0x004) +#define AR9170_EEPROM_WP_MAGIC2 0x55aa00ff + +#define AR9170_EEPROM_REG_WP_MAGIC3 (AR9170_EEPROM_REG_BASE + 0x008) +#define AR9170_EEPROM_WP_MAGIC3 0x13579ace + +#define AR9170_EEPROM_REG_CLOCK_DIV (AR9170_EEPROM_REG_BASE + 0x00C) +#define AR9170_EEPROM_CLOCK_DIV_FAC_S 0 +#define AR9170_EEPROM_CLOCK_DIV_FAC 0x000001ff +#define AR9170_EEPROM_CLOCK_DIV_FAC_39KHZ 0xff +#define AR9170_EEPROM_CLOCK_DIV_FAC_78KHZ 0x7f +#define AR9170_EEPROM_CLOCK_DIV_FAC_312KHZ 0x1f +#define AR9170_EEPROM_CLOCK_DIV_FAC_10MHZ 0x0 +#define AR9170_EEPROM_CLOCK_DIV_SOFT_RST BIT(9) + +#define AR9170_EEPROM_REG_MODE (AR9170_EEPROM_REG_BASE + 0x010) +#define AR9170_EEPROM_MODE_EEPROM_SIZE_16K_PLUS BIT(31) + +#define AR9170_EEPROM_REG_WRITE_PROTECT (AR9170_EEPROM_REG_BASE + 0x014) +#define AR9170_EEPROM_WRITE_PROTECT_WP_STATUS BIT(0) +#define AR9170_EEPROM_WRITE_PROTECT_WP_SET BIT(8) /* Interrupt Controller */ #define AR9170_MAX_INT_SRC 9 diff --git a/toolchain/Makefile b/toolchain/Makefile index cf7e345..36e29e3 100644 --- a/toolchain/Makefile +++ b/toolchain/Makefile @@ -1,12 +1,12 @@ -BINUTILS_VER=2.23.1 +BINUTILS_VER=2.25 BINUTILS_TAR=binutils-$(BINUTILS_VER).tar.bz2 BINUTILS_URL="http://mirrors.kernel.org/gnu/binutils/$(BINUTILS_TAR)" -NEWLIB_VER=2.0.0 +NEWLIB_VER=2.2.0 NEWLIB_TAR=newlib-$(NEWLIB_VER).tar.gz NEWLIB_URL="ftp://sourceware.org/pub/newlib/$(NEWLIB_TAR)" -GCC_VER=4.8.2 +GCC_VER=5.2.0 GCC_TAR=gcc-$(GCC_VER).tar.bz2 GCC_URL="http://mirrors.kernel.org/gnu/gcc/gcc-$(GCC_VER)/$(GCC_TAR)" diff --git a/toolchain/SHA256SUMS b/toolchain/SHA256SUMS index ca4b7c2..64f6947 100644 --- a/toolchain/SHA256SUMS +++ b/toolchain/SHA256SUMS @@ -7,4 +7,13 @@ c644b2847244278c57bec2ddda69d8fab5a7c767f3b9af69aa7aa3da823ff692 src/newlib-1.2 b037fe5132b71ecad2ea7141ec92292b5d32427bf90fd90cde432b1d5abacc2c src/gcc-4.8.0.tar.bz2 545b44be3ad9f2c4e90e6880f5c9d4f0a8f0e5f67e1ffb0d45da9fa01bb05813 src/gcc-4.8.1.tar.bz2 09dc2276c73424bbbfda1dbddc62bbbf900c9f185acf7f3e1d773ce2d7e3cdc8 src/gcc-4.8.2.tar.bz2 +e5e8c5be9664e7f7f96e0d09919110ab5ad597794f5b1809871177a0f0f14137 src/binutils-2.24.tar.bz2 +3e4d5ab9f0508942b6231b8ade4f8e5048cf92c96ed574c2bd6bd3320a599a48 src/newlib-2.1.0.tar.gz +b9b047a97bade9c1c89970bc8e211ff57b7b8998a1730a80a653d329f8ed1257 src/gcc-4.9.0.tar.bz2 +d334781a124ada6f38e63b545e2a3b8c2183049515a1abab6d513f109f1d717e src/gcc-4.9.1.tar.bz2 +2020c98295856aa13fda0f2f3a4794490757fc24bcca918d52cc8b4917b972dd src/gcc-4.9.2.tar.bz2 +f8add263b0737591aff451b12a00c262c2efac4fa87d741fa1c318fc3bb335be src/newlib-2.2.0.tar.gz +22defc65cfa3ef2a3395faaea75d6331c6e62ea5dfacfed3e2ec17b08c882923 src/binutils-2.25.tar.bz2 +b7dafdf89cbb0e20333dbf5b5349319ae06e3d1a30bf3515b5488f7e89dca5ad src/gcc-5.1.0.tar.bz2 +5f835b04b5f7dd4f4d2dc96190ec1621b8d89f2dc6f638f9f8bc1b1014ba8cad src/gcc-5.2.0.tar.bz2 diff --git a/tools/lib/carlfw.h b/tools/lib/carlfw.h index 6e722c9..1207e70 100644 --- a/tools/lib/carlfw.h +++ b/tools/lib/carlfw.h @@ -18,6 +18,14 @@ #ifndef __CARLFW_H #define __CARLFW_H +/* These macros are already defined as part of newlib's sys/cdefs.h. + * However they are not part of standard libc which is used to compile + * the host tools. For now, simply add them here. + */ +#define __packed __attribute__((packed)) +#define __unused __attribute__((unused)) +#define __aligned(x) __attribute__((aligned(x))) + #include #include "compiler.h" #include "fwdesc.h" diff --git a/tools/src/fwinfo.c b/tools/src/fwinfo.c index 3547041..cd5466c 100644 --- a/tools/src/fwinfo.c +++ b/tools/src/fwinfo.c @@ -69,6 +69,7 @@ static const struct feature_list known_otus_features_v1[] = { CHECK_FOR_FEATURE(CARL9170FW_FIXED_5GHZ_PSM), CHECK_FOR_FEATURE(CARL9170FW_HW_COUNTERS), CHECK_FOR_FEATURE(CARL9170FW_RX_BA_FILTER), + CHECK_FOR_FEATURE(CARL9170FW_HAS_WREGB_CMD), CHECK_FOR_FEATURE(CARL9170FW_PATTERN_GENERATOR), }; diff --git a/tools/src/fwprepare.c b/tools/src/fwprepare.c index 7bf3542..f022874 100644 --- a/tools/src/fwprepare.c +++ b/tools/src/fwprepare.c @@ -23,11 +23,11 @@ #include #include #include +#include -#include "pattern.h" #include "carlfw.h" +#include "pattern.h" -#include "compiler.h" static void checksum_help(void) { diff --git a/tools/src/wol.c b/tools/src/wol.c index 41daba2..f2bd51b 100644 --- a/tools/src/wol.c +++ b/tools/src/wol.c @@ -25,10 +25,12 @@ #include #include +#include +#include + #include #include /* ETH_P_ALL */ #include /* sockaddr_ll */ -#include /* IFNAMSIZ */ static int monitor_init(const char *ifname) {