18c2ecf20Sopenharmony_ci/****************************************************************************** 28c2ecf20Sopenharmony_ci * 38c2ecf20Sopenharmony_ci * This file is provided under a dual BSD/GPLv2 license. When using or 48c2ecf20Sopenharmony_ci * redistributing this file, you may do so under either license. 58c2ecf20Sopenharmony_ci * 68c2ecf20Sopenharmony_ci * GPL LICENSE SUMMARY 78c2ecf20Sopenharmony_ci * 88c2ecf20Sopenharmony_ci * Copyright(c) 2005 - 2014 Intel Corporation. All rights reserved. 98c2ecf20Sopenharmony_ci * 108c2ecf20Sopenharmony_ci * This program is free software; you can redistribute it and/or modify 118c2ecf20Sopenharmony_ci * it under the terms of version 2 of the GNU General Public License as 128c2ecf20Sopenharmony_ci * published by the Free Software Foundation. 138c2ecf20Sopenharmony_ci * 148c2ecf20Sopenharmony_ci * This program is distributed in the hope that it will be useful, but 158c2ecf20Sopenharmony_ci * WITHOUT ANY WARRANTY; without even the implied warranty of 168c2ecf20Sopenharmony_ci * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 178c2ecf20Sopenharmony_ci * General Public License for more details. 188c2ecf20Sopenharmony_ci * 198c2ecf20Sopenharmony_ci * The full GNU General Public License is included in this distribution 208c2ecf20Sopenharmony_ci * in the file called COPYING. 218c2ecf20Sopenharmony_ci * 228c2ecf20Sopenharmony_ci * Contact Information: 238c2ecf20Sopenharmony_ci * Intel Linux Wireless <linuxwifi@intel.com> 248c2ecf20Sopenharmony_ci * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 258c2ecf20Sopenharmony_ci * 268c2ecf20Sopenharmony_ci * BSD LICENSE 278c2ecf20Sopenharmony_ci * 288c2ecf20Sopenharmony_ci * Copyright(c) 2005 - 2014 Intel Corporation. All rights reserved. 298c2ecf20Sopenharmony_ci * All rights reserved. 308c2ecf20Sopenharmony_ci * 318c2ecf20Sopenharmony_ci * Redistribution and use in source and binary forms, with or without 328c2ecf20Sopenharmony_ci * modification, are permitted provided that the following conditions 338c2ecf20Sopenharmony_ci * are met: 348c2ecf20Sopenharmony_ci * 358c2ecf20Sopenharmony_ci * * Redistributions of source code must retain the above copyright 368c2ecf20Sopenharmony_ci * notice, this list of conditions and the following disclaimer. 378c2ecf20Sopenharmony_ci * * Redistributions in binary form must reproduce the above copyright 388c2ecf20Sopenharmony_ci * notice, this list of conditions and the following disclaimer in 398c2ecf20Sopenharmony_ci * the documentation and/or other materials provided with the 408c2ecf20Sopenharmony_ci * distribution. 418c2ecf20Sopenharmony_ci * * Neither the name Intel Corporation nor the names of its 428c2ecf20Sopenharmony_ci * contributors may be used to endorse or promote products derived 438c2ecf20Sopenharmony_ci * from this software without specific prior written permission. 448c2ecf20Sopenharmony_ci * 458c2ecf20Sopenharmony_ci * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 468c2ecf20Sopenharmony_ci * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 478c2ecf20Sopenharmony_ci * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 488c2ecf20Sopenharmony_ci * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 498c2ecf20Sopenharmony_ci * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 508c2ecf20Sopenharmony_ci * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 518c2ecf20Sopenharmony_ci * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 528c2ecf20Sopenharmony_ci * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 538c2ecf20Sopenharmony_ci * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 548c2ecf20Sopenharmony_ci * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 558c2ecf20Sopenharmony_ci * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 568c2ecf20Sopenharmony_ci * 578c2ecf20Sopenharmony_ci *****************************************************************************/ 588c2ecf20Sopenharmony_ci/* 598c2ecf20Sopenharmony_ci * Please use this file (commands.h) only for uCode API definitions. 608c2ecf20Sopenharmony_ci * Please use iwl-xxxx-hw.h for hardware-related definitions. 618c2ecf20Sopenharmony_ci * Please use dev.h for driver implementation definitions. 628c2ecf20Sopenharmony_ci */ 638c2ecf20Sopenharmony_ci 648c2ecf20Sopenharmony_ci#ifndef __iwl_commands_h__ 658c2ecf20Sopenharmony_ci#define __iwl_commands_h__ 668c2ecf20Sopenharmony_ci 678c2ecf20Sopenharmony_ci#include <linux/ieee80211.h> 688c2ecf20Sopenharmony_ci#include <linux/types.h> 698c2ecf20Sopenharmony_ci 708c2ecf20Sopenharmony_ci 718c2ecf20Sopenharmony_cienum { 728c2ecf20Sopenharmony_ci REPLY_ALIVE = 0x1, 738c2ecf20Sopenharmony_ci REPLY_ERROR = 0x2, 748c2ecf20Sopenharmony_ci REPLY_ECHO = 0x3, /* test command */ 758c2ecf20Sopenharmony_ci 768c2ecf20Sopenharmony_ci /* RXON and QOS commands */ 778c2ecf20Sopenharmony_ci REPLY_RXON = 0x10, 788c2ecf20Sopenharmony_ci REPLY_RXON_ASSOC = 0x11, 798c2ecf20Sopenharmony_ci REPLY_QOS_PARAM = 0x13, 808c2ecf20Sopenharmony_ci REPLY_RXON_TIMING = 0x14, 818c2ecf20Sopenharmony_ci 828c2ecf20Sopenharmony_ci /* Multi-Station support */ 838c2ecf20Sopenharmony_ci REPLY_ADD_STA = 0x18, 848c2ecf20Sopenharmony_ci REPLY_REMOVE_STA = 0x19, 858c2ecf20Sopenharmony_ci REPLY_REMOVE_ALL_STA = 0x1a, /* not used */ 868c2ecf20Sopenharmony_ci REPLY_TXFIFO_FLUSH = 0x1e, 878c2ecf20Sopenharmony_ci 888c2ecf20Sopenharmony_ci /* Security */ 898c2ecf20Sopenharmony_ci REPLY_WEPKEY = 0x20, 908c2ecf20Sopenharmony_ci 918c2ecf20Sopenharmony_ci /* RX, TX, LEDs */ 928c2ecf20Sopenharmony_ci REPLY_TX = 0x1c, 938c2ecf20Sopenharmony_ci REPLY_LEDS_CMD = 0x48, 948c2ecf20Sopenharmony_ci REPLY_TX_LINK_QUALITY_CMD = 0x4e, 958c2ecf20Sopenharmony_ci 968c2ecf20Sopenharmony_ci /* WiMAX coexistence */ 978c2ecf20Sopenharmony_ci COEX_PRIORITY_TABLE_CMD = 0x5a, 988c2ecf20Sopenharmony_ci COEX_MEDIUM_NOTIFICATION = 0x5b, 998c2ecf20Sopenharmony_ci COEX_EVENT_CMD = 0x5c, 1008c2ecf20Sopenharmony_ci 1018c2ecf20Sopenharmony_ci /* Calibration */ 1028c2ecf20Sopenharmony_ci TEMPERATURE_NOTIFICATION = 0x62, 1038c2ecf20Sopenharmony_ci CALIBRATION_CFG_CMD = 0x65, 1048c2ecf20Sopenharmony_ci CALIBRATION_RES_NOTIFICATION = 0x66, 1058c2ecf20Sopenharmony_ci CALIBRATION_COMPLETE_NOTIFICATION = 0x67, 1068c2ecf20Sopenharmony_ci 1078c2ecf20Sopenharmony_ci /* 802.11h related */ 1088c2ecf20Sopenharmony_ci REPLY_QUIET_CMD = 0x71, /* not used */ 1098c2ecf20Sopenharmony_ci REPLY_CHANNEL_SWITCH = 0x72, 1108c2ecf20Sopenharmony_ci CHANNEL_SWITCH_NOTIFICATION = 0x73, 1118c2ecf20Sopenharmony_ci REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74, 1128c2ecf20Sopenharmony_ci SPECTRUM_MEASURE_NOTIFICATION = 0x75, 1138c2ecf20Sopenharmony_ci 1148c2ecf20Sopenharmony_ci /* Power Management */ 1158c2ecf20Sopenharmony_ci POWER_TABLE_CMD = 0x77, 1168c2ecf20Sopenharmony_ci PM_SLEEP_NOTIFICATION = 0x7A, 1178c2ecf20Sopenharmony_ci PM_DEBUG_STATISTIC_NOTIFIC = 0x7B, 1188c2ecf20Sopenharmony_ci 1198c2ecf20Sopenharmony_ci /* Scan commands and notifications */ 1208c2ecf20Sopenharmony_ci REPLY_SCAN_CMD = 0x80, 1218c2ecf20Sopenharmony_ci REPLY_SCAN_ABORT_CMD = 0x81, 1228c2ecf20Sopenharmony_ci SCAN_START_NOTIFICATION = 0x82, 1238c2ecf20Sopenharmony_ci SCAN_RESULTS_NOTIFICATION = 0x83, 1248c2ecf20Sopenharmony_ci SCAN_COMPLETE_NOTIFICATION = 0x84, 1258c2ecf20Sopenharmony_ci 1268c2ecf20Sopenharmony_ci /* IBSS/AP commands */ 1278c2ecf20Sopenharmony_ci BEACON_NOTIFICATION = 0x90, 1288c2ecf20Sopenharmony_ci REPLY_TX_BEACON = 0x91, 1298c2ecf20Sopenharmony_ci WHO_IS_AWAKE_NOTIFICATION = 0x94, /* not used */ 1308c2ecf20Sopenharmony_ci 1318c2ecf20Sopenharmony_ci /* Miscellaneous commands */ 1328c2ecf20Sopenharmony_ci REPLY_TX_POWER_DBM_CMD = 0x95, 1338c2ecf20Sopenharmony_ci QUIET_NOTIFICATION = 0x96, /* not used */ 1348c2ecf20Sopenharmony_ci REPLY_TX_PWR_TABLE_CMD = 0x97, 1358c2ecf20Sopenharmony_ci REPLY_TX_POWER_DBM_CMD_V1 = 0x98, /* old version of API */ 1368c2ecf20Sopenharmony_ci TX_ANT_CONFIGURATION_CMD = 0x98, 1378c2ecf20Sopenharmony_ci MEASURE_ABORT_NOTIFICATION = 0x99, /* not used */ 1388c2ecf20Sopenharmony_ci 1398c2ecf20Sopenharmony_ci /* Bluetooth device coexistence config command */ 1408c2ecf20Sopenharmony_ci REPLY_BT_CONFIG = 0x9b, 1418c2ecf20Sopenharmony_ci 1428c2ecf20Sopenharmony_ci /* Statistics */ 1438c2ecf20Sopenharmony_ci REPLY_STATISTICS_CMD = 0x9c, 1448c2ecf20Sopenharmony_ci STATISTICS_NOTIFICATION = 0x9d, 1458c2ecf20Sopenharmony_ci 1468c2ecf20Sopenharmony_ci /* RF-KILL commands and notifications */ 1478c2ecf20Sopenharmony_ci REPLY_CARD_STATE_CMD = 0xa0, 1488c2ecf20Sopenharmony_ci CARD_STATE_NOTIFICATION = 0xa1, 1498c2ecf20Sopenharmony_ci 1508c2ecf20Sopenharmony_ci /* Missed beacons notification */ 1518c2ecf20Sopenharmony_ci MISSED_BEACONS_NOTIFICATION = 0xa2, 1528c2ecf20Sopenharmony_ci 1538c2ecf20Sopenharmony_ci REPLY_CT_KILL_CONFIG_CMD = 0xa4, 1548c2ecf20Sopenharmony_ci SENSITIVITY_CMD = 0xa8, 1558c2ecf20Sopenharmony_ci REPLY_PHY_CALIBRATION_CMD = 0xb0, 1568c2ecf20Sopenharmony_ci REPLY_RX_PHY_CMD = 0xc0, 1578c2ecf20Sopenharmony_ci REPLY_RX_MPDU_CMD = 0xc1, 1588c2ecf20Sopenharmony_ci REPLY_RX = 0xc3, 1598c2ecf20Sopenharmony_ci REPLY_COMPRESSED_BA = 0xc5, 1608c2ecf20Sopenharmony_ci 1618c2ecf20Sopenharmony_ci /* BT Coex */ 1628c2ecf20Sopenharmony_ci REPLY_BT_COEX_PRIO_TABLE = 0xcc, 1638c2ecf20Sopenharmony_ci REPLY_BT_COEX_PROT_ENV = 0xcd, 1648c2ecf20Sopenharmony_ci REPLY_BT_COEX_PROFILE_NOTIF = 0xce, 1658c2ecf20Sopenharmony_ci 1668c2ecf20Sopenharmony_ci /* PAN commands */ 1678c2ecf20Sopenharmony_ci REPLY_WIPAN_PARAMS = 0xb2, 1688c2ecf20Sopenharmony_ci REPLY_WIPAN_RXON = 0xb3, /* use REPLY_RXON structure */ 1698c2ecf20Sopenharmony_ci REPLY_WIPAN_RXON_TIMING = 0xb4, /* use REPLY_RXON_TIMING structure */ 1708c2ecf20Sopenharmony_ci REPLY_WIPAN_RXON_ASSOC = 0xb6, /* use REPLY_RXON_ASSOC structure */ 1718c2ecf20Sopenharmony_ci REPLY_WIPAN_QOS_PARAM = 0xb7, /* use REPLY_QOS_PARAM structure */ 1728c2ecf20Sopenharmony_ci REPLY_WIPAN_WEPKEY = 0xb8, /* use REPLY_WEPKEY structure */ 1738c2ecf20Sopenharmony_ci REPLY_WIPAN_P2P_CHANNEL_SWITCH = 0xb9, 1748c2ecf20Sopenharmony_ci REPLY_WIPAN_NOA_NOTIFICATION = 0xbc, 1758c2ecf20Sopenharmony_ci REPLY_WIPAN_DEACTIVATION_COMPLETE = 0xbd, 1768c2ecf20Sopenharmony_ci 1778c2ecf20Sopenharmony_ci REPLY_WOWLAN_PATTERNS = 0xe0, 1788c2ecf20Sopenharmony_ci REPLY_WOWLAN_WAKEUP_FILTER = 0xe1, 1798c2ecf20Sopenharmony_ci REPLY_WOWLAN_TSC_RSC_PARAMS = 0xe2, 1808c2ecf20Sopenharmony_ci REPLY_WOWLAN_TKIP_PARAMS = 0xe3, 1818c2ecf20Sopenharmony_ci REPLY_WOWLAN_KEK_KCK_MATERIAL = 0xe4, 1828c2ecf20Sopenharmony_ci REPLY_WOWLAN_GET_STATUS = 0xe5, 1838c2ecf20Sopenharmony_ci REPLY_D3_CONFIG = 0xd3, 1848c2ecf20Sopenharmony_ci 1858c2ecf20Sopenharmony_ci REPLY_MAX = 0xff 1868c2ecf20Sopenharmony_ci}; 1878c2ecf20Sopenharmony_ci 1888c2ecf20Sopenharmony_ci/* 1898c2ecf20Sopenharmony_ci * Minimum number of queues. MAX_NUM is defined in hw specific files. 1908c2ecf20Sopenharmony_ci * Set the minimum to accommodate 1918c2ecf20Sopenharmony_ci * - 4 standard TX queues 1928c2ecf20Sopenharmony_ci * - the command queue 1938c2ecf20Sopenharmony_ci * - 4 PAN TX queues 1948c2ecf20Sopenharmony_ci * - the PAN multicast queue, and 1958c2ecf20Sopenharmony_ci * - the AUX (TX during scan dwell) queue. 1968c2ecf20Sopenharmony_ci */ 1978c2ecf20Sopenharmony_ci#define IWL_MIN_NUM_QUEUES 11 1988c2ecf20Sopenharmony_ci 1998c2ecf20Sopenharmony_ci/* 2008c2ecf20Sopenharmony_ci * Command queue depends on iPAN support. 2018c2ecf20Sopenharmony_ci */ 2028c2ecf20Sopenharmony_ci#define IWL_DEFAULT_CMD_QUEUE_NUM 4 2038c2ecf20Sopenharmony_ci#define IWL_IPAN_CMD_QUEUE_NUM 9 2048c2ecf20Sopenharmony_ci 2058c2ecf20Sopenharmony_ci#define IWL_TX_FIFO_BK 0 /* shared */ 2068c2ecf20Sopenharmony_ci#define IWL_TX_FIFO_BE 1 2078c2ecf20Sopenharmony_ci#define IWL_TX_FIFO_VI 2 /* shared */ 2088c2ecf20Sopenharmony_ci#define IWL_TX_FIFO_VO 3 2098c2ecf20Sopenharmony_ci#define IWL_TX_FIFO_BK_IPAN IWL_TX_FIFO_BK 2108c2ecf20Sopenharmony_ci#define IWL_TX_FIFO_BE_IPAN 4 2118c2ecf20Sopenharmony_ci#define IWL_TX_FIFO_VI_IPAN IWL_TX_FIFO_VI 2128c2ecf20Sopenharmony_ci#define IWL_TX_FIFO_VO_IPAN 5 2138c2ecf20Sopenharmony_ci/* re-uses the VO FIFO, uCode will properly flush/schedule */ 2148c2ecf20Sopenharmony_ci#define IWL_TX_FIFO_AUX 5 2158c2ecf20Sopenharmony_ci#define IWL_TX_FIFO_UNUSED 255 2168c2ecf20Sopenharmony_ci 2178c2ecf20Sopenharmony_ci#define IWLAGN_CMD_FIFO_NUM 7 2188c2ecf20Sopenharmony_ci 2198c2ecf20Sopenharmony_ci/* 2208c2ecf20Sopenharmony_ci * This queue number is required for proper operation 2218c2ecf20Sopenharmony_ci * because the ucode will stop/start the scheduler as 2228c2ecf20Sopenharmony_ci * required. 2238c2ecf20Sopenharmony_ci */ 2248c2ecf20Sopenharmony_ci#define IWL_IPAN_MCAST_QUEUE 8 2258c2ecf20Sopenharmony_ci 2268c2ecf20Sopenharmony_ci/****************************************************************************** 2278c2ecf20Sopenharmony_ci * (0) 2288c2ecf20Sopenharmony_ci * Commonly used structures and definitions: 2298c2ecf20Sopenharmony_ci * Command header, rate_n_flags, txpower 2308c2ecf20Sopenharmony_ci * 2318c2ecf20Sopenharmony_ci *****************************************************************************/ 2328c2ecf20Sopenharmony_ci 2338c2ecf20Sopenharmony_ci/** 2348c2ecf20Sopenharmony_ci * iwlagn rate_n_flags bit fields 2358c2ecf20Sopenharmony_ci * 2368c2ecf20Sopenharmony_ci * rate_n_flags format is used in following iwlagn commands: 2378c2ecf20Sopenharmony_ci * REPLY_RX (response only) 2388c2ecf20Sopenharmony_ci * REPLY_RX_MPDU (response only) 2398c2ecf20Sopenharmony_ci * REPLY_TX (both command and response) 2408c2ecf20Sopenharmony_ci * REPLY_TX_LINK_QUALITY_CMD 2418c2ecf20Sopenharmony_ci * 2428c2ecf20Sopenharmony_ci * High-throughput (HT) rate format for bits 7:0 (bit 8 must be "1"): 2438c2ecf20Sopenharmony_ci * 2-0: 0) 6 Mbps 2448c2ecf20Sopenharmony_ci * 1) 12 Mbps 2458c2ecf20Sopenharmony_ci * 2) 18 Mbps 2468c2ecf20Sopenharmony_ci * 3) 24 Mbps 2478c2ecf20Sopenharmony_ci * 4) 36 Mbps 2488c2ecf20Sopenharmony_ci * 5) 48 Mbps 2498c2ecf20Sopenharmony_ci * 6) 54 Mbps 2508c2ecf20Sopenharmony_ci * 7) 60 Mbps 2518c2ecf20Sopenharmony_ci * 2528c2ecf20Sopenharmony_ci * 4-3: 0) Single stream (SISO) 2538c2ecf20Sopenharmony_ci * 1) Dual stream (MIMO) 2548c2ecf20Sopenharmony_ci * 2) Triple stream (MIMO) 2558c2ecf20Sopenharmony_ci * 2568c2ecf20Sopenharmony_ci * 5: Value of 0x20 in bits 7:0 indicates 6 Mbps HT40 duplicate data 2578c2ecf20Sopenharmony_ci * 2588c2ecf20Sopenharmony_ci * Legacy OFDM rate format for bits 7:0 (bit 8 must be "0", bit 9 "0"): 2598c2ecf20Sopenharmony_ci * 3-0: 0xD) 6 Mbps 2608c2ecf20Sopenharmony_ci * 0xF) 9 Mbps 2618c2ecf20Sopenharmony_ci * 0x5) 12 Mbps 2628c2ecf20Sopenharmony_ci * 0x7) 18 Mbps 2638c2ecf20Sopenharmony_ci * 0x9) 24 Mbps 2648c2ecf20Sopenharmony_ci * 0xB) 36 Mbps 2658c2ecf20Sopenharmony_ci * 0x1) 48 Mbps 2668c2ecf20Sopenharmony_ci * 0x3) 54 Mbps 2678c2ecf20Sopenharmony_ci * 2688c2ecf20Sopenharmony_ci * Legacy CCK rate format for bits 7:0 (bit 8 must be "0", bit 9 "1"): 2698c2ecf20Sopenharmony_ci * 6-0: 10) 1 Mbps 2708c2ecf20Sopenharmony_ci * 20) 2 Mbps 2718c2ecf20Sopenharmony_ci * 55) 5.5 Mbps 2728c2ecf20Sopenharmony_ci * 110) 11 Mbps 2738c2ecf20Sopenharmony_ci */ 2748c2ecf20Sopenharmony_ci#define RATE_MCS_CODE_MSK 0x7 2758c2ecf20Sopenharmony_ci#define RATE_MCS_SPATIAL_POS 3 2768c2ecf20Sopenharmony_ci#define RATE_MCS_SPATIAL_MSK 0x18 2778c2ecf20Sopenharmony_ci#define RATE_MCS_HT_DUP_POS 5 2788c2ecf20Sopenharmony_ci#define RATE_MCS_HT_DUP_MSK 0x20 2798c2ecf20Sopenharmony_ci/* Both legacy and HT use bits 7:0 as the CCK/OFDM rate or HT MCS */ 2808c2ecf20Sopenharmony_ci#define RATE_MCS_RATE_MSK 0xff 2818c2ecf20Sopenharmony_ci 2828c2ecf20Sopenharmony_ci/* Bit 8: (1) HT format, (0) legacy format in bits 7:0 */ 2838c2ecf20Sopenharmony_ci#define RATE_MCS_FLAGS_POS 8 2848c2ecf20Sopenharmony_ci#define RATE_MCS_HT_POS 8 2858c2ecf20Sopenharmony_ci#define RATE_MCS_HT_MSK 0x100 2868c2ecf20Sopenharmony_ci 2878c2ecf20Sopenharmony_ci/* Bit 9: (1) CCK, (0) OFDM. HT (bit 8) must be "0" for this bit to be valid */ 2888c2ecf20Sopenharmony_ci#define RATE_MCS_CCK_POS 9 2898c2ecf20Sopenharmony_ci#define RATE_MCS_CCK_MSK 0x200 2908c2ecf20Sopenharmony_ci 2918c2ecf20Sopenharmony_ci/* Bit 10: (1) Use Green Field preamble */ 2928c2ecf20Sopenharmony_ci#define RATE_MCS_GF_POS 10 2938c2ecf20Sopenharmony_ci#define RATE_MCS_GF_MSK 0x400 2948c2ecf20Sopenharmony_ci 2958c2ecf20Sopenharmony_ci/* Bit 11: (1) Use 40Mhz HT40 chnl width, (0) use 20 MHz legacy chnl width */ 2968c2ecf20Sopenharmony_ci#define RATE_MCS_HT40_POS 11 2978c2ecf20Sopenharmony_ci#define RATE_MCS_HT40_MSK 0x800 2988c2ecf20Sopenharmony_ci 2998c2ecf20Sopenharmony_ci/* Bit 12: (1) Duplicate data on both 20MHz chnls. HT40 (bit 11) must be set. */ 3008c2ecf20Sopenharmony_ci#define RATE_MCS_DUP_POS 12 3018c2ecf20Sopenharmony_ci#define RATE_MCS_DUP_MSK 0x1000 3028c2ecf20Sopenharmony_ci 3038c2ecf20Sopenharmony_ci/* Bit 13: (1) Short guard interval (0.4 usec), (0) normal GI (0.8 usec) */ 3048c2ecf20Sopenharmony_ci#define RATE_MCS_SGI_POS 13 3058c2ecf20Sopenharmony_ci#define RATE_MCS_SGI_MSK 0x2000 3068c2ecf20Sopenharmony_ci 3078c2ecf20Sopenharmony_ci/** 3088c2ecf20Sopenharmony_ci * rate_n_flags Tx antenna masks 3098c2ecf20Sopenharmony_ci * bit14:16 3108c2ecf20Sopenharmony_ci */ 3118c2ecf20Sopenharmony_ci#define RATE_MCS_ANT_POS 14 3128c2ecf20Sopenharmony_ci#define RATE_MCS_ANT_A_MSK 0x04000 3138c2ecf20Sopenharmony_ci#define RATE_MCS_ANT_B_MSK 0x08000 3148c2ecf20Sopenharmony_ci#define RATE_MCS_ANT_C_MSK 0x10000 3158c2ecf20Sopenharmony_ci#define RATE_MCS_ANT_AB_MSK (RATE_MCS_ANT_A_MSK | RATE_MCS_ANT_B_MSK) 3168c2ecf20Sopenharmony_ci#define RATE_MCS_ANT_ABC_MSK (RATE_MCS_ANT_AB_MSK | RATE_MCS_ANT_C_MSK) 3178c2ecf20Sopenharmony_ci#define RATE_ANT_NUM 3 3188c2ecf20Sopenharmony_ci 3198c2ecf20Sopenharmony_ci#define POWER_TABLE_NUM_ENTRIES 33 3208c2ecf20Sopenharmony_ci#define POWER_TABLE_NUM_HT_OFDM_ENTRIES 32 3218c2ecf20Sopenharmony_ci#define POWER_TABLE_CCK_ENTRY 32 3228c2ecf20Sopenharmony_ci 3238c2ecf20Sopenharmony_ci#define IWL_PWR_NUM_HT_OFDM_ENTRIES 24 3248c2ecf20Sopenharmony_ci#define IWL_PWR_CCK_ENTRIES 2 3258c2ecf20Sopenharmony_ci 3268c2ecf20Sopenharmony_ci/** 3278c2ecf20Sopenharmony_ci * struct tx_power_dual_stream 3288c2ecf20Sopenharmony_ci * 3298c2ecf20Sopenharmony_ci * Table entries in REPLY_TX_PWR_TABLE_CMD, REPLY_CHANNEL_SWITCH 3308c2ecf20Sopenharmony_ci * 3318c2ecf20Sopenharmony_ci * Same format as iwl_tx_power_dual_stream, but __le32 3328c2ecf20Sopenharmony_ci */ 3338c2ecf20Sopenharmony_cistruct tx_power_dual_stream { 3348c2ecf20Sopenharmony_ci __le32 dw; 3358c2ecf20Sopenharmony_ci} __packed; 3368c2ecf20Sopenharmony_ci 3378c2ecf20Sopenharmony_ci/** 3388c2ecf20Sopenharmony_ci * Command REPLY_TX_POWER_DBM_CMD = 0x98 3398c2ecf20Sopenharmony_ci * struct iwlagn_tx_power_dbm_cmd 3408c2ecf20Sopenharmony_ci */ 3418c2ecf20Sopenharmony_ci#define IWLAGN_TX_POWER_AUTO 0x7f 3428c2ecf20Sopenharmony_ci#define IWLAGN_TX_POWER_NO_CLOSED (0x1 << 6) 3438c2ecf20Sopenharmony_ci 3448c2ecf20Sopenharmony_cistruct iwlagn_tx_power_dbm_cmd { 3458c2ecf20Sopenharmony_ci s8 global_lmt; /*in half-dBm (e.g. 30 = 15 dBm) */ 3468c2ecf20Sopenharmony_ci u8 flags; 3478c2ecf20Sopenharmony_ci s8 srv_chan_lmt; /*in half-dBm (e.g. 30 = 15 dBm) */ 3488c2ecf20Sopenharmony_ci u8 reserved; 3498c2ecf20Sopenharmony_ci} __packed; 3508c2ecf20Sopenharmony_ci 3518c2ecf20Sopenharmony_ci/** 3528c2ecf20Sopenharmony_ci * Command TX_ANT_CONFIGURATION_CMD = 0x98 3538c2ecf20Sopenharmony_ci * This command is used to configure valid Tx antenna. 3548c2ecf20Sopenharmony_ci * By default uCode concludes the valid antenna according to the radio flavor. 3558c2ecf20Sopenharmony_ci * This command enables the driver to override/modify this conclusion. 3568c2ecf20Sopenharmony_ci */ 3578c2ecf20Sopenharmony_cistruct iwl_tx_ant_config_cmd { 3588c2ecf20Sopenharmony_ci __le32 valid; 3598c2ecf20Sopenharmony_ci} __packed; 3608c2ecf20Sopenharmony_ci 3618c2ecf20Sopenharmony_ci/****************************************************************************** 3628c2ecf20Sopenharmony_ci * (0a) 3638c2ecf20Sopenharmony_ci * Alive and Error Commands & Responses: 3648c2ecf20Sopenharmony_ci * 3658c2ecf20Sopenharmony_ci *****************************************************************************/ 3668c2ecf20Sopenharmony_ci 3678c2ecf20Sopenharmony_ci#define UCODE_VALID_OK cpu_to_le32(0x1) 3688c2ecf20Sopenharmony_ci 3698c2ecf20Sopenharmony_ci/** 3708c2ecf20Sopenharmony_ci * REPLY_ALIVE = 0x1 (response only, not a command) 3718c2ecf20Sopenharmony_ci * 3728c2ecf20Sopenharmony_ci * uCode issues this "alive" notification once the runtime image is ready 3738c2ecf20Sopenharmony_ci * to receive commands from the driver. This is the *second* "alive" 3748c2ecf20Sopenharmony_ci * notification that the driver will receive after rebooting uCode; 3758c2ecf20Sopenharmony_ci * this "alive" is indicated by subtype field != 9. 3768c2ecf20Sopenharmony_ci * 3778c2ecf20Sopenharmony_ci * See comments documenting "BSM" (bootstrap state machine). 3788c2ecf20Sopenharmony_ci * 3798c2ecf20Sopenharmony_ci * This response includes two pointers to structures within the device's 3808c2ecf20Sopenharmony_ci * data SRAM (access via HBUS_TARG_MEM_* regs) that are useful for debugging: 3818c2ecf20Sopenharmony_ci * 3828c2ecf20Sopenharmony_ci * 1) log_event_table_ptr indicates base of the event log. This traces 3838c2ecf20Sopenharmony_ci * a 256-entry history of uCode execution within a circular buffer. 3848c2ecf20Sopenharmony_ci * Its header format is: 3858c2ecf20Sopenharmony_ci * 3868c2ecf20Sopenharmony_ci * __le32 log_size; log capacity (in number of entries) 3878c2ecf20Sopenharmony_ci * __le32 type; (1) timestamp with each entry, (0) no timestamp 3888c2ecf20Sopenharmony_ci * __le32 wraps; # times uCode has wrapped to top of circular buffer 3898c2ecf20Sopenharmony_ci * __le32 write_index; next circular buffer entry that uCode would fill 3908c2ecf20Sopenharmony_ci * 3918c2ecf20Sopenharmony_ci * The header is followed by the circular buffer of log entries. Entries 3928c2ecf20Sopenharmony_ci * with timestamps have the following format: 3938c2ecf20Sopenharmony_ci * 3948c2ecf20Sopenharmony_ci * __le32 event_id; range 0 - 1500 3958c2ecf20Sopenharmony_ci * __le32 timestamp; low 32 bits of TSF (of network, if associated) 3968c2ecf20Sopenharmony_ci * __le32 data; event_id-specific data value 3978c2ecf20Sopenharmony_ci * 3988c2ecf20Sopenharmony_ci * Entries without timestamps contain only event_id and data. 3998c2ecf20Sopenharmony_ci * 4008c2ecf20Sopenharmony_ci * 4018c2ecf20Sopenharmony_ci * 2) error_event_table_ptr indicates base of the error log. This contains 4028c2ecf20Sopenharmony_ci * information about any uCode error that occurs. For agn, the format 4038c2ecf20Sopenharmony_ci * of the error log is defined by struct iwl_error_event_table. 4048c2ecf20Sopenharmony_ci * 4058c2ecf20Sopenharmony_ci * The Linux driver can print both logs to the system log when a uCode error 4068c2ecf20Sopenharmony_ci * occurs. 4078c2ecf20Sopenharmony_ci */ 4088c2ecf20Sopenharmony_ci 4098c2ecf20Sopenharmony_ci/* 4108c2ecf20Sopenharmony_ci * Note: This structure is read from the device with IO accesses, 4118c2ecf20Sopenharmony_ci * and the reading already does the endian conversion. As it is 4128c2ecf20Sopenharmony_ci * read with u32-sized accesses, any members with a different size 4138c2ecf20Sopenharmony_ci * need to be ordered correctly though! 4148c2ecf20Sopenharmony_ci */ 4158c2ecf20Sopenharmony_cistruct iwl_error_event_table { 4168c2ecf20Sopenharmony_ci u32 valid; /* (nonzero) valid, (0) log is empty */ 4178c2ecf20Sopenharmony_ci u32 error_id; /* type of error */ 4188c2ecf20Sopenharmony_ci u32 pc; /* program counter */ 4198c2ecf20Sopenharmony_ci u32 blink1; /* branch link */ 4208c2ecf20Sopenharmony_ci u32 blink2; /* branch link */ 4218c2ecf20Sopenharmony_ci u32 ilink1; /* interrupt link */ 4228c2ecf20Sopenharmony_ci u32 ilink2; /* interrupt link */ 4238c2ecf20Sopenharmony_ci u32 data1; /* error-specific data */ 4248c2ecf20Sopenharmony_ci u32 data2; /* error-specific data */ 4258c2ecf20Sopenharmony_ci u32 line; /* source code line of error */ 4268c2ecf20Sopenharmony_ci u32 bcon_time; /* beacon timer */ 4278c2ecf20Sopenharmony_ci u32 tsf_low; /* network timestamp function timer */ 4288c2ecf20Sopenharmony_ci u32 tsf_hi; /* network timestamp function timer */ 4298c2ecf20Sopenharmony_ci u32 gp1; /* GP1 timer register */ 4308c2ecf20Sopenharmony_ci u32 gp2; /* GP2 timer register */ 4318c2ecf20Sopenharmony_ci u32 gp3; /* GP3 timer register */ 4328c2ecf20Sopenharmony_ci u32 ucode_ver; /* uCode version */ 4338c2ecf20Sopenharmony_ci u32 hw_ver; /* HW Silicon version */ 4348c2ecf20Sopenharmony_ci u32 brd_ver; /* HW board version */ 4358c2ecf20Sopenharmony_ci u32 log_pc; /* log program counter */ 4368c2ecf20Sopenharmony_ci u32 frame_ptr; /* frame pointer */ 4378c2ecf20Sopenharmony_ci u32 stack_ptr; /* stack pointer */ 4388c2ecf20Sopenharmony_ci u32 hcmd; /* last host command header */ 4398c2ecf20Sopenharmony_ci u32 isr0; /* isr status register LMPM_NIC_ISR0: 4408c2ecf20Sopenharmony_ci * rxtx_flag */ 4418c2ecf20Sopenharmony_ci u32 isr1; /* isr status register LMPM_NIC_ISR1: 4428c2ecf20Sopenharmony_ci * host_flag */ 4438c2ecf20Sopenharmony_ci u32 isr2; /* isr status register LMPM_NIC_ISR2: 4448c2ecf20Sopenharmony_ci * enc_flag */ 4458c2ecf20Sopenharmony_ci u32 isr3; /* isr status register LMPM_NIC_ISR3: 4468c2ecf20Sopenharmony_ci * time_flag */ 4478c2ecf20Sopenharmony_ci u32 isr4; /* isr status register LMPM_NIC_ISR4: 4488c2ecf20Sopenharmony_ci * wico interrupt */ 4498c2ecf20Sopenharmony_ci u32 isr_pref; /* isr status register LMPM_NIC_PREF_STAT */ 4508c2ecf20Sopenharmony_ci u32 wait_event; /* wait event() caller address */ 4518c2ecf20Sopenharmony_ci u32 l2p_control; /* L2pControlField */ 4528c2ecf20Sopenharmony_ci u32 l2p_duration; /* L2pDurationField */ 4538c2ecf20Sopenharmony_ci u32 l2p_mhvalid; /* L2pMhValidBits */ 4548c2ecf20Sopenharmony_ci u32 l2p_addr_match; /* L2pAddrMatchStat */ 4558c2ecf20Sopenharmony_ci u32 lmpm_pmg_sel; /* indicate which clocks are turned on 4568c2ecf20Sopenharmony_ci * (LMPM_PMG_SEL) */ 4578c2ecf20Sopenharmony_ci u32 u_timestamp; /* indicate when the date and time of the 4588c2ecf20Sopenharmony_ci * compilation */ 4598c2ecf20Sopenharmony_ci u32 flow_handler; /* FH read/write pointers, RX credit */ 4608c2ecf20Sopenharmony_ci} __packed; 4618c2ecf20Sopenharmony_ci 4628c2ecf20Sopenharmony_cistruct iwl_alive_resp { 4638c2ecf20Sopenharmony_ci u8 ucode_minor; 4648c2ecf20Sopenharmony_ci u8 ucode_major; 4658c2ecf20Sopenharmony_ci __le16 reserved1; 4668c2ecf20Sopenharmony_ci u8 sw_rev[8]; 4678c2ecf20Sopenharmony_ci u8 ver_type; 4688c2ecf20Sopenharmony_ci u8 ver_subtype; /* not "9" for runtime alive */ 4698c2ecf20Sopenharmony_ci __le16 reserved2; 4708c2ecf20Sopenharmony_ci __le32 log_event_table_ptr; /* SRAM address for event log */ 4718c2ecf20Sopenharmony_ci __le32 error_event_table_ptr; /* SRAM address for error log */ 4728c2ecf20Sopenharmony_ci __le32 timestamp; 4738c2ecf20Sopenharmony_ci __le32 is_valid; 4748c2ecf20Sopenharmony_ci} __packed; 4758c2ecf20Sopenharmony_ci 4768c2ecf20Sopenharmony_ci/* 4778c2ecf20Sopenharmony_ci * REPLY_ERROR = 0x2 (response only, not a command) 4788c2ecf20Sopenharmony_ci */ 4798c2ecf20Sopenharmony_cistruct iwl_error_resp { 4808c2ecf20Sopenharmony_ci __le32 error_type; 4818c2ecf20Sopenharmony_ci u8 cmd_id; 4828c2ecf20Sopenharmony_ci u8 reserved1; 4838c2ecf20Sopenharmony_ci __le16 bad_cmd_seq_num; 4848c2ecf20Sopenharmony_ci __le32 error_info; 4858c2ecf20Sopenharmony_ci __le64 timestamp; 4868c2ecf20Sopenharmony_ci} __packed; 4878c2ecf20Sopenharmony_ci 4888c2ecf20Sopenharmony_ci/****************************************************************************** 4898c2ecf20Sopenharmony_ci * (1) 4908c2ecf20Sopenharmony_ci * RXON Commands & Responses: 4918c2ecf20Sopenharmony_ci * 4928c2ecf20Sopenharmony_ci *****************************************************************************/ 4938c2ecf20Sopenharmony_ci 4948c2ecf20Sopenharmony_ci/* 4958c2ecf20Sopenharmony_ci * Rx config defines & structure 4968c2ecf20Sopenharmony_ci */ 4978c2ecf20Sopenharmony_ci/* rx_config device types */ 4988c2ecf20Sopenharmony_cienum { 4998c2ecf20Sopenharmony_ci RXON_DEV_TYPE_AP = 1, 5008c2ecf20Sopenharmony_ci RXON_DEV_TYPE_ESS = 3, 5018c2ecf20Sopenharmony_ci RXON_DEV_TYPE_IBSS = 4, 5028c2ecf20Sopenharmony_ci RXON_DEV_TYPE_SNIFFER = 6, 5038c2ecf20Sopenharmony_ci RXON_DEV_TYPE_CP = 7, 5048c2ecf20Sopenharmony_ci RXON_DEV_TYPE_2STA = 8, 5058c2ecf20Sopenharmony_ci RXON_DEV_TYPE_P2P = 9, 5068c2ecf20Sopenharmony_ci}; 5078c2ecf20Sopenharmony_ci 5088c2ecf20Sopenharmony_ci 5098c2ecf20Sopenharmony_ci#define RXON_RX_CHAIN_DRIVER_FORCE_MSK cpu_to_le16(0x1 << 0) 5108c2ecf20Sopenharmony_ci#define RXON_RX_CHAIN_DRIVER_FORCE_POS (0) 5118c2ecf20Sopenharmony_ci#define RXON_RX_CHAIN_VALID_MSK cpu_to_le16(0x7 << 1) 5128c2ecf20Sopenharmony_ci#define RXON_RX_CHAIN_VALID_POS (1) 5138c2ecf20Sopenharmony_ci#define RXON_RX_CHAIN_FORCE_SEL_MSK cpu_to_le16(0x7 << 4) 5148c2ecf20Sopenharmony_ci#define RXON_RX_CHAIN_FORCE_SEL_POS (4) 5158c2ecf20Sopenharmony_ci#define RXON_RX_CHAIN_FORCE_MIMO_SEL_MSK cpu_to_le16(0x7 << 7) 5168c2ecf20Sopenharmony_ci#define RXON_RX_CHAIN_FORCE_MIMO_SEL_POS (7) 5178c2ecf20Sopenharmony_ci#define RXON_RX_CHAIN_CNT_MSK cpu_to_le16(0x3 << 10) 5188c2ecf20Sopenharmony_ci#define RXON_RX_CHAIN_CNT_POS (10) 5198c2ecf20Sopenharmony_ci#define RXON_RX_CHAIN_MIMO_CNT_MSK cpu_to_le16(0x3 << 12) 5208c2ecf20Sopenharmony_ci#define RXON_RX_CHAIN_MIMO_CNT_POS (12) 5218c2ecf20Sopenharmony_ci#define RXON_RX_CHAIN_MIMO_FORCE_MSK cpu_to_le16(0x1 << 14) 5228c2ecf20Sopenharmony_ci#define RXON_RX_CHAIN_MIMO_FORCE_POS (14) 5238c2ecf20Sopenharmony_ci 5248c2ecf20Sopenharmony_ci/* rx_config flags */ 5258c2ecf20Sopenharmony_ci/* band & modulation selection */ 5268c2ecf20Sopenharmony_ci#define RXON_FLG_BAND_24G_MSK cpu_to_le32(1 << 0) 5278c2ecf20Sopenharmony_ci#define RXON_FLG_CCK_MSK cpu_to_le32(1 << 1) 5288c2ecf20Sopenharmony_ci/* auto detection enable */ 5298c2ecf20Sopenharmony_ci#define RXON_FLG_AUTO_DETECT_MSK cpu_to_le32(1 << 2) 5308c2ecf20Sopenharmony_ci/* TGg protection when tx */ 5318c2ecf20Sopenharmony_ci#define RXON_FLG_TGG_PROTECT_MSK cpu_to_le32(1 << 3) 5328c2ecf20Sopenharmony_ci/* cck short slot & preamble */ 5338c2ecf20Sopenharmony_ci#define RXON_FLG_SHORT_SLOT_MSK cpu_to_le32(1 << 4) 5348c2ecf20Sopenharmony_ci#define RXON_FLG_SHORT_PREAMBLE_MSK cpu_to_le32(1 << 5) 5358c2ecf20Sopenharmony_ci/* antenna selection */ 5368c2ecf20Sopenharmony_ci#define RXON_FLG_DIS_DIV_MSK cpu_to_le32(1 << 7) 5378c2ecf20Sopenharmony_ci#define RXON_FLG_ANT_SEL_MSK cpu_to_le32(0x0f00) 5388c2ecf20Sopenharmony_ci#define RXON_FLG_ANT_A_MSK cpu_to_le32(1 << 8) 5398c2ecf20Sopenharmony_ci#define RXON_FLG_ANT_B_MSK cpu_to_le32(1 << 9) 5408c2ecf20Sopenharmony_ci/* radar detection enable */ 5418c2ecf20Sopenharmony_ci#define RXON_FLG_RADAR_DETECT_MSK cpu_to_le32(1 << 12) 5428c2ecf20Sopenharmony_ci#define RXON_FLG_TGJ_NARROW_BAND_MSK cpu_to_le32(1 << 13) 5438c2ecf20Sopenharmony_ci/* rx response to host with 8-byte TSF 5448c2ecf20Sopenharmony_ci* (according to ON_AIR deassertion) */ 5458c2ecf20Sopenharmony_ci#define RXON_FLG_TSF2HOST_MSK cpu_to_le32(1 << 15) 5468c2ecf20Sopenharmony_ci 5478c2ecf20Sopenharmony_ci 5488c2ecf20Sopenharmony_ci/* HT flags */ 5498c2ecf20Sopenharmony_ci#define RXON_FLG_CTRL_CHANNEL_LOC_POS (22) 5508c2ecf20Sopenharmony_ci#define RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK cpu_to_le32(0x1 << 22) 5518c2ecf20Sopenharmony_ci 5528c2ecf20Sopenharmony_ci#define RXON_FLG_HT_OPERATING_MODE_POS (23) 5538c2ecf20Sopenharmony_ci 5548c2ecf20Sopenharmony_ci#define RXON_FLG_HT_PROT_MSK cpu_to_le32(0x1 << 23) 5558c2ecf20Sopenharmony_ci#define RXON_FLG_HT40_PROT_MSK cpu_to_le32(0x2 << 23) 5568c2ecf20Sopenharmony_ci 5578c2ecf20Sopenharmony_ci#define RXON_FLG_CHANNEL_MODE_POS (25) 5588c2ecf20Sopenharmony_ci#define RXON_FLG_CHANNEL_MODE_MSK cpu_to_le32(0x3 << 25) 5598c2ecf20Sopenharmony_ci 5608c2ecf20Sopenharmony_ci/* channel mode */ 5618c2ecf20Sopenharmony_cienum { 5628c2ecf20Sopenharmony_ci CHANNEL_MODE_LEGACY = 0, 5638c2ecf20Sopenharmony_ci CHANNEL_MODE_PURE_40 = 1, 5648c2ecf20Sopenharmony_ci CHANNEL_MODE_MIXED = 2, 5658c2ecf20Sopenharmony_ci CHANNEL_MODE_RESERVED = 3, 5668c2ecf20Sopenharmony_ci}; 5678c2ecf20Sopenharmony_ci#define RXON_FLG_CHANNEL_MODE_LEGACY cpu_to_le32(CHANNEL_MODE_LEGACY << RXON_FLG_CHANNEL_MODE_POS) 5688c2ecf20Sopenharmony_ci#define RXON_FLG_CHANNEL_MODE_PURE_40 cpu_to_le32(CHANNEL_MODE_PURE_40 << RXON_FLG_CHANNEL_MODE_POS) 5698c2ecf20Sopenharmony_ci#define RXON_FLG_CHANNEL_MODE_MIXED cpu_to_le32(CHANNEL_MODE_MIXED << RXON_FLG_CHANNEL_MODE_POS) 5708c2ecf20Sopenharmony_ci 5718c2ecf20Sopenharmony_ci/* CTS to self (if spec allows) flag */ 5728c2ecf20Sopenharmony_ci#define RXON_FLG_SELF_CTS_EN cpu_to_le32(0x1<<30) 5738c2ecf20Sopenharmony_ci 5748c2ecf20Sopenharmony_ci/* rx_config filter flags */ 5758c2ecf20Sopenharmony_ci/* accept all data frames */ 5768c2ecf20Sopenharmony_ci#define RXON_FILTER_PROMISC_MSK cpu_to_le32(1 << 0) 5778c2ecf20Sopenharmony_ci/* pass control & management to host */ 5788c2ecf20Sopenharmony_ci#define RXON_FILTER_CTL2HOST_MSK cpu_to_le32(1 << 1) 5798c2ecf20Sopenharmony_ci/* accept multi-cast */ 5808c2ecf20Sopenharmony_ci#define RXON_FILTER_ACCEPT_GRP_MSK cpu_to_le32(1 << 2) 5818c2ecf20Sopenharmony_ci/* don't decrypt uni-cast frames */ 5828c2ecf20Sopenharmony_ci#define RXON_FILTER_DIS_DECRYPT_MSK cpu_to_le32(1 << 3) 5838c2ecf20Sopenharmony_ci/* don't decrypt multi-cast frames */ 5848c2ecf20Sopenharmony_ci#define RXON_FILTER_DIS_GRP_DECRYPT_MSK cpu_to_le32(1 << 4) 5858c2ecf20Sopenharmony_ci/* STA is associated */ 5868c2ecf20Sopenharmony_ci#define RXON_FILTER_ASSOC_MSK cpu_to_le32(1 << 5) 5878c2ecf20Sopenharmony_ci/* transfer to host non bssid beacons in associated state */ 5888c2ecf20Sopenharmony_ci#define RXON_FILTER_BCON_AWARE_MSK cpu_to_le32(1 << 6) 5898c2ecf20Sopenharmony_ci 5908c2ecf20Sopenharmony_ci/** 5918c2ecf20Sopenharmony_ci * REPLY_RXON = 0x10 (command, has simple generic response) 5928c2ecf20Sopenharmony_ci * 5938c2ecf20Sopenharmony_ci * RXON tunes the radio tuner to a service channel, and sets up a number 5948c2ecf20Sopenharmony_ci * of parameters that are used primarily for Rx, but also for Tx operations. 5958c2ecf20Sopenharmony_ci * 5968c2ecf20Sopenharmony_ci * NOTE: When tuning to a new channel, driver must set the 5978c2ecf20Sopenharmony_ci * RXON_FILTER_ASSOC_MSK to 0. This will clear station-dependent 5988c2ecf20Sopenharmony_ci * info within the device, including the station tables, tx retry 5998c2ecf20Sopenharmony_ci * rate tables, and txpower tables. Driver must build a new station 6008c2ecf20Sopenharmony_ci * table and txpower table before transmitting anything on the RXON 6018c2ecf20Sopenharmony_ci * channel. 6028c2ecf20Sopenharmony_ci * 6038c2ecf20Sopenharmony_ci * NOTE: All RXONs wipe clean the internal txpower table. Driver must 6048c2ecf20Sopenharmony_ci * issue a new REPLY_TX_PWR_TABLE_CMD after each REPLY_RXON (0x10), 6058c2ecf20Sopenharmony_ci * regardless of whether RXON_FILTER_ASSOC_MSK is set. 6068c2ecf20Sopenharmony_ci */ 6078c2ecf20Sopenharmony_ci 6088c2ecf20Sopenharmony_cistruct iwl_rxon_cmd { 6098c2ecf20Sopenharmony_ci u8 node_addr[6]; 6108c2ecf20Sopenharmony_ci __le16 reserved1; 6118c2ecf20Sopenharmony_ci u8 bssid_addr[6]; 6128c2ecf20Sopenharmony_ci __le16 reserved2; 6138c2ecf20Sopenharmony_ci u8 wlap_bssid_addr[6]; 6148c2ecf20Sopenharmony_ci __le16 reserved3; 6158c2ecf20Sopenharmony_ci u8 dev_type; 6168c2ecf20Sopenharmony_ci u8 air_propagation; 6178c2ecf20Sopenharmony_ci __le16 rx_chain; 6188c2ecf20Sopenharmony_ci u8 ofdm_basic_rates; 6198c2ecf20Sopenharmony_ci u8 cck_basic_rates; 6208c2ecf20Sopenharmony_ci __le16 assoc_id; 6218c2ecf20Sopenharmony_ci __le32 flags; 6228c2ecf20Sopenharmony_ci __le32 filter_flags; 6238c2ecf20Sopenharmony_ci __le16 channel; 6248c2ecf20Sopenharmony_ci u8 ofdm_ht_single_stream_basic_rates; 6258c2ecf20Sopenharmony_ci u8 ofdm_ht_dual_stream_basic_rates; 6268c2ecf20Sopenharmony_ci u8 ofdm_ht_triple_stream_basic_rates; 6278c2ecf20Sopenharmony_ci u8 reserved5; 6288c2ecf20Sopenharmony_ci __le16 acquisition_data; 6298c2ecf20Sopenharmony_ci __le16 reserved6; 6308c2ecf20Sopenharmony_ci} __packed; 6318c2ecf20Sopenharmony_ci 6328c2ecf20Sopenharmony_ci/* 6338c2ecf20Sopenharmony_ci * REPLY_RXON_ASSOC = 0x11 (command, has simple generic response) 6348c2ecf20Sopenharmony_ci */ 6358c2ecf20Sopenharmony_cistruct iwl_rxon_assoc_cmd { 6368c2ecf20Sopenharmony_ci __le32 flags; 6378c2ecf20Sopenharmony_ci __le32 filter_flags; 6388c2ecf20Sopenharmony_ci u8 ofdm_basic_rates; 6398c2ecf20Sopenharmony_ci u8 cck_basic_rates; 6408c2ecf20Sopenharmony_ci __le16 reserved1; 6418c2ecf20Sopenharmony_ci u8 ofdm_ht_single_stream_basic_rates; 6428c2ecf20Sopenharmony_ci u8 ofdm_ht_dual_stream_basic_rates; 6438c2ecf20Sopenharmony_ci u8 ofdm_ht_triple_stream_basic_rates; 6448c2ecf20Sopenharmony_ci u8 reserved2; 6458c2ecf20Sopenharmony_ci __le16 rx_chain_select_flags; 6468c2ecf20Sopenharmony_ci __le16 acquisition_data; 6478c2ecf20Sopenharmony_ci __le32 reserved3; 6488c2ecf20Sopenharmony_ci} __packed; 6498c2ecf20Sopenharmony_ci 6508c2ecf20Sopenharmony_ci#define IWL_CONN_MAX_LISTEN_INTERVAL 10 6518c2ecf20Sopenharmony_ci#define IWL_MAX_UCODE_BEACON_INTERVAL 4 /* 4096 */ 6528c2ecf20Sopenharmony_ci 6538c2ecf20Sopenharmony_ci/* 6548c2ecf20Sopenharmony_ci * REPLY_RXON_TIMING = 0x14 (command, has simple generic response) 6558c2ecf20Sopenharmony_ci */ 6568c2ecf20Sopenharmony_cistruct iwl_rxon_time_cmd { 6578c2ecf20Sopenharmony_ci __le64 timestamp; 6588c2ecf20Sopenharmony_ci __le16 beacon_interval; 6598c2ecf20Sopenharmony_ci __le16 atim_window; 6608c2ecf20Sopenharmony_ci __le32 beacon_init_val; 6618c2ecf20Sopenharmony_ci __le16 listen_interval; 6628c2ecf20Sopenharmony_ci u8 dtim_period; 6638c2ecf20Sopenharmony_ci u8 delta_cp_bss_tbtts; 6648c2ecf20Sopenharmony_ci} __packed; 6658c2ecf20Sopenharmony_ci 6668c2ecf20Sopenharmony_ci/* 6678c2ecf20Sopenharmony_ci * REPLY_CHANNEL_SWITCH = 0x72 (command, has simple generic response) 6688c2ecf20Sopenharmony_ci */ 6698c2ecf20Sopenharmony_ci/** 6708c2ecf20Sopenharmony_ci * struct iwl5000_channel_switch_cmd 6718c2ecf20Sopenharmony_ci * @band: 0- 5.2GHz, 1- 2.4GHz 6728c2ecf20Sopenharmony_ci * @expect_beacon: 0- resume transmits after channel switch 6738c2ecf20Sopenharmony_ci * 1- wait for beacon to resume transmits 6748c2ecf20Sopenharmony_ci * @channel: new channel number 6758c2ecf20Sopenharmony_ci * @rxon_flags: Rx on flags 6768c2ecf20Sopenharmony_ci * @rxon_filter_flags: filtering parameters 6778c2ecf20Sopenharmony_ci * @switch_time: switch time in extended beacon format 6788c2ecf20Sopenharmony_ci * @reserved: reserved bytes 6798c2ecf20Sopenharmony_ci */ 6808c2ecf20Sopenharmony_cistruct iwl5000_channel_switch_cmd { 6818c2ecf20Sopenharmony_ci u8 band; 6828c2ecf20Sopenharmony_ci u8 expect_beacon; 6838c2ecf20Sopenharmony_ci __le16 channel; 6848c2ecf20Sopenharmony_ci __le32 rxon_flags; 6858c2ecf20Sopenharmony_ci __le32 rxon_filter_flags; 6868c2ecf20Sopenharmony_ci __le32 switch_time; 6878c2ecf20Sopenharmony_ci __le32 reserved[2][IWL_PWR_NUM_HT_OFDM_ENTRIES + IWL_PWR_CCK_ENTRIES]; 6888c2ecf20Sopenharmony_ci} __packed; 6898c2ecf20Sopenharmony_ci 6908c2ecf20Sopenharmony_ci/** 6918c2ecf20Sopenharmony_ci * struct iwl6000_channel_switch_cmd 6928c2ecf20Sopenharmony_ci * @band: 0- 5.2GHz, 1- 2.4GHz 6938c2ecf20Sopenharmony_ci * @expect_beacon: 0- resume transmits after channel switch 6948c2ecf20Sopenharmony_ci * 1- wait for beacon to resume transmits 6958c2ecf20Sopenharmony_ci * @channel: new channel number 6968c2ecf20Sopenharmony_ci * @rxon_flags: Rx on flags 6978c2ecf20Sopenharmony_ci * @rxon_filter_flags: filtering parameters 6988c2ecf20Sopenharmony_ci * @switch_time: switch time in extended beacon format 6998c2ecf20Sopenharmony_ci * @reserved: reserved bytes 7008c2ecf20Sopenharmony_ci */ 7018c2ecf20Sopenharmony_cistruct iwl6000_channel_switch_cmd { 7028c2ecf20Sopenharmony_ci u8 band; 7038c2ecf20Sopenharmony_ci u8 expect_beacon; 7048c2ecf20Sopenharmony_ci __le16 channel; 7058c2ecf20Sopenharmony_ci __le32 rxon_flags; 7068c2ecf20Sopenharmony_ci __le32 rxon_filter_flags; 7078c2ecf20Sopenharmony_ci __le32 switch_time; 7088c2ecf20Sopenharmony_ci __le32 reserved[3][IWL_PWR_NUM_HT_OFDM_ENTRIES + IWL_PWR_CCK_ENTRIES]; 7098c2ecf20Sopenharmony_ci} __packed; 7108c2ecf20Sopenharmony_ci 7118c2ecf20Sopenharmony_ci/* 7128c2ecf20Sopenharmony_ci * CHANNEL_SWITCH_NOTIFICATION = 0x73 (notification only, not a command) 7138c2ecf20Sopenharmony_ci */ 7148c2ecf20Sopenharmony_cistruct iwl_csa_notification { 7158c2ecf20Sopenharmony_ci __le16 band; 7168c2ecf20Sopenharmony_ci __le16 channel; 7178c2ecf20Sopenharmony_ci __le32 status; /* 0 - OK, 1 - fail */ 7188c2ecf20Sopenharmony_ci} __packed; 7198c2ecf20Sopenharmony_ci 7208c2ecf20Sopenharmony_ci/****************************************************************************** 7218c2ecf20Sopenharmony_ci * (2) 7228c2ecf20Sopenharmony_ci * Quality-of-Service (QOS) Commands & Responses: 7238c2ecf20Sopenharmony_ci * 7248c2ecf20Sopenharmony_ci *****************************************************************************/ 7258c2ecf20Sopenharmony_ci 7268c2ecf20Sopenharmony_ci/** 7278c2ecf20Sopenharmony_ci * struct iwl_ac_qos -- QOS timing params for REPLY_QOS_PARAM 7288c2ecf20Sopenharmony_ci * One for each of 4 EDCA access categories in struct iwl_qosparam_cmd 7298c2ecf20Sopenharmony_ci * 7308c2ecf20Sopenharmony_ci * @cw_min: Contention window, start value in numbers of slots. 7318c2ecf20Sopenharmony_ci * Should be a power-of-2, minus 1. Device's default is 0x0f. 7328c2ecf20Sopenharmony_ci * @cw_max: Contention window, max value in numbers of slots. 7338c2ecf20Sopenharmony_ci * Should be a power-of-2, minus 1. Device's default is 0x3f. 7348c2ecf20Sopenharmony_ci * @aifsn: Number of slots in Arbitration Interframe Space (before 7358c2ecf20Sopenharmony_ci * performing random backoff timing prior to Tx). Device default 1. 7368c2ecf20Sopenharmony_ci * @edca_txop: Length of Tx opportunity, in uSecs. Device default is 0. 7378c2ecf20Sopenharmony_ci * 7388c2ecf20Sopenharmony_ci * Device will automatically increase contention window by (2*CW) + 1 for each 7398c2ecf20Sopenharmony_ci * transmission retry. Device uses cw_max as a bit mask, ANDed with new CW 7408c2ecf20Sopenharmony_ci * value, to cap the CW value. 7418c2ecf20Sopenharmony_ci */ 7428c2ecf20Sopenharmony_cistruct iwl_ac_qos { 7438c2ecf20Sopenharmony_ci __le16 cw_min; 7448c2ecf20Sopenharmony_ci __le16 cw_max; 7458c2ecf20Sopenharmony_ci u8 aifsn; 7468c2ecf20Sopenharmony_ci u8 reserved1; 7478c2ecf20Sopenharmony_ci __le16 edca_txop; 7488c2ecf20Sopenharmony_ci} __packed; 7498c2ecf20Sopenharmony_ci 7508c2ecf20Sopenharmony_ci/* QoS flags defines */ 7518c2ecf20Sopenharmony_ci#define QOS_PARAM_FLG_UPDATE_EDCA_MSK cpu_to_le32(0x01) 7528c2ecf20Sopenharmony_ci#define QOS_PARAM_FLG_TGN_MSK cpu_to_le32(0x02) 7538c2ecf20Sopenharmony_ci#define QOS_PARAM_FLG_TXOP_TYPE_MSK cpu_to_le32(0x10) 7548c2ecf20Sopenharmony_ci 7558c2ecf20Sopenharmony_ci/* Number of Access Categories (AC) (EDCA), queues 0..3 */ 7568c2ecf20Sopenharmony_ci#define AC_NUM 4 7578c2ecf20Sopenharmony_ci 7588c2ecf20Sopenharmony_ci/* 7598c2ecf20Sopenharmony_ci * REPLY_QOS_PARAM = 0x13 (command, has simple generic response) 7608c2ecf20Sopenharmony_ci * 7618c2ecf20Sopenharmony_ci * This command sets up timings for each of the 4 prioritized EDCA Tx FIFOs 7628c2ecf20Sopenharmony_ci * 0: Background, 1: Best Effort, 2: Video, 3: Voice. 7638c2ecf20Sopenharmony_ci */ 7648c2ecf20Sopenharmony_cistruct iwl_qosparam_cmd { 7658c2ecf20Sopenharmony_ci __le32 qos_flags; 7668c2ecf20Sopenharmony_ci struct iwl_ac_qos ac[AC_NUM]; 7678c2ecf20Sopenharmony_ci} __packed; 7688c2ecf20Sopenharmony_ci 7698c2ecf20Sopenharmony_ci/****************************************************************************** 7708c2ecf20Sopenharmony_ci * (3) 7718c2ecf20Sopenharmony_ci * Add/Modify Stations Commands & Responses: 7728c2ecf20Sopenharmony_ci * 7738c2ecf20Sopenharmony_ci *****************************************************************************/ 7748c2ecf20Sopenharmony_ci/* 7758c2ecf20Sopenharmony_ci * Multi station support 7768c2ecf20Sopenharmony_ci */ 7778c2ecf20Sopenharmony_ci 7788c2ecf20Sopenharmony_ci/* Special, dedicated locations within device's station table */ 7798c2ecf20Sopenharmony_ci#define IWL_AP_ID 0 7808c2ecf20Sopenharmony_ci#define IWL_AP_ID_PAN 1 7818c2ecf20Sopenharmony_ci#define IWL_STA_ID 2 7828c2ecf20Sopenharmony_ci#define IWLAGN_PAN_BCAST_ID 14 7838c2ecf20Sopenharmony_ci#define IWLAGN_BROADCAST_ID 15 7848c2ecf20Sopenharmony_ci#define IWLAGN_STATION_COUNT 16 7858c2ecf20Sopenharmony_ci 7868c2ecf20Sopenharmony_ci#define IWL_TID_NON_QOS IWL_MAX_TID_COUNT 7878c2ecf20Sopenharmony_ci 7888c2ecf20Sopenharmony_ci#define STA_FLG_TX_RATE_MSK cpu_to_le32(1 << 2) 7898c2ecf20Sopenharmony_ci#define STA_FLG_PWR_SAVE_MSK cpu_to_le32(1 << 8) 7908c2ecf20Sopenharmony_ci#define STA_FLG_PAN_STATION cpu_to_le32(1 << 13) 7918c2ecf20Sopenharmony_ci#define STA_FLG_RTS_MIMO_PROT_MSK cpu_to_le32(1 << 17) 7928c2ecf20Sopenharmony_ci#define STA_FLG_AGG_MPDU_8US_MSK cpu_to_le32(1 << 18) 7938c2ecf20Sopenharmony_ci#define STA_FLG_MAX_AGG_SIZE_POS (19) 7948c2ecf20Sopenharmony_ci#define STA_FLG_MAX_AGG_SIZE_MSK cpu_to_le32(3 << 19) 7958c2ecf20Sopenharmony_ci#define STA_FLG_HT40_EN_MSK cpu_to_le32(1 << 21) 7968c2ecf20Sopenharmony_ci#define STA_FLG_MIMO_DIS_MSK cpu_to_le32(1 << 22) 7978c2ecf20Sopenharmony_ci#define STA_FLG_AGG_MPDU_DENSITY_POS (23) 7988c2ecf20Sopenharmony_ci#define STA_FLG_AGG_MPDU_DENSITY_MSK cpu_to_le32(7 << 23) 7998c2ecf20Sopenharmony_ci 8008c2ecf20Sopenharmony_ci/* Use in mode field. 1: modify existing entry, 0: add new station entry */ 8018c2ecf20Sopenharmony_ci#define STA_CONTROL_MODIFY_MSK 0x01 8028c2ecf20Sopenharmony_ci 8038c2ecf20Sopenharmony_ci/* key flags __le16*/ 8048c2ecf20Sopenharmony_ci#define STA_KEY_FLG_ENCRYPT_MSK cpu_to_le16(0x0007) 8058c2ecf20Sopenharmony_ci#define STA_KEY_FLG_NO_ENC cpu_to_le16(0x0000) 8068c2ecf20Sopenharmony_ci#define STA_KEY_FLG_WEP cpu_to_le16(0x0001) 8078c2ecf20Sopenharmony_ci#define STA_KEY_FLG_CCMP cpu_to_le16(0x0002) 8088c2ecf20Sopenharmony_ci#define STA_KEY_FLG_TKIP cpu_to_le16(0x0003) 8098c2ecf20Sopenharmony_ci 8108c2ecf20Sopenharmony_ci#define STA_KEY_FLG_KEYID_POS 8 8118c2ecf20Sopenharmony_ci#define STA_KEY_FLG_INVALID cpu_to_le16(0x0800) 8128c2ecf20Sopenharmony_ci/* wep key is either from global key (0) or from station info array (1) */ 8138c2ecf20Sopenharmony_ci#define STA_KEY_FLG_MAP_KEY_MSK cpu_to_le16(0x0008) 8148c2ecf20Sopenharmony_ci 8158c2ecf20Sopenharmony_ci/* wep key in STA: 5-bytes (0) or 13-bytes (1) */ 8168c2ecf20Sopenharmony_ci#define STA_KEY_FLG_KEY_SIZE_MSK cpu_to_le16(0x1000) 8178c2ecf20Sopenharmony_ci#define STA_KEY_MULTICAST_MSK cpu_to_le16(0x4000) 8188c2ecf20Sopenharmony_ci#define STA_KEY_MAX_NUM 8 8198c2ecf20Sopenharmony_ci#define STA_KEY_MAX_NUM_PAN 16 8208c2ecf20Sopenharmony_ci/* must not match WEP_INVALID_OFFSET */ 8218c2ecf20Sopenharmony_ci#define IWLAGN_HW_KEY_DEFAULT 0xfe 8228c2ecf20Sopenharmony_ci 8238c2ecf20Sopenharmony_ci/* Flags indicate whether to modify vs. don't change various station params */ 8248c2ecf20Sopenharmony_ci#define STA_MODIFY_KEY_MASK 0x01 8258c2ecf20Sopenharmony_ci#define STA_MODIFY_TID_DISABLE_TX 0x02 8268c2ecf20Sopenharmony_ci#define STA_MODIFY_TX_RATE_MSK 0x04 8278c2ecf20Sopenharmony_ci#define STA_MODIFY_ADDBA_TID_MSK 0x08 8288c2ecf20Sopenharmony_ci#define STA_MODIFY_DELBA_TID_MSK 0x10 8298c2ecf20Sopenharmony_ci#define STA_MODIFY_SLEEP_TX_COUNT_MSK 0x20 8308c2ecf20Sopenharmony_ci 8318c2ecf20Sopenharmony_ci/* agn */ 8328c2ecf20Sopenharmony_cistruct iwl_keyinfo { 8338c2ecf20Sopenharmony_ci __le16 key_flags; 8348c2ecf20Sopenharmony_ci u8 tkip_rx_tsc_byte2; /* TSC[2] for key mix ph1 detection */ 8358c2ecf20Sopenharmony_ci u8 reserved1; 8368c2ecf20Sopenharmony_ci __le16 tkip_rx_ttak[5]; /* 10-byte unicast TKIP TTAK */ 8378c2ecf20Sopenharmony_ci u8 key_offset; 8388c2ecf20Sopenharmony_ci u8 reserved2; 8398c2ecf20Sopenharmony_ci u8 key[16]; /* 16-byte unicast decryption key */ 8408c2ecf20Sopenharmony_ci __le64 tx_secur_seq_cnt; 8418c2ecf20Sopenharmony_ci __le64 hw_tkip_mic_rx_key; 8428c2ecf20Sopenharmony_ci __le64 hw_tkip_mic_tx_key; 8438c2ecf20Sopenharmony_ci} __packed; 8448c2ecf20Sopenharmony_ci 8458c2ecf20Sopenharmony_ci/** 8468c2ecf20Sopenharmony_ci * struct sta_id_modify 8478c2ecf20Sopenharmony_ci * @addr[ETH_ALEN]: station's MAC address 8488c2ecf20Sopenharmony_ci * @sta_id: index of station in uCode's station table 8498c2ecf20Sopenharmony_ci * @modify_mask: STA_MODIFY_*, 1: modify, 0: don't change 8508c2ecf20Sopenharmony_ci * 8518c2ecf20Sopenharmony_ci * Driver selects unused table index when adding new station, 8528c2ecf20Sopenharmony_ci * or the index to a pre-existing station entry when modifying that station. 8538c2ecf20Sopenharmony_ci * Some indexes have special purposes (IWL_AP_ID, index 0, is for AP). 8548c2ecf20Sopenharmony_ci * 8558c2ecf20Sopenharmony_ci * modify_mask flags select which parameters to modify vs. leave alone. 8568c2ecf20Sopenharmony_ci */ 8578c2ecf20Sopenharmony_cistruct sta_id_modify { 8588c2ecf20Sopenharmony_ci u8 addr[ETH_ALEN]; 8598c2ecf20Sopenharmony_ci __le16 reserved1; 8608c2ecf20Sopenharmony_ci u8 sta_id; 8618c2ecf20Sopenharmony_ci u8 modify_mask; 8628c2ecf20Sopenharmony_ci __le16 reserved2; 8638c2ecf20Sopenharmony_ci} __packed; 8648c2ecf20Sopenharmony_ci 8658c2ecf20Sopenharmony_ci/* 8668c2ecf20Sopenharmony_ci * REPLY_ADD_STA = 0x18 (command) 8678c2ecf20Sopenharmony_ci * 8688c2ecf20Sopenharmony_ci * The device contains an internal table of per-station information, 8698c2ecf20Sopenharmony_ci * with info on security keys, aggregation parameters, and Tx rates for 8708c2ecf20Sopenharmony_ci * initial Tx attempt and any retries (agn devices uses 8718c2ecf20Sopenharmony_ci * REPLY_TX_LINK_QUALITY_CMD, 8728c2ecf20Sopenharmony_ci * 8738c2ecf20Sopenharmony_ci * REPLY_ADD_STA sets up the table entry for one station, either creating 8748c2ecf20Sopenharmony_ci * a new entry, or modifying a pre-existing one. 8758c2ecf20Sopenharmony_ci * 8768c2ecf20Sopenharmony_ci * NOTE: RXON command (without "associated" bit set) wipes the station table 8778c2ecf20Sopenharmony_ci * clean. Moving into RF_KILL state does this also. Driver must set up 8788c2ecf20Sopenharmony_ci * new station table before transmitting anything on the RXON channel 8798c2ecf20Sopenharmony_ci * (except active scans or active measurements; those commands carry 8808c2ecf20Sopenharmony_ci * their own txpower/rate setup data). 8818c2ecf20Sopenharmony_ci * 8828c2ecf20Sopenharmony_ci * When getting started on a new channel, driver must set up the 8838c2ecf20Sopenharmony_ci * IWL_BROADCAST_ID entry (last entry in the table). For a client 8848c2ecf20Sopenharmony_ci * station in a BSS, once an AP is selected, driver sets up the AP STA 8858c2ecf20Sopenharmony_ci * in the IWL_AP_ID entry (1st entry in the table). BROADCAST and AP 8868c2ecf20Sopenharmony_ci * are all that are needed for a BSS client station. If the device is 8878c2ecf20Sopenharmony_ci * used as AP, or in an IBSS network, driver must set up station table 8888c2ecf20Sopenharmony_ci * entries for all STAs in network, starting with index IWL_STA_ID. 8898c2ecf20Sopenharmony_ci */ 8908c2ecf20Sopenharmony_ci 8918c2ecf20Sopenharmony_cistruct iwl_addsta_cmd { 8928c2ecf20Sopenharmony_ci u8 mode; /* 1: modify existing, 0: add new station */ 8938c2ecf20Sopenharmony_ci u8 reserved[3]; 8948c2ecf20Sopenharmony_ci struct sta_id_modify sta; 8958c2ecf20Sopenharmony_ci struct iwl_keyinfo key; 8968c2ecf20Sopenharmony_ci __le32 station_flags; /* STA_FLG_* */ 8978c2ecf20Sopenharmony_ci __le32 station_flags_msk; /* STA_FLG_* */ 8988c2ecf20Sopenharmony_ci 8998c2ecf20Sopenharmony_ci /* bit field to disable (1) or enable (0) Tx for Traffic ID (TID) 9008c2ecf20Sopenharmony_ci * corresponding to bit (e.g. bit 5 controls TID 5). 9018c2ecf20Sopenharmony_ci * Set modify_mask bit STA_MODIFY_TID_DISABLE_TX to use this field. */ 9028c2ecf20Sopenharmony_ci __le16 tid_disable_tx; 9038c2ecf20Sopenharmony_ci __le16 legacy_reserved; 9048c2ecf20Sopenharmony_ci 9058c2ecf20Sopenharmony_ci /* TID for which to add block-ack support. 9068c2ecf20Sopenharmony_ci * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */ 9078c2ecf20Sopenharmony_ci u8 add_immediate_ba_tid; 9088c2ecf20Sopenharmony_ci 9098c2ecf20Sopenharmony_ci /* TID for which to remove block-ack support. 9108c2ecf20Sopenharmony_ci * Set modify_mask bit STA_MODIFY_DELBA_TID_MSK to use this field. */ 9118c2ecf20Sopenharmony_ci u8 remove_immediate_ba_tid; 9128c2ecf20Sopenharmony_ci 9138c2ecf20Sopenharmony_ci /* Starting Sequence Number for added block-ack support. 9148c2ecf20Sopenharmony_ci * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */ 9158c2ecf20Sopenharmony_ci __le16 add_immediate_ba_ssn; 9168c2ecf20Sopenharmony_ci 9178c2ecf20Sopenharmony_ci /* 9188c2ecf20Sopenharmony_ci * Number of packets OK to transmit to station even though 9198c2ecf20Sopenharmony_ci * it is asleep -- used to synchronise PS-poll and u-APSD 9208c2ecf20Sopenharmony_ci * responses while ucode keeps track of STA sleep state. 9218c2ecf20Sopenharmony_ci */ 9228c2ecf20Sopenharmony_ci __le16 sleep_tx_count; 9238c2ecf20Sopenharmony_ci 9248c2ecf20Sopenharmony_ci __le16 reserved2; 9258c2ecf20Sopenharmony_ci} __packed; 9268c2ecf20Sopenharmony_ci 9278c2ecf20Sopenharmony_ci 9288c2ecf20Sopenharmony_ci#define ADD_STA_SUCCESS_MSK 0x1 9298c2ecf20Sopenharmony_ci#define ADD_STA_NO_ROOM_IN_TABLE 0x2 9308c2ecf20Sopenharmony_ci#define ADD_STA_NO_BLOCK_ACK_RESOURCE 0x4 9318c2ecf20Sopenharmony_ci#define ADD_STA_MODIFY_NON_EXIST_STA 0x8 9328c2ecf20Sopenharmony_ci/* 9338c2ecf20Sopenharmony_ci * REPLY_ADD_STA = 0x18 (response) 9348c2ecf20Sopenharmony_ci */ 9358c2ecf20Sopenharmony_cistruct iwl_add_sta_resp { 9368c2ecf20Sopenharmony_ci u8 status; /* ADD_STA_* */ 9378c2ecf20Sopenharmony_ci} __packed; 9388c2ecf20Sopenharmony_ci 9398c2ecf20Sopenharmony_ci#define REM_STA_SUCCESS_MSK 0x1 9408c2ecf20Sopenharmony_ci/* 9418c2ecf20Sopenharmony_ci * REPLY_REM_STA = 0x19 (response) 9428c2ecf20Sopenharmony_ci */ 9438c2ecf20Sopenharmony_cistruct iwl_rem_sta_resp { 9448c2ecf20Sopenharmony_ci u8 status; 9458c2ecf20Sopenharmony_ci} __packed; 9468c2ecf20Sopenharmony_ci 9478c2ecf20Sopenharmony_ci/* 9488c2ecf20Sopenharmony_ci * REPLY_REM_STA = 0x19 (command) 9498c2ecf20Sopenharmony_ci */ 9508c2ecf20Sopenharmony_cistruct iwl_rem_sta_cmd { 9518c2ecf20Sopenharmony_ci u8 num_sta; /* number of removed stations */ 9528c2ecf20Sopenharmony_ci u8 reserved[3]; 9538c2ecf20Sopenharmony_ci u8 addr[ETH_ALEN]; /* MAC addr of the first station */ 9548c2ecf20Sopenharmony_ci u8 reserved2[2]; 9558c2ecf20Sopenharmony_ci} __packed; 9568c2ecf20Sopenharmony_ci 9578c2ecf20Sopenharmony_ci 9588c2ecf20Sopenharmony_ci/* WiFi queues mask */ 9598c2ecf20Sopenharmony_ci#define IWL_SCD_BK_MSK BIT(0) 9608c2ecf20Sopenharmony_ci#define IWL_SCD_BE_MSK BIT(1) 9618c2ecf20Sopenharmony_ci#define IWL_SCD_VI_MSK BIT(2) 9628c2ecf20Sopenharmony_ci#define IWL_SCD_VO_MSK BIT(3) 9638c2ecf20Sopenharmony_ci#define IWL_SCD_MGMT_MSK BIT(3) 9648c2ecf20Sopenharmony_ci 9658c2ecf20Sopenharmony_ci/* PAN queues mask */ 9668c2ecf20Sopenharmony_ci#define IWL_PAN_SCD_BK_MSK BIT(4) 9678c2ecf20Sopenharmony_ci#define IWL_PAN_SCD_BE_MSK BIT(5) 9688c2ecf20Sopenharmony_ci#define IWL_PAN_SCD_VI_MSK BIT(6) 9698c2ecf20Sopenharmony_ci#define IWL_PAN_SCD_VO_MSK BIT(7) 9708c2ecf20Sopenharmony_ci#define IWL_PAN_SCD_MGMT_MSK BIT(7) 9718c2ecf20Sopenharmony_ci#define IWL_PAN_SCD_MULTICAST_MSK BIT(8) 9728c2ecf20Sopenharmony_ci 9738c2ecf20Sopenharmony_ci#define IWL_AGG_TX_QUEUE_MSK 0xffc00 9748c2ecf20Sopenharmony_ci 9758c2ecf20Sopenharmony_ci#define IWL_DROP_ALL BIT(1) 9768c2ecf20Sopenharmony_ci 9778c2ecf20Sopenharmony_ci/* 9788c2ecf20Sopenharmony_ci * REPLY_TXFIFO_FLUSH = 0x1e(command and response) 9798c2ecf20Sopenharmony_ci * 9808c2ecf20Sopenharmony_ci * When using full FIFO flush this command checks the scheduler HW block WR/RD 9818c2ecf20Sopenharmony_ci * pointers to check if all the frames were transferred by DMA into the 9828c2ecf20Sopenharmony_ci * relevant TX FIFO queue. Only when the DMA is finished and the queue is 9838c2ecf20Sopenharmony_ci * empty the command can finish. 9848c2ecf20Sopenharmony_ci * This command is used to flush the TXFIFO from transmit commands, it may 9858c2ecf20Sopenharmony_ci * operate on single or multiple queues, the command queue can't be flushed by 9868c2ecf20Sopenharmony_ci * this command. The command response is returned when all the queue flush 9878c2ecf20Sopenharmony_ci * operations are done. Each TX command flushed return response with the FLUSH 9888c2ecf20Sopenharmony_ci * status set in the TX response status. When FIFO flush operation is used, 9898c2ecf20Sopenharmony_ci * the flush operation ends when both the scheduler DMA done and TXFIFO empty 9908c2ecf20Sopenharmony_ci * are set. 9918c2ecf20Sopenharmony_ci * 9928c2ecf20Sopenharmony_ci * @queue_control: bit mask for which queues to flush 9938c2ecf20Sopenharmony_ci * @flush_control: flush controls 9948c2ecf20Sopenharmony_ci * 0: Dump single MSDU 9958c2ecf20Sopenharmony_ci * 1: Dump multiple MSDU according to PS, INVALID STA, TTL, TID disable. 9968c2ecf20Sopenharmony_ci * 2: Dump all FIFO 9978c2ecf20Sopenharmony_ci */ 9988c2ecf20Sopenharmony_cistruct iwl_txfifo_flush_cmd_v3 { 9998c2ecf20Sopenharmony_ci __le32 queue_control; 10008c2ecf20Sopenharmony_ci __le16 flush_control; 10018c2ecf20Sopenharmony_ci __le16 reserved; 10028c2ecf20Sopenharmony_ci} __packed; 10038c2ecf20Sopenharmony_ci 10048c2ecf20Sopenharmony_cistruct iwl_txfifo_flush_cmd_v2 { 10058c2ecf20Sopenharmony_ci __le16 queue_control; 10068c2ecf20Sopenharmony_ci __le16 flush_control; 10078c2ecf20Sopenharmony_ci} __packed; 10088c2ecf20Sopenharmony_ci 10098c2ecf20Sopenharmony_ci/* 10108c2ecf20Sopenharmony_ci * REPLY_WEP_KEY = 0x20 10118c2ecf20Sopenharmony_ci */ 10128c2ecf20Sopenharmony_cistruct iwl_wep_key { 10138c2ecf20Sopenharmony_ci u8 key_index; 10148c2ecf20Sopenharmony_ci u8 key_offset; 10158c2ecf20Sopenharmony_ci u8 reserved1[2]; 10168c2ecf20Sopenharmony_ci u8 key_size; 10178c2ecf20Sopenharmony_ci u8 reserved2[3]; 10188c2ecf20Sopenharmony_ci u8 key[16]; 10198c2ecf20Sopenharmony_ci} __packed; 10208c2ecf20Sopenharmony_ci 10218c2ecf20Sopenharmony_cistruct iwl_wep_cmd { 10228c2ecf20Sopenharmony_ci u8 num_keys; 10238c2ecf20Sopenharmony_ci u8 global_key_type; 10248c2ecf20Sopenharmony_ci u8 flags; 10258c2ecf20Sopenharmony_ci u8 reserved; 10268c2ecf20Sopenharmony_ci struct iwl_wep_key key[]; 10278c2ecf20Sopenharmony_ci} __packed; 10288c2ecf20Sopenharmony_ci 10298c2ecf20Sopenharmony_ci#define WEP_KEY_WEP_TYPE 1 10308c2ecf20Sopenharmony_ci#define WEP_KEYS_MAX 4 10318c2ecf20Sopenharmony_ci#define WEP_INVALID_OFFSET 0xff 10328c2ecf20Sopenharmony_ci#define WEP_KEY_LEN_64 5 10338c2ecf20Sopenharmony_ci#define WEP_KEY_LEN_128 13 10348c2ecf20Sopenharmony_ci 10358c2ecf20Sopenharmony_ci/****************************************************************************** 10368c2ecf20Sopenharmony_ci * (4) 10378c2ecf20Sopenharmony_ci * Rx Responses: 10388c2ecf20Sopenharmony_ci * 10398c2ecf20Sopenharmony_ci *****************************************************************************/ 10408c2ecf20Sopenharmony_ci 10418c2ecf20Sopenharmony_ci#define RX_RES_STATUS_NO_CRC32_ERROR cpu_to_le32(1 << 0) 10428c2ecf20Sopenharmony_ci#define RX_RES_STATUS_NO_RXE_OVERFLOW cpu_to_le32(1 << 1) 10438c2ecf20Sopenharmony_ci 10448c2ecf20Sopenharmony_ci#define RX_RES_PHY_FLAGS_BAND_24_MSK cpu_to_le16(1 << 0) 10458c2ecf20Sopenharmony_ci#define RX_RES_PHY_FLAGS_MOD_CCK_MSK cpu_to_le16(1 << 1) 10468c2ecf20Sopenharmony_ci#define RX_RES_PHY_FLAGS_SHORT_PREAMBLE_MSK cpu_to_le16(1 << 2) 10478c2ecf20Sopenharmony_ci#define RX_RES_PHY_FLAGS_NARROW_BAND_MSK cpu_to_le16(1 << 3) 10488c2ecf20Sopenharmony_ci#define RX_RES_PHY_FLAGS_ANTENNA_MSK 0x70 10498c2ecf20Sopenharmony_ci#define RX_RES_PHY_FLAGS_ANTENNA_POS 4 10508c2ecf20Sopenharmony_ci#define RX_RES_PHY_FLAGS_AGG_MSK cpu_to_le16(1 << 7) 10518c2ecf20Sopenharmony_ci 10528c2ecf20Sopenharmony_ci#define RX_RES_STATUS_SEC_TYPE_MSK (0x7 << 8) 10538c2ecf20Sopenharmony_ci#define RX_RES_STATUS_SEC_TYPE_NONE (0x0 << 8) 10548c2ecf20Sopenharmony_ci#define RX_RES_STATUS_SEC_TYPE_WEP (0x1 << 8) 10558c2ecf20Sopenharmony_ci#define RX_RES_STATUS_SEC_TYPE_CCMP (0x2 << 8) 10568c2ecf20Sopenharmony_ci#define RX_RES_STATUS_SEC_TYPE_TKIP (0x3 << 8) 10578c2ecf20Sopenharmony_ci#define RX_RES_STATUS_SEC_TYPE_ERR (0x7 << 8) 10588c2ecf20Sopenharmony_ci 10598c2ecf20Sopenharmony_ci#define RX_RES_STATUS_STATION_FOUND (1<<6) 10608c2ecf20Sopenharmony_ci#define RX_RES_STATUS_NO_STATION_INFO_MISMATCH (1<<7) 10618c2ecf20Sopenharmony_ci 10628c2ecf20Sopenharmony_ci#define RX_RES_STATUS_DECRYPT_TYPE_MSK (0x3 << 11) 10638c2ecf20Sopenharmony_ci#define RX_RES_STATUS_NOT_DECRYPT (0x0 << 11) 10648c2ecf20Sopenharmony_ci#define RX_RES_STATUS_DECRYPT_OK (0x3 << 11) 10658c2ecf20Sopenharmony_ci#define RX_RES_STATUS_BAD_ICV_MIC (0x1 << 11) 10668c2ecf20Sopenharmony_ci#define RX_RES_STATUS_BAD_KEY_TTAK (0x2 << 11) 10678c2ecf20Sopenharmony_ci 10688c2ecf20Sopenharmony_ci#define RX_MPDU_RES_STATUS_ICV_OK (0x20) 10698c2ecf20Sopenharmony_ci#define RX_MPDU_RES_STATUS_MIC_OK (0x40) 10708c2ecf20Sopenharmony_ci#define RX_MPDU_RES_STATUS_TTAK_OK (1 << 7) 10718c2ecf20Sopenharmony_ci#define RX_MPDU_RES_STATUS_DEC_DONE_MSK (0x800) 10728c2ecf20Sopenharmony_ci 10738c2ecf20Sopenharmony_ci 10748c2ecf20Sopenharmony_ci#define IWLAGN_RX_RES_PHY_CNT 8 10758c2ecf20Sopenharmony_ci#define IWLAGN_RX_RES_AGC_IDX 1 10768c2ecf20Sopenharmony_ci#define IWLAGN_RX_RES_RSSI_AB_IDX 2 10778c2ecf20Sopenharmony_ci#define IWLAGN_RX_RES_RSSI_C_IDX 3 10788c2ecf20Sopenharmony_ci#define IWLAGN_OFDM_AGC_MSK 0xfe00 10798c2ecf20Sopenharmony_ci#define IWLAGN_OFDM_AGC_BIT_POS 9 10808c2ecf20Sopenharmony_ci#define IWLAGN_OFDM_RSSI_INBAND_A_BITMSK 0x00ff 10818c2ecf20Sopenharmony_ci#define IWLAGN_OFDM_RSSI_ALLBAND_A_BITMSK 0xff00 10828c2ecf20Sopenharmony_ci#define IWLAGN_OFDM_RSSI_A_BIT_POS 0 10838c2ecf20Sopenharmony_ci#define IWLAGN_OFDM_RSSI_INBAND_B_BITMSK 0xff0000 10848c2ecf20Sopenharmony_ci#define IWLAGN_OFDM_RSSI_ALLBAND_B_BITMSK 0xff000000 10858c2ecf20Sopenharmony_ci#define IWLAGN_OFDM_RSSI_B_BIT_POS 16 10868c2ecf20Sopenharmony_ci#define IWLAGN_OFDM_RSSI_INBAND_C_BITMSK 0x00ff 10878c2ecf20Sopenharmony_ci#define IWLAGN_OFDM_RSSI_ALLBAND_C_BITMSK 0xff00 10888c2ecf20Sopenharmony_ci#define IWLAGN_OFDM_RSSI_C_BIT_POS 0 10898c2ecf20Sopenharmony_ci 10908c2ecf20Sopenharmony_cistruct iwlagn_non_cfg_phy { 10918c2ecf20Sopenharmony_ci __le32 non_cfg_phy[IWLAGN_RX_RES_PHY_CNT]; /* up to 8 phy entries */ 10928c2ecf20Sopenharmony_ci} __packed; 10938c2ecf20Sopenharmony_ci 10948c2ecf20Sopenharmony_ci 10958c2ecf20Sopenharmony_ci/* 10968c2ecf20Sopenharmony_ci * REPLY_RX = 0xc3 (response only, not a command) 10978c2ecf20Sopenharmony_ci * Used only for legacy (non 11n) frames. 10988c2ecf20Sopenharmony_ci */ 10998c2ecf20Sopenharmony_cistruct iwl_rx_phy_res { 11008c2ecf20Sopenharmony_ci u8 non_cfg_phy_cnt; /* non configurable DSP phy data byte count */ 11018c2ecf20Sopenharmony_ci u8 cfg_phy_cnt; /* configurable DSP phy data byte count */ 11028c2ecf20Sopenharmony_ci u8 stat_id; /* configurable DSP phy data set ID */ 11038c2ecf20Sopenharmony_ci u8 reserved1; 11048c2ecf20Sopenharmony_ci __le64 timestamp; /* TSF at on air rise */ 11058c2ecf20Sopenharmony_ci __le32 beacon_time_stamp; /* beacon at on-air rise */ 11068c2ecf20Sopenharmony_ci __le16 phy_flags; /* general phy flags: band, modulation, ... */ 11078c2ecf20Sopenharmony_ci __le16 channel; /* channel number */ 11088c2ecf20Sopenharmony_ci u8 non_cfg_phy_buf[32]; /* for various implementations of non_cfg_phy */ 11098c2ecf20Sopenharmony_ci __le32 rate_n_flags; /* RATE_MCS_* */ 11108c2ecf20Sopenharmony_ci __le16 byte_count; /* frame's byte-count */ 11118c2ecf20Sopenharmony_ci __le16 frame_time; /* frame's time on the air */ 11128c2ecf20Sopenharmony_ci} __packed; 11138c2ecf20Sopenharmony_ci 11148c2ecf20Sopenharmony_cistruct iwl_rx_mpdu_res_start { 11158c2ecf20Sopenharmony_ci __le16 byte_count; 11168c2ecf20Sopenharmony_ci __le16 reserved; 11178c2ecf20Sopenharmony_ci} __packed; 11188c2ecf20Sopenharmony_ci 11198c2ecf20Sopenharmony_ci 11208c2ecf20Sopenharmony_ci/****************************************************************************** 11218c2ecf20Sopenharmony_ci * (5) 11228c2ecf20Sopenharmony_ci * Tx Commands & Responses: 11238c2ecf20Sopenharmony_ci * 11248c2ecf20Sopenharmony_ci * Driver must place each REPLY_TX command into one of the prioritized Tx 11258c2ecf20Sopenharmony_ci * queues in host DRAM, shared between driver and device (see comments for 11268c2ecf20Sopenharmony_ci * SCD registers and Tx/Rx Queues). When the device's Tx scheduler and uCode 11278c2ecf20Sopenharmony_ci * are preparing to transmit, the device pulls the Tx command over the PCI 11288c2ecf20Sopenharmony_ci * bus via one of the device's Tx DMA channels, to fill an internal FIFO 11298c2ecf20Sopenharmony_ci * from which data will be transmitted. 11308c2ecf20Sopenharmony_ci * 11318c2ecf20Sopenharmony_ci * uCode handles all timing and protocol related to control frames 11328c2ecf20Sopenharmony_ci * (RTS/CTS/ACK), based on flags in the Tx command. uCode and Tx scheduler 11338c2ecf20Sopenharmony_ci * handle reception of block-acks; uCode updates the host driver via 11348c2ecf20Sopenharmony_ci * REPLY_COMPRESSED_BA. 11358c2ecf20Sopenharmony_ci * 11368c2ecf20Sopenharmony_ci * uCode handles retrying Tx when an ACK is expected but not received. 11378c2ecf20Sopenharmony_ci * This includes trying lower data rates than the one requested in the Tx 11388c2ecf20Sopenharmony_ci * command, as set up by the REPLY_TX_LINK_QUALITY_CMD (agn). 11398c2ecf20Sopenharmony_ci * 11408c2ecf20Sopenharmony_ci * Driver sets up transmit power for various rates via REPLY_TX_PWR_TABLE_CMD. 11418c2ecf20Sopenharmony_ci * This command must be executed after every RXON command, before Tx can occur. 11428c2ecf20Sopenharmony_ci *****************************************************************************/ 11438c2ecf20Sopenharmony_ci 11448c2ecf20Sopenharmony_ci/* REPLY_TX Tx flags field */ 11458c2ecf20Sopenharmony_ci 11468c2ecf20Sopenharmony_ci/* 11478c2ecf20Sopenharmony_ci * 1: Use RTS/CTS protocol or CTS-to-self if spec allows it 11488c2ecf20Sopenharmony_ci * before this frame. if CTS-to-self required check 11498c2ecf20Sopenharmony_ci * RXON_FLG_SELF_CTS_EN status. 11508c2ecf20Sopenharmony_ci */ 11518c2ecf20Sopenharmony_ci#define TX_CMD_FLG_PROT_REQUIRE_MSK cpu_to_le32(1 << 0) 11528c2ecf20Sopenharmony_ci 11538c2ecf20Sopenharmony_ci/* 1: Expect ACK from receiving station 11548c2ecf20Sopenharmony_ci * 0: Don't expect ACK (MAC header's duration field s/b 0) 11558c2ecf20Sopenharmony_ci * Set this for unicast frames, but not broadcast/multicast. */ 11568c2ecf20Sopenharmony_ci#define TX_CMD_FLG_ACK_MSK cpu_to_le32(1 << 3) 11578c2ecf20Sopenharmony_ci 11588c2ecf20Sopenharmony_ci/* For agn devices: 11598c2ecf20Sopenharmony_ci * 1: Use rate scale table (see REPLY_TX_LINK_QUALITY_CMD). 11608c2ecf20Sopenharmony_ci * Tx command's initial_rate_index indicates first rate to try; 11618c2ecf20Sopenharmony_ci * uCode walks through table for additional Tx attempts. 11628c2ecf20Sopenharmony_ci * 0: Use Tx rate/MCS from Tx command's rate_n_flags field. 11638c2ecf20Sopenharmony_ci * This rate will be used for all Tx attempts; it will not be scaled. */ 11648c2ecf20Sopenharmony_ci#define TX_CMD_FLG_STA_RATE_MSK cpu_to_le32(1 << 4) 11658c2ecf20Sopenharmony_ci 11668c2ecf20Sopenharmony_ci/* 1: Expect immediate block-ack. 11678c2ecf20Sopenharmony_ci * Set when Txing a block-ack request frame. Also set TX_CMD_FLG_ACK_MSK. */ 11688c2ecf20Sopenharmony_ci#define TX_CMD_FLG_IMM_BA_RSP_MASK cpu_to_le32(1 << 6) 11698c2ecf20Sopenharmony_ci 11708c2ecf20Sopenharmony_ci/* Tx antenna selection field; reserved (0) for agn devices. */ 11718c2ecf20Sopenharmony_ci#define TX_CMD_FLG_ANT_SEL_MSK cpu_to_le32(0xf00) 11728c2ecf20Sopenharmony_ci 11738c2ecf20Sopenharmony_ci/* 1: Ignore Bluetooth priority for this frame. 11748c2ecf20Sopenharmony_ci * 0: Delay Tx until Bluetooth device is done (normal usage). */ 11758c2ecf20Sopenharmony_ci#define TX_CMD_FLG_IGNORE_BT cpu_to_le32(1 << 12) 11768c2ecf20Sopenharmony_ci 11778c2ecf20Sopenharmony_ci/* 1: uCode overrides sequence control field in MAC header. 11788c2ecf20Sopenharmony_ci * 0: Driver provides sequence control field in MAC header. 11798c2ecf20Sopenharmony_ci * Set this for management frames, non-QOS data frames, non-unicast frames, 11808c2ecf20Sopenharmony_ci * and also in Tx command embedded in REPLY_SCAN_CMD for active scans. */ 11818c2ecf20Sopenharmony_ci#define TX_CMD_FLG_SEQ_CTL_MSK cpu_to_le32(1 << 13) 11828c2ecf20Sopenharmony_ci 11838c2ecf20Sopenharmony_ci/* 1: This frame is non-last MPDU; more fragments are coming. 11848c2ecf20Sopenharmony_ci * 0: Last fragment, or not using fragmentation. */ 11858c2ecf20Sopenharmony_ci#define TX_CMD_FLG_MORE_FRAG_MSK cpu_to_le32(1 << 14) 11868c2ecf20Sopenharmony_ci 11878c2ecf20Sopenharmony_ci/* 1: uCode calculates and inserts Timestamp Function (TSF) in outgoing frame. 11888c2ecf20Sopenharmony_ci * 0: No TSF required in outgoing frame. 11898c2ecf20Sopenharmony_ci * Set this for transmitting beacons and probe responses. */ 11908c2ecf20Sopenharmony_ci#define TX_CMD_FLG_TSF_MSK cpu_to_le32(1 << 16) 11918c2ecf20Sopenharmony_ci 11928c2ecf20Sopenharmony_ci/* 1: Driver inserted 2 bytes pad after the MAC header, for (required) dword 11938c2ecf20Sopenharmony_ci * alignment of frame's payload data field. 11948c2ecf20Sopenharmony_ci * 0: No pad 11958c2ecf20Sopenharmony_ci * Set this for MAC headers with 26 or 30 bytes, i.e. those with QOS or ADDR4 11968c2ecf20Sopenharmony_ci * field (but not both). Driver must align frame data (i.e. data following 11978c2ecf20Sopenharmony_ci * MAC header) to DWORD boundary. */ 11988c2ecf20Sopenharmony_ci#define TX_CMD_FLG_MH_PAD_MSK cpu_to_le32(1 << 20) 11998c2ecf20Sopenharmony_ci 12008c2ecf20Sopenharmony_ci/* accelerate aggregation support 12018c2ecf20Sopenharmony_ci * 0 - no CCMP encryption; 1 - CCMP encryption */ 12028c2ecf20Sopenharmony_ci#define TX_CMD_FLG_AGG_CCMP_MSK cpu_to_le32(1 << 22) 12038c2ecf20Sopenharmony_ci 12048c2ecf20Sopenharmony_ci/* HCCA-AP - disable duration overwriting. */ 12058c2ecf20Sopenharmony_ci#define TX_CMD_FLG_DUR_MSK cpu_to_le32(1 << 25) 12068c2ecf20Sopenharmony_ci 12078c2ecf20Sopenharmony_ci 12088c2ecf20Sopenharmony_ci/* 12098c2ecf20Sopenharmony_ci * TX command security control 12108c2ecf20Sopenharmony_ci */ 12118c2ecf20Sopenharmony_ci#define TX_CMD_SEC_WEP 0x01 12128c2ecf20Sopenharmony_ci#define TX_CMD_SEC_CCM 0x02 12138c2ecf20Sopenharmony_ci#define TX_CMD_SEC_TKIP 0x03 12148c2ecf20Sopenharmony_ci#define TX_CMD_SEC_MSK 0x03 12158c2ecf20Sopenharmony_ci#define TX_CMD_SEC_SHIFT 6 12168c2ecf20Sopenharmony_ci#define TX_CMD_SEC_KEY128 0x08 12178c2ecf20Sopenharmony_ci 12188c2ecf20Sopenharmony_ci/* 12198c2ecf20Sopenharmony_ci * REPLY_TX = 0x1c (command) 12208c2ecf20Sopenharmony_ci */ 12218c2ecf20Sopenharmony_ci 12228c2ecf20Sopenharmony_ci/* 12238c2ecf20Sopenharmony_ci * Used for managing Tx retries when expecting block-acks. 12248c2ecf20Sopenharmony_ci * Driver should set these fields to 0. 12258c2ecf20Sopenharmony_ci */ 12268c2ecf20Sopenharmony_cistruct iwl_dram_scratch { 12278c2ecf20Sopenharmony_ci u8 try_cnt; /* Tx attempts */ 12288c2ecf20Sopenharmony_ci u8 bt_kill_cnt; /* Tx attempts blocked by Bluetooth device */ 12298c2ecf20Sopenharmony_ci __le16 reserved; 12308c2ecf20Sopenharmony_ci} __packed; 12318c2ecf20Sopenharmony_ci 12328c2ecf20Sopenharmony_cistruct iwl_tx_cmd { 12338c2ecf20Sopenharmony_ci /* 12348c2ecf20Sopenharmony_ci * MPDU byte count: 12358c2ecf20Sopenharmony_ci * MAC header (24/26/30/32 bytes) + 2 bytes pad if 26/30 header size, 12368c2ecf20Sopenharmony_ci * + 8 byte IV for CCM or TKIP (not used for WEP) 12378c2ecf20Sopenharmony_ci * + Data payload 12388c2ecf20Sopenharmony_ci * + 8-byte MIC (not used for CCM/WEP) 12398c2ecf20Sopenharmony_ci * NOTE: Does not include Tx command bytes, post-MAC pad bytes, 12408c2ecf20Sopenharmony_ci * MIC (CCM) 8 bytes, ICV (WEP/TKIP/CKIP) 4 bytes, CRC 4 bytes.i 12418c2ecf20Sopenharmony_ci * Range: 14-2342 bytes. 12428c2ecf20Sopenharmony_ci */ 12438c2ecf20Sopenharmony_ci __le16 len; 12448c2ecf20Sopenharmony_ci 12458c2ecf20Sopenharmony_ci /* 12468c2ecf20Sopenharmony_ci * MPDU or MSDU byte count for next frame. 12478c2ecf20Sopenharmony_ci * Used for fragmentation and bursting, but not 11n aggregation. 12488c2ecf20Sopenharmony_ci * Same as "len", but for next frame. Set to 0 if not applicable. 12498c2ecf20Sopenharmony_ci */ 12508c2ecf20Sopenharmony_ci __le16 next_frame_len; 12518c2ecf20Sopenharmony_ci 12528c2ecf20Sopenharmony_ci __le32 tx_flags; /* TX_CMD_FLG_* */ 12538c2ecf20Sopenharmony_ci 12548c2ecf20Sopenharmony_ci /* uCode may modify this field of the Tx command (in host DRAM!). 12558c2ecf20Sopenharmony_ci * Driver must also set dram_lsb_ptr and dram_msb_ptr in this cmd. */ 12568c2ecf20Sopenharmony_ci struct iwl_dram_scratch scratch; 12578c2ecf20Sopenharmony_ci 12588c2ecf20Sopenharmony_ci /* Rate for *all* Tx attempts, if TX_CMD_FLG_STA_RATE_MSK is cleared. */ 12598c2ecf20Sopenharmony_ci __le32 rate_n_flags; /* RATE_MCS_* */ 12608c2ecf20Sopenharmony_ci 12618c2ecf20Sopenharmony_ci /* Index of destination station in uCode's station table */ 12628c2ecf20Sopenharmony_ci u8 sta_id; 12638c2ecf20Sopenharmony_ci 12648c2ecf20Sopenharmony_ci /* Type of security encryption: CCM or TKIP */ 12658c2ecf20Sopenharmony_ci u8 sec_ctl; /* TX_CMD_SEC_* */ 12668c2ecf20Sopenharmony_ci 12678c2ecf20Sopenharmony_ci /* 12688c2ecf20Sopenharmony_ci * Index into rate table (see REPLY_TX_LINK_QUALITY_CMD) for initial 12698c2ecf20Sopenharmony_ci * Tx attempt, if TX_CMD_FLG_STA_RATE_MSK is set. Normally "0" for 12708c2ecf20Sopenharmony_ci * data frames, this field may be used to selectively reduce initial 12718c2ecf20Sopenharmony_ci * rate (via non-0 value) for special frames (e.g. management), while 12728c2ecf20Sopenharmony_ci * still supporting rate scaling for all frames. 12738c2ecf20Sopenharmony_ci */ 12748c2ecf20Sopenharmony_ci u8 initial_rate_index; 12758c2ecf20Sopenharmony_ci u8 reserved; 12768c2ecf20Sopenharmony_ci u8 key[16]; 12778c2ecf20Sopenharmony_ci __le16 next_frame_flags; 12788c2ecf20Sopenharmony_ci __le16 reserved2; 12798c2ecf20Sopenharmony_ci union { 12808c2ecf20Sopenharmony_ci __le32 life_time; 12818c2ecf20Sopenharmony_ci __le32 attempt; 12828c2ecf20Sopenharmony_ci } stop_time; 12838c2ecf20Sopenharmony_ci 12848c2ecf20Sopenharmony_ci /* Host DRAM physical address pointer to "scratch" in this command. 12858c2ecf20Sopenharmony_ci * Must be dword aligned. "0" in dram_lsb_ptr disables usage. */ 12868c2ecf20Sopenharmony_ci __le32 dram_lsb_ptr; 12878c2ecf20Sopenharmony_ci u8 dram_msb_ptr; 12888c2ecf20Sopenharmony_ci 12898c2ecf20Sopenharmony_ci u8 rts_retry_limit; /*byte 50 */ 12908c2ecf20Sopenharmony_ci u8 data_retry_limit; /*byte 51 */ 12918c2ecf20Sopenharmony_ci u8 tid_tspec; 12928c2ecf20Sopenharmony_ci union { 12938c2ecf20Sopenharmony_ci __le16 pm_frame_timeout; 12948c2ecf20Sopenharmony_ci __le16 attempt_duration; 12958c2ecf20Sopenharmony_ci } timeout; 12968c2ecf20Sopenharmony_ci 12978c2ecf20Sopenharmony_ci /* 12988c2ecf20Sopenharmony_ci * Duration of EDCA burst Tx Opportunity, in 32-usec units. 12998c2ecf20Sopenharmony_ci * Set this if txop time is not specified by HCCA protocol (e.g. by AP). 13008c2ecf20Sopenharmony_ci */ 13018c2ecf20Sopenharmony_ci __le16 driver_txop; 13028c2ecf20Sopenharmony_ci 13038c2ecf20Sopenharmony_ci /* 13048c2ecf20Sopenharmony_ci * MAC header goes here, followed by 2 bytes padding if MAC header 13058c2ecf20Sopenharmony_ci * length is 26 or 30 bytes, followed by payload data 13068c2ecf20Sopenharmony_ci */ 13078c2ecf20Sopenharmony_ci u8 payload[0]; 13088c2ecf20Sopenharmony_ci struct ieee80211_hdr hdr[]; 13098c2ecf20Sopenharmony_ci} __packed; 13108c2ecf20Sopenharmony_ci 13118c2ecf20Sopenharmony_ci/* 13128c2ecf20Sopenharmony_ci * TX command response is sent after *agn* transmission attempts. 13138c2ecf20Sopenharmony_ci * 13148c2ecf20Sopenharmony_ci * both postpone and abort status are expected behavior from uCode. there is 13158c2ecf20Sopenharmony_ci * no special operation required from driver; except for RFKILL_FLUSH, 13168c2ecf20Sopenharmony_ci * which required tx flush host command to flush all the tx frames in queues 13178c2ecf20Sopenharmony_ci */ 13188c2ecf20Sopenharmony_cienum { 13198c2ecf20Sopenharmony_ci TX_STATUS_SUCCESS = 0x01, 13208c2ecf20Sopenharmony_ci TX_STATUS_DIRECT_DONE = 0x02, 13218c2ecf20Sopenharmony_ci /* postpone TX */ 13228c2ecf20Sopenharmony_ci TX_STATUS_POSTPONE_DELAY = 0x40, 13238c2ecf20Sopenharmony_ci TX_STATUS_POSTPONE_FEW_BYTES = 0x41, 13248c2ecf20Sopenharmony_ci TX_STATUS_POSTPONE_BT_PRIO = 0x42, 13258c2ecf20Sopenharmony_ci TX_STATUS_POSTPONE_QUIET_PERIOD = 0x43, 13268c2ecf20Sopenharmony_ci TX_STATUS_POSTPONE_CALC_TTAK = 0x44, 13278c2ecf20Sopenharmony_ci /* abort TX */ 13288c2ecf20Sopenharmony_ci TX_STATUS_FAIL_INTERNAL_CROSSED_RETRY = 0x81, 13298c2ecf20Sopenharmony_ci TX_STATUS_FAIL_SHORT_LIMIT = 0x82, 13308c2ecf20Sopenharmony_ci TX_STATUS_FAIL_LONG_LIMIT = 0x83, 13318c2ecf20Sopenharmony_ci TX_STATUS_FAIL_FIFO_UNDERRUN = 0x84, 13328c2ecf20Sopenharmony_ci TX_STATUS_FAIL_DRAIN_FLOW = 0x85, 13338c2ecf20Sopenharmony_ci TX_STATUS_FAIL_RFKILL_FLUSH = 0x86, 13348c2ecf20Sopenharmony_ci TX_STATUS_FAIL_LIFE_EXPIRE = 0x87, 13358c2ecf20Sopenharmony_ci TX_STATUS_FAIL_DEST_PS = 0x88, 13368c2ecf20Sopenharmony_ci TX_STATUS_FAIL_HOST_ABORTED = 0x89, 13378c2ecf20Sopenharmony_ci TX_STATUS_FAIL_BT_RETRY = 0x8a, 13388c2ecf20Sopenharmony_ci TX_STATUS_FAIL_STA_INVALID = 0x8b, 13398c2ecf20Sopenharmony_ci TX_STATUS_FAIL_FRAG_DROPPED = 0x8c, 13408c2ecf20Sopenharmony_ci TX_STATUS_FAIL_TID_DISABLE = 0x8d, 13418c2ecf20Sopenharmony_ci TX_STATUS_FAIL_FIFO_FLUSHED = 0x8e, 13428c2ecf20Sopenharmony_ci TX_STATUS_FAIL_INSUFFICIENT_CF_POLL = 0x8f, 13438c2ecf20Sopenharmony_ci TX_STATUS_FAIL_PASSIVE_NO_RX = 0x90, 13448c2ecf20Sopenharmony_ci TX_STATUS_FAIL_NO_BEACON_ON_RADAR = 0x91, 13458c2ecf20Sopenharmony_ci}; 13468c2ecf20Sopenharmony_ci 13478c2ecf20Sopenharmony_ci#define TX_PACKET_MODE_REGULAR 0x0000 13488c2ecf20Sopenharmony_ci#define TX_PACKET_MODE_BURST_SEQ 0x0100 13498c2ecf20Sopenharmony_ci#define TX_PACKET_MODE_BURST_FIRST 0x0200 13508c2ecf20Sopenharmony_ci 13518c2ecf20Sopenharmony_cienum { 13528c2ecf20Sopenharmony_ci TX_POWER_PA_NOT_ACTIVE = 0x0, 13538c2ecf20Sopenharmony_ci}; 13548c2ecf20Sopenharmony_ci 13558c2ecf20Sopenharmony_cienum { 13568c2ecf20Sopenharmony_ci TX_STATUS_MSK = 0x000000ff, /* bits 0:7 */ 13578c2ecf20Sopenharmony_ci TX_STATUS_DELAY_MSK = 0x00000040, 13588c2ecf20Sopenharmony_ci TX_STATUS_ABORT_MSK = 0x00000080, 13598c2ecf20Sopenharmony_ci TX_PACKET_MODE_MSK = 0x0000ff00, /* bits 8:15 */ 13608c2ecf20Sopenharmony_ci TX_FIFO_NUMBER_MSK = 0x00070000, /* bits 16:18 */ 13618c2ecf20Sopenharmony_ci TX_RESERVED = 0x00780000, /* bits 19:22 */ 13628c2ecf20Sopenharmony_ci TX_POWER_PA_DETECT_MSK = 0x7f800000, /* bits 23:30 */ 13638c2ecf20Sopenharmony_ci TX_ABORT_REQUIRED_MSK = 0x80000000, /* bits 31:31 */ 13648c2ecf20Sopenharmony_ci}; 13658c2ecf20Sopenharmony_ci 13668c2ecf20Sopenharmony_ci/* ******************************* 13678c2ecf20Sopenharmony_ci * TX aggregation status 13688c2ecf20Sopenharmony_ci ******************************* */ 13698c2ecf20Sopenharmony_ci 13708c2ecf20Sopenharmony_cienum { 13718c2ecf20Sopenharmony_ci AGG_TX_STATE_TRANSMITTED = 0x00, 13728c2ecf20Sopenharmony_ci AGG_TX_STATE_UNDERRUN_MSK = 0x01, 13738c2ecf20Sopenharmony_ci AGG_TX_STATE_BT_PRIO_MSK = 0x02, 13748c2ecf20Sopenharmony_ci AGG_TX_STATE_FEW_BYTES_MSK = 0x04, 13758c2ecf20Sopenharmony_ci AGG_TX_STATE_ABORT_MSK = 0x08, 13768c2ecf20Sopenharmony_ci AGG_TX_STATE_LAST_SENT_TTL_MSK = 0x10, 13778c2ecf20Sopenharmony_ci AGG_TX_STATE_LAST_SENT_TRY_CNT_MSK = 0x20, 13788c2ecf20Sopenharmony_ci AGG_TX_STATE_LAST_SENT_BT_KILL_MSK = 0x40, 13798c2ecf20Sopenharmony_ci AGG_TX_STATE_SCD_QUERY_MSK = 0x80, 13808c2ecf20Sopenharmony_ci AGG_TX_STATE_TEST_BAD_CRC32_MSK = 0x100, 13818c2ecf20Sopenharmony_ci AGG_TX_STATE_RESPONSE_MSK = 0x1ff, 13828c2ecf20Sopenharmony_ci AGG_TX_STATE_DUMP_TX_MSK = 0x200, 13838c2ecf20Sopenharmony_ci AGG_TX_STATE_DELAY_TX_MSK = 0x400 13848c2ecf20Sopenharmony_ci}; 13858c2ecf20Sopenharmony_ci 13868c2ecf20Sopenharmony_ci#define AGG_TX_STATUS_MSK 0x00000fff /* bits 0:11 */ 13878c2ecf20Sopenharmony_ci#define AGG_TX_TRY_MSK 0x0000f000 /* bits 12:15 */ 13888c2ecf20Sopenharmony_ci#define AGG_TX_TRY_POS 12 13898c2ecf20Sopenharmony_ci 13908c2ecf20Sopenharmony_ci#define AGG_TX_STATE_LAST_SENT_MSK (AGG_TX_STATE_LAST_SENT_TTL_MSK | \ 13918c2ecf20Sopenharmony_ci AGG_TX_STATE_LAST_SENT_TRY_CNT_MSK | \ 13928c2ecf20Sopenharmony_ci AGG_TX_STATE_LAST_SENT_BT_KILL_MSK) 13938c2ecf20Sopenharmony_ci 13948c2ecf20Sopenharmony_ci/* # tx attempts for first frame in aggregation */ 13958c2ecf20Sopenharmony_ci#define AGG_TX_STATE_TRY_CNT_POS 12 13968c2ecf20Sopenharmony_ci#define AGG_TX_STATE_TRY_CNT_MSK 0xf000 13978c2ecf20Sopenharmony_ci 13988c2ecf20Sopenharmony_ci/* Command ID and sequence number of Tx command for this frame */ 13998c2ecf20Sopenharmony_ci#define AGG_TX_STATE_SEQ_NUM_POS 16 14008c2ecf20Sopenharmony_ci#define AGG_TX_STATE_SEQ_NUM_MSK 0xffff0000 14018c2ecf20Sopenharmony_ci 14028c2ecf20Sopenharmony_ci/* 14038c2ecf20Sopenharmony_ci * REPLY_TX = 0x1c (response) 14048c2ecf20Sopenharmony_ci * 14058c2ecf20Sopenharmony_ci * This response may be in one of two slightly different formats, indicated 14068c2ecf20Sopenharmony_ci * by the frame_count field: 14078c2ecf20Sopenharmony_ci * 14088c2ecf20Sopenharmony_ci * 1) No aggregation (frame_count == 1). This reports Tx results for 14098c2ecf20Sopenharmony_ci * a single frame. Multiple attempts, at various bit rates, may have 14108c2ecf20Sopenharmony_ci * been made for this frame. 14118c2ecf20Sopenharmony_ci * 14128c2ecf20Sopenharmony_ci * 2) Aggregation (frame_count > 1). This reports Tx results for 14138c2ecf20Sopenharmony_ci * 2 or more frames that used block-acknowledge. All frames were 14148c2ecf20Sopenharmony_ci * transmitted at same rate. Rate scaling may have been used if first 14158c2ecf20Sopenharmony_ci * frame in this new agg block failed in previous agg block(s). 14168c2ecf20Sopenharmony_ci * 14178c2ecf20Sopenharmony_ci * Note that, for aggregation, ACK (block-ack) status is not delivered here; 14188c2ecf20Sopenharmony_ci * block-ack has not been received by the time the agn device records 14198c2ecf20Sopenharmony_ci * this status. 14208c2ecf20Sopenharmony_ci * This status relates to reasons the tx might have been blocked or aborted 14218c2ecf20Sopenharmony_ci * within the sending station (this agn device), rather than whether it was 14228c2ecf20Sopenharmony_ci * received successfully by the destination station. 14238c2ecf20Sopenharmony_ci */ 14248c2ecf20Sopenharmony_cistruct agg_tx_status { 14258c2ecf20Sopenharmony_ci __le16 status; 14268c2ecf20Sopenharmony_ci __le16 sequence; 14278c2ecf20Sopenharmony_ci} __packed; 14288c2ecf20Sopenharmony_ci 14298c2ecf20Sopenharmony_ci/* refer to ra_tid */ 14308c2ecf20Sopenharmony_ci#define IWLAGN_TX_RES_TID_POS 0 14318c2ecf20Sopenharmony_ci#define IWLAGN_TX_RES_TID_MSK 0x0f 14328c2ecf20Sopenharmony_ci#define IWLAGN_TX_RES_RA_POS 4 14338c2ecf20Sopenharmony_ci#define IWLAGN_TX_RES_RA_MSK 0xf0 14348c2ecf20Sopenharmony_ci 14358c2ecf20Sopenharmony_cistruct iwlagn_tx_resp { 14368c2ecf20Sopenharmony_ci u8 frame_count; /* 1 no aggregation, >1 aggregation */ 14378c2ecf20Sopenharmony_ci u8 bt_kill_count; /* # blocked by bluetooth (unused for agg) */ 14388c2ecf20Sopenharmony_ci u8 failure_rts; /* # failures due to unsuccessful RTS */ 14398c2ecf20Sopenharmony_ci u8 failure_frame; /* # failures due to no ACK (unused for agg) */ 14408c2ecf20Sopenharmony_ci 14418c2ecf20Sopenharmony_ci /* For non-agg: Rate at which frame was successful. 14428c2ecf20Sopenharmony_ci * For agg: Rate at which all frames were transmitted. */ 14438c2ecf20Sopenharmony_ci __le32 rate_n_flags; /* RATE_MCS_* */ 14448c2ecf20Sopenharmony_ci 14458c2ecf20Sopenharmony_ci /* For non-agg: RTS + CTS + frame tx attempts time + ACK. 14468c2ecf20Sopenharmony_ci * For agg: RTS + CTS + aggregation tx time + block-ack time. */ 14478c2ecf20Sopenharmony_ci __le16 wireless_media_time; /* uSecs */ 14488c2ecf20Sopenharmony_ci 14498c2ecf20Sopenharmony_ci u8 pa_status; /* RF power amplifier measurement (not used) */ 14508c2ecf20Sopenharmony_ci u8 pa_integ_res_a[3]; 14518c2ecf20Sopenharmony_ci u8 pa_integ_res_b[3]; 14528c2ecf20Sopenharmony_ci u8 pa_integ_res_C[3]; 14538c2ecf20Sopenharmony_ci 14548c2ecf20Sopenharmony_ci __le32 tfd_info; 14558c2ecf20Sopenharmony_ci __le16 seq_ctl; 14568c2ecf20Sopenharmony_ci __le16 byte_cnt; 14578c2ecf20Sopenharmony_ci u8 tlc_info; 14588c2ecf20Sopenharmony_ci u8 ra_tid; /* tid (0:3), sta_id (4:7) */ 14598c2ecf20Sopenharmony_ci __le16 frame_ctrl; 14608c2ecf20Sopenharmony_ci /* 14618c2ecf20Sopenharmony_ci * For non-agg: frame status TX_STATUS_* 14628c2ecf20Sopenharmony_ci * For agg: status of 1st frame, AGG_TX_STATE_*; other frame status 14638c2ecf20Sopenharmony_ci * fields follow this one, up to frame_count. 14648c2ecf20Sopenharmony_ci * Bit fields: 14658c2ecf20Sopenharmony_ci * 11- 0: AGG_TX_STATE_* status code 14668c2ecf20Sopenharmony_ci * 15-12: Retry count for 1st frame in aggregation (retries 14678c2ecf20Sopenharmony_ci * occur if tx failed for this frame when it was a 14688c2ecf20Sopenharmony_ci * member of a previous aggregation block). If rate 14698c2ecf20Sopenharmony_ci * scaling is used, retry count indicates the rate 14708c2ecf20Sopenharmony_ci * table entry used for all frames in the new agg. 14718c2ecf20Sopenharmony_ci * 31-16: Sequence # for this frame's Tx cmd (not SSN!) 14728c2ecf20Sopenharmony_ci */ 14738c2ecf20Sopenharmony_ci struct agg_tx_status status; /* TX status (in aggregation - 14748c2ecf20Sopenharmony_ci * status of 1st frame) */ 14758c2ecf20Sopenharmony_ci} __packed; 14768c2ecf20Sopenharmony_ci/* 14778c2ecf20Sopenharmony_ci * REPLY_COMPRESSED_BA = 0xc5 (response only, not a command) 14788c2ecf20Sopenharmony_ci * 14798c2ecf20Sopenharmony_ci * Reports Block-Acknowledge from recipient station 14808c2ecf20Sopenharmony_ci */ 14818c2ecf20Sopenharmony_cistruct iwl_compressed_ba_resp { 14828c2ecf20Sopenharmony_ci __le32 sta_addr_lo32; 14838c2ecf20Sopenharmony_ci __le16 sta_addr_hi16; 14848c2ecf20Sopenharmony_ci __le16 reserved; 14858c2ecf20Sopenharmony_ci 14868c2ecf20Sopenharmony_ci /* Index of recipient (BA-sending) station in uCode's station table */ 14878c2ecf20Sopenharmony_ci u8 sta_id; 14888c2ecf20Sopenharmony_ci u8 tid; 14898c2ecf20Sopenharmony_ci __le16 seq_ctl; 14908c2ecf20Sopenharmony_ci __le64 bitmap; 14918c2ecf20Sopenharmony_ci __le16 scd_flow; 14928c2ecf20Sopenharmony_ci __le16 scd_ssn; 14938c2ecf20Sopenharmony_ci u8 txed; /* number of frames sent */ 14948c2ecf20Sopenharmony_ci u8 txed_2_done; /* number of frames acked */ 14958c2ecf20Sopenharmony_ci __le16 reserved1; 14968c2ecf20Sopenharmony_ci} __packed; 14978c2ecf20Sopenharmony_ci 14988c2ecf20Sopenharmony_ci/* 14998c2ecf20Sopenharmony_ci * REPLY_TX_PWR_TABLE_CMD = 0x97 (command, has simple generic response) 15008c2ecf20Sopenharmony_ci * 15018c2ecf20Sopenharmony_ci */ 15028c2ecf20Sopenharmony_ci 15038c2ecf20Sopenharmony_ci/*RS_NEW_API: only TLC_RTS remains and moved to bit 0 */ 15048c2ecf20Sopenharmony_ci#define LINK_QUAL_FLAGS_SET_STA_TLC_RTS_MSK (1 << 0) 15058c2ecf20Sopenharmony_ci 15068c2ecf20Sopenharmony_ci/* # of EDCA prioritized tx fifos */ 15078c2ecf20Sopenharmony_ci#define LINK_QUAL_AC_NUM AC_NUM 15088c2ecf20Sopenharmony_ci 15098c2ecf20Sopenharmony_ci/* # entries in rate scale table to support Tx retries */ 15108c2ecf20Sopenharmony_ci#define LINK_QUAL_MAX_RETRY_NUM 16 15118c2ecf20Sopenharmony_ci 15128c2ecf20Sopenharmony_ci/* Tx antenna selection values */ 15138c2ecf20Sopenharmony_ci#define LINK_QUAL_ANT_A_MSK (1 << 0) 15148c2ecf20Sopenharmony_ci#define LINK_QUAL_ANT_B_MSK (1 << 1) 15158c2ecf20Sopenharmony_ci#define LINK_QUAL_ANT_MSK (LINK_QUAL_ANT_A_MSK|LINK_QUAL_ANT_B_MSK) 15168c2ecf20Sopenharmony_ci 15178c2ecf20Sopenharmony_ci 15188c2ecf20Sopenharmony_ci/** 15198c2ecf20Sopenharmony_ci * struct iwl_link_qual_general_params 15208c2ecf20Sopenharmony_ci * 15218c2ecf20Sopenharmony_ci * Used in REPLY_TX_LINK_QUALITY_CMD 15228c2ecf20Sopenharmony_ci */ 15238c2ecf20Sopenharmony_cistruct iwl_link_qual_general_params { 15248c2ecf20Sopenharmony_ci u8 flags; 15258c2ecf20Sopenharmony_ci 15268c2ecf20Sopenharmony_ci /* No entries at or above this (driver chosen) index contain MIMO */ 15278c2ecf20Sopenharmony_ci u8 mimo_delimiter; 15288c2ecf20Sopenharmony_ci 15298c2ecf20Sopenharmony_ci /* Best single antenna to use for single stream (legacy, SISO). */ 15308c2ecf20Sopenharmony_ci u8 single_stream_ant_msk; /* LINK_QUAL_ANT_* */ 15318c2ecf20Sopenharmony_ci 15328c2ecf20Sopenharmony_ci /* Best antennas to use for MIMO */ 15338c2ecf20Sopenharmony_ci u8 dual_stream_ant_msk; /* LINK_QUAL_ANT_* */ 15348c2ecf20Sopenharmony_ci 15358c2ecf20Sopenharmony_ci /* 15368c2ecf20Sopenharmony_ci * If driver needs to use different initial rates for different 15378c2ecf20Sopenharmony_ci * EDCA QOS access categories (as implemented by tx fifos 0-3), 15388c2ecf20Sopenharmony_ci * this table will set that up, by indicating the indexes in the 15398c2ecf20Sopenharmony_ci * rs_table[LINK_QUAL_MAX_RETRY_NUM] rate table at which to start. 15408c2ecf20Sopenharmony_ci * Otherwise, driver should set all entries to 0. 15418c2ecf20Sopenharmony_ci * 15428c2ecf20Sopenharmony_ci * Entry usage: 15438c2ecf20Sopenharmony_ci * 0 = Background, 1 = Best Effort (normal), 2 = Video, 3 = Voice 15448c2ecf20Sopenharmony_ci * TX FIFOs above 3 use same value (typically 0) as TX FIFO 3. 15458c2ecf20Sopenharmony_ci */ 15468c2ecf20Sopenharmony_ci u8 start_rate_index[LINK_QUAL_AC_NUM]; 15478c2ecf20Sopenharmony_ci} __packed; 15488c2ecf20Sopenharmony_ci 15498c2ecf20Sopenharmony_ci#define LINK_QUAL_AGG_TIME_LIMIT_DEF (4000) /* 4 milliseconds */ 15508c2ecf20Sopenharmony_ci#define LINK_QUAL_AGG_TIME_LIMIT_MAX (8000) 15518c2ecf20Sopenharmony_ci#define LINK_QUAL_AGG_TIME_LIMIT_MIN (100) 15528c2ecf20Sopenharmony_ci 15538c2ecf20Sopenharmony_ci#define LINK_QUAL_AGG_DISABLE_START_DEF (3) 15548c2ecf20Sopenharmony_ci#define LINK_QUAL_AGG_DISABLE_START_MAX (255) 15558c2ecf20Sopenharmony_ci#define LINK_QUAL_AGG_DISABLE_START_MIN (0) 15568c2ecf20Sopenharmony_ci 15578c2ecf20Sopenharmony_ci#define LINK_QUAL_AGG_FRAME_LIMIT_DEF (63) 15588c2ecf20Sopenharmony_ci#define LINK_QUAL_AGG_FRAME_LIMIT_MAX (63) 15598c2ecf20Sopenharmony_ci#define LINK_QUAL_AGG_FRAME_LIMIT_MIN (0) 15608c2ecf20Sopenharmony_ci 15618c2ecf20Sopenharmony_ci/** 15628c2ecf20Sopenharmony_ci * struct iwl_link_qual_agg_params 15638c2ecf20Sopenharmony_ci * 15648c2ecf20Sopenharmony_ci * Used in REPLY_TX_LINK_QUALITY_CMD 15658c2ecf20Sopenharmony_ci */ 15668c2ecf20Sopenharmony_cistruct iwl_link_qual_agg_params { 15678c2ecf20Sopenharmony_ci 15688c2ecf20Sopenharmony_ci /* 15698c2ecf20Sopenharmony_ci *Maximum number of uSec in aggregation. 15708c2ecf20Sopenharmony_ci * default set to 4000 (4 milliseconds) if not configured in .cfg 15718c2ecf20Sopenharmony_ci */ 15728c2ecf20Sopenharmony_ci __le16 agg_time_limit; 15738c2ecf20Sopenharmony_ci 15748c2ecf20Sopenharmony_ci /* 15758c2ecf20Sopenharmony_ci * Number of Tx retries allowed for a frame, before that frame will 15768c2ecf20Sopenharmony_ci * no longer be considered for the start of an aggregation sequence 15778c2ecf20Sopenharmony_ci * (scheduler will then try to tx it as single frame). 15788c2ecf20Sopenharmony_ci * Driver should set this to 3. 15798c2ecf20Sopenharmony_ci */ 15808c2ecf20Sopenharmony_ci u8 agg_dis_start_th; 15818c2ecf20Sopenharmony_ci 15828c2ecf20Sopenharmony_ci /* 15838c2ecf20Sopenharmony_ci * Maximum number of frames in aggregation. 15848c2ecf20Sopenharmony_ci * 0 = no limit (default). 1 = no aggregation. 15858c2ecf20Sopenharmony_ci * Other values = max # frames in aggregation. 15868c2ecf20Sopenharmony_ci */ 15878c2ecf20Sopenharmony_ci u8 agg_frame_cnt_limit; 15888c2ecf20Sopenharmony_ci 15898c2ecf20Sopenharmony_ci __le32 reserved; 15908c2ecf20Sopenharmony_ci} __packed; 15918c2ecf20Sopenharmony_ci 15928c2ecf20Sopenharmony_ci/* 15938c2ecf20Sopenharmony_ci * REPLY_TX_LINK_QUALITY_CMD = 0x4e (command, has simple generic response) 15948c2ecf20Sopenharmony_ci * 15958c2ecf20Sopenharmony_ci * For agn devices 15968c2ecf20Sopenharmony_ci * 15978c2ecf20Sopenharmony_ci * Each station in the agn device's internal station table has its own table 15988c2ecf20Sopenharmony_ci * of 16 15998c2ecf20Sopenharmony_ci * Tx rates and modulation modes (e.g. legacy/SISO/MIMO) for retrying Tx when 16008c2ecf20Sopenharmony_ci * an ACK is not received. This command replaces the entire table for 16018c2ecf20Sopenharmony_ci * one station. 16028c2ecf20Sopenharmony_ci * 16038c2ecf20Sopenharmony_ci * NOTE: Station must already be in agn device's station table. 16048c2ecf20Sopenharmony_ci * Use REPLY_ADD_STA. 16058c2ecf20Sopenharmony_ci * 16068c2ecf20Sopenharmony_ci * The rate scaling procedures described below work well. Of course, other 16078c2ecf20Sopenharmony_ci * procedures are possible, and may work better for particular environments. 16088c2ecf20Sopenharmony_ci * 16098c2ecf20Sopenharmony_ci * 16108c2ecf20Sopenharmony_ci * FILLING THE RATE TABLE 16118c2ecf20Sopenharmony_ci * 16128c2ecf20Sopenharmony_ci * Given a particular initial rate and mode, as determined by the rate 16138c2ecf20Sopenharmony_ci * scaling algorithm described below, the Linux driver uses the following 16148c2ecf20Sopenharmony_ci * formula to fill the rs_table[LINK_QUAL_MAX_RETRY_NUM] rate table in the 16158c2ecf20Sopenharmony_ci * Link Quality command: 16168c2ecf20Sopenharmony_ci * 16178c2ecf20Sopenharmony_ci * 16188c2ecf20Sopenharmony_ci * 1) If using High-throughput (HT) (SISO or MIMO) initial rate: 16198c2ecf20Sopenharmony_ci * a) Use this same initial rate for first 3 entries. 16208c2ecf20Sopenharmony_ci * b) Find next lower available rate using same mode (SISO or MIMO), 16218c2ecf20Sopenharmony_ci * use for next 3 entries. If no lower rate available, switch to 16228c2ecf20Sopenharmony_ci * legacy mode (no HT40 channel, no MIMO, no short guard interval). 16238c2ecf20Sopenharmony_ci * c) If using MIMO, set command's mimo_delimiter to number of entries 16248c2ecf20Sopenharmony_ci * using MIMO (3 or 6). 16258c2ecf20Sopenharmony_ci * d) After trying 2 HT rates, switch to legacy mode (no HT40 channel, 16268c2ecf20Sopenharmony_ci * no MIMO, no short guard interval), at the next lower bit rate 16278c2ecf20Sopenharmony_ci * (e.g. if second HT bit rate was 54, try 48 legacy), and follow 16288c2ecf20Sopenharmony_ci * legacy procedure for remaining table entries. 16298c2ecf20Sopenharmony_ci * 16308c2ecf20Sopenharmony_ci * 2) If using legacy initial rate: 16318c2ecf20Sopenharmony_ci * a) Use the initial rate for only one entry. 16328c2ecf20Sopenharmony_ci * b) For each following entry, reduce the rate to next lower available 16338c2ecf20Sopenharmony_ci * rate, until reaching the lowest available rate. 16348c2ecf20Sopenharmony_ci * c) When reducing rate, also switch antenna selection. 16358c2ecf20Sopenharmony_ci * d) Once lowest available rate is reached, repeat this rate until 16368c2ecf20Sopenharmony_ci * rate table is filled (16 entries), switching antenna each entry. 16378c2ecf20Sopenharmony_ci * 16388c2ecf20Sopenharmony_ci * 16398c2ecf20Sopenharmony_ci * ACCUMULATING HISTORY 16408c2ecf20Sopenharmony_ci * 16418c2ecf20Sopenharmony_ci * The rate scaling algorithm for agn devices, as implemented in Linux driver, 16428c2ecf20Sopenharmony_ci * uses two sets of frame Tx success history: One for the current/active 16438c2ecf20Sopenharmony_ci * modulation mode, and one for a speculative/search mode that is being 16448c2ecf20Sopenharmony_ci * attempted. If the speculative mode turns out to be more effective (i.e. 16458c2ecf20Sopenharmony_ci * actual transfer rate is better), then the driver continues to use the 16468c2ecf20Sopenharmony_ci * speculative mode as the new current active mode. 16478c2ecf20Sopenharmony_ci * 16488c2ecf20Sopenharmony_ci * Each history set contains, separately for each possible rate, data for a 16498c2ecf20Sopenharmony_ci * sliding window of the 62 most recent tx attempts at that rate. The data 16508c2ecf20Sopenharmony_ci * includes a shifting bitmap of success(1)/failure(0), and sums of successful 16518c2ecf20Sopenharmony_ci * and attempted frames, from which the driver can additionally calculate a 16528c2ecf20Sopenharmony_ci * success ratio (success / attempted) and number of failures 16538c2ecf20Sopenharmony_ci * (attempted - success), and control the size of the window (attempted). 16548c2ecf20Sopenharmony_ci * The driver uses the bit map to remove successes from the success sum, as 16558c2ecf20Sopenharmony_ci * the oldest tx attempts fall out of the window. 16568c2ecf20Sopenharmony_ci * 16578c2ecf20Sopenharmony_ci * When the agn device makes multiple tx attempts for a given frame, each 16588c2ecf20Sopenharmony_ci * attempt might be at a different rate, and have different modulation 16598c2ecf20Sopenharmony_ci * characteristics (e.g. antenna, fat channel, short guard interval), as set 16608c2ecf20Sopenharmony_ci * up in the rate scaling table in the Link Quality command. The driver must 16618c2ecf20Sopenharmony_ci * determine which rate table entry was used for each tx attempt, to determine 16628c2ecf20Sopenharmony_ci * which rate-specific history to update, and record only those attempts that 16638c2ecf20Sopenharmony_ci * match the modulation characteristics of the history set. 16648c2ecf20Sopenharmony_ci * 16658c2ecf20Sopenharmony_ci * When using block-ack (aggregation), all frames are transmitted at the same 16668c2ecf20Sopenharmony_ci * rate, since there is no per-attempt acknowledgment from the destination 16678c2ecf20Sopenharmony_ci * station. The Tx response struct iwl_tx_resp indicates the Tx rate in 16688c2ecf20Sopenharmony_ci * rate_n_flags field. After receiving a block-ack, the driver can update 16698c2ecf20Sopenharmony_ci * history for the entire block all at once. 16708c2ecf20Sopenharmony_ci * 16718c2ecf20Sopenharmony_ci * 16728c2ecf20Sopenharmony_ci * FINDING BEST STARTING RATE: 16738c2ecf20Sopenharmony_ci * 16748c2ecf20Sopenharmony_ci * When working with a selected initial modulation mode (see below), the 16758c2ecf20Sopenharmony_ci * driver attempts to find a best initial rate. The initial rate is the 16768c2ecf20Sopenharmony_ci * first entry in the Link Quality command's rate table. 16778c2ecf20Sopenharmony_ci * 16788c2ecf20Sopenharmony_ci * 1) Calculate actual throughput (success ratio * expected throughput, see 16798c2ecf20Sopenharmony_ci * table below) for current initial rate. Do this only if enough frames 16808c2ecf20Sopenharmony_ci * have been attempted to make the value meaningful: at least 6 failed 16818c2ecf20Sopenharmony_ci * tx attempts, or at least 8 successes. If not enough, don't try rate 16828c2ecf20Sopenharmony_ci * scaling yet. 16838c2ecf20Sopenharmony_ci * 16848c2ecf20Sopenharmony_ci * 2) Find available rates adjacent to current initial rate. Available means: 16858c2ecf20Sopenharmony_ci * a) supported by hardware && 16868c2ecf20Sopenharmony_ci * b) supported by association && 16878c2ecf20Sopenharmony_ci * c) within any constraints selected by user 16888c2ecf20Sopenharmony_ci * 16898c2ecf20Sopenharmony_ci * 3) Gather measured throughputs for adjacent rates. These might not have 16908c2ecf20Sopenharmony_ci * enough history to calculate a throughput. That's okay, we might try 16918c2ecf20Sopenharmony_ci * using one of them anyway! 16928c2ecf20Sopenharmony_ci * 16938c2ecf20Sopenharmony_ci * 4) Try decreasing rate if, for current rate: 16948c2ecf20Sopenharmony_ci * a) success ratio is < 15% || 16958c2ecf20Sopenharmony_ci * b) lower adjacent rate has better measured throughput || 16968c2ecf20Sopenharmony_ci * c) higher adjacent rate has worse throughput, and lower is unmeasured 16978c2ecf20Sopenharmony_ci * 16988c2ecf20Sopenharmony_ci * As a sanity check, if decrease was determined above, leave rate 16998c2ecf20Sopenharmony_ci * unchanged if: 17008c2ecf20Sopenharmony_ci * a) lower rate unavailable 17018c2ecf20Sopenharmony_ci * b) success ratio at current rate > 85% (very good) 17028c2ecf20Sopenharmony_ci * c) current measured throughput is better than expected throughput 17038c2ecf20Sopenharmony_ci * of lower rate (under perfect 100% tx conditions, see table below) 17048c2ecf20Sopenharmony_ci * 17058c2ecf20Sopenharmony_ci * 5) Try increasing rate if, for current rate: 17068c2ecf20Sopenharmony_ci * a) success ratio is < 15% || 17078c2ecf20Sopenharmony_ci * b) both adjacent rates' throughputs are unmeasured (try it!) || 17088c2ecf20Sopenharmony_ci * b) higher adjacent rate has better measured throughput || 17098c2ecf20Sopenharmony_ci * c) lower adjacent rate has worse throughput, and higher is unmeasured 17108c2ecf20Sopenharmony_ci * 17118c2ecf20Sopenharmony_ci * As a sanity check, if increase was determined above, leave rate 17128c2ecf20Sopenharmony_ci * unchanged if: 17138c2ecf20Sopenharmony_ci * a) success ratio at current rate < 70%. This is not particularly 17148c2ecf20Sopenharmony_ci * good performance; higher rate is sure to have poorer success. 17158c2ecf20Sopenharmony_ci * 17168c2ecf20Sopenharmony_ci * 6) Re-evaluate the rate after each tx frame. If working with block- 17178c2ecf20Sopenharmony_ci * acknowledge, history and statistics may be calculated for the entire 17188c2ecf20Sopenharmony_ci * block (including prior history that fits within the history windows), 17198c2ecf20Sopenharmony_ci * before re-evaluation. 17208c2ecf20Sopenharmony_ci * 17218c2ecf20Sopenharmony_ci * FINDING BEST STARTING MODULATION MODE: 17228c2ecf20Sopenharmony_ci * 17238c2ecf20Sopenharmony_ci * After working with a modulation mode for a "while" (and doing rate scaling), 17248c2ecf20Sopenharmony_ci * the driver searches for a new initial mode in an attempt to improve 17258c2ecf20Sopenharmony_ci * throughput. The "while" is measured by numbers of attempted frames: 17268c2ecf20Sopenharmony_ci * 17278c2ecf20Sopenharmony_ci * For legacy mode, search for new mode after: 17288c2ecf20Sopenharmony_ci * 480 successful frames, or 160 failed frames 17298c2ecf20Sopenharmony_ci * For high-throughput modes (SISO or MIMO), search for new mode after: 17308c2ecf20Sopenharmony_ci * 4500 successful frames, or 400 failed frames 17318c2ecf20Sopenharmony_ci * 17328c2ecf20Sopenharmony_ci * Mode switch possibilities are (3 for each mode): 17338c2ecf20Sopenharmony_ci * 17348c2ecf20Sopenharmony_ci * For legacy: 17358c2ecf20Sopenharmony_ci * Change antenna, try SISO (if HT association), try MIMO (if HT association) 17368c2ecf20Sopenharmony_ci * For SISO: 17378c2ecf20Sopenharmony_ci * Change antenna, try MIMO, try shortened guard interval (SGI) 17388c2ecf20Sopenharmony_ci * For MIMO: 17398c2ecf20Sopenharmony_ci * Try SISO antenna A, SISO antenna B, try shortened guard interval (SGI) 17408c2ecf20Sopenharmony_ci * 17418c2ecf20Sopenharmony_ci * When trying a new mode, use the same bit rate as the old/current mode when 17428c2ecf20Sopenharmony_ci * trying antenna switches and shortened guard interval. When switching to 17438c2ecf20Sopenharmony_ci * SISO from MIMO or legacy, or to MIMO from SISO or legacy, use a rate 17448c2ecf20Sopenharmony_ci * for which the expected throughput (under perfect conditions) is about the 17458c2ecf20Sopenharmony_ci * same or slightly better than the actual measured throughput delivered by 17468c2ecf20Sopenharmony_ci * the old/current mode. 17478c2ecf20Sopenharmony_ci * 17488c2ecf20Sopenharmony_ci * Actual throughput can be estimated by multiplying the expected throughput 17498c2ecf20Sopenharmony_ci * by the success ratio (successful / attempted tx frames). Frame size is 17508c2ecf20Sopenharmony_ci * not considered in this calculation; it assumes that frame size will average 17518c2ecf20Sopenharmony_ci * out to be fairly consistent over several samples. The following are 17528c2ecf20Sopenharmony_ci * metric values for expected throughput assuming 100% success ratio. 17538c2ecf20Sopenharmony_ci * Only G band has support for CCK rates: 17548c2ecf20Sopenharmony_ci * 17558c2ecf20Sopenharmony_ci * RATE: 1 2 5 11 6 9 12 18 24 36 48 54 60 17568c2ecf20Sopenharmony_ci * 17578c2ecf20Sopenharmony_ci * G: 7 13 35 58 40 57 72 98 121 154 177 186 186 17588c2ecf20Sopenharmony_ci * A: 0 0 0 0 40 57 72 98 121 154 177 186 186 17598c2ecf20Sopenharmony_ci * SISO 20MHz: 0 0 0 0 42 42 76 102 124 159 183 193 202 17608c2ecf20Sopenharmony_ci * SGI SISO 20MHz: 0 0 0 0 46 46 82 110 132 168 192 202 211 17618c2ecf20Sopenharmony_ci * MIMO 20MHz: 0 0 0 0 74 74 123 155 179 214 236 244 251 17628c2ecf20Sopenharmony_ci * SGI MIMO 20MHz: 0 0 0 0 81 81 131 164 188 222 243 251 257 17638c2ecf20Sopenharmony_ci * SISO 40MHz: 0 0 0 0 77 77 127 160 184 220 242 250 257 17648c2ecf20Sopenharmony_ci * SGI SISO 40MHz: 0 0 0 0 83 83 135 169 193 229 250 257 264 17658c2ecf20Sopenharmony_ci * MIMO 40MHz: 0 0 0 0 123 123 182 214 235 264 279 285 289 17668c2ecf20Sopenharmony_ci * SGI MIMO 40MHz: 0 0 0 0 131 131 191 222 242 270 284 289 293 17678c2ecf20Sopenharmony_ci * 17688c2ecf20Sopenharmony_ci * After the new mode has been tried for a short while (minimum of 6 failed 17698c2ecf20Sopenharmony_ci * frames or 8 successful frames), compare success ratio and actual throughput 17708c2ecf20Sopenharmony_ci * estimate of the new mode with the old. If either is better with the new 17718c2ecf20Sopenharmony_ci * mode, continue to use the new mode. 17728c2ecf20Sopenharmony_ci * 17738c2ecf20Sopenharmony_ci * Continue comparing modes until all 3 possibilities have been tried. 17748c2ecf20Sopenharmony_ci * If moving from legacy to HT, try all 3 possibilities from the new HT 17758c2ecf20Sopenharmony_ci * mode. After trying all 3, a best mode is found. Continue to use this mode 17768c2ecf20Sopenharmony_ci * for the longer "while" described above (e.g. 480 successful frames for 17778c2ecf20Sopenharmony_ci * legacy), and then repeat the search process. 17788c2ecf20Sopenharmony_ci * 17798c2ecf20Sopenharmony_ci */ 17808c2ecf20Sopenharmony_cistruct iwl_link_quality_cmd { 17818c2ecf20Sopenharmony_ci 17828c2ecf20Sopenharmony_ci /* Index of destination/recipient station in uCode's station table */ 17838c2ecf20Sopenharmony_ci u8 sta_id; 17848c2ecf20Sopenharmony_ci u8 reserved1; 17858c2ecf20Sopenharmony_ci __le16 control; /* not used */ 17868c2ecf20Sopenharmony_ci struct iwl_link_qual_general_params general_params; 17878c2ecf20Sopenharmony_ci struct iwl_link_qual_agg_params agg_params; 17888c2ecf20Sopenharmony_ci 17898c2ecf20Sopenharmony_ci /* 17908c2ecf20Sopenharmony_ci * Rate info; when using rate-scaling, Tx command's initial_rate_index 17918c2ecf20Sopenharmony_ci * specifies 1st Tx rate attempted, via index into this table. 17928c2ecf20Sopenharmony_ci * agn devices works its way through table when retrying Tx. 17938c2ecf20Sopenharmony_ci */ 17948c2ecf20Sopenharmony_ci struct { 17958c2ecf20Sopenharmony_ci __le32 rate_n_flags; /* RATE_MCS_*, IWL_RATE_* */ 17968c2ecf20Sopenharmony_ci } rs_table[LINK_QUAL_MAX_RETRY_NUM]; 17978c2ecf20Sopenharmony_ci __le32 reserved2; 17988c2ecf20Sopenharmony_ci} __packed; 17998c2ecf20Sopenharmony_ci 18008c2ecf20Sopenharmony_ci/* 18018c2ecf20Sopenharmony_ci * BT configuration enable flags: 18028c2ecf20Sopenharmony_ci * bit 0 - 1: BT channel announcement enabled 18038c2ecf20Sopenharmony_ci * 0: disable 18048c2ecf20Sopenharmony_ci * bit 1 - 1: priority of BT device enabled 18058c2ecf20Sopenharmony_ci * 0: disable 18068c2ecf20Sopenharmony_ci * bit 2 - 1: BT 2 wire support enabled 18078c2ecf20Sopenharmony_ci * 0: disable 18088c2ecf20Sopenharmony_ci */ 18098c2ecf20Sopenharmony_ci#define BT_COEX_DISABLE (0x0) 18108c2ecf20Sopenharmony_ci#define BT_ENABLE_CHANNEL_ANNOUNCE BIT(0) 18118c2ecf20Sopenharmony_ci#define BT_ENABLE_PRIORITY BIT(1) 18128c2ecf20Sopenharmony_ci#define BT_ENABLE_2_WIRE BIT(2) 18138c2ecf20Sopenharmony_ci 18148c2ecf20Sopenharmony_ci#define BT_COEX_DISABLE (0x0) 18158c2ecf20Sopenharmony_ci#define BT_COEX_ENABLE (BT_ENABLE_CHANNEL_ANNOUNCE | BT_ENABLE_PRIORITY) 18168c2ecf20Sopenharmony_ci 18178c2ecf20Sopenharmony_ci#define BT_LEAD_TIME_MIN (0x0) 18188c2ecf20Sopenharmony_ci#define BT_LEAD_TIME_DEF (0x1E) 18198c2ecf20Sopenharmony_ci#define BT_LEAD_TIME_MAX (0xFF) 18208c2ecf20Sopenharmony_ci 18218c2ecf20Sopenharmony_ci#define BT_MAX_KILL_MIN (0x1) 18228c2ecf20Sopenharmony_ci#define BT_MAX_KILL_DEF (0x5) 18238c2ecf20Sopenharmony_ci#define BT_MAX_KILL_MAX (0xFF) 18248c2ecf20Sopenharmony_ci 18258c2ecf20Sopenharmony_ci#define BT_DURATION_LIMIT_DEF 625 18268c2ecf20Sopenharmony_ci#define BT_DURATION_LIMIT_MAX 1250 18278c2ecf20Sopenharmony_ci#define BT_DURATION_LIMIT_MIN 625 18288c2ecf20Sopenharmony_ci 18298c2ecf20Sopenharmony_ci#define BT_ON_THRESHOLD_DEF 4 18308c2ecf20Sopenharmony_ci#define BT_ON_THRESHOLD_MAX 1000 18318c2ecf20Sopenharmony_ci#define BT_ON_THRESHOLD_MIN 1 18328c2ecf20Sopenharmony_ci 18338c2ecf20Sopenharmony_ci#define BT_FRAG_THRESHOLD_DEF 0 18348c2ecf20Sopenharmony_ci#define BT_FRAG_THRESHOLD_MAX 0 18358c2ecf20Sopenharmony_ci#define BT_FRAG_THRESHOLD_MIN 0 18368c2ecf20Sopenharmony_ci 18378c2ecf20Sopenharmony_ci#define BT_AGG_THRESHOLD_DEF 1200 18388c2ecf20Sopenharmony_ci#define BT_AGG_THRESHOLD_MAX 8000 18398c2ecf20Sopenharmony_ci#define BT_AGG_THRESHOLD_MIN 400 18408c2ecf20Sopenharmony_ci 18418c2ecf20Sopenharmony_ci/* 18428c2ecf20Sopenharmony_ci * REPLY_BT_CONFIG = 0x9b (command, has simple generic response) 18438c2ecf20Sopenharmony_ci * 18448c2ecf20Sopenharmony_ci * agn devices support hardware handshake with Bluetooth device on 18458c2ecf20Sopenharmony_ci * same platform. Bluetooth device alerts wireless device when it will Tx; 18468c2ecf20Sopenharmony_ci * wireless device can delay or kill its own Tx to accommodate. 18478c2ecf20Sopenharmony_ci */ 18488c2ecf20Sopenharmony_cistruct iwl_bt_cmd { 18498c2ecf20Sopenharmony_ci u8 flags; 18508c2ecf20Sopenharmony_ci u8 lead_time; 18518c2ecf20Sopenharmony_ci u8 max_kill; 18528c2ecf20Sopenharmony_ci u8 reserved; 18538c2ecf20Sopenharmony_ci __le32 kill_ack_mask; 18548c2ecf20Sopenharmony_ci __le32 kill_cts_mask; 18558c2ecf20Sopenharmony_ci} __packed; 18568c2ecf20Sopenharmony_ci 18578c2ecf20Sopenharmony_ci#define IWLAGN_BT_FLAG_CHANNEL_INHIBITION BIT(0) 18588c2ecf20Sopenharmony_ci 18598c2ecf20Sopenharmony_ci#define IWLAGN_BT_FLAG_COEX_MODE_MASK (BIT(3)|BIT(4)|BIT(5)) 18608c2ecf20Sopenharmony_ci#define IWLAGN_BT_FLAG_COEX_MODE_SHIFT 3 18618c2ecf20Sopenharmony_ci#define IWLAGN_BT_FLAG_COEX_MODE_DISABLED 0 18628c2ecf20Sopenharmony_ci#define IWLAGN_BT_FLAG_COEX_MODE_LEGACY_2W 1 18638c2ecf20Sopenharmony_ci#define IWLAGN_BT_FLAG_COEX_MODE_3W 2 18648c2ecf20Sopenharmony_ci#define IWLAGN_BT_FLAG_COEX_MODE_4W 3 18658c2ecf20Sopenharmony_ci 18668c2ecf20Sopenharmony_ci#define IWLAGN_BT_FLAG_UCODE_DEFAULT BIT(6) 18678c2ecf20Sopenharmony_ci/* Disable Sync PSPoll on SCO/eSCO */ 18688c2ecf20Sopenharmony_ci#define IWLAGN_BT_FLAG_SYNC_2_BT_DISABLE BIT(7) 18698c2ecf20Sopenharmony_ci 18708c2ecf20Sopenharmony_ci#define IWLAGN_BT_PSP_MIN_RSSI_THRESHOLD -75 /* dBm */ 18718c2ecf20Sopenharmony_ci#define IWLAGN_BT_PSP_MAX_RSSI_THRESHOLD -65 /* dBm */ 18728c2ecf20Sopenharmony_ci 18738c2ecf20Sopenharmony_ci#define IWLAGN_BT_PRIO_BOOST_MAX 0xFF 18748c2ecf20Sopenharmony_ci#define IWLAGN_BT_PRIO_BOOST_MIN 0x00 18758c2ecf20Sopenharmony_ci#define IWLAGN_BT_PRIO_BOOST_DEFAULT 0xF0 18768c2ecf20Sopenharmony_ci#define IWLAGN_BT_PRIO_BOOST_DEFAULT32 0xF0F0F0F0 18778c2ecf20Sopenharmony_ci 18788c2ecf20Sopenharmony_ci#define IWLAGN_BT_MAX_KILL_DEFAULT 5 18798c2ecf20Sopenharmony_ci 18808c2ecf20Sopenharmony_ci#define IWLAGN_BT3_T7_DEFAULT 1 18818c2ecf20Sopenharmony_ci 18828c2ecf20Sopenharmony_cienum iwl_bt_kill_idx { 18838c2ecf20Sopenharmony_ci IWL_BT_KILL_DEFAULT = 0, 18848c2ecf20Sopenharmony_ci IWL_BT_KILL_OVERRIDE = 1, 18858c2ecf20Sopenharmony_ci IWL_BT_KILL_REDUCE = 2, 18868c2ecf20Sopenharmony_ci}; 18878c2ecf20Sopenharmony_ci 18888c2ecf20Sopenharmony_ci#define IWLAGN_BT_KILL_ACK_MASK_DEFAULT cpu_to_le32(0xffff0000) 18898c2ecf20Sopenharmony_ci#define IWLAGN_BT_KILL_CTS_MASK_DEFAULT cpu_to_le32(0xffff0000) 18908c2ecf20Sopenharmony_ci#define IWLAGN_BT_KILL_ACK_CTS_MASK_SCO cpu_to_le32(0xffffffff) 18918c2ecf20Sopenharmony_ci#define IWLAGN_BT_KILL_ACK_CTS_MASK_REDUCE cpu_to_le32(0) 18928c2ecf20Sopenharmony_ci 18938c2ecf20Sopenharmony_ci#define IWLAGN_BT3_PRIO_SAMPLE_DEFAULT 2 18948c2ecf20Sopenharmony_ci 18958c2ecf20Sopenharmony_ci#define IWLAGN_BT3_T2_DEFAULT 0xc 18968c2ecf20Sopenharmony_ci 18978c2ecf20Sopenharmony_ci#define IWLAGN_BT_VALID_ENABLE_FLAGS cpu_to_le16(BIT(0)) 18988c2ecf20Sopenharmony_ci#define IWLAGN_BT_VALID_BOOST cpu_to_le16(BIT(1)) 18998c2ecf20Sopenharmony_ci#define IWLAGN_BT_VALID_MAX_KILL cpu_to_le16(BIT(2)) 19008c2ecf20Sopenharmony_ci#define IWLAGN_BT_VALID_3W_TIMERS cpu_to_le16(BIT(3)) 19018c2ecf20Sopenharmony_ci#define IWLAGN_BT_VALID_KILL_ACK_MASK cpu_to_le16(BIT(4)) 19028c2ecf20Sopenharmony_ci#define IWLAGN_BT_VALID_KILL_CTS_MASK cpu_to_le16(BIT(5)) 19038c2ecf20Sopenharmony_ci#define IWLAGN_BT_VALID_REDUCED_TX_PWR cpu_to_le16(BIT(6)) 19048c2ecf20Sopenharmony_ci#define IWLAGN_BT_VALID_3W_LUT cpu_to_le16(BIT(7)) 19058c2ecf20Sopenharmony_ci 19068c2ecf20Sopenharmony_ci#define IWLAGN_BT_ALL_VALID_MSK (IWLAGN_BT_VALID_ENABLE_FLAGS | \ 19078c2ecf20Sopenharmony_ci IWLAGN_BT_VALID_BOOST | \ 19088c2ecf20Sopenharmony_ci IWLAGN_BT_VALID_MAX_KILL | \ 19098c2ecf20Sopenharmony_ci IWLAGN_BT_VALID_3W_TIMERS | \ 19108c2ecf20Sopenharmony_ci IWLAGN_BT_VALID_KILL_ACK_MASK | \ 19118c2ecf20Sopenharmony_ci IWLAGN_BT_VALID_KILL_CTS_MASK | \ 19128c2ecf20Sopenharmony_ci IWLAGN_BT_VALID_REDUCED_TX_PWR | \ 19138c2ecf20Sopenharmony_ci IWLAGN_BT_VALID_3W_LUT) 19148c2ecf20Sopenharmony_ci 19158c2ecf20Sopenharmony_ci#define IWLAGN_BT_REDUCED_TX_PWR BIT(0) 19168c2ecf20Sopenharmony_ci 19178c2ecf20Sopenharmony_ci#define IWLAGN_BT_DECISION_LUT_SIZE 12 19188c2ecf20Sopenharmony_ci 19198c2ecf20Sopenharmony_cistruct iwl_basic_bt_cmd { 19208c2ecf20Sopenharmony_ci u8 flags; 19218c2ecf20Sopenharmony_ci u8 ledtime; /* unused */ 19228c2ecf20Sopenharmony_ci u8 max_kill; 19238c2ecf20Sopenharmony_ci u8 bt3_timer_t7_value; 19248c2ecf20Sopenharmony_ci __le32 kill_ack_mask; 19258c2ecf20Sopenharmony_ci __le32 kill_cts_mask; 19268c2ecf20Sopenharmony_ci u8 bt3_prio_sample_time; 19278c2ecf20Sopenharmony_ci u8 bt3_timer_t2_value; 19288c2ecf20Sopenharmony_ci __le16 bt4_reaction_time; /* unused */ 19298c2ecf20Sopenharmony_ci __le32 bt3_lookup_table[IWLAGN_BT_DECISION_LUT_SIZE]; 19308c2ecf20Sopenharmony_ci /* 19318c2ecf20Sopenharmony_ci * bit 0: use reduced tx power for control frame 19328c2ecf20Sopenharmony_ci * bit 1 - 7: reserved 19338c2ecf20Sopenharmony_ci */ 19348c2ecf20Sopenharmony_ci u8 reduce_txpower; 19358c2ecf20Sopenharmony_ci u8 reserved; 19368c2ecf20Sopenharmony_ci __le16 valid; 19378c2ecf20Sopenharmony_ci}; 19388c2ecf20Sopenharmony_ci 19398c2ecf20Sopenharmony_cistruct iwl_bt_cmd_v1 { 19408c2ecf20Sopenharmony_ci struct iwl_basic_bt_cmd basic; 19418c2ecf20Sopenharmony_ci u8 prio_boost; 19428c2ecf20Sopenharmony_ci /* 19438c2ecf20Sopenharmony_ci * set IWLAGN_BT_VALID_BOOST to "1" in "valid" bitmask 19448c2ecf20Sopenharmony_ci * if configure the following patterns 19458c2ecf20Sopenharmony_ci */ 19468c2ecf20Sopenharmony_ci u8 tx_prio_boost; /* SW boost of WiFi tx priority */ 19478c2ecf20Sopenharmony_ci __le16 rx_prio_boost; /* SW boost of WiFi rx priority */ 19488c2ecf20Sopenharmony_ci}; 19498c2ecf20Sopenharmony_ci 19508c2ecf20Sopenharmony_cistruct iwl_bt_cmd_v2 { 19518c2ecf20Sopenharmony_ci struct iwl_basic_bt_cmd basic; 19528c2ecf20Sopenharmony_ci __le32 prio_boost; 19538c2ecf20Sopenharmony_ci /* 19548c2ecf20Sopenharmony_ci * set IWLAGN_BT_VALID_BOOST to "1" in "valid" bitmask 19558c2ecf20Sopenharmony_ci * if configure the following patterns 19568c2ecf20Sopenharmony_ci */ 19578c2ecf20Sopenharmony_ci u8 reserved; 19588c2ecf20Sopenharmony_ci u8 tx_prio_boost; /* SW boost of WiFi tx priority */ 19598c2ecf20Sopenharmony_ci __le16 rx_prio_boost; /* SW boost of WiFi rx priority */ 19608c2ecf20Sopenharmony_ci}; 19618c2ecf20Sopenharmony_ci 19628c2ecf20Sopenharmony_ci#define IWLAGN_BT_SCO_ACTIVE cpu_to_le32(BIT(0)) 19638c2ecf20Sopenharmony_ci 19648c2ecf20Sopenharmony_cistruct iwlagn_bt_sco_cmd { 19658c2ecf20Sopenharmony_ci __le32 flags; 19668c2ecf20Sopenharmony_ci}; 19678c2ecf20Sopenharmony_ci 19688c2ecf20Sopenharmony_ci/****************************************************************************** 19698c2ecf20Sopenharmony_ci * (6) 19708c2ecf20Sopenharmony_ci * Spectrum Management (802.11h) Commands, Responses, Notifications: 19718c2ecf20Sopenharmony_ci * 19728c2ecf20Sopenharmony_ci *****************************************************************************/ 19738c2ecf20Sopenharmony_ci 19748c2ecf20Sopenharmony_ci/* 19758c2ecf20Sopenharmony_ci * Spectrum Management 19768c2ecf20Sopenharmony_ci */ 19778c2ecf20Sopenharmony_ci#define MEASUREMENT_FILTER_FLAG (RXON_FILTER_PROMISC_MSK | \ 19788c2ecf20Sopenharmony_ci RXON_FILTER_CTL2HOST_MSK | \ 19798c2ecf20Sopenharmony_ci RXON_FILTER_ACCEPT_GRP_MSK | \ 19808c2ecf20Sopenharmony_ci RXON_FILTER_DIS_DECRYPT_MSK | \ 19818c2ecf20Sopenharmony_ci RXON_FILTER_DIS_GRP_DECRYPT_MSK | \ 19828c2ecf20Sopenharmony_ci RXON_FILTER_ASSOC_MSK | \ 19838c2ecf20Sopenharmony_ci RXON_FILTER_BCON_AWARE_MSK) 19848c2ecf20Sopenharmony_ci 19858c2ecf20Sopenharmony_cistruct iwl_measure_channel { 19868c2ecf20Sopenharmony_ci __le32 duration; /* measurement duration in extended beacon 19878c2ecf20Sopenharmony_ci * format */ 19888c2ecf20Sopenharmony_ci u8 channel; /* channel to measure */ 19898c2ecf20Sopenharmony_ci u8 type; /* see enum iwl_measure_type */ 19908c2ecf20Sopenharmony_ci __le16 reserved; 19918c2ecf20Sopenharmony_ci} __packed; 19928c2ecf20Sopenharmony_ci 19938c2ecf20Sopenharmony_ci/* 19948c2ecf20Sopenharmony_ci * REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74 (command) 19958c2ecf20Sopenharmony_ci */ 19968c2ecf20Sopenharmony_cistruct iwl_spectrum_cmd { 19978c2ecf20Sopenharmony_ci __le16 len; /* number of bytes starting from token */ 19988c2ecf20Sopenharmony_ci u8 token; /* token id */ 19998c2ecf20Sopenharmony_ci u8 id; /* measurement id -- 0 or 1 */ 20008c2ecf20Sopenharmony_ci u8 origin; /* 0 = TGh, 1 = other, 2 = TGk */ 20018c2ecf20Sopenharmony_ci u8 periodic; /* 1 = periodic */ 20028c2ecf20Sopenharmony_ci __le16 path_loss_timeout; 20038c2ecf20Sopenharmony_ci __le32 start_time; /* start time in extended beacon format */ 20048c2ecf20Sopenharmony_ci __le32 reserved2; 20058c2ecf20Sopenharmony_ci __le32 flags; /* rxon flags */ 20068c2ecf20Sopenharmony_ci __le32 filter_flags; /* rxon filter flags */ 20078c2ecf20Sopenharmony_ci __le16 channel_count; /* minimum 1, maximum 10 */ 20088c2ecf20Sopenharmony_ci __le16 reserved3; 20098c2ecf20Sopenharmony_ci struct iwl_measure_channel channels[10]; 20108c2ecf20Sopenharmony_ci} __packed; 20118c2ecf20Sopenharmony_ci 20128c2ecf20Sopenharmony_ci/* 20138c2ecf20Sopenharmony_ci * REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74 (response) 20148c2ecf20Sopenharmony_ci */ 20158c2ecf20Sopenharmony_cistruct iwl_spectrum_resp { 20168c2ecf20Sopenharmony_ci u8 token; 20178c2ecf20Sopenharmony_ci u8 id; /* id of the prior command replaced, or 0xff */ 20188c2ecf20Sopenharmony_ci __le16 status; /* 0 - command will be handled 20198c2ecf20Sopenharmony_ci * 1 - cannot handle (conflicts with another 20208c2ecf20Sopenharmony_ci * measurement) */ 20218c2ecf20Sopenharmony_ci} __packed; 20228c2ecf20Sopenharmony_ci 20238c2ecf20Sopenharmony_cienum iwl_measurement_state { 20248c2ecf20Sopenharmony_ci IWL_MEASUREMENT_START = 0, 20258c2ecf20Sopenharmony_ci IWL_MEASUREMENT_STOP = 1, 20268c2ecf20Sopenharmony_ci}; 20278c2ecf20Sopenharmony_ci 20288c2ecf20Sopenharmony_cienum iwl_measurement_status { 20298c2ecf20Sopenharmony_ci IWL_MEASUREMENT_OK = 0, 20308c2ecf20Sopenharmony_ci IWL_MEASUREMENT_CONCURRENT = 1, 20318c2ecf20Sopenharmony_ci IWL_MEASUREMENT_CSA_CONFLICT = 2, 20328c2ecf20Sopenharmony_ci IWL_MEASUREMENT_TGH_CONFLICT = 3, 20338c2ecf20Sopenharmony_ci /* 4-5 reserved */ 20348c2ecf20Sopenharmony_ci IWL_MEASUREMENT_STOPPED = 6, 20358c2ecf20Sopenharmony_ci IWL_MEASUREMENT_TIMEOUT = 7, 20368c2ecf20Sopenharmony_ci IWL_MEASUREMENT_PERIODIC_FAILED = 8, 20378c2ecf20Sopenharmony_ci}; 20388c2ecf20Sopenharmony_ci 20398c2ecf20Sopenharmony_ci#define NUM_ELEMENTS_IN_HISTOGRAM 8 20408c2ecf20Sopenharmony_ci 20418c2ecf20Sopenharmony_cistruct iwl_measurement_histogram { 20428c2ecf20Sopenharmony_ci __le32 ofdm[NUM_ELEMENTS_IN_HISTOGRAM]; /* in 0.8usec counts */ 20438c2ecf20Sopenharmony_ci __le32 cck[NUM_ELEMENTS_IN_HISTOGRAM]; /* in 1usec counts */ 20448c2ecf20Sopenharmony_ci} __packed; 20458c2ecf20Sopenharmony_ci 20468c2ecf20Sopenharmony_ci/* clear channel availability counters */ 20478c2ecf20Sopenharmony_cistruct iwl_measurement_cca_counters { 20488c2ecf20Sopenharmony_ci __le32 ofdm; 20498c2ecf20Sopenharmony_ci __le32 cck; 20508c2ecf20Sopenharmony_ci} __packed; 20518c2ecf20Sopenharmony_ci 20528c2ecf20Sopenharmony_cienum iwl_measure_type { 20538c2ecf20Sopenharmony_ci IWL_MEASURE_BASIC = (1 << 0), 20548c2ecf20Sopenharmony_ci IWL_MEASURE_CHANNEL_LOAD = (1 << 1), 20558c2ecf20Sopenharmony_ci IWL_MEASURE_HISTOGRAM_RPI = (1 << 2), 20568c2ecf20Sopenharmony_ci IWL_MEASURE_HISTOGRAM_NOISE = (1 << 3), 20578c2ecf20Sopenharmony_ci IWL_MEASURE_FRAME = (1 << 4), 20588c2ecf20Sopenharmony_ci /* bits 5:6 are reserved */ 20598c2ecf20Sopenharmony_ci IWL_MEASURE_IDLE = (1 << 7), 20608c2ecf20Sopenharmony_ci}; 20618c2ecf20Sopenharmony_ci 20628c2ecf20Sopenharmony_ci/* 20638c2ecf20Sopenharmony_ci * SPECTRUM_MEASURE_NOTIFICATION = 0x75 (notification only, not a command) 20648c2ecf20Sopenharmony_ci */ 20658c2ecf20Sopenharmony_cistruct iwl_spectrum_notification { 20668c2ecf20Sopenharmony_ci u8 id; /* measurement id -- 0 or 1 */ 20678c2ecf20Sopenharmony_ci u8 token; 20688c2ecf20Sopenharmony_ci u8 channel_index; /* index in measurement channel list */ 20698c2ecf20Sopenharmony_ci u8 state; /* 0 - start, 1 - stop */ 20708c2ecf20Sopenharmony_ci __le32 start_time; /* lower 32-bits of TSF */ 20718c2ecf20Sopenharmony_ci u8 band; /* 0 - 5.2GHz, 1 - 2.4GHz */ 20728c2ecf20Sopenharmony_ci u8 channel; 20738c2ecf20Sopenharmony_ci u8 type; /* see enum iwl_measurement_type */ 20748c2ecf20Sopenharmony_ci u8 reserved1; 20758c2ecf20Sopenharmony_ci /* NOTE: cca_ofdm, cca_cck, basic_type, and histogram are only only 20768c2ecf20Sopenharmony_ci * valid if applicable for measurement type requested. */ 20778c2ecf20Sopenharmony_ci __le32 cca_ofdm; /* cca fraction time in 40Mhz clock periods */ 20788c2ecf20Sopenharmony_ci __le32 cca_cck; /* cca fraction time in 44Mhz clock periods */ 20798c2ecf20Sopenharmony_ci __le32 cca_time; /* channel load time in usecs */ 20808c2ecf20Sopenharmony_ci u8 basic_type; /* 0 - bss, 1 - ofdm preamble, 2 - 20818c2ecf20Sopenharmony_ci * unidentified */ 20828c2ecf20Sopenharmony_ci u8 reserved2[3]; 20838c2ecf20Sopenharmony_ci struct iwl_measurement_histogram histogram; 20848c2ecf20Sopenharmony_ci __le32 stop_time; /* lower 32-bits of TSF */ 20858c2ecf20Sopenharmony_ci __le32 status; /* see iwl_measurement_status */ 20868c2ecf20Sopenharmony_ci} __packed; 20878c2ecf20Sopenharmony_ci 20888c2ecf20Sopenharmony_ci/****************************************************************************** 20898c2ecf20Sopenharmony_ci * (7) 20908c2ecf20Sopenharmony_ci * Power Management Commands, Responses, Notifications: 20918c2ecf20Sopenharmony_ci * 20928c2ecf20Sopenharmony_ci *****************************************************************************/ 20938c2ecf20Sopenharmony_ci 20948c2ecf20Sopenharmony_ci/** 20958c2ecf20Sopenharmony_ci * struct iwl_powertable_cmd - Power Table Command 20968c2ecf20Sopenharmony_ci * @flags: See below: 20978c2ecf20Sopenharmony_ci * 20988c2ecf20Sopenharmony_ci * POWER_TABLE_CMD = 0x77 (command, has simple generic response) 20998c2ecf20Sopenharmony_ci * 21008c2ecf20Sopenharmony_ci * PM allow: 21018c2ecf20Sopenharmony_ci * bit 0 - '0' Driver not allow power management 21028c2ecf20Sopenharmony_ci * '1' Driver allow PM (use rest of parameters) 21038c2ecf20Sopenharmony_ci * 21048c2ecf20Sopenharmony_ci * uCode send sleep notifications: 21058c2ecf20Sopenharmony_ci * bit 1 - '0' Don't send sleep notification 21068c2ecf20Sopenharmony_ci * '1' send sleep notification (SEND_PM_NOTIFICATION) 21078c2ecf20Sopenharmony_ci * 21088c2ecf20Sopenharmony_ci * Sleep over DTIM 21098c2ecf20Sopenharmony_ci * bit 2 - '0' PM have to walk up every DTIM 21108c2ecf20Sopenharmony_ci * '1' PM could sleep over DTIM till listen Interval. 21118c2ecf20Sopenharmony_ci * 21128c2ecf20Sopenharmony_ci * PCI power managed 21138c2ecf20Sopenharmony_ci * bit 3 - '0' (PCI_CFG_LINK_CTRL & 0x1) 21148c2ecf20Sopenharmony_ci * '1' !(PCI_CFG_LINK_CTRL & 0x1) 21158c2ecf20Sopenharmony_ci * 21168c2ecf20Sopenharmony_ci * Fast PD 21178c2ecf20Sopenharmony_ci * bit 4 - '1' Put radio to sleep when receiving frame for others 21188c2ecf20Sopenharmony_ci * 21198c2ecf20Sopenharmony_ci * Force sleep Modes 21208c2ecf20Sopenharmony_ci * bit 31/30- '00' use both mac/xtal sleeps 21218c2ecf20Sopenharmony_ci * '01' force Mac sleep 21228c2ecf20Sopenharmony_ci * '10' force xtal sleep 21238c2ecf20Sopenharmony_ci * '11' Illegal set 21248c2ecf20Sopenharmony_ci * 21258c2ecf20Sopenharmony_ci * NOTE: if sleep_interval[SLEEP_INTRVL_TABLE_SIZE-1] > DTIM period then 21268c2ecf20Sopenharmony_ci * ucode assume sleep over DTIM is allowed and we don't need to wake up 21278c2ecf20Sopenharmony_ci * for every DTIM. 21288c2ecf20Sopenharmony_ci */ 21298c2ecf20Sopenharmony_ci#define IWL_POWER_VEC_SIZE 5 21308c2ecf20Sopenharmony_ci 21318c2ecf20Sopenharmony_ci#define IWL_POWER_DRIVER_ALLOW_SLEEP_MSK cpu_to_le16(BIT(0)) 21328c2ecf20Sopenharmony_ci#define IWL_POWER_POWER_SAVE_ENA_MSK cpu_to_le16(BIT(0)) 21338c2ecf20Sopenharmony_ci#define IWL_POWER_POWER_MANAGEMENT_ENA_MSK cpu_to_le16(BIT(1)) 21348c2ecf20Sopenharmony_ci#define IWL_POWER_SLEEP_OVER_DTIM_MSK cpu_to_le16(BIT(2)) 21358c2ecf20Sopenharmony_ci#define IWL_POWER_PCI_PM_MSK cpu_to_le16(BIT(3)) 21368c2ecf20Sopenharmony_ci#define IWL_POWER_FAST_PD cpu_to_le16(BIT(4)) 21378c2ecf20Sopenharmony_ci#define IWL_POWER_BEACON_FILTERING cpu_to_le16(BIT(5)) 21388c2ecf20Sopenharmony_ci#define IWL_POWER_SHADOW_REG_ENA cpu_to_le16(BIT(6)) 21398c2ecf20Sopenharmony_ci#define IWL_POWER_CT_KILL_SET cpu_to_le16(BIT(7)) 21408c2ecf20Sopenharmony_ci#define IWL_POWER_BT_SCO_ENA cpu_to_le16(BIT(8)) 21418c2ecf20Sopenharmony_ci#define IWL_POWER_ADVANCE_PM_ENA_MSK cpu_to_le16(BIT(9)) 21428c2ecf20Sopenharmony_ci 21438c2ecf20Sopenharmony_cistruct iwl_powertable_cmd { 21448c2ecf20Sopenharmony_ci __le16 flags; 21458c2ecf20Sopenharmony_ci u8 keep_alive_seconds; 21468c2ecf20Sopenharmony_ci u8 debug_flags; 21478c2ecf20Sopenharmony_ci __le32 rx_data_timeout; 21488c2ecf20Sopenharmony_ci __le32 tx_data_timeout; 21498c2ecf20Sopenharmony_ci __le32 sleep_interval[IWL_POWER_VEC_SIZE]; 21508c2ecf20Sopenharmony_ci __le32 keep_alive_beacons; 21518c2ecf20Sopenharmony_ci} __packed; 21528c2ecf20Sopenharmony_ci 21538c2ecf20Sopenharmony_ci/* 21548c2ecf20Sopenharmony_ci * PM_SLEEP_NOTIFICATION = 0x7A (notification only, not a command) 21558c2ecf20Sopenharmony_ci * all devices identical. 21568c2ecf20Sopenharmony_ci */ 21578c2ecf20Sopenharmony_cistruct iwl_sleep_notification { 21588c2ecf20Sopenharmony_ci u8 pm_sleep_mode; 21598c2ecf20Sopenharmony_ci u8 pm_wakeup_src; 21608c2ecf20Sopenharmony_ci __le16 reserved; 21618c2ecf20Sopenharmony_ci __le32 sleep_time; 21628c2ecf20Sopenharmony_ci __le32 tsf_low; 21638c2ecf20Sopenharmony_ci __le32 bcon_timer; 21648c2ecf20Sopenharmony_ci} __packed; 21658c2ecf20Sopenharmony_ci 21668c2ecf20Sopenharmony_ci/* Sleep states. all devices identical. */ 21678c2ecf20Sopenharmony_cienum { 21688c2ecf20Sopenharmony_ci IWL_PM_NO_SLEEP = 0, 21698c2ecf20Sopenharmony_ci IWL_PM_SLP_MAC = 1, 21708c2ecf20Sopenharmony_ci IWL_PM_SLP_FULL_MAC_UNASSOCIATE = 2, 21718c2ecf20Sopenharmony_ci IWL_PM_SLP_FULL_MAC_CARD_STATE = 3, 21728c2ecf20Sopenharmony_ci IWL_PM_SLP_PHY = 4, 21738c2ecf20Sopenharmony_ci IWL_PM_SLP_REPENT = 5, 21748c2ecf20Sopenharmony_ci IWL_PM_WAKEUP_BY_TIMER = 6, 21758c2ecf20Sopenharmony_ci IWL_PM_WAKEUP_BY_DRIVER = 7, 21768c2ecf20Sopenharmony_ci IWL_PM_WAKEUP_BY_RFKILL = 8, 21778c2ecf20Sopenharmony_ci /* 3 reserved */ 21788c2ecf20Sopenharmony_ci IWL_PM_NUM_OF_MODES = 12, 21798c2ecf20Sopenharmony_ci}; 21808c2ecf20Sopenharmony_ci 21818c2ecf20Sopenharmony_ci/* 21828c2ecf20Sopenharmony_ci * REPLY_CARD_STATE_CMD = 0xa0 (command, has simple generic response) 21838c2ecf20Sopenharmony_ci */ 21848c2ecf20Sopenharmony_ci#define CARD_STATE_CMD_DISABLE 0x00 /* Put card to sleep */ 21858c2ecf20Sopenharmony_ci#define CARD_STATE_CMD_ENABLE 0x01 /* Wake up card */ 21868c2ecf20Sopenharmony_ci#define CARD_STATE_CMD_HALT 0x02 /* Power down permanently */ 21878c2ecf20Sopenharmony_cistruct iwl_card_state_cmd { 21888c2ecf20Sopenharmony_ci __le32 status; /* CARD_STATE_CMD_* request new power state */ 21898c2ecf20Sopenharmony_ci} __packed; 21908c2ecf20Sopenharmony_ci 21918c2ecf20Sopenharmony_ci/* 21928c2ecf20Sopenharmony_ci * CARD_STATE_NOTIFICATION = 0xa1 (notification only, not a command) 21938c2ecf20Sopenharmony_ci */ 21948c2ecf20Sopenharmony_cistruct iwl_card_state_notif { 21958c2ecf20Sopenharmony_ci __le32 flags; 21968c2ecf20Sopenharmony_ci} __packed; 21978c2ecf20Sopenharmony_ci 21988c2ecf20Sopenharmony_ci#define HW_CARD_DISABLED 0x01 21998c2ecf20Sopenharmony_ci#define SW_CARD_DISABLED 0x02 22008c2ecf20Sopenharmony_ci#define CT_CARD_DISABLED 0x04 22018c2ecf20Sopenharmony_ci#define RXON_CARD_DISABLED 0x10 22028c2ecf20Sopenharmony_ci 22038c2ecf20Sopenharmony_cistruct iwl_ct_kill_config { 22048c2ecf20Sopenharmony_ci __le32 reserved; 22058c2ecf20Sopenharmony_ci __le32 critical_temperature_M; 22068c2ecf20Sopenharmony_ci __le32 critical_temperature_R; 22078c2ecf20Sopenharmony_ci} __packed; 22088c2ecf20Sopenharmony_ci 22098c2ecf20Sopenharmony_ci/* 1000, and 6x00 */ 22108c2ecf20Sopenharmony_cistruct iwl_ct_kill_throttling_config { 22118c2ecf20Sopenharmony_ci __le32 critical_temperature_exit; 22128c2ecf20Sopenharmony_ci __le32 reserved; 22138c2ecf20Sopenharmony_ci __le32 critical_temperature_enter; 22148c2ecf20Sopenharmony_ci} __packed; 22158c2ecf20Sopenharmony_ci 22168c2ecf20Sopenharmony_ci/****************************************************************************** 22178c2ecf20Sopenharmony_ci * (8) 22188c2ecf20Sopenharmony_ci * Scan Commands, Responses, Notifications: 22198c2ecf20Sopenharmony_ci * 22208c2ecf20Sopenharmony_ci *****************************************************************************/ 22218c2ecf20Sopenharmony_ci 22228c2ecf20Sopenharmony_ci#define SCAN_CHANNEL_TYPE_PASSIVE cpu_to_le32(0) 22238c2ecf20Sopenharmony_ci#define SCAN_CHANNEL_TYPE_ACTIVE cpu_to_le32(1) 22248c2ecf20Sopenharmony_ci 22258c2ecf20Sopenharmony_ci/** 22268c2ecf20Sopenharmony_ci * struct iwl_scan_channel - entry in REPLY_SCAN_CMD channel table 22278c2ecf20Sopenharmony_ci * 22288c2ecf20Sopenharmony_ci * One for each channel in the scan list. 22298c2ecf20Sopenharmony_ci * Each channel can independently select: 22308c2ecf20Sopenharmony_ci * 1) SSID for directed active scans 22318c2ecf20Sopenharmony_ci * 2) Txpower setting (for rate specified within Tx command) 22328c2ecf20Sopenharmony_ci * 3) How long to stay on-channel (behavior may be modified by quiet_time, 22338c2ecf20Sopenharmony_ci * quiet_plcp_th, good_CRC_th) 22348c2ecf20Sopenharmony_ci * 22358c2ecf20Sopenharmony_ci * To avoid uCode errors, make sure the following are true (see comments 22368c2ecf20Sopenharmony_ci * under struct iwl_scan_cmd about max_out_time and quiet_time): 22378c2ecf20Sopenharmony_ci * 1) If using passive_dwell (i.e. passive_dwell != 0): 22388c2ecf20Sopenharmony_ci * active_dwell <= passive_dwell (< max_out_time if max_out_time != 0) 22398c2ecf20Sopenharmony_ci * 2) quiet_time <= active_dwell 22408c2ecf20Sopenharmony_ci * 3) If restricting off-channel time (i.e. max_out_time !=0): 22418c2ecf20Sopenharmony_ci * passive_dwell < max_out_time 22428c2ecf20Sopenharmony_ci * active_dwell < max_out_time 22438c2ecf20Sopenharmony_ci */ 22448c2ecf20Sopenharmony_ci 22458c2ecf20Sopenharmony_cistruct iwl_scan_channel { 22468c2ecf20Sopenharmony_ci /* 22478c2ecf20Sopenharmony_ci * type is defined as: 22488c2ecf20Sopenharmony_ci * 0:0 1 = active, 0 = passive 22498c2ecf20Sopenharmony_ci * 1:20 SSID direct bit map; if a bit is set, then corresponding 22508c2ecf20Sopenharmony_ci * SSID IE is transmitted in probe request. 22518c2ecf20Sopenharmony_ci * 21:31 reserved 22528c2ecf20Sopenharmony_ci */ 22538c2ecf20Sopenharmony_ci __le32 type; 22548c2ecf20Sopenharmony_ci __le16 channel; /* band is selected by iwl_scan_cmd "flags" field */ 22558c2ecf20Sopenharmony_ci u8 tx_gain; /* gain for analog radio */ 22568c2ecf20Sopenharmony_ci u8 dsp_atten; /* gain for DSP */ 22578c2ecf20Sopenharmony_ci __le16 active_dwell; /* in 1024-uSec TU (time units), typ 5-50 */ 22588c2ecf20Sopenharmony_ci __le16 passive_dwell; /* in 1024-uSec TU (time units), typ 20-500 */ 22598c2ecf20Sopenharmony_ci} __packed; 22608c2ecf20Sopenharmony_ci 22618c2ecf20Sopenharmony_ci/* set number of direct probes __le32 type */ 22628c2ecf20Sopenharmony_ci#define IWL_SCAN_PROBE_MASK(n) cpu_to_le32((BIT(n) | (BIT(n) - BIT(1)))) 22638c2ecf20Sopenharmony_ci 22648c2ecf20Sopenharmony_ci/** 22658c2ecf20Sopenharmony_ci * struct iwl_ssid_ie - directed scan network information element 22668c2ecf20Sopenharmony_ci * 22678c2ecf20Sopenharmony_ci * Up to 20 of these may appear in REPLY_SCAN_CMD, 22688c2ecf20Sopenharmony_ci * selected by "type" bit field in struct iwl_scan_channel; 22698c2ecf20Sopenharmony_ci * each channel may select different ssids from among the 20 entries. 22708c2ecf20Sopenharmony_ci * SSID IEs get transmitted in reverse order of entry. 22718c2ecf20Sopenharmony_ci */ 22728c2ecf20Sopenharmony_cistruct iwl_ssid_ie { 22738c2ecf20Sopenharmony_ci u8 id; 22748c2ecf20Sopenharmony_ci u8 len; 22758c2ecf20Sopenharmony_ci u8 ssid[32]; 22768c2ecf20Sopenharmony_ci} __packed; 22778c2ecf20Sopenharmony_ci 22788c2ecf20Sopenharmony_ci#define PROBE_OPTION_MAX 20 22798c2ecf20Sopenharmony_ci#define TX_CMD_LIFE_TIME_INFINITE cpu_to_le32(0xFFFFFFFF) 22808c2ecf20Sopenharmony_ci#define IWL_GOOD_CRC_TH_DISABLED 0 22818c2ecf20Sopenharmony_ci#define IWL_GOOD_CRC_TH_DEFAULT cpu_to_le16(1) 22828c2ecf20Sopenharmony_ci#define IWL_GOOD_CRC_TH_NEVER cpu_to_le16(0xffff) 22838c2ecf20Sopenharmony_ci#define IWL_MAX_CMD_SIZE 4096 22848c2ecf20Sopenharmony_ci 22858c2ecf20Sopenharmony_ci/* 22868c2ecf20Sopenharmony_ci * REPLY_SCAN_CMD = 0x80 (command) 22878c2ecf20Sopenharmony_ci * 22888c2ecf20Sopenharmony_ci * The hardware scan command is very powerful; the driver can set it up to 22898c2ecf20Sopenharmony_ci * maintain (relatively) normal network traffic while doing a scan in the 22908c2ecf20Sopenharmony_ci * background. The max_out_time and suspend_time control the ratio of how 22918c2ecf20Sopenharmony_ci * long the device stays on an associated network channel ("service channel") 22928c2ecf20Sopenharmony_ci * vs. how long it's away from the service channel, i.e. tuned to other channels 22938c2ecf20Sopenharmony_ci * for scanning. 22948c2ecf20Sopenharmony_ci * 22958c2ecf20Sopenharmony_ci * max_out_time is the max time off-channel (in usec), and suspend_time 22968c2ecf20Sopenharmony_ci * is how long (in "extended beacon" format) that the scan is "suspended" 22978c2ecf20Sopenharmony_ci * after returning to the service channel. That is, suspend_time is the 22988c2ecf20Sopenharmony_ci * time that we stay on the service channel, doing normal work, between 22998c2ecf20Sopenharmony_ci * scan segments. The driver may set these parameters differently to support 23008c2ecf20Sopenharmony_ci * scanning when associated vs. not associated, and light vs. heavy traffic 23018c2ecf20Sopenharmony_ci * loads when associated. 23028c2ecf20Sopenharmony_ci * 23038c2ecf20Sopenharmony_ci * After receiving this command, the device's scan engine does the following; 23048c2ecf20Sopenharmony_ci * 23058c2ecf20Sopenharmony_ci * 1) Sends SCAN_START notification to driver 23068c2ecf20Sopenharmony_ci * 2) Checks to see if it has time to do scan for one channel 23078c2ecf20Sopenharmony_ci * 3) Sends NULL packet, with power-save (PS) bit set to 1, 23088c2ecf20Sopenharmony_ci * to tell AP that we're going off-channel 23098c2ecf20Sopenharmony_ci * 4) Tunes to first channel in scan list, does active or passive scan 23108c2ecf20Sopenharmony_ci * 5) Sends SCAN_RESULT notification to driver 23118c2ecf20Sopenharmony_ci * 6) Checks to see if it has time to do scan on *next* channel in list 23128c2ecf20Sopenharmony_ci * 7) Repeats 4-6 until it no longer has time to scan the next channel 23138c2ecf20Sopenharmony_ci * before max_out_time expires 23148c2ecf20Sopenharmony_ci * 8) Returns to service channel 23158c2ecf20Sopenharmony_ci * 9) Sends NULL packet with PS=0 to tell AP that we're back 23168c2ecf20Sopenharmony_ci * 10) Stays on service channel until suspend_time expires 23178c2ecf20Sopenharmony_ci * 11) Repeats entire process 2-10 until list is complete 23188c2ecf20Sopenharmony_ci * 12) Sends SCAN_COMPLETE notification 23198c2ecf20Sopenharmony_ci * 23208c2ecf20Sopenharmony_ci * For fast, efficient scans, the scan command also has support for staying on 23218c2ecf20Sopenharmony_ci * a channel for just a short time, if doing active scanning and getting no 23228c2ecf20Sopenharmony_ci * responses to the transmitted probe request. This time is controlled by 23238c2ecf20Sopenharmony_ci * quiet_time, and the number of received packets below which a channel is 23248c2ecf20Sopenharmony_ci * considered "quiet" is controlled by quiet_plcp_threshold. 23258c2ecf20Sopenharmony_ci * 23268c2ecf20Sopenharmony_ci * For active scanning on channels that have regulatory restrictions against 23278c2ecf20Sopenharmony_ci * blindly transmitting, the scan can listen before transmitting, to make sure 23288c2ecf20Sopenharmony_ci * that there is already legitimate activity on the channel. If enough 23298c2ecf20Sopenharmony_ci * packets are cleanly received on the channel (controlled by good_CRC_th, 23308c2ecf20Sopenharmony_ci * typical value 1), the scan engine starts transmitting probe requests. 23318c2ecf20Sopenharmony_ci * 23328c2ecf20Sopenharmony_ci * Driver must use separate scan commands for 2.4 vs. 5 GHz bands. 23338c2ecf20Sopenharmony_ci * 23348c2ecf20Sopenharmony_ci * To avoid uCode errors, see timing restrictions described under 23358c2ecf20Sopenharmony_ci * struct iwl_scan_channel. 23368c2ecf20Sopenharmony_ci */ 23378c2ecf20Sopenharmony_ci 23388c2ecf20Sopenharmony_cienum iwl_scan_flags { 23398c2ecf20Sopenharmony_ci /* BIT(0) currently unused */ 23408c2ecf20Sopenharmony_ci IWL_SCAN_FLAGS_ACTION_FRAME_TX = BIT(1), 23418c2ecf20Sopenharmony_ci /* bits 2-7 reserved */ 23428c2ecf20Sopenharmony_ci}; 23438c2ecf20Sopenharmony_ci 23448c2ecf20Sopenharmony_cistruct iwl_scan_cmd { 23458c2ecf20Sopenharmony_ci __le16 len; 23468c2ecf20Sopenharmony_ci u8 scan_flags; /* scan flags: see enum iwl_scan_flags */ 23478c2ecf20Sopenharmony_ci u8 channel_count; /* # channels in channel list */ 23488c2ecf20Sopenharmony_ci __le16 quiet_time; /* dwell only this # millisecs on quiet channel 23498c2ecf20Sopenharmony_ci * (only for active scan) */ 23508c2ecf20Sopenharmony_ci __le16 quiet_plcp_th; /* quiet chnl is < this # pkts (typ. 1) */ 23518c2ecf20Sopenharmony_ci __le16 good_CRC_th; /* passive -> active promotion threshold */ 23528c2ecf20Sopenharmony_ci __le16 rx_chain; /* RXON_RX_CHAIN_* */ 23538c2ecf20Sopenharmony_ci __le32 max_out_time; /* max usec to be away from associated (service) 23548c2ecf20Sopenharmony_ci * channel */ 23558c2ecf20Sopenharmony_ci __le32 suspend_time; /* pause scan this long (in "extended beacon 23568c2ecf20Sopenharmony_ci * format") when returning to service chnl: 23578c2ecf20Sopenharmony_ci */ 23588c2ecf20Sopenharmony_ci __le32 flags; /* RXON_FLG_* */ 23598c2ecf20Sopenharmony_ci __le32 filter_flags; /* RXON_FILTER_* */ 23608c2ecf20Sopenharmony_ci 23618c2ecf20Sopenharmony_ci /* For active scans (set to all-0s for passive scans). 23628c2ecf20Sopenharmony_ci * Does not include payload. Must specify Tx rate; no rate scaling. */ 23638c2ecf20Sopenharmony_ci struct iwl_tx_cmd tx_cmd; 23648c2ecf20Sopenharmony_ci 23658c2ecf20Sopenharmony_ci /* For directed active scans (set to all-0s otherwise) */ 23668c2ecf20Sopenharmony_ci struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX]; 23678c2ecf20Sopenharmony_ci 23688c2ecf20Sopenharmony_ci /* 23698c2ecf20Sopenharmony_ci * Probe request frame, followed by channel list. 23708c2ecf20Sopenharmony_ci * 23718c2ecf20Sopenharmony_ci * Size of probe request frame is specified by byte count in tx_cmd. 23728c2ecf20Sopenharmony_ci * Channel list follows immediately after probe request frame. 23738c2ecf20Sopenharmony_ci * Number of channels in list is specified by channel_count. 23748c2ecf20Sopenharmony_ci * Each channel in list is of type: 23758c2ecf20Sopenharmony_ci * 23768c2ecf20Sopenharmony_ci * struct iwl_scan_channel channels[0]; 23778c2ecf20Sopenharmony_ci * 23788c2ecf20Sopenharmony_ci * NOTE: Only one band of channels can be scanned per pass. You 23798c2ecf20Sopenharmony_ci * must not mix 2.4GHz channels and 5.2GHz channels, and you must wait 23808c2ecf20Sopenharmony_ci * for one scan to complete (i.e. receive SCAN_COMPLETE_NOTIFICATION) 23818c2ecf20Sopenharmony_ci * before requesting another scan. 23828c2ecf20Sopenharmony_ci */ 23838c2ecf20Sopenharmony_ci u8 data[]; 23848c2ecf20Sopenharmony_ci} __packed; 23858c2ecf20Sopenharmony_ci 23868c2ecf20Sopenharmony_ci/* Can abort will notify by complete notification with abort status. */ 23878c2ecf20Sopenharmony_ci#define CAN_ABORT_STATUS cpu_to_le32(0x1) 23888c2ecf20Sopenharmony_ci/* complete notification statuses */ 23898c2ecf20Sopenharmony_ci#define ABORT_STATUS 0x2 23908c2ecf20Sopenharmony_ci 23918c2ecf20Sopenharmony_ci/* 23928c2ecf20Sopenharmony_ci * REPLY_SCAN_CMD = 0x80 (response) 23938c2ecf20Sopenharmony_ci */ 23948c2ecf20Sopenharmony_cistruct iwl_scanreq_notification { 23958c2ecf20Sopenharmony_ci __le32 status; /* 1: okay, 2: cannot fulfill request */ 23968c2ecf20Sopenharmony_ci} __packed; 23978c2ecf20Sopenharmony_ci 23988c2ecf20Sopenharmony_ci/* 23998c2ecf20Sopenharmony_ci * SCAN_START_NOTIFICATION = 0x82 (notification only, not a command) 24008c2ecf20Sopenharmony_ci */ 24018c2ecf20Sopenharmony_cistruct iwl_scanstart_notification { 24028c2ecf20Sopenharmony_ci __le32 tsf_low; 24038c2ecf20Sopenharmony_ci __le32 tsf_high; 24048c2ecf20Sopenharmony_ci __le32 beacon_timer; 24058c2ecf20Sopenharmony_ci u8 channel; 24068c2ecf20Sopenharmony_ci u8 band; 24078c2ecf20Sopenharmony_ci u8 reserved[2]; 24088c2ecf20Sopenharmony_ci __le32 status; 24098c2ecf20Sopenharmony_ci} __packed; 24108c2ecf20Sopenharmony_ci 24118c2ecf20Sopenharmony_ci#define SCAN_OWNER_STATUS 0x1 24128c2ecf20Sopenharmony_ci#define MEASURE_OWNER_STATUS 0x2 24138c2ecf20Sopenharmony_ci 24148c2ecf20Sopenharmony_ci#define IWL_PROBE_STATUS_OK 0 24158c2ecf20Sopenharmony_ci#define IWL_PROBE_STATUS_TX_FAILED BIT(0) 24168c2ecf20Sopenharmony_ci/* error statuses combined with TX_FAILED */ 24178c2ecf20Sopenharmony_ci#define IWL_PROBE_STATUS_FAIL_TTL BIT(1) 24188c2ecf20Sopenharmony_ci#define IWL_PROBE_STATUS_FAIL_BT BIT(2) 24198c2ecf20Sopenharmony_ci 24208c2ecf20Sopenharmony_ci#define NUMBER_OF_STATISTICS 1 /* first __le32 is good CRC */ 24218c2ecf20Sopenharmony_ci/* 24228c2ecf20Sopenharmony_ci * SCAN_RESULTS_NOTIFICATION = 0x83 (notification only, not a command) 24238c2ecf20Sopenharmony_ci */ 24248c2ecf20Sopenharmony_cistruct iwl_scanresults_notification { 24258c2ecf20Sopenharmony_ci u8 channel; 24268c2ecf20Sopenharmony_ci u8 band; 24278c2ecf20Sopenharmony_ci u8 probe_status; 24288c2ecf20Sopenharmony_ci u8 num_probe_not_sent; /* not enough time to send */ 24298c2ecf20Sopenharmony_ci __le32 tsf_low; 24308c2ecf20Sopenharmony_ci __le32 tsf_high; 24318c2ecf20Sopenharmony_ci __le32 statistics[NUMBER_OF_STATISTICS]; 24328c2ecf20Sopenharmony_ci} __packed; 24338c2ecf20Sopenharmony_ci 24348c2ecf20Sopenharmony_ci/* 24358c2ecf20Sopenharmony_ci * SCAN_COMPLETE_NOTIFICATION = 0x84 (notification only, not a command) 24368c2ecf20Sopenharmony_ci */ 24378c2ecf20Sopenharmony_cistruct iwl_scancomplete_notification { 24388c2ecf20Sopenharmony_ci u8 scanned_channels; 24398c2ecf20Sopenharmony_ci u8 status; 24408c2ecf20Sopenharmony_ci u8 bt_status; /* BT On/Off status */ 24418c2ecf20Sopenharmony_ci u8 last_channel; 24428c2ecf20Sopenharmony_ci __le32 tsf_low; 24438c2ecf20Sopenharmony_ci __le32 tsf_high; 24448c2ecf20Sopenharmony_ci} __packed; 24458c2ecf20Sopenharmony_ci 24468c2ecf20Sopenharmony_ci 24478c2ecf20Sopenharmony_ci/****************************************************************************** 24488c2ecf20Sopenharmony_ci * (9) 24498c2ecf20Sopenharmony_ci * IBSS/AP Commands and Notifications: 24508c2ecf20Sopenharmony_ci * 24518c2ecf20Sopenharmony_ci *****************************************************************************/ 24528c2ecf20Sopenharmony_ci 24538c2ecf20Sopenharmony_cienum iwl_ibss_manager { 24548c2ecf20Sopenharmony_ci IWL_NOT_IBSS_MANAGER = 0, 24558c2ecf20Sopenharmony_ci IWL_IBSS_MANAGER = 1, 24568c2ecf20Sopenharmony_ci}; 24578c2ecf20Sopenharmony_ci 24588c2ecf20Sopenharmony_ci/* 24598c2ecf20Sopenharmony_ci * BEACON_NOTIFICATION = 0x90 (notification only, not a command) 24608c2ecf20Sopenharmony_ci */ 24618c2ecf20Sopenharmony_ci 24628c2ecf20Sopenharmony_cistruct iwlagn_beacon_notif { 24638c2ecf20Sopenharmony_ci struct iwlagn_tx_resp beacon_notify_hdr; 24648c2ecf20Sopenharmony_ci __le32 low_tsf; 24658c2ecf20Sopenharmony_ci __le32 high_tsf; 24668c2ecf20Sopenharmony_ci __le32 ibss_mgr_status; 24678c2ecf20Sopenharmony_ci} __packed; 24688c2ecf20Sopenharmony_ci 24698c2ecf20Sopenharmony_ci/* 24708c2ecf20Sopenharmony_ci * REPLY_TX_BEACON = 0x91 (command, has simple generic response) 24718c2ecf20Sopenharmony_ci */ 24728c2ecf20Sopenharmony_ci 24738c2ecf20Sopenharmony_cistruct iwl_tx_beacon_cmd { 24748c2ecf20Sopenharmony_ci struct iwl_tx_cmd tx; 24758c2ecf20Sopenharmony_ci __le16 tim_idx; 24768c2ecf20Sopenharmony_ci u8 tim_size; 24778c2ecf20Sopenharmony_ci u8 reserved1; 24788c2ecf20Sopenharmony_ci struct ieee80211_hdr frame[]; /* beacon frame */ 24798c2ecf20Sopenharmony_ci} __packed; 24808c2ecf20Sopenharmony_ci 24818c2ecf20Sopenharmony_ci/****************************************************************************** 24828c2ecf20Sopenharmony_ci * (10) 24838c2ecf20Sopenharmony_ci * Statistics Commands and Notifications: 24848c2ecf20Sopenharmony_ci * 24858c2ecf20Sopenharmony_ci *****************************************************************************/ 24868c2ecf20Sopenharmony_ci 24878c2ecf20Sopenharmony_ci#define IWL_TEMP_CONVERT 260 24888c2ecf20Sopenharmony_ci 24898c2ecf20Sopenharmony_ci#define SUP_RATE_11A_MAX_NUM_CHANNELS 8 24908c2ecf20Sopenharmony_ci#define SUP_RATE_11B_MAX_NUM_CHANNELS 4 24918c2ecf20Sopenharmony_ci#define SUP_RATE_11G_MAX_NUM_CHANNELS 12 24928c2ecf20Sopenharmony_ci 24938c2ecf20Sopenharmony_ci/* Used for passing to driver number of successes and failures per rate */ 24948c2ecf20Sopenharmony_cistruct rate_histogram { 24958c2ecf20Sopenharmony_ci union { 24968c2ecf20Sopenharmony_ci __le32 a[SUP_RATE_11A_MAX_NUM_CHANNELS]; 24978c2ecf20Sopenharmony_ci __le32 b[SUP_RATE_11B_MAX_NUM_CHANNELS]; 24988c2ecf20Sopenharmony_ci __le32 g[SUP_RATE_11G_MAX_NUM_CHANNELS]; 24998c2ecf20Sopenharmony_ci } success; 25008c2ecf20Sopenharmony_ci union { 25018c2ecf20Sopenharmony_ci __le32 a[SUP_RATE_11A_MAX_NUM_CHANNELS]; 25028c2ecf20Sopenharmony_ci __le32 b[SUP_RATE_11B_MAX_NUM_CHANNELS]; 25038c2ecf20Sopenharmony_ci __le32 g[SUP_RATE_11G_MAX_NUM_CHANNELS]; 25048c2ecf20Sopenharmony_ci } failed; 25058c2ecf20Sopenharmony_ci} __packed; 25068c2ecf20Sopenharmony_ci 25078c2ecf20Sopenharmony_ci/* statistics command response */ 25088c2ecf20Sopenharmony_ci 25098c2ecf20Sopenharmony_cistruct statistics_dbg { 25108c2ecf20Sopenharmony_ci __le32 burst_check; 25118c2ecf20Sopenharmony_ci __le32 burst_count; 25128c2ecf20Sopenharmony_ci __le32 wait_for_silence_timeout_cnt; 25138c2ecf20Sopenharmony_ci __le32 reserved[3]; 25148c2ecf20Sopenharmony_ci} __packed; 25158c2ecf20Sopenharmony_ci 25168c2ecf20Sopenharmony_cistruct statistics_rx_phy { 25178c2ecf20Sopenharmony_ci __le32 ina_cnt; 25188c2ecf20Sopenharmony_ci __le32 fina_cnt; 25198c2ecf20Sopenharmony_ci __le32 plcp_err; 25208c2ecf20Sopenharmony_ci __le32 crc32_err; 25218c2ecf20Sopenharmony_ci __le32 overrun_err; 25228c2ecf20Sopenharmony_ci __le32 early_overrun_err; 25238c2ecf20Sopenharmony_ci __le32 crc32_good; 25248c2ecf20Sopenharmony_ci __le32 false_alarm_cnt; 25258c2ecf20Sopenharmony_ci __le32 fina_sync_err_cnt; 25268c2ecf20Sopenharmony_ci __le32 sfd_timeout; 25278c2ecf20Sopenharmony_ci __le32 fina_timeout; 25288c2ecf20Sopenharmony_ci __le32 unresponded_rts; 25298c2ecf20Sopenharmony_ci __le32 rxe_frame_limit_overrun; 25308c2ecf20Sopenharmony_ci __le32 sent_ack_cnt; 25318c2ecf20Sopenharmony_ci __le32 sent_cts_cnt; 25328c2ecf20Sopenharmony_ci __le32 sent_ba_rsp_cnt; 25338c2ecf20Sopenharmony_ci __le32 dsp_self_kill; 25348c2ecf20Sopenharmony_ci __le32 mh_format_err; 25358c2ecf20Sopenharmony_ci __le32 re_acq_main_rssi_sum; 25368c2ecf20Sopenharmony_ci __le32 reserved3; 25378c2ecf20Sopenharmony_ci} __packed; 25388c2ecf20Sopenharmony_ci 25398c2ecf20Sopenharmony_cistruct statistics_rx_ht_phy { 25408c2ecf20Sopenharmony_ci __le32 plcp_err; 25418c2ecf20Sopenharmony_ci __le32 overrun_err; 25428c2ecf20Sopenharmony_ci __le32 early_overrun_err; 25438c2ecf20Sopenharmony_ci __le32 crc32_good; 25448c2ecf20Sopenharmony_ci __le32 crc32_err; 25458c2ecf20Sopenharmony_ci __le32 mh_format_err; 25468c2ecf20Sopenharmony_ci __le32 agg_crc32_good; 25478c2ecf20Sopenharmony_ci __le32 agg_mpdu_cnt; 25488c2ecf20Sopenharmony_ci __le32 agg_cnt; 25498c2ecf20Sopenharmony_ci __le32 unsupport_mcs; 25508c2ecf20Sopenharmony_ci} __packed; 25518c2ecf20Sopenharmony_ci 25528c2ecf20Sopenharmony_ci#define INTERFERENCE_DATA_AVAILABLE cpu_to_le32(1) 25538c2ecf20Sopenharmony_ci 25548c2ecf20Sopenharmony_cistruct statistics_rx_non_phy { 25558c2ecf20Sopenharmony_ci __le32 bogus_cts; /* CTS received when not expecting CTS */ 25568c2ecf20Sopenharmony_ci __le32 bogus_ack; /* ACK received when not expecting ACK */ 25578c2ecf20Sopenharmony_ci __le32 non_bssid_frames; /* number of frames with BSSID that 25588c2ecf20Sopenharmony_ci * doesn't belong to the STA BSSID */ 25598c2ecf20Sopenharmony_ci __le32 filtered_frames; /* count frames that were dumped in the 25608c2ecf20Sopenharmony_ci * filtering process */ 25618c2ecf20Sopenharmony_ci __le32 non_channel_beacons; /* beacons with our bss id but not on 25628c2ecf20Sopenharmony_ci * our serving channel */ 25638c2ecf20Sopenharmony_ci __le32 channel_beacons; /* beacons with our bss id and in our 25648c2ecf20Sopenharmony_ci * serving channel */ 25658c2ecf20Sopenharmony_ci __le32 num_missed_bcon; /* number of missed beacons */ 25668c2ecf20Sopenharmony_ci __le32 adc_rx_saturation_time; /* count in 0.8us units the time the 25678c2ecf20Sopenharmony_ci * ADC was in saturation */ 25688c2ecf20Sopenharmony_ci __le32 ina_detection_search_time;/* total time (in 0.8us) searched 25698c2ecf20Sopenharmony_ci * for INA */ 25708c2ecf20Sopenharmony_ci __le32 beacon_silence_rssi_a; /* RSSI silence after beacon frame */ 25718c2ecf20Sopenharmony_ci __le32 beacon_silence_rssi_b; /* RSSI silence after beacon frame */ 25728c2ecf20Sopenharmony_ci __le32 beacon_silence_rssi_c; /* RSSI silence after beacon frame */ 25738c2ecf20Sopenharmony_ci __le32 interference_data_flag; /* flag for interference data 25748c2ecf20Sopenharmony_ci * availability. 1 when data is 25758c2ecf20Sopenharmony_ci * available. */ 25768c2ecf20Sopenharmony_ci __le32 channel_load; /* counts RX Enable time in uSec */ 25778c2ecf20Sopenharmony_ci __le32 dsp_false_alarms; /* DSP false alarm (both OFDM 25788c2ecf20Sopenharmony_ci * and CCK) counter */ 25798c2ecf20Sopenharmony_ci __le32 beacon_rssi_a; 25808c2ecf20Sopenharmony_ci __le32 beacon_rssi_b; 25818c2ecf20Sopenharmony_ci __le32 beacon_rssi_c; 25828c2ecf20Sopenharmony_ci __le32 beacon_energy_a; 25838c2ecf20Sopenharmony_ci __le32 beacon_energy_b; 25848c2ecf20Sopenharmony_ci __le32 beacon_energy_c; 25858c2ecf20Sopenharmony_ci} __packed; 25868c2ecf20Sopenharmony_ci 25878c2ecf20Sopenharmony_cistruct statistics_rx_non_phy_bt { 25888c2ecf20Sopenharmony_ci struct statistics_rx_non_phy common; 25898c2ecf20Sopenharmony_ci /* additional stats for bt */ 25908c2ecf20Sopenharmony_ci __le32 num_bt_kills; 25918c2ecf20Sopenharmony_ci __le32 reserved[2]; 25928c2ecf20Sopenharmony_ci} __packed; 25938c2ecf20Sopenharmony_ci 25948c2ecf20Sopenharmony_cistruct statistics_rx { 25958c2ecf20Sopenharmony_ci struct statistics_rx_phy ofdm; 25968c2ecf20Sopenharmony_ci struct statistics_rx_phy cck; 25978c2ecf20Sopenharmony_ci struct statistics_rx_non_phy general; 25988c2ecf20Sopenharmony_ci struct statistics_rx_ht_phy ofdm_ht; 25998c2ecf20Sopenharmony_ci} __packed; 26008c2ecf20Sopenharmony_ci 26018c2ecf20Sopenharmony_cistruct statistics_rx_bt { 26028c2ecf20Sopenharmony_ci struct statistics_rx_phy ofdm; 26038c2ecf20Sopenharmony_ci struct statistics_rx_phy cck; 26048c2ecf20Sopenharmony_ci struct statistics_rx_non_phy_bt general; 26058c2ecf20Sopenharmony_ci struct statistics_rx_ht_phy ofdm_ht; 26068c2ecf20Sopenharmony_ci} __packed; 26078c2ecf20Sopenharmony_ci 26088c2ecf20Sopenharmony_ci/** 26098c2ecf20Sopenharmony_ci * struct statistics_tx_power - current tx power 26108c2ecf20Sopenharmony_ci * 26118c2ecf20Sopenharmony_ci * @ant_a: current tx power on chain a in 1/2 dB step 26128c2ecf20Sopenharmony_ci * @ant_b: current tx power on chain b in 1/2 dB step 26138c2ecf20Sopenharmony_ci * @ant_c: current tx power on chain c in 1/2 dB step 26148c2ecf20Sopenharmony_ci */ 26158c2ecf20Sopenharmony_cistruct statistics_tx_power { 26168c2ecf20Sopenharmony_ci u8 ant_a; 26178c2ecf20Sopenharmony_ci u8 ant_b; 26188c2ecf20Sopenharmony_ci u8 ant_c; 26198c2ecf20Sopenharmony_ci u8 reserved; 26208c2ecf20Sopenharmony_ci} __packed; 26218c2ecf20Sopenharmony_ci 26228c2ecf20Sopenharmony_cistruct statistics_tx_non_phy_agg { 26238c2ecf20Sopenharmony_ci __le32 ba_timeout; 26248c2ecf20Sopenharmony_ci __le32 ba_reschedule_frames; 26258c2ecf20Sopenharmony_ci __le32 scd_query_agg_frame_cnt; 26268c2ecf20Sopenharmony_ci __le32 scd_query_no_agg; 26278c2ecf20Sopenharmony_ci __le32 scd_query_agg; 26288c2ecf20Sopenharmony_ci __le32 scd_query_mismatch; 26298c2ecf20Sopenharmony_ci __le32 frame_not_ready; 26308c2ecf20Sopenharmony_ci __le32 underrun; 26318c2ecf20Sopenharmony_ci __le32 bt_prio_kill; 26328c2ecf20Sopenharmony_ci __le32 rx_ba_rsp_cnt; 26338c2ecf20Sopenharmony_ci} __packed; 26348c2ecf20Sopenharmony_ci 26358c2ecf20Sopenharmony_cistruct statistics_tx { 26368c2ecf20Sopenharmony_ci __le32 preamble_cnt; 26378c2ecf20Sopenharmony_ci __le32 rx_detected_cnt; 26388c2ecf20Sopenharmony_ci __le32 bt_prio_defer_cnt; 26398c2ecf20Sopenharmony_ci __le32 bt_prio_kill_cnt; 26408c2ecf20Sopenharmony_ci __le32 few_bytes_cnt; 26418c2ecf20Sopenharmony_ci __le32 cts_timeout; 26428c2ecf20Sopenharmony_ci __le32 ack_timeout; 26438c2ecf20Sopenharmony_ci __le32 expected_ack_cnt; 26448c2ecf20Sopenharmony_ci __le32 actual_ack_cnt; 26458c2ecf20Sopenharmony_ci __le32 dump_msdu_cnt; 26468c2ecf20Sopenharmony_ci __le32 burst_abort_next_frame_mismatch_cnt; 26478c2ecf20Sopenharmony_ci __le32 burst_abort_missing_next_frame_cnt; 26488c2ecf20Sopenharmony_ci __le32 cts_timeout_collision; 26498c2ecf20Sopenharmony_ci __le32 ack_or_ba_timeout_collision; 26508c2ecf20Sopenharmony_ci struct statistics_tx_non_phy_agg agg; 26518c2ecf20Sopenharmony_ci /* 26528c2ecf20Sopenharmony_ci * "tx_power" are optional parameters provided by uCode, 26538c2ecf20Sopenharmony_ci * 6000 series is the only device provide the information, 26548c2ecf20Sopenharmony_ci * Those are reserved fields for all the other devices 26558c2ecf20Sopenharmony_ci */ 26568c2ecf20Sopenharmony_ci struct statistics_tx_power tx_power; 26578c2ecf20Sopenharmony_ci __le32 reserved1; 26588c2ecf20Sopenharmony_ci} __packed; 26598c2ecf20Sopenharmony_ci 26608c2ecf20Sopenharmony_ci 26618c2ecf20Sopenharmony_cistruct statistics_div { 26628c2ecf20Sopenharmony_ci __le32 tx_on_a; 26638c2ecf20Sopenharmony_ci __le32 tx_on_b; 26648c2ecf20Sopenharmony_ci __le32 exec_time; 26658c2ecf20Sopenharmony_ci __le32 probe_time; 26668c2ecf20Sopenharmony_ci __le32 reserved1; 26678c2ecf20Sopenharmony_ci __le32 reserved2; 26688c2ecf20Sopenharmony_ci} __packed; 26698c2ecf20Sopenharmony_ci 26708c2ecf20Sopenharmony_cistruct statistics_general_common { 26718c2ecf20Sopenharmony_ci __le32 temperature; /* radio temperature */ 26728c2ecf20Sopenharmony_ci __le32 temperature_m; /* radio voltage */ 26738c2ecf20Sopenharmony_ci struct statistics_dbg dbg; 26748c2ecf20Sopenharmony_ci __le32 sleep_time; 26758c2ecf20Sopenharmony_ci __le32 slots_out; 26768c2ecf20Sopenharmony_ci __le32 slots_idle; 26778c2ecf20Sopenharmony_ci __le32 ttl_timestamp; 26788c2ecf20Sopenharmony_ci struct statistics_div div; 26798c2ecf20Sopenharmony_ci __le32 rx_enable_counter; 26808c2ecf20Sopenharmony_ci /* 26818c2ecf20Sopenharmony_ci * num_of_sos_states: 26828c2ecf20Sopenharmony_ci * count the number of times we have to re-tune 26838c2ecf20Sopenharmony_ci * in order to get out of bad PHY status 26848c2ecf20Sopenharmony_ci */ 26858c2ecf20Sopenharmony_ci __le32 num_of_sos_states; 26868c2ecf20Sopenharmony_ci} __packed; 26878c2ecf20Sopenharmony_ci 26888c2ecf20Sopenharmony_cistruct statistics_bt_activity { 26898c2ecf20Sopenharmony_ci /* Tx statistics */ 26908c2ecf20Sopenharmony_ci __le32 hi_priority_tx_req_cnt; 26918c2ecf20Sopenharmony_ci __le32 hi_priority_tx_denied_cnt; 26928c2ecf20Sopenharmony_ci __le32 lo_priority_tx_req_cnt; 26938c2ecf20Sopenharmony_ci __le32 lo_priority_tx_denied_cnt; 26948c2ecf20Sopenharmony_ci /* Rx statistics */ 26958c2ecf20Sopenharmony_ci __le32 hi_priority_rx_req_cnt; 26968c2ecf20Sopenharmony_ci __le32 hi_priority_rx_denied_cnt; 26978c2ecf20Sopenharmony_ci __le32 lo_priority_rx_req_cnt; 26988c2ecf20Sopenharmony_ci __le32 lo_priority_rx_denied_cnt; 26998c2ecf20Sopenharmony_ci} __packed; 27008c2ecf20Sopenharmony_ci 27018c2ecf20Sopenharmony_cistruct statistics_general { 27028c2ecf20Sopenharmony_ci struct statistics_general_common common; 27038c2ecf20Sopenharmony_ci __le32 reserved2; 27048c2ecf20Sopenharmony_ci __le32 reserved3; 27058c2ecf20Sopenharmony_ci} __packed; 27068c2ecf20Sopenharmony_ci 27078c2ecf20Sopenharmony_cistruct statistics_general_bt { 27088c2ecf20Sopenharmony_ci struct statistics_general_common common; 27098c2ecf20Sopenharmony_ci struct statistics_bt_activity activity; 27108c2ecf20Sopenharmony_ci __le32 reserved2; 27118c2ecf20Sopenharmony_ci __le32 reserved3; 27128c2ecf20Sopenharmony_ci} __packed; 27138c2ecf20Sopenharmony_ci 27148c2ecf20Sopenharmony_ci#define UCODE_STATISTICS_CLEAR_MSK (0x1 << 0) 27158c2ecf20Sopenharmony_ci#define UCODE_STATISTICS_FREQUENCY_MSK (0x1 << 1) 27168c2ecf20Sopenharmony_ci#define UCODE_STATISTICS_NARROW_BAND_MSK (0x1 << 2) 27178c2ecf20Sopenharmony_ci 27188c2ecf20Sopenharmony_ci/* 27198c2ecf20Sopenharmony_ci * REPLY_STATISTICS_CMD = 0x9c, 27208c2ecf20Sopenharmony_ci * all devices identical. 27218c2ecf20Sopenharmony_ci * 27228c2ecf20Sopenharmony_ci * This command triggers an immediate response containing uCode statistics. 27238c2ecf20Sopenharmony_ci * The response is in the same format as STATISTICS_NOTIFICATION 0x9d, below. 27248c2ecf20Sopenharmony_ci * 27258c2ecf20Sopenharmony_ci * If the CLEAR_STATS configuration flag is set, uCode will clear its 27268c2ecf20Sopenharmony_ci * internal copy of the statistics (counters) after issuing the response. 27278c2ecf20Sopenharmony_ci * This flag does not affect STATISTICS_NOTIFICATIONs after beacons (see below). 27288c2ecf20Sopenharmony_ci * 27298c2ecf20Sopenharmony_ci * If the DISABLE_NOTIF configuration flag is set, uCode will not issue 27308c2ecf20Sopenharmony_ci * STATISTICS_NOTIFICATIONs after received beacons (see below). This flag 27318c2ecf20Sopenharmony_ci * does not affect the response to the REPLY_STATISTICS_CMD 0x9c itself. 27328c2ecf20Sopenharmony_ci */ 27338c2ecf20Sopenharmony_ci#define IWL_STATS_CONF_CLEAR_STATS cpu_to_le32(0x1) /* see above */ 27348c2ecf20Sopenharmony_ci#define IWL_STATS_CONF_DISABLE_NOTIF cpu_to_le32(0x2)/* see above */ 27358c2ecf20Sopenharmony_cistruct iwl_statistics_cmd { 27368c2ecf20Sopenharmony_ci __le32 configuration_flags; /* IWL_STATS_CONF_* */ 27378c2ecf20Sopenharmony_ci} __packed; 27388c2ecf20Sopenharmony_ci 27398c2ecf20Sopenharmony_ci/* 27408c2ecf20Sopenharmony_ci * STATISTICS_NOTIFICATION = 0x9d (notification only, not a command) 27418c2ecf20Sopenharmony_ci * 27428c2ecf20Sopenharmony_ci * By default, uCode issues this notification after receiving a beacon 27438c2ecf20Sopenharmony_ci * while associated. To disable this behavior, set DISABLE_NOTIF flag in the 27448c2ecf20Sopenharmony_ci * REPLY_STATISTICS_CMD 0x9c, above. 27458c2ecf20Sopenharmony_ci * 27468c2ecf20Sopenharmony_ci * Statistics counters continue to increment beacon after beacon, but are 27478c2ecf20Sopenharmony_ci * cleared when changing channels or when driver issues REPLY_STATISTICS_CMD 27488c2ecf20Sopenharmony_ci * 0x9c with CLEAR_STATS bit set (see above). 27498c2ecf20Sopenharmony_ci * 27508c2ecf20Sopenharmony_ci * uCode also issues this notification during scans. uCode clears statistics 27518c2ecf20Sopenharmony_ci * appropriately so that each notification contains statistics for only the 27528c2ecf20Sopenharmony_ci * one channel that has just been scanned. 27538c2ecf20Sopenharmony_ci */ 27548c2ecf20Sopenharmony_ci#define STATISTICS_REPLY_FLG_BAND_24G_MSK cpu_to_le32(0x2) 27558c2ecf20Sopenharmony_ci#define STATISTICS_REPLY_FLG_HT40_MODE_MSK cpu_to_le32(0x8) 27568c2ecf20Sopenharmony_ci 27578c2ecf20Sopenharmony_cistruct iwl_notif_statistics { 27588c2ecf20Sopenharmony_ci __le32 flag; 27598c2ecf20Sopenharmony_ci struct statistics_rx rx; 27608c2ecf20Sopenharmony_ci struct statistics_tx tx; 27618c2ecf20Sopenharmony_ci struct statistics_general general; 27628c2ecf20Sopenharmony_ci} __packed; 27638c2ecf20Sopenharmony_ci 27648c2ecf20Sopenharmony_cistruct iwl_bt_notif_statistics { 27658c2ecf20Sopenharmony_ci __le32 flag; 27668c2ecf20Sopenharmony_ci struct statistics_rx_bt rx; 27678c2ecf20Sopenharmony_ci struct statistics_tx tx; 27688c2ecf20Sopenharmony_ci struct statistics_general_bt general; 27698c2ecf20Sopenharmony_ci} __packed; 27708c2ecf20Sopenharmony_ci 27718c2ecf20Sopenharmony_ci/* 27728c2ecf20Sopenharmony_ci * MISSED_BEACONS_NOTIFICATION = 0xa2 (notification only, not a command) 27738c2ecf20Sopenharmony_ci * 27748c2ecf20Sopenharmony_ci * uCode send MISSED_BEACONS_NOTIFICATION to driver when detect beacon missed 27758c2ecf20Sopenharmony_ci * in regardless of how many missed beacons, which mean when driver receive the 27768c2ecf20Sopenharmony_ci * notification, inside the command, it can find all the beacons information 27778c2ecf20Sopenharmony_ci * which include number of total missed beacons, number of consecutive missed 27788c2ecf20Sopenharmony_ci * beacons, number of beacons received and number of beacons expected to 27798c2ecf20Sopenharmony_ci * receive. 27808c2ecf20Sopenharmony_ci * 27818c2ecf20Sopenharmony_ci * If uCode detected consecutive_missed_beacons > 5, it will reset the radio 27828c2ecf20Sopenharmony_ci * in order to bring the radio/PHY back to working state; which has no relation 27838c2ecf20Sopenharmony_ci * to when driver will perform sensitivity calibration. 27848c2ecf20Sopenharmony_ci * 27858c2ecf20Sopenharmony_ci * Driver should set it own missed_beacon_threshold to decide when to perform 27868c2ecf20Sopenharmony_ci * sensitivity calibration based on number of consecutive missed beacons in 27878c2ecf20Sopenharmony_ci * order to improve overall performance, especially in noisy environment. 27888c2ecf20Sopenharmony_ci * 27898c2ecf20Sopenharmony_ci */ 27908c2ecf20Sopenharmony_ci 27918c2ecf20Sopenharmony_ci#define IWL_MISSED_BEACON_THRESHOLD_MIN (1) 27928c2ecf20Sopenharmony_ci#define IWL_MISSED_BEACON_THRESHOLD_DEF (5) 27938c2ecf20Sopenharmony_ci#define IWL_MISSED_BEACON_THRESHOLD_MAX IWL_MISSED_BEACON_THRESHOLD_DEF 27948c2ecf20Sopenharmony_ci 27958c2ecf20Sopenharmony_cistruct iwl_missed_beacon_notif { 27968c2ecf20Sopenharmony_ci __le32 consecutive_missed_beacons; 27978c2ecf20Sopenharmony_ci __le32 total_missed_becons; 27988c2ecf20Sopenharmony_ci __le32 num_expected_beacons; 27998c2ecf20Sopenharmony_ci __le32 num_recvd_beacons; 28008c2ecf20Sopenharmony_ci} __packed; 28018c2ecf20Sopenharmony_ci 28028c2ecf20Sopenharmony_ci 28038c2ecf20Sopenharmony_ci/****************************************************************************** 28048c2ecf20Sopenharmony_ci * (11) 28058c2ecf20Sopenharmony_ci * Rx Calibration Commands: 28068c2ecf20Sopenharmony_ci * 28078c2ecf20Sopenharmony_ci * With the uCode used for open source drivers, most Tx calibration (except 28088c2ecf20Sopenharmony_ci * for Tx Power) and most Rx calibration is done by uCode during the 28098c2ecf20Sopenharmony_ci * "initialize" phase of uCode boot. Driver must calibrate only: 28108c2ecf20Sopenharmony_ci * 28118c2ecf20Sopenharmony_ci * 1) Tx power (depends on temperature), described elsewhere 28128c2ecf20Sopenharmony_ci * 2) Receiver gain balance (optimize MIMO, and detect disconnected antennas) 28138c2ecf20Sopenharmony_ci * 3) Receiver sensitivity (to optimize signal detection) 28148c2ecf20Sopenharmony_ci * 28158c2ecf20Sopenharmony_ci *****************************************************************************/ 28168c2ecf20Sopenharmony_ci 28178c2ecf20Sopenharmony_ci/** 28188c2ecf20Sopenharmony_ci * SENSITIVITY_CMD = 0xa8 (command, has simple generic response) 28198c2ecf20Sopenharmony_ci * 28208c2ecf20Sopenharmony_ci * This command sets up the Rx signal detector for a sensitivity level that 28218c2ecf20Sopenharmony_ci * is high enough to lock onto all signals within the associated network, 28228c2ecf20Sopenharmony_ci * but low enough to ignore signals that are below a certain threshold, so as 28238c2ecf20Sopenharmony_ci * not to have too many "false alarms". False alarms are signals that the 28248c2ecf20Sopenharmony_ci * Rx DSP tries to lock onto, but then discards after determining that they 28258c2ecf20Sopenharmony_ci * are noise. 28268c2ecf20Sopenharmony_ci * 28278c2ecf20Sopenharmony_ci * The optimum number of false alarms is between 5 and 50 per 200 TUs 28288c2ecf20Sopenharmony_ci * (200 * 1024 uSecs, i.e. 204.8 milliseconds) of actual Rx time (i.e. 28298c2ecf20Sopenharmony_ci * time listening, not transmitting). Driver must adjust sensitivity so that 28308c2ecf20Sopenharmony_ci * the ratio of actual false alarms to actual Rx time falls within this range. 28318c2ecf20Sopenharmony_ci * 28328c2ecf20Sopenharmony_ci * While associated, uCode delivers STATISTICS_NOTIFICATIONs after each 28338c2ecf20Sopenharmony_ci * received beacon. These provide information to the driver to analyze the 28348c2ecf20Sopenharmony_ci * sensitivity. Don't analyze statistics that come in from scanning, or any 28358c2ecf20Sopenharmony_ci * other non-associated-network source. Pertinent statistics include: 28368c2ecf20Sopenharmony_ci * 28378c2ecf20Sopenharmony_ci * From "general" statistics (struct statistics_rx_non_phy): 28388c2ecf20Sopenharmony_ci * 28398c2ecf20Sopenharmony_ci * (beacon_energy_[abc] & 0x0FF00) >> 8 (unsigned, higher value is lower level) 28408c2ecf20Sopenharmony_ci * Measure of energy of desired signal. Used for establishing a level 28418c2ecf20Sopenharmony_ci * below which the device does not detect signals. 28428c2ecf20Sopenharmony_ci * 28438c2ecf20Sopenharmony_ci * (beacon_silence_rssi_[abc] & 0x0FF00) >> 8 (unsigned, units in dB) 28448c2ecf20Sopenharmony_ci * Measure of background noise in silent period after beacon. 28458c2ecf20Sopenharmony_ci * 28468c2ecf20Sopenharmony_ci * channel_load 28478c2ecf20Sopenharmony_ci * uSecs of actual Rx time during beacon period (varies according to 28488c2ecf20Sopenharmony_ci * how much time was spent transmitting). 28498c2ecf20Sopenharmony_ci * 28508c2ecf20Sopenharmony_ci * From "cck" and "ofdm" statistics (struct statistics_rx_phy), separately: 28518c2ecf20Sopenharmony_ci * 28528c2ecf20Sopenharmony_ci * false_alarm_cnt 28538c2ecf20Sopenharmony_ci * Signal locks abandoned early (before phy-level header). 28548c2ecf20Sopenharmony_ci * 28558c2ecf20Sopenharmony_ci * plcp_err 28568c2ecf20Sopenharmony_ci * Signal locks abandoned late (during phy-level header). 28578c2ecf20Sopenharmony_ci * 28588c2ecf20Sopenharmony_ci * NOTE: Both false_alarm_cnt and plcp_err increment monotonically from 28598c2ecf20Sopenharmony_ci * beacon to beacon, i.e. each value is an accumulation of all errors 28608c2ecf20Sopenharmony_ci * before and including the latest beacon. Values will wrap around to 0 28618c2ecf20Sopenharmony_ci * after counting up to 2^32 - 1. Driver must differentiate vs. 28628c2ecf20Sopenharmony_ci * previous beacon's values to determine # false alarms in the current 28638c2ecf20Sopenharmony_ci * beacon period. 28648c2ecf20Sopenharmony_ci * 28658c2ecf20Sopenharmony_ci * Total number of false alarms = false_alarms + plcp_errs 28668c2ecf20Sopenharmony_ci * 28678c2ecf20Sopenharmony_ci * For OFDM, adjust the following table entries in struct iwl_sensitivity_cmd 28688c2ecf20Sopenharmony_ci * (notice that the start points for OFDM are at or close to settings for 28698c2ecf20Sopenharmony_ci * maximum sensitivity): 28708c2ecf20Sopenharmony_ci * 28718c2ecf20Sopenharmony_ci * START / MIN / MAX 28728c2ecf20Sopenharmony_ci * HD_AUTO_CORR32_X1_TH_ADD_MIN_INDEX 90 / 85 / 120 28738c2ecf20Sopenharmony_ci * HD_AUTO_CORR32_X1_TH_ADD_MIN_MRC_INDEX 170 / 170 / 210 28748c2ecf20Sopenharmony_ci * HD_AUTO_CORR32_X4_TH_ADD_MIN_INDEX 105 / 105 / 140 28758c2ecf20Sopenharmony_ci * HD_AUTO_CORR32_X4_TH_ADD_MIN_MRC_INDEX 220 / 220 / 270 28768c2ecf20Sopenharmony_ci * 28778c2ecf20Sopenharmony_ci * If actual rate of OFDM false alarms (+ plcp_errors) is too high 28788c2ecf20Sopenharmony_ci * (greater than 50 for each 204.8 msecs listening), reduce sensitivity 28798c2ecf20Sopenharmony_ci * by *adding* 1 to all 4 of the table entries above, up to the max for 28808c2ecf20Sopenharmony_ci * each entry. Conversely, if false alarm rate is too low (less than 5 28818c2ecf20Sopenharmony_ci * for each 204.8 msecs listening), *subtract* 1 from each entry to 28828c2ecf20Sopenharmony_ci * increase sensitivity. 28838c2ecf20Sopenharmony_ci * 28848c2ecf20Sopenharmony_ci * For CCK sensitivity, keep track of the following: 28858c2ecf20Sopenharmony_ci * 28868c2ecf20Sopenharmony_ci * 1). 20-beacon history of maximum background noise, indicated by 28878c2ecf20Sopenharmony_ci * (beacon_silence_rssi_[abc] & 0x0FF00), units in dB, across the 28888c2ecf20Sopenharmony_ci * 3 receivers. For any given beacon, the "silence reference" is 28898c2ecf20Sopenharmony_ci * the maximum of last 60 samples (20 beacons * 3 receivers). 28908c2ecf20Sopenharmony_ci * 28918c2ecf20Sopenharmony_ci * 2). 10-beacon history of strongest signal level, as indicated 28928c2ecf20Sopenharmony_ci * by (beacon_energy_[abc] & 0x0FF00) >> 8, across the 3 receivers, 28938c2ecf20Sopenharmony_ci * i.e. the strength of the signal through the best receiver at the 28948c2ecf20Sopenharmony_ci * moment. These measurements are "upside down", with lower values 28958c2ecf20Sopenharmony_ci * for stronger signals, so max energy will be *minimum* value. 28968c2ecf20Sopenharmony_ci * 28978c2ecf20Sopenharmony_ci * Then for any given beacon, the driver must determine the *weakest* 28988c2ecf20Sopenharmony_ci * of the strongest signals; this is the minimum level that needs to be 28998c2ecf20Sopenharmony_ci * successfully detected, when using the best receiver at the moment. 29008c2ecf20Sopenharmony_ci * "Max cck energy" is the maximum (higher value means lower energy!) 29018c2ecf20Sopenharmony_ci * of the last 10 minima. Once this is determined, driver must add 29028c2ecf20Sopenharmony_ci * a little margin by adding "6" to it. 29038c2ecf20Sopenharmony_ci * 29048c2ecf20Sopenharmony_ci * 3). Number of consecutive beacon periods with too few false alarms. 29058c2ecf20Sopenharmony_ci * Reset this to 0 at the first beacon period that falls within the 29068c2ecf20Sopenharmony_ci * "good" range (5 to 50 false alarms per 204.8 milliseconds rx). 29078c2ecf20Sopenharmony_ci * 29088c2ecf20Sopenharmony_ci * Then, adjust the following CCK table entries in struct iwl_sensitivity_cmd 29098c2ecf20Sopenharmony_ci * (notice that the start points for CCK are at maximum sensitivity): 29108c2ecf20Sopenharmony_ci * 29118c2ecf20Sopenharmony_ci * START / MIN / MAX 29128c2ecf20Sopenharmony_ci * HD_AUTO_CORR40_X4_TH_ADD_MIN_INDEX 125 / 125 / 200 29138c2ecf20Sopenharmony_ci * HD_AUTO_CORR40_X4_TH_ADD_MIN_MRC_INDEX 200 / 200 / 400 29148c2ecf20Sopenharmony_ci * HD_MIN_ENERGY_CCK_DET_INDEX 100 / 0 / 100 29158c2ecf20Sopenharmony_ci * 29168c2ecf20Sopenharmony_ci * If actual rate of CCK false alarms (+ plcp_errors) is too high 29178c2ecf20Sopenharmony_ci * (greater than 50 for each 204.8 msecs listening), method for reducing 29188c2ecf20Sopenharmony_ci * sensitivity is: 29198c2ecf20Sopenharmony_ci * 29208c2ecf20Sopenharmony_ci * 1) *Add* 3 to value in HD_AUTO_CORR40_X4_TH_ADD_MIN_MRC_INDEX, 29218c2ecf20Sopenharmony_ci * up to max 400. 29228c2ecf20Sopenharmony_ci * 29238c2ecf20Sopenharmony_ci * 2) If current value in HD_AUTO_CORR40_X4_TH_ADD_MIN_INDEX is < 160, 29248c2ecf20Sopenharmony_ci * sensitivity has been reduced a significant amount; bring it up to 29258c2ecf20Sopenharmony_ci * a moderate 161. Otherwise, *add* 3, up to max 200. 29268c2ecf20Sopenharmony_ci * 29278c2ecf20Sopenharmony_ci * 3) a) If current value in HD_AUTO_CORR40_X4_TH_ADD_MIN_INDEX is > 160, 29288c2ecf20Sopenharmony_ci * sensitivity has been reduced only a moderate or small amount; 29298c2ecf20Sopenharmony_ci * *subtract* 2 from value in HD_MIN_ENERGY_CCK_DET_INDEX, 29308c2ecf20Sopenharmony_ci * down to min 0. Otherwise (if gain has been significantly reduced), 29318c2ecf20Sopenharmony_ci * don't change the HD_MIN_ENERGY_CCK_DET_INDEX value. 29328c2ecf20Sopenharmony_ci * 29338c2ecf20Sopenharmony_ci * b) Save a snapshot of the "silence reference". 29348c2ecf20Sopenharmony_ci * 29358c2ecf20Sopenharmony_ci * If actual rate of CCK false alarms (+ plcp_errors) is too low 29368c2ecf20Sopenharmony_ci * (less than 5 for each 204.8 msecs listening), method for increasing 29378c2ecf20Sopenharmony_ci * sensitivity is used only if: 29388c2ecf20Sopenharmony_ci * 29398c2ecf20Sopenharmony_ci * 1a) Previous beacon did not have too many false alarms 29408c2ecf20Sopenharmony_ci * 1b) AND difference between previous "silence reference" and current 29418c2ecf20Sopenharmony_ci * "silence reference" (prev - current) is 2 or more, 29428c2ecf20Sopenharmony_ci * OR 2) 100 or more consecutive beacon periods have had rate of 29438c2ecf20Sopenharmony_ci * less than 5 false alarms per 204.8 milliseconds rx time. 29448c2ecf20Sopenharmony_ci * 29458c2ecf20Sopenharmony_ci * Method for increasing sensitivity: 29468c2ecf20Sopenharmony_ci * 29478c2ecf20Sopenharmony_ci * 1) *Subtract* 3 from value in HD_AUTO_CORR40_X4_TH_ADD_MIN_INDEX, 29488c2ecf20Sopenharmony_ci * down to min 125. 29498c2ecf20Sopenharmony_ci * 29508c2ecf20Sopenharmony_ci * 2) *Subtract* 3 from value in HD_AUTO_CORR40_X4_TH_ADD_MIN_MRC_INDEX, 29518c2ecf20Sopenharmony_ci * down to min 200. 29528c2ecf20Sopenharmony_ci * 29538c2ecf20Sopenharmony_ci * 3) *Add* 2 to value in HD_MIN_ENERGY_CCK_DET_INDEX, up to max 100. 29548c2ecf20Sopenharmony_ci * 29558c2ecf20Sopenharmony_ci * If actual rate of CCK false alarms (+ plcp_errors) is within good range 29568c2ecf20Sopenharmony_ci * (between 5 and 50 for each 204.8 msecs listening): 29578c2ecf20Sopenharmony_ci * 29588c2ecf20Sopenharmony_ci * 1) Save a snapshot of the silence reference. 29598c2ecf20Sopenharmony_ci * 29608c2ecf20Sopenharmony_ci * 2) If previous beacon had too many CCK false alarms (+ plcp_errors), 29618c2ecf20Sopenharmony_ci * give some extra margin to energy threshold by *subtracting* 8 29628c2ecf20Sopenharmony_ci * from value in HD_MIN_ENERGY_CCK_DET_INDEX. 29638c2ecf20Sopenharmony_ci * 29648c2ecf20Sopenharmony_ci * For all cases (too few, too many, good range), make sure that the CCK 29658c2ecf20Sopenharmony_ci * detection threshold (energy) is below the energy level for robust 29668c2ecf20Sopenharmony_ci * detection over the past 10 beacon periods, the "Max cck energy". 29678c2ecf20Sopenharmony_ci * Lower values mean higher energy; this means making sure that the value 29688c2ecf20Sopenharmony_ci * in HD_MIN_ENERGY_CCK_DET_INDEX is at or *above* "Max cck energy". 29698c2ecf20Sopenharmony_ci * 29708c2ecf20Sopenharmony_ci */ 29718c2ecf20Sopenharmony_ci 29728c2ecf20Sopenharmony_ci/* 29738c2ecf20Sopenharmony_ci * Table entries in SENSITIVITY_CMD (struct iwl_sensitivity_cmd) 29748c2ecf20Sopenharmony_ci */ 29758c2ecf20Sopenharmony_ci#define HD_TABLE_SIZE (11) /* number of entries */ 29768c2ecf20Sopenharmony_ci#define HD_MIN_ENERGY_CCK_DET_INDEX (0) /* table indexes */ 29778c2ecf20Sopenharmony_ci#define HD_MIN_ENERGY_OFDM_DET_INDEX (1) 29788c2ecf20Sopenharmony_ci#define HD_AUTO_CORR32_X1_TH_ADD_MIN_INDEX (2) 29798c2ecf20Sopenharmony_ci#define HD_AUTO_CORR32_X1_TH_ADD_MIN_MRC_INDEX (3) 29808c2ecf20Sopenharmony_ci#define HD_AUTO_CORR40_X4_TH_ADD_MIN_MRC_INDEX (4) 29818c2ecf20Sopenharmony_ci#define HD_AUTO_CORR32_X4_TH_ADD_MIN_INDEX (5) 29828c2ecf20Sopenharmony_ci#define HD_AUTO_CORR32_X4_TH_ADD_MIN_MRC_INDEX (6) 29838c2ecf20Sopenharmony_ci#define HD_BARKER_CORR_TH_ADD_MIN_INDEX (7) 29848c2ecf20Sopenharmony_ci#define HD_BARKER_CORR_TH_ADD_MIN_MRC_INDEX (8) 29858c2ecf20Sopenharmony_ci#define HD_AUTO_CORR40_X4_TH_ADD_MIN_INDEX (9) 29868c2ecf20Sopenharmony_ci#define HD_OFDM_ENERGY_TH_IN_INDEX (10) 29878c2ecf20Sopenharmony_ci 29888c2ecf20Sopenharmony_ci/* 29898c2ecf20Sopenharmony_ci * Additional table entries in enhance SENSITIVITY_CMD 29908c2ecf20Sopenharmony_ci */ 29918c2ecf20Sopenharmony_ci#define HD_INA_NON_SQUARE_DET_OFDM_INDEX (11) 29928c2ecf20Sopenharmony_ci#define HD_INA_NON_SQUARE_DET_CCK_INDEX (12) 29938c2ecf20Sopenharmony_ci#define HD_CORR_11_INSTEAD_OF_CORR_9_EN_INDEX (13) 29948c2ecf20Sopenharmony_ci#define HD_OFDM_NON_SQUARE_DET_SLOPE_MRC_INDEX (14) 29958c2ecf20Sopenharmony_ci#define HD_OFDM_NON_SQUARE_DET_INTERCEPT_MRC_INDEX (15) 29968c2ecf20Sopenharmony_ci#define HD_OFDM_NON_SQUARE_DET_SLOPE_INDEX (16) 29978c2ecf20Sopenharmony_ci#define HD_OFDM_NON_SQUARE_DET_INTERCEPT_INDEX (17) 29988c2ecf20Sopenharmony_ci#define HD_CCK_NON_SQUARE_DET_SLOPE_MRC_INDEX (18) 29998c2ecf20Sopenharmony_ci#define HD_CCK_NON_SQUARE_DET_INTERCEPT_MRC_INDEX (19) 30008c2ecf20Sopenharmony_ci#define HD_CCK_NON_SQUARE_DET_SLOPE_INDEX (20) 30018c2ecf20Sopenharmony_ci#define HD_CCK_NON_SQUARE_DET_INTERCEPT_INDEX (21) 30028c2ecf20Sopenharmony_ci#define HD_RESERVED (22) 30038c2ecf20Sopenharmony_ci 30048c2ecf20Sopenharmony_ci/* number of entries for enhanced tbl */ 30058c2ecf20Sopenharmony_ci#define ENHANCE_HD_TABLE_SIZE (23) 30068c2ecf20Sopenharmony_ci 30078c2ecf20Sopenharmony_ci/* number of additional entries for enhanced tbl */ 30088c2ecf20Sopenharmony_ci#define ENHANCE_HD_TABLE_ENTRIES (ENHANCE_HD_TABLE_SIZE - HD_TABLE_SIZE) 30098c2ecf20Sopenharmony_ci 30108c2ecf20Sopenharmony_ci#define HD_INA_NON_SQUARE_DET_OFDM_DATA_V1 cpu_to_le16(0) 30118c2ecf20Sopenharmony_ci#define HD_INA_NON_SQUARE_DET_CCK_DATA_V1 cpu_to_le16(0) 30128c2ecf20Sopenharmony_ci#define HD_CORR_11_INSTEAD_OF_CORR_9_EN_DATA_V1 cpu_to_le16(0) 30138c2ecf20Sopenharmony_ci#define HD_OFDM_NON_SQUARE_DET_SLOPE_MRC_DATA_V1 cpu_to_le16(668) 30148c2ecf20Sopenharmony_ci#define HD_OFDM_NON_SQUARE_DET_INTERCEPT_MRC_DATA_V1 cpu_to_le16(4) 30158c2ecf20Sopenharmony_ci#define HD_OFDM_NON_SQUARE_DET_SLOPE_DATA_V1 cpu_to_le16(486) 30168c2ecf20Sopenharmony_ci#define HD_OFDM_NON_SQUARE_DET_INTERCEPT_DATA_V1 cpu_to_le16(37) 30178c2ecf20Sopenharmony_ci#define HD_CCK_NON_SQUARE_DET_SLOPE_MRC_DATA_V1 cpu_to_le16(853) 30188c2ecf20Sopenharmony_ci#define HD_CCK_NON_SQUARE_DET_INTERCEPT_MRC_DATA_V1 cpu_to_le16(4) 30198c2ecf20Sopenharmony_ci#define HD_CCK_NON_SQUARE_DET_SLOPE_DATA_V1 cpu_to_le16(476) 30208c2ecf20Sopenharmony_ci#define HD_CCK_NON_SQUARE_DET_INTERCEPT_DATA_V1 cpu_to_le16(99) 30218c2ecf20Sopenharmony_ci 30228c2ecf20Sopenharmony_ci#define HD_INA_NON_SQUARE_DET_OFDM_DATA_V2 cpu_to_le16(1) 30238c2ecf20Sopenharmony_ci#define HD_INA_NON_SQUARE_DET_CCK_DATA_V2 cpu_to_le16(1) 30248c2ecf20Sopenharmony_ci#define HD_CORR_11_INSTEAD_OF_CORR_9_EN_DATA_V2 cpu_to_le16(1) 30258c2ecf20Sopenharmony_ci#define HD_OFDM_NON_SQUARE_DET_SLOPE_MRC_DATA_V2 cpu_to_le16(600) 30268c2ecf20Sopenharmony_ci#define HD_OFDM_NON_SQUARE_DET_INTERCEPT_MRC_DATA_V2 cpu_to_le16(40) 30278c2ecf20Sopenharmony_ci#define HD_OFDM_NON_SQUARE_DET_SLOPE_DATA_V2 cpu_to_le16(486) 30288c2ecf20Sopenharmony_ci#define HD_OFDM_NON_SQUARE_DET_INTERCEPT_DATA_V2 cpu_to_le16(45) 30298c2ecf20Sopenharmony_ci#define HD_CCK_NON_SQUARE_DET_SLOPE_MRC_DATA_V2 cpu_to_le16(853) 30308c2ecf20Sopenharmony_ci#define HD_CCK_NON_SQUARE_DET_INTERCEPT_MRC_DATA_V2 cpu_to_le16(60) 30318c2ecf20Sopenharmony_ci#define HD_CCK_NON_SQUARE_DET_SLOPE_DATA_V2 cpu_to_le16(476) 30328c2ecf20Sopenharmony_ci#define HD_CCK_NON_SQUARE_DET_INTERCEPT_DATA_V2 cpu_to_le16(99) 30338c2ecf20Sopenharmony_ci 30348c2ecf20Sopenharmony_ci 30358c2ecf20Sopenharmony_ci/* Control field in struct iwl_sensitivity_cmd */ 30368c2ecf20Sopenharmony_ci#define SENSITIVITY_CMD_CONTROL_DEFAULT_TABLE cpu_to_le16(0) 30378c2ecf20Sopenharmony_ci#define SENSITIVITY_CMD_CONTROL_WORK_TABLE cpu_to_le16(1) 30388c2ecf20Sopenharmony_ci 30398c2ecf20Sopenharmony_ci/** 30408c2ecf20Sopenharmony_ci * struct iwl_sensitivity_cmd 30418c2ecf20Sopenharmony_ci * @control: (1) updates working table, (0) updates default table 30428c2ecf20Sopenharmony_ci * @table: energy threshold values, use HD_* as index into table 30438c2ecf20Sopenharmony_ci * 30448c2ecf20Sopenharmony_ci * Always use "1" in "control" to update uCode's working table and DSP. 30458c2ecf20Sopenharmony_ci */ 30468c2ecf20Sopenharmony_cistruct iwl_sensitivity_cmd { 30478c2ecf20Sopenharmony_ci __le16 control; /* always use "1" */ 30488c2ecf20Sopenharmony_ci __le16 table[HD_TABLE_SIZE]; /* use HD_* as index */ 30498c2ecf20Sopenharmony_ci} __packed; 30508c2ecf20Sopenharmony_ci 30518c2ecf20Sopenharmony_ci/* 30528c2ecf20Sopenharmony_ci * 30538c2ecf20Sopenharmony_ci */ 30548c2ecf20Sopenharmony_cistruct iwl_enhance_sensitivity_cmd { 30558c2ecf20Sopenharmony_ci __le16 control; /* always use "1" */ 30568c2ecf20Sopenharmony_ci __le16 enhance_table[ENHANCE_HD_TABLE_SIZE]; /* use HD_* as index */ 30578c2ecf20Sopenharmony_ci} __packed; 30588c2ecf20Sopenharmony_ci 30598c2ecf20Sopenharmony_ci 30608c2ecf20Sopenharmony_ci/** 30618c2ecf20Sopenharmony_ci * REPLY_PHY_CALIBRATION_CMD = 0xb0 (command, has simple generic response) 30628c2ecf20Sopenharmony_ci * 30638c2ecf20Sopenharmony_ci * This command sets the relative gains of agn device's 3 radio receiver chains. 30648c2ecf20Sopenharmony_ci * 30658c2ecf20Sopenharmony_ci * After the first association, driver should accumulate signal and noise 30668c2ecf20Sopenharmony_ci * statistics from the STATISTICS_NOTIFICATIONs that follow the first 20 30678c2ecf20Sopenharmony_ci * beacons from the associated network (don't collect statistics that come 30688c2ecf20Sopenharmony_ci * in from scanning, or any other non-network source). 30698c2ecf20Sopenharmony_ci * 30708c2ecf20Sopenharmony_ci * DISCONNECTED ANTENNA: 30718c2ecf20Sopenharmony_ci * 30728c2ecf20Sopenharmony_ci * Driver should determine which antennas are actually connected, by comparing 30738c2ecf20Sopenharmony_ci * average beacon signal levels for the 3 Rx chains. Accumulate (add) the 30748c2ecf20Sopenharmony_ci * following values over 20 beacons, one accumulator for each of the chains 30758c2ecf20Sopenharmony_ci * a/b/c, from struct statistics_rx_non_phy: 30768c2ecf20Sopenharmony_ci * 30778c2ecf20Sopenharmony_ci * beacon_rssi_[abc] & 0x0FF (unsigned, units in dB) 30788c2ecf20Sopenharmony_ci * 30798c2ecf20Sopenharmony_ci * Find the strongest signal from among a/b/c. Compare the other two to the 30808c2ecf20Sopenharmony_ci * strongest. If any signal is more than 15 dB (times 20, unless you 30818c2ecf20Sopenharmony_ci * divide the accumulated values by 20) below the strongest, the driver 30828c2ecf20Sopenharmony_ci * considers that antenna to be disconnected, and should not try to use that 30838c2ecf20Sopenharmony_ci * antenna/chain for Rx or Tx. If both A and B seem to be disconnected, 30848c2ecf20Sopenharmony_ci * driver should declare the stronger one as connected, and attempt to use it 30858c2ecf20Sopenharmony_ci * (A and B are the only 2 Tx chains!). 30868c2ecf20Sopenharmony_ci * 30878c2ecf20Sopenharmony_ci * 30888c2ecf20Sopenharmony_ci * RX BALANCE: 30898c2ecf20Sopenharmony_ci * 30908c2ecf20Sopenharmony_ci * Driver should balance the 3 receivers (but just the ones that are connected 30918c2ecf20Sopenharmony_ci * to antennas, see above) for gain, by comparing the average signal levels 30928c2ecf20Sopenharmony_ci * detected during the silence after each beacon (background noise). 30938c2ecf20Sopenharmony_ci * Accumulate (add) the following values over 20 beacons, one accumulator for 30948c2ecf20Sopenharmony_ci * each of the chains a/b/c, from struct statistics_rx_non_phy: 30958c2ecf20Sopenharmony_ci * 30968c2ecf20Sopenharmony_ci * beacon_silence_rssi_[abc] & 0x0FF (unsigned, units in dB) 30978c2ecf20Sopenharmony_ci * 30988c2ecf20Sopenharmony_ci * Find the weakest background noise level from among a/b/c. This Rx chain 30998c2ecf20Sopenharmony_ci * will be the reference, with 0 gain adjustment. Attenuate other channels by 31008c2ecf20Sopenharmony_ci * finding noise difference: 31018c2ecf20Sopenharmony_ci * 31028c2ecf20Sopenharmony_ci * (accum_noise[i] - accum_noise[reference]) / 30 31038c2ecf20Sopenharmony_ci * 31048c2ecf20Sopenharmony_ci * The "30" adjusts the dB in the 20 accumulated samples to units of 1.5 dB. 31058c2ecf20Sopenharmony_ci * For use in diff_gain_[abc] fields of struct iwl_calibration_cmd, the 31068c2ecf20Sopenharmony_ci * driver should limit the difference results to a range of 0-3 (0-4.5 dB), 31078c2ecf20Sopenharmony_ci * and set bit 2 to indicate "reduce gain". The value for the reference 31088c2ecf20Sopenharmony_ci * (weakest) chain should be "0". 31098c2ecf20Sopenharmony_ci * 31108c2ecf20Sopenharmony_ci * diff_gain_[abc] bit fields: 31118c2ecf20Sopenharmony_ci * 2: (1) reduce gain, (0) increase gain 31128c2ecf20Sopenharmony_ci * 1-0: amount of gain, units of 1.5 dB 31138c2ecf20Sopenharmony_ci */ 31148c2ecf20Sopenharmony_ci 31158c2ecf20Sopenharmony_ci/* Phy calibration command for series */ 31168c2ecf20Sopenharmony_cienum { 31178c2ecf20Sopenharmony_ci IWL_PHY_CALIBRATE_DC_CMD = 8, 31188c2ecf20Sopenharmony_ci IWL_PHY_CALIBRATE_LO_CMD = 9, 31198c2ecf20Sopenharmony_ci IWL_PHY_CALIBRATE_TX_IQ_CMD = 11, 31208c2ecf20Sopenharmony_ci IWL_PHY_CALIBRATE_CRYSTAL_FRQ_CMD = 15, 31218c2ecf20Sopenharmony_ci IWL_PHY_CALIBRATE_BASE_BAND_CMD = 16, 31228c2ecf20Sopenharmony_ci IWL_PHY_CALIBRATE_TX_IQ_PERD_CMD = 17, 31238c2ecf20Sopenharmony_ci IWL_PHY_CALIBRATE_TEMP_OFFSET_CMD = 18, 31248c2ecf20Sopenharmony_ci}; 31258c2ecf20Sopenharmony_ci 31268c2ecf20Sopenharmony_ci/* This enum defines the bitmap of various calibrations to enable in both 31278c2ecf20Sopenharmony_ci * init ucode and runtime ucode through CALIBRATION_CFG_CMD. 31288c2ecf20Sopenharmony_ci */ 31298c2ecf20Sopenharmony_cienum iwl_ucode_calib_cfg { 31308c2ecf20Sopenharmony_ci IWL_CALIB_CFG_RX_BB_IDX = BIT(0), 31318c2ecf20Sopenharmony_ci IWL_CALIB_CFG_DC_IDX = BIT(1), 31328c2ecf20Sopenharmony_ci IWL_CALIB_CFG_LO_IDX = BIT(2), 31338c2ecf20Sopenharmony_ci IWL_CALIB_CFG_TX_IQ_IDX = BIT(3), 31348c2ecf20Sopenharmony_ci IWL_CALIB_CFG_RX_IQ_IDX = BIT(4), 31358c2ecf20Sopenharmony_ci IWL_CALIB_CFG_NOISE_IDX = BIT(5), 31368c2ecf20Sopenharmony_ci IWL_CALIB_CFG_CRYSTAL_IDX = BIT(6), 31378c2ecf20Sopenharmony_ci IWL_CALIB_CFG_TEMPERATURE_IDX = BIT(7), 31388c2ecf20Sopenharmony_ci IWL_CALIB_CFG_PAPD_IDX = BIT(8), 31398c2ecf20Sopenharmony_ci IWL_CALIB_CFG_SENSITIVITY_IDX = BIT(9), 31408c2ecf20Sopenharmony_ci IWL_CALIB_CFG_TX_PWR_IDX = BIT(10), 31418c2ecf20Sopenharmony_ci}; 31428c2ecf20Sopenharmony_ci 31438c2ecf20Sopenharmony_ci#define IWL_CALIB_INIT_CFG_ALL cpu_to_le32(IWL_CALIB_CFG_RX_BB_IDX | \ 31448c2ecf20Sopenharmony_ci IWL_CALIB_CFG_DC_IDX | \ 31458c2ecf20Sopenharmony_ci IWL_CALIB_CFG_LO_IDX | \ 31468c2ecf20Sopenharmony_ci IWL_CALIB_CFG_TX_IQ_IDX | \ 31478c2ecf20Sopenharmony_ci IWL_CALIB_CFG_RX_IQ_IDX | \ 31488c2ecf20Sopenharmony_ci IWL_CALIB_CFG_CRYSTAL_IDX) 31498c2ecf20Sopenharmony_ci 31508c2ecf20Sopenharmony_ci#define IWL_CALIB_RT_CFG_ALL cpu_to_le32(IWL_CALIB_CFG_RX_BB_IDX | \ 31518c2ecf20Sopenharmony_ci IWL_CALIB_CFG_DC_IDX | \ 31528c2ecf20Sopenharmony_ci IWL_CALIB_CFG_LO_IDX | \ 31538c2ecf20Sopenharmony_ci IWL_CALIB_CFG_TX_IQ_IDX | \ 31548c2ecf20Sopenharmony_ci IWL_CALIB_CFG_RX_IQ_IDX | \ 31558c2ecf20Sopenharmony_ci IWL_CALIB_CFG_TEMPERATURE_IDX | \ 31568c2ecf20Sopenharmony_ci IWL_CALIB_CFG_PAPD_IDX | \ 31578c2ecf20Sopenharmony_ci IWL_CALIB_CFG_TX_PWR_IDX | \ 31588c2ecf20Sopenharmony_ci IWL_CALIB_CFG_CRYSTAL_IDX) 31598c2ecf20Sopenharmony_ci 31608c2ecf20Sopenharmony_ci#define IWL_CALIB_CFG_FLAG_SEND_COMPLETE_NTFY_MSK cpu_to_le32(BIT(0)) 31618c2ecf20Sopenharmony_ci 31628c2ecf20Sopenharmony_cistruct iwl_calib_cfg_elmnt_s { 31638c2ecf20Sopenharmony_ci __le32 is_enable; 31648c2ecf20Sopenharmony_ci __le32 start; 31658c2ecf20Sopenharmony_ci __le32 send_res; 31668c2ecf20Sopenharmony_ci __le32 apply_res; 31678c2ecf20Sopenharmony_ci __le32 reserved; 31688c2ecf20Sopenharmony_ci} __packed; 31698c2ecf20Sopenharmony_ci 31708c2ecf20Sopenharmony_cistruct iwl_calib_cfg_status_s { 31718c2ecf20Sopenharmony_ci struct iwl_calib_cfg_elmnt_s once; 31728c2ecf20Sopenharmony_ci struct iwl_calib_cfg_elmnt_s perd; 31738c2ecf20Sopenharmony_ci __le32 flags; 31748c2ecf20Sopenharmony_ci} __packed; 31758c2ecf20Sopenharmony_ci 31768c2ecf20Sopenharmony_cistruct iwl_calib_cfg_cmd { 31778c2ecf20Sopenharmony_ci struct iwl_calib_cfg_status_s ucd_calib_cfg; 31788c2ecf20Sopenharmony_ci struct iwl_calib_cfg_status_s drv_calib_cfg; 31798c2ecf20Sopenharmony_ci __le32 reserved1; 31808c2ecf20Sopenharmony_ci} __packed; 31818c2ecf20Sopenharmony_ci 31828c2ecf20Sopenharmony_cistruct iwl_calib_hdr { 31838c2ecf20Sopenharmony_ci u8 op_code; 31848c2ecf20Sopenharmony_ci u8 first_group; 31858c2ecf20Sopenharmony_ci u8 groups_num; 31868c2ecf20Sopenharmony_ci u8 data_valid; 31878c2ecf20Sopenharmony_ci} __packed; 31888c2ecf20Sopenharmony_ci 31898c2ecf20Sopenharmony_cistruct iwl_calib_cmd { 31908c2ecf20Sopenharmony_ci struct iwl_calib_hdr hdr; 31918c2ecf20Sopenharmony_ci u8 data[]; 31928c2ecf20Sopenharmony_ci} __packed; 31938c2ecf20Sopenharmony_ci 31948c2ecf20Sopenharmony_cistruct iwl_calib_xtal_freq_cmd { 31958c2ecf20Sopenharmony_ci struct iwl_calib_hdr hdr; 31968c2ecf20Sopenharmony_ci u8 cap_pin1; 31978c2ecf20Sopenharmony_ci u8 cap_pin2; 31988c2ecf20Sopenharmony_ci u8 pad[2]; 31998c2ecf20Sopenharmony_ci} __packed; 32008c2ecf20Sopenharmony_ci 32018c2ecf20Sopenharmony_ci#define DEFAULT_RADIO_SENSOR_OFFSET cpu_to_le16(2700) 32028c2ecf20Sopenharmony_cistruct iwl_calib_temperature_offset_cmd { 32038c2ecf20Sopenharmony_ci struct iwl_calib_hdr hdr; 32048c2ecf20Sopenharmony_ci __le16 radio_sensor_offset; 32058c2ecf20Sopenharmony_ci __le16 reserved; 32068c2ecf20Sopenharmony_ci} __packed; 32078c2ecf20Sopenharmony_ci 32088c2ecf20Sopenharmony_cistruct iwl_calib_temperature_offset_v2_cmd { 32098c2ecf20Sopenharmony_ci struct iwl_calib_hdr hdr; 32108c2ecf20Sopenharmony_ci __le16 radio_sensor_offset_high; 32118c2ecf20Sopenharmony_ci __le16 radio_sensor_offset_low; 32128c2ecf20Sopenharmony_ci __le16 burntVoltageRef; 32138c2ecf20Sopenharmony_ci __le16 reserved; 32148c2ecf20Sopenharmony_ci} __packed; 32158c2ecf20Sopenharmony_ci 32168c2ecf20Sopenharmony_ci/* IWL_PHY_CALIBRATE_CHAIN_NOISE_RESET_CMD */ 32178c2ecf20Sopenharmony_cistruct iwl_calib_chain_noise_reset_cmd { 32188c2ecf20Sopenharmony_ci struct iwl_calib_hdr hdr; 32198c2ecf20Sopenharmony_ci u8 data[]; 32208c2ecf20Sopenharmony_ci}; 32218c2ecf20Sopenharmony_ci 32228c2ecf20Sopenharmony_ci/* IWL_PHY_CALIBRATE_CHAIN_NOISE_GAIN_CMD */ 32238c2ecf20Sopenharmony_cistruct iwl_calib_chain_noise_gain_cmd { 32248c2ecf20Sopenharmony_ci struct iwl_calib_hdr hdr; 32258c2ecf20Sopenharmony_ci u8 delta_gain_1; 32268c2ecf20Sopenharmony_ci u8 delta_gain_2; 32278c2ecf20Sopenharmony_ci u8 pad[2]; 32288c2ecf20Sopenharmony_ci} __packed; 32298c2ecf20Sopenharmony_ci 32308c2ecf20Sopenharmony_ci/****************************************************************************** 32318c2ecf20Sopenharmony_ci * (12) 32328c2ecf20Sopenharmony_ci * Miscellaneous Commands: 32338c2ecf20Sopenharmony_ci * 32348c2ecf20Sopenharmony_ci *****************************************************************************/ 32358c2ecf20Sopenharmony_ci 32368c2ecf20Sopenharmony_ci/* 32378c2ecf20Sopenharmony_ci * LEDs Command & Response 32388c2ecf20Sopenharmony_ci * REPLY_LEDS_CMD = 0x48 (command, has simple generic response) 32398c2ecf20Sopenharmony_ci * 32408c2ecf20Sopenharmony_ci * For each of 3 possible LEDs (Activity/Link/Tech, selected by "id" field), 32418c2ecf20Sopenharmony_ci * this command turns it on or off, or sets up a periodic blinking cycle. 32428c2ecf20Sopenharmony_ci */ 32438c2ecf20Sopenharmony_cistruct iwl_led_cmd { 32448c2ecf20Sopenharmony_ci __le32 interval; /* "interval" in uSec */ 32458c2ecf20Sopenharmony_ci u8 id; /* 1: Activity, 2: Link, 3: Tech */ 32468c2ecf20Sopenharmony_ci u8 off; /* # intervals off while blinking; 32478c2ecf20Sopenharmony_ci * "0", with >0 "on" value, turns LED on */ 32488c2ecf20Sopenharmony_ci u8 on; /* # intervals on while blinking; 32498c2ecf20Sopenharmony_ci * "0", regardless of "off", turns LED off */ 32508c2ecf20Sopenharmony_ci u8 reserved; 32518c2ecf20Sopenharmony_ci} __packed; 32528c2ecf20Sopenharmony_ci 32538c2ecf20Sopenharmony_ci/* 32548c2ecf20Sopenharmony_ci * station priority table entries 32558c2ecf20Sopenharmony_ci * also used as potential "events" value for both 32568c2ecf20Sopenharmony_ci * COEX_MEDIUM_NOTIFICATION and COEX_EVENT_CMD 32578c2ecf20Sopenharmony_ci */ 32588c2ecf20Sopenharmony_ci 32598c2ecf20Sopenharmony_ci/* 32608c2ecf20Sopenharmony_ci * COEX events entry flag masks 32618c2ecf20Sopenharmony_ci * RP - Requested Priority 32628c2ecf20Sopenharmony_ci * WP - Win Medium Priority: priority assigned when the contention has been won 32638c2ecf20Sopenharmony_ci */ 32648c2ecf20Sopenharmony_ci#define COEX_EVT_FLAG_MEDIUM_FREE_NTFY_FLG (0x1) 32658c2ecf20Sopenharmony_ci#define COEX_EVT_FLAG_MEDIUM_ACTV_NTFY_FLG (0x2) 32668c2ecf20Sopenharmony_ci#define COEX_EVT_FLAG_DELAY_MEDIUM_FREE_NTFY_FLG (0x4) 32678c2ecf20Sopenharmony_ci 32688c2ecf20Sopenharmony_ci#define COEX_CU_UNASSOC_IDLE_RP 4 32698c2ecf20Sopenharmony_ci#define COEX_CU_UNASSOC_MANUAL_SCAN_RP 4 32708c2ecf20Sopenharmony_ci#define COEX_CU_UNASSOC_AUTO_SCAN_RP 4 32718c2ecf20Sopenharmony_ci#define COEX_CU_CALIBRATION_RP 4 32728c2ecf20Sopenharmony_ci#define COEX_CU_PERIODIC_CALIBRATION_RP 4 32738c2ecf20Sopenharmony_ci#define COEX_CU_CONNECTION_ESTAB_RP 4 32748c2ecf20Sopenharmony_ci#define COEX_CU_ASSOCIATED_IDLE_RP 4 32758c2ecf20Sopenharmony_ci#define COEX_CU_ASSOC_MANUAL_SCAN_RP 4 32768c2ecf20Sopenharmony_ci#define COEX_CU_ASSOC_AUTO_SCAN_RP 4 32778c2ecf20Sopenharmony_ci#define COEX_CU_ASSOC_ACTIVE_LEVEL_RP 4 32788c2ecf20Sopenharmony_ci#define COEX_CU_RF_ON_RP 6 32798c2ecf20Sopenharmony_ci#define COEX_CU_RF_OFF_RP 4 32808c2ecf20Sopenharmony_ci#define COEX_CU_STAND_ALONE_DEBUG_RP 6 32818c2ecf20Sopenharmony_ci#define COEX_CU_IPAN_ASSOC_LEVEL_RP 4 32828c2ecf20Sopenharmony_ci#define COEX_CU_RSRVD1_RP 4 32838c2ecf20Sopenharmony_ci#define COEX_CU_RSRVD2_RP 4 32848c2ecf20Sopenharmony_ci 32858c2ecf20Sopenharmony_ci#define COEX_CU_UNASSOC_IDLE_WP 3 32868c2ecf20Sopenharmony_ci#define COEX_CU_UNASSOC_MANUAL_SCAN_WP 3 32878c2ecf20Sopenharmony_ci#define COEX_CU_UNASSOC_AUTO_SCAN_WP 3 32888c2ecf20Sopenharmony_ci#define COEX_CU_CALIBRATION_WP 3 32898c2ecf20Sopenharmony_ci#define COEX_CU_PERIODIC_CALIBRATION_WP 3 32908c2ecf20Sopenharmony_ci#define COEX_CU_CONNECTION_ESTAB_WP 3 32918c2ecf20Sopenharmony_ci#define COEX_CU_ASSOCIATED_IDLE_WP 3 32928c2ecf20Sopenharmony_ci#define COEX_CU_ASSOC_MANUAL_SCAN_WP 3 32938c2ecf20Sopenharmony_ci#define COEX_CU_ASSOC_AUTO_SCAN_WP 3 32948c2ecf20Sopenharmony_ci#define COEX_CU_ASSOC_ACTIVE_LEVEL_WP 3 32958c2ecf20Sopenharmony_ci#define COEX_CU_RF_ON_WP 3 32968c2ecf20Sopenharmony_ci#define COEX_CU_RF_OFF_WP 3 32978c2ecf20Sopenharmony_ci#define COEX_CU_STAND_ALONE_DEBUG_WP 6 32988c2ecf20Sopenharmony_ci#define COEX_CU_IPAN_ASSOC_LEVEL_WP 3 32998c2ecf20Sopenharmony_ci#define COEX_CU_RSRVD1_WP 3 33008c2ecf20Sopenharmony_ci#define COEX_CU_RSRVD2_WP 3 33018c2ecf20Sopenharmony_ci 33028c2ecf20Sopenharmony_ci#define COEX_UNASSOC_IDLE_FLAGS 0 33038c2ecf20Sopenharmony_ci#define COEX_UNASSOC_MANUAL_SCAN_FLAGS \ 33048c2ecf20Sopenharmony_ci (COEX_EVT_FLAG_MEDIUM_FREE_NTFY_FLG | \ 33058c2ecf20Sopenharmony_ci COEX_EVT_FLAG_MEDIUM_ACTV_NTFY_FLG) 33068c2ecf20Sopenharmony_ci#define COEX_UNASSOC_AUTO_SCAN_FLAGS \ 33078c2ecf20Sopenharmony_ci (COEX_EVT_FLAG_MEDIUM_FREE_NTFY_FLG | \ 33088c2ecf20Sopenharmony_ci COEX_EVT_FLAG_MEDIUM_ACTV_NTFY_FLG) 33098c2ecf20Sopenharmony_ci#define COEX_CALIBRATION_FLAGS \ 33108c2ecf20Sopenharmony_ci (COEX_EVT_FLAG_MEDIUM_FREE_NTFY_FLG | \ 33118c2ecf20Sopenharmony_ci COEX_EVT_FLAG_MEDIUM_ACTV_NTFY_FLG) 33128c2ecf20Sopenharmony_ci#define COEX_PERIODIC_CALIBRATION_FLAGS 0 33138c2ecf20Sopenharmony_ci/* 33148c2ecf20Sopenharmony_ci * COEX_CONNECTION_ESTAB: 33158c2ecf20Sopenharmony_ci * we need DELAY_MEDIUM_FREE_NTFY to let WiMAX disconnect from network. 33168c2ecf20Sopenharmony_ci */ 33178c2ecf20Sopenharmony_ci#define COEX_CONNECTION_ESTAB_FLAGS \ 33188c2ecf20Sopenharmony_ci (COEX_EVT_FLAG_MEDIUM_FREE_NTFY_FLG | \ 33198c2ecf20Sopenharmony_ci COEX_EVT_FLAG_MEDIUM_ACTV_NTFY_FLG | \ 33208c2ecf20Sopenharmony_ci COEX_EVT_FLAG_DELAY_MEDIUM_FREE_NTFY_FLG) 33218c2ecf20Sopenharmony_ci#define COEX_ASSOCIATED_IDLE_FLAGS 0 33228c2ecf20Sopenharmony_ci#define COEX_ASSOC_MANUAL_SCAN_FLAGS \ 33238c2ecf20Sopenharmony_ci (COEX_EVT_FLAG_MEDIUM_FREE_NTFY_FLG | \ 33248c2ecf20Sopenharmony_ci COEX_EVT_FLAG_MEDIUM_ACTV_NTFY_FLG) 33258c2ecf20Sopenharmony_ci#define COEX_ASSOC_AUTO_SCAN_FLAGS \ 33268c2ecf20Sopenharmony_ci (COEX_EVT_FLAG_MEDIUM_FREE_NTFY_FLG | \ 33278c2ecf20Sopenharmony_ci COEX_EVT_FLAG_MEDIUM_ACTV_NTFY_FLG) 33288c2ecf20Sopenharmony_ci#define COEX_ASSOC_ACTIVE_LEVEL_FLAGS 0 33298c2ecf20Sopenharmony_ci#define COEX_RF_ON_FLAGS 0 33308c2ecf20Sopenharmony_ci#define COEX_RF_OFF_FLAGS 0 33318c2ecf20Sopenharmony_ci#define COEX_STAND_ALONE_DEBUG_FLAGS \ 33328c2ecf20Sopenharmony_ci (COEX_EVT_FLAG_MEDIUM_FREE_NTFY_FLG | \ 33338c2ecf20Sopenharmony_ci COEX_EVT_FLAG_MEDIUM_ACTV_NTFY_FLG) 33348c2ecf20Sopenharmony_ci#define COEX_IPAN_ASSOC_LEVEL_FLAGS \ 33358c2ecf20Sopenharmony_ci (COEX_EVT_FLAG_MEDIUM_FREE_NTFY_FLG | \ 33368c2ecf20Sopenharmony_ci COEX_EVT_FLAG_MEDIUM_ACTV_NTFY_FLG | \ 33378c2ecf20Sopenharmony_ci COEX_EVT_FLAG_DELAY_MEDIUM_FREE_NTFY_FLG) 33388c2ecf20Sopenharmony_ci#define COEX_RSRVD1_FLAGS 0 33398c2ecf20Sopenharmony_ci#define COEX_RSRVD2_FLAGS 0 33408c2ecf20Sopenharmony_ci/* 33418c2ecf20Sopenharmony_ci * COEX_CU_RF_ON is the event wrapping all radio ownership. 33428c2ecf20Sopenharmony_ci * We need DELAY_MEDIUM_FREE_NTFY to let WiMAX disconnect from network. 33438c2ecf20Sopenharmony_ci */ 33448c2ecf20Sopenharmony_ci#define COEX_CU_RF_ON_FLAGS \ 33458c2ecf20Sopenharmony_ci (COEX_EVT_FLAG_MEDIUM_FREE_NTFY_FLG | \ 33468c2ecf20Sopenharmony_ci COEX_EVT_FLAG_MEDIUM_ACTV_NTFY_FLG | \ 33478c2ecf20Sopenharmony_ci COEX_EVT_FLAG_DELAY_MEDIUM_FREE_NTFY_FLG) 33488c2ecf20Sopenharmony_ci 33498c2ecf20Sopenharmony_ci 33508c2ecf20Sopenharmony_cienum { 33518c2ecf20Sopenharmony_ci /* un-association part */ 33528c2ecf20Sopenharmony_ci COEX_UNASSOC_IDLE = 0, 33538c2ecf20Sopenharmony_ci COEX_UNASSOC_MANUAL_SCAN = 1, 33548c2ecf20Sopenharmony_ci COEX_UNASSOC_AUTO_SCAN = 2, 33558c2ecf20Sopenharmony_ci /* calibration */ 33568c2ecf20Sopenharmony_ci COEX_CALIBRATION = 3, 33578c2ecf20Sopenharmony_ci COEX_PERIODIC_CALIBRATION = 4, 33588c2ecf20Sopenharmony_ci /* connection */ 33598c2ecf20Sopenharmony_ci COEX_CONNECTION_ESTAB = 5, 33608c2ecf20Sopenharmony_ci /* association part */ 33618c2ecf20Sopenharmony_ci COEX_ASSOCIATED_IDLE = 6, 33628c2ecf20Sopenharmony_ci COEX_ASSOC_MANUAL_SCAN = 7, 33638c2ecf20Sopenharmony_ci COEX_ASSOC_AUTO_SCAN = 8, 33648c2ecf20Sopenharmony_ci COEX_ASSOC_ACTIVE_LEVEL = 9, 33658c2ecf20Sopenharmony_ci /* RF ON/OFF */ 33668c2ecf20Sopenharmony_ci COEX_RF_ON = 10, 33678c2ecf20Sopenharmony_ci COEX_RF_OFF = 11, 33688c2ecf20Sopenharmony_ci COEX_STAND_ALONE_DEBUG = 12, 33698c2ecf20Sopenharmony_ci /* IPAN */ 33708c2ecf20Sopenharmony_ci COEX_IPAN_ASSOC_LEVEL = 13, 33718c2ecf20Sopenharmony_ci /* reserved */ 33728c2ecf20Sopenharmony_ci COEX_RSRVD1 = 14, 33738c2ecf20Sopenharmony_ci COEX_RSRVD2 = 15, 33748c2ecf20Sopenharmony_ci COEX_NUM_OF_EVENTS = 16 33758c2ecf20Sopenharmony_ci}; 33768c2ecf20Sopenharmony_ci 33778c2ecf20Sopenharmony_ci/* 33788c2ecf20Sopenharmony_ci * Coexistence WIFI/WIMAX Command 33798c2ecf20Sopenharmony_ci * COEX_PRIORITY_TABLE_CMD = 0x5a 33808c2ecf20Sopenharmony_ci * 33818c2ecf20Sopenharmony_ci */ 33828c2ecf20Sopenharmony_cistruct iwl_wimax_coex_event_entry { 33838c2ecf20Sopenharmony_ci u8 request_prio; 33848c2ecf20Sopenharmony_ci u8 win_medium_prio; 33858c2ecf20Sopenharmony_ci u8 reserved; 33868c2ecf20Sopenharmony_ci u8 flags; 33878c2ecf20Sopenharmony_ci} __packed; 33888c2ecf20Sopenharmony_ci 33898c2ecf20Sopenharmony_ci/* COEX flag masks */ 33908c2ecf20Sopenharmony_ci 33918c2ecf20Sopenharmony_ci/* Station table is valid */ 33928c2ecf20Sopenharmony_ci#define COEX_FLAGS_STA_TABLE_VALID_MSK (0x1) 33938c2ecf20Sopenharmony_ci/* UnMask wake up src at unassociated sleep */ 33948c2ecf20Sopenharmony_ci#define COEX_FLAGS_UNASSOC_WA_UNMASK_MSK (0x4) 33958c2ecf20Sopenharmony_ci/* UnMask wake up src at associated sleep */ 33968c2ecf20Sopenharmony_ci#define COEX_FLAGS_ASSOC_WA_UNMASK_MSK (0x8) 33978c2ecf20Sopenharmony_ci/* Enable CoEx feature. */ 33988c2ecf20Sopenharmony_ci#define COEX_FLAGS_COEX_ENABLE_MSK (0x80) 33998c2ecf20Sopenharmony_ci 34008c2ecf20Sopenharmony_cistruct iwl_wimax_coex_cmd { 34018c2ecf20Sopenharmony_ci u8 flags; 34028c2ecf20Sopenharmony_ci u8 reserved[3]; 34038c2ecf20Sopenharmony_ci struct iwl_wimax_coex_event_entry sta_prio[COEX_NUM_OF_EVENTS]; 34048c2ecf20Sopenharmony_ci} __packed; 34058c2ecf20Sopenharmony_ci 34068c2ecf20Sopenharmony_ci/* 34078c2ecf20Sopenharmony_ci * Coexistence MEDIUM NOTIFICATION 34088c2ecf20Sopenharmony_ci * COEX_MEDIUM_NOTIFICATION = 0x5b 34098c2ecf20Sopenharmony_ci * 34108c2ecf20Sopenharmony_ci * notification from uCode to host to indicate medium changes 34118c2ecf20Sopenharmony_ci * 34128c2ecf20Sopenharmony_ci */ 34138c2ecf20Sopenharmony_ci/* 34148c2ecf20Sopenharmony_ci * status field 34158c2ecf20Sopenharmony_ci * bit 0 - 2: medium status 34168c2ecf20Sopenharmony_ci * bit 3: medium change indication 34178c2ecf20Sopenharmony_ci * bit 4 - 31: reserved 34188c2ecf20Sopenharmony_ci */ 34198c2ecf20Sopenharmony_ci/* status option values, (0 - 2 bits) */ 34208c2ecf20Sopenharmony_ci#define COEX_MEDIUM_BUSY (0x0) /* radio belongs to WiMAX */ 34218c2ecf20Sopenharmony_ci#define COEX_MEDIUM_ACTIVE (0x1) /* radio belongs to WiFi */ 34228c2ecf20Sopenharmony_ci#define COEX_MEDIUM_PRE_RELEASE (0x2) /* received radio release */ 34238c2ecf20Sopenharmony_ci#define COEX_MEDIUM_MSK (0x7) 34248c2ecf20Sopenharmony_ci 34258c2ecf20Sopenharmony_ci/* send notification status (1 bit) */ 34268c2ecf20Sopenharmony_ci#define COEX_MEDIUM_CHANGED (0x8) 34278c2ecf20Sopenharmony_ci#define COEX_MEDIUM_CHANGED_MSK (0x8) 34288c2ecf20Sopenharmony_ci#define COEX_MEDIUM_SHIFT (3) 34298c2ecf20Sopenharmony_ci 34308c2ecf20Sopenharmony_cistruct iwl_coex_medium_notification { 34318c2ecf20Sopenharmony_ci __le32 status; 34328c2ecf20Sopenharmony_ci __le32 events; 34338c2ecf20Sopenharmony_ci} __packed; 34348c2ecf20Sopenharmony_ci 34358c2ecf20Sopenharmony_ci/* 34368c2ecf20Sopenharmony_ci * Coexistence EVENT Command 34378c2ecf20Sopenharmony_ci * COEX_EVENT_CMD = 0x5c 34388c2ecf20Sopenharmony_ci * 34398c2ecf20Sopenharmony_ci * send from host to uCode for coex event request. 34408c2ecf20Sopenharmony_ci */ 34418c2ecf20Sopenharmony_ci/* flags options */ 34428c2ecf20Sopenharmony_ci#define COEX_EVENT_REQUEST_MSK (0x1) 34438c2ecf20Sopenharmony_ci 34448c2ecf20Sopenharmony_cistruct iwl_coex_event_cmd { 34458c2ecf20Sopenharmony_ci u8 flags; 34468c2ecf20Sopenharmony_ci u8 event; 34478c2ecf20Sopenharmony_ci __le16 reserved; 34488c2ecf20Sopenharmony_ci} __packed; 34498c2ecf20Sopenharmony_ci 34508c2ecf20Sopenharmony_cistruct iwl_coex_event_resp { 34518c2ecf20Sopenharmony_ci __le32 status; 34528c2ecf20Sopenharmony_ci} __packed; 34538c2ecf20Sopenharmony_ci 34548c2ecf20Sopenharmony_ci 34558c2ecf20Sopenharmony_ci/****************************************************************************** 34568c2ecf20Sopenharmony_ci * Bluetooth Coexistence commands 34578c2ecf20Sopenharmony_ci * 34588c2ecf20Sopenharmony_ci *****************************************************************************/ 34598c2ecf20Sopenharmony_ci 34608c2ecf20Sopenharmony_ci/* 34618c2ecf20Sopenharmony_ci * BT Status notification 34628c2ecf20Sopenharmony_ci * REPLY_BT_COEX_PROFILE_NOTIF = 0xce 34638c2ecf20Sopenharmony_ci */ 34648c2ecf20Sopenharmony_cienum iwl_bt_coex_profile_traffic_load { 34658c2ecf20Sopenharmony_ci IWL_BT_COEX_TRAFFIC_LOAD_NONE = 0, 34668c2ecf20Sopenharmony_ci IWL_BT_COEX_TRAFFIC_LOAD_LOW = 1, 34678c2ecf20Sopenharmony_ci IWL_BT_COEX_TRAFFIC_LOAD_HIGH = 2, 34688c2ecf20Sopenharmony_ci IWL_BT_COEX_TRAFFIC_LOAD_CONTINUOUS = 3, 34698c2ecf20Sopenharmony_ci/* 34708c2ecf20Sopenharmony_ci * There are no more even though below is a u8, the 34718c2ecf20Sopenharmony_ci * indication from the BT device only has two bits. 34728c2ecf20Sopenharmony_ci */ 34738c2ecf20Sopenharmony_ci}; 34748c2ecf20Sopenharmony_ci 34758c2ecf20Sopenharmony_ci#define BT_SESSION_ACTIVITY_1_UART_MSG 0x1 34768c2ecf20Sopenharmony_ci#define BT_SESSION_ACTIVITY_2_UART_MSG 0x2 34778c2ecf20Sopenharmony_ci 34788c2ecf20Sopenharmony_ci/* BT UART message - Share Part (BT -> WiFi) */ 34798c2ecf20Sopenharmony_ci#define BT_UART_MSG_FRAME1MSGTYPE_POS (0) 34808c2ecf20Sopenharmony_ci#define BT_UART_MSG_FRAME1MSGTYPE_MSK \ 34818c2ecf20Sopenharmony_ci (0x7 << BT_UART_MSG_FRAME1MSGTYPE_POS) 34828c2ecf20Sopenharmony_ci#define BT_UART_MSG_FRAME1SSN_POS (3) 34838c2ecf20Sopenharmony_ci#define BT_UART_MSG_FRAME1SSN_MSK \ 34848c2ecf20Sopenharmony_ci (0x3 << BT_UART_MSG_FRAME1SSN_POS) 34858c2ecf20Sopenharmony_ci#define BT_UART_MSG_FRAME1UPDATEREQ_POS (5) 34868c2ecf20Sopenharmony_ci#define BT_UART_MSG_FRAME1UPDATEREQ_MSK \ 34878c2ecf20Sopenharmony_ci (0x1 << BT_UART_MSG_FRAME1UPDATEREQ_POS) 34888c2ecf20Sopenharmony_ci#define BT_UART_MSG_FRAME1RESERVED_POS (6) 34898c2ecf20Sopenharmony_ci#define BT_UART_MSG_FRAME1RESERVED_MSK \ 34908c2ecf20Sopenharmony_ci (0x3 << BT_UART_MSG_FRAME1RESERVED_POS) 34918c2ecf20Sopenharmony_ci 34928c2ecf20Sopenharmony_ci#define BT_UART_MSG_FRAME2OPENCONNECTIONS_POS (0) 34938c2ecf20Sopenharmony_ci#define BT_UART_MSG_FRAME2OPENCONNECTIONS_MSK \ 34948c2ecf20Sopenharmony_ci (0x3 << BT_UART_MSG_FRAME2OPENCONNECTIONS_POS) 34958c2ecf20Sopenharmony_ci#define BT_UART_MSG_FRAME2TRAFFICLOAD_POS (2) 34968c2ecf20Sopenharmony_ci#define BT_UART_MSG_FRAME2TRAFFICLOAD_MSK \ 34978c2ecf20Sopenharmony_ci (0x3 << BT_UART_MSG_FRAME2TRAFFICLOAD_POS) 34988c2ecf20Sopenharmony_ci#define BT_UART_MSG_FRAME2CHLSEQN_POS (4) 34998c2ecf20Sopenharmony_ci#define BT_UART_MSG_FRAME2CHLSEQN_MSK \ 35008c2ecf20Sopenharmony_ci (0x1 << BT_UART_MSG_FRAME2CHLSEQN_POS) 35018c2ecf20Sopenharmony_ci#define BT_UART_MSG_FRAME2INBAND_POS (5) 35028c2ecf20Sopenharmony_ci#define BT_UART_MSG_FRAME2INBAND_MSK \ 35038c2ecf20Sopenharmony_ci (0x1 << BT_UART_MSG_FRAME2INBAND_POS) 35048c2ecf20Sopenharmony_ci#define BT_UART_MSG_FRAME2RESERVED_POS (6) 35058c2ecf20Sopenharmony_ci#define BT_UART_MSG_FRAME2RESERVED_MSK \ 35068c2ecf20Sopenharmony_ci (0x3 << BT_UART_MSG_FRAME2RESERVED_POS) 35078c2ecf20Sopenharmony_ci 35088c2ecf20Sopenharmony_ci#define BT_UART_MSG_FRAME3SCOESCO_POS (0) 35098c2ecf20Sopenharmony_ci#define BT_UART_MSG_FRAME3SCOESCO_MSK \ 35108c2ecf20Sopenharmony_ci (0x1 << BT_UART_MSG_FRAME3SCOESCO_POS) 35118c2ecf20Sopenharmony_ci#define BT_UART_MSG_FRAME3SNIFF_POS (1) 35128c2ecf20Sopenharmony_ci#define BT_UART_MSG_FRAME3SNIFF_MSK \ 35138c2ecf20Sopenharmony_ci (0x1 << BT_UART_MSG_FRAME3SNIFF_POS) 35148c2ecf20Sopenharmony_ci#define BT_UART_MSG_FRAME3A2DP_POS (2) 35158c2ecf20Sopenharmony_ci#define BT_UART_MSG_FRAME3A2DP_MSK \ 35168c2ecf20Sopenharmony_ci (0x1 << BT_UART_MSG_FRAME3A2DP_POS) 35178c2ecf20Sopenharmony_ci#define BT_UART_MSG_FRAME3ACL_POS (3) 35188c2ecf20Sopenharmony_ci#define BT_UART_MSG_FRAME3ACL_MSK \ 35198c2ecf20Sopenharmony_ci (0x1 << BT_UART_MSG_FRAME3ACL_POS) 35208c2ecf20Sopenharmony_ci#define BT_UART_MSG_FRAME3MASTER_POS (4) 35218c2ecf20Sopenharmony_ci#define BT_UART_MSG_FRAME3MASTER_MSK \ 35228c2ecf20Sopenharmony_ci (0x1 << BT_UART_MSG_FRAME3MASTER_POS) 35238c2ecf20Sopenharmony_ci#define BT_UART_MSG_FRAME3OBEX_POS (5) 35248c2ecf20Sopenharmony_ci#define BT_UART_MSG_FRAME3OBEX_MSK \ 35258c2ecf20Sopenharmony_ci (0x1 << BT_UART_MSG_FRAME3OBEX_POS) 35268c2ecf20Sopenharmony_ci#define BT_UART_MSG_FRAME3RESERVED_POS (6) 35278c2ecf20Sopenharmony_ci#define BT_UART_MSG_FRAME3RESERVED_MSK \ 35288c2ecf20Sopenharmony_ci (0x3 << BT_UART_MSG_FRAME3RESERVED_POS) 35298c2ecf20Sopenharmony_ci 35308c2ecf20Sopenharmony_ci#define BT_UART_MSG_FRAME4IDLEDURATION_POS (0) 35318c2ecf20Sopenharmony_ci#define BT_UART_MSG_FRAME4IDLEDURATION_MSK \ 35328c2ecf20Sopenharmony_ci (0x3F << BT_UART_MSG_FRAME4IDLEDURATION_POS) 35338c2ecf20Sopenharmony_ci#define BT_UART_MSG_FRAME4RESERVED_POS (6) 35348c2ecf20Sopenharmony_ci#define BT_UART_MSG_FRAME4RESERVED_MSK \ 35358c2ecf20Sopenharmony_ci (0x3 << BT_UART_MSG_FRAME4RESERVED_POS) 35368c2ecf20Sopenharmony_ci 35378c2ecf20Sopenharmony_ci#define BT_UART_MSG_FRAME5TXACTIVITY_POS (0) 35388c2ecf20Sopenharmony_ci#define BT_UART_MSG_FRAME5TXACTIVITY_MSK \ 35398c2ecf20Sopenharmony_ci (0x3 << BT_UART_MSG_FRAME5TXACTIVITY_POS) 35408c2ecf20Sopenharmony_ci#define BT_UART_MSG_FRAME5RXACTIVITY_POS (2) 35418c2ecf20Sopenharmony_ci#define BT_UART_MSG_FRAME5RXACTIVITY_MSK \ 35428c2ecf20Sopenharmony_ci (0x3 << BT_UART_MSG_FRAME5RXACTIVITY_POS) 35438c2ecf20Sopenharmony_ci#define BT_UART_MSG_FRAME5ESCORETRANSMIT_POS (4) 35448c2ecf20Sopenharmony_ci#define BT_UART_MSG_FRAME5ESCORETRANSMIT_MSK \ 35458c2ecf20Sopenharmony_ci (0x3 << BT_UART_MSG_FRAME5ESCORETRANSMIT_POS) 35468c2ecf20Sopenharmony_ci#define BT_UART_MSG_FRAME5RESERVED_POS (6) 35478c2ecf20Sopenharmony_ci#define BT_UART_MSG_FRAME5RESERVED_MSK \ 35488c2ecf20Sopenharmony_ci (0x3 << BT_UART_MSG_FRAME5RESERVED_POS) 35498c2ecf20Sopenharmony_ci 35508c2ecf20Sopenharmony_ci#define BT_UART_MSG_FRAME6SNIFFINTERVAL_POS (0) 35518c2ecf20Sopenharmony_ci#define BT_UART_MSG_FRAME6SNIFFINTERVAL_MSK \ 35528c2ecf20Sopenharmony_ci (0x1F << BT_UART_MSG_FRAME6SNIFFINTERVAL_POS) 35538c2ecf20Sopenharmony_ci#define BT_UART_MSG_FRAME6DISCOVERABLE_POS (5) 35548c2ecf20Sopenharmony_ci#define BT_UART_MSG_FRAME6DISCOVERABLE_MSK \ 35558c2ecf20Sopenharmony_ci (0x1 << BT_UART_MSG_FRAME6DISCOVERABLE_POS) 35568c2ecf20Sopenharmony_ci#define BT_UART_MSG_FRAME6RESERVED_POS (6) 35578c2ecf20Sopenharmony_ci#define BT_UART_MSG_FRAME6RESERVED_MSK \ 35588c2ecf20Sopenharmony_ci (0x3 << BT_UART_MSG_FRAME6RESERVED_POS) 35598c2ecf20Sopenharmony_ci 35608c2ecf20Sopenharmony_ci#define BT_UART_MSG_FRAME7SNIFFACTIVITY_POS (0) 35618c2ecf20Sopenharmony_ci#define BT_UART_MSG_FRAME7SNIFFACTIVITY_MSK \ 35628c2ecf20Sopenharmony_ci (0x7 << BT_UART_MSG_FRAME7SNIFFACTIVITY_POS) 35638c2ecf20Sopenharmony_ci#define BT_UART_MSG_FRAME7PAGE_POS (3) 35648c2ecf20Sopenharmony_ci#define BT_UART_MSG_FRAME7PAGE_MSK \ 35658c2ecf20Sopenharmony_ci (0x1 << BT_UART_MSG_FRAME7PAGE_POS) 35668c2ecf20Sopenharmony_ci#define BT_UART_MSG_FRAME7INQUIRY_POS (4) 35678c2ecf20Sopenharmony_ci#define BT_UART_MSG_FRAME7INQUIRY_MSK \ 35688c2ecf20Sopenharmony_ci (0x1 << BT_UART_MSG_FRAME7INQUIRY_POS) 35698c2ecf20Sopenharmony_ci#define BT_UART_MSG_FRAME7CONNECTABLE_POS (5) 35708c2ecf20Sopenharmony_ci#define BT_UART_MSG_FRAME7CONNECTABLE_MSK \ 35718c2ecf20Sopenharmony_ci (0x1 << BT_UART_MSG_FRAME7CONNECTABLE_POS) 35728c2ecf20Sopenharmony_ci#define BT_UART_MSG_FRAME7RESERVED_POS (6) 35738c2ecf20Sopenharmony_ci#define BT_UART_MSG_FRAME7RESERVED_MSK \ 35748c2ecf20Sopenharmony_ci (0x3 << BT_UART_MSG_FRAME7RESERVED_POS) 35758c2ecf20Sopenharmony_ci 35768c2ecf20Sopenharmony_ci/* BT Session Activity 2 UART message (BT -> WiFi) */ 35778c2ecf20Sopenharmony_ci#define BT_UART_MSG_2_FRAME1RESERVED1_POS (5) 35788c2ecf20Sopenharmony_ci#define BT_UART_MSG_2_FRAME1RESERVED1_MSK \ 35798c2ecf20Sopenharmony_ci (0x1<<BT_UART_MSG_2_FRAME1RESERVED1_POS) 35808c2ecf20Sopenharmony_ci#define BT_UART_MSG_2_FRAME1RESERVED2_POS (6) 35818c2ecf20Sopenharmony_ci#define BT_UART_MSG_2_FRAME1RESERVED2_MSK \ 35828c2ecf20Sopenharmony_ci (0x3<<BT_UART_MSG_2_FRAME1RESERVED2_POS) 35838c2ecf20Sopenharmony_ci 35848c2ecf20Sopenharmony_ci#define BT_UART_MSG_2_FRAME2AGGTRAFFICLOAD_POS (0) 35858c2ecf20Sopenharmony_ci#define BT_UART_MSG_2_FRAME2AGGTRAFFICLOAD_MSK \ 35868c2ecf20Sopenharmony_ci (0x3F<<BT_UART_MSG_2_FRAME2AGGTRAFFICLOAD_POS) 35878c2ecf20Sopenharmony_ci#define BT_UART_MSG_2_FRAME2RESERVED_POS (6) 35888c2ecf20Sopenharmony_ci#define BT_UART_MSG_2_FRAME2RESERVED_MSK \ 35898c2ecf20Sopenharmony_ci (0x3<<BT_UART_MSG_2_FRAME2RESERVED_POS) 35908c2ecf20Sopenharmony_ci 35918c2ecf20Sopenharmony_ci#define BT_UART_MSG_2_FRAME3BRLASTTXPOWER_POS (0) 35928c2ecf20Sopenharmony_ci#define BT_UART_MSG_2_FRAME3BRLASTTXPOWER_MSK \ 35938c2ecf20Sopenharmony_ci (0xF<<BT_UART_MSG_2_FRAME3BRLASTTXPOWER_POS) 35948c2ecf20Sopenharmony_ci#define BT_UART_MSG_2_FRAME3INQPAGESRMODE_POS (4) 35958c2ecf20Sopenharmony_ci#define BT_UART_MSG_2_FRAME3INQPAGESRMODE_MSK \ 35968c2ecf20Sopenharmony_ci (0x1<<BT_UART_MSG_2_FRAME3INQPAGESRMODE_POS) 35978c2ecf20Sopenharmony_ci#define BT_UART_MSG_2_FRAME3LEMASTER_POS (5) 35988c2ecf20Sopenharmony_ci#define BT_UART_MSG_2_FRAME3LEMASTER_MSK \ 35998c2ecf20Sopenharmony_ci (0x1<<BT_UART_MSG_2_FRAME3LEMASTER_POS) 36008c2ecf20Sopenharmony_ci#define BT_UART_MSG_2_FRAME3RESERVED_POS (6) 36018c2ecf20Sopenharmony_ci#define BT_UART_MSG_2_FRAME3RESERVED_MSK \ 36028c2ecf20Sopenharmony_ci (0x3<<BT_UART_MSG_2_FRAME3RESERVED_POS) 36038c2ecf20Sopenharmony_ci 36048c2ecf20Sopenharmony_ci#define BT_UART_MSG_2_FRAME4LELASTTXPOWER_POS (0) 36058c2ecf20Sopenharmony_ci#define BT_UART_MSG_2_FRAME4LELASTTXPOWER_MSK \ 36068c2ecf20Sopenharmony_ci (0xF<<BT_UART_MSG_2_FRAME4LELASTTXPOWER_POS) 36078c2ecf20Sopenharmony_ci#define BT_UART_MSG_2_FRAME4NUMLECONN_POS (4) 36088c2ecf20Sopenharmony_ci#define BT_UART_MSG_2_FRAME4NUMLECONN_MSK \ 36098c2ecf20Sopenharmony_ci (0x3<<BT_UART_MSG_2_FRAME4NUMLECONN_POS) 36108c2ecf20Sopenharmony_ci#define BT_UART_MSG_2_FRAME4RESERVED_POS (6) 36118c2ecf20Sopenharmony_ci#define BT_UART_MSG_2_FRAME4RESERVED_MSK \ 36128c2ecf20Sopenharmony_ci (0x3<<BT_UART_MSG_2_FRAME4RESERVED_POS) 36138c2ecf20Sopenharmony_ci 36148c2ecf20Sopenharmony_ci#define BT_UART_MSG_2_FRAME5BTMINRSSI_POS (0) 36158c2ecf20Sopenharmony_ci#define BT_UART_MSG_2_FRAME5BTMINRSSI_MSK \ 36168c2ecf20Sopenharmony_ci (0xF<<BT_UART_MSG_2_FRAME5BTMINRSSI_POS) 36178c2ecf20Sopenharmony_ci#define BT_UART_MSG_2_FRAME5LESCANINITMODE_POS (4) 36188c2ecf20Sopenharmony_ci#define BT_UART_MSG_2_FRAME5LESCANINITMODE_MSK \ 36198c2ecf20Sopenharmony_ci (0x1<<BT_UART_MSG_2_FRAME5LESCANINITMODE_POS) 36208c2ecf20Sopenharmony_ci#define BT_UART_MSG_2_FRAME5LEADVERMODE_POS (5) 36218c2ecf20Sopenharmony_ci#define BT_UART_MSG_2_FRAME5LEADVERMODE_MSK \ 36228c2ecf20Sopenharmony_ci (0x1<<BT_UART_MSG_2_FRAME5LEADVERMODE_POS) 36238c2ecf20Sopenharmony_ci#define BT_UART_MSG_2_FRAME5RESERVED_POS (6) 36248c2ecf20Sopenharmony_ci#define BT_UART_MSG_2_FRAME5RESERVED_MSK \ 36258c2ecf20Sopenharmony_ci (0x3<<BT_UART_MSG_2_FRAME5RESERVED_POS) 36268c2ecf20Sopenharmony_ci 36278c2ecf20Sopenharmony_ci#define BT_UART_MSG_2_FRAME6LECONNINTERVAL_POS (0) 36288c2ecf20Sopenharmony_ci#define BT_UART_MSG_2_FRAME6LECONNINTERVAL_MSK \ 36298c2ecf20Sopenharmony_ci (0x1F<<BT_UART_MSG_2_FRAME6LECONNINTERVAL_POS) 36308c2ecf20Sopenharmony_ci#define BT_UART_MSG_2_FRAME6RFU_POS (5) 36318c2ecf20Sopenharmony_ci#define BT_UART_MSG_2_FRAME6RFU_MSK \ 36328c2ecf20Sopenharmony_ci (0x1<<BT_UART_MSG_2_FRAME6RFU_POS) 36338c2ecf20Sopenharmony_ci#define BT_UART_MSG_2_FRAME6RESERVED_POS (6) 36348c2ecf20Sopenharmony_ci#define BT_UART_MSG_2_FRAME6RESERVED_MSK \ 36358c2ecf20Sopenharmony_ci (0x3<<BT_UART_MSG_2_FRAME6RESERVED_POS) 36368c2ecf20Sopenharmony_ci 36378c2ecf20Sopenharmony_ci#define BT_UART_MSG_2_FRAME7LECONNSLAVELAT_POS (0) 36388c2ecf20Sopenharmony_ci#define BT_UART_MSG_2_FRAME7LECONNSLAVELAT_MSK \ 36398c2ecf20Sopenharmony_ci (0x7<<BT_UART_MSG_2_FRAME7LECONNSLAVELAT_POS) 36408c2ecf20Sopenharmony_ci#define BT_UART_MSG_2_FRAME7LEPROFILE1_POS (3) 36418c2ecf20Sopenharmony_ci#define BT_UART_MSG_2_FRAME7LEPROFILE1_MSK \ 36428c2ecf20Sopenharmony_ci (0x1<<BT_UART_MSG_2_FRAME7LEPROFILE1_POS) 36438c2ecf20Sopenharmony_ci#define BT_UART_MSG_2_FRAME7LEPROFILE2_POS (4) 36448c2ecf20Sopenharmony_ci#define BT_UART_MSG_2_FRAME7LEPROFILE2_MSK \ 36458c2ecf20Sopenharmony_ci (0x1<<BT_UART_MSG_2_FRAME7LEPROFILE2_POS) 36468c2ecf20Sopenharmony_ci#define BT_UART_MSG_2_FRAME7LEPROFILEOTHER_POS (5) 36478c2ecf20Sopenharmony_ci#define BT_UART_MSG_2_FRAME7LEPROFILEOTHER_MSK \ 36488c2ecf20Sopenharmony_ci (0x1<<BT_UART_MSG_2_FRAME7LEPROFILEOTHER_POS) 36498c2ecf20Sopenharmony_ci#define BT_UART_MSG_2_FRAME7RESERVED_POS (6) 36508c2ecf20Sopenharmony_ci#define BT_UART_MSG_2_FRAME7RESERVED_MSK \ 36518c2ecf20Sopenharmony_ci (0x3<<BT_UART_MSG_2_FRAME7RESERVED_POS) 36528c2ecf20Sopenharmony_ci 36538c2ecf20Sopenharmony_ci 36548c2ecf20Sopenharmony_ci#define BT_ENABLE_REDUCED_TXPOWER_THRESHOLD (-62) 36558c2ecf20Sopenharmony_ci#define BT_DISABLE_REDUCED_TXPOWER_THRESHOLD (-65) 36568c2ecf20Sopenharmony_ci 36578c2ecf20Sopenharmony_cistruct iwl_bt_uart_msg { 36588c2ecf20Sopenharmony_ci u8 header; 36598c2ecf20Sopenharmony_ci u8 frame1; 36608c2ecf20Sopenharmony_ci u8 frame2; 36618c2ecf20Sopenharmony_ci u8 frame3; 36628c2ecf20Sopenharmony_ci u8 frame4; 36638c2ecf20Sopenharmony_ci u8 frame5; 36648c2ecf20Sopenharmony_ci u8 frame6; 36658c2ecf20Sopenharmony_ci u8 frame7; 36668c2ecf20Sopenharmony_ci} __packed; 36678c2ecf20Sopenharmony_ci 36688c2ecf20Sopenharmony_cistruct iwl_bt_coex_profile_notif { 36698c2ecf20Sopenharmony_ci struct iwl_bt_uart_msg last_bt_uart_msg; 36708c2ecf20Sopenharmony_ci u8 bt_status; /* 0 - off, 1 - on */ 36718c2ecf20Sopenharmony_ci u8 bt_traffic_load; /* 0 .. 3? */ 36728c2ecf20Sopenharmony_ci u8 bt_ci_compliance; /* 0 - not complied, 1 - complied */ 36738c2ecf20Sopenharmony_ci u8 reserved; 36748c2ecf20Sopenharmony_ci} __packed; 36758c2ecf20Sopenharmony_ci 36768c2ecf20Sopenharmony_ci#define IWL_BT_COEX_PRIO_TBL_SHARED_ANTENNA_POS 0 36778c2ecf20Sopenharmony_ci#define IWL_BT_COEX_PRIO_TBL_SHARED_ANTENNA_MSK 0x1 36788c2ecf20Sopenharmony_ci#define IWL_BT_COEX_PRIO_TBL_PRIO_POS 1 36798c2ecf20Sopenharmony_ci#define IWL_BT_COEX_PRIO_TBL_PRIO_MASK 0x0e 36808c2ecf20Sopenharmony_ci#define IWL_BT_COEX_PRIO_TBL_RESERVED_POS 4 36818c2ecf20Sopenharmony_ci#define IWL_BT_COEX_PRIO_TBL_RESERVED_MASK 0xf0 36828c2ecf20Sopenharmony_ci#define IWL_BT_COEX_PRIO_TBL_PRIO_SHIFT 1 36838c2ecf20Sopenharmony_ci 36848c2ecf20Sopenharmony_ci/* 36858c2ecf20Sopenharmony_ci * BT Coexistence Priority table 36868c2ecf20Sopenharmony_ci * REPLY_BT_COEX_PRIO_TABLE = 0xcc 36878c2ecf20Sopenharmony_ci */ 36888c2ecf20Sopenharmony_cienum bt_coex_prio_table_events { 36898c2ecf20Sopenharmony_ci BT_COEX_PRIO_TBL_EVT_INIT_CALIB1 = 0, 36908c2ecf20Sopenharmony_ci BT_COEX_PRIO_TBL_EVT_INIT_CALIB2 = 1, 36918c2ecf20Sopenharmony_ci BT_COEX_PRIO_TBL_EVT_PERIODIC_CALIB_LOW1 = 2, 36928c2ecf20Sopenharmony_ci BT_COEX_PRIO_TBL_EVT_PERIODIC_CALIB_LOW2 = 3, /* DC calib */ 36938c2ecf20Sopenharmony_ci BT_COEX_PRIO_TBL_EVT_PERIODIC_CALIB_HIGH1 = 4, 36948c2ecf20Sopenharmony_ci BT_COEX_PRIO_TBL_EVT_PERIODIC_CALIB_HIGH2 = 5, 36958c2ecf20Sopenharmony_ci BT_COEX_PRIO_TBL_EVT_DTIM = 6, 36968c2ecf20Sopenharmony_ci BT_COEX_PRIO_TBL_EVT_SCAN52 = 7, 36978c2ecf20Sopenharmony_ci BT_COEX_PRIO_TBL_EVT_SCAN24 = 8, 36988c2ecf20Sopenharmony_ci BT_COEX_PRIO_TBL_EVT_RESERVED0 = 9, 36998c2ecf20Sopenharmony_ci BT_COEX_PRIO_TBL_EVT_RESERVED1 = 10, 37008c2ecf20Sopenharmony_ci BT_COEX_PRIO_TBL_EVT_RESERVED2 = 11, 37018c2ecf20Sopenharmony_ci BT_COEX_PRIO_TBL_EVT_RESERVED3 = 12, 37028c2ecf20Sopenharmony_ci BT_COEX_PRIO_TBL_EVT_RESERVED4 = 13, 37038c2ecf20Sopenharmony_ci BT_COEX_PRIO_TBL_EVT_RESERVED5 = 14, 37048c2ecf20Sopenharmony_ci BT_COEX_PRIO_TBL_EVT_RESERVED6 = 15, 37058c2ecf20Sopenharmony_ci /* BT_COEX_PRIO_TBL_EVT_MAX should always be last */ 37068c2ecf20Sopenharmony_ci BT_COEX_PRIO_TBL_EVT_MAX, 37078c2ecf20Sopenharmony_ci}; 37088c2ecf20Sopenharmony_ci 37098c2ecf20Sopenharmony_cienum bt_coex_prio_table_priorities { 37108c2ecf20Sopenharmony_ci BT_COEX_PRIO_TBL_DISABLED = 0, 37118c2ecf20Sopenharmony_ci BT_COEX_PRIO_TBL_PRIO_LOW = 1, 37128c2ecf20Sopenharmony_ci BT_COEX_PRIO_TBL_PRIO_HIGH = 2, 37138c2ecf20Sopenharmony_ci BT_COEX_PRIO_TBL_PRIO_BYPASS = 3, 37148c2ecf20Sopenharmony_ci BT_COEX_PRIO_TBL_PRIO_COEX_OFF = 4, 37158c2ecf20Sopenharmony_ci BT_COEX_PRIO_TBL_PRIO_COEX_ON = 5, 37168c2ecf20Sopenharmony_ci BT_COEX_PRIO_TBL_PRIO_RSRVD1 = 6, 37178c2ecf20Sopenharmony_ci BT_COEX_PRIO_TBL_PRIO_RSRVD2 = 7, 37188c2ecf20Sopenharmony_ci BT_COEX_PRIO_TBL_MAX, 37198c2ecf20Sopenharmony_ci}; 37208c2ecf20Sopenharmony_ci 37218c2ecf20Sopenharmony_cistruct iwl_bt_coex_prio_table_cmd { 37228c2ecf20Sopenharmony_ci u8 prio_tbl[BT_COEX_PRIO_TBL_EVT_MAX]; 37238c2ecf20Sopenharmony_ci} __packed; 37248c2ecf20Sopenharmony_ci 37258c2ecf20Sopenharmony_ci#define IWL_BT_COEX_ENV_CLOSE 0 37268c2ecf20Sopenharmony_ci#define IWL_BT_COEX_ENV_OPEN 1 37278c2ecf20Sopenharmony_ci/* 37288c2ecf20Sopenharmony_ci * BT Protection Envelope 37298c2ecf20Sopenharmony_ci * REPLY_BT_COEX_PROT_ENV = 0xcd 37308c2ecf20Sopenharmony_ci */ 37318c2ecf20Sopenharmony_cistruct iwl_bt_coex_prot_env_cmd { 37328c2ecf20Sopenharmony_ci u8 action; /* 0 = closed, 1 = open */ 37338c2ecf20Sopenharmony_ci u8 type; /* 0 .. 15 */ 37348c2ecf20Sopenharmony_ci u8 reserved[2]; 37358c2ecf20Sopenharmony_ci} __packed; 37368c2ecf20Sopenharmony_ci 37378c2ecf20Sopenharmony_ci/* 37388c2ecf20Sopenharmony_ci * REPLY_D3_CONFIG 37398c2ecf20Sopenharmony_ci */ 37408c2ecf20Sopenharmony_cienum iwlagn_d3_wakeup_filters { 37418c2ecf20Sopenharmony_ci IWLAGN_D3_WAKEUP_RFKILL = BIT(0), 37428c2ecf20Sopenharmony_ci IWLAGN_D3_WAKEUP_SYSASSERT = BIT(1), 37438c2ecf20Sopenharmony_ci}; 37448c2ecf20Sopenharmony_ci 37458c2ecf20Sopenharmony_cistruct iwlagn_d3_config_cmd { 37468c2ecf20Sopenharmony_ci __le32 min_sleep_time; 37478c2ecf20Sopenharmony_ci __le32 wakeup_flags; 37488c2ecf20Sopenharmony_ci} __packed; 37498c2ecf20Sopenharmony_ci 37508c2ecf20Sopenharmony_ci/* 37518c2ecf20Sopenharmony_ci * REPLY_WOWLAN_PATTERNS 37528c2ecf20Sopenharmony_ci */ 37538c2ecf20Sopenharmony_ci#define IWLAGN_WOWLAN_MIN_PATTERN_LEN 16 37548c2ecf20Sopenharmony_ci#define IWLAGN_WOWLAN_MAX_PATTERN_LEN 128 37558c2ecf20Sopenharmony_ci 37568c2ecf20Sopenharmony_cistruct iwlagn_wowlan_pattern { 37578c2ecf20Sopenharmony_ci u8 mask[IWLAGN_WOWLAN_MAX_PATTERN_LEN / 8]; 37588c2ecf20Sopenharmony_ci u8 pattern[IWLAGN_WOWLAN_MAX_PATTERN_LEN]; 37598c2ecf20Sopenharmony_ci u8 mask_size; 37608c2ecf20Sopenharmony_ci u8 pattern_size; 37618c2ecf20Sopenharmony_ci __le16 reserved; 37628c2ecf20Sopenharmony_ci} __packed; 37638c2ecf20Sopenharmony_ci 37648c2ecf20Sopenharmony_ci#define IWLAGN_WOWLAN_MAX_PATTERNS 20 37658c2ecf20Sopenharmony_ci 37668c2ecf20Sopenharmony_cistruct iwlagn_wowlan_patterns_cmd { 37678c2ecf20Sopenharmony_ci __le32 n_patterns; 37688c2ecf20Sopenharmony_ci struct iwlagn_wowlan_pattern patterns[]; 37698c2ecf20Sopenharmony_ci} __packed; 37708c2ecf20Sopenharmony_ci 37718c2ecf20Sopenharmony_ci/* 37728c2ecf20Sopenharmony_ci * REPLY_WOWLAN_WAKEUP_FILTER 37738c2ecf20Sopenharmony_ci */ 37748c2ecf20Sopenharmony_cienum iwlagn_wowlan_wakeup_filters { 37758c2ecf20Sopenharmony_ci IWLAGN_WOWLAN_WAKEUP_MAGIC_PACKET = BIT(0), 37768c2ecf20Sopenharmony_ci IWLAGN_WOWLAN_WAKEUP_PATTERN_MATCH = BIT(1), 37778c2ecf20Sopenharmony_ci IWLAGN_WOWLAN_WAKEUP_BEACON_MISS = BIT(2), 37788c2ecf20Sopenharmony_ci IWLAGN_WOWLAN_WAKEUP_LINK_CHANGE = BIT(3), 37798c2ecf20Sopenharmony_ci IWLAGN_WOWLAN_WAKEUP_GTK_REKEY_FAIL = BIT(4), 37808c2ecf20Sopenharmony_ci IWLAGN_WOWLAN_WAKEUP_EAP_IDENT_REQ = BIT(5), 37818c2ecf20Sopenharmony_ci IWLAGN_WOWLAN_WAKEUP_4WAY_HANDSHAKE = BIT(6), 37828c2ecf20Sopenharmony_ci IWLAGN_WOWLAN_WAKEUP_ALWAYS = BIT(7), 37838c2ecf20Sopenharmony_ci IWLAGN_WOWLAN_WAKEUP_ENABLE_NET_DETECT = BIT(8), 37848c2ecf20Sopenharmony_ci}; 37858c2ecf20Sopenharmony_ci 37868c2ecf20Sopenharmony_cistruct iwlagn_wowlan_wakeup_filter_cmd { 37878c2ecf20Sopenharmony_ci __le32 enabled; 37888c2ecf20Sopenharmony_ci __le16 non_qos_seq; 37898c2ecf20Sopenharmony_ci __le16 reserved; 37908c2ecf20Sopenharmony_ci __le16 qos_seq[8]; 37918c2ecf20Sopenharmony_ci}; 37928c2ecf20Sopenharmony_ci 37938c2ecf20Sopenharmony_ci/* 37948c2ecf20Sopenharmony_ci * REPLY_WOWLAN_TSC_RSC_PARAMS 37958c2ecf20Sopenharmony_ci */ 37968c2ecf20Sopenharmony_ci#define IWLAGN_NUM_RSC 16 37978c2ecf20Sopenharmony_ci 37988c2ecf20Sopenharmony_cistruct tkip_sc { 37998c2ecf20Sopenharmony_ci __le16 iv16; 38008c2ecf20Sopenharmony_ci __le16 pad; 38018c2ecf20Sopenharmony_ci __le32 iv32; 38028c2ecf20Sopenharmony_ci} __packed; 38038c2ecf20Sopenharmony_ci 38048c2ecf20Sopenharmony_cistruct iwlagn_tkip_rsc_tsc { 38058c2ecf20Sopenharmony_ci struct tkip_sc unicast_rsc[IWLAGN_NUM_RSC]; 38068c2ecf20Sopenharmony_ci struct tkip_sc multicast_rsc[IWLAGN_NUM_RSC]; 38078c2ecf20Sopenharmony_ci struct tkip_sc tsc; 38088c2ecf20Sopenharmony_ci} __packed; 38098c2ecf20Sopenharmony_ci 38108c2ecf20Sopenharmony_cistruct aes_sc { 38118c2ecf20Sopenharmony_ci __le64 pn; 38128c2ecf20Sopenharmony_ci} __packed; 38138c2ecf20Sopenharmony_ci 38148c2ecf20Sopenharmony_cistruct iwlagn_aes_rsc_tsc { 38158c2ecf20Sopenharmony_ci struct aes_sc unicast_rsc[IWLAGN_NUM_RSC]; 38168c2ecf20Sopenharmony_ci struct aes_sc multicast_rsc[IWLAGN_NUM_RSC]; 38178c2ecf20Sopenharmony_ci struct aes_sc tsc; 38188c2ecf20Sopenharmony_ci} __packed; 38198c2ecf20Sopenharmony_ci 38208c2ecf20Sopenharmony_ciunion iwlagn_all_tsc_rsc { 38218c2ecf20Sopenharmony_ci struct iwlagn_tkip_rsc_tsc tkip; 38228c2ecf20Sopenharmony_ci struct iwlagn_aes_rsc_tsc aes; 38238c2ecf20Sopenharmony_ci}; 38248c2ecf20Sopenharmony_ci 38258c2ecf20Sopenharmony_cistruct iwlagn_wowlan_rsc_tsc_params_cmd { 38268c2ecf20Sopenharmony_ci union iwlagn_all_tsc_rsc all_tsc_rsc; 38278c2ecf20Sopenharmony_ci} __packed; 38288c2ecf20Sopenharmony_ci 38298c2ecf20Sopenharmony_ci/* 38308c2ecf20Sopenharmony_ci * REPLY_WOWLAN_TKIP_PARAMS 38318c2ecf20Sopenharmony_ci */ 38328c2ecf20Sopenharmony_ci#define IWLAGN_MIC_KEY_SIZE 8 38338c2ecf20Sopenharmony_ci#define IWLAGN_P1K_SIZE 5 38348c2ecf20Sopenharmony_cistruct iwlagn_mic_keys { 38358c2ecf20Sopenharmony_ci u8 tx[IWLAGN_MIC_KEY_SIZE]; 38368c2ecf20Sopenharmony_ci u8 rx_unicast[IWLAGN_MIC_KEY_SIZE]; 38378c2ecf20Sopenharmony_ci u8 rx_mcast[IWLAGN_MIC_KEY_SIZE]; 38388c2ecf20Sopenharmony_ci} __packed; 38398c2ecf20Sopenharmony_ci 38408c2ecf20Sopenharmony_cistruct iwlagn_p1k_cache { 38418c2ecf20Sopenharmony_ci __le16 p1k[IWLAGN_P1K_SIZE]; 38428c2ecf20Sopenharmony_ci} __packed; 38438c2ecf20Sopenharmony_ci 38448c2ecf20Sopenharmony_ci#define IWLAGN_NUM_RX_P1K_CACHE 2 38458c2ecf20Sopenharmony_ci 38468c2ecf20Sopenharmony_cistruct iwlagn_wowlan_tkip_params_cmd { 38478c2ecf20Sopenharmony_ci struct iwlagn_mic_keys mic_keys; 38488c2ecf20Sopenharmony_ci struct iwlagn_p1k_cache tx; 38498c2ecf20Sopenharmony_ci struct iwlagn_p1k_cache rx_uni[IWLAGN_NUM_RX_P1K_CACHE]; 38508c2ecf20Sopenharmony_ci struct iwlagn_p1k_cache rx_multi[IWLAGN_NUM_RX_P1K_CACHE]; 38518c2ecf20Sopenharmony_ci} __packed; 38528c2ecf20Sopenharmony_ci 38538c2ecf20Sopenharmony_ci/* 38548c2ecf20Sopenharmony_ci * REPLY_WOWLAN_KEK_KCK_MATERIAL 38558c2ecf20Sopenharmony_ci */ 38568c2ecf20Sopenharmony_ci 38578c2ecf20Sopenharmony_ci#define IWLAGN_KCK_MAX_SIZE 32 38588c2ecf20Sopenharmony_ci#define IWLAGN_KEK_MAX_SIZE 32 38598c2ecf20Sopenharmony_ci 38608c2ecf20Sopenharmony_cistruct iwlagn_wowlan_kek_kck_material_cmd { 38618c2ecf20Sopenharmony_ci u8 kck[IWLAGN_KCK_MAX_SIZE]; 38628c2ecf20Sopenharmony_ci u8 kek[IWLAGN_KEK_MAX_SIZE]; 38638c2ecf20Sopenharmony_ci __le16 kck_len; 38648c2ecf20Sopenharmony_ci __le16 kek_len; 38658c2ecf20Sopenharmony_ci __le64 replay_ctr; 38668c2ecf20Sopenharmony_ci} __packed; 38678c2ecf20Sopenharmony_ci 38688c2ecf20Sopenharmony_ci#define RF_KILL_INDICATOR_FOR_WOWLAN 0x87 38698c2ecf20Sopenharmony_ci 38708c2ecf20Sopenharmony_ci/* 38718c2ecf20Sopenharmony_ci * REPLY_WOWLAN_GET_STATUS = 0xe5 38728c2ecf20Sopenharmony_ci */ 38738c2ecf20Sopenharmony_cistruct iwlagn_wowlan_status { 38748c2ecf20Sopenharmony_ci __le64 replay_ctr; 38758c2ecf20Sopenharmony_ci __le32 rekey_status; 38768c2ecf20Sopenharmony_ci __le32 wakeup_reason; 38778c2ecf20Sopenharmony_ci u8 pattern_number; 38788c2ecf20Sopenharmony_ci u8 reserved1; 38798c2ecf20Sopenharmony_ci __le16 qos_seq_ctr[8]; 38808c2ecf20Sopenharmony_ci __le16 non_qos_seq_ctr; 38818c2ecf20Sopenharmony_ci __le16 reserved2; 38828c2ecf20Sopenharmony_ci union iwlagn_all_tsc_rsc tsc_rsc; 38838c2ecf20Sopenharmony_ci __le16 reserved3; 38848c2ecf20Sopenharmony_ci} __packed; 38858c2ecf20Sopenharmony_ci 38868c2ecf20Sopenharmony_ci/* 38878c2ecf20Sopenharmony_ci * REPLY_WIPAN_PARAMS = 0xb2 (Commands and Notification) 38888c2ecf20Sopenharmony_ci */ 38898c2ecf20Sopenharmony_ci 38908c2ecf20Sopenharmony_ci/* 38918c2ecf20Sopenharmony_ci * Minimum slot time in TU 38928c2ecf20Sopenharmony_ci */ 38938c2ecf20Sopenharmony_ci#define IWL_MIN_SLOT_TIME 20 38948c2ecf20Sopenharmony_ci 38958c2ecf20Sopenharmony_ci/** 38968c2ecf20Sopenharmony_ci * struct iwl_wipan_slot 38978c2ecf20Sopenharmony_ci * @width: Time in TU 38988c2ecf20Sopenharmony_ci * @type: 38998c2ecf20Sopenharmony_ci * 0 - BSS 39008c2ecf20Sopenharmony_ci * 1 - PAN 39018c2ecf20Sopenharmony_ci */ 39028c2ecf20Sopenharmony_cistruct iwl_wipan_slot { 39038c2ecf20Sopenharmony_ci __le16 width; 39048c2ecf20Sopenharmony_ci u8 type; 39058c2ecf20Sopenharmony_ci u8 reserved; 39068c2ecf20Sopenharmony_ci} __packed; 39078c2ecf20Sopenharmony_ci 39088c2ecf20Sopenharmony_ci#define IWL_WIPAN_PARAMS_FLG_LEAVE_CHANNEL_CTS BIT(1) /* reserved */ 39098c2ecf20Sopenharmony_ci#define IWL_WIPAN_PARAMS_FLG_LEAVE_CHANNEL_QUIET BIT(2) /* reserved */ 39108c2ecf20Sopenharmony_ci#define IWL_WIPAN_PARAMS_FLG_SLOTTED_MODE BIT(3) /* reserved */ 39118c2ecf20Sopenharmony_ci#define IWL_WIPAN_PARAMS_FLG_FILTER_BEACON_NOTIF BIT(4) 39128c2ecf20Sopenharmony_ci#define IWL_WIPAN_PARAMS_FLG_FULL_SLOTTED_MODE BIT(5) 39138c2ecf20Sopenharmony_ci 39148c2ecf20Sopenharmony_ci/** 39158c2ecf20Sopenharmony_ci * struct iwl_wipan_params_cmd 39168c2ecf20Sopenharmony_ci * @flags: 39178c2ecf20Sopenharmony_ci * bit0: reserved 39188c2ecf20Sopenharmony_ci * bit1: CP leave channel with CTS 39198c2ecf20Sopenharmony_ci * bit2: CP leave channel qith Quiet 39208c2ecf20Sopenharmony_ci * bit3: slotted mode 39218c2ecf20Sopenharmony_ci * 1 - work in slotted mode 39228c2ecf20Sopenharmony_ci * 0 - work in non slotted mode 39238c2ecf20Sopenharmony_ci * bit4: filter beacon notification 39248c2ecf20Sopenharmony_ci * bit5: full tx slotted mode. if this flag is set, 39258c2ecf20Sopenharmony_ci * uCode will perform leaving channel methods in context switch 39268c2ecf20Sopenharmony_ci * also when working in same channel mode 39278c2ecf20Sopenharmony_ci * @num_slots: 1 - 10 39288c2ecf20Sopenharmony_ci */ 39298c2ecf20Sopenharmony_cistruct iwl_wipan_params_cmd { 39308c2ecf20Sopenharmony_ci __le16 flags; 39318c2ecf20Sopenharmony_ci u8 reserved; 39328c2ecf20Sopenharmony_ci u8 num_slots; 39338c2ecf20Sopenharmony_ci struct iwl_wipan_slot slots[10]; 39348c2ecf20Sopenharmony_ci} __packed; 39358c2ecf20Sopenharmony_ci 39368c2ecf20Sopenharmony_ci/* 39378c2ecf20Sopenharmony_ci * REPLY_WIPAN_P2P_CHANNEL_SWITCH = 0xb9 39388c2ecf20Sopenharmony_ci * 39398c2ecf20Sopenharmony_ci * TODO: Figure out what this is used for, 39408c2ecf20Sopenharmony_ci * it can only switch between 2.4 GHz 39418c2ecf20Sopenharmony_ci * channels!! 39428c2ecf20Sopenharmony_ci */ 39438c2ecf20Sopenharmony_ci 39448c2ecf20Sopenharmony_cistruct iwl_wipan_p2p_channel_switch_cmd { 39458c2ecf20Sopenharmony_ci __le16 channel; 39468c2ecf20Sopenharmony_ci __le16 reserved; 39478c2ecf20Sopenharmony_ci}; 39488c2ecf20Sopenharmony_ci 39498c2ecf20Sopenharmony_ci/* 39508c2ecf20Sopenharmony_ci * REPLY_WIPAN_NOA_NOTIFICATION = 0xbc 39518c2ecf20Sopenharmony_ci * 39528c2ecf20Sopenharmony_ci * This is used by the device to notify us of the 39538c2ecf20Sopenharmony_ci * NoA schedule it determined so we can forward it 39548c2ecf20Sopenharmony_ci * to userspace for inclusion in probe responses. 39558c2ecf20Sopenharmony_ci * 39568c2ecf20Sopenharmony_ci * In beacons, the NoA schedule is simply appended 39578c2ecf20Sopenharmony_ci * to the frame we give the device. 39588c2ecf20Sopenharmony_ci */ 39598c2ecf20Sopenharmony_ci 39608c2ecf20Sopenharmony_cistruct iwl_wipan_noa_descriptor { 39618c2ecf20Sopenharmony_ci u8 count; 39628c2ecf20Sopenharmony_ci __le32 duration; 39638c2ecf20Sopenharmony_ci __le32 interval; 39648c2ecf20Sopenharmony_ci __le32 starttime; 39658c2ecf20Sopenharmony_ci} __packed; 39668c2ecf20Sopenharmony_ci 39678c2ecf20Sopenharmony_cistruct iwl_wipan_noa_attribute { 39688c2ecf20Sopenharmony_ci u8 id; 39698c2ecf20Sopenharmony_ci __le16 length; 39708c2ecf20Sopenharmony_ci u8 index; 39718c2ecf20Sopenharmony_ci u8 ct_window; 39728c2ecf20Sopenharmony_ci struct iwl_wipan_noa_descriptor descr0, descr1; 39738c2ecf20Sopenharmony_ci u8 reserved; 39748c2ecf20Sopenharmony_ci} __packed; 39758c2ecf20Sopenharmony_ci 39768c2ecf20Sopenharmony_cistruct iwl_wipan_noa_notification { 39778c2ecf20Sopenharmony_ci u32 noa_active; 39788c2ecf20Sopenharmony_ci struct iwl_wipan_noa_attribute noa_attribute; 39798c2ecf20Sopenharmony_ci} __packed; 39808c2ecf20Sopenharmony_ci 39818c2ecf20Sopenharmony_ci#endif /* __iwl_commands_h__ */ 3982