162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * Copyright (C) 2005-2014 Intel Corporation 462306a36Sopenharmony_ci */ 562306a36Sopenharmony_ci/* 662306a36Sopenharmony_ci * Please use this file (commands.h) only for uCode API definitions. 762306a36Sopenharmony_ci * Please use iwl-xxxx-hw.h for hardware-related definitions. 862306a36Sopenharmony_ci * Please use dev.h for driver implementation definitions. 962306a36Sopenharmony_ci */ 1062306a36Sopenharmony_ci 1162306a36Sopenharmony_ci#ifndef __iwl_commands_h__ 1262306a36Sopenharmony_ci#define __iwl_commands_h__ 1362306a36Sopenharmony_ci 1462306a36Sopenharmony_ci#include <linux/ieee80211.h> 1562306a36Sopenharmony_ci#include <linux/types.h> 1662306a36Sopenharmony_ci 1762306a36Sopenharmony_ci 1862306a36Sopenharmony_cienum { 1962306a36Sopenharmony_ci REPLY_ALIVE = 0x1, 2062306a36Sopenharmony_ci REPLY_ERROR = 0x2, 2162306a36Sopenharmony_ci REPLY_ECHO = 0x3, /* test command */ 2262306a36Sopenharmony_ci 2362306a36Sopenharmony_ci /* RXON and QOS commands */ 2462306a36Sopenharmony_ci REPLY_RXON = 0x10, 2562306a36Sopenharmony_ci REPLY_RXON_ASSOC = 0x11, 2662306a36Sopenharmony_ci REPLY_QOS_PARAM = 0x13, 2762306a36Sopenharmony_ci REPLY_RXON_TIMING = 0x14, 2862306a36Sopenharmony_ci 2962306a36Sopenharmony_ci /* Multi-Station support */ 3062306a36Sopenharmony_ci REPLY_ADD_STA = 0x18, 3162306a36Sopenharmony_ci REPLY_REMOVE_STA = 0x19, 3262306a36Sopenharmony_ci REPLY_REMOVE_ALL_STA = 0x1a, /* not used */ 3362306a36Sopenharmony_ci REPLY_TXFIFO_FLUSH = 0x1e, 3462306a36Sopenharmony_ci 3562306a36Sopenharmony_ci /* Security */ 3662306a36Sopenharmony_ci REPLY_WEPKEY = 0x20, 3762306a36Sopenharmony_ci 3862306a36Sopenharmony_ci /* RX, TX, LEDs */ 3962306a36Sopenharmony_ci REPLY_TX = 0x1c, 4062306a36Sopenharmony_ci REPLY_LEDS_CMD = 0x48, 4162306a36Sopenharmony_ci REPLY_TX_LINK_QUALITY_CMD = 0x4e, 4262306a36Sopenharmony_ci 4362306a36Sopenharmony_ci /* WiMAX coexistence */ 4462306a36Sopenharmony_ci COEX_PRIORITY_TABLE_CMD = 0x5a, 4562306a36Sopenharmony_ci COEX_MEDIUM_NOTIFICATION = 0x5b, 4662306a36Sopenharmony_ci COEX_EVENT_CMD = 0x5c, 4762306a36Sopenharmony_ci 4862306a36Sopenharmony_ci /* Calibration */ 4962306a36Sopenharmony_ci TEMPERATURE_NOTIFICATION = 0x62, 5062306a36Sopenharmony_ci CALIBRATION_CFG_CMD = 0x65, 5162306a36Sopenharmony_ci CALIBRATION_RES_NOTIFICATION = 0x66, 5262306a36Sopenharmony_ci CALIBRATION_COMPLETE_NOTIFICATION = 0x67, 5362306a36Sopenharmony_ci 5462306a36Sopenharmony_ci /* 802.11h related */ 5562306a36Sopenharmony_ci REPLY_QUIET_CMD = 0x71, /* not used */ 5662306a36Sopenharmony_ci REPLY_CHANNEL_SWITCH = 0x72, 5762306a36Sopenharmony_ci CHANNEL_SWITCH_NOTIFICATION = 0x73, 5862306a36Sopenharmony_ci REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74, 5962306a36Sopenharmony_ci SPECTRUM_MEASURE_NOTIFICATION = 0x75, 6062306a36Sopenharmony_ci 6162306a36Sopenharmony_ci /* Power Management */ 6262306a36Sopenharmony_ci POWER_TABLE_CMD = 0x77, 6362306a36Sopenharmony_ci PM_SLEEP_NOTIFICATION = 0x7A, 6462306a36Sopenharmony_ci PM_DEBUG_STATISTIC_NOTIFIC = 0x7B, 6562306a36Sopenharmony_ci 6662306a36Sopenharmony_ci /* Scan commands and notifications */ 6762306a36Sopenharmony_ci REPLY_SCAN_CMD = 0x80, 6862306a36Sopenharmony_ci REPLY_SCAN_ABORT_CMD = 0x81, 6962306a36Sopenharmony_ci SCAN_START_NOTIFICATION = 0x82, 7062306a36Sopenharmony_ci SCAN_RESULTS_NOTIFICATION = 0x83, 7162306a36Sopenharmony_ci SCAN_COMPLETE_NOTIFICATION = 0x84, 7262306a36Sopenharmony_ci 7362306a36Sopenharmony_ci /* IBSS/AP commands */ 7462306a36Sopenharmony_ci BEACON_NOTIFICATION = 0x90, 7562306a36Sopenharmony_ci REPLY_TX_BEACON = 0x91, 7662306a36Sopenharmony_ci WHO_IS_AWAKE_NOTIFICATION = 0x94, /* not used */ 7762306a36Sopenharmony_ci 7862306a36Sopenharmony_ci /* Miscellaneous commands */ 7962306a36Sopenharmony_ci REPLY_TX_POWER_DBM_CMD = 0x95, 8062306a36Sopenharmony_ci QUIET_NOTIFICATION = 0x96, /* not used */ 8162306a36Sopenharmony_ci REPLY_TX_PWR_TABLE_CMD = 0x97, 8262306a36Sopenharmony_ci REPLY_TX_POWER_DBM_CMD_V1 = 0x98, /* old version of API */ 8362306a36Sopenharmony_ci TX_ANT_CONFIGURATION_CMD = 0x98, 8462306a36Sopenharmony_ci MEASURE_ABORT_NOTIFICATION = 0x99, /* not used */ 8562306a36Sopenharmony_ci 8662306a36Sopenharmony_ci /* Bluetooth device coexistence config command */ 8762306a36Sopenharmony_ci REPLY_BT_CONFIG = 0x9b, 8862306a36Sopenharmony_ci 8962306a36Sopenharmony_ci /* Statistics */ 9062306a36Sopenharmony_ci REPLY_STATISTICS_CMD = 0x9c, 9162306a36Sopenharmony_ci STATISTICS_NOTIFICATION = 0x9d, 9262306a36Sopenharmony_ci 9362306a36Sopenharmony_ci /* RF-KILL commands and notifications */ 9462306a36Sopenharmony_ci REPLY_CARD_STATE_CMD = 0xa0, 9562306a36Sopenharmony_ci CARD_STATE_NOTIFICATION = 0xa1, 9662306a36Sopenharmony_ci 9762306a36Sopenharmony_ci /* Missed beacons notification */ 9862306a36Sopenharmony_ci MISSED_BEACONS_NOTIFICATION = 0xa2, 9962306a36Sopenharmony_ci 10062306a36Sopenharmony_ci REPLY_CT_KILL_CONFIG_CMD = 0xa4, 10162306a36Sopenharmony_ci SENSITIVITY_CMD = 0xa8, 10262306a36Sopenharmony_ci REPLY_PHY_CALIBRATION_CMD = 0xb0, 10362306a36Sopenharmony_ci REPLY_RX_PHY_CMD = 0xc0, 10462306a36Sopenharmony_ci REPLY_RX_MPDU_CMD = 0xc1, 10562306a36Sopenharmony_ci REPLY_RX = 0xc3, 10662306a36Sopenharmony_ci REPLY_COMPRESSED_BA = 0xc5, 10762306a36Sopenharmony_ci 10862306a36Sopenharmony_ci /* BT Coex */ 10962306a36Sopenharmony_ci REPLY_BT_COEX_PRIO_TABLE = 0xcc, 11062306a36Sopenharmony_ci REPLY_BT_COEX_PROT_ENV = 0xcd, 11162306a36Sopenharmony_ci REPLY_BT_COEX_PROFILE_NOTIF = 0xce, 11262306a36Sopenharmony_ci 11362306a36Sopenharmony_ci /* PAN commands */ 11462306a36Sopenharmony_ci REPLY_WIPAN_PARAMS = 0xb2, 11562306a36Sopenharmony_ci REPLY_WIPAN_RXON = 0xb3, /* use REPLY_RXON structure */ 11662306a36Sopenharmony_ci REPLY_WIPAN_RXON_TIMING = 0xb4, /* use REPLY_RXON_TIMING structure */ 11762306a36Sopenharmony_ci REPLY_WIPAN_RXON_ASSOC = 0xb6, /* use REPLY_RXON_ASSOC structure */ 11862306a36Sopenharmony_ci REPLY_WIPAN_QOS_PARAM = 0xb7, /* use REPLY_QOS_PARAM structure */ 11962306a36Sopenharmony_ci REPLY_WIPAN_WEPKEY = 0xb8, /* use REPLY_WEPKEY structure */ 12062306a36Sopenharmony_ci REPLY_WIPAN_P2P_CHANNEL_SWITCH = 0xb9, 12162306a36Sopenharmony_ci REPLY_WIPAN_NOA_NOTIFICATION = 0xbc, 12262306a36Sopenharmony_ci REPLY_WIPAN_DEACTIVATION_COMPLETE = 0xbd, 12362306a36Sopenharmony_ci 12462306a36Sopenharmony_ci REPLY_WOWLAN_PATTERNS = 0xe0, 12562306a36Sopenharmony_ci REPLY_WOWLAN_WAKEUP_FILTER = 0xe1, 12662306a36Sopenharmony_ci REPLY_WOWLAN_TSC_RSC_PARAMS = 0xe2, 12762306a36Sopenharmony_ci REPLY_WOWLAN_TKIP_PARAMS = 0xe3, 12862306a36Sopenharmony_ci REPLY_WOWLAN_KEK_KCK_MATERIAL = 0xe4, 12962306a36Sopenharmony_ci REPLY_WOWLAN_GET_STATUS = 0xe5, 13062306a36Sopenharmony_ci REPLY_D3_CONFIG = 0xd3, 13162306a36Sopenharmony_ci 13262306a36Sopenharmony_ci REPLY_MAX = 0xff 13362306a36Sopenharmony_ci}; 13462306a36Sopenharmony_ci 13562306a36Sopenharmony_ci/* 13662306a36Sopenharmony_ci * Minimum number of queues. MAX_NUM is defined in hw specific files. 13762306a36Sopenharmony_ci * Set the minimum to accommodate 13862306a36Sopenharmony_ci * - 4 standard TX queues 13962306a36Sopenharmony_ci * - the command queue 14062306a36Sopenharmony_ci * - 4 PAN TX queues 14162306a36Sopenharmony_ci * - the PAN multicast queue, and 14262306a36Sopenharmony_ci * - the AUX (TX during scan dwell) queue. 14362306a36Sopenharmony_ci */ 14462306a36Sopenharmony_ci#define IWL_MIN_NUM_QUEUES 11 14562306a36Sopenharmony_ci 14662306a36Sopenharmony_ci/* 14762306a36Sopenharmony_ci * Command queue depends on iPAN support. 14862306a36Sopenharmony_ci */ 14962306a36Sopenharmony_ci#define IWL_DEFAULT_CMD_QUEUE_NUM 4 15062306a36Sopenharmony_ci#define IWL_IPAN_CMD_QUEUE_NUM 9 15162306a36Sopenharmony_ci 15262306a36Sopenharmony_ci#define IWL_TX_FIFO_BK 0 /* shared */ 15362306a36Sopenharmony_ci#define IWL_TX_FIFO_BE 1 15462306a36Sopenharmony_ci#define IWL_TX_FIFO_VI 2 /* shared */ 15562306a36Sopenharmony_ci#define IWL_TX_FIFO_VO 3 15662306a36Sopenharmony_ci#define IWL_TX_FIFO_BK_IPAN IWL_TX_FIFO_BK 15762306a36Sopenharmony_ci#define IWL_TX_FIFO_BE_IPAN 4 15862306a36Sopenharmony_ci#define IWL_TX_FIFO_VI_IPAN IWL_TX_FIFO_VI 15962306a36Sopenharmony_ci#define IWL_TX_FIFO_VO_IPAN 5 16062306a36Sopenharmony_ci/* re-uses the VO FIFO, uCode will properly flush/schedule */ 16162306a36Sopenharmony_ci#define IWL_TX_FIFO_AUX 5 16262306a36Sopenharmony_ci#define IWL_TX_FIFO_UNUSED 255 16362306a36Sopenharmony_ci 16462306a36Sopenharmony_ci#define IWLAGN_CMD_FIFO_NUM 7 16562306a36Sopenharmony_ci 16662306a36Sopenharmony_ci/* 16762306a36Sopenharmony_ci * This queue number is required for proper operation 16862306a36Sopenharmony_ci * because the ucode will stop/start the scheduler as 16962306a36Sopenharmony_ci * required. 17062306a36Sopenharmony_ci */ 17162306a36Sopenharmony_ci#define IWL_IPAN_MCAST_QUEUE 8 17262306a36Sopenharmony_ci 17362306a36Sopenharmony_ci/****************************************************************************** 17462306a36Sopenharmony_ci * (0) 17562306a36Sopenharmony_ci * Commonly used structures and definitions: 17662306a36Sopenharmony_ci * Command header, rate_n_flags, txpower 17762306a36Sopenharmony_ci * 17862306a36Sopenharmony_ci *****************************************************************************/ 17962306a36Sopenharmony_ci 18062306a36Sopenharmony_ci/** 18162306a36Sopenharmony_ci * iwlagn rate_n_flags bit fields 18262306a36Sopenharmony_ci * 18362306a36Sopenharmony_ci * rate_n_flags format is used in following iwlagn commands: 18462306a36Sopenharmony_ci * REPLY_RX (response only) 18562306a36Sopenharmony_ci * REPLY_RX_MPDU (response only) 18662306a36Sopenharmony_ci * REPLY_TX (both command and response) 18762306a36Sopenharmony_ci * REPLY_TX_LINK_QUALITY_CMD 18862306a36Sopenharmony_ci * 18962306a36Sopenharmony_ci * High-throughput (HT) rate format for bits 7:0 (bit 8 must be "1"): 19062306a36Sopenharmony_ci * 2-0: 0) 6 Mbps 19162306a36Sopenharmony_ci * 1) 12 Mbps 19262306a36Sopenharmony_ci * 2) 18 Mbps 19362306a36Sopenharmony_ci * 3) 24 Mbps 19462306a36Sopenharmony_ci * 4) 36 Mbps 19562306a36Sopenharmony_ci * 5) 48 Mbps 19662306a36Sopenharmony_ci * 6) 54 Mbps 19762306a36Sopenharmony_ci * 7) 60 Mbps 19862306a36Sopenharmony_ci * 19962306a36Sopenharmony_ci * 4-3: 0) Single stream (SISO) 20062306a36Sopenharmony_ci * 1) Dual stream (MIMO) 20162306a36Sopenharmony_ci * 2) Triple stream (MIMO) 20262306a36Sopenharmony_ci * 20362306a36Sopenharmony_ci * 5: Value of 0x20 in bits 7:0 indicates 6 Mbps HT40 duplicate data 20462306a36Sopenharmony_ci * 20562306a36Sopenharmony_ci * Legacy OFDM rate format for bits 7:0 (bit 8 must be "0", bit 9 "0"): 20662306a36Sopenharmony_ci * 3-0: 0xD) 6 Mbps 20762306a36Sopenharmony_ci * 0xF) 9 Mbps 20862306a36Sopenharmony_ci * 0x5) 12 Mbps 20962306a36Sopenharmony_ci * 0x7) 18 Mbps 21062306a36Sopenharmony_ci * 0x9) 24 Mbps 21162306a36Sopenharmony_ci * 0xB) 36 Mbps 21262306a36Sopenharmony_ci * 0x1) 48 Mbps 21362306a36Sopenharmony_ci * 0x3) 54 Mbps 21462306a36Sopenharmony_ci * 21562306a36Sopenharmony_ci * Legacy CCK rate format for bits 7:0 (bit 8 must be "0", bit 9 "1"): 21662306a36Sopenharmony_ci * 6-0: 10) 1 Mbps 21762306a36Sopenharmony_ci * 20) 2 Mbps 21862306a36Sopenharmony_ci * 55) 5.5 Mbps 21962306a36Sopenharmony_ci * 110) 11 Mbps 22062306a36Sopenharmony_ci */ 22162306a36Sopenharmony_ci#define RATE_MCS_CODE_MSK 0x7 22262306a36Sopenharmony_ci#define RATE_MCS_SPATIAL_POS 3 22362306a36Sopenharmony_ci#define RATE_MCS_SPATIAL_MSK 0x18 22462306a36Sopenharmony_ci#define RATE_MCS_HT_DUP_POS 5 22562306a36Sopenharmony_ci#define RATE_MCS_HT_DUP_MSK 0x20 22662306a36Sopenharmony_ci/* Both legacy and HT use bits 7:0 as the CCK/OFDM rate or HT MCS */ 22762306a36Sopenharmony_ci#define RATE_MCS_RATE_MSK 0xff 22862306a36Sopenharmony_ci 22962306a36Sopenharmony_ci/* Bit 8: (1) HT format, (0) legacy format in bits 7:0 */ 23062306a36Sopenharmony_ci#define RATE_MCS_FLAGS_POS 8 23162306a36Sopenharmony_ci#define RATE_MCS_HT_POS 8 23262306a36Sopenharmony_ci#define RATE_MCS_HT_MSK 0x100 23362306a36Sopenharmony_ci 23462306a36Sopenharmony_ci/* Bit 9: (1) CCK, (0) OFDM. HT (bit 8) must be "0" for this bit to be valid */ 23562306a36Sopenharmony_ci#define RATE_MCS_CCK_POS 9 23662306a36Sopenharmony_ci#define RATE_MCS_CCK_MSK 0x200 23762306a36Sopenharmony_ci 23862306a36Sopenharmony_ci/* Bit 10: (1) Use Green Field preamble */ 23962306a36Sopenharmony_ci#define RATE_MCS_GF_POS 10 24062306a36Sopenharmony_ci#define RATE_MCS_GF_MSK 0x400 24162306a36Sopenharmony_ci 24262306a36Sopenharmony_ci/* Bit 11: (1) Use 40Mhz HT40 chnl width, (0) use 20 MHz legacy chnl width */ 24362306a36Sopenharmony_ci#define RATE_MCS_HT40_POS 11 24462306a36Sopenharmony_ci#define RATE_MCS_HT40_MSK 0x800 24562306a36Sopenharmony_ci 24662306a36Sopenharmony_ci/* Bit 12: (1) Duplicate data on both 20MHz chnls. HT40 (bit 11) must be set. */ 24762306a36Sopenharmony_ci#define RATE_MCS_DUP_POS 12 24862306a36Sopenharmony_ci#define RATE_MCS_DUP_MSK 0x1000 24962306a36Sopenharmony_ci 25062306a36Sopenharmony_ci/* Bit 13: (1) Short guard interval (0.4 usec), (0) normal GI (0.8 usec) */ 25162306a36Sopenharmony_ci#define RATE_MCS_SGI_POS 13 25262306a36Sopenharmony_ci#define RATE_MCS_SGI_MSK 0x2000 25362306a36Sopenharmony_ci 25462306a36Sopenharmony_ci/** 25562306a36Sopenharmony_ci * rate_n_flags Tx antenna masks 25662306a36Sopenharmony_ci * bit14:16 25762306a36Sopenharmony_ci */ 25862306a36Sopenharmony_ci#define RATE_MCS_ANT_POS 14 25962306a36Sopenharmony_ci#define RATE_MCS_ANT_A_MSK 0x04000 26062306a36Sopenharmony_ci#define RATE_MCS_ANT_B_MSK 0x08000 26162306a36Sopenharmony_ci#define RATE_MCS_ANT_C_MSK 0x10000 26262306a36Sopenharmony_ci#define RATE_MCS_ANT_AB_MSK (RATE_MCS_ANT_A_MSK | RATE_MCS_ANT_B_MSK) 26362306a36Sopenharmony_ci#define RATE_MCS_ANT_ABC_MSK (RATE_MCS_ANT_AB_MSK | RATE_MCS_ANT_C_MSK) 26462306a36Sopenharmony_ci#define RATE_ANT_NUM 3 26562306a36Sopenharmony_ci 26662306a36Sopenharmony_ci#define POWER_TABLE_NUM_ENTRIES 33 26762306a36Sopenharmony_ci#define POWER_TABLE_NUM_HT_OFDM_ENTRIES 32 26862306a36Sopenharmony_ci#define POWER_TABLE_CCK_ENTRY 32 26962306a36Sopenharmony_ci 27062306a36Sopenharmony_ci#define IWL_PWR_NUM_HT_OFDM_ENTRIES 24 27162306a36Sopenharmony_ci#define IWL_PWR_CCK_ENTRIES 2 27262306a36Sopenharmony_ci 27362306a36Sopenharmony_ci/** 27462306a36Sopenharmony_ci * struct tx_power_dual_stream 27562306a36Sopenharmony_ci * 27662306a36Sopenharmony_ci * Table entries in REPLY_TX_PWR_TABLE_CMD, REPLY_CHANNEL_SWITCH 27762306a36Sopenharmony_ci * 27862306a36Sopenharmony_ci * Same format as iwl_tx_power_dual_stream, but __le32 27962306a36Sopenharmony_ci */ 28062306a36Sopenharmony_cistruct tx_power_dual_stream { 28162306a36Sopenharmony_ci __le32 dw; 28262306a36Sopenharmony_ci} __packed; 28362306a36Sopenharmony_ci 28462306a36Sopenharmony_ci/** 28562306a36Sopenharmony_ci * Command REPLY_TX_POWER_DBM_CMD = 0x98 28662306a36Sopenharmony_ci * struct iwlagn_tx_power_dbm_cmd 28762306a36Sopenharmony_ci */ 28862306a36Sopenharmony_ci#define IWLAGN_TX_POWER_AUTO 0x7f 28962306a36Sopenharmony_ci#define IWLAGN_TX_POWER_NO_CLOSED (0x1 << 6) 29062306a36Sopenharmony_ci 29162306a36Sopenharmony_cistruct iwlagn_tx_power_dbm_cmd { 29262306a36Sopenharmony_ci s8 global_lmt; /*in half-dBm (e.g. 30 = 15 dBm) */ 29362306a36Sopenharmony_ci u8 flags; 29462306a36Sopenharmony_ci s8 srv_chan_lmt; /*in half-dBm (e.g. 30 = 15 dBm) */ 29562306a36Sopenharmony_ci u8 reserved; 29662306a36Sopenharmony_ci} __packed; 29762306a36Sopenharmony_ci 29862306a36Sopenharmony_ci/** 29962306a36Sopenharmony_ci * Command TX_ANT_CONFIGURATION_CMD = 0x98 30062306a36Sopenharmony_ci * This command is used to configure valid Tx antenna. 30162306a36Sopenharmony_ci * By default uCode concludes the valid antenna according to the radio flavor. 30262306a36Sopenharmony_ci * This command enables the driver to override/modify this conclusion. 30362306a36Sopenharmony_ci */ 30462306a36Sopenharmony_cistruct iwl_tx_ant_config_cmd { 30562306a36Sopenharmony_ci __le32 valid; 30662306a36Sopenharmony_ci} __packed; 30762306a36Sopenharmony_ci 30862306a36Sopenharmony_ci/****************************************************************************** 30962306a36Sopenharmony_ci * (0a) 31062306a36Sopenharmony_ci * Alive and Error Commands & Responses: 31162306a36Sopenharmony_ci * 31262306a36Sopenharmony_ci *****************************************************************************/ 31362306a36Sopenharmony_ci 31462306a36Sopenharmony_ci#define UCODE_VALID_OK cpu_to_le32(0x1) 31562306a36Sopenharmony_ci 31662306a36Sopenharmony_ci/** 31762306a36Sopenharmony_ci * REPLY_ALIVE = 0x1 (response only, not a command) 31862306a36Sopenharmony_ci * 31962306a36Sopenharmony_ci * uCode issues this "alive" notification once the runtime image is ready 32062306a36Sopenharmony_ci * to receive commands from the driver. This is the *second* "alive" 32162306a36Sopenharmony_ci * notification that the driver will receive after rebooting uCode; 32262306a36Sopenharmony_ci * this "alive" is indicated by subtype field != 9. 32362306a36Sopenharmony_ci * 32462306a36Sopenharmony_ci * See comments documenting "BSM" (bootstrap state machine). 32562306a36Sopenharmony_ci * 32662306a36Sopenharmony_ci * This response includes two pointers to structures within the device's 32762306a36Sopenharmony_ci * data SRAM (access via HBUS_TARG_MEM_* regs) that are useful for debugging: 32862306a36Sopenharmony_ci * 32962306a36Sopenharmony_ci * 1) log_event_table_ptr indicates base of the event log. This traces 33062306a36Sopenharmony_ci * a 256-entry history of uCode execution within a circular buffer. 33162306a36Sopenharmony_ci * Its header format is: 33262306a36Sopenharmony_ci * 33362306a36Sopenharmony_ci * __le32 log_size; log capacity (in number of entries) 33462306a36Sopenharmony_ci * __le32 type; (1) timestamp with each entry, (0) no timestamp 33562306a36Sopenharmony_ci * __le32 wraps; # times uCode has wrapped to top of circular buffer 33662306a36Sopenharmony_ci * __le32 write_index; next circular buffer entry that uCode would fill 33762306a36Sopenharmony_ci * 33862306a36Sopenharmony_ci * The header is followed by the circular buffer of log entries. Entries 33962306a36Sopenharmony_ci * with timestamps have the following format: 34062306a36Sopenharmony_ci * 34162306a36Sopenharmony_ci * __le32 event_id; range 0 - 1500 34262306a36Sopenharmony_ci * __le32 timestamp; low 32 bits of TSF (of network, if associated) 34362306a36Sopenharmony_ci * __le32 data; event_id-specific data value 34462306a36Sopenharmony_ci * 34562306a36Sopenharmony_ci * Entries without timestamps contain only event_id and data. 34662306a36Sopenharmony_ci * 34762306a36Sopenharmony_ci * 34862306a36Sopenharmony_ci * 2) error_event_table_ptr indicates base of the error log. This contains 34962306a36Sopenharmony_ci * information about any uCode error that occurs. For agn, the format 35062306a36Sopenharmony_ci * of the error log is defined by struct iwl_error_event_table. 35162306a36Sopenharmony_ci * 35262306a36Sopenharmony_ci * The Linux driver can print both logs to the system log when a uCode error 35362306a36Sopenharmony_ci * occurs. 35462306a36Sopenharmony_ci */ 35562306a36Sopenharmony_ci 35662306a36Sopenharmony_ci/* 35762306a36Sopenharmony_ci * Note: This structure is read from the device with IO accesses, 35862306a36Sopenharmony_ci * and the reading already does the endian conversion. As it is 35962306a36Sopenharmony_ci * read with u32-sized accesses, any members with a different size 36062306a36Sopenharmony_ci * need to be ordered correctly though! 36162306a36Sopenharmony_ci */ 36262306a36Sopenharmony_cistruct iwl_error_event_table { 36362306a36Sopenharmony_ci u32 valid; /* (nonzero) valid, (0) log is empty */ 36462306a36Sopenharmony_ci u32 error_id; /* type of error */ 36562306a36Sopenharmony_ci u32 pc; /* program counter */ 36662306a36Sopenharmony_ci u32 blink1; /* branch link */ 36762306a36Sopenharmony_ci u32 blink2; /* branch link */ 36862306a36Sopenharmony_ci u32 ilink1; /* interrupt link */ 36962306a36Sopenharmony_ci u32 ilink2; /* interrupt link */ 37062306a36Sopenharmony_ci u32 data1; /* error-specific data */ 37162306a36Sopenharmony_ci u32 data2; /* error-specific data */ 37262306a36Sopenharmony_ci u32 line; /* source code line of error */ 37362306a36Sopenharmony_ci u32 bcon_time; /* beacon timer */ 37462306a36Sopenharmony_ci u32 tsf_low; /* network timestamp function timer */ 37562306a36Sopenharmony_ci u32 tsf_hi; /* network timestamp function timer */ 37662306a36Sopenharmony_ci u32 gp1; /* GP1 timer register */ 37762306a36Sopenharmony_ci u32 gp2; /* GP2 timer register */ 37862306a36Sopenharmony_ci u32 gp3; /* GP3 timer register */ 37962306a36Sopenharmony_ci u32 ucode_ver; /* uCode version */ 38062306a36Sopenharmony_ci u32 hw_ver; /* HW Silicon version */ 38162306a36Sopenharmony_ci u32 brd_ver; /* HW board version */ 38262306a36Sopenharmony_ci u32 log_pc; /* log program counter */ 38362306a36Sopenharmony_ci u32 frame_ptr; /* frame pointer */ 38462306a36Sopenharmony_ci u32 stack_ptr; /* stack pointer */ 38562306a36Sopenharmony_ci u32 hcmd; /* last host command header */ 38662306a36Sopenharmony_ci u32 isr0; /* isr status register LMPM_NIC_ISR0: 38762306a36Sopenharmony_ci * rxtx_flag */ 38862306a36Sopenharmony_ci u32 isr1; /* isr status register LMPM_NIC_ISR1: 38962306a36Sopenharmony_ci * host_flag */ 39062306a36Sopenharmony_ci u32 isr2; /* isr status register LMPM_NIC_ISR2: 39162306a36Sopenharmony_ci * enc_flag */ 39262306a36Sopenharmony_ci u32 isr3; /* isr status register LMPM_NIC_ISR3: 39362306a36Sopenharmony_ci * time_flag */ 39462306a36Sopenharmony_ci u32 isr4; /* isr status register LMPM_NIC_ISR4: 39562306a36Sopenharmony_ci * wico interrupt */ 39662306a36Sopenharmony_ci u32 isr_pref; /* isr status register LMPM_NIC_PREF_STAT */ 39762306a36Sopenharmony_ci u32 wait_event; /* wait event() caller address */ 39862306a36Sopenharmony_ci u32 l2p_control; /* L2pControlField */ 39962306a36Sopenharmony_ci u32 l2p_duration; /* L2pDurationField */ 40062306a36Sopenharmony_ci u32 l2p_mhvalid; /* L2pMhValidBits */ 40162306a36Sopenharmony_ci u32 l2p_addr_match; /* L2pAddrMatchStat */ 40262306a36Sopenharmony_ci u32 lmpm_pmg_sel; /* indicate which clocks are turned on 40362306a36Sopenharmony_ci * (LMPM_PMG_SEL) */ 40462306a36Sopenharmony_ci u32 u_timestamp; /* indicate when the date and time of the 40562306a36Sopenharmony_ci * compilation */ 40662306a36Sopenharmony_ci u32 flow_handler; /* FH read/write pointers, RX credit */ 40762306a36Sopenharmony_ci} __packed; 40862306a36Sopenharmony_ci 40962306a36Sopenharmony_cistruct iwl_alive_resp { 41062306a36Sopenharmony_ci u8 ucode_minor; 41162306a36Sopenharmony_ci u8 ucode_major; 41262306a36Sopenharmony_ci __le16 reserved1; 41362306a36Sopenharmony_ci u8 sw_rev[8]; 41462306a36Sopenharmony_ci u8 ver_type; 41562306a36Sopenharmony_ci u8 ver_subtype; /* not "9" for runtime alive */ 41662306a36Sopenharmony_ci __le16 reserved2; 41762306a36Sopenharmony_ci __le32 log_event_table_ptr; /* SRAM address for event log */ 41862306a36Sopenharmony_ci __le32 error_event_table_ptr; /* SRAM address for error log */ 41962306a36Sopenharmony_ci __le32 timestamp; 42062306a36Sopenharmony_ci __le32 is_valid; 42162306a36Sopenharmony_ci} __packed; 42262306a36Sopenharmony_ci 42362306a36Sopenharmony_ci/* 42462306a36Sopenharmony_ci * REPLY_ERROR = 0x2 (response only, not a command) 42562306a36Sopenharmony_ci */ 42662306a36Sopenharmony_cistruct iwl_error_resp { 42762306a36Sopenharmony_ci __le32 error_type; 42862306a36Sopenharmony_ci u8 cmd_id; 42962306a36Sopenharmony_ci u8 reserved1; 43062306a36Sopenharmony_ci __le16 bad_cmd_seq_num; 43162306a36Sopenharmony_ci __le32 error_info; 43262306a36Sopenharmony_ci __le64 timestamp; 43362306a36Sopenharmony_ci} __packed; 43462306a36Sopenharmony_ci 43562306a36Sopenharmony_ci/****************************************************************************** 43662306a36Sopenharmony_ci * (1) 43762306a36Sopenharmony_ci * RXON Commands & Responses: 43862306a36Sopenharmony_ci * 43962306a36Sopenharmony_ci *****************************************************************************/ 44062306a36Sopenharmony_ci 44162306a36Sopenharmony_ci/* 44262306a36Sopenharmony_ci * Rx config defines & structure 44362306a36Sopenharmony_ci */ 44462306a36Sopenharmony_ci/* rx_config device types */ 44562306a36Sopenharmony_cienum { 44662306a36Sopenharmony_ci RXON_DEV_TYPE_AP = 1, 44762306a36Sopenharmony_ci RXON_DEV_TYPE_ESS = 3, 44862306a36Sopenharmony_ci RXON_DEV_TYPE_IBSS = 4, 44962306a36Sopenharmony_ci RXON_DEV_TYPE_SNIFFER = 6, 45062306a36Sopenharmony_ci RXON_DEV_TYPE_CP = 7, 45162306a36Sopenharmony_ci RXON_DEV_TYPE_2STA = 8, 45262306a36Sopenharmony_ci RXON_DEV_TYPE_P2P = 9, 45362306a36Sopenharmony_ci}; 45462306a36Sopenharmony_ci 45562306a36Sopenharmony_ci 45662306a36Sopenharmony_ci#define RXON_RX_CHAIN_DRIVER_FORCE_MSK cpu_to_le16(0x1 << 0) 45762306a36Sopenharmony_ci#define RXON_RX_CHAIN_DRIVER_FORCE_POS (0) 45862306a36Sopenharmony_ci#define RXON_RX_CHAIN_VALID_MSK cpu_to_le16(0x7 << 1) 45962306a36Sopenharmony_ci#define RXON_RX_CHAIN_VALID_POS (1) 46062306a36Sopenharmony_ci#define RXON_RX_CHAIN_FORCE_SEL_MSK cpu_to_le16(0x7 << 4) 46162306a36Sopenharmony_ci#define RXON_RX_CHAIN_FORCE_SEL_POS (4) 46262306a36Sopenharmony_ci#define RXON_RX_CHAIN_FORCE_MIMO_SEL_MSK cpu_to_le16(0x7 << 7) 46362306a36Sopenharmony_ci#define RXON_RX_CHAIN_FORCE_MIMO_SEL_POS (7) 46462306a36Sopenharmony_ci#define RXON_RX_CHAIN_CNT_MSK cpu_to_le16(0x3 << 10) 46562306a36Sopenharmony_ci#define RXON_RX_CHAIN_CNT_POS (10) 46662306a36Sopenharmony_ci#define RXON_RX_CHAIN_MIMO_CNT_MSK cpu_to_le16(0x3 << 12) 46762306a36Sopenharmony_ci#define RXON_RX_CHAIN_MIMO_CNT_POS (12) 46862306a36Sopenharmony_ci#define RXON_RX_CHAIN_MIMO_FORCE_MSK cpu_to_le16(0x1 << 14) 46962306a36Sopenharmony_ci#define RXON_RX_CHAIN_MIMO_FORCE_POS (14) 47062306a36Sopenharmony_ci 47162306a36Sopenharmony_ci/* rx_config flags */ 47262306a36Sopenharmony_ci/* band & modulation selection */ 47362306a36Sopenharmony_ci#define RXON_FLG_BAND_24G_MSK cpu_to_le32(1 << 0) 47462306a36Sopenharmony_ci#define RXON_FLG_CCK_MSK cpu_to_le32(1 << 1) 47562306a36Sopenharmony_ci/* auto detection enable */ 47662306a36Sopenharmony_ci#define RXON_FLG_AUTO_DETECT_MSK cpu_to_le32(1 << 2) 47762306a36Sopenharmony_ci/* TGg protection when tx */ 47862306a36Sopenharmony_ci#define RXON_FLG_TGG_PROTECT_MSK cpu_to_le32(1 << 3) 47962306a36Sopenharmony_ci/* cck short slot & preamble */ 48062306a36Sopenharmony_ci#define RXON_FLG_SHORT_SLOT_MSK cpu_to_le32(1 << 4) 48162306a36Sopenharmony_ci#define RXON_FLG_SHORT_PREAMBLE_MSK cpu_to_le32(1 << 5) 48262306a36Sopenharmony_ci/* antenna selection */ 48362306a36Sopenharmony_ci#define RXON_FLG_DIS_DIV_MSK cpu_to_le32(1 << 7) 48462306a36Sopenharmony_ci#define RXON_FLG_ANT_SEL_MSK cpu_to_le32(0x0f00) 48562306a36Sopenharmony_ci#define RXON_FLG_ANT_A_MSK cpu_to_le32(1 << 8) 48662306a36Sopenharmony_ci#define RXON_FLG_ANT_B_MSK cpu_to_le32(1 << 9) 48762306a36Sopenharmony_ci/* radar detection enable */ 48862306a36Sopenharmony_ci#define RXON_FLG_RADAR_DETECT_MSK cpu_to_le32(1 << 12) 48962306a36Sopenharmony_ci#define RXON_FLG_TGJ_NARROW_BAND_MSK cpu_to_le32(1 << 13) 49062306a36Sopenharmony_ci/* rx response to host with 8-byte TSF 49162306a36Sopenharmony_ci* (according to ON_AIR deassertion) */ 49262306a36Sopenharmony_ci#define RXON_FLG_TSF2HOST_MSK cpu_to_le32(1 << 15) 49362306a36Sopenharmony_ci 49462306a36Sopenharmony_ci 49562306a36Sopenharmony_ci/* HT flags */ 49662306a36Sopenharmony_ci#define RXON_FLG_CTRL_CHANNEL_LOC_POS (22) 49762306a36Sopenharmony_ci#define RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK cpu_to_le32(0x1 << 22) 49862306a36Sopenharmony_ci 49962306a36Sopenharmony_ci#define RXON_FLG_HT_OPERATING_MODE_POS (23) 50062306a36Sopenharmony_ci 50162306a36Sopenharmony_ci#define RXON_FLG_HT_PROT_MSK cpu_to_le32(0x1 << 23) 50262306a36Sopenharmony_ci#define RXON_FLG_HT40_PROT_MSK cpu_to_le32(0x2 << 23) 50362306a36Sopenharmony_ci 50462306a36Sopenharmony_ci#define RXON_FLG_CHANNEL_MODE_POS (25) 50562306a36Sopenharmony_ci#define RXON_FLG_CHANNEL_MODE_MSK cpu_to_le32(0x3 << 25) 50662306a36Sopenharmony_ci 50762306a36Sopenharmony_ci/* channel mode */ 50862306a36Sopenharmony_cienum { 50962306a36Sopenharmony_ci CHANNEL_MODE_LEGACY = 0, 51062306a36Sopenharmony_ci CHANNEL_MODE_PURE_40 = 1, 51162306a36Sopenharmony_ci CHANNEL_MODE_MIXED = 2, 51262306a36Sopenharmony_ci CHANNEL_MODE_RESERVED = 3, 51362306a36Sopenharmony_ci}; 51462306a36Sopenharmony_ci#define RXON_FLG_CHANNEL_MODE_LEGACY cpu_to_le32(CHANNEL_MODE_LEGACY << RXON_FLG_CHANNEL_MODE_POS) 51562306a36Sopenharmony_ci#define RXON_FLG_CHANNEL_MODE_PURE_40 cpu_to_le32(CHANNEL_MODE_PURE_40 << RXON_FLG_CHANNEL_MODE_POS) 51662306a36Sopenharmony_ci#define RXON_FLG_CHANNEL_MODE_MIXED cpu_to_le32(CHANNEL_MODE_MIXED << RXON_FLG_CHANNEL_MODE_POS) 51762306a36Sopenharmony_ci 51862306a36Sopenharmony_ci/* CTS to self (if spec allows) flag */ 51962306a36Sopenharmony_ci#define RXON_FLG_SELF_CTS_EN cpu_to_le32(0x1<<30) 52062306a36Sopenharmony_ci 52162306a36Sopenharmony_ci/* rx_config filter flags */ 52262306a36Sopenharmony_ci/* accept all data frames */ 52362306a36Sopenharmony_ci#define RXON_FILTER_PROMISC_MSK cpu_to_le32(1 << 0) 52462306a36Sopenharmony_ci/* pass control & management to host */ 52562306a36Sopenharmony_ci#define RXON_FILTER_CTL2HOST_MSK cpu_to_le32(1 << 1) 52662306a36Sopenharmony_ci/* accept multi-cast */ 52762306a36Sopenharmony_ci#define RXON_FILTER_ACCEPT_GRP_MSK cpu_to_le32(1 << 2) 52862306a36Sopenharmony_ci/* don't decrypt uni-cast frames */ 52962306a36Sopenharmony_ci#define RXON_FILTER_DIS_DECRYPT_MSK cpu_to_le32(1 << 3) 53062306a36Sopenharmony_ci/* don't decrypt multi-cast frames */ 53162306a36Sopenharmony_ci#define RXON_FILTER_DIS_GRP_DECRYPT_MSK cpu_to_le32(1 << 4) 53262306a36Sopenharmony_ci/* STA is associated */ 53362306a36Sopenharmony_ci#define RXON_FILTER_ASSOC_MSK cpu_to_le32(1 << 5) 53462306a36Sopenharmony_ci/* transfer to host non bssid beacons in associated state */ 53562306a36Sopenharmony_ci#define RXON_FILTER_BCON_AWARE_MSK cpu_to_le32(1 << 6) 53662306a36Sopenharmony_ci 53762306a36Sopenharmony_ci/** 53862306a36Sopenharmony_ci * REPLY_RXON = 0x10 (command, has simple generic response) 53962306a36Sopenharmony_ci * 54062306a36Sopenharmony_ci * RXON tunes the radio tuner to a service channel, and sets up a number 54162306a36Sopenharmony_ci * of parameters that are used primarily for Rx, but also for Tx operations. 54262306a36Sopenharmony_ci * 54362306a36Sopenharmony_ci * NOTE: When tuning to a new channel, driver must set the 54462306a36Sopenharmony_ci * RXON_FILTER_ASSOC_MSK to 0. This will clear station-dependent 54562306a36Sopenharmony_ci * info within the device, including the station tables, tx retry 54662306a36Sopenharmony_ci * rate tables, and txpower tables. Driver must build a new station 54762306a36Sopenharmony_ci * table and txpower table before transmitting anything on the RXON 54862306a36Sopenharmony_ci * channel. 54962306a36Sopenharmony_ci * 55062306a36Sopenharmony_ci * NOTE: All RXONs wipe clean the internal txpower table. Driver must 55162306a36Sopenharmony_ci * issue a new REPLY_TX_PWR_TABLE_CMD after each REPLY_RXON (0x10), 55262306a36Sopenharmony_ci * regardless of whether RXON_FILTER_ASSOC_MSK is set. 55362306a36Sopenharmony_ci */ 55462306a36Sopenharmony_ci 55562306a36Sopenharmony_cistruct iwl_rxon_cmd { 55662306a36Sopenharmony_ci u8 node_addr[6]; 55762306a36Sopenharmony_ci __le16 reserved1; 55862306a36Sopenharmony_ci u8 bssid_addr[6]; 55962306a36Sopenharmony_ci __le16 reserved2; 56062306a36Sopenharmony_ci u8 wlap_bssid_addr[6]; 56162306a36Sopenharmony_ci __le16 reserved3; 56262306a36Sopenharmony_ci u8 dev_type; 56362306a36Sopenharmony_ci u8 air_propagation; 56462306a36Sopenharmony_ci __le16 rx_chain; 56562306a36Sopenharmony_ci u8 ofdm_basic_rates; 56662306a36Sopenharmony_ci u8 cck_basic_rates; 56762306a36Sopenharmony_ci __le16 assoc_id; 56862306a36Sopenharmony_ci __le32 flags; 56962306a36Sopenharmony_ci __le32 filter_flags; 57062306a36Sopenharmony_ci __le16 channel; 57162306a36Sopenharmony_ci u8 ofdm_ht_single_stream_basic_rates; 57262306a36Sopenharmony_ci u8 ofdm_ht_dual_stream_basic_rates; 57362306a36Sopenharmony_ci u8 ofdm_ht_triple_stream_basic_rates; 57462306a36Sopenharmony_ci u8 reserved5; 57562306a36Sopenharmony_ci __le16 acquisition_data; 57662306a36Sopenharmony_ci __le16 reserved6; 57762306a36Sopenharmony_ci} __packed; 57862306a36Sopenharmony_ci 57962306a36Sopenharmony_ci/* 58062306a36Sopenharmony_ci * REPLY_RXON_ASSOC = 0x11 (command, has simple generic response) 58162306a36Sopenharmony_ci */ 58262306a36Sopenharmony_cistruct iwl_rxon_assoc_cmd { 58362306a36Sopenharmony_ci __le32 flags; 58462306a36Sopenharmony_ci __le32 filter_flags; 58562306a36Sopenharmony_ci u8 ofdm_basic_rates; 58662306a36Sopenharmony_ci u8 cck_basic_rates; 58762306a36Sopenharmony_ci __le16 reserved1; 58862306a36Sopenharmony_ci u8 ofdm_ht_single_stream_basic_rates; 58962306a36Sopenharmony_ci u8 ofdm_ht_dual_stream_basic_rates; 59062306a36Sopenharmony_ci u8 ofdm_ht_triple_stream_basic_rates; 59162306a36Sopenharmony_ci u8 reserved2; 59262306a36Sopenharmony_ci __le16 rx_chain_select_flags; 59362306a36Sopenharmony_ci __le16 acquisition_data; 59462306a36Sopenharmony_ci __le32 reserved3; 59562306a36Sopenharmony_ci} __packed; 59662306a36Sopenharmony_ci 59762306a36Sopenharmony_ci#define IWL_CONN_MAX_LISTEN_INTERVAL 10 59862306a36Sopenharmony_ci#define IWL_MAX_UCODE_BEACON_INTERVAL 4 /* 4096 */ 59962306a36Sopenharmony_ci 60062306a36Sopenharmony_ci/* 60162306a36Sopenharmony_ci * REPLY_RXON_TIMING = 0x14 (command, has simple generic response) 60262306a36Sopenharmony_ci */ 60362306a36Sopenharmony_cistruct iwl_rxon_time_cmd { 60462306a36Sopenharmony_ci __le64 timestamp; 60562306a36Sopenharmony_ci __le16 beacon_interval; 60662306a36Sopenharmony_ci __le16 atim_window; 60762306a36Sopenharmony_ci __le32 beacon_init_val; 60862306a36Sopenharmony_ci __le16 listen_interval; 60962306a36Sopenharmony_ci u8 dtim_period; 61062306a36Sopenharmony_ci u8 delta_cp_bss_tbtts; 61162306a36Sopenharmony_ci} __packed; 61262306a36Sopenharmony_ci 61362306a36Sopenharmony_ci/* 61462306a36Sopenharmony_ci * REPLY_CHANNEL_SWITCH = 0x72 (command, has simple generic response) 61562306a36Sopenharmony_ci */ 61662306a36Sopenharmony_ci/** 61762306a36Sopenharmony_ci * struct iwl5000_channel_switch_cmd 61862306a36Sopenharmony_ci * @band: 0- 5.2GHz, 1- 2.4GHz 61962306a36Sopenharmony_ci * @expect_beacon: 0- resume transmits after channel switch 62062306a36Sopenharmony_ci * 1- wait for beacon to resume transmits 62162306a36Sopenharmony_ci * @channel: new channel number 62262306a36Sopenharmony_ci * @rxon_flags: Rx on flags 62362306a36Sopenharmony_ci * @rxon_filter_flags: filtering parameters 62462306a36Sopenharmony_ci * @switch_time: switch time in extended beacon format 62562306a36Sopenharmony_ci * @reserved: reserved bytes 62662306a36Sopenharmony_ci */ 62762306a36Sopenharmony_cistruct iwl5000_channel_switch_cmd { 62862306a36Sopenharmony_ci u8 band; 62962306a36Sopenharmony_ci u8 expect_beacon; 63062306a36Sopenharmony_ci __le16 channel; 63162306a36Sopenharmony_ci __le32 rxon_flags; 63262306a36Sopenharmony_ci __le32 rxon_filter_flags; 63362306a36Sopenharmony_ci __le32 switch_time; 63462306a36Sopenharmony_ci __le32 reserved[2][IWL_PWR_NUM_HT_OFDM_ENTRIES + IWL_PWR_CCK_ENTRIES]; 63562306a36Sopenharmony_ci} __packed; 63662306a36Sopenharmony_ci 63762306a36Sopenharmony_ci/** 63862306a36Sopenharmony_ci * struct iwl6000_channel_switch_cmd 63962306a36Sopenharmony_ci * @band: 0- 5.2GHz, 1- 2.4GHz 64062306a36Sopenharmony_ci * @expect_beacon: 0- resume transmits after channel switch 64162306a36Sopenharmony_ci * 1- wait for beacon to resume transmits 64262306a36Sopenharmony_ci * @channel: new channel number 64362306a36Sopenharmony_ci * @rxon_flags: Rx on flags 64462306a36Sopenharmony_ci * @rxon_filter_flags: filtering parameters 64562306a36Sopenharmony_ci * @switch_time: switch time in extended beacon format 64662306a36Sopenharmony_ci * @reserved: reserved bytes 64762306a36Sopenharmony_ci */ 64862306a36Sopenharmony_cistruct iwl6000_channel_switch_cmd { 64962306a36Sopenharmony_ci u8 band; 65062306a36Sopenharmony_ci u8 expect_beacon; 65162306a36Sopenharmony_ci __le16 channel; 65262306a36Sopenharmony_ci __le32 rxon_flags; 65362306a36Sopenharmony_ci __le32 rxon_filter_flags; 65462306a36Sopenharmony_ci __le32 switch_time; 65562306a36Sopenharmony_ci __le32 reserved[3][IWL_PWR_NUM_HT_OFDM_ENTRIES + IWL_PWR_CCK_ENTRIES]; 65662306a36Sopenharmony_ci} __packed; 65762306a36Sopenharmony_ci 65862306a36Sopenharmony_ci/* 65962306a36Sopenharmony_ci * CHANNEL_SWITCH_NOTIFICATION = 0x73 (notification only, not a command) 66062306a36Sopenharmony_ci */ 66162306a36Sopenharmony_cistruct iwl_csa_notification { 66262306a36Sopenharmony_ci __le16 band; 66362306a36Sopenharmony_ci __le16 channel; 66462306a36Sopenharmony_ci __le32 status; /* 0 - OK, 1 - fail */ 66562306a36Sopenharmony_ci} __packed; 66662306a36Sopenharmony_ci 66762306a36Sopenharmony_ci/****************************************************************************** 66862306a36Sopenharmony_ci * (2) 66962306a36Sopenharmony_ci * Quality-of-Service (QOS) Commands & Responses: 67062306a36Sopenharmony_ci * 67162306a36Sopenharmony_ci *****************************************************************************/ 67262306a36Sopenharmony_ci 67362306a36Sopenharmony_ci/** 67462306a36Sopenharmony_ci * struct iwl_ac_qos -- QOS timing params for REPLY_QOS_PARAM 67562306a36Sopenharmony_ci * One for each of 4 EDCA access categories in struct iwl_qosparam_cmd 67662306a36Sopenharmony_ci * 67762306a36Sopenharmony_ci * @cw_min: Contention window, start value in numbers of slots. 67862306a36Sopenharmony_ci * Should be a power-of-2, minus 1. Device's default is 0x0f. 67962306a36Sopenharmony_ci * @cw_max: Contention window, max value in numbers of slots. 68062306a36Sopenharmony_ci * Should be a power-of-2, minus 1. Device's default is 0x3f. 68162306a36Sopenharmony_ci * @aifsn: Number of slots in Arbitration Interframe Space (before 68262306a36Sopenharmony_ci * performing random backoff timing prior to Tx). Device default 1. 68362306a36Sopenharmony_ci * @edca_txop: Length of Tx opportunity, in uSecs. Device default is 0. 68462306a36Sopenharmony_ci * 68562306a36Sopenharmony_ci * Device will automatically increase contention window by (2*CW) + 1 for each 68662306a36Sopenharmony_ci * transmission retry. Device uses cw_max as a bit mask, ANDed with new CW 68762306a36Sopenharmony_ci * value, to cap the CW value. 68862306a36Sopenharmony_ci */ 68962306a36Sopenharmony_cistruct iwl_ac_qos { 69062306a36Sopenharmony_ci __le16 cw_min; 69162306a36Sopenharmony_ci __le16 cw_max; 69262306a36Sopenharmony_ci u8 aifsn; 69362306a36Sopenharmony_ci u8 reserved1; 69462306a36Sopenharmony_ci __le16 edca_txop; 69562306a36Sopenharmony_ci} __packed; 69662306a36Sopenharmony_ci 69762306a36Sopenharmony_ci/* QoS flags defines */ 69862306a36Sopenharmony_ci#define QOS_PARAM_FLG_UPDATE_EDCA_MSK cpu_to_le32(0x01) 69962306a36Sopenharmony_ci#define QOS_PARAM_FLG_TGN_MSK cpu_to_le32(0x02) 70062306a36Sopenharmony_ci#define QOS_PARAM_FLG_TXOP_TYPE_MSK cpu_to_le32(0x10) 70162306a36Sopenharmony_ci 70262306a36Sopenharmony_ci/* Number of Access Categories (AC) (EDCA), queues 0..3 */ 70362306a36Sopenharmony_ci#define AC_NUM 4 70462306a36Sopenharmony_ci 70562306a36Sopenharmony_ci/* 70662306a36Sopenharmony_ci * REPLY_QOS_PARAM = 0x13 (command, has simple generic response) 70762306a36Sopenharmony_ci * 70862306a36Sopenharmony_ci * This command sets up timings for each of the 4 prioritized EDCA Tx FIFOs 70962306a36Sopenharmony_ci * 0: Background, 1: Best Effort, 2: Video, 3: Voice. 71062306a36Sopenharmony_ci */ 71162306a36Sopenharmony_cistruct iwl_qosparam_cmd { 71262306a36Sopenharmony_ci __le32 qos_flags; 71362306a36Sopenharmony_ci struct iwl_ac_qos ac[AC_NUM]; 71462306a36Sopenharmony_ci} __packed; 71562306a36Sopenharmony_ci 71662306a36Sopenharmony_ci/****************************************************************************** 71762306a36Sopenharmony_ci * (3) 71862306a36Sopenharmony_ci * Add/Modify Stations Commands & Responses: 71962306a36Sopenharmony_ci * 72062306a36Sopenharmony_ci *****************************************************************************/ 72162306a36Sopenharmony_ci/* 72262306a36Sopenharmony_ci * Multi station support 72362306a36Sopenharmony_ci */ 72462306a36Sopenharmony_ci 72562306a36Sopenharmony_ci/* Special, dedicated locations within device's station table */ 72662306a36Sopenharmony_ci#define IWL_AP_ID 0 72762306a36Sopenharmony_ci#define IWL_AP_ID_PAN 1 72862306a36Sopenharmony_ci#define IWL_STA_ID 2 72962306a36Sopenharmony_ci#define IWLAGN_PAN_BCAST_ID 14 73062306a36Sopenharmony_ci#define IWLAGN_BROADCAST_ID 15 73162306a36Sopenharmony_ci#define IWLAGN_STATION_COUNT 16 73262306a36Sopenharmony_ci 73362306a36Sopenharmony_ci#define IWL_TID_NON_QOS IWL_MAX_TID_COUNT 73462306a36Sopenharmony_ci 73562306a36Sopenharmony_ci#define STA_FLG_TX_RATE_MSK cpu_to_le32(1 << 2) 73662306a36Sopenharmony_ci#define STA_FLG_PWR_SAVE_MSK cpu_to_le32(1 << 8) 73762306a36Sopenharmony_ci#define STA_FLG_PAN_STATION cpu_to_le32(1 << 13) 73862306a36Sopenharmony_ci#define STA_FLG_RTS_MIMO_PROT_MSK cpu_to_le32(1 << 17) 73962306a36Sopenharmony_ci#define STA_FLG_AGG_MPDU_8US_MSK cpu_to_le32(1 << 18) 74062306a36Sopenharmony_ci#define STA_FLG_MAX_AGG_SIZE_POS (19) 74162306a36Sopenharmony_ci#define STA_FLG_MAX_AGG_SIZE_MSK cpu_to_le32(3 << 19) 74262306a36Sopenharmony_ci#define STA_FLG_HT40_EN_MSK cpu_to_le32(1 << 21) 74362306a36Sopenharmony_ci#define STA_FLG_MIMO_DIS_MSK cpu_to_le32(1 << 22) 74462306a36Sopenharmony_ci#define STA_FLG_AGG_MPDU_DENSITY_POS (23) 74562306a36Sopenharmony_ci#define STA_FLG_AGG_MPDU_DENSITY_MSK cpu_to_le32(7 << 23) 74662306a36Sopenharmony_ci 74762306a36Sopenharmony_ci/* Use in mode field. 1: modify existing entry, 0: add new station entry */ 74862306a36Sopenharmony_ci#define STA_CONTROL_MODIFY_MSK 0x01 74962306a36Sopenharmony_ci 75062306a36Sopenharmony_ci/* key flags __le16*/ 75162306a36Sopenharmony_ci#define STA_KEY_FLG_ENCRYPT_MSK cpu_to_le16(0x0007) 75262306a36Sopenharmony_ci#define STA_KEY_FLG_NO_ENC cpu_to_le16(0x0000) 75362306a36Sopenharmony_ci#define STA_KEY_FLG_WEP cpu_to_le16(0x0001) 75462306a36Sopenharmony_ci#define STA_KEY_FLG_CCMP cpu_to_le16(0x0002) 75562306a36Sopenharmony_ci#define STA_KEY_FLG_TKIP cpu_to_le16(0x0003) 75662306a36Sopenharmony_ci 75762306a36Sopenharmony_ci#define STA_KEY_FLG_KEYID_POS 8 75862306a36Sopenharmony_ci#define STA_KEY_FLG_INVALID cpu_to_le16(0x0800) 75962306a36Sopenharmony_ci/* wep key is either from global key (0) or from station info array (1) */ 76062306a36Sopenharmony_ci#define STA_KEY_FLG_MAP_KEY_MSK cpu_to_le16(0x0008) 76162306a36Sopenharmony_ci 76262306a36Sopenharmony_ci/* wep key in STA: 5-bytes (0) or 13-bytes (1) */ 76362306a36Sopenharmony_ci#define STA_KEY_FLG_KEY_SIZE_MSK cpu_to_le16(0x1000) 76462306a36Sopenharmony_ci#define STA_KEY_MULTICAST_MSK cpu_to_le16(0x4000) 76562306a36Sopenharmony_ci#define STA_KEY_MAX_NUM 8 76662306a36Sopenharmony_ci#define STA_KEY_MAX_NUM_PAN 16 76762306a36Sopenharmony_ci/* must not match WEP_INVALID_OFFSET */ 76862306a36Sopenharmony_ci#define IWLAGN_HW_KEY_DEFAULT 0xfe 76962306a36Sopenharmony_ci 77062306a36Sopenharmony_ci/* Flags indicate whether to modify vs. don't change various station params */ 77162306a36Sopenharmony_ci#define STA_MODIFY_KEY_MASK 0x01 77262306a36Sopenharmony_ci#define STA_MODIFY_TID_DISABLE_TX 0x02 77362306a36Sopenharmony_ci#define STA_MODIFY_TX_RATE_MSK 0x04 77462306a36Sopenharmony_ci#define STA_MODIFY_ADDBA_TID_MSK 0x08 77562306a36Sopenharmony_ci#define STA_MODIFY_DELBA_TID_MSK 0x10 77662306a36Sopenharmony_ci#define STA_MODIFY_SLEEP_TX_COUNT_MSK 0x20 77762306a36Sopenharmony_ci 77862306a36Sopenharmony_ci/* agn */ 77962306a36Sopenharmony_cistruct iwl_keyinfo { 78062306a36Sopenharmony_ci __le16 key_flags; 78162306a36Sopenharmony_ci u8 tkip_rx_tsc_byte2; /* TSC[2] for key mix ph1 detection */ 78262306a36Sopenharmony_ci u8 reserved1; 78362306a36Sopenharmony_ci __le16 tkip_rx_ttak[5]; /* 10-byte unicast TKIP TTAK */ 78462306a36Sopenharmony_ci u8 key_offset; 78562306a36Sopenharmony_ci u8 reserved2; 78662306a36Sopenharmony_ci u8 key[16]; /* 16-byte unicast decryption key */ 78762306a36Sopenharmony_ci __le64 tx_secur_seq_cnt; 78862306a36Sopenharmony_ci __le64 hw_tkip_mic_rx_key; 78962306a36Sopenharmony_ci __le64 hw_tkip_mic_tx_key; 79062306a36Sopenharmony_ci} __packed; 79162306a36Sopenharmony_ci 79262306a36Sopenharmony_ci/** 79362306a36Sopenharmony_ci * struct sta_id_modify 79462306a36Sopenharmony_ci * @addr[ETH_ALEN]: station's MAC address 79562306a36Sopenharmony_ci * @sta_id: index of station in uCode's station table 79662306a36Sopenharmony_ci * @modify_mask: STA_MODIFY_*, 1: modify, 0: don't change 79762306a36Sopenharmony_ci * 79862306a36Sopenharmony_ci * Driver selects unused table index when adding new station, 79962306a36Sopenharmony_ci * or the index to a pre-existing station entry when modifying that station. 80062306a36Sopenharmony_ci * Some indexes have special purposes (IWL_AP_ID, index 0, is for AP). 80162306a36Sopenharmony_ci * 80262306a36Sopenharmony_ci * modify_mask flags select which parameters to modify vs. leave alone. 80362306a36Sopenharmony_ci */ 80462306a36Sopenharmony_cistruct sta_id_modify { 80562306a36Sopenharmony_ci u8 addr[ETH_ALEN]; 80662306a36Sopenharmony_ci __le16 reserved1; 80762306a36Sopenharmony_ci u8 sta_id; 80862306a36Sopenharmony_ci u8 modify_mask; 80962306a36Sopenharmony_ci __le16 reserved2; 81062306a36Sopenharmony_ci} __packed; 81162306a36Sopenharmony_ci 81262306a36Sopenharmony_ci/* 81362306a36Sopenharmony_ci * REPLY_ADD_STA = 0x18 (command) 81462306a36Sopenharmony_ci * 81562306a36Sopenharmony_ci * The device contains an internal table of per-station information, 81662306a36Sopenharmony_ci * with info on security keys, aggregation parameters, and Tx rates for 81762306a36Sopenharmony_ci * initial Tx attempt and any retries (agn devices uses 81862306a36Sopenharmony_ci * REPLY_TX_LINK_QUALITY_CMD, 81962306a36Sopenharmony_ci * 82062306a36Sopenharmony_ci * REPLY_ADD_STA sets up the table entry for one station, either creating 82162306a36Sopenharmony_ci * a new entry, or modifying a pre-existing one. 82262306a36Sopenharmony_ci * 82362306a36Sopenharmony_ci * NOTE: RXON command (without "associated" bit set) wipes the station table 82462306a36Sopenharmony_ci * clean. Moving into RF_KILL state does this also. Driver must set up 82562306a36Sopenharmony_ci * new station table before transmitting anything on the RXON channel 82662306a36Sopenharmony_ci * (except active scans or active measurements; those commands carry 82762306a36Sopenharmony_ci * their own txpower/rate setup data). 82862306a36Sopenharmony_ci * 82962306a36Sopenharmony_ci * When getting started on a new channel, driver must set up the 83062306a36Sopenharmony_ci * IWL_BROADCAST_ID entry (last entry in the table). For a client 83162306a36Sopenharmony_ci * station in a BSS, once an AP is selected, driver sets up the AP STA 83262306a36Sopenharmony_ci * in the IWL_AP_ID entry (1st entry in the table). BROADCAST and AP 83362306a36Sopenharmony_ci * are all that are needed for a BSS client station. If the device is 83462306a36Sopenharmony_ci * used as AP, or in an IBSS network, driver must set up station table 83562306a36Sopenharmony_ci * entries for all STAs in network, starting with index IWL_STA_ID. 83662306a36Sopenharmony_ci */ 83762306a36Sopenharmony_ci 83862306a36Sopenharmony_cistruct iwl_addsta_cmd { 83962306a36Sopenharmony_ci u8 mode; /* 1: modify existing, 0: add new station */ 84062306a36Sopenharmony_ci u8 reserved[3]; 84162306a36Sopenharmony_ci struct sta_id_modify sta; 84262306a36Sopenharmony_ci struct iwl_keyinfo key; 84362306a36Sopenharmony_ci __le32 station_flags; /* STA_FLG_* */ 84462306a36Sopenharmony_ci __le32 station_flags_msk; /* STA_FLG_* */ 84562306a36Sopenharmony_ci 84662306a36Sopenharmony_ci /* bit field to disable (1) or enable (0) Tx for Traffic ID (TID) 84762306a36Sopenharmony_ci * corresponding to bit (e.g. bit 5 controls TID 5). 84862306a36Sopenharmony_ci * Set modify_mask bit STA_MODIFY_TID_DISABLE_TX to use this field. */ 84962306a36Sopenharmony_ci __le16 tid_disable_tx; 85062306a36Sopenharmony_ci __le16 legacy_reserved; 85162306a36Sopenharmony_ci 85262306a36Sopenharmony_ci /* TID for which to add block-ack support. 85362306a36Sopenharmony_ci * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */ 85462306a36Sopenharmony_ci u8 add_immediate_ba_tid; 85562306a36Sopenharmony_ci 85662306a36Sopenharmony_ci /* TID for which to remove block-ack support. 85762306a36Sopenharmony_ci * Set modify_mask bit STA_MODIFY_DELBA_TID_MSK to use this field. */ 85862306a36Sopenharmony_ci u8 remove_immediate_ba_tid; 85962306a36Sopenharmony_ci 86062306a36Sopenharmony_ci /* Starting Sequence Number for added block-ack support. 86162306a36Sopenharmony_ci * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */ 86262306a36Sopenharmony_ci __le16 add_immediate_ba_ssn; 86362306a36Sopenharmony_ci 86462306a36Sopenharmony_ci /* 86562306a36Sopenharmony_ci * Number of packets OK to transmit to station even though 86662306a36Sopenharmony_ci * it is asleep -- used to synchronise PS-poll and u-APSD 86762306a36Sopenharmony_ci * responses while ucode keeps track of STA sleep state. 86862306a36Sopenharmony_ci */ 86962306a36Sopenharmony_ci __le16 sleep_tx_count; 87062306a36Sopenharmony_ci 87162306a36Sopenharmony_ci __le16 reserved2; 87262306a36Sopenharmony_ci} __packed; 87362306a36Sopenharmony_ci 87462306a36Sopenharmony_ci 87562306a36Sopenharmony_ci#define ADD_STA_SUCCESS_MSK 0x1 87662306a36Sopenharmony_ci#define ADD_STA_NO_ROOM_IN_TABLE 0x2 87762306a36Sopenharmony_ci#define ADD_STA_NO_BLOCK_ACK_RESOURCE 0x4 87862306a36Sopenharmony_ci#define ADD_STA_MODIFY_NON_EXIST_STA 0x8 87962306a36Sopenharmony_ci/* 88062306a36Sopenharmony_ci * REPLY_ADD_STA = 0x18 (response) 88162306a36Sopenharmony_ci */ 88262306a36Sopenharmony_cistruct iwl_add_sta_resp { 88362306a36Sopenharmony_ci u8 status; /* ADD_STA_* */ 88462306a36Sopenharmony_ci} __packed; 88562306a36Sopenharmony_ci 88662306a36Sopenharmony_ci#define REM_STA_SUCCESS_MSK 0x1 88762306a36Sopenharmony_ci/* 88862306a36Sopenharmony_ci * REPLY_REM_STA = 0x19 (response) 88962306a36Sopenharmony_ci */ 89062306a36Sopenharmony_cistruct iwl_rem_sta_resp { 89162306a36Sopenharmony_ci u8 status; 89262306a36Sopenharmony_ci} __packed; 89362306a36Sopenharmony_ci 89462306a36Sopenharmony_ci/* 89562306a36Sopenharmony_ci * REPLY_REM_STA = 0x19 (command) 89662306a36Sopenharmony_ci */ 89762306a36Sopenharmony_cistruct iwl_rem_sta_cmd { 89862306a36Sopenharmony_ci u8 num_sta; /* number of removed stations */ 89962306a36Sopenharmony_ci u8 reserved[3]; 90062306a36Sopenharmony_ci u8 addr[ETH_ALEN]; /* MAC addr of the first station */ 90162306a36Sopenharmony_ci u8 reserved2[2]; 90262306a36Sopenharmony_ci} __packed; 90362306a36Sopenharmony_ci 90462306a36Sopenharmony_ci 90562306a36Sopenharmony_ci/* WiFi queues mask */ 90662306a36Sopenharmony_ci#define IWL_SCD_BK_MSK BIT(0) 90762306a36Sopenharmony_ci#define IWL_SCD_BE_MSK BIT(1) 90862306a36Sopenharmony_ci#define IWL_SCD_VI_MSK BIT(2) 90962306a36Sopenharmony_ci#define IWL_SCD_VO_MSK BIT(3) 91062306a36Sopenharmony_ci#define IWL_SCD_MGMT_MSK BIT(3) 91162306a36Sopenharmony_ci 91262306a36Sopenharmony_ci/* PAN queues mask */ 91362306a36Sopenharmony_ci#define IWL_PAN_SCD_BK_MSK BIT(4) 91462306a36Sopenharmony_ci#define IWL_PAN_SCD_BE_MSK BIT(5) 91562306a36Sopenharmony_ci#define IWL_PAN_SCD_VI_MSK BIT(6) 91662306a36Sopenharmony_ci#define IWL_PAN_SCD_VO_MSK BIT(7) 91762306a36Sopenharmony_ci#define IWL_PAN_SCD_MGMT_MSK BIT(7) 91862306a36Sopenharmony_ci#define IWL_PAN_SCD_MULTICAST_MSK BIT(8) 91962306a36Sopenharmony_ci 92062306a36Sopenharmony_ci#define IWL_AGG_TX_QUEUE_MSK 0xffc00 92162306a36Sopenharmony_ci 92262306a36Sopenharmony_ci#define IWL_DROP_ALL BIT(1) 92362306a36Sopenharmony_ci 92462306a36Sopenharmony_ci/* 92562306a36Sopenharmony_ci * REPLY_TXFIFO_FLUSH = 0x1e(command and response) 92662306a36Sopenharmony_ci * 92762306a36Sopenharmony_ci * When using full FIFO flush this command checks the scheduler HW block WR/RD 92862306a36Sopenharmony_ci * pointers to check if all the frames were transferred by DMA into the 92962306a36Sopenharmony_ci * relevant TX FIFO queue. Only when the DMA is finished and the queue is 93062306a36Sopenharmony_ci * empty the command can finish. 93162306a36Sopenharmony_ci * This command is used to flush the TXFIFO from transmit commands, it may 93262306a36Sopenharmony_ci * operate on single or multiple queues, the command queue can't be flushed by 93362306a36Sopenharmony_ci * this command. The command response is returned when all the queue flush 93462306a36Sopenharmony_ci * operations are done. Each TX command flushed return response with the FLUSH 93562306a36Sopenharmony_ci * status set in the TX response status. When FIFO flush operation is used, 93662306a36Sopenharmony_ci * the flush operation ends when both the scheduler DMA done and TXFIFO empty 93762306a36Sopenharmony_ci * are set. 93862306a36Sopenharmony_ci * 93962306a36Sopenharmony_ci * @queue_control: bit mask for which queues to flush 94062306a36Sopenharmony_ci * @flush_control: flush controls 94162306a36Sopenharmony_ci * 0: Dump single MSDU 94262306a36Sopenharmony_ci * 1: Dump multiple MSDU according to PS, INVALID STA, TTL, TID disable. 94362306a36Sopenharmony_ci * 2: Dump all FIFO 94462306a36Sopenharmony_ci */ 94562306a36Sopenharmony_cistruct iwl_txfifo_flush_cmd_v3 { 94662306a36Sopenharmony_ci __le32 queue_control; 94762306a36Sopenharmony_ci __le16 flush_control; 94862306a36Sopenharmony_ci __le16 reserved; 94962306a36Sopenharmony_ci} __packed; 95062306a36Sopenharmony_ci 95162306a36Sopenharmony_cistruct iwl_txfifo_flush_cmd_v2 { 95262306a36Sopenharmony_ci __le16 queue_control; 95362306a36Sopenharmony_ci __le16 flush_control; 95462306a36Sopenharmony_ci} __packed; 95562306a36Sopenharmony_ci 95662306a36Sopenharmony_ci/* 95762306a36Sopenharmony_ci * REPLY_WEP_KEY = 0x20 95862306a36Sopenharmony_ci */ 95962306a36Sopenharmony_cistruct iwl_wep_key { 96062306a36Sopenharmony_ci u8 key_index; 96162306a36Sopenharmony_ci u8 key_offset; 96262306a36Sopenharmony_ci u8 reserved1[2]; 96362306a36Sopenharmony_ci u8 key_size; 96462306a36Sopenharmony_ci u8 reserved2[3]; 96562306a36Sopenharmony_ci u8 key[16]; 96662306a36Sopenharmony_ci} __packed; 96762306a36Sopenharmony_ci 96862306a36Sopenharmony_cistruct iwl_wep_cmd { 96962306a36Sopenharmony_ci u8 num_keys; 97062306a36Sopenharmony_ci u8 global_key_type; 97162306a36Sopenharmony_ci u8 flags; 97262306a36Sopenharmony_ci u8 reserved; 97362306a36Sopenharmony_ci struct iwl_wep_key key[]; 97462306a36Sopenharmony_ci} __packed; 97562306a36Sopenharmony_ci 97662306a36Sopenharmony_ci#define WEP_KEY_WEP_TYPE 1 97762306a36Sopenharmony_ci#define WEP_KEYS_MAX 4 97862306a36Sopenharmony_ci#define WEP_INVALID_OFFSET 0xff 97962306a36Sopenharmony_ci#define WEP_KEY_LEN_64 5 98062306a36Sopenharmony_ci#define WEP_KEY_LEN_128 13 98162306a36Sopenharmony_ci 98262306a36Sopenharmony_ci/****************************************************************************** 98362306a36Sopenharmony_ci * (4) 98462306a36Sopenharmony_ci * Rx Responses: 98562306a36Sopenharmony_ci * 98662306a36Sopenharmony_ci *****************************************************************************/ 98762306a36Sopenharmony_ci 98862306a36Sopenharmony_ci#define RX_RES_STATUS_NO_CRC32_ERROR cpu_to_le32(1 << 0) 98962306a36Sopenharmony_ci#define RX_RES_STATUS_NO_RXE_OVERFLOW cpu_to_le32(1 << 1) 99062306a36Sopenharmony_ci 99162306a36Sopenharmony_ci#define RX_RES_PHY_FLAGS_BAND_24_MSK cpu_to_le16(1 << 0) 99262306a36Sopenharmony_ci#define RX_RES_PHY_FLAGS_MOD_CCK_MSK cpu_to_le16(1 << 1) 99362306a36Sopenharmony_ci#define RX_RES_PHY_FLAGS_SHORT_PREAMBLE_MSK cpu_to_le16(1 << 2) 99462306a36Sopenharmony_ci#define RX_RES_PHY_FLAGS_NARROW_BAND_MSK cpu_to_le16(1 << 3) 99562306a36Sopenharmony_ci#define RX_RES_PHY_FLAGS_ANTENNA_MSK 0x70 99662306a36Sopenharmony_ci#define RX_RES_PHY_FLAGS_ANTENNA_POS 4 99762306a36Sopenharmony_ci#define RX_RES_PHY_FLAGS_AGG_MSK cpu_to_le16(1 << 7) 99862306a36Sopenharmony_ci 99962306a36Sopenharmony_ci#define RX_RES_STATUS_SEC_TYPE_MSK (0x7 << 8) 100062306a36Sopenharmony_ci#define RX_RES_STATUS_SEC_TYPE_NONE (0x0 << 8) 100162306a36Sopenharmony_ci#define RX_RES_STATUS_SEC_TYPE_WEP (0x1 << 8) 100262306a36Sopenharmony_ci#define RX_RES_STATUS_SEC_TYPE_CCMP (0x2 << 8) 100362306a36Sopenharmony_ci#define RX_RES_STATUS_SEC_TYPE_TKIP (0x3 << 8) 100462306a36Sopenharmony_ci#define RX_RES_STATUS_SEC_TYPE_ERR (0x7 << 8) 100562306a36Sopenharmony_ci 100662306a36Sopenharmony_ci#define RX_RES_STATUS_STATION_FOUND (1<<6) 100762306a36Sopenharmony_ci#define RX_RES_STATUS_NO_STATION_INFO_MISMATCH (1<<7) 100862306a36Sopenharmony_ci 100962306a36Sopenharmony_ci#define RX_RES_STATUS_DECRYPT_TYPE_MSK (0x3 << 11) 101062306a36Sopenharmony_ci#define RX_RES_STATUS_NOT_DECRYPT (0x0 << 11) 101162306a36Sopenharmony_ci#define RX_RES_STATUS_DECRYPT_OK (0x3 << 11) 101262306a36Sopenharmony_ci#define RX_RES_STATUS_BAD_ICV_MIC (0x1 << 11) 101362306a36Sopenharmony_ci#define RX_RES_STATUS_BAD_KEY_TTAK (0x2 << 11) 101462306a36Sopenharmony_ci 101562306a36Sopenharmony_ci#define RX_MPDU_RES_STATUS_ICV_OK (0x20) 101662306a36Sopenharmony_ci#define RX_MPDU_RES_STATUS_MIC_OK (0x40) 101762306a36Sopenharmony_ci#define RX_MPDU_RES_STATUS_TTAK_OK (1 << 7) 101862306a36Sopenharmony_ci#define RX_MPDU_RES_STATUS_DEC_DONE_MSK (0x800) 101962306a36Sopenharmony_ci 102062306a36Sopenharmony_ci 102162306a36Sopenharmony_ci#define IWLAGN_RX_RES_PHY_CNT 8 102262306a36Sopenharmony_ci#define IWLAGN_RX_RES_AGC_IDX 1 102362306a36Sopenharmony_ci#define IWLAGN_RX_RES_RSSI_AB_IDX 2 102462306a36Sopenharmony_ci#define IWLAGN_RX_RES_RSSI_C_IDX 3 102562306a36Sopenharmony_ci#define IWLAGN_OFDM_AGC_MSK 0xfe00 102662306a36Sopenharmony_ci#define IWLAGN_OFDM_AGC_BIT_POS 9 102762306a36Sopenharmony_ci#define IWLAGN_OFDM_RSSI_INBAND_A_BITMSK 0x00ff 102862306a36Sopenharmony_ci#define IWLAGN_OFDM_RSSI_ALLBAND_A_BITMSK 0xff00 102962306a36Sopenharmony_ci#define IWLAGN_OFDM_RSSI_A_BIT_POS 0 103062306a36Sopenharmony_ci#define IWLAGN_OFDM_RSSI_INBAND_B_BITMSK 0xff0000 103162306a36Sopenharmony_ci#define IWLAGN_OFDM_RSSI_ALLBAND_B_BITMSK 0xff000000 103262306a36Sopenharmony_ci#define IWLAGN_OFDM_RSSI_B_BIT_POS 16 103362306a36Sopenharmony_ci#define IWLAGN_OFDM_RSSI_INBAND_C_BITMSK 0x00ff 103462306a36Sopenharmony_ci#define IWLAGN_OFDM_RSSI_ALLBAND_C_BITMSK 0xff00 103562306a36Sopenharmony_ci#define IWLAGN_OFDM_RSSI_C_BIT_POS 0 103662306a36Sopenharmony_ci 103762306a36Sopenharmony_cistruct iwlagn_non_cfg_phy { 103862306a36Sopenharmony_ci __le32 non_cfg_phy[IWLAGN_RX_RES_PHY_CNT]; /* up to 8 phy entries */ 103962306a36Sopenharmony_ci} __packed; 104062306a36Sopenharmony_ci 104162306a36Sopenharmony_ci 104262306a36Sopenharmony_ci/* 104362306a36Sopenharmony_ci * REPLY_RX = 0xc3 (response only, not a command) 104462306a36Sopenharmony_ci * Used only for legacy (non 11n) frames. 104562306a36Sopenharmony_ci */ 104662306a36Sopenharmony_cistruct iwl_rx_phy_res { 104762306a36Sopenharmony_ci u8 non_cfg_phy_cnt; /* non configurable DSP phy data byte count */ 104862306a36Sopenharmony_ci u8 cfg_phy_cnt; /* configurable DSP phy data byte count */ 104962306a36Sopenharmony_ci u8 stat_id; /* configurable DSP phy data set ID */ 105062306a36Sopenharmony_ci u8 reserved1; 105162306a36Sopenharmony_ci __le64 timestamp; /* TSF at on air rise */ 105262306a36Sopenharmony_ci __le32 beacon_time_stamp; /* beacon at on-air rise */ 105362306a36Sopenharmony_ci __le16 phy_flags; /* general phy flags: band, modulation, ... */ 105462306a36Sopenharmony_ci __le16 channel; /* channel number */ 105562306a36Sopenharmony_ci u8 non_cfg_phy_buf[32]; /* for various implementations of non_cfg_phy */ 105662306a36Sopenharmony_ci __le32 rate_n_flags; /* RATE_MCS_* */ 105762306a36Sopenharmony_ci __le16 byte_count; /* frame's byte-count */ 105862306a36Sopenharmony_ci __le16 frame_time; /* frame's time on the air */ 105962306a36Sopenharmony_ci} __packed; 106062306a36Sopenharmony_ci 106162306a36Sopenharmony_cistruct iwl_rx_mpdu_res_start { 106262306a36Sopenharmony_ci __le16 byte_count; 106362306a36Sopenharmony_ci __le16 reserved; 106462306a36Sopenharmony_ci} __packed; 106562306a36Sopenharmony_ci 106662306a36Sopenharmony_ci 106762306a36Sopenharmony_ci/****************************************************************************** 106862306a36Sopenharmony_ci * (5) 106962306a36Sopenharmony_ci * Tx Commands & Responses: 107062306a36Sopenharmony_ci * 107162306a36Sopenharmony_ci * Driver must place each REPLY_TX command into one of the prioritized Tx 107262306a36Sopenharmony_ci * queues in host DRAM, shared between driver and device (see comments for 107362306a36Sopenharmony_ci * SCD registers and Tx/Rx Queues). When the device's Tx scheduler and uCode 107462306a36Sopenharmony_ci * are preparing to transmit, the device pulls the Tx command over the PCI 107562306a36Sopenharmony_ci * bus via one of the device's Tx DMA channels, to fill an internal FIFO 107662306a36Sopenharmony_ci * from which data will be transmitted. 107762306a36Sopenharmony_ci * 107862306a36Sopenharmony_ci * uCode handles all timing and protocol related to control frames 107962306a36Sopenharmony_ci * (RTS/CTS/ACK), based on flags in the Tx command. uCode and Tx scheduler 108062306a36Sopenharmony_ci * handle reception of block-acks; uCode updates the host driver via 108162306a36Sopenharmony_ci * REPLY_COMPRESSED_BA. 108262306a36Sopenharmony_ci * 108362306a36Sopenharmony_ci * uCode handles retrying Tx when an ACK is expected but not received. 108462306a36Sopenharmony_ci * This includes trying lower data rates than the one requested in the Tx 108562306a36Sopenharmony_ci * command, as set up by the REPLY_TX_LINK_QUALITY_CMD (agn). 108662306a36Sopenharmony_ci * 108762306a36Sopenharmony_ci * Driver sets up transmit power for various rates via REPLY_TX_PWR_TABLE_CMD. 108862306a36Sopenharmony_ci * This command must be executed after every RXON command, before Tx can occur. 108962306a36Sopenharmony_ci *****************************************************************************/ 109062306a36Sopenharmony_ci 109162306a36Sopenharmony_ci/* REPLY_TX Tx flags field */ 109262306a36Sopenharmony_ci 109362306a36Sopenharmony_ci/* 109462306a36Sopenharmony_ci * 1: Use RTS/CTS protocol or CTS-to-self if spec allows it 109562306a36Sopenharmony_ci * before this frame. if CTS-to-self required check 109662306a36Sopenharmony_ci * RXON_FLG_SELF_CTS_EN status. 109762306a36Sopenharmony_ci */ 109862306a36Sopenharmony_ci#define TX_CMD_FLG_PROT_REQUIRE_MSK cpu_to_le32(1 << 0) 109962306a36Sopenharmony_ci 110062306a36Sopenharmony_ci/* 1: Expect ACK from receiving station 110162306a36Sopenharmony_ci * 0: Don't expect ACK (MAC header's duration field s/b 0) 110262306a36Sopenharmony_ci * Set this for unicast frames, but not broadcast/multicast. */ 110362306a36Sopenharmony_ci#define TX_CMD_FLG_ACK_MSK cpu_to_le32(1 << 3) 110462306a36Sopenharmony_ci 110562306a36Sopenharmony_ci/* For agn devices: 110662306a36Sopenharmony_ci * 1: Use rate scale table (see REPLY_TX_LINK_QUALITY_CMD). 110762306a36Sopenharmony_ci * Tx command's initial_rate_index indicates first rate to try; 110862306a36Sopenharmony_ci * uCode walks through table for additional Tx attempts. 110962306a36Sopenharmony_ci * 0: Use Tx rate/MCS from Tx command's rate_n_flags field. 111062306a36Sopenharmony_ci * This rate will be used for all Tx attempts; it will not be scaled. */ 111162306a36Sopenharmony_ci#define TX_CMD_FLG_STA_RATE_MSK cpu_to_le32(1 << 4) 111262306a36Sopenharmony_ci 111362306a36Sopenharmony_ci/* 1: Expect immediate block-ack. 111462306a36Sopenharmony_ci * Set when Txing a block-ack request frame. Also set TX_CMD_FLG_ACK_MSK. */ 111562306a36Sopenharmony_ci#define TX_CMD_FLG_IMM_BA_RSP_MASK cpu_to_le32(1 << 6) 111662306a36Sopenharmony_ci 111762306a36Sopenharmony_ci/* Tx antenna selection field; reserved (0) for agn devices. */ 111862306a36Sopenharmony_ci#define TX_CMD_FLG_ANT_SEL_MSK cpu_to_le32(0xf00) 111962306a36Sopenharmony_ci 112062306a36Sopenharmony_ci/* 1: Ignore Bluetooth priority for this frame. 112162306a36Sopenharmony_ci * 0: Delay Tx until Bluetooth device is done (normal usage). */ 112262306a36Sopenharmony_ci#define TX_CMD_FLG_IGNORE_BT cpu_to_le32(1 << 12) 112362306a36Sopenharmony_ci 112462306a36Sopenharmony_ci/* 1: uCode overrides sequence control field in MAC header. 112562306a36Sopenharmony_ci * 0: Driver provides sequence control field in MAC header. 112662306a36Sopenharmony_ci * Set this for management frames, non-QOS data frames, non-unicast frames, 112762306a36Sopenharmony_ci * and also in Tx command embedded in REPLY_SCAN_CMD for active scans. */ 112862306a36Sopenharmony_ci#define TX_CMD_FLG_SEQ_CTL_MSK cpu_to_le32(1 << 13) 112962306a36Sopenharmony_ci 113062306a36Sopenharmony_ci/* 1: This frame is non-last MPDU; more fragments are coming. 113162306a36Sopenharmony_ci * 0: Last fragment, or not using fragmentation. */ 113262306a36Sopenharmony_ci#define TX_CMD_FLG_MORE_FRAG_MSK cpu_to_le32(1 << 14) 113362306a36Sopenharmony_ci 113462306a36Sopenharmony_ci/* 1: uCode calculates and inserts Timestamp Function (TSF) in outgoing frame. 113562306a36Sopenharmony_ci * 0: No TSF required in outgoing frame. 113662306a36Sopenharmony_ci * Set this for transmitting beacons and probe responses. */ 113762306a36Sopenharmony_ci#define TX_CMD_FLG_TSF_MSK cpu_to_le32(1 << 16) 113862306a36Sopenharmony_ci 113962306a36Sopenharmony_ci/* 1: Driver inserted 2 bytes pad after the MAC header, for (required) dword 114062306a36Sopenharmony_ci * alignment of frame's payload data field. 114162306a36Sopenharmony_ci * 0: No pad 114262306a36Sopenharmony_ci * Set this for MAC headers with 26 or 30 bytes, i.e. those with QOS or ADDR4 114362306a36Sopenharmony_ci * field (but not both). Driver must align frame data (i.e. data following 114462306a36Sopenharmony_ci * MAC header) to DWORD boundary. */ 114562306a36Sopenharmony_ci#define TX_CMD_FLG_MH_PAD_MSK cpu_to_le32(1 << 20) 114662306a36Sopenharmony_ci 114762306a36Sopenharmony_ci/* accelerate aggregation support 114862306a36Sopenharmony_ci * 0 - no CCMP encryption; 1 - CCMP encryption */ 114962306a36Sopenharmony_ci#define TX_CMD_FLG_AGG_CCMP_MSK cpu_to_le32(1 << 22) 115062306a36Sopenharmony_ci 115162306a36Sopenharmony_ci/* HCCA-AP - disable duration overwriting. */ 115262306a36Sopenharmony_ci#define TX_CMD_FLG_DUR_MSK cpu_to_le32(1 << 25) 115362306a36Sopenharmony_ci 115462306a36Sopenharmony_ci 115562306a36Sopenharmony_ci/* 115662306a36Sopenharmony_ci * TX command security control 115762306a36Sopenharmony_ci */ 115862306a36Sopenharmony_ci#define TX_CMD_SEC_WEP 0x01 115962306a36Sopenharmony_ci#define TX_CMD_SEC_CCM 0x02 116062306a36Sopenharmony_ci#define TX_CMD_SEC_TKIP 0x03 116162306a36Sopenharmony_ci#define TX_CMD_SEC_MSK 0x03 116262306a36Sopenharmony_ci#define TX_CMD_SEC_SHIFT 6 116362306a36Sopenharmony_ci#define TX_CMD_SEC_KEY128 0x08 116462306a36Sopenharmony_ci 116562306a36Sopenharmony_ci/* 116662306a36Sopenharmony_ci * REPLY_TX = 0x1c (command) 116762306a36Sopenharmony_ci */ 116862306a36Sopenharmony_ci 116962306a36Sopenharmony_ci/* 117062306a36Sopenharmony_ci * Used for managing Tx retries when expecting block-acks. 117162306a36Sopenharmony_ci * Driver should set these fields to 0. 117262306a36Sopenharmony_ci */ 117362306a36Sopenharmony_cistruct iwl_dram_scratch { 117462306a36Sopenharmony_ci u8 try_cnt; /* Tx attempts */ 117562306a36Sopenharmony_ci u8 bt_kill_cnt; /* Tx attempts blocked by Bluetooth device */ 117662306a36Sopenharmony_ci __le16 reserved; 117762306a36Sopenharmony_ci} __packed; 117862306a36Sopenharmony_ci 117962306a36Sopenharmony_cistruct iwl_tx_cmd { 118062306a36Sopenharmony_ci /* 118162306a36Sopenharmony_ci * MPDU byte count: 118262306a36Sopenharmony_ci * MAC header (24/26/30/32 bytes) + 2 bytes pad if 26/30 header size, 118362306a36Sopenharmony_ci * + 8 byte IV for CCM or TKIP (not used for WEP) 118462306a36Sopenharmony_ci * + Data payload 118562306a36Sopenharmony_ci * + 8-byte MIC (not used for CCM/WEP) 118662306a36Sopenharmony_ci * NOTE: Does not include Tx command bytes, post-MAC pad bytes, 118762306a36Sopenharmony_ci * MIC (CCM) 8 bytes, ICV (WEP/TKIP/CKIP) 4 bytes, CRC 4 bytes.i 118862306a36Sopenharmony_ci * Range: 14-2342 bytes. 118962306a36Sopenharmony_ci */ 119062306a36Sopenharmony_ci __le16 len; 119162306a36Sopenharmony_ci 119262306a36Sopenharmony_ci /* 119362306a36Sopenharmony_ci * MPDU or MSDU byte count for next frame. 119462306a36Sopenharmony_ci * Used for fragmentation and bursting, but not 11n aggregation. 119562306a36Sopenharmony_ci * Same as "len", but for next frame. Set to 0 if not applicable. 119662306a36Sopenharmony_ci */ 119762306a36Sopenharmony_ci __le16 next_frame_len; 119862306a36Sopenharmony_ci 119962306a36Sopenharmony_ci __le32 tx_flags; /* TX_CMD_FLG_* */ 120062306a36Sopenharmony_ci 120162306a36Sopenharmony_ci /* uCode may modify this field of the Tx command (in host DRAM!). 120262306a36Sopenharmony_ci * Driver must also set dram_lsb_ptr and dram_msb_ptr in this cmd. */ 120362306a36Sopenharmony_ci struct iwl_dram_scratch scratch; 120462306a36Sopenharmony_ci 120562306a36Sopenharmony_ci /* Rate for *all* Tx attempts, if TX_CMD_FLG_STA_RATE_MSK is cleared. */ 120662306a36Sopenharmony_ci __le32 rate_n_flags; /* RATE_MCS_* */ 120762306a36Sopenharmony_ci 120862306a36Sopenharmony_ci /* Index of destination station in uCode's station table */ 120962306a36Sopenharmony_ci u8 sta_id; 121062306a36Sopenharmony_ci 121162306a36Sopenharmony_ci /* Type of security encryption: CCM or TKIP */ 121262306a36Sopenharmony_ci u8 sec_ctl; /* TX_CMD_SEC_* */ 121362306a36Sopenharmony_ci 121462306a36Sopenharmony_ci /* 121562306a36Sopenharmony_ci * Index into rate table (see REPLY_TX_LINK_QUALITY_CMD) for initial 121662306a36Sopenharmony_ci * Tx attempt, if TX_CMD_FLG_STA_RATE_MSK is set. Normally "0" for 121762306a36Sopenharmony_ci * data frames, this field may be used to selectively reduce initial 121862306a36Sopenharmony_ci * rate (via non-0 value) for special frames (e.g. management), while 121962306a36Sopenharmony_ci * still supporting rate scaling for all frames. 122062306a36Sopenharmony_ci */ 122162306a36Sopenharmony_ci u8 initial_rate_index; 122262306a36Sopenharmony_ci u8 reserved; 122362306a36Sopenharmony_ci u8 key[16]; 122462306a36Sopenharmony_ci __le16 next_frame_flags; 122562306a36Sopenharmony_ci __le16 reserved2; 122662306a36Sopenharmony_ci union { 122762306a36Sopenharmony_ci __le32 life_time; 122862306a36Sopenharmony_ci __le32 attempt; 122962306a36Sopenharmony_ci } stop_time; 123062306a36Sopenharmony_ci 123162306a36Sopenharmony_ci /* Host DRAM physical address pointer to "scratch" in this command. 123262306a36Sopenharmony_ci * Must be dword aligned. "0" in dram_lsb_ptr disables usage. */ 123362306a36Sopenharmony_ci __le32 dram_lsb_ptr; 123462306a36Sopenharmony_ci u8 dram_msb_ptr; 123562306a36Sopenharmony_ci 123662306a36Sopenharmony_ci u8 rts_retry_limit; /*byte 50 */ 123762306a36Sopenharmony_ci u8 data_retry_limit; /*byte 51 */ 123862306a36Sopenharmony_ci u8 tid_tspec; 123962306a36Sopenharmony_ci union { 124062306a36Sopenharmony_ci __le16 pm_frame_timeout; 124162306a36Sopenharmony_ci __le16 attempt_duration; 124262306a36Sopenharmony_ci } timeout; 124362306a36Sopenharmony_ci 124462306a36Sopenharmony_ci /* 124562306a36Sopenharmony_ci * Duration of EDCA burst Tx Opportunity, in 32-usec units. 124662306a36Sopenharmony_ci * Set this if txop time is not specified by HCCA protocol (e.g. by AP). 124762306a36Sopenharmony_ci */ 124862306a36Sopenharmony_ci __le16 driver_txop; 124962306a36Sopenharmony_ci 125062306a36Sopenharmony_ci /* 125162306a36Sopenharmony_ci * MAC header goes here, followed by 2 bytes padding if MAC header 125262306a36Sopenharmony_ci * length is 26 or 30 bytes, followed by payload data 125362306a36Sopenharmony_ci */ 125462306a36Sopenharmony_ci union { 125562306a36Sopenharmony_ci DECLARE_FLEX_ARRAY(u8, payload); 125662306a36Sopenharmony_ci DECLARE_FLEX_ARRAY(struct ieee80211_hdr, hdr); 125762306a36Sopenharmony_ci }; 125862306a36Sopenharmony_ci} __packed; 125962306a36Sopenharmony_ci 126062306a36Sopenharmony_ci/* 126162306a36Sopenharmony_ci * TX command response is sent after *agn* transmission attempts. 126262306a36Sopenharmony_ci * 126362306a36Sopenharmony_ci * both postpone and abort status are expected behavior from uCode. there is 126462306a36Sopenharmony_ci * no special operation required from driver; except for RFKILL_FLUSH, 126562306a36Sopenharmony_ci * which required tx flush host command to flush all the tx frames in queues 126662306a36Sopenharmony_ci */ 126762306a36Sopenharmony_cienum { 126862306a36Sopenharmony_ci TX_STATUS_SUCCESS = 0x01, 126962306a36Sopenharmony_ci TX_STATUS_DIRECT_DONE = 0x02, 127062306a36Sopenharmony_ci /* postpone TX */ 127162306a36Sopenharmony_ci TX_STATUS_POSTPONE_DELAY = 0x40, 127262306a36Sopenharmony_ci TX_STATUS_POSTPONE_FEW_BYTES = 0x41, 127362306a36Sopenharmony_ci TX_STATUS_POSTPONE_BT_PRIO = 0x42, 127462306a36Sopenharmony_ci TX_STATUS_POSTPONE_QUIET_PERIOD = 0x43, 127562306a36Sopenharmony_ci TX_STATUS_POSTPONE_CALC_TTAK = 0x44, 127662306a36Sopenharmony_ci /* abort TX */ 127762306a36Sopenharmony_ci TX_STATUS_FAIL_INTERNAL_CROSSED_RETRY = 0x81, 127862306a36Sopenharmony_ci TX_STATUS_FAIL_SHORT_LIMIT = 0x82, 127962306a36Sopenharmony_ci TX_STATUS_FAIL_LONG_LIMIT = 0x83, 128062306a36Sopenharmony_ci TX_STATUS_FAIL_FIFO_UNDERRUN = 0x84, 128162306a36Sopenharmony_ci TX_STATUS_FAIL_DRAIN_FLOW = 0x85, 128262306a36Sopenharmony_ci TX_STATUS_FAIL_RFKILL_FLUSH = 0x86, 128362306a36Sopenharmony_ci TX_STATUS_FAIL_LIFE_EXPIRE = 0x87, 128462306a36Sopenharmony_ci TX_STATUS_FAIL_DEST_PS = 0x88, 128562306a36Sopenharmony_ci TX_STATUS_FAIL_HOST_ABORTED = 0x89, 128662306a36Sopenharmony_ci TX_STATUS_FAIL_BT_RETRY = 0x8a, 128762306a36Sopenharmony_ci TX_STATUS_FAIL_STA_INVALID = 0x8b, 128862306a36Sopenharmony_ci TX_STATUS_FAIL_FRAG_DROPPED = 0x8c, 128962306a36Sopenharmony_ci TX_STATUS_FAIL_TID_DISABLE = 0x8d, 129062306a36Sopenharmony_ci TX_STATUS_FAIL_FIFO_FLUSHED = 0x8e, 129162306a36Sopenharmony_ci TX_STATUS_FAIL_INSUFFICIENT_CF_POLL = 0x8f, 129262306a36Sopenharmony_ci TX_STATUS_FAIL_PASSIVE_NO_RX = 0x90, 129362306a36Sopenharmony_ci TX_STATUS_FAIL_NO_BEACON_ON_RADAR = 0x91, 129462306a36Sopenharmony_ci}; 129562306a36Sopenharmony_ci 129662306a36Sopenharmony_ci#define TX_PACKET_MODE_REGULAR 0x0000 129762306a36Sopenharmony_ci#define TX_PACKET_MODE_BURST_SEQ 0x0100 129862306a36Sopenharmony_ci#define TX_PACKET_MODE_BURST_FIRST 0x0200 129962306a36Sopenharmony_ci 130062306a36Sopenharmony_cienum { 130162306a36Sopenharmony_ci TX_POWER_PA_NOT_ACTIVE = 0x0, 130262306a36Sopenharmony_ci}; 130362306a36Sopenharmony_ci 130462306a36Sopenharmony_cienum { 130562306a36Sopenharmony_ci TX_STATUS_MSK = 0x000000ff, /* bits 0:7 */ 130662306a36Sopenharmony_ci TX_STATUS_DELAY_MSK = 0x00000040, 130762306a36Sopenharmony_ci TX_STATUS_ABORT_MSK = 0x00000080, 130862306a36Sopenharmony_ci TX_PACKET_MODE_MSK = 0x0000ff00, /* bits 8:15 */ 130962306a36Sopenharmony_ci TX_FIFO_NUMBER_MSK = 0x00070000, /* bits 16:18 */ 131062306a36Sopenharmony_ci TX_RESERVED = 0x00780000, /* bits 19:22 */ 131162306a36Sopenharmony_ci TX_POWER_PA_DETECT_MSK = 0x7f800000, /* bits 23:30 */ 131262306a36Sopenharmony_ci TX_ABORT_REQUIRED_MSK = 0x80000000, /* bits 31:31 */ 131362306a36Sopenharmony_ci}; 131462306a36Sopenharmony_ci 131562306a36Sopenharmony_ci/* ******************************* 131662306a36Sopenharmony_ci * TX aggregation status 131762306a36Sopenharmony_ci ******************************* */ 131862306a36Sopenharmony_ci 131962306a36Sopenharmony_cienum { 132062306a36Sopenharmony_ci AGG_TX_STATE_TRANSMITTED = 0x00, 132162306a36Sopenharmony_ci AGG_TX_STATE_UNDERRUN_MSK = 0x01, 132262306a36Sopenharmony_ci AGG_TX_STATE_BT_PRIO_MSK = 0x02, 132362306a36Sopenharmony_ci AGG_TX_STATE_FEW_BYTES_MSK = 0x04, 132462306a36Sopenharmony_ci AGG_TX_STATE_ABORT_MSK = 0x08, 132562306a36Sopenharmony_ci AGG_TX_STATE_LAST_SENT_TTL_MSK = 0x10, 132662306a36Sopenharmony_ci AGG_TX_STATE_LAST_SENT_TRY_CNT_MSK = 0x20, 132762306a36Sopenharmony_ci AGG_TX_STATE_LAST_SENT_BT_KILL_MSK = 0x40, 132862306a36Sopenharmony_ci AGG_TX_STATE_SCD_QUERY_MSK = 0x80, 132962306a36Sopenharmony_ci AGG_TX_STATE_TEST_BAD_CRC32_MSK = 0x100, 133062306a36Sopenharmony_ci AGG_TX_STATE_RESPONSE_MSK = 0x1ff, 133162306a36Sopenharmony_ci AGG_TX_STATE_DUMP_TX_MSK = 0x200, 133262306a36Sopenharmony_ci AGG_TX_STATE_DELAY_TX_MSK = 0x400 133362306a36Sopenharmony_ci}; 133462306a36Sopenharmony_ci 133562306a36Sopenharmony_ci#define AGG_TX_STATUS_MSK 0x00000fff /* bits 0:11 */ 133662306a36Sopenharmony_ci#define AGG_TX_TRY_MSK 0x0000f000 /* bits 12:15 */ 133762306a36Sopenharmony_ci#define AGG_TX_TRY_POS 12 133862306a36Sopenharmony_ci 133962306a36Sopenharmony_ci#define AGG_TX_STATE_LAST_SENT_MSK (AGG_TX_STATE_LAST_SENT_TTL_MSK | \ 134062306a36Sopenharmony_ci AGG_TX_STATE_LAST_SENT_TRY_CNT_MSK | \ 134162306a36Sopenharmony_ci AGG_TX_STATE_LAST_SENT_BT_KILL_MSK) 134262306a36Sopenharmony_ci 134362306a36Sopenharmony_ci/* # tx attempts for first frame in aggregation */ 134462306a36Sopenharmony_ci#define AGG_TX_STATE_TRY_CNT_POS 12 134562306a36Sopenharmony_ci#define AGG_TX_STATE_TRY_CNT_MSK 0xf000 134662306a36Sopenharmony_ci 134762306a36Sopenharmony_ci/* Command ID and sequence number of Tx command for this frame */ 134862306a36Sopenharmony_ci#define AGG_TX_STATE_SEQ_NUM_POS 16 134962306a36Sopenharmony_ci#define AGG_TX_STATE_SEQ_NUM_MSK 0xffff0000 135062306a36Sopenharmony_ci 135162306a36Sopenharmony_ci/* 135262306a36Sopenharmony_ci * REPLY_TX = 0x1c (response) 135362306a36Sopenharmony_ci * 135462306a36Sopenharmony_ci * This response may be in one of two slightly different formats, indicated 135562306a36Sopenharmony_ci * by the frame_count field: 135662306a36Sopenharmony_ci * 135762306a36Sopenharmony_ci * 1) No aggregation (frame_count == 1). This reports Tx results for 135862306a36Sopenharmony_ci * a single frame. Multiple attempts, at various bit rates, may have 135962306a36Sopenharmony_ci * been made for this frame. 136062306a36Sopenharmony_ci * 136162306a36Sopenharmony_ci * 2) Aggregation (frame_count > 1). This reports Tx results for 136262306a36Sopenharmony_ci * 2 or more frames that used block-acknowledge. All frames were 136362306a36Sopenharmony_ci * transmitted at same rate. Rate scaling may have been used if first 136462306a36Sopenharmony_ci * frame in this new agg block failed in previous agg block(s). 136562306a36Sopenharmony_ci * 136662306a36Sopenharmony_ci * Note that, for aggregation, ACK (block-ack) status is not delivered here; 136762306a36Sopenharmony_ci * block-ack has not been received by the time the agn device records 136862306a36Sopenharmony_ci * this status. 136962306a36Sopenharmony_ci * This status relates to reasons the tx might have been blocked or aborted 137062306a36Sopenharmony_ci * within the sending station (this agn device), rather than whether it was 137162306a36Sopenharmony_ci * received successfully by the destination station. 137262306a36Sopenharmony_ci */ 137362306a36Sopenharmony_cistruct agg_tx_status { 137462306a36Sopenharmony_ci __le16 status; 137562306a36Sopenharmony_ci __le16 sequence; 137662306a36Sopenharmony_ci} __packed; 137762306a36Sopenharmony_ci 137862306a36Sopenharmony_ci/* refer to ra_tid */ 137962306a36Sopenharmony_ci#define IWLAGN_TX_RES_TID_POS 0 138062306a36Sopenharmony_ci#define IWLAGN_TX_RES_TID_MSK 0x0f 138162306a36Sopenharmony_ci#define IWLAGN_TX_RES_RA_POS 4 138262306a36Sopenharmony_ci#define IWLAGN_TX_RES_RA_MSK 0xf0 138362306a36Sopenharmony_ci 138462306a36Sopenharmony_cistruct iwlagn_tx_resp { 138562306a36Sopenharmony_ci u8 frame_count; /* 1 no aggregation, >1 aggregation */ 138662306a36Sopenharmony_ci u8 bt_kill_count; /* # blocked by bluetooth (unused for agg) */ 138762306a36Sopenharmony_ci u8 failure_rts; /* # failures due to unsuccessful RTS */ 138862306a36Sopenharmony_ci u8 failure_frame; /* # failures due to no ACK (unused for agg) */ 138962306a36Sopenharmony_ci 139062306a36Sopenharmony_ci /* For non-agg: Rate at which frame was successful. 139162306a36Sopenharmony_ci * For agg: Rate at which all frames were transmitted. */ 139262306a36Sopenharmony_ci __le32 rate_n_flags; /* RATE_MCS_* */ 139362306a36Sopenharmony_ci 139462306a36Sopenharmony_ci /* For non-agg: RTS + CTS + frame tx attempts time + ACK. 139562306a36Sopenharmony_ci * For agg: RTS + CTS + aggregation tx time + block-ack time. */ 139662306a36Sopenharmony_ci __le16 wireless_media_time; /* uSecs */ 139762306a36Sopenharmony_ci 139862306a36Sopenharmony_ci u8 pa_status; /* RF power amplifier measurement (not used) */ 139962306a36Sopenharmony_ci u8 pa_integ_res_a[3]; 140062306a36Sopenharmony_ci u8 pa_integ_res_b[3]; 140162306a36Sopenharmony_ci u8 pa_integ_res_C[3]; 140262306a36Sopenharmony_ci 140362306a36Sopenharmony_ci __le32 tfd_info; 140462306a36Sopenharmony_ci __le16 seq_ctl; 140562306a36Sopenharmony_ci __le16 byte_cnt; 140662306a36Sopenharmony_ci u8 tlc_info; 140762306a36Sopenharmony_ci u8 ra_tid; /* tid (0:3), sta_id (4:7) */ 140862306a36Sopenharmony_ci __le16 frame_ctrl; 140962306a36Sopenharmony_ci /* 141062306a36Sopenharmony_ci * For non-agg: frame status TX_STATUS_* 141162306a36Sopenharmony_ci * For agg: status of 1st frame, AGG_TX_STATE_*; other frame status 141262306a36Sopenharmony_ci * fields follow this one, up to frame_count. 141362306a36Sopenharmony_ci * Bit fields: 141462306a36Sopenharmony_ci * 11- 0: AGG_TX_STATE_* status code 141562306a36Sopenharmony_ci * 15-12: Retry count for 1st frame in aggregation (retries 141662306a36Sopenharmony_ci * occur if tx failed for this frame when it was a 141762306a36Sopenharmony_ci * member of a previous aggregation block). If rate 141862306a36Sopenharmony_ci * scaling is used, retry count indicates the rate 141962306a36Sopenharmony_ci * table entry used for all frames in the new agg. 142062306a36Sopenharmony_ci * 31-16: Sequence # for this frame's Tx cmd (not SSN!) 142162306a36Sopenharmony_ci */ 142262306a36Sopenharmony_ci struct agg_tx_status status; /* TX status (in aggregation - 142362306a36Sopenharmony_ci * status of 1st frame) */ 142462306a36Sopenharmony_ci} __packed; 142562306a36Sopenharmony_ci/* 142662306a36Sopenharmony_ci * REPLY_COMPRESSED_BA = 0xc5 (response only, not a command) 142762306a36Sopenharmony_ci * 142862306a36Sopenharmony_ci * Reports Block-Acknowledge from recipient station 142962306a36Sopenharmony_ci */ 143062306a36Sopenharmony_cistruct iwl_compressed_ba_resp { 143162306a36Sopenharmony_ci __le32 sta_addr_lo32; 143262306a36Sopenharmony_ci __le16 sta_addr_hi16; 143362306a36Sopenharmony_ci __le16 reserved; 143462306a36Sopenharmony_ci 143562306a36Sopenharmony_ci /* Index of recipient (BA-sending) station in uCode's station table */ 143662306a36Sopenharmony_ci u8 sta_id; 143762306a36Sopenharmony_ci u8 tid; 143862306a36Sopenharmony_ci __le16 seq_ctl; 143962306a36Sopenharmony_ci __le64 bitmap; 144062306a36Sopenharmony_ci __le16 scd_flow; 144162306a36Sopenharmony_ci __le16 scd_ssn; 144262306a36Sopenharmony_ci u8 txed; /* number of frames sent */ 144362306a36Sopenharmony_ci u8 txed_2_done; /* number of frames acked */ 144462306a36Sopenharmony_ci __le16 reserved1; 144562306a36Sopenharmony_ci} __packed; 144662306a36Sopenharmony_ci 144762306a36Sopenharmony_ci/* 144862306a36Sopenharmony_ci * REPLY_TX_PWR_TABLE_CMD = 0x97 (command, has simple generic response) 144962306a36Sopenharmony_ci * 145062306a36Sopenharmony_ci */ 145162306a36Sopenharmony_ci 145262306a36Sopenharmony_ci/*RS_NEW_API: only TLC_RTS remains and moved to bit 0 */ 145362306a36Sopenharmony_ci#define LINK_QUAL_FLAGS_SET_STA_TLC_RTS_MSK (1 << 0) 145462306a36Sopenharmony_ci 145562306a36Sopenharmony_ci/* # of EDCA prioritized tx fifos */ 145662306a36Sopenharmony_ci#define LINK_QUAL_AC_NUM AC_NUM 145762306a36Sopenharmony_ci 145862306a36Sopenharmony_ci/* # entries in rate scale table to support Tx retries */ 145962306a36Sopenharmony_ci#define LINK_QUAL_MAX_RETRY_NUM 16 146062306a36Sopenharmony_ci 146162306a36Sopenharmony_ci/* Tx antenna selection values */ 146262306a36Sopenharmony_ci#define LINK_QUAL_ANT_A_MSK (1 << 0) 146362306a36Sopenharmony_ci#define LINK_QUAL_ANT_B_MSK (1 << 1) 146462306a36Sopenharmony_ci#define LINK_QUAL_ANT_MSK (LINK_QUAL_ANT_A_MSK|LINK_QUAL_ANT_B_MSK) 146562306a36Sopenharmony_ci 146662306a36Sopenharmony_ci 146762306a36Sopenharmony_ci/** 146862306a36Sopenharmony_ci * struct iwl_link_qual_general_params 146962306a36Sopenharmony_ci * 147062306a36Sopenharmony_ci * Used in REPLY_TX_LINK_QUALITY_CMD 147162306a36Sopenharmony_ci */ 147262306a36Sopenharmony_cistruct iwl_link_qual_general_params { 147362306a36Sopenharmony_ci u8 flags; 147462306a36Sopenharmony_ci 147562306a36Sopenharmony_ci /* No entries at or above this (driver chosen) index contain MIMO */ 147662306a36Sopenharmony_ci u8 mimo_delimiter; 147762306a36Sopenharmony_ci 147862306a36Sopenharmony_ci /* Best single antenna to use for single stream (legacy, SISO). */ 147962306a36Sopenharmony_ci u8 single_stream_ant_msk; /* LINK_QUAL_ANT_* */ 148062306a36Sopenharmony_ci 148162306a36Sopenharmony_ci /* Best antennas to use for MIMO */ 148262306a36Sopenharmony_ci u8 dual_stream_ant_msk; /* LINK_QUAL_ANT_* */ 148362306a36Sopenharmony_ci 148462306a36Sopenharmony_ci /* 148562306a36Sopenharmony_ci * If driver needs to use different initial rates for different 148662306a36Sopenharmony_ci * EDCA QOS access categories (as implemented by tx fifos 0-3), 148762306a36Sopenharmony_ci * this table will set that up, by indicating the indexes in the 148862306a36Sopenharmony_ci * rs_table[LINK_QUAL_MAX_RETRY_NUM] rate table at which to start. 148962306a36Sopenharmony_ci * Otherwise, driver should set all entries to 0. 149062306a36Sopenharmony_ci * 149162306a36Sopenharmony_ci * Entry usage: 149262306a36Sopenharmony_ci * 0 = Background, 1 = Best Effort (normal), 2 = Video, 3 = Voice 149362306a36Sopenharmony_ci * TX FIFOs above 3 use same value (typically 0) as TX FIFO 3. 149462306a36Sopenharmony_ci */ 149562306a36Sopenharmony_ci u8 start_rate_index[LINK_QUAL_AC_NUM]; 149662306a36Sopenharmony_ci} __packed; 149762306a36Sopenharmony_ci 149862306a36Sopenharmony_ci#define LINK_QUAL_AGG_TIME_LIMIT_DEF (4000) /* 4 milliseconds */ 149962306a36Sopenharmony_ci#define LINK_QUAL_AGG_TIME_LIMIT_MAX (8000) 150062306a36Sopenharmony_ci#define LINK_QUAL_AGG_TIME_LIMIT_MIN (100) 150162306a36Sopenharmony_ci 150262306a36Sopenharmony_ci#define LINK_QUAL_AGG_DISABLE_START_DEF (3) 150362306a36Sopenharmony_ci#define LINK_QUAL_AGG_DISABLE_START_MAX (255) 150462306a36Sopenharmony_ci#define LINK_QUAL_AGG_DISABLE_START_MIN (0) 150562306a36Sopenharmony_ci 150662306a36Sopenharmony_ci#define LINK_QUAL_AGG_FRAME_LIMIT_DEF (63) 150762306a36Sopenharmony_ci#define LINK_QUAL_AGG_FRAME_LIMIT_MAX (63) 150862306a36Sopenharmony_ci#define LINK_QUAL_AGG_FRAME_LIMIT_MIN (0) 150962306a36Sopenharmony_ci 151062306a36Sopenharmony_ci/** 151162306a36Sopenharmony_ci * struct iwl_link_qual_agg_params 151262306a36Sopenharmony_ci * 151362306a36Sopenharmony_ci * Used in REPLY_TX_LINK_QUALITY_CMD 151462306a36Sopenharmony_ci */ 151562306a36Sopenharmony_cistruct iwl_link_qual_agg_params { 151662306a36Sopenharmony_ci 151762306a36Sopenharmony_ci /* 151862306a36Sopenharmony_ci *Maximum number of uSec in aggregation. 151962306a36Sopenharmony_ci * default set to 4000 (4 milliseconds) if not configured in .cfg 152062306a36Sopenharmony_ci */ 152162306a36Sopenharmony_ci __le16 agg_time_limit; 152262306a36Sopenharmony_ci 152362306a36Sopenharmony_ci /* 152462306a36Sopenharmony_ci * Number of Tx retries allowed for a frame, before that frame will 152562306a36Sopenharmony_ci * no longer be considered for the start of an aggregation sequence 152662306a36Sopenharmony_ci * (scheduler will then try to tx it as single frame). 152762306a36Sopenharmony_ci * Driver should set this to 3. 152862306a36Sopenharmony_ci */ 152962306a36Sopenharmony_ci u8 agg_dis_start_th; 153062306a36Sopenharmony_ci 153162306a36Sopenharmony_ci /* 153262306a36Sopenharmony_ci * Maximum number of frames in aggregation. 153362306a36Sopenharmony_ci * 0 = no limit (default). 1 = no aggregation. 153462306a36Sopenharmony_ci * Other values = max # frames in aggregation. 153562306a36Sopenharmony_ci */ 153662306a36Sopenharmony_ci u8 agg_frame_cnt_limit; 153762306a36Sopenharmony_ci 153862306a36Sopenharmony_ci __le32 reserved; 153962306a36Sopenharmony_ci} __packed; 154062306a36Sopenharmony_ci 154162306a36Sopenharmony_ci/* 154262306a36Sopenharmony_ci * REPLY_TX_LINK_QUALITY_CMD = 0x4e (command, has simple generic response) 154362306a36Sopenharmony_ci * 154462306a36Sopenharmony_ci * For agn devices 154562306a36Sopenharmony_ci * 154662306a36Sopenharmony_ci * Each station in the agn device's internal station table has its own table 154762306a36Sopenharmony_ci * of 16 154862306a36Sopenharmony_ci * Tx rates and modulation modes (e.g. legacy/SISO/MIMO) for retrying Tx when 154962306a36Sopenharmony_ci * an ACK is not received. This command replaces the entire table for 155062306a36Sopenharmony_ci * one station. 155162306a36Sopenharmony_ci * 155262306a36Sopenharmony_ci * NOTE: Station must already be in agn device's station table. 155362306a36Sopenharmony_ci * Use REPLY_ADD_STA. 155462306a36Sopenharmony_ci * 155562306a36Sopenharmony_ci * The rate scaling procedures described below work well. Of course, other 155662306a36Sopenharmony_ci * procedures are possible, and may work better for particular environments. 155762306a36Sopenharmony_ci * 155862306a36Sopenharmony_ci * 155962306a36Sopenharmony_ci * FILLING THE RATE TABLE 156062306a36Sopenharmony_ci * 156162306a36Sopenharmony_ci * Given a particular initial rate and mode, as determined by the rate 156262306a36Sopenharmony_ci * scaling algorithm described below, the Linux driver uses the following 156362306a36Sopenharmony_ci * formula to fill the rs_table[LINK_QUAL_MAX_RETRY_NUM] rate table in the 156462306a36Sopenharmony_ci * Link Quality command: 156562306a36Sopenharmony_ci * 156662306a36Sopenharmony_ci * 156762306a36Sopenharmony_ci * 1) If using High-throughput (HT) (SISO or MIMO) initial rate: 156862306a36Sopenharmony_ci * a) Use this same initial rate for first 3 entries. 156962306a36Sopenharmony_ci * b) Find next lower available rate using same mode (SISO or MIMO), 157062306a36Sopenharmony_ci * use for next 3 entries. If no lower rate available, switch to 157162306a36Sopenharmony_ci * legacy mode (no HT40 channel, no MIMO, no short guard interval). 157262306a36Sopenharmony_ci * c) If using MIMO, set command's mimo_delimiter to number of entries 157362306a36Sopenharmony_ci * using MIMO (3 or 6). 157462306a36Sopenharmony_ci * d) After trying 2 HT rates, switch to legacy mode (no HT40 channel, 157562306a36Sopenharmony_ci * no MIMO, no short guard interval), at the next lower bit rate 157662306a36Sopenharmony_ci * (e.g. if second HT bit rate was 54, try 48 legacy), and follow 157762306a36Sopenharmony_ci * legacy procedure for remaining table entries. 157862306a36Sopenharmony_ci * 157962306a36Sopenharmony_ci * 2) If using legacy initial rate: 158062306a36Sopenharmony_ci * a) Use the initial rate for only one entry. 158162306a36Sopenharmony_ci * b) For each following entry, reduce the rate to next lower available 158262306a36Sopenharmony_ci * rate, until reaching the lowest available rate. 158362306a36Sopenharmony_ci * c) When reducing rate, also switch antenna selection. 158462306a36Sopenharmony_ci * d) Once lowest available rate is reached, repeat this rate until 158562306a36Sopenharmony_ci * rate table is filled (16 entries), switching antenna each entry. 158662306a36Sopenharmony_ci * 158762306a36Sopenharmony_ci * 158862306a36Sopenharmony_ci * ACCUMULATING HISTORY 158962306a36Sopenharmony_ci * 159062306a36Sopenharmony_ci * The rate scaling algorithm for agn devices, as implemented in Linux driver, 159162306a36Sopenharmony_ci * uses two sets of frame Tx success history: One for the current/active 159262306a36Sopenharmony_ci * modulation mode, and one for a speculative/search mode that is being 159362306a36Sopenharmony_ci * attempted. If the speculative mode turns out to be more effective (i.e. 159462306a36Sopenharmony_ci * actual transfer rate is better), then the driver continues to use the 159562306a36Sopenharmony_ci * speculative mode as the new current active mode. 159662306a36Sopenharmony_ci * 159762306a36Sopenharmony_ci * Each history set contains, separately for each possible rate, data for a 159862306a36Sopenharmony_ci * sliding window of the 62 most recent tx attempts at that rate. The data 159962306a36Sopenharmony_ci * includes a shifting bitmap of success(1)/failure(0), and sums of successful 160062306a36Sopenharmony_ci * and attempted frames, from which the driver can additionally calculate a 160162306a36Sopenharmony_ci * success ratio (success / attempted) and number of failures 160262306a36Sopenharmony_ci * (attempted - success), and control the size of the window (attempted). 160362306a36Sopenharmony_ci * The driver uses the bit map to remove successes from the success sum, as 160462306a36Sopenharmony_ci * the oldest tx attempts fall out of the window. 160562306a36Sopenharmony_ci * 160662306a36Sopenharmony_ci * When the agn device makes multiple tx attempts for a given frame, each 160762306a36Sopenharmony_ci * attempt might be at a different rate, and have different modulation 160862306a36Sopenharmony_ci * characteristics (e.g. antenna, fat channel, short guard interval), as set 160962306a36Sopenharmony_ci * up in the rate scaling table in the Link Quality command. The driver must 161062306a36Sopenharmony_ci * determine which rate table entry was used for each tx attempt, to determine 161162306a36Sopenharmony_ci * which rate-specific history to update, and record only those attempts that 161262306a36Sopenharmony_ci * match the modulation characteristics of the history set. 161362306a36Sopenharmony_ci * 161462306a36Sopenharmony_ci * When using block-ack (aggregation), all frames are transmitted at the same 161562306a36Sopenharmony_ci * rate, since there is no per-attempt acknowledgment from the destination 161662306a36Sopenharmony_ci * station. The Tx response struct iwl_tx_resp indicates the Tx rate in 161762306a36Sopenharmony_ci * rate_n_flags field. After receiving a block-ack, the driver can update 161862306a36Sopenharmony_ci * history for the entire block all at once. 161962306a36Sopenharmony_ci * 162062306a36Sopenharmony_ci * 162162306a36Sopenharmony_ci * FINDING BEST STARTING RATE: 162262306a36Sopenharmony_ci * 162362306a36Sopenharmony_ci * When working with a selected initial modulation mode (see below), the 162462306a36Sopenharmony_ci * driver attempts to find a best initial rate. The initial rate is the 162562306a36Sopenharmony_ci * first entry in the Link Quality command's rate table. 162662306a36Sopenharmony_ci * 162762306a36Sopenharmony_ci * 1) Calculate actual throughput (success ratio * expected throughput, see 162862306a36Sopenharmony_ci * table below) for current initial rate. Do this only if enough frames 162962306a36Sopenharmony_ci * have been attempted to make the value meaningful: at least 6 failed 163062306a36Sopenharmony_ci * tx attempts, or at least 8 successes. If not enough, don't try rate 163162306a36Sopenharmony_ci * scaling yet. 163262306a36Sopenharmony_ci * 163362306a36Sopenharmony_ci * 2) Find available rates adjacent to current initial rate. Available means: 163462306a36Sopenharmony_ci * a) supported by hardware && 163562306a36Sopenharmony_ci * b) supported by association && 163662306a36Sopenharmony_ci * c) within any constraints selected by user 163762306a36Sopenharmony_ci * 163862306a36Sopenharmony_ci * 3) Gather measured throughputs for adjacent rates. These might not have 163962306a36Sopenharmony_ci * enough history to calculate a throughput. That's okay, we might try 164062306a36Sopenharmony_ci * using one of them anyway! 164162306a36Sopenharmony_ci * 164262306a36Sopenharmony_ci * 4) Try decreasing rate if, for current rate: 164362306a36Sopenharmony_ci * a) success ratio is < 15% || 164462306a36Sopenharmony_ci * b) lower adjacent rate has better measured throughput || 164562306a36Sopenharmony_ci * c) higher adjacent rate has worse throughput, and lower is unmeasured 164662306a36Sopenharmony_ci * 164762306a36Sopenharmony_ci * As a sanity check, if decrease was determined above, leave rate 164862306a36Sopenharmony_ci * unchanged if: 164962306a36Sopenharmony_ci * a) lower rate unavailable 165062306a36Sopenharmony_ci * b) success ratio at current rate > 85% (very good) 165162306a36Sopenharmony_ci * c) current measured throughput is better than expected throughput 165262306a36Sopenharmony_ci * of lower rate (under perfect 100% tx conditions, see table below) 165362306a36Sopenharmony_ci * 165462306a36Sopenharmony_ci * 5) Try increasing rate if, for current rate: 165562306a36Sopenharmony_ci * a) success ratio is < 15% || 165662306a36Sopenharmony_ci * b) both adjacent rates' throughputs are unmeasured (try it!) || 165762306a36Sopenharmony_ci * b) higher adjacent rate has better measured throughput || 165862306a36Sopenharmony_ci * c) lower adjacent rate has worse throughput, and higher is unmeasured 165962306a36Sopenharmony_ci * 166062306a36Sopenharmony_ci * As a sanity check, if increase was determined above, leave rate 166162306a36Sopenharmony_ci * unchanged if: 166262306a36Sopenharmony_ci * a) success ratio at current rate < 70%. This is not particularly 166362306a36Sopenharmony_ci * good performance; higher rate is sure to have poorer success. 166462306a36Sopenharmony_ci * 166562306a36Sopenharmony_ci * 6) Re-evaluate the rate after each tx frame. If working with block- 166662306a36Sopenharmony_ci * acknowledge, history and statistics may be calculated for the entire 166762306a36Sopenharmony_ci * block (including prior history that fits within the history windows), 166862306a36Sopenharmony_ci * before re-evaluation. 166962306a36Sopenharmony_ci * 167062306a36Sopenharmony_ci * FINDING BEST STARTING MODULATION MODE: 167162306a36Sopenharmony_ci * 167262306a36Sopenharmony_ci * After working with a modulation mode for a "while" (and doing rate scaling), 167362306a36Sopenharmony_ci * the driver searches for a new initial mode in an attempt to improve 167462306a36Sopenharmony_ci * throughput. The "while" is measured by numbers of attempted frames: 167562306a36Sopenharmony_ci * 167662306a36Sopenharmony_ci * For legacy mode, search for new mode after: 167762306a36Sopenharmony_ci * 480 successful frames, or 160 failed frames 167862306a36Sopenharmony_ci * For high-throughput modes (SISO or MIMO), search for new mode after: 167962306a36Sopenharmony_ci * 4500 successful frames, or 400 failed frames 168062306a36Sopenharmony_ci * 168162306a36Sopenharmony_ci * Mode switch possibilities are (3 for each mode): 168262306a36Sopenharmony_ci * 168362306a36Sopenharmony_ci * For legacy: 168462306a36Sopenharmony_ci * Change antenna, try SISO (if HT association), try MIMO (if HT association) 168562306a36Sopenharmony_ci * For SISO: 168662306a36Sopenharmony_ci * Change antenna, try MIMO, try shortened guard interval (SGI) 168762306a36Sopenharmony_ci * For MIMO: 168862306a36Sopenharmony_ci * Try SISO antenna A, SISO antenna B, try shortened guard interval (SGI) 168962306a36Sopenharmony_ci * 169062306a36Sopenharmony_ci * When trying a new mode, use the same bit rate as the old/current mode when 169162306a36Sopenharmony_ci * trying antenna switches and shortened guard interval. When switching to 169262306a36Sopenharmony_ci * SISO from MIMO or legacy, or to MIMO from SISO or legacy, use a rate 169362306a36Sopenharmony_ci * for which the expected throughput (under perfect conditions) is about the 169462306a36Sopenharmony_ci * same or slightly better than the actual measured throughput delivered by 169562306a36Sopenharmony_ci * the old/current mode. 169662306a36Sopenharmony_ci * 169762306a36Sopenharmony_ci * Actual throughput can be estimated by multiplying the expected throughput 169862306a36Sopenharmony_ci * by the success ratio (successful / attempted tx frames). Frame size is 169962306a36Sopenharmony_ci * not considered in this calculation; it assumes that frame size will average 170062306a36Sopenharmony_ci * out to be fairly consistent over several samples. The following are 170162306a36Sopenharmony_ci * metric values for expected throughput assuming 100% success ratio. 170262306a36Sopenharmony_ci * Only G band has support for CCK rates: 170362306a36Sopenharmony_ci * 170462306a36Sopenharmony_ci * RATE: 1 2 5 11 6 9 12 18 24 36 48 54 60 170562306a36Sopenharmony_ci * 170662306a36Sopenharmony_ci * G: 7 13 35 58 40 57 72 98 121 154 177 186 186 170762306a36Sopenharmony_ci * A: 0 0 0 0 40 57 72 98 121 154 177 186 186 170862306a36Sopenharmony_ci * SISO 20MHz: 0 0 0 0 42 42 76 102 124 159 183 193 202 170962306a36Sopenharmony_ci * SGI SISO 20MHz: 0 0 0 0 46 46 82 110 132 168 192 202 211 171062306a36Sopenharmony_ci * MIMO 20MHz: 0 0 0 0 74 74 123 155 179 214 236 244 251 171162306a36Sopenharmony_ci * SGI MIMO 20MHz: 0 0 0 0 81 81 131 164 188 222 243 251 257 171262306a36Sopenharmony_ci * SISO 40MHz: 0 0 0 0 77 77 127 160 184 220 242 250 257 171362306a36Sopenharmony_ci * SGI SISO 40MHz: 0 0 0 0 83 83 135 169 193 229 250 257 264 171462306a36Sopenharmony_ci * MIMO 40MHz: 0 0 0 0 123 123 182 214 235 264 279 285 289 171562306a36Sopenharmony_ci * SGI MIMO 40MHz: 0 0 0 0 131 131 191 222 242 270 284 289 293 171662306a36Sopenharmony_ci * 171762306a36Sopenharmony_ci * After the new mode has been tried for a short while (minimum of 6 failed 171862306a36Sopenharmony_ci * frames or 8 successful frames), compare success ratio and actual throughput 171962306a36Sopenharmony_ci * estimate of the new mode with the old. If either is better with the new 172062306a36Sopenharmony_ci * mode, continue to use the new mode. 172162306a36Sopenharmony_ci * 172262306a36Sopenharmony_ci * Continue comparing modes until all 3 possibilities have been tried. 172362306a36Sopenharmony_ci * If moving from legacy to HT, try all 3 possibilities from the new HT 172462306a36Sopenharmony_ci * mode. After trying all 3, a best mode is found. Continue to use this mode 172562306a36Sopenharmony_ci * for the longer "while" described above (e.g. 480 successful frames for 172662306a36Sopenharmony_ci * legacy), and then repeat the search process. 172762306a36Sopenharmony_ci * 172862306a36Sopenharmony_ci */ 172962306a36Sopenharmony_cistruct iwl_link_quality_cmd { 173062306a36Sopenharmony_ci 173162306a36Sopenharmony_ci /* Index of destination/recipient station in uCode's station table */ 173262306a36Sopenharmony_ci u8 sta_id; 173362306a36Sopenharmony_ci u8 reserved1; 173462306a36Sopenharmony_ci __le16 control; /* not used */ 173562306a36Sopenharmony_ci struct iwl_link_qual_general_params general_params; 173662306a36Sopenharmony_ci struct iwl_link_qual_agg_params agg_params; 173762306a36Sopenharmony_ci 173862306a36Sopenharmony_ci /* 173962306a36Sopenharmony_ci * Rate info; when using rate-scaling, Tx command's initial_rate_index 174062306a36Sopenharmony_ci * specifies 1st Tx rate attempted, via index into this table. 174162306a36Sopenharmony_ci * agn devices works its way through table when retrying Tx. 174262306a36Sopenharmony_ci */ 174362306a36Sopenharmony_ci struct { 174462306a36Sopenharmony_ci __le32 rate_n_flags; /* RATE_MCS_*, IWL_RATE_* */ 174562306a36Sopenharmony_ci } rs_table[LINK_QUAL_MAX_RETRY_NUM]; 174662306a36Sopenharmony_ci __le32 reserved2; 174762306a36Sopenharmony_ci} __packed; 174862306a36Sopenharmony_ci 174962306a36Sopenharmony_ci/* 175062306a36Sopenharmony_ci * BT configuration enable flags: 175162306a36Sopenharmony_ci * bit 0 - 1: BT channel announcement enabled 175262306a36Sopenharmony_ci * 0: disable 175362306a36Sopenharmony_ci * bit 1 - 1: priority of BT device enabled 175462306a36Sopenharmony_ci * 0: disable 175562306a36Sopenharmony_ci * bit 2 - 1: BT 2 wire support enabled 175662306a36Sopenharmony_ci * 0: disable 175762306a36Sopenharmony_ci */ 175862306a36Sopenharmony_ci#define BT_COEX_DISABLE (0x0) 175962306a36Sopenharmony_ci#define BT_ENABLE_CHANNEL_ANNOUNCE BIT(0) 176062306a36Sopenharmony_ci#define BT_ENABLE_PRIORITY BIT(1) 176162306a36Sopenharmony_ci#define BT_ENABLE_2_WIRE BIT(2) 176262306a36Sopenharmony_ci 176362306a36Sopenharmony_ci#define BT_COEX_DISABLE (0x0) 176462306a36Sopenharmony_ci#define BT_COEX_ENABLE (BT_ENABLE_CHANNEL_ANNOUNCE | BT_ENABLE_PRIORITY) 176562306a36Sopenharmony_ci 176662306a36Sopenharmony_ci#define BT_LEAD_TIME_MIN (0x0) 176762306a36Sopenharmony_ci#define BT_LEAD_TIME_DEF (0x1E) 176862306a36Sopenharmony_ci#define BT_LEAD_TIME_MAX (0xFF) 176962306a36Sopenharmony_ci 177062306a36Sopenharmony_ci#define BT_MAX_KILL_MIN (0x1) 177162306a36Sopenharmony_ci#define BT_MAX_KILL_DEF (0x5) 177262306a36Sopenharmony_ci#define BT_MAX_KILL_MAX (0xFF) 177362306a36Sopenharmony_ci 177462306a36Sopenharmony_ci#define BT_DURATION_LIMIT_DEF 625 177562306a36Sopenharmony_ci#define BT_DURATION_LIMIT_MAX 1250 177662306a36Sopenharmony_ci#define BT_DURATION_LIMIT_MIN 625 177762306a36Sopenharmony_ci 177862306a36Sopenharmony_ci#define BT_ON_THRESHOLD_DEF 4 177962306a36Sopenharmony_ci#define BT_ON_THRESHOLD_MAX 1000 178062306a36Sopenharmony_ci#define BT_ON_THRESHOLD_MIN 1 178162306a36Sopenharmony_ci 178262306a36Sopenharmony_ci#define BT_FRAG_THRESHOLD_DEF 0 178362306a36Sopenharmony_ci#define BT_FRAG_THRESHOLD_MAX 0 178462306a36Sopenharmony_ci#define BT_FRAG_THRESHOLD_MIN 0 178562306a36Sopenharmony_ci 178662306a36Sopenharmony_ci#define BT_AGG_THRESHOLD_DEF 1200 178762306a36Sopenharmony_ci#define BT_AGG_THRESHOLD_MAX 8000 178862306a36Sopenharmony_ci#define BT_AGG_THRESHOLD_MIN 400 178962306a36Sopenharmony_ci 179062306a36Sopenharmony_ci/* 179162306a36Sopenharmony_ci * REPLY_BT_CONFIG = 0x9b (command, has simple generic response) 179262306a36Sopenharmony_ci * 179362306a36Sopenharmony_ci * agn devices support hardware handshake with Bluetooth device on 179462306a36Sopenharmony_ci * same platform. Bluetooth device alerts wireless device when it will Tx; 179562306a36Sopenharmony_ci * wireless device can delay or kill its own Tx to accommodate. 179662306a36Sopenharmony_ci */ 179762306a36Sopenharmony_cistruct iwl_bt_cmd { 179862306a36Sopenharmony_ci u8 flags; 179962306a36Sopenharmony_ci u8 lead_time; 180062306a36Sopenharmony_ci u8 max_kill; 180162306a36Sopenharmony_ci u8 reserved; 180262306a36Sopenharmony_ci __le32 kill_ack_mask; 180362306a36Sopenharmony_ci __le32 kill_cts_mask; 180462306a36Sopenharmony_ci} __packed; 180562306a36Sopenharmony_ci 180662306a36Sopenharmony_ci#define IWLAGN_BT_FLAG_CHANNEL_INHIBITION BIT(0) 180762306a36Sopenharmony_ci 180862306a36Sopenharmony_ci#define IWLAGN_BT_FLAG_COEX_MODE_MASK (BIT(3)|BIT(4)|BIT(5)) 180962306a36Sopenharmony_ci#define IWLAGN_BT_FLAG_COEX_MODE_SHIFT 3 181062306a36Sopenharmony_ci#define IWLAGN_BT_FLAG_COEX_MODE_DISABLED 0 181162306a36Sopenharmony_ci#define IWLAGN_BT_FLAG_COEX_MODE_LEGACY_2W 1 181262306a36Sopenharmony_ci#define IWLAGN_BT_FLAG_COEX_MODE_3W 2 181362306a36Sopenharmony_ci#define IWLAGN_BT_FLAG_COEX_MODE_4W 3 181462306a36Sopenharmony_ci 181562306a36Sopenharmony_ci#define IWLAGN_BT_FLAG_UCODE_DEFAULT BIT(6) 181662306a36Sopenharmony_ci/* Disable Sync PSPoll on SCO/eSCO */ 181762306a36Sopenharmony_ci#define IWLAGN_BT_FLAG_SYNC_2_BT_DISABLE BIT(7) 181862306a36Sopenharmony_ci 181962306a36Sopenharmony_ci#define IWLAGN_BT_PSP_MIN_RSSI_THRESHOLD -75 /* dBm */ 182062306a36Sopenharmony_ci#define IWLAGN_BT_PSP_MAX_RSSI_THRESHOLD -65 /* dBm */ 182162306a36Sopenharmony_ci 182262306a36Sopenharmony_ci#define IWLAGN_BT_PRIO_BOOST_MAX 0xFF 182362306a36Sopenharmony_ci#define IWLAGN_BT_PRIO_BOOST_MIN 0x00 182462306a36Sopenharmony_ci#define IWLAGN_BT_PRIO_BOOST_DEFAULT 0xF0 182562306a36Sopenharmony_ci#define IWLAGN_BT_PRIO_BOOST_DEFAULT32 0xF0F0F0F0 182662306a36Sopenharmony_ci 182762306a36Sopenharmony_ci#define IWLAGN_BT_MAX_KILL_DEFAULT 5 182862306a36Sopenharmony_ci 182962306a36Sopenharmony_ci#define IWLAGN_BT3_T7_DEFAULT 1 183062306a36Sopenharmony_ci 183162306a36Sopenharmony_cienum iwl_bt_kill_idx { 183262306a36Sopenharmony_ci IWL_BT_KILL_DEFAULT = 0, 183362306a36Sopenharmony_ci IWL_BT_KILL_OVERRIDE = 1, 183462306a36Sopenharmony_ci IWL_BT_KILL_REDUCE = 2, 183562306a36Sopenharmony_ci}; 183662306a36Sopenharmony_ci 183762306a36Sopenharmony_ci#define IWLAGN_BT_KILL_ACK_MASK_DEFAULT cpu_to_le32(0xffff0000) 183862306a36Sopenharmony_ci#define IWLAGN_BT_KILL_CTS_MASK_DEFAULT cpu_to_le32(0xffff0000) 183962306a36Sopenharmony_ci#define IWLAGN_BT_KILL_ACK_CTS_MASK_SCO cpu_to_le32(0xffffffff) 184062306a36Sopenharmony_ci#define IWLAGN_BT_KILL_ACK_CTS_MASK_REDUCE cpu_to_le32(0) 184162306a36Sopenharmony_ci 184262306a36Sopenharmony_ci#define IWLAGN_BT3_PRIO_SAMPLE_DEFAULT 2 184362306a36Sopenharmony_ci 184462306a36Sopenharmony_ci#define IWLAGN_BT3_T2_DEFAULT 0xc 184562306a36Sopenharmony_ci 184662306a36Sopenharmony_ci#define IWLAGN_BT_VALID_ENABLE_FLAGS cpu_to_le16(BIT(0)) 184762306a36Sopenharmony_ci#define IWLAGN_BT_VALID_BOOST cpu_to_le16(BIT(1)) 184862306a36Sopenharmony_ci#define IWLAGN_BT_VALID_MAX_KILL cpu_to_le16(BIT(2)) 184962306a36Sopenharmony_ci#define IWLAGN_BT_VALID_3W_TIMERS cpu_to_le16(BIT(3)) 185062306a36Sopenharmony_ci#define IWLAGN_BT_VALID_KILL_ACK_MASK cpu_to_le16(BIT(4)) 185162306a36Sopenharmony_ci#define IWLAGN_BT_VALID_KILL_CTS_MASK cpu_to_le16(BIT(5)) 185262306a36Sopenharmony_ci#define IWLAGN_BT_VALID_REDUCED_TX_PWR cpu_to_le16(BIT(6)) 185362306a36Sopenharmony_ci#define IWLAGN_BT_VALID_3W_LUT cpu_to_le16(BIT(7)) 185462306a36Sopenharmony_ci 185562306a36Sopenharmony_ci#define IWLAGN_BT_ALL_VALID_MSK (IWLAGN_BT_VALID_ENABLE_FLAGS | \ 185662306a36Sopenharmony_ci IWLAGN_BT_VALID_BOOST | \ 185762306a36Sopenharmony_ci IWLAGN_BT_VALID_MAX_KILL | \ 185862306a36Sopenharmony_ci IWLAGN_BT_VALID_3W_TIMERS | \ 185962306a36Sopenharmony_ci IWLAGN_BT_VALID_KILL_ACK_MASK | \ 186062306a36Sopenharmony_ci IWLAGN_BT_VALID_KILL_CTS_MASK | \ 186162306a36Sopenharmony_ci IWLAGN_BT_VALID_REDUCED_TX_PWR | \ 186262306a36Sopenharmony_ci IWLAGN_BT_VALID_3W_LUT) 186362306a36Sopenharmony_ci 186462306a36Sopenharmony_ci#define IWLAGN_BT_REDUCED_TX_PWR BIT(0) 186562306a36Sopenharmony_ci 186662306a36Sopenharmony_ci#define IWLAGN_BT_DECISION_LUT_SIZE 12 186762306a36Sopenharmony_ci 186862306a36Sopenharmony_cistruct iwl_basic_bt_cmd { 186962306a36Sopenharmony_ci u8 flags; 187062306a36Sopenharmony_ci u8 ledtime; /* unused */ 187162306a36Sopenharmony_ci u8 max_kill; 187262306a36Sopenharmony_ci u8 bt3_timer_t7_value; 187362306a36Sopenharmony_ci __le32 kill_ack_mask; 187462306a36Sopenharmony_ci __le32 kill_cts_mask; 187562306a36Sopenharmony_ci u8 bt3_prio_sample_time; 187662306a36Sopenharmony_ci u8 bt3_timer_t2_value; 187762306a36Sopenharmony_ci __le16 bt4_reaction_time; /* unused */ 187862306a36Sopenharmony_ci __le32 bt3_lookup_table[IWLAGN_BT_DECISION_LUT_SIZE]; 187962306a36Sopenharmony_ci /* 188062306a36Sopenharmony_ci * bit 0: use reduced tx power for control frame 188162306a36Sopenharmony_ci * bit 1 - 7: reserved 188262306a36Sopenharmony_ci */ 188362306a36Sopenharmony_ci u8 reduce_txpower; 188462306a36Sopenharmony_ci u8 reserved; 188562306a36Sopenharmony_ci __le16 valid; 188662306a36Sopenharmony_ci}; 188762306a36Sopenharmony_ci 188862306a36Sopenharmony_cistruct iwl_bt_cmd_v1 { 188962306a36Sopenharmony_ci struct iwl_basic_bt_cmd basic; 189062306a36Sopenharmony_ci u8 prio_boost; 189162306a36Sopenharmony_ci /* 189262306a36Sopenharmony_ci * set IWLAGN_BT_VALID_BOOST to "1" in "valid" bitmask 189362306a36Sopenharmony_ci * if configure the following patterns 189462306a36Sopenharmony_ci */ 189562306a36Sopenharmony_ci u8 tx_prio_boost; /* SW boost of WiFi tx priority */ 189662306a36Sopenharmony_ci __le16 rx_prio_boost; /* SW boost of WiFi rx priority */ 189762306a36Sopenharmony_ci}; 189862306a36Sopenharmony_ci 189962306a36Sopenharmony_cistruct iwl_bt_cmd_v2 { 190062306a36Sopenharmony_ci struct iwl_basic_bt_cmd basic; 190162306a36Sopenharmony_ci __le32 prio_boost; 190262306a36Sopenharmony_ci /* 190362306a36Sopenharmony_ci * set IWLAGN_BT_VALID_BOOST to "1" in "valid" bitmask 190462306a36Sopenharmony_ci * if configure the following patterns 190562306a36Sopenharmony_ci */ 190662306a36Sopenharmony_ci u8 reserved; 190762306a36Sopenharmony_ci u8 tx_prio_boost; /* SW boost of WiFi tx priority */ 190862306a36Sopenharmony_ci __le16 rx_prio_boost; /* SW boost of WiFi rx priority */ 190962306a36Sopenharmony_ci}; 191062306a36Sopenharmony_ci 191162306a36Sopenharmony_ci#define IWLAGN_BT_SCO_ACTIVE cpu_to_le32(BIT(0)) 191262306a36Sopenharmony_ci 191362306a36Sopenharmony_cistruct iwlagn_bt_sco_cmd { 191462306a36Sopenharmony_ci __le32 flags; 191562306a36Sopenharmony_ci}; 191662306a36Sopenharmony_ci 191762306a36Sopenharmony_ci/****************************************************************************** 191862306a36Sopenharmony_ci * (6) 191962306a36Sopenharmony_ci * Spectrum Management (802.11h) Commands, Responses, Notifications: 192062306a36Sopenharmony_ci * 192162306a36Sopenharmony_ci *****************************************************************************/ 192262306a36Sopenharmony_ci 192362306a36Sopenharmony_ci/* 192462306a36Sopenharmony_ci * Spectrum Management 192562306a36Sopenharmony_ci */ 192662306a36Sopenharmony_ci#define MEASUREMENT_FILTER_FLAG (RXON_FILTER_PROMISC_MSK | \ 192762306a36Sopenharmony_ci RXON_FILTER_CTL2HOST_MSK | \ 192862306a36Sopenharmony_ci RXON_FILTER_ACCEPT_GRP_MSK | \ 192962306a36Sopenharmony_ci RXON_FILTER_DIS_DECRYPT_MSK | \ 193062306a36Sopenharmony_ci RXON_FILTER_DIS_GRP_DECRYPT_MSK | \ 193162306a36Sopenharmony_ci RXON_FILTER_ASSOC_MSK | \ 193262306a36Sopenharmony_ci RXON_FILTER_BCON_AWARE_MSK) 193362306a36Sopenharmony_ci 193462306a36Sopenharmony_cistruct iwl_measure_channel { 193562306a36Sopenharmony_ci __le32 duration; /* measurement duration in extended beacon 193662306a36Sopenharmony_ci * format */ 193762306a36Sopenharmony_ci u8 channel; /* channel to measure */ 193862306a36Sopenharmony_ci u8 type; /* see enum iwl_measure_type */ 193962306a36Sopenharmony_ci __le16 reserved; 194062306a36Sopenharmony_ci} __packed; 194162306a36Sopenharmony_ci 194262306a36Sopenharmony_ci/* 194362306a36Sopenharmony_ci * REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74 (command) 194462306a36Sopenharmony_ci */ 194562306a36Sopenharmony_cistruct iwl_spectrum_cmd { 194662306a36Sopenharmony_ci __le16 len; /* number of bytes starting from token */ 194762306a36Sopenharmony_ci u8 token; /* token id */ 194862306a36Sopenharmony_ci u8 id; /* measurement id -- 0 or 1 */ 194962306a36Sopenharmony_ci u8 origin; /* 0 = TGh, 1 = other, 2 = TGk */ 195062306a36Sopenharmony_ci u8 periodic; /* 1 = periodic */ 195162306a36Sopenharmony_ci __le16 path_loss_timeout; 195262306a36Sopenharmony_ci __le32 start_time; /* start time in extended beacon format */ 195362306a36Sopenharmony_ci __le32 reserved2; 195462306a36Sopenharmony_ci __le32 flags; /* rxon flags */ 195562306a36Sopenharmony_ci __le32 filter_flags; /* rxon filter flags */ 195662306a36Sopenharmony_ci __le16 channel_count; /* minimum 1, maximum 10 */ 195762306a36Sopenharmony_ci __le16 reserved3; 195862306a36Sopenharmony_ci struct iwl_measure_channel channels[10]; 195962306a36Sopenharmony_ci} __packed; 196062306a36Sopenharmony_ci 196162306a36Sopenharmony_ci/* 196262306a36Sopenharmony_ci * REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74 (response) 196362306a36Sopenharmony_ci */ 196462306a36Sopenharmony_cistruct iwl_spectrum_resp { 196562306a36Sopenharmony_ci u8 token; 196662306a36Sopenharmony_ci u8 id; /* id of the prior command replaced, or 0xff */ 196762306a36Sopenharmony_ci __le16 status; /* 0 - command will be handled 196862306a36Sopenharmony_ci * 1 - cannot handle (conflicts with another 196962306a36Sopenharmony_ci * measurement) */ 197062306a36Sopenharmony_ci} __packed; 197162306a36Sopenharmony_ci 197262306a36Sopenharmony_cienum iwl_measurement_state { 197362306a36Sopenharmony_ci IWL_MEASUREMENT_START = 0, 197462306a36Sopenharmony_ci IWL_MEASUREMENT_STOP = 1, 197562306a36Sopenharmony_ci}; 197662306a36Sopenharmony_ci 197762306a36Sopenharmony_cienum iwl_measurement_status { 197862306a36Sopenharmony_ci IWL_MEASUREMENT_OK = 0, 197962306a36Sopenharmony_ci IWL_MEASUREMENT_CONCURRENT = 1, 198062306a36Sopenharmony_ci IWL_MEASUREMENT_CSA_CONFLICT = 2, 198162306a36Sopenharmony_ci IWL_MEASUREMENT_TGH_CONFLICT = 3, 198262306a36Sopenharmony_ci /* 4-5 reserved */ 198362306a36Sopenharmony_ci IWL_MEASUREMENT_STOPPED = 6, 198462306a36Sopenharmony_ci IWL_MEASUREMENT_TIMEOUT = 7, 198562306a36Sopenharmony_ci IWL_MEASUREMENT_PERIODIC_FAILED = 8, 198662306a36Sopenharmony_ci}; 198762306a36Sopenharmony_ci 198862306a36Sopenharmony_ci#define NUM_ELEMENTS_IN_HISTOGRAM 8 198962306a36Sopenharmony_ci 199062306a36Sopenharmony_cistruct iwl_measurement_histogram { 199162306a36Sopenharmony_ci __le32 ofdm[NUM_ELEMENTS_IN_HISTOGRAM]; /* in 0.8usec counts */ 199262306a36Sopenharmony_ci __le32 cck[NUM_ELEMENTS_IN_HISTOGRAM]; /* in 1usec counts */ 199362306a36Sopenharmony_ci} __packed; 199462306a36Sopenharmony_ci 199562306a36Sopenharmony_ci/* clear channel availability counters */ 199662306a36Sopenharmony_cistruct iwl_measurement_cca_counters { 199762306a36Sopenharmony_ci __le32 ofdm; 199862306a36Sopenharmony_ci __le32 cck; 199962306a36Sopenharmony_ci} __packed; 200062306a36Sopenharmony_ci 200162306a36Sopenharmony_cienum iwl_measure_type { 200262306a36Sopenharmony_ci IWL_MEASURE_BASIC = (1 << 0), 200362306a36Sopenharmony_ci IWL_MEASURE_CHANNEL_LOAD = (1 << 1), 200462306a36Sopenharmony_ci IWL_MEASURE_HISTOGRAM_RPI = (1 << 2), 200562306a36Sopenharmony_ci IWL_MEASURE_HISTOGRAM_NOISE = (1 << 3), 200662306a36Sopenharmony_ci IWL_MEASURE_FRAME = (1 << 4), 200762306a36Sopenharmony_ci /* bits 5:6 are reserved */ 200862306a36Sopenharmony_ci IWL_MEASURE_IDLE = (1 << 7), 200962306a36Sopenharmony_ci}; 201062306a36Sopenharmony_ci 201162306a36Sopenharmony_ci/* 201262306a36Sopenharmony_ci * SPECTRUM_MEASURE_NOTIFICATION = 0x75 (notification only, not a command) 201362306a36Sopenharmony_ci */ 201462306a36Sopenharmony_cistruct iwl_spectrum_notification { 201562306a36Sopenharmony_ci u8 id; /* measurement id -- 0 or 1 */ 201662306a36Sopenharmony_ci u8 token; 201762306a36Sopenharmony_ci u8 channel_index; /* index in measurement channel list */ 201862306a36Sopenharmony_ci u8 state; /* 0 - start, 1 - stop */ 201962306a36Sopenharmony_ci __le32 start_time; /* lower 32-bits of TSF */ 202062306a36Sopenharmony_ci u8 band; /* 0 - 5.2GHz, 1 - 2.4GHz */ 202162306a36Sopenharmony_ci u8 channel; 202262306a36Sopenharmony_ci u8 type; /* see enum iwl_measurement_type */ 202362306a36Sopenharmony_ci u8 reserved1; 202462306a36Sopenharmony_ci /* NOTE: cca_ofdm, cca_cck, basic_type, and histogram are only only 202562306a36Sopenharmony_ci * valid if applicable for measurement type requested. */ 202662306a36Sopenharmony_ci __le32 cca_ofdm; /* cca fraction time in 40Mhz clock periods */ 202762306a36Sopenharmony_ci __le32 cca_cck; /* cca fraction time in 44Mhz clock periods */ 202862306a36Sopenharmony_ci __le32 cca_time; /* channel load time in usecs */ 202962306a36Sopenharmony_ci u8 basic_type; /* 0 - bss, 1 - ofdm preamble, 2 - 203062306a36Sopenharmony_ci * unidentified */ 203162306a36Sopenharmony_ci u8 reserved2[3]; 203262306a36Sopenharmony_ci struct iwl_measurement_histogram histogram; 203362306a36Sopenharmony_ci __le32 stop_time; /* lower 32-bits of TSF */ 203462306a36Sopenharmony_ci __le32 status; /* see iwl_measurement_status */ 203562306a36Sopenharmony_ci} __packed; 203662306a36Sopenharmony_ci 203762306a36Sopenharmony_ci/****************************************************************************** 203862306a36Sopenharmony_ci * (7) 203962306a36Sopenharmony_ci * Power Management Commands, Responses, Notifications: 204062306a36Sopenharmony_ci * 204162306a36Sopenharmony_ci *****************************************************************************/ 204262306a36Sopenharmony_ci 204362306a36Sopenharmony_ci/** 204462306a36Sopenharmony_ci * struct iwl_powertable_cmd - Power Table Command 204562306a36Sopenharmony_ci * @flags: See below: 204662306a36Sopenharmony_ci * 204762306a36Sopenharmony_ci * POWER_TABLE_CMD = 0x77 (command, has simple generic response) 204862306a36Sopenharmony_ci * 204962306a36Sopenharmony_ci * PM allow: 205062306a36Sopenharmony_ci * bit 0 - '0' Driver not allow power management 205162306a36Sopenharmony_ci * '1' Driver allow PM (use rest of parameters) 205262306a36Sopenharmony_ci * 205362306a36Sopenharmony_ci * uCode send sleep notifications: 205462306a36Sopenharmony_ci * bit 1 - '0' Don't send sleep notification 205562306a36Sopenharmony_ci * '1' send sleep notification (SEND_PM_NOTIFICATION) 205662306a36Sopenharmony_ci * 205762306a36Sopenharmony_ci * Sleep over DTIM 205862306a36Sopenharmony_ci * bit 2 - '0' PM have to walk up every DTIM 205962306a36Sopenharmony_ci * '1' PM could sleep over DTIM till listen Interval. 206062306a36Sopenharmony_ci * 206162306a36Sopenharmony_ci * PCI power managed 206262306a36Sopenharmony_ci * bit 3 - '0' (PCI_CFG_LINK_CTRL & 0x1) 206362306a36Sopenharmony_ci * '1' !(PCI_CFG_LINK_CTRL & 0x1) 206462306a36Sopenharmony_ci * 206562306a36Sopenharmony_ci * Fast PD 206662306a36Sopenharmony_ci * bit 4 - '1' Put radio to sleep when receiving frame for others 206762306a36Sopenharmony_ci * 206862306a36Sopenharmony_ci * Force sleep Modes 206962306a36Sopenharmony_ci * bit 31/30- '00' use both mac/xtal sleeps 207062306a36Sopenharmony_ci * '01' force Mac sleep 207162306a36Sopenharmony_ci * '10' force xtal sleep 207262306a36Sopenharmony_ci * '11' Illegal set 207362306a36Sopenharmony_ci * 207462306a36Sopenharmony_ci * NOTE: if sleep_interval[SLEEP_INTRVL_TABLE_SIZE-1] > DTIM period then 207562306a36Sopenharmony_ci * ucode assume sleep over DTIM is allowed and we don't need to wake up 207662306a36Sopenharmony_ci * for every DTIM. 207762306a36Sopenharmony_ci */ 207862306a36Sopenharmony_ci#define IWL_POWER_VEC_SIZE 5 207962306a36Sopenharmony_ci 208062306a36Sopenharmony_ci#define IWL_POWER_DRIVER_ALLOW_SLEEP_MSK cpu_to_le16(BIT(0)) 208162306a36Sopenharmony_ci#define IWL_POWER_POWER_SAVE_ENA_MSK cpu_to_le16(BIT(0)) 208262306a36Sopenharmony_ci#define IWL_POWER_POWER_MANAGEMENT_ENA_MSK cpu_to_le16(BIT(1)) 208362306a36Sopenharmony_ci#define IWL_POWER_SLEEP_OVER_DTIM_MSK cpu_to_le16(BIT(2)) 208462306a36Sopenharmony_ci#define IWL_POWER_PCI_PM_MSK cpu_to_le16(BIT(3)) 208562306a36Sopenharmony_ci#define IWL_POWER_FAST_PD cpu_to_le16(BIT(4)) 208662306a36Sopenharmony_ci#define IWL_POWER_BEACON_FILTERING cpu_to_le16(BIT(5)) 208762306a36Sopenharmony_ci#define IWL_POWER_SHADOW_REG_ENA cpu_to_le16(BIT(6)) 208862306a36Sopenharmony_ci#define IWL_POWER_CT_KILL_SET cpu_to_le16(BIT(7)) 208962306a36Sopenharmony_ci#define IWL_POWER_BT_SCO_ENA cpu_to_le16(BIT(8)) 209062306a36Sopenharmony_ci#define IWL_POWER_ADVANCE_PM_ENA_MSK cpu_to_le16(BIT(9)) 209162306a36Sopenharmony_ci 209262306a36Sopenharmony_cistruct iwl_powertable_cmd { 209362306a36Sopenharmony_ci __le16 flags; 209462306a36Sopenharmony_ci u8 keep_alive_seconds; 209562306a36Sopenharmony_ci u8 debug_flags; 209662306a36Sopenharmony_ci __le32 rx_data_timeout; 209762306a36Sopenharmony_ci __le32 tx_data_timeout; 209862306a36Sopenharmony_ci __le32 sleep_interval[IWL_POWER_VEC_SIZE]; 209962306a36Sopenharmony_ci __le32 keep_alive_beacons; 210062306a36Sopenharmony_ci} __packed; 210162306a36Sopenharmony_ci 210262306a36Sopenharmony_ci/* 210362306a36Sopenharmony_ci * PM_SLEEP_NOTIFICATION = 0x7A (notification only, not a command) 210462306a36Sopenharmony_ci * all devices identical. 210562306a36Sopenharmony_ci */ 210662306a36Sopenharmony_cistruct iwl_sleep_notification { 210762306a36Sopenharmony_ci u8 pm_sleep_mode; 210862306a36Sopenharmony_ci u8 pm_wakeup_src; 210962306a36Sopenharmony_ci __le16 reserved; 211062306a36Sopenharmony_ci __le32 sleep_time; 211162306a36Sopenharmony_ci __le32 tsf_low; 211262306a36Sopenharmony_ci __le32 bcon_timer; 211362306a36Sopenharmony_ci} __packed; 211462306a36Sopenharmony_ci 211562306a36Sopenharmony_ci/* Sleep states. all devices identical. */ 211662306a36Sopenharmony_cienum { 211762306a36Sopenharmony_ci IWL_PM_NO_SLEEP = 0, 211862306a36Sopenharmony_ci IWL_PM_SLP_MAC = 1, 211962306a36Sopenharmony_ci IWL_PM_SLP_FULL_MAC_UNASSOCIATE = 2, 212062306a36Sopenharmony_ci IWL_PM_SLP_FULL_MAC_CARD_STATE = 3, 212162306a36Sopenharmony_ci IWL_PM_SLP_PHY = 4, 212262306a36Sopenharmony_ci IWL_PM_SLP_REPENT = 5, 212362306a36Sopenharmony_ci IWL_PM_WAKEUP_BY_TIMER = 6, 212462306a36Sopenharmony_ci IWL_PM_WAKEUP_BY_DRIVER = 7, 212562306a36Sopenharmony_ci IWL_PM_WAKEUP_BY_RFKILL = 8, 212662306a36Sopenharmony_ci /* 3 reserved */ 212762306a36Sopenharmony_ci IWL_PM_NUM_OF_MODES = 12, 212862306a36Sopenharmony_ci}; 212962306a36Sopenharmony_ci 213062306a36Sopenharmony_ci/* 213162306a36Sopenharmony_ci * REPLY_CARD_STATE_CMD = 0xa0 (command, has simple generic response) 213262306a36Sopenharmony_ci */ 213362306a36Sopenharmony_ci#define CARD_STATE_CMD_DISABLE 0x00 /* Put card to sleep */ 213462306a36Sopenharmony_ci#define CARD_STATE_CMD_ENABLE 0x01 /* Wake up card */ 213562306a36Sopenharmony_ci#define CARD_STATE_CMD_HALT 0x02 /* Power down permanently */ 213662306a36Sopenharmony_cistruct iwl_card_state_cmd { 213762306a36Sopenharmony_ci __le32 status; /* CARD_STATE_CMD_* request new power state */ 213862306a36Sopenharmony_ci} __packed; 213962306a36Sopenharmony_ci 214062306a36Sopenharmony_ci/* 214162306a36Sopenharmony_ci * CARD_STATE_NOTIFICATION = 0xa1 (notification only, not a command) 214262306a36Sopenharmony_ci */ 214362306a36Sopenharmony_cistruct iwl_card_state_notif { 214462306a36Sopenharmony_ci __le32 flags; 214562306a36Sopenharmony_ci} __packed; 214662306a36Sopenharmony_ci 214762306a36Sopenharmony_ci#define HW_CARD_DISABLED 0x01 214862306a36Sopenharmony_ci#define SW_CARD_DISABLED 0x02 214962306a36Sopenharmony_ci#define CT_CARD_DISABLED 0x04 215062306a36Sopenharmony_ci#define RXON_CARD_DISABLED 0x10 215162306a36Sopenharmony_ci 215262306a36Sopenharmony_cistruct iwl_ct_kill_config { 215362306a36Sopenharmony_ci __le32 reserved; 215462306a36Sopenharmony_ci __le32 critical_temperature_M; 215562306a36Sopenharmony_ci __le32 critical_temperature_R; 215662306a36Sopenharmony_ci} __packed; 215762306a36Sopenharmony_ci 215862306a36Sopenharmony_ci/* 1000, and 6x00 */ 215962306a36Sopenharmony_cistruct iwl_ct_kill_throttling_config { 216062306a36Sopenharmony_ci __le32 critical_temperature_exit; 216162306a36Sopenharmony_ci __le32 reserved; 216262306a36Sopenharmony_ci __le32 critical_temperature_enter; 216362306a36Sopenharmony_ci} __packed; 216462306a36Sopenharmony_ci 216562306a36Sopenharmony_ci/****************************************************************************** 216662306a36Sopenharmony_ci * (8) 216762306a36Sopenharmony_ci * Scan Commands, Responses, Notifications: 216862306a36Sopenharmony_ci * 216962306a36Sopenharmony_ci *****************************************************************************/ 217062306a36Sopenharmony_ci 217162306a36Sopenharmony_ci#define SCAN_CHANNEL_TYPE_PASSIVE cpu_to_le32(0) 217262306a36Sopenharmony_ci#define SCAN_CHANNEL_TYPE_ACTIVE cpu_to_le32(1) 217362306a36Sopenharmony_ci 217462306a36Sopenharmony_ci/** 217562306a36Sopenharmony_ci * struct iwl_scan_channel - entry in REPLY_SCAN_CMD channel table 217662306a36Sopenharmony_ci * 217762306a36Sopenharmony_ci * One for each channel in the scan list. 217862306a36Sopenharmony_ci * Each channel can independently select: 217962306a36Sopenharmony_ci * 1) SSID for directed active scans 218062306a36Sopenharmony_ci * 2) Txpower setting (for rate specified within Tx command) 218162306a36Sopenharmony_ci * 3) How long to stay on-channel (behavior may be modified by quiet_time, 218262306a36Sopenharmony_ci * quiet_plcp_th, good_CRC_th) 218362306a36Sopenharmony_ci * 218462306a36Sopenharmony_ci * To avoid uCode errors, make sure the following are true (see comments 218562306a36Sopenharmony_ci * under struct iwl_scan_cmd about max_out_time and quiet_time): 218662306a36Sopenharmony_ci * 1) If using passive_dwell (i.e. passive_dwell != 0): 218762306a36Sopenharmony_ci * active_dwell <= passive_dwell (< max_out_time if max_out_time != 0) 218862306a36Sopenharmony_ci * 2) quiet_time <= active_dwell 218962306a36Sopenharmony_ci * 3) If restricting off-channel time (i.e. max_out_time !=0): 219062306a36Sopenharmony_ci * passive_dwell < max_out_time 219162306a36Sopenharmony_ci * active_dwell < max_out_time 219262306a36Sopenharmony_ci */ 219362306a36Sopenharmony_ci 219462306a36Sopenharmony_cistruct iwl_scan_channel { 219562306a36Sopenharmony_ci /* 219662306a36Sopenharmony_ci * type is defined as: 219762306a36Sopenharmony_ci * 0:0 1 = active, 0 = passive 219862306a36Sopenharmony_ci * 1:20 SSID direct bit map; if a bit is set, then corresponding 219962306a36Sopenharmony_ci * SSID IE is transmitted in probe request. 220062306a36Sopenharmony_ci * 21:31 reserved 220162306a36Sopenharmony_ci */ 220262306a36Sopenharmony_ci __le32 type; 220362306a36Sopenharmony_ci __le16 channel; /* band is selected by iwl_scan_cmd "flags" field */ 220462306a36Sopenharmony_ci u8 tx_gain; /* gain for analog radio */ 220562306a36Sopenharmony_ci u8 dsp_atten; /* gain for DSP */ 220662306a36Sopenharmony_ci __le16 active_dwell; /* in 1024-uSec TU (time units), typ 5-50 */ 220762306a36Sopenharmony_ci __le16 passive_dwell; /* in 1024-uSec TU (time units), typ 20-500 */ 220862306a36Sopenharmony_ci} __packed; 220962306a36Sopenharmony_ci 221062306a36Sopenharmony_ci/* set number of direct probes __le32 type */ 221162306a36Sopenharmony_ci#define IWL_SCAN_PROBE_MASK(n) cpu_to_le32((BIT(n) | (BIT(n) - BIT(1)))) 221262306a36Sopenharmony_ci 221362306a36Sopenharmony_ci/** 221462306a36Sopenharmony_ci * struct iwl_ssid_ie - directed scan network information element 221562306a36Sopenharmony_ci * 221662306a36Sopenharmony_ci * Up to 20 of these may appear in REPLY_SCAN_CMD, 221762306a36Sopenharmony_ci * selected by "type" bit field in struct iwl_scan_channel; 221862306a36Sopenharmony_ci * each channel may select different ssids from among the 20 entries. 221962306a36Sopenharmony_ci * SSID IEs get transmitted in reverse order of entry. 222062306a36Sopenharmony_ci */ 222162306a36Sopenharmony_cistruct iwl_ssid_ie { 222262306a36Sopenharmony_ci u8 id; 222362306a36Sopenharmony_ci u8 len; 222462306a36Sopenharmony_ci u8 ssid[32]; 222562306a36Sopenharmony_ci} __packed; 222662306a36Sopenharmony_ci 222762306a36Sopenharmony_ci#define PROBE_OPTION_MAX 20 222862306a36Sopenharmony_ci#define TX_CMD_LIFE_TIME_INFINITE cpu_to_le32(0xFFFFFFFF) 222962306a36Sopenharmony_ci#define IWL_GOOD_CRC_TH_DISABLED 0 223062306a36Sopenharmony_ci#define IWL_GOOD_CRC_TH_DEFAULT cpu_to_le16(1) 223162306a36Sopenharmony_ci#define IWL_GOOD_CRC_TH_NEVER cpu_to_le16(0xffff) 223262306a36Sopenharmony_ci#define IWL_MAX_CMD_SIZE 4096 223362306a36Sopenharmony_ci 223462306a36Sopenharmony_ci/* 223562306a36Sopenharmony_ci * REPLY_SCAN_CMD = 0x80 (command) 223662306a36Sopenharmony_ci * 223762306a36Sopenharmony_ci * The hardware scan command is very powerful; the driver can set it up to 223862306a36Sopenharmony_ci * maintain (relatively) normal network traffic while doing a scan in the 223962306a36Sopenharmony_ci * background. The max_out_time and suspend_time control the ratio of how 224062306a36Sopenharmony_ci * long the device stays on an associated network channel ("service channel") 224162306a36Sopenharmony_ci * vs. how long it's away from the service channel, i.e. tuned to other channels 224262306a36Sopenharmony_ci * for scanning. 224362306a36Sopenharmony_ci * 224462306a36Sopenharmony_ci * max_out_time is the max time off-channel (in usec), and suspend_time 224562306a36Sopenharmony_ci * is how long (in "extended beacon" format) that the scan is "suspended" 224662306a36Sopenharmony_ci * after returning to the service channel. That is, suspend_time is the 224762306a36Sopenharmony_ci * time that we stay on the service channel, doing normal work, between 224862306a36Sopenharmony_ci * scan segments. The driver may set these parameters differently to support 224962306a36Sopenharmony_ci * scanning when associated vs. not associated, and light vs. heavy traffic 225062306a36Sopenharmony_ci * loads when associated. 225162306a36Sopenharmony_ci * 225262306a36Sopenharmony_ci * After receiving this command, the device's scan engine does the following; 225362306a36Sopenharmony_ci * 225462306a36Sopenharmony_ci * 1) Sends SCAN_START notification to driver 225562306a36Sopenharmony_ci * 2) Checks to see if it has time to do scan for one channel 225662306a36Sopenharmony_ci * 3) Sends NULL packet, with power-save (PS) bit set to 1, 225762306a36Sopenharmony_ci * to tell AP that we're going off-channel 225862306a36Sopenharmony_ci * 4) Tunes to first channel in scan list, does active or passive scan 225962306a36Sopenharmony_ci * 5) Sends SCAN_RESULT notification to driver 226062306a36Sopenharmony_ci * 6) Checks to see if it has time to do scan on *next* channel in list 226162306a36Sopenharmony_ci * 7) Repeats 4-6 until it no longer has time to scan the next channel 226262306a36Sopenharmony_ci * before max_out_time expires 226362306a36Sopenharmony_ci * 8) Returns to service channel 226462306a36Sopenharmony_ci * 9) Sends NULL packet with PS=0 to tell AP that we're back 226562306a36Sopenharmony_ci * 10) Stays on service channel until suspend_time expires 226662306a36Sopenharmony_ci * 11) Repeats entire process 2-10 until list is complete 226762306a36Sopenharmony_ci * 12) Sends SCAN_COMPLETE notification 226862306a36Sopenharmony_ci * 226962306a36Sopenharmony_ci * For fast, efficient scans, the scan command also has support for staying on 227062306a36Sopenharmony_ci * a channel for just a short time, if doing active scanning and getting no 227162306a36Sopenharmony_ci * responses to the transmitted probe request. This time is controlled by 227262306a36Sopenharmony_ci * quiet_time, and the number of received packets below which a channel is 227362306a36Sopenharmony_ci * considered "quiet" is controlled by quiet_plcp_threshold. 227462306a36Sopenharmony_ci * 227562306a36Sopenharmony_ci * For active scanning on channels that have regulatory restrictions against 227662306a36Sopenharmony_ci * blindly transmitting, the scan can listen before transmitting, to make sure 227762306a36Sopenharmony_ci * that there is already legitimate activity on the channel. If enough 227862306a36Sopenharmony_ci * packets are cleanly received on the channel (controlled by good_CRC_th, 227962306a36Sopenharmony_ci * typical value 1), the scan engine starts transmitting probe requests. 228062306a36Sopenharmony_ci * 228162306a36Sopenharmony_ci * Driver must use separate scan commands for 2.4 vs. 5 GHz bands. 228262306a36Sopenharmony_ci * 228362306a36Sopenharmony_ci * To avoid uCode errors, see timing restrictions described under 228462306a36Sopenharmony_ci * struct iwl_scan_channel. 228562306a36Sopenharmony_ci */ 228662306a36Sopenharmony_ci 228762306a36Sopenharmony_cienum iwl_scan_flags { 228862306a36Sopenharmony_ci /* BIT(0) currently unused */ 228962306a36Sopenharmony_ci IWL_SCAN_FLAGS_ACTION_FRAME_TX = BIT(1), 229062306a36Sopenharmony_ci /* bits 2-7 reserved */ 229162306a36Sopenharmony_ci}; 229262306a36Sopenharmony_ci 229362306a36Sopenharmony_cistruct iwl_scan_cmd { 229462306a36Sopenharmony_ci __le16 len; 229562306a36Sopenharmony_ci u8 scan_flags; /* scan flags: see enum iwl_scan_flags */ 229662306a36Sopenharmony_ci u8 channel_count; /* # channels in channel list */ 229762306a36Sopenharmony_ci __le16 quiet_time; /* dwell only this # millisecs on quiet channel 229862306a36Sopenharmony_ci * (only for active scan) */ 229962306a36Sopenharmony_ci __le16 quiet_plcp_th; /* quiet chnl is < this # pkts (typ. 1) */ 230062306a36Sopenharmony_ci __le16 good_CRC_th; /* passive -> active promotion threshold */ 230162306a36Sopenharmony_ci __le16 rx_chain; /* RXON_RX_CHAIN_* */ 230262306a36Sopenharmony_ci __le32 max_out_time; /* max usec to be away from associated (service) 230362306a36Sopenharmony_ci * channel */ 230462306a36Sopenharmony_ci __le32 suspend_time; /* pause scan this long (in "extended beacon 230562306a36Sopenharmony_ci * format") when returning to service chnl: 230662306a36Sopenharmony_ci */ 230762306a36Sopenharmony_ci __le32 flags; /* RXON_FLG_* */ 230862306a36Sopenharmony_ci __le32 filter_flags; /* RXON_FILTER_* */ 230962306a36Sopenharmony_ci 231062306a36Sopenharmony_ci /* For active scans (set to all-0s for passive scans). 231162306a36Sopenharmony_ci * Does not include payload. Must specify Tx rate; no rate scaling. */ 231262306a36Sopenharmony_ci struct iwl_tx_cmd tx_cmd; 231362306a36Sopenharmony_ci 231462306a36Sopenharmony_ci /* For directed active scans (set to all-0s otherwise) */ 231562306a36Sopenharmony_ci struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX]; 231662306a36Sopenharmony_ci 231762306a36Sopenharmony_ci /* 231862306a36Sopenharmony_ci * Probe request frame, followed by channel list. 231962306a36Sopenharmony_ci * 232062306a36Sopenharmony_ci * Size of probe request frame is specified by byte count in tx_cmd. 232162306a36Sopenharmony_ci * Channel list follows immediately after probe request frame. 232262306a36Sopenharmony_ci * Number of channels in list is specified by channel_count. 232362306a36Sopenharmony_ci * Each channel in list is of type: 232462306a36Sopenharmony_ci * 232562306a36Sopenharmony_ci * struct iwl_scan_channel channels[0]; 232662306a36Sopenharmony_ci * 232762306a36Sopenharmony_ci * NOTE: Only one band of channels can be scanned per pass. You 232862306a36Sopenharmony_ci * must not mix 2.4GHz channels and 5.2GHz channels, and you must wait 232962306a36Sopenharmony_ci * for one scan to complete (i.e. receive SCAN_COMPLETE_NOTIFICATION) 233062306a36Sopenharmony_ci * before requesting another scan. 233162306a36Sopenharmony_ci */ 233262306a36Sopenharmony_ci u8 data[]; 233362306a36Sopenharmony_ci} __packed; 233462306a36Sopenharmony_ci 233562306a36Sopenharmony_ci/* Can abort will notify by complete notification with abort status. */ 233662306a36Sopenharmony_ci#define CAN_ABORT_STATUS cpu_to_le32(0x1) 233762306a36Sopenharmony_ci/* complete notification statuses */ 233862306a36Sopenharmony_ci#define ABORT_STATUS 0x2 233962306a36Sopenharmony_ci 234062306a36Sopenharmony_ci/* 234162306a36Sopenharmony_ci * REPLY_SCAN_CMD = 0x80 (response) 234262306a36Sopenharmony_ci */ 234362306a36Sopenharmony_cistruct iwl_scanreq_notification { 234462306a36Sopenharmony_ci __le32 status; /* 1: okay, 2: cannot fulfill request */ 234562306a36Sopenharmony_ci} __packed; 234662306a36Sopenharmony_ci 234762306a36Sopenharmony_ci/* 234862306a36Sopenharmony_ci * SCAN_START_NOTIFICATION = 0x82 (notification only, not a command) 234962306a36Sopenharmony_ci */ 235062306a36Sopenharmony_cistruct iwl_scanstart_notification { 235162306a36Sopenharmony_ci __le32 tsf_low; 235262306a36Sopenharmony_ci __le32 tsf_high; 235362306a36Sopenharmony_ci __le32 beacon_timer; 235462306a36Sopenharmony_ci u8 channel; 235562306a36Sopenharmony_ci u8 band; 235662306a36Sopenharmony_ci u8 reserved[2]; 235762306a36Sopenharmony_ci __le32 status; 235862306a36Sopenharmony_ci} __packed; 235962306a36Sopenharmony_ci 236062306a36Sopenharmony_ci#define SCAN_OWNER_STATUS 0x1 236162306a36Sopenharmony_ci#define MEASURE_OWNER_STATUS 0x2 236262306a36Sopenharmony_ci 236362306a36Sopenharmony_ci#define IWL_PROBE_STATUS_OK 0 236462306a36Sopenharmony_ci#define IWL_PROBE_STATUS_TX_FAILED BIT(0) 236562306a36Sopenharmony_ci/* error statuses combined with TX_FAILED */ 236662306a36Sopenharmony_ci#define IWL_PROBE_STATUS_FAIL_TTL BIT(1) 236762306a36Sopenharmony_ci#define IWL_PROBE_STATUS_FAIL_BT BIT(2) 236862306a36Sopenharmony_ci 236962306a36Sopenharmony_ci#define NUMBER_OF_STATISTICS 1 /* first __le32 is good CRC */ 237062306a36Sopenharmony_ci/* 237162306a36Sopenharmony_ci * SCAN_RESULTS_NOTIFICATION = 0x83 (notification only, not a command) 237262306a36Sopenharmony_ci */ 237362306a36Sopenharmony_cistruct iwl_scanresults_notification { 237462306a36Sopenharmony_ci u8 channel; 237562306a36Sopenharmony_ci u8 band; 237662306a36Sopenharmony_ci u8 probe_status; 237762306a36Sopenharmony_ci u8 num_probe_not_sent; /* not enough time to send */ 237862306a36Sopenharmony_ci __le32 tsf_low; 237962306a36Sopenharmony_ci __le32 tsf_high; 238062306a36Sopenharmony_ci __le32 statistics[NUMBER_OF_STATISTICS]; 238162306a36Sopenharmony_ci} __packed; 238262306a36Sopenharmony_ci 238362306a36Sopenharmony_ci/* 238462306a36Sopenharmony_ci * SCAN_COMPLETE_NOTIFICATION = 0x84 (notification only, not a command) 238562306a36Sopenharmony_ci */ 238662306a36Sopenharmony_cistruct iwl_scancomplete_notification { 238762306a36Sopenharmony_ci u8 scanned_channels; 238862306a36Sopenharmony_ci u8 status; 238962306a36Sopenharmony_ci u8 bt_status; /* BT On/Off status */ 239062306a36Sopenharmony_ci u8 last_channel; 239162306a36Sopenharmony_ci __le32 tsf_low; 239262306a36Sopenharmony_ci __le32 tsf_high; 239362306a36Sopenharmony_ci} __packed; 239462306a36Sopenharmony_ci 239562306a36Sopenharmony_ci 239662306a36Sopenharmony_ci/****************************************************************************** 239762306a36Sopenharmony_ci * (9) 239862306a36Sopenharmony_ci * IBSS/AP Commands and Notifications: 239962306a36Sopenharmony_ci * 240062306a36Sopenharmony_ci *****************************************************************************/ 240162306a36Sopenharmony_ci 240262306a36Sopenharmony_cienum iwl_ibss_manager { 240362306a36Sopenharmony_ci IWL_NOT_IBSS_MANAGER = 0, 240462306a36Sopenharmony_ci IWL_IBSS_MANAGER = 1, 240562306a36Sopenharmony_ci}; 240662306a36Sopenharmony_ci 240762306a36Sopenharmony_ci/* 240862306a36Sopenharmony_ci * BEACON_NOTIFICATION = 0x90 (notification only, not a command) 240962306a36Sopenharmony_ci */ 241062306a36Sopenharmony_ci 241162306a36Sopenharmony_cistruct iwlagn_beacon_notif { 241262306a36Sopenharmony_ci struct iwlagn_tx_resp beacon_notify_hdr; 241362306a36Sopenharmony_ci __le32 low_tsf; 241462306a36Sopenharmony_ci __le32 high_tsf; 241562306a36Sopenharmony_ci __le32 ibss_mgr_status; 241662306a36Sopenharmony_ci} __packed; 241762306a36Sopenharmony_ci 241862306a36Sopenharmony_ci/* 241962306a36Sopenharmony_ci * REPLY_TX_BEACON = 0x91 (command, has simple generic response) 242062306a36Sopenharmony_ci */ 242162306a36Sopenharmony_ci 242262306a36Sopenharmony_cistruct iwl_tx_beacon_cmd { 242362306a36Sopenharmony_ci struct iwl_tx_cmd tx; 242462306a36Sopenharmony_ci __le16 tim_idx; 242562306a36Sopenharmony_ci u8 tim_size; 242662306a36Sopenharmony_ci u8 reserved1; 242762306a36Sopenharmony_ci struct ieee80211_hdr frame[]; /* beacon frame */ 242862306a36Sopenharmony_ci} __packed; 242962306a36Sopenharmony_ci 243062306a36Sopenharmony_ci/****************************************************************************** 243162306a36Sopenharmony_ci * (10) 243262306a36Sopenharmony_ci * Statistics Commands and Notifications: 243362306a36Sopenharmony_ci * 243462306a36Sopenharmony_ci *****************************************************************************/ 243562306a36Sopenharmony_ci 243662306a36Sopenharmony_ci#define IWL_TEMP_CONVERT 260 243762306a36Sopenharmony_ci 243862306a36Sopenharmony_ci#define SUP_RATE_11A_MAX_NUM_CHANNELS 8 243962306a36Sopenharmony_ci#define SUP_RATE_11B_MAX_NUM_CHANNELS 4 244062306a36Sopenharmony_ci#define SUP_RATE_11G_MAX_NUM_CHANNELS 12 244162306a36Sopenharmony_ci 244262306a36Sopenharmony_ci/* Used for passing to driver number of successes and failures per rate */ 244362306a36Sopenharmony_cistruct rate_histogram { 244462306a36Sopenharmony_ci union { 244562306a36Sopenharmony_ci __le32 a[SUP_RATE_11A_MAX_NUM_CHANNELS]; 244662306a36Sopenharmony_ci __le32 b[SUP_RATE_11B_MAX_NUM_CHANNELS]; 244762306a36Sopenharmony_ci __le32 g[SUP_RATE_11G_MAX_NUM_CHANNELS]; 244862306a36Sopenharmony_ci } success; 244962306a36Sopenharmony_ci union { 245062306a36Sopenharmony_ci __le32 a[SUP_RATE_11A_MAX_NUM_CHANNELS]; 245162306a36Sopenharmony_ci __le32 b[SUP_RATE_11B_MAX_NUM_CHANNELS]; 245262306a36Sopenharmony_ci __le32 g[SUP_RATE_11G_MAX_NUM_CHANNELS]; 245362306a36Sopenharmony_ci } failed; 245462306a36Sopenharmony_ci} __packed; 245562306a36Sopenharmony_ci 245662306a36Sopenharmony_ci/* statistics command response */ 245762306a36Sopenharmony_ci 245862306a36Sopenharmony_cistruct statistics_dbg { 245962306a36Sopenharmony_ci __le32 burst_check; 246062306a36Sopenharmony_ci __le32 burst_count; 246162306a36Sopenharmony_ci __le32 wait_for_silence_timeout_cnt; 246262306a36Sopenharmony_ci __le32 reserved[3]; 246362306a36Sopenharmony_ci} __packed; 246462306a36Sopenharmony_ci 246562306a36Sopenharmony_cistruct statistics_rx_phy { 246662306a36Sopenharmony_ci __le32 ina_cnt; 246762306a36Sopenharmony_ci __le32 fina_cnt; 246862306a36Sopenharmony_ci __le32 plcp_err; 246962306a36Sopenharmony_ci __le32 crc32_err; 247062306a36Sopenharmony_ci __le32 overrun_err; 247162306a36Sopenharmony_ci __le32 early_overrun_err; 247262306a36Sopenharmony_ci __le32 crc32_good; 247362306a36Sopenharmony_ci __le32 false_alarm_cnt; 247462306a36Sopenharmony_ci __le32 fina_sync_err_cnt; 247562306a36Sopenharmony_ci __le32 sfd_timeout; 247662306a36Sopenharmony_ci __le32 fina_timeout; 247762306a36Sopenharmony_ci __le32 unresponded_rts; 247862306a36Sopenharmony_ci __le32 rxe_frame_limit_overrun; 247962306a36Sopenharmony_ci __le32 sent_ack_cnt; 248062306a36Sopenharmony_ci __le32 sent_cts_cnt; 248162306a36Sopenharmony_ci __le32 sent_ba_rsp_cnt; 248262306a36Sopenharmony_ci __le32 dsp_self_kill; 248362306a36Sopenharmony_ci __le32 mh_format_err; 248462306a36Sopenharmony_ci __le32 re_acq_main_rssi_sum; 248562306a36Sopenharmony_ci __le32 reserved3; 248662306a36Sopenharmony_ci} __packed; 248762306a36Sopenharmony_ci 248862306a36Sopenharmony_cistruct statistics_rx_ht_phy { 248962306a36Sopenharmony_ci __le32 plcp_err; 249062306a36Sopenharmony_ci __le32 overrun_err; 249162306a36Sopenharmony_ci __le32 early_overrun_err; 249262306a36Sopenharmony_ci __le32 crc32_good; 249362306a36Sopenharmony_ci __le32 crc32_err; 249462306a36Sopenharmony_ci __le32 mh_format_err; 249562306a36Sopenharmony_ci __le32 agg_crc32_good; 249662306a36Sopenharmony_ci __le32 agg_mpdu_cnt; 249762306a36Sopenharmony_ci __le32 agg_cnt; 249862306a36Sopenharmony_ci __le32 unsupport_mcs; 249962306a36Sopenharmony_ci} __packed; 250062306a36Sopenharmony_ci 250162306a36Sopenharmony_ci#define INTERFERENCE_DATA_AVAILABLE cpu_to_le32(1) 250262306a36Sopenharmony_ci 250362306a36Sopenharmony_cistruct statistics_rx_non_phy { 250462306a36Sopenharmony_ci __le32 bogus_cts; /* CTS received when not expecting CTS */ 250562306a36Sopenharmony_ci __le32 bogus_ack; /* ACK received when not expecting ACK */ 250662306a36Sopenharmony_ci __le32 non_bssid_frames; /* number of frames with BSSID that 250762306a36Sopenharmony_ci * doesn't belong to the STA BSSID */ 250862306a36Sopenharmony_ci __le32 filtered_frames; /* count frames that were dumped in the 250962306a36Sopenharmony_ci * filtering process */ 251062306a36Sopenharmony_ci __le32 non_channel_beacons; /* beacons with our bss id but not on 251162306a36Sopenharmony_ci * our serving channel */ 251262306a36Sopenharmony_ci __le32 channel_beacons; /* beacons with our bss id and in our 251362306a36Sopenharmony_ci * serving channel */ 251462306a36Sopenharmony_ci __le32 num_missed_bcon; /* number of missed beacons */ 251562306a36Sopenharmony_ci __le32 adc_rx_saturation_time; /* count in 0.8us units the time the 251662306a36Sopenharmony_ci * ADC was in saturation */ 251762306a36Sopenharmony_ci __le32 ina_detection_search_time;/* total time (in 0.8us) searched 251862306a36Sopenharmony_ci * for INA */ 251962306a36Sopenharmony_ci __le32 beacon_silence_rssi_a; /* RSSI silence after beacon frame */ 252062306a36Sopenharmony_ci __le32 beacon_silence_rssi_b; /* RSSI silence after beacon frame */ 252162306a36Sopenharmony_ci __le32 beacon_silence_rssi_c; /* RSSI silence after beacon frame */ 252262306a36Sopenharmony_ci __le32 interference_data_flag; /* flag for interference data 252362306a36Sopenharmony_ci * availability. 1 when data is 252462306a36Sopenharmony_ci * available. */ 252562306a36Sopenharmony_ci __le32 channel_load; /* counts RX Enable time in uSec */ 252662306a36Sopenharmony_ci __le32 dsp_false_alarms; /* DSP false alarm (both OFDM 252762306a36Sopenharmony_ci * and CCK) counter */ 252862306a36Sopenharmony_ci __le32 beacon_rssi_a; 252962306a36Sopenharmony_ci __le32 beacon_rssi_b; 253062306a36Sopenharmony_ci __le32 beacon_rssi_c; 253162306a36Sopenharmony_ci __le32 beacon_energy_a; 253262306a36Sopenharmony_ci __le32 beacon_energy_b; 253362306a36Sopenharmony_ci __le32 beacon_energy_c; 253462306a36Sopenharmony_ci} __packed; 253562306a36Sopenharmony_ci 253662306a36Sopenharmony_cistruct statistics_rx_non_phy_bt { 253762306a36Sopenharmony_ci struct statistics_rx_non_phy common; 253862306a36Sopenharmony_ci /* additional stats for bt */ 253962306a36Sopenharmony_ci __le32 num_bt_kills; 254062306a36Sopenharmony_ci __le32 reserved[2]; 254162306a36Sopenharmony_ci} __packed; 254262306a36Sopenharmony_ci 254362306a36Sopenharmony_cistruct statistics_rx { 254462306a36Sopenharmony_ci struct statistics_rx_phy ofdm; 254562306a36Sopenharmony_ci struct statistics_rx_phy cck; 254662306a36Sopenharmony_ci struct statistics_rx_non_phy general; 254762306a36Sopenharmony_ci struct statistics_rx_ht_phy ofdm_ht; 254862306a36Sopenharmony_ci} __packed; 254962306a36Sopenharmony_ci 255062306a36Sopenharmony_cistruct statistics_rx_bt { 255162306a36Sopenharmony_ci struct statistics_rx_phy ofdm; 255262306a36Sopenharmony_ci struct statistics_rx_phy cck; 255362306a36Sopenharmony_ci struct statistics_rx_non_phy_bt general; 255462306a36Sopenharmony_ci struct statistics_rx_ht_phy ofdm_ht; 255562306a36Sopenharmony_ci} __packed; 255662306a36Sopenharmony_ci 255762306a36Sopenharmony_ci/** 255862306a36Sopenharmony_ci * struct statistics_tx_power - current tx power 255962306a36Sopenharmony_ci * 256062306a36Sopenharmony_ci * @ant_a: current tx power on chain a in 1/2 dB step 256162306a36Sopenharmony_ci * @ant_b: current tx power on chain b in 1/2 dB step 256262306a36Sopenharmony_ci * @ant_c: current tx power on chain c in 1/2 dB step 256362306a36Sopenharmony_ci */ 256462306a36Sopenharmony_cistruct statistics_tx_power { 256562306a36Sopenharmony_ci u8 ant_a; 256662306a36Sopenharmony_ci u8 ant_b; 256762306a36Sopenharmony_ci u8 ant_c; 256862306a36Sopenharmony_ci u8 reserved; 256962306a36Sopenharmony_ci} __packed; 257062306a36Sopenharmony_ci 257162306a36Sopenharmony_cistruct statistics_tx_non_phy_agg { 257262306a36Sopenharmony_ci __le32 ba_timeout; 257362306a36Sopenharmony_ci __le32 ba_reschedule_frames; 257462306a36Sopenharmony_ci __le32 scd_query_agg_frame_cnt; 257562306a36Sopenharmony_ci __le32 scd_query_no_agg; 257662306a36Sopenharmony_ci __le32 scd_query_agg; 257762306a36Sopenharmony_ci __le32 scd_query_mismatch; 257862306a36Sopenharmony_ci __le32 frame_not_ready; 257962306a36Sopenharmony_ci __le32 underrun; 258062306a36Sopenharmony_ci __le32 bt_prio_kill; 258162306a36Sopenharmony_ci __le32 rx_ba_rsp_cnt; 258262306a36Sopenharmony_ci} __packed; 258362306a36Sopenharmony_ci 258462306a36Sopenharmony_cistruct statistics_tx { 258562306a36Sopenharmony_ci __le32 preamble_cnt; 258662306a36Sopenharmony_ci __le32 rx_detected_cnt; 258762306a36Sopenharmony_ci __le32 bt_prio_defer_cnt; 258862306a36Sopenharmony_ci __le32 bt_prio_kill_cnt; 258962306a36Sopenharmony_ci __le32 few_bytes_cnt; 259062306a36Sopenharmony_ci __le32 cts_timeout; 259162306a36Sopenharmony_ci __le32 ack_timeout; 259262306a36Sopenharmony_ci __le32 expected_ack_cnt; 259362306a36Sopenharmony_ci __le32 actual_ack_cnt; 259462306a36Sopenharmony_ci __le32 dump_msdu_cnt; 259562306a36Sopenharmony_ci __le32 burst_abort_next_frame_mismatch_cnt; 259662306a36Sopenharmony_ci __le32 burst_abort_missing_next_frame_cnt; 259762306a36Sopenharmony_ci __le32 cts_timeout_collision; 259862306a36Sopenharmony_ci __le32 ack_or_ba_timeout_collision; 259962306a36Sopenharmony_ci struct statistics_tx_non_phy_agg agg; 260062306a36Sopenharmony_ci /* 260162306a36Sopenharmony_ci * "tx_power" are optional parameters provided by uCode, 260262306a36Sopenharmony_ci * 6000 series is the only device provide the information, 260362306a36Sopenharmony_ci * Those are reserved fields for all the other devices 260462306a36Sopenharmony_ci */ 260562306a36Sopenharmony_ci struct statistics_tx_power tx_power; 260662306a36Sopenharmony_ci __le32 reserved1; 260762306a36Sopenharmony_ci} __packed; 260862306a36Sopenharmony_ci 260962306a36Sopenharmony_ci 261062306a36Sopenharmony_cistruct statistics_div { 261162306a36Sopenharmony_ci __le32 tx_on_a; 261262306a36Sopenharmony_ci __le32 tx_on_b; 261362306a36Sopenharmony_ci __le32 exec_time; 261462306a36Sopenharmony_ci __le32 probe_time; 261562306a36Sopenharmony_ci __le32 reserved1; 261662306a36Sopenharmony_ci __le32 reserved2; 261762306a36Sopenharmony_ci} __packed; 261862306a36Sopenharmony_ci 261962306a36Sopenharmony_cistruct statistics_general_common { 262062306a36Sopenharmony_ci __le32 temperature; /* radio temperature */ 262162306a36Sopenharmony_ci __le32 temperature_m; /* radio voltage */ 262262306a36Sopenharmony_ci struct statistics_dbg dbg; 262362306a36Sopenharmony_ci __le32 sleep_time; 262462306a36Sopenharmony_ci __le32 slots_out; 262562306a36Sopenharmony_ci __le32 slots_idle; 262662306a36Sopenharmony_ci __le32 ttl_timestamp; 262762306a36Sopenharmony_ci struct statistics_div div; 262862306a36Sopenharmony_ci __le32 rx_enable_counter; 262962306a36Sopenharmony_ci /* 263062306a36Sopenharmony_ci * num_of_sos_states: 263162306a36Sopenharmony_ci * count the number of times we have to re-tune 263262306a36Sopenharmony_ci * in order to get out of bad PHY status 263362306a36Sopenharmony_ci */ 263462306a36Sopenharmony_ci __le32 num_of_sos_states; 263562306a36Sopenharmony_ci} __packed; 263662306a36Sopenharmony_ci 263762306a36Sopenharmony_cistruct statistics_bt_activity { 263862306a36Sopenharmony_ci /* Tx statistics */ 263962306a36Sopenharmony_ci __le32 hi_priority_tx_req_cnt; 264062306a36Sopenharmony_ci __le32 hi_priority_tx_denied_cnt; 264162306a36Sopenharmony_ci __le32 lo_priority_tx_req_cnt; 264262306a36Sopenharmony_ci __le32 lo_priority_tx_denied_cnt; 264362306a36Sopenharmony_ci /* Rx statistics */ 264462306a36Sopenharmony_ci __le32 hi_priority_rx_req_cnt; 264562306a36Sopenharmony_ci __le32 hi_priority_rx_denied_cnt; 264662306a36Sopenharmony_ci __le32 lo_priority_rx_req_cnt; 264762306a36Sopenharmony_ci __le32 lo_priority_rx_denied_cnt; 264862306a36Sopenharmony_ci} __packed; 264962306a36Sopenharmony_ci 265062306a36Sopenharmony_cistruct statistics_general { 265162306a36Sopenharmony_ci struct statistics_general_common common; 265262306a36Sopenharmony_ci __le32 reserved2; 265362306a36Sopenharmony_ci __le32 reserved3; 265462306a36Sopenharmony_ci} __packed; 265562306a36Sopenharmony_ci 265662306a36Sopenharmony_cistruct statistics_general_bt { 265762306a36Sopenharmony_ci struct statistics_general_common common; 265862306a36Sopenharmony_ci struct statistics_bt_activity activity; 265962306a36Sopenharmony_ci __le32 reserved2; 266062306a36Sopenharmony_ci __le32 reserved3; 266162306a36Sopenharmony_ci} __packed; 266262306a36Sopenharmony_ci 266362306a36Sopenharmony_ci#define UCODE_STATISTICS_CLEAR_MSK (0x1 << 0) 266462306a36Sopenharmony_ci#define UCODE_STATISTICS_FREQUENCY_MSK (0x1 << 1) 266562306a36Sopenharmony_ci#define UCODE_STATISTICS_NARROW_BAND_MSK (0x1 << 2) 266662306a36Sopenharmony_ci 266762306a36Sopenharmony_ci/* 266862306a36Sopenharmony_ci * REPLY_STATISTICS_CMD = 0x9c, 266962306a36Sopenharmony_ci * all devices identical. 267062306a36Sopenharmony_ci * 267162306a36Sopenharmony_ci * This command triggers an immediate response containing uCode statistics. 267262306a36Sopenharmony_ci * The response is in the same format as STATISTICS_NOTIFICATION 0x9d, below. 267362306a36Sopenharmony_ci * 267462306a36Sopenharmony_ci * If the CLEAR_STATS configuration flag is set, uCode will clear its 267562306a36Sopenharmony_ci * internal copy of the statistics (counters) after issuing the response. 267662306a36Sopenharmony_ci * This flag does not affect STATISTICS_NOTIFICATIONs after beacons (see below). 267762306a36Sopenharmony_ci * 267862306a36Sopenharmony_ci * If the DISABLE_NOTIF configuration flag is set, uCode will not issue 267962306a36Sopenharmony_ci * STATISTICS_NOTIFICATIONs after received beacons (see below). This flag 268062306a36Sopenharmony_ci * does not affect the response to the REPLY_STATISTICS_CMD 0x9c itself. 268162306a36Sopenharmony_ci */ 268262306a36Sopenharmony_ci#define IWL_STATS_CONF_CLEAR_STATS cpu_to_le32(0x1) /* see above */ 268362306a36Sopenharmony_ci#define IWL_STATS_CONF_DISABLE_NOTIF cpu_to_le32(0x2)/* see above */ 268462306a36Sopenharmony_cistruct iwl_statistics_cmd { 268562306a36Sopenharmony_ci __le32 configuration_flags; /* IWL_STATS_CONF_* */ 268662306a36Sopenharmony_ci} __packed; 268762306a36Sopenharmony_ci 268862306a36Sopenharmony_ci/* 268962306a36Sopenharmony_ci * STATISTICS_NOTIFICATION = 0x9d (notification only, not a command) 269062306a36Sopenharmony_ci * 269162306a36Sopenharmony_ci * By default, uCode issues this notification after receiving a beacon 269262306a36Sopenharmony_ci * while associated. To disable this behavior, set DISABLE_NOTIF flag in the 269362306a36Sopenharmony_ci * REPLY_STATISTICS_CMD 0x9c, above. 269462306a36Sopenharmony_ci * 269562306a36Sopenharmony_ci * Statistics counters continue to increment beacon after beacon, but are 269662306a36Sopenharmony_ci * cleared when changing channels or when driver issues REPLY_STATISTICS_CMD 269762306a36Sopenharmony_ci * 0x9c with CLEAR_STATS bit set (see above). 269862306a36Sopenharmony_ci * 269962306a36Sopenharmony_ci * uCode also issues this notification during scans. uCode clears statistics 270062306a36Sopenharmony_ci * appropriately so that each notification contains statistics for only the 270162306a36Sopenharmony_ci * one channel that has just been scanned. 270262306a36Sopenharmony_ci */ 270362306a36Sopenharmony_ci#define STATISTICS_REPLY_FLG_BAND_24G_MSK cpu_to_le32(0x2) 270462306a36Sopenharmony_ci#define STATISTICS_REPLY_FLG_HT40_MODE_MSK cpu_to_le32(0x8) 270562306a36Sopenharmony_ci 270662306a36Sopenharmony_cistruct iwl_notif_statistics { 270762306a36Sopenharmony_ci __le32 flag; 270862306a36Sopenharmony_ci struct statistics_rx rx; 270962306a36Sopenharmony_ci struct statistics_tx tx; 271062306a36Sopenharmony_ci struct statistics_general general; 271162306a36Sopenharmony_ci} __packed; 271262306a36Sopenharmony_ci 271362306a36Sopenharmony_cistruct iwl_bt_notif_statistics { 271462306a36Sopenharmony_ci __le32 flag; 271562306a36Sopenharmony_ci struct statistics_rx_bt rx; 271662306a36Sopenharmony_ci struct statistics_tx tx; 271762306a36Sopenharmony_ci struct statistics_general_bt general; 271862306a36Sopenharmony_ci} __packed; 271962306a36Sopenharmony_ci 272062306a36Sopenharmony_ci/* 272162306a36Sopenharmony_ci * MISSED_BEACONS_NOTIFICATION = 0xa2 (notification only, not a command) 272262306a36Sopenharmony_ci * 272362306a36Sopenharmony_ci * uCode send MISSED_BEACONS_NOTIFICATION to driver when detect beacon missed 272462306a36Sopenharmony_ci * in regardless of how many missed beacons, which mean when driver receive the 272562306a36Sopenharmony_ci * notification, inside the command, it can find all the beacons information 272662306a36Sopenharmony_ci * which include number of total missed beacons, number of consecutive missed 272762306a36Sopenharmony_ci * beacons, number of beacons received and number of beacons expected to 272862306a36Sopenharmony_ci * receive. 272962306a36Sopenharmony_ci * 273062306a36Sopenharmony_ci * If uCode detected consecutive_missed_beacons > 5, it will reset the radio 273162306a36Sopenharmony_ci * in order to bring the radio/PHY back to working state; which has no relation 273262306a36Sopenharmony_ci * to when driver will perform sensitivity calibration. 273362306a36Sopenharmony_ci * 273462306a36Sopenharmony_ci * Driver should set it own missed_beacon_threshold to decide when to perform 273562306a36Sopenharmony_ci * sensitivity calibration based on number of consecutive missed beacons in 273662306a36Sopenharmony_ci * order to improve overall performance, especially in noisy environment. 273762306a36Sopenharmony_ci * 273862306a36Sopenharmony_ci */ 273962306a36Sopenharmony_ci 274062306a36Sopenharmony_ci#define IWL_MISSED_BEACON_THRESHOLD_MIN (1) 274162306a36Sopenharmony_ci#define IWL_MISSED_BEACON_THRESHOLD_DEF (5) 274262306a36Sopenharmony_ci#define IWL_MISSED_BEACON_THRESHOLD_MAX IWL_MISSED_BEACON_THRESHOLD_DEF 274362306a36Sopenharmony_ci 274462306a36Sopenharmony_cistruct iwl_missed_beacon_notif { 274562306a36Sopenharmony_ci __le32 consecutive_missed_beacons; 274662306a36Sopenharmony_ci __le32 total_missed_becons; 274762306a36Sopenharmony_ci __le32 num_expected_beacons; 274862306a36Sopenharmony_ci __le32 num_recvd_beacons; 274962306a36Sopenharmony_ci} __packed; 275062306a36Sopenharmony_ci 275162306a36Sopenharmony_ci 275262306a36Sopenharmony_ci/****************************************************************************** 275362306a36Sopenharmony_ci * (11) 275462306a36Sopenharmony_ci * Rx Calibration Commands: 275562306a36Sopenharmony_ci * 275662306a36Sopenharmony_ci * With the uCode used for open source drivers, most Tx calibration (except 275762306a36Sopenharmony_ci * for Tx Power) and most Rx calibration is done by uCode during the 275862306a36Sopenharmony_ci * "initialize" phase of uCode boot. Driver must calibrate only: 275962306a36Sopenharmony_ci * 276062306a36Sopenharmony_ci * 1) Tx power (depends on temperature), described elsewhere 276162306a36Sopenharmony_ci * 2) Receiver gain balance (optimize MIMO, and detect disconnected antennas) 276262306a36Sopenharmony_ci * 3) Receiver sensitivity (to optimize signal detection) 276362306a36Sopenharmony_ci * 276462306a36Sopenharmony_ci *****************************************************************************/ 276562306a36Sopenharmony_ci 276662306a36Sopenharmony_ci/** 276762306a36Sopenharmony_ci * SENSITIVITY_CMD = 0xa8 (command, has simple generic response) 276862306a36Sopenharmony_ci * 276962306a36Sopenharmony_ci * This command sets up the Rx signal detector for a sensitivity level that 277062306a36Sopenharmony_ci * is high enough to lock onto all signals within the associated network, 277162306a36Sopenharmony_ci * but low enough to ignore signals that are below a certain threshold, so as 277262306a36Sopenharmony_ci * not to have too many "false alarms". False alarms are signals that the 277362306a36Sopenharmony_ci * Rx DSP tries to lock onto, but then discards after determining that they 277462306a36Sopenharmony_ci * are noise. 277562306a36Sopenharmony_ci * 277662306a36Sopenharmony_ci * The optimum number of false alarms is between 5 and 50 per 200 TUs 277762306a36Sopenharmony_ci * (200 * 1024 uSecs, i.e. 204.8 milliseconds) of actual Rx time (i.e. 277862306a36Sopenharmony_ci * time listening, not transmitting). Driver must adjust sensitivity so that 277962306a36Sopenharmony_ci * the ratio of actual false alarms to actual Rx time falls within this range. 278062306a36Sopenharmony_ci * 278162306a36Sopenharmony_ci * While associated, uCode delivers STATISTICS_NOTIFICATIONs after each 278262306a36Sopenharmony_ci * received beacon. These provide information to the driver to analyze the 278362306a36Sopenharmony_ci * sensitivity. Don't analyze statistics that come in from scanning, or any 278462306a36Sopenharmony_ci * other non-associated-network source. Pertinent statistics include: 278562306a36Sopenharmony_ci * 278662306a36Sopenharmony_ci * From "general" statistics (struct statistics_rx_non_phy): 278762306a36Sopenharmony_ci * 278862306a36Sopenharmony_ci * (beacon_energy_[abc] & 0x0FF00) >> 8 (unsigned, higher value is lower level) 278962306a36Sopenharmony_ci * Measure of energy of desired signal. Used for establishing a level 279062306a36Sopenharmony_ci * below which the device does not detect signals. 279162306a36Sopenharmony_ci * 279262306a36Sopenharmony_ci * (beacon_silence_rssi_[abc] & 0x0FF00) >> 8 (unsigned, units in dB) 279362306a36Sopenharmony_ci * Measure of background noise in silent period after beacon. 279462306a36Sopenharmony_ci * 279562306a36Sopenharmony_ci * channel_load 279662306a36Sopenharmony_ci * uSecs of actual Rx time during beacon period (varies according to 279762306a36Sopenharmony_ci * how much time was spent transmitting). 279862306a36Sopenharmony_ci * 279962306a36Sopenharmony_ci * From "cck" and "ofdm" statistics (struct statistics_rx_phy), separately: 280062306a36Sopenharmony_ci * 280162306a36Sopenharmony_ci * false_alarm_cnt 280262306a36Sopenharmony_ci * Signal locks abandoned early (before phy-level header). 280362306a36Sopenharmony_ci * 280462306a36Sopenharmony_ci * plcp_err 280562306a36Sopenharmony_ci * Signal locks abandoned late (during phy-level header). 280662306a36Sopenharmony_ci * 280762306a36Sopenharmony_ci * NOTE: Both false_alarm_cnt and plcp_err increment monotonically from 280862306a36Sopenharmony_ci * beacon to beacon, i.e. each value is an accumulation of all errors 280962306a36Sopenharmony_ci * before and including the latest beacon. Values will wrap around to 0 281062306a36Sopenharmony_ci * after counting up to 2^32 - 1. Driver must differentiate vs. 281162306a36Sopenharmony_ci * previous beacon's values to determine # false alarms in the current 281262306a36Sopenharmony_ci * beacon period. 281362306a36Sopenharmony_ci * 281462306a36Sopenharmony_ci * Total number of false alarms = false_alarms + plcp_errs 281562306a36Sopenharmony_ci * 281662306a36Sopenharmony_ci * For OFDM, adjust the following table entries in struct iwl_sensitivity_cmd 281762306a36Sopenharmony_ci * (notice that the start points for OFDM are at or close to settings for 281862306a36Sopenharmony_ci * maximum sensitivity): 281962306a36Sopenharmony_ci * 282062306a36Sopenharmony_ci * START / MIN / MAX 282162306a36Sopenharmony_ci * HD_AUTO_CORR32_X1_TH_ADD_MIN_INDEX 90 / 85 / 120 282262306a36Sopenharmony_ci * HD_AUTO_CORR32_X1_TH_ADD_MIN_MRC_INDEX 170 / 170 / 210 282362306a36Sopenharmony_ci * HD_AUTO_CORR32_X4_TH_ADD_MIN_INDEX 105 / 105 / 140 282462306a36Sopenharmony_ci * HD_AUTO_CORR32_X4_TH_ADD_MIN_MRC_INDEX 220 / 220 / 270 282562306a36Sopenharmony_ci * 282662306a36Sopenharmony_ci * If actual rate of OFDM false alarms (+ plcp_errors) is too high 282762306a36Sopenharmony_ci * (greater than 50 for each 204.8 msecs listening), reduce sensitivity 282862306a36Sopenharmony_ci * by *adding* 1 to all 4 of the table entries above, up to the max for 282962306a36Sopenharmony_ci * each entry. Conversely, if false alarm rate is too low (less than 5 283062306a36Sopenharmony_ci * for each 204.8 msecs listening), *subtract* 1 from each entry to 283162306a36Sopenharmony_ci * increase sensitivity. 283262306a36Sopenharmony_ci * 283362306a36Sopenharmony_ci * For CCK sensitivity, keep track of the following: 283462306a36Sopenharmony_ci * 283562306a36Sopenharmony_ci * 1). 20-beacon history of maximum background noise, indicated by 283662306a36Sopenharmony_ci * (beacon_silence_rssi_[abc] & 0x0FF00), units in dB, across the 283762306a36Sopenharmony_ci * 3 receivers. For any given beacon, the "silence reference" is 283862306a36Sopenharmony_ci * the maximum of last 60 samples (20 beacons * 3 receivers). 283962306a36Sopenharmony_ci * 284062306a36Sopenharmony_ci * 2). 10-beacon history of strongest signal level, as indicated 284162306a36Sopenharmony_ci * by (beacon_energy_[abc] & 0x0FF00) >> 8, across the 3 receivers, 284262306a36Sopenharmony_ci * i.e. the strength of the signal through the best receiver at the 284362306a36Sopenharmony_ci * moment. These measurements are "upside down", with lower values 284462306a36Sopenharmony_ci * for stronger signals, so max energy will be *minimum* value. 284562306a36Sopenharmony_ci * 284662306a36Sopenharmony_ci * Then for any given beacon, the driver must determine the *weakest* 284762306a36Sopenharmony_ci * of the strongest signals; this is the minimum level that needs to be 284862306a36Sopenharmony_ci * successfully detected, when using the best receiver at the moment. 284962306a36Sopenharmony_ci * "Max cck energy" is the maximum (higher value means lower energy!) 285062306a36Sopenharmony_ci * of the last 10 minima. Once this is determined, driver must add 285162306a36Sopenharmony_ci * a little margin by adding "6" to it. 285262306a36Sopenharmony_ci * 285362306a36Sopenharmony_ci * 3). Number of consecutive beacon periods with too few false alarms. 285462306a36Sopenharmony_ci * Reset this to 0 at the first beacon period that falls within the 285562306a36Sopenharmony_ci * "good" range (5 to 50 false alarms per 204.8 milliseconds rx). 285662306a36Sopenharmony_ci * 285762306a36Sopenharmony_ci * Then, adjust the following CCK table entries in struct iwl_sensitivity_cmd 285862306a36Sopenharmony_ci * (notice that the start points for CCK are at maximum sensitivity): 285962306a36Sopenharmony_ci * 286062306a36Sopenharmony_ci * START / MIN / MAX 286162306a36Sopenharmony_ci * HD_AUTO_CORR40_X4_TH_ADD_MIN_INDEX 125 / 125 / 200 286262306a36Sopenharmony_ci * HD_AUTO_CORR40_X4_TH_ADD_MIN_MRC_INDEX 200 / 200 / 400 286362306a36Sopenharmony_ci * HD_MIN_ENERGY_CCK_DET_INDEX 100 / 0 / 100 286462306a36Sopenharmony_ci * 286562306a36Sopenharmony_ci * If actual rate of CCK false alarms (+ plcp_errors) is too high 286662306a36Sopenharmony_ci * (greater than 50 for each 204.8 msecs listening), method for reducing 286762306a36Sopenharmony_ci * sensitivity is: 286862306a36Sopenharmony_ci * 286962306a36Sopenharmony_ci * 1) *Add* 3 to value in HD_AUTO_CORR40_X4_TH_ADD_MIN_MRC_INDEX, 287062306a36Sopenharmony_ci * up to max 400. 287162306a36Sopenharmony_ci * 287262306a36Sopenharmony_ci * 2) If current value in HD_AUTO_CORR40_X4_TH_ADD_MIN_INDEX is < 160, 287362306a36Sopenharmony_ci * sensitivity has been reduced a significant amount; bring it up to 287462306a36Sopenharmony_ci * a moderate 161. Otherwise, *add* 3, up to max 200. 287562306a36Sopenharmony_ci * 287662306a36Sopenharmony_ci * 3) a) If current value in HD_AUTO_CORR40_X4_TH_ADD_MIN_INDEX is > 160, 287762306a36Sopenharmony_ci * sensitivity has been reduced only a moderate or small amount; 287862306a36Sopenharmony_ci * *subtract* 2 from value in HD_MIN_ENERGY_CCK_DET_INDEX, 287962306a36Sopenharmony_ci * down to min 0. Otherwise (if gain has been significantly reduced), 288062306a36Sopenharmony_ci * don't change the HD_MIN_ENERGY_CCK_DET_INDEX value. 288162306a36Sopenharmony_ci * 288262306a36Sopenharmony_ci * b) Save a snapshot of the "silence reference". 288362306a36Sopenharmony_ci * 288462306a36Sopenharmony_ci * If actual rate of CCK false alarms (+ plcp_errors) is too low 288562306a36Sopenharmony_ci * (less than 5 for each 204.8 msecs listening), method for increasing 288662306a36Sopenharmony_ci * sensitivity is used only if: 288762306a36Sopenharmony_ci * 288862306a36Sopenharmony_ci * 1a) Previous beacon did not have too many false alarms 288962306a36Sopenharmony_ci * 1b) AND difference between previous "silence reference" and current 289062306a36Sopenharmony_ci * "silence reference" (prev - current) is 2 or more, 289162306a36Sopenharmony_ci * OR 2) 100 or more consecutive beacon periods have had rate of 289262306a36Sopenharmony_ci * less than 5 false alarms per 204.8 milliseconds rx time. 289362306a36Sopenharmony_ci * 289462306a36Sopenharmony_ci * Method for increasing sensitivity: 289562306a36Sopenharmony_ci * 289662306a36Sopenharmony_ci * 1) *Subtract* 3 from value in HD_AUTO_CORR40_X4_TH_ADD_MIN_INDEX, 289762306a36Sopenharmony_ci * down to min 125. 289862306a36Sopenharmony_ci * 289962306a36Sopenharmony_ci * 2) *Subtract* 3 from value in HD_AUTO_CORR40_X4_TH_ADD_MIN_MRC_INDEX, 290062306a36Sopenharmony_ci * down to min 200. 290162306a36Sopenharmony_ci * 290262306a36Sopenharmony_ci * 3) *Add* 2 to value in HD_MIN_ENERGY_CCK_DET_INDEX, up to max 100. 290362306a36Sopenharmony_ci * 290462306a36Sopenharmony_ci * If actual rate of CCK false alarms (+ plcp_errors) is within good range 290562306a36Sopenharmony_ci * (between 5 and 50 for each 204.8 msecs listening): 290662306a36Sopenharmony_ci * 290762306a36Sopenharmony_ci * 1) Save a snapshot of the silence reference. 290862306a36Sopenharmony_ci * 290962306a36Sopenharmony_ci * 2) If previous beacon had too many CCK false alarms (+ plcp_errors), 291062306a36Sopenharmony_ci * give some extra margin to energy threshold by *subtracting* 8 291162306a36Sopenharmony_ci * from value in HD_MIN_ENERGY_CCK_DET_INDEX. 291262306a36Sopenharmony_ci * 291362306a36Sopenharmony_ci * For all cases (too few, too many, good range), make sure that the CCK 291462306a36Sopenharmony_ci * detection threshold (energy) is below the energy level for robust 291562306a36Sopenharmony_ci * detection over the past 10 beacon periods, the "Max cck energy". 291662306a36Sopenharmony_ci * Lower values mean higher energy; this means making sure that the value 291762306a36Sopenharmony_ci * in HD_MIN_ENERGY_CCK_DET_INDEX is at or *above* "Max cck energy". 291862306a36Sopenharmony_ci * 291962306a36Sopenharmony_ci */ 292062306a36Sopenharmony_ci 292162306a36Sopenharmony_ci/* 292262306a36Sopenharmony_ci * Table entries in SENSITIVITY_CMD (struct iwl_sensitivity_cmd) 292362306a36Sopenharmony_ci */ 292462306a36Sopenharmony_ci#define HD_TABLE_SIZE (11) /* number of entries */ 292562306a36Sopenharmony_ci#define HD_MIN_ENERGY_CCK_DET_INDEX (0) /* table indexes */ 292662306a36Sopenharmony_ci#define HD_MIN_ENERGY_OFDM_DET_INDEX (1) 292762306a36Sopenharmony_ci#define HD_AUTO_CORR32_X1_TH_ADD_MIN_INDEX (2) 292862306a36Sopenharmony_ci#define HD_AUTO_CORR32_X1_TH_ADD_MIN_MRC_INDEX (3) 292962306a36Sopenharmony_ci#define HD_AUTO_CORR40_X4_TH_ADD_MIN_MRC_INDEX (4) 293062306a36Sopenharmony_ci#define HD_AUTO_CORR32_X4_TH_ADD_MIN_INDEX (5) 293162306a36Sopenharmony_ci#define HD_AUTO_CORR32_X4_TH_ADD_MIN_MRC_INDEX (6) 293262306a36Sopenharmony_ci#define HD_BARKER_CORR_TH_ADD_MIN_INDEX (7) 293362306a36Sopenharmony_ci#define HD_BARKER_CORR_TH_ADD_MIN_MRC_INDEX (8) 293462306a36Sopenharmony_ci#define HD_AUTO_CORR40_X4_TH_ADD_MIN_INDEX (9) 293562306a36Sopenharmony_ci#define HD_OFDM_ENERGY_TH_IN_INDEX (10) 293662306a36Sopenharmony_ci 293762306a36Sopenharmony_ci/* 293862306a36Sopenharmony_ci * Additional table entries in enhance SENSITIVITY_CMD 293962306a36Sopenharmony_ci */ 294062306a36Sopenharmony_ci#define HD_INA_NON_SQUARE_DET_OFDM_INDEX (11) 294162306a36Sopenharmony_ci#define HD_INA_NON_SQUARE_DET_CCK_INDEX (12) 294262306a36Sopenharmony_ci#define HD_CORR_11_INSTEAD_OF_CORR_9_EN_INDEX (13) 294362306a36Sopenharmony_ci#define HD_OFDM_NON_SQUARE_DET_SLOPE_MRC_INDEX (14) 294462306a36Sopenharmony_ci#define HD_OFDM_NON_SQUARE_DET_INTERCEPT_MRC_INDEX (15) 294562306a36Sopenharmony_ci#define HD_OFDM_NON_SQUARE_DET_SLOPE_INDEX (16) 294662306a36Sopenharmony_ci#define HD_OFDM_NON_SQUARE_DET_INTERCEPT_INDEX (17) 294762306a36Sopenharmony_ci#define HD_CCK_NON_SQUARE_DET_SLOPE_MRC_INDEX (18) 294862306a36Sopenharmony_ci#define HD_CCK_NON_SQUARE_DET_INTERCEPT_MRC_INDEX (19) 294962306a36Sopenharmony_ci#define HD_CCK_NON_SQUARE_DET_SLOPE_INDEX (20) 295062306a36Sopenharmony_ci#define HD_CCK_NON_SQUARE_DET_INTERCEPT_INDEX (21) 295162306a36Sopenharmony_ci#define HD_RESERVED (22) 295262306a36Sopenharmony_ci 295362306a36Sopenharmony_ci/* number of entries for enhanced tbl */ 295462306a36Sopenharmony_ci#define ENHANCE_HD_TABLE_SIZE (23) 295562306a36Sopenharmony_ci 295662306a36Sopenharmony_ci/* number of additional entries for enhanced tbl */ 295762306a36Sopenharmony_ci#define ENHANCE_HD_TABLE_ENTRIES (ENHANCE_HD_TABLE_SIZE - HD_TABLE_SIZE) 295862306a36Sopenharmony_ci 295962306a36Sopenharmony_ci#define HD_INA_NON_SQUARE_DET_OFDM_DATA_V1 cpu_to_le16(0) 296062306a36Sopenharmony_ci#define HD_INA_NON_SQUARE_DET_CCK_DATA_V1 cpu_to_le16(0) 296162306a36Sopenharmony_ci#define HD_CORR_11_INSTEAD_OF_CORR_9_EN_DATA_V1 cpu_to_le16(0) 296262306a36Sopenharmony_ci#define HD_OFDM_NON_SQUARE_DET_SLOPE_MRC_DATA_V1 cpu_to_le16(668) 296362306a36Sopenharmony_ci#define HD_OFDM_NON_SQUARE_DET_INTERCEPT_MRC_DATA_V1 cpu_to_le16(4) 296462306a36Sopenharmony_ci#define HD_OFDM_NON_SQUARE_DET_SLOPE_DATA_V1 cpu_to_le16(486) 296562306a36Sopenharmony_ci#define HD_OFDM_NON_SQUARE_DET_INTERCEPT_DATA_V1 cpu_to_le16(37) 296662306a36Sopenharmony_ci#define HD_CCK_NON_SQUARE_DET_SLOPE_MRC_DATA_V1 cpu_to_le16(853) 296762306a36Sopenharmony_ci#define HD_CCK_NON_SQUARE_DET_INTERCEPT_MRC_DATA_V1 cpu_to_le16(4) 296862306a36Sopenharmony_ci#define HD_CCK_NON_SQUARE_DET_SLOPE_DATA_V1 cpu_to_le16(476) 296962306a36Sopenharmony_ci#define HD_CCK_NON_SQUARE_DET_INTERCEPT_DATA_V1 cpu_to_le16(99) 297062306a36Sopenharmony_ci 297162306a36Sopenharmony_ci#define HD_INA_NON_SQUARE_DET_OFDM_DATA_V2 cpu_to_le16(1) 297262306a36Sopenharmony_ci#define HD_INA_NON_SQUARE_DET_CCK_DATA_V2 cpu_to_le16(1) 297362306a36Sopenharmony_ci#define HD_CORR_11_INSTEAD_OF_CORR_9_EN_DATA_V2 cpu_to_le16(1) 297462306a36Sopenharmony_ci#define HD_OFDM_NON_SQUARE_DET_SLOPE_MRC_DATA_V2 cpu_to_le16(600) 297562306a36Sopenharmony_ci#define HD_OFDM_NON_SQUARE_DET_INTERCEPT_MRC_DATA_V2 cpu_to_le16(40) 297662306a36Sopenharmony_ci#define HD_OFDM_NON_SQUARE_DET_SLOPE_DATA_V2 cpu_to_le16(486) 297762306a36Sopenharmony_ci#define HD_OFDM_NON_SQUARE_DET_INTERCEPT_DATA_V2 cpu_to_le16(45) 297862306a36Sopenharmony_ci#define HD_CCK_NON_SQUARE_DET_SLOPE_MRC_DATA_V2 cpu_to_le16(853) 297962306a36Sopenharmony_ci#define HD_CCK_NON_SQUARE_DET_INTERCEPT_MRC_DATA_V2 cpu_to_le16(60) 298062306a36Sopenharmony_ci#define HD_CCK_NON_SQUARE_DET_SLOPE_DATA_V2 cpu_to_le16(476) 298162306a36Sopenharmony_ci#define HD_CCK_NON_SQUARE_DET_INTERCEPT_DATA_V2 cpu_to_le16(99) 298262306a36Sopenharmony_ci 298362306a36Sopenharmony_ci 298462306a36Sopenharmony_ci/* Control field in struct iwl_sensitivity_cmd */ 298562306a36Sopenharmony_ci#define SENSITIVITY_CMD_CONTROL_DEFAULT_TABLE cpu_to_le16(0) 298662306a36Sopenharmony_ci#define SENSITIVITY_CMD_CONTROL_WORK_TABLE cpu_to_le16(1) 298762306a36Sopenharmony_ci 298862306a36Sopenharmony_ci/** 298962306a36Sopenharmony_ci * struct iwl_sensitivity_cmd 299062306a36Sopenharmony_ci * @control: (1) updates working table, (0) updates default table 299162306a36Sopenharmony_ci * @table: energy threshold values, use HD_* as index into table 299262306a36Sopenharmony_ci * 299362306a36Sopenharmony_ci * Always use "1" in "control" to update uCode's working table and DSP. 299462306a36Sopenharmony_ci */ 299562306a36Sopenharmony_cistruct iwl_sensitivity_cmd { 299662306a36Sopenharmony_ci __le16 control; /* always use "1" */ 299762306a36Sopenharmony_ci __le16 table[HD_TABLE_SIZE]; /* use HD_* as index */ 299862306a36Sopenharmony_ci} __packed; 299962306a36Sopenharmony_ci 300062306a36Sopenharmony_ci/* 300162306a36Sopenharmony_ci * 300262306a36Sopenharmony_ci */ 300362306a36Sopenharmony_cistruct iwl_enhance_sensitivity_cmd { 300462306a36Sopenharmony_ci __le16 control; /* always use "1" */ 300562306a36Sopenharmony_ci __le16 enhance_table[ENHANCE_HD_TABLE_SIZE]; /* use HD_* as index */ 300662306a36Sopenharmony_ci} __packed; 300762306a36Sopenharmony_ci 300862306a36Sopenharmony_ci 300962306a36Sopenharmony_ci/** 301062306a36Sopenharmony_ci * REPLY_PHY_CALIBRATION_CMD = 0xb0 (command, has simple generic response) 301162306a36Sopenharmony_ci * 301262306a36Sopenharmony_ci * This command sets the relative gains of agn device's 3 radio receiver chains. 301362306a36Sopenharmony_ci * 301462306a36Sopenharmony_ci * After the first association, driver should accumulate signal and noise 301562306a36Sopenharmony_ci * statistics from the STATISTICS_NOTIFICATIONs that follow the first 20 301662306a36Sopenharmony_ci * beacons from the associated network (don't collect statistics that come 301762306a36Sopenharmony_ci * in from scanning, or any other non-network source). 301862306a36Sopenharmony_ci * 301962306a36Sopenharmony_ci * DISCONNECTED ANTENNA: 302062306a36Sopenharmony_ci * 302162306a36Sopenharmony_ci * Driver should determine which antennas are actually connected, by comparing 302262306a36Sopenharmony_ci * average beacon signal levels for the 3 Rx chains. Accumulate (add) the 302362306a36Sopenharmony_ci * following values over 20 beacons, one accumulator for each of the chains 302462306a36Sopenharmony_ci * a/b/c, from struct statistics_rx_non_phy: 302562306a36Sopenharmony_ci * 302662306a36Sopenharmony_ci * beacon_rssi_[abc] & 0x0FF (unsigned, units in dB) 302762306a36Sopenharmony_ci * 302862306a36Sopenharmony_ci * Find the strongest signal from among a/b/c. Compare the other two to the 302962306a36Sopenharmony_ci * strongest. If any signal is more than 15 dB (times 20, unless you 303062306a36Sopenharmony_ci * divide the accumulated values by 20) below the strongest, the driver 303162306a36Sopenharmony_ci * considers that antenna to be disconnected, and should not try to use that 303262306a36Sopenharmony_ci * antenna/chain for Rx or Tx. If both A and B seem to be disconnected, 303362306a36Sopenharmony_ci * driver should declare the stronger one as connected, and attempt to use it 303462306a36Sopenharmony_ci * (A and B are the only 2 Tx chains!). 303562306a36Sopenharmony_ci * 303662306a36Sopenharmony_ci * 303762306a36Sopenharmony_ci * RX BALANCE: 303862306a36Sopenharmony_ci * 303962306a36Sopenharmony_ci * Driver should balance the 3 receivers (but just the ones that are connected 304062306a36Sopenharmony_ci * to antennas, see above) for gain, by comparing the average signal levels 304162306a36Sopenharmony_ci * detected during the silence after each beacon (background noise). 304262306a36Sopenharmony_ci * Accumulate (add) the following values over 20 beacons, one accumulator for 304362306a36Sopenharmony_ci * each of the chains a/b/c, from struct statistics_rx_non_phy: 304462306a36Sopenharmony_ci * 304562306a36Sopenharmony_ci * beacon_silence_rssi_[abc] & 0x0FF (unsigned, units in dB) 304662306a36Sopenharmony_ci * 304762306a36Sopenharmony_ci * Find the weakest background noise level from among a/b/c. This Rx chain 304862306a36Sopenharmony_ci * will be the reference, with 0 gain adjustment. Attenuate other channels by 304962306a36Sopenharmony_ci * finding noise difference: 305062306a36Sopenharmony_ci * 305162306a36Sopenharmony_ci * (accum_noise[i] - accum_noise[reference]) / 30 305262306a36Sopenharmony_ci * 305362306a36Sopenharmony_ci * The "30" adjusts the dB in the 20 accumulated samples to units of 1.5 dB. 305462306a36Sopenharmony_ci * For use in diff_gain_[abc] fields of struct iwl_calibration_cmd, the 305562306a36Sopenharmony_ci * driver should limit the difference results to a range of 0-3 (0-4.5 dB), 305662306a36Sopenharmony_ci * and set bit 2 to indicate "reduce gain". The value for the reference 305762306a36Sopenharmony_ci * (weakest) chain should be "0". 305862306a36Sopenharmony_ci * 305962306a36Sopenharmony_ci * diff_gain_[abc] bit fields: 306062306a36Sopenharmony_ci * 2: (1) reduce gain, (0) increase gain 306162306a36Sopenharmony_ci * 1-0: amount of gain, units of 1.5 dB 306262306a36Sopenharmony_ci */ 306362306a36Sopenharmony_ci 306462306a36Sopenharmony_ci/* Phy calibration command for series */ 306562306a36Sopenharmony_cienum { 306662306a36Sopenharmony_ci IWL_PHY_CALIBRATE_DC_CMD = 8, 306762306a36Sopenharmony_ci IWL_PHY_CALIBRATE_LO_CMD = 9, 306862306a36Sopenharmony_ci IWL_PHY_CALIBRATE_TX_IQ_CMD = 11, 306962306a36Sopenharmony_ci IWL_PHY_CALIBRATE_CRYSTAL_FRQ_CMD = 15, 307062306a36Sopenharmony_ci IWL_PHY_CALIBRATE_BASE_BAND_CMD = 16, 307162306a36Sopenharmony_ci IWL_PHY_CALIBRATE_TX_IQ_PERD_CMD = 17, 307262306a36Sopenharmony_ci IWL_PHY_CALIBRATE_TEMP_OFFSET_CMD = 18, 307362306a36Sopenharmony_ci}; 307462306a36Sopenharmony_ci 307562306a36Sopenharmony_ci/* This enum defines the bitmap of various calibrations to enable in both 307662306a36Sopenharmony_ci * init ucode and runtime ucode through CALIBRATION_CFG_CMD. 307762306a36Sopenharmony_ci */ 307862306a36Sopenharmony_cienum iwl_ucode_calib_cfg { 307962306a36Sopenharmony_ci IWL_CALIB_CFG_RX_BB_IDX = BIT(0), 308062306a36Sopenharmony_ci IWL_CALIB_CFG_DC_IDX = BIT(1), 308162306a36Sopenharmony_ci IWL_CALIB_CFG_LO_IDX = BIT(2), 308262306a36Sopenharmony_ci IWL_CALIB_CFG_TX_IQ_IDX = BIT(3), 308362306a36Sopenharmony_ci IWL_CALIB_CFG_RX_IQ_IDX = BIT(4), 308462306a36Sopenharmony_ci IWL_CALIB_CFG_NOISE_IDX = BIT(5), 308562306a36Sopenharmony_ci IWL_CALIB_CFG_CRYSTAL_IDX = BIT(6), 308662306a36Sopenharmony_ci IWL_CALIB_CFG_TEMPERATURE_IDX = BIT(7), 308762306a36Sopenharmony_ci IWL_CALIB_CFG_PAPD_IDX = BIT(8), 308862306a36Sopenharmony_ci IWL_CALIB_CFG_SENSITIVITY_IDX = BIT(9), 308962306a36Sopenharmony_ci IWL_CALIB_CFG_TX_PWR_IDX = BIT(10), 309062306a36Sopenharmony_ci}; 309162306a36Sopenharmony_ci 309262306a36Sopenharmony_ci#define IWL_CALIB_INIT_CFG_ALL cpu_to_le32(IWL_CALIB_CFG_RX_BB_IDX | \ 309362306a36Sopenharmony_ci IWL_CALIB_CFG_DC_IDX | \ 309462306a36Sopenharmony_ci IWL_CALIB_CFG_LO_IDX | \ 309562306a36Sopenharmony_ci IWL_CALIB_CFG_TX_IQ_IDX | \ 309662306a36Sopenharmony_ci IWL_CALIB_CFG_RX_IQ_IDX | \ 309762306a36Sopenharmony_ci IWL_CALIB_CFG_CRYSTAL_IDX) 309862306a36Sopenharmony_ci 309962306a36Sopenharmony_ci#define IWL_CALIB_RT_CFG_ALL cpu_to_le32(IWL_CALIB_CFG_RX_BB_IDX | \ 310062306a36Sopenharmony_ci IWL_CALIB_CFG_DC_IDX | \ 310162306a36Sopenharmony_ci IWL_CALIB_CFG_LO_IDX | \ 310262306a36Sopenharmony_ci IWL_CALIB_CFG_TX_IQ_IDX | \ 310362306a36Sopenharmony_ci IWL_CALIB_CFG_RX_IQ_IDX | \ 310462306a36Sopenharmony_ci IWL_CALIB_CFG_TEMPERATURE_IDX | \ 310562306a36Sopenharmony_ci IWL_CALIB_CFG_PAPD_IDX | \ 310662306a36Sopenharmony_ci IWL_CALIB_CFG_TX_PWR_IDX | \ 310762306a36Sopenharmony_ci IWL_CALIB_CFG_CRYSTAL_IDX) 310862306a36Sopenharmony_ci 310962306a36Sopenharmony_ci#define IWL_CALIB_CFG_FLAG_SEND_COMPLETE_NTFY_MSK cpu_to_le32(BIT(0)) 311062306a36Sopenharmony_ci 311162306a36Sopenharmony_cistruct iwl_calib_cfg_elmnt_s { 311262306a36Sopenharmony_ci __le32 is_enable; 311362306a36Sopenharmony_ci __le32 start; 311462306a36Sopenharmony_ci __le32 send_res; 311562306a36Sopenharmony_ci __le32 apply_res; 311662306a36Sopenharmony_ci __le32 reserved; 311762306a36Sopenharmony_ci} __packed; 311862306a36Sopenharmony_ci 311962306a36Sopenharmony_cistruct iwl_calib_cfg_status_s { 312062306a36Sopenharmony_ci struct iwl_calib_cfg_elmnt_s once; 312162306a36Sopenharmony_ci struct iwl_calib_cfg_elmnt_s perd; 312262306a36Sopenharmony_ci __le32 flags; 312362306a36Sopenharmony_ci} __packed; 312462306a36Sopenharmony_ci 312562306a36Sopenharmony_cistruct iwl_calib_cfg_cmd { 312662306a36Sopenharmony_ci struct iwl_calib_cfg_status_s ucd_calib_cfg; 312762306a36Sopenharmony_ci struct iwl_calib_cfg_status_s drv_calib_cfg; 312862306a36Sopenharmony_ci __le32 reserved1; 312962306a36Sopenharmony_ci} __packed; 313062306a36Sopenharmony_ci 313162306a36Sopenharmony_cistruct iwl_calib_hdr { 313262306a36Sopenharmony_ci u8 op_code; 313362306a36Sopenharmony_ci u8 first_group; 313462306a36Sopenharmony_ci u8 groups_num; 313562306a36Sopenharmony_ci u8 data_valid; 313662306a36Sopenharmony_ci} __packed; 313762306a36Sopenharmony_ci 313862306a36Sopenharmony_cistruct iwl_calib_cmd { 313962306a36Sopenharmony_ci struct iwl_calib_hdr hdr; 314062306a36Sopenharmony_ci u8 data[]; 314162306a36Sopenharmony_ci} __packed; 314262306a36Sopenharmony_ci 314362306a36Sopenharmony_cistruct iwl_calib_xtal_freq_cmd { 314462306a36Sopenharmony_ci struct iwl_calib_hdr hdr; 314562306a36Sopenharmony_ci u8 cap_pin1; 314662306a36Sopenharmony_ci u8 cap_pin2; 314762306a36Sopenharmony_ci u8 pad[2]; 314862306a36Sopenharmony_ci} __packed; 314962306a36Sopenharmony_ci 315062306a36Sopenharmony_ci#define DEFAULT_RADIO_SENSOR_OFFSET cpu_to_le16(2700) 315162306a36Sopenharmony_cistruct iwl_calib_temperature_offset_cmd { 315262306a36Sopenharmony_ci struct iwl_calib_hdr hdr; 315362306a36Sopenharmony_ci __le16 radio_sensor_offset; 315462306a36Sopenharmony_ci __le16 reserved; 315562306a36Sopenharmony_ci} __packed; 315662306a36Sopenharmony_ci 315762306a36Sopenharmony_cistruct iwl_calib_temperature_offset_v2_cmd { 315862306a36Sopenharmony_ci struct iwl_calib_hdr hdr; 315962306a36Sopenharmony_ci __le16 radio_sensor_offset_high; 316062306a36Sopenharmony_ci __le16 radio_sensor_offset_low; 316162306a36Sopenharmony_ci __le16 burntVoltageRef; 316262306a36Sopenharmony_ci __le16 reserved; 316362306a36Sopenharmony_ci} __packed; 316462306a36Sopenharmony_ci 316562306a36Sopenharmony_ci/* IWL_PHY_CALIBRATE_CHAIN_NOISE_RESET_CMD */ 316662306a36Sopenharmony_cistruct iwl_calib_chain_noise_reset_cmd { 316762306a36Sopenharmony_ci struct iwl_calib_hdr hdr; 316862306a36Sopenharmony_ci u8 data[]; 316962306a36Sopenharmony_ci}; 317062306a36Sopenharmony_ci 317162306a36Sopenharmony_ci/* IWL_PHY_CALIBRATE_CHAIN_NOISE_GAIN_CMD */ 317262306a36Sopenharmony_cistruct iwl_calib_chain_noise_gain_cmd { 317362306a36Sopenharmony_ci struct iwl_calib_hdr hdr; 317462306a36Sopenharmony_ci u8 delta_gain_1; 317562306a36Sopenharmony_ci u8 delta_gain_2; 317662306a36Sopenharmony_ci u8 pad[2]; 317762306a36Sopenharmony_ci} __packed; 317862306a36Sopenharmony_ci 317962306a36Sopenharmony_ci/****************************************************************************** 318062306a36Sopenharmony_ci * (12) 318162306a36Sopenharmony_ci * Miscellaneous Commands: 318262306a36Sopenharmony_ci * 318362306a36Sopenharmony_ci *****************************************************************************/ 318462306a36Sopenharmony_ci 318562306a36Sopenharmony_ci/* 318662306a36Sopenharmony_ci * LEDs Command & Response 318762306a36Sopenharmony_ci * REPLY_LEDS_CMD = 0x48 (command, has simple generic response) 318862306a36Sopenharmony_ci * 318962306a36Sopenharmony_ci * For each of 3 possible LEDs (Activity/Link/Tech, selected by "id" field), 319062306a36Sopenharmony_ci * this command turns it on or off, or sets up a periodic blinking cycle. 319162306a36Sopenharmony_ci */ 319262306a36Sopenharmony_cistruct iwl_led_cmd { 319362306a36Sopenharmony_ci __le32 interval; /* "interval" in uSec */ 319462306a36Sopenharmony_ci u8 id; /* 1: Activity, 2: Link, 3: Tech */ 319562306a36Sopenharmony_ci u8 off; /* # intervals off while blinking; 319662306a36Sopenharmony_ci * "0", with >0 "on" value, turns LED on */ 319762306a36Sopenharmony_ci u8 on; /* # intervals on while blinking; 319862306a36Sopenharmony_ci * "0", regardless of "off", turns LED off */ 319962306a36Sopenharmony_ci u8 reserved; 320062306a36Sopenharmony_ci} __packed; 320162306a36Sopenharmony_ci 320262306a36Sopenharmony_ci/* 320362306a36Sopenharmony_ci * station priority table entries 320462306a36Sopenharmony_ci * also used as potential "events" value for both 320562306a36Sopenharmony_ci * COEX_MEDIUM_NOTIFICATION and COEX_EVENT_CMD 320662306a36Sopenharmony_ci */ 320762306a36Sopenharmony_ci 320862306a36Sopenharmony_ci/* 320962306a36Sopenharmony_ci * COEX events entry flag masks 321062306a36Sopenharmony_ci * RP - Requested Priority 321162306a36Sopenharmony_ci * WP - Win Medium Priority: priority assigned when the contention has been won 321262306a36Sopenharmony_ci */ 321362306a36Sopenharmony_ci#define COEX_EVT_FLAG_MEDIUM_FREE_NTFY_FLG (0x1) 321462306a36Sopenharmony_ci#define COEX_EVT_FLAG_MEDIUM_ACTV_NTFY_FLG (0x2) 321562306a36Sopenharmony_ci#define COEX_EVT_FLAG_DELAY_MEDIUM_FREE_NTFY_FLG (0x4) 321662306a36Sopenharmony_ci 321762306a36Sopenharmony_ci#define COEX_CU_UNASSOC_IDLE_RP 4 321862306a36Sopenharmony_ci#define COEX_CU_UNASSOC_MANUAL_SCAN_RP 4 321962306a36Sopenharmony_ci#define COEX_CU_UNASSOC_AUTO_SCAN_RP 4 322062306a36Sopenharmony_ci#define COEX_CU_CALIBRATION_RP 4 322162306a36Sopenharmony_ci#define COEX_CU_PERIODIC_CALIBRATION_RP 4 322262306a36Sopenharmony_ci#define COEX_CU_CONNECTION_ESTAB_RP 4 322362306a36Sopenharmony_ci#define COEX_CU_ASSOCIATED_IDLE_RP 4 322462306a36Sopenharmony_ci#define COEX_CU_ASSOC_MANUAL_SCAN_RP 4 322562306a36Sopenharmony_ci#define COEX_CU_ASSOC_AUTO_SCAN_RP 4 322662306a36Sopenharmony_ci#define COEX_CU_ASSOC_ACTIVE_LEVEL_RP 4 322762306a36Sopenharmony_ci#define COEX_CU_RF_ON_RP 6 322862306a36Sopenharmony_ci#define COEX_CU_RF_OFF_RP 4 322962306a36Sopenharmony_ci#define COEX_CU_STAND_ALONE_DEBUG_RP 6 323062306a36Sopenharmony_ci#define COEX_CU_IPAN_ASSOC_LEVEL_RP 4 323162306a36Sopenharmony_ci#define COEX_CU_RSRVD1_RP 4 323262306a36Sopenharmony_ci#define COEX_CU_RSRVD2_RP 4 323362306a36Sopenharmony_ci 323462306a36Sopenharmony_ci#define COEX_CU_UNASSOC_IDLE_WP 3 323562306a36Sopenharmony_ci#define COEX_CU_UNASSOC_MANUAL_SCAN_WP 3 323662306a36Sopenharmony_ci#define COEX_CU_UNASSOC_AUTO_SCAN_WP 3 323762306a36Sopenharmony_ci#define COEX_CU_CALIBRATION_WP 3 323862306a36Sopenharmony_ci#define COEX_CU_PERIODIC_CALIBRATION_WP 3 323962306a36Sopenharmony_ci#define COEX_CU_CONNECTION_ESTAB_WP 3 324062306a36Sopenharmony_ci#define COEX_CU_ASSOCIATED_IDLE_WP 3 324162306a36Sopenharmony_ci#define COEX_CU_ASSOC_MANUAL_SCAN_WP 3 324262306a36Sopenharmony_ci#define COEX_CU_ASSOC_AUTO_SCAN_WP 3 324362306a36Sopenharmony_ci#define COEX_CU_ASSOC_ACTIVE_LEVEL_WP 3 324462306a36Sopenharmony_ci#define COEX_CU_RF_ON_WP 3 324562306a36Sopenharmony_ci#define COEX_CU_RF_OFF_WP 3 324662306a36Sopenharmony_ci#define COEX_CU_STAND_ALONE_DEBUG_WP 6 324762306a36Sopenharmony_ci#define COEX_CU_IPAN_ASSOC_LEVEL_WP 3 324862306a36Sopenharmony_ci#define COEX_CU_RSRVD1_WP 3 324962306a36Sopenharmony_ci#define COEX_CU_RSRVD2_WP 3 325062306a36Sopenharmony_ci 325162306a36Sopenharmony_ci#define COEX_UNASSOC_IDLE_FLAGS 0 325262306a36Sopenharmony_ci#define COEX_UNASSOC_MANUAL_SCAN_FLAGS \ 325362306a36Sopenharmony_ci (COEX_EVT_FLAG_MEDIUM_FREE_NTFY_FLG | \ 325462306a36Sopenharmony_ci COEX_EVT_FLAG_MEDIUM_ACTV_NTFY_FLG) 325562306a36Sopenharmony_ci#define COEX_UNASSOC_AUTO_SCAN_FLAGS \ 325662306a36Sopenharmony_ci (COEX_EVT_FLAG_MEDIUM_FREE_NTFY_FLG | \ 325762306a36Sopenharmony_ci COEX_EVT_FLAG_MEDIUM_ACTV_NTFY_FLG) 325862306a36Sopenharmony_ci#define COEX_CALIBRATION_FLAGS \ 325962306a36Sopenharmony_ci (COEX_EVT_FLAG_MEDIUM_FREE_NTFY_FLG | \ 326062306a36Sopenharmony_ci COEX_EVT_FLAG_MEDIUM_ACTV_NTFY_FLG) 326162306a36Sopenharmony_ci#define COEX_PERIODIC_CALIBRATION_FLAGS 0 326262306a36Sopenharmony_ci/* 326362306a36Sopenharmony_ci * COEX_CONNECTION_ESTAB: 326462306a36Sopenharmony_ci * we need DELAY_MEDIUM_FREE_NTFY to let WiMAX disconnect from network. 326562306a36Sopenharmony_ci */ 326662306a36Sopenharmony_ci#define COEX_CONNECTION_ESTAB_FLAGS \ 326762306a36Sopenharmony_ci (COEX_EVT_FLAG_MEDIUM_FREE_NTFY_FLG | \ 326862306a36Sopenharmony_ci COEX_EVT_FLAG_MEDIUM_ACTV_NTFY_FLG | \ 326962306a36Sopenharmony_ci COEX_EVT_FLAG_DELAY_MEDIUM_FREE_NTFY_FLG) 327062306a36Sopenharmony_ci#define COEX_ASSOCIATED_IDLE_FLAGS 0 327162306a36Sopenharmony_ci#define COEX_ASSOC_MANUAL_SCAN_FLAGS \ 327262306a36Sopenharmony_ci (COEX_EVT_FLAG_MEDIUM_FREE_NTFY_FLG | \ 327362306a36Sopenharmony_ci COEX_EVT_FLAG_MEDIUM_ACTV_NTFY_FLG) 327462306a36Sopenharmony_ci#define COEX_ASSOC_AUTO_SCAN_FLAGS \ 327562306a36Sopenharmony_ci (COEX_EVT_FLAG_MEDIUM_FREE_NTFY_FLG | \ 327662306a36Sopenharmony_ci COEX_EVT_FLAG_MEDIUM_ACTV_NTFY_FLG) 327762306a36Sopenharmony_ci#define COEX_ASSOC_ACTIVE_LEVEL_FLAGS 0 327862306a36Sopenharmony_ci#define COEX_RF_ON_FLAGS 0 327962306a36Sopenharmony_ci#define COEX_RF_OFF_FLAGS 0 328062306a36Sopenharmony_ci#define COEX_STAND_ALONE_DEBUG_FLAGS \ 328162306a36Sopenharmony_ci (COEX_EVT_FLAG_MEDIUM_FREE_NTFY_FLG | \ 328262306a36Sopenharmony_ci COEX_EVT_FLAG_MEDIUM_ACTV_NTFY_FLG) 328362306a36Sopenharmony_ci#define COEX_IPAN_ASSOC_LEVEL_FLAGS \ 328462306a36Sopenharmony_ci (COEX_EVT_FLAG_MEDIUM_FREE_NTFY_FLG | \ 328562306a36Sopenharmony_ci COEX_EVT_FLAG_MEDIUM_ACTV_NTFY_FLG | \ 328662306a36Sopenharmony_ci COEX_EVT_FLAG_DELAY_MEDIUM_FREE_NTFY_FLG) 328762306a36Sopenharmony_ci#define COEX_RSRVD1_FLAGS 0 328862306a36Sopenharmony_ci#define COEX_RSRVD2_FLAGS 0 328962306a36Sopenharmony_ci/* 329062306a36Sopenharmony_ci * COEX_CU_RF_ON is the event wrapping all radio ownership. 329162306a36Sopenharmony_ci * We need DELAY_MEDIUM_FREE_NTFY to let WiMAX disconnect from network. 329262306a36Sopenharmony_ci */ 329362306a36Sopenharmony_ci#define COEX_CU_RF_ON_FLAGS \ 329462306a36Sopenharmony_ci (COEX_EVT_FLAG_MEDIUM_FREE_NTFY_FLG | \ 329562306a36Sopenharmony_ci COEX_EVT_FLAG_MEDIUM_ACTV_NTFY_FLG | \ 329662306a36Sopenharmony_ci COEX_EVT_FLAG_DELAY_MEDIUM_FREE_NTFY_FLG) 329762306a36Sopenharmony_ci 329862306a36Sopenharmony_ci 329962306a36Sopenharmony_cienum { 330062306a36Sopenharmony_ci /* un-association part */ 330162306a36Sopenharmony_ci COEX_UNASSOC_IDLE = 0, 330262306a36Sopenharmony_ci COEX_UNASSOC_MANUAL_SCAN = 1, 330362306a36Sopenharmony_ci COEX_UNASSOC_AUTO_SCAN = 2, 330462306a36Sopenharmony_ci /* calibration */ 330562306a36Sopenharmony_ci COEX_CALIBRATION = 3, 330662306a36Sopenharmony_ci COEX_PERIODIC_CALIBRATION = 4, 330762306a36Sopenharmony_ci /* connection */ 330862306a36Sopenharmony_ci COEX_CONNECTION_ESTAB = 5, 330962306a36Sopenharmony_ci /* association part */ 331062306a36Sopenharmony_ci COEX_ASSOCIATED_IDLE = 6, 331162306a36Sopenharmony_ci COEX_ASSOC_MANUAL_SCAN = 7, 331262306a36Sopenharmony_ci COEX_ASSOC_AUTO_SCAN = 8, 331362306a36Sopenharmony_ci COEX_ASSOC_ACTIVE_LEVEL = 9, 331462306a36Sopenharmony_ci /* RF ON/OFF */ 331562306a36Sopenharmony_ci COEX_RF_ON = 10, 331662306a36Sopenharmony_ci COEX_RF_OFF = 11, 331762306a36Sopenharmony_ci COEX_STAND_ALONE_DEBUG = 12, 331862306a36Sopenharmony_ci /* IPAN */ 331962306a36Sopenharmony_ci COEX_IPAN_ASSOC_LEVEL = 13, 332062306a36Sopenharmony_ci /* reserved */ 332162306a36Sopenharmony_ci COEX_RSRVD1 = 14, 332262306a36Sopenharmony_ci COEX_RSRVD2 = 15, 332362306a36Sopenharmony_ci COEX_NUM_OF_EVENTS = 16 332462306a36Sopenharmony_ci}; 332562306a36Sopenharmony_ci 332662306a36Sopenharmony_ci/* 332762306a36Sopenharmony_ci * Coexistence WIFI/WIMAX Command 332862306a36Sopenharmony_ci * COEX_PRIORITY_TABLE_CMD = 0x5a 332962306a36Sopenharmony_ci * 333062306a36Sopenharmony_ci */ 333162306a36Sopenharmony_cistruct iwl_wimax_coex_event_entry { 333262306a36Sopenharmony_ci u8 request_prio; 333362306a36Sopenharmony_ci u8 win_medium_prio; 333462306a36Sopenharmony_ci u8 reserved; 333562306a36Sopenharmony_ci u8 flags; 333662306a36Sopenharmony_ci} __packed; 333762306a36Sopenharmony_ci 333862306a36Sopenharmony_ci/* COEX flag masks */ 333962306a36Sopenharmony_ci 334062306a36Sopenharmony_ci/* Station table is valid */ 334162306a36Sopenharmony_ci#define COEX_FLAGS_STA_TABLE_VALID_MSK (0x1) 334262306a36Sopenharmony_ci/* UnMask wake up src at unassociated sleep */ 334362306a36Sopenharmony_ci#define COEX_FLAGS_UNASSOC_WA_UNMASK_MSK (0x4) 334462306a36Sopenharmony_ci/* UnMask wake up src at associated sleep */ 334562306a36Sopenharmony_ci#define COEX_FLAGS_ASSOC_WA_UNMASK_MSK (0x8) 334662306a36Sopenharmony_ci/* Enable CoEx feature. */ 334762306a36Sopenharmony_ci#define COEX_FLAGS_COEX_ENABLE_MSK (0x80) 334862306a36Sopenharmony_ci 334962306a36Sopenharmony_cistruct iwl_wimax_coex_cmd { 335062306a36Sopenharmony_ci u8 flags; 335162306a36Sopenharmony_ci u8 reserved[3]; 335262306a36Sopenharmony_ci struct iwl_wimax_coex_event_entry sta_prio[COEX_NUM_OF_EVENTS]; 335362306a36Sopenharmony_ci} __packed; 335462306a36Sopenharmony_ci 335562306a36Sopenharmony_ci/* 335662306a36Sopenharmony_ci * Coexistence MEDIUM NOTIFICATION 335762306a36Sopenharmony_ci * COEX_MEDIUM_NOTIFICATION = 0x5b 335862306a36Sopenharmony_ci * 335962306a36Sopenharmony_ci * notification from uCode to host to indicate medium changes 336062306a36Sopenharmony_ci * 336162306a36Sopenharmony_ci */ 336262306a36Sopenharmony_ci/* 336362306a36Sopenharmony_ci * status field 336462306a36Sopenharmony_ci * bit 0 - 2: medium status 336562306a36Sopenharmony_ci * bit 3: medium change indication 336662306a36Sopenharmony_ci * bit 4 - 31: reserved 336762306a36Sopenharmony_ci */ 336862306a36Sopenharmony_ci/* status option values, (0 - 2 bits) */ 336962306a36Sopenharmony_ci#define COEX_MEDIUM_BUSY (0x0) /* radio belongs to WiMAX */ 337062306a36Sopenharmony_ci#define COEX_MEDIUM_ACTIVE (0x1) /* radio belongs to WiFi */ 337162306a36Sopenharmony_ci#define COEX_MEDIUM_PRE_RELEASE (0x2) /* received radio release */ 337262306a36Sopenharmony_ci#define COEX_MEDIUM_MSK (0x7) 337362306a36Sopenharmony_ci 337462306a36Sopenharmony_ci/* send notification status (1 bit) */ 337562306a36Sopenharmony_ci#define COEX_MEDIUM_CHANGED (0x8) 337662306a36Sopenharmony_ci#define COEX_MEDIUM_CHANGED_MSK (0x8) 337762306a36Sopenharmony_ci#define COEX_MEDIUM_SHIFT (3) 337862306a36Sopenharmony_ci 337962306a36Sopenharmony_cistruct iwl_coex_medium_notification { 338062306a36Sopenharmony_ci __le32 status; 338162306a36Sopenharmony_ci __le32 events; 338262306a36Sopenharmony_ci} __packed; 338362306a36Sopenharmony_ci 338462306a36Sopenharmony_ci/* 338562306a36Sopenharmony_ci * Coexistence EVENT Command 338662306a36Sopenharmony_ci * COEX_EVENT_CMD = 0x5c 338762306a36Sopenharmony_ci * 338862306a36Sopenharmony_ci * send from host to uCode for coex event request. 338962306a36Sopenharmony_ci */ 339062306a36Sopenharmony_ci/* flags options */ 339162306a36Sopenharmony_ci#define COEX_EVENT_REQUEST_MSK (0x1) 339262306a36Sopenharmony_ci 339362306a36Sopenharmony_cistruct iwl_coex_event_cmd { 339462306a36Sopenharmony_ci u8 flags; 339562306a36Sopenharmony_ci u8 event; 339662306a36Sopenharmony_ci __le16 reserved; 339762306a36Sopenharmony_ci} __packed; 339862306a36Sopenharmony_ci 339962306a36Sopenharmony_cistruct iwl_coex_event_resp { 340062306a36Sopenharmony_ci __le32 status; 340162306a36Sopenharmony_ci} __packed; 340262306a36Sopenharmony_ci 340362306a36Sopenharmony_ci 340462306a36Sopenharmony_ci/****************************************************************************** 340562306a36Sopenharmony_ci * Bluetooth Coexistence commands 340662306a36Sopenharmony_ci * 340762306a36Sopenharmony_ci *****************************************************************************/ 340862306a36Sopenharmony_ci 340962306a36Sopenharmony_ci/* 341062306a36Sopenharmony_ci * BT Status notification 341162306a36Sopenharmony_ci * REPLY_BT_COEX_PROFILE_NOTIF = 0xce 341262306a36Sopenharmony_ci */ 341362306a36Sopenharmony_cienum iwl_bt_coex_profile_traffic_load { 341462306a36Sopenharmony_ci IWL_BT_COEX_TRAFFIC_LOAD_NONE = 0, 341562306a36Sopenharmony_ci IWL_BT_COEX_TRAFFIC_LOAD_LOW = 1, 341662306a36Sopenharmony_ci IWL_BT_COEX_TRAFFIC_LOAD_HIGH = 2, 341762306a36Sopenharmony_ci IWL_BT_COEX_TRAFFIC_LOAD_CONTINUOUS = 3, 341862306a36Sopenharmony_ci/* 341962306a36Sopenharmony_ci * There are no more even though below is a u8, the 342062306a36Sopenharmony_ci * indication from the BT device only has two bits. 342162306a36Sopenharmony_ci */ 342262306a36Sopenharmony_ci}; 342362306a36Sopenharmony_ci 342462306a36Sopenharmony_ci#define BT_SESSION_ACTIVITY_1_UART_MSG 0x1 342562306a36Sopenharmony_ci#define BT_SESSION_ACTIVITY_2_UART_MSG 0x2 342662306a36Sopenharmony_ci 342762306a36Sopenharmony_ci/* BT UART message - Share Part (BT -> WiFi) */ 342862306a36Sopenharmony_ci#define BT_UART_MSG_FRAME1MSGTYPE_POS (0) 342962306a36Sopenharmony_ci#define BT_UART_MSG_FRAME1MSGTYPE_MSK \ 343062306a36Sopenharmony_ci (0x7 << BT_UART_MSG_FRAME1MSGTYPE_POS) 343162306a36Sopenharmony_ci#define BT_UART_MSG_FRAME1SSN_POS (3) 343262306a36Sopenharmony_ci#define BT_UART_MSG_FRAME1SSN_MSK \ 343362306a36Sopenharmony_ci (0x3 << BT_UART_MSG_FRAME1SSN_POS) 343462306a36Sopenharmony_ci#define BT_UART_MSG_FRAME1UPDATEREQ_POS (5) 343562306a36Sopenharmony_ci#define BT_UART_MSG_FRAME1UPDATEREQ_MSK \ 343662306a36Sopenharmony_ci (0x1 << BT_UART_MSG_FRAME1UPDATEREQ_POS) 343762306a36Sopenharmony_ci#define BT_UART_MSG_FRAME1RESERVED_POS (6) 343862306a36Sopenharmony_ci#define BT_UART_MSG_FRAME1RESERVED_MSK \ 343962306a36Sopenharmony_ci (0x3 << BT_UART_MSG_FRAME1RESERVED_POS) 344062306a36Sopenharmony_ci 344162306a36Sopenharmony_ci#define BT_UART_MSG_FRAME2OPENCONNECTIONS_POS (0) 344262306a36Sopenharmony_ci#define BT_UART_MSG_FRAME2OPENCONNECTIONS_MSK \ 344362306a36Sopenharmony_ci (0x3 << BT_UART_MSG_FRAME2OPENCONNECTIONS_POS) 344462306a36Sopenharmony_ci#define BT_UART_MSG_FRAME2TRAFFICLOAD_POS (2) 344562306a36Sopenharmony_ci#define BT_UART_MSG_FRAME2TRAFFICLOAD_MSK \ 344662306a36Sopenharmony_ci (0x3 << BT_UART_MSG_FRAME2TRAFFICLOAD_POS) 344762306a36Sopenharmony_ci#define BT_UART_MSG_FRAME2CHLSEQN_POS (4) 344862306a36Sopenharmony_ci#define BT_UART_MSG_FRAME2CHLSEQN_MSK \ 344962306a36Sopenharmony_ci (0x1 << BT_UART_MSG_FRAME2CHLSEQN_POS) 345062306a36Sopenharmony_ci#define BT_UART_MSG_FRAME2INBAND_POS (5) 345162306a36Sopenharmony_ci#define BT_UART_MSG_FRAME2INBAND_MSK \ 345262306a36Sopenharmony_ci (0x1 << BT_UART_MSG_FRAME2INBAND_POS) 345362306a36Sopenharmony_ci#define BT_UART_MSG_FRAME2RESERVED_POS (6) 345462306a36Sopenharmony_ci#define BT_UART_MSG_FRAME2RESERVED_MSK \ 345562306a36Sopenharmony_ci (0x3 << BT_UART_MSG_FRAME2RESERVED_POS) 345662306a36Sopenharmony_ci 345762306a36Sopenharmony_ci#define BT_UART_MSG_FRAME3SCOESCO_POS (0) 345862306a36Sopenharmony_ci#define BT_UART_MSG_FRAME3SCOESCO_MSK \ 345962306a36Sopenharmony_ci (0x1 << BT_UART_MSG_FRAME3SCOESCO_POS) 346062306a36Sopenharmony_ci#define BT_UART_MSG_FRAME3SNIFF_POS (1) 346162306a36Sopenharmony_ci#define BT_UART_MSG_FRAME3SNIFF_MSK \ 346262306a36Sopenharmony_ci (0x1 << BT_UART_MSG_FRAME3SNIFF_POS) 346362306a36Sopenharmony_ci#define BT_UART_MSG_FRAME3A2DP_POS (2) 346462306a36Sopenharmony_ci#define BT_UART_MSG_FRAME3A2DP_MSK \ 346562306a36Sopenharmony_ci (0x1 << BT_UART_MSG_FRAME3A2DP_POS) 346662306a36Sopenharmony_ci#define BT_UART_MSG_FRAME3ACL_POS (3) 346762306a36Sopenharmony_ci#define BT_UART_MSG_FRAME3ACL_MSK \ 346862306a36Sopenharmony_ci (0x1 << BT_UART_MSG_FRAME3ACL_POS) 346962306a36Sopenharmony_ci#define BT_UART_MSG_FRAME3MASTER_POS (4) 347062306a36Sopenharmony_ci#define BT_UART_MSG_FRAME3MASTER_MSK \ 347162306a36Sopenharmony_ci (0x1 << BT_UART_MSG_FRAME3MASTER_POS) 347262306a36Sopenharmony_ci#define BT_UART_MSG_FRAME3OBEX_POS (5) 347362306a36Sopenharmony_ci#define BT_UART_MSG_FRAME3OBEX_MSK \ 347462306a36Sopenharmony_ci (0x1 << BT_UART_MSG_FRAME3OBEX_POS) 347562306a36Sopenharmony_ci#define BT_UART_MSG_FRAME3RESERVED_POS (6) 347662306a36Sopenharmony_ci#define BT_UART_MSG_FRAME3RESERVED_MSK \ 347762306a36Sopenharmony_ci (0x3 << BT_UART_MSG_FRAME3RESERVED_POS) 347862306a36Sopenharmony_ci 347962306a36Sopenharmony_ci#define BT_UART_MSG_FRAME4IDLEDURATION_POS (0) 348062306a36Sopenharmony_ci#define BT_UART_MSG_FRAME4IDLEDURATION_MSK \ 348162306a36Sopenharmony_ci (0x3F << BT_UART_MSG_FRAME4IDLEDURATION_POS) 348262306a36Sopenharmony_ci#define BT_UART_MSG_FRAME4RESERVED_POS (6) 348362306a36Sopenharmony_ci#define BT_UART_MSG_FRAME4RESERVED_MSK \ 348462306a36Sopenharmony_ci (0x3 << BT_UART_MSG_FRAME4RESERVED_POS) 348562306a36Sopenharmony_ci 348662306a36Sopenharmony_ci#define BT_UART_MSG_FRAME5TXACTIVITY_POS (0) 348762306a36Sopenharmony_ci#define BT_UART_MSG_FRAME5TXACTIVITY_MSK \ 348862306a36Sopenharmony_ci (0x3 << BT_UART_MSG_FRAME5TXACTIVITY_POS) 348962306a36Sopenharmony_ci#define BT_UART_MSG_FRAME5RXACTIVITY_POS (2) 349062306a36Sopenharmony_ci#define BT_UART_MSG_FRAME5RXACTIVITY_MSK \ 349162306a36Sopenharmony_ci (0x3 << BT_UART_MSG_FRAME5RXACTIVITY_POS) 349262306a36Sopenharmony_ci#define BT_UART_MSG_FRAME5ESCORETRANSMIT_POS (4) 349362306a36Sopenharmony_ci#define BT_UART_MSG_FRAME5ESCORETRANSMIT_MSK \ 349462306a36Sopenharmony_ci (0x3 << BT_UART_MSG_FRAME5ESCORETRANSMIT_POS) 349562306a36Sopenharmony_ci#define BT_UART_MSG_FRAME5RESERVED_POS (6) 349662306a36Sopenharmony_ci#define BT_UART_MSG_FRAME5RESERVED_MSK \ 349762306a36Sopenharmony_ci (0x3 << BT_UART_MSG_FRAME5RESERVED_POS) 349862306a36Sopenharmony_ci 349962306a36Sopenharmony_ci#define BT_UART_MSG_FRAME6SNIFFINTERVAL_POS (0) 350062306a36Sopenharmony_ci#define BT_UART_MSG_FRAME6SNIFFINTERVAL_MSK \ 350162306a36Sopenharmony_ci (0x1F << BT_UART_MSG_FRAME6SNIFFINTERVAL_POS) 350262306a36Sopenharmony_ci#define BT_UART_MSG_FRAME6DISCOVERABLE_POS (5) 350362306a36Sopenharmony_ci#define BT_UART_MSG_FRAME6DISCOVERABLE_MSK \ 350462306a36Sopenharmony_ci (0x1 << BT_UART_MSG_FRAME6DISCOVERABLE_POS) 350562306a36Sopenharmony_ci#define BT_UART_MSG_FRAME6RESERVED_POS (6) 350662306a36Sopenharmony_ci#define BT_UART_MSG_FRAME6RESERVED_MSK \ 350762306a36Sopenharmony_ci (0x3 << BT_UART_MSG_FRAME6RESERVED_POS) 350862306a36Sopenharmony_ci 350962306a36Sopenharmony_ci#define BT_UART_MSG_FRAME7SNIFFACTIVITY_POS (0) 351062306a36Sopenharmony_ci#define BT_UART_MSG_FRAME7SNIFFACTIVITY_MSK \ 351162306a36Sopenharmony_ci (0x7 << BT_UART_MSG_FRAME7SNIFFACTIVITY_POS) 351262306a36Sopenharmony_ci#define BT_UART_MSG_FRAME7PAGE_POS (3) 351362306a36Sopenharmony_ci#define BT_UART_MSG_FRAME7PAGE_MSK \ 351462306a36Sopenharmony_ci (0x1 << BT_UART_MSG_FRAME7PAGE_POS) 351562306a36Sopenharmony_ci#define BT_UART_MSG_FRAME7INQUIRY_POS (4) 351662306a36Sopenharmony_ci#define BT_UART_MSG_FRAME7INQUIRY_MSK \ 351762306a36Sopenharmony_ci (0x1 << BT_UART_MSG_FRAME7INQUIRY_POS) 351862306a36Sopenharmony_ci#define BT_UART_MSG_FRAME7CONNECTABLE_POS (5) 351962306a36Sopenharmony_ci#define BT_UART_MSG_FRAME7CONNECTABLE_MSK \ 352062306a36Sopenharmony_ci (0x1 << BT_UART_MSG_FRAME7CONNECTABLE_POS) 352162306a36Sopenharmony_ci#define BT_UART_MSG_FRAME7RESERVED_POS (6) 352262306a36Sopenharmony_ci#define BT_UART_MSG_FRAME7RESERVED_MSK \ 352362306a36Sopenharmony_ci (0x3 << BT_UART_MSG_FRAME7RESERVED_POS) 352462306a36Sopenharmony_ci 352562306a36Sopenharmony_ci/* BT Session Activity 2 UART message (BT -> WiFi) */ 352662306a36Sopenharmony_ci#define BT_UART_MSG_2_FRAME1RESERVED1_POS (5) 352762306a36Sopenharmony_ci#define BT_UART_MSG_2_FRAME1RESERVED1_MSK \ 352862306a36Sopenharmony_ci (0x1<<BT_UART_MSG_2_FRAME1RESERVED1_POS) 352962306a36Sopenharmony_ci#define BT_UART_MSG_2_FRAME1RESERVED2_POS (6) 353062306a36Sopenharmony_ci#define BT_UART_MSG_2_FRAME1RESERVED2_MSK \ 353162306a36Sopenharmony_ci (0x3<<BT_UART_MSG_2_FRAME1RESERVED2_POS) 353262306a36Sopenharmony_ci 353362306a36Sopenharmony_ci#define BT_UART_MSG_2_FRAME2AGGTRAFFICLOAD_POS (0) 353462306a36Sopenharmony_ci#define BT_UART_MSG_2_FRAME2AGGTRAFFICLOAD_MSK \ 353562306a36Sopenharmony_ci (0x3F<<BT_UART_MSG_2_FRAME2AGGTRAFFICLOAD_POS) 353662306a36Sopenharmony_ci#define BT_UART_MSG_2_FRAME2RESERVED_POS (6) 353762306a36Sopenharmony_ci#define BT_UART_MSG_2_FRAME2RESERVED_MSK \ 353862306a36Sopenharmony_ci (0x3<<BT_UART_MSG_2_FRAME2RESERVED_POS) 353962306a36Sopenharmony_ci 354062306a36Sopenharmony_ci#define BT_UART_MSG_2_FRAME3BRLASTTXPOWER_POS (0) 354162306a36Sopenharmony_ci#define BT_UART_MSG_2_FRAME3BRLASTTXPOWER_MSK \ 354262306a36Sopenharmony_ci (0xF<<BT_UART_MSG_2_FRAME3BRLASTTXPOWER_POS) 354362306a36Sopenharmony_ci#define BT_UART_MSG_2_FRAME3INQPAGESRMODE_POS (4) 354462306a36Sopenharmony_ci#define BT_UART_MSG_2_FRAME3INQPAGESRMODE_MSK \ 354562306a36Sopenharmony_ci (0x1<<BT_UART_MSG_2_FRAME3INQPAGESRMODE_POS) 354662306a36Sopenharmony_ci#define BT_UART_MSG_2_FRAME3LEMASTER_POS (5) 354762306a36Sopenharmony_ci#define BT_UART_MSG_2_FRAME3LEMASTER_MSK \ 354862306a36Sopenharmony_ci (0x1<<BT_UART_MSG_2_FRAME3LEMASTER_POS) 354962306a36Sopenharmony_ci#define BT_UART_MSG_2_FRAME3RESERVED_POS (6) 355062306a36Sopenharmony_ci#define BT_UART_MSG_2_FRAME3RESERVED_MSK \ 355162306a36Sopenharmony_ci (0x3<<BT_UART_MSG_2_FRAME3RESERVED_POS) 355262306a36Sopenharmony_ci 355362306a36Sopenharmony_ci#define BT_UART_MSG_2_FRAME4LELASTTXPOWER_POS (0) 355462306a36Sopenharmony_ci#define BT_UART_MSG_2_FRAME4LELASTTXPOWER_MSK \ 355562306a36Sopenharmony_ci (0xF<<BT_UART_MSG_2_FRAME4LELASTTXPOWER_POS) 355662306a36Sopenharmony_ci#define BT_UART_MSG_2_FRAME4NUMLECONN_POS (4) 355762306a36Sopenharmony_ci#define BT_UART_MSG_2_FRAME4NUMLECONN_MSK \ 355862306a36Sopenharmony_ci (0x3<<BT_UART_MSG_2_FRAME4NUMLECONN_POS) 355962306a36Sopenharmony_ci#define BT_UART_MSG_2_FRAME4RESERVED_POS (6) 356062306a36Sopenharmony_ci#define BT_UART_MSG_2_FRAME4RESERVED_MSK \ 356162306a36Sopenharmony_ci (0x3<<BT_UART_MSG_2_FRAME4RESERVED_POS) 356262306a36Sopenharmony_ci 356362306a36Sopenharmony_ci#define BT_UART_MSG_2_FRAME5BTMINRSSI_POS (0) 356462306a36Sopenharmony_ci#define BT_UART_MSG_2_FRAME5BTMINRSSI_MSK \ 356562306a36Sopenharmony_ci (0xF<<BT_UART_MSG_2_FRAME5BTMINRSSI_POS) 356662306a36Sopenharmony_ci#define BT_UART_MSG_2_FRAME5LESCANINITMODE_POS (4) 356762306a36Sopenharmony_ci#define BT_UART_MSG_2_FRAME5LESCANINITMODE_MSK \ 356862306a36Sopenharmony_ci (0x1<<BT_UART_MSG_2_FRAME5LESCANINITMODE_POS) 356962306a36Sopenharmony_ci#define BT_UART_MSG_2_FRAME5LEADVERMODE_POS (5) 357062306a36Sopenharmony_ci#define BT_UART_MSG_2_FRAME5LEADVERMODE_MSK \ 357162306a36Sopenharmony_ci (0x1<<BT_UART_MSG_2_FRAME5LEADVERMODE_POS) 357262306a36Sopenharmony_ci#define BT_UART_MSG_2_FRAME5RESERVED_POS (6) 357362306a36Sopenharmony_ci#define BT_UART_MSG_2_FRAME5RESERVED_MSK \ 357462306a36Sopenharmony_ci (0x3<<BT_UART_MSG_2_FRAME5RESERVED_POS) 357562306a36Sopenharmony_ci 357662306a36Sopenharmony_ci#define BT_UART_MSG_2_FRAME6LECONNINTERVAL_POS (0) 357762306a36Sopenharmony_ci#define BT_UART_MSG_2_FRAME6LECONNINTERVAL_MSK \ 357862306a36Sopenharmony_ci (0x1F<<BT_UART_MSG_2_FRAME6LECONNINTERVAL_POS) 357962306a36Sopenharmony_ci#define BT_UART_MSG_2_FRAME6RFU_POS (5) 358062306a36Sopenharmony_ci#define BT_UART_MSG_2_FRAME6RFU_MSK \ 358162306a36Sopenharmony_ci (0x1<<BT_UART_MSG_2_FRAME6RFU_POS) 358262306a36Sopenharmony_ci#define BT_UART_MSG_2_FRAME6RESERVED_POS (6) 358362306a36Sopenharmony_ci#define BT_UART_MSG_2_FRAME6RESERVED_MSK \ 358462306a36Sopenharmony_ci (0x3<<BT_UART_MSG_2_FRAME6RESERVED_POS) 358562306a36Sopenharmony_ci 358662306a36Sopenharmony_ci#define BT_UART_MSG_2_FRAME7LECONNSLAVELAT_POS (0) 358762306a36Sopenharmony_ci#define BT_UART_MSG_2_FRAME7LECONNSLAVELAT_MSK \ 358862306a36Sopenharmony_ci (0x7<<BT_UART_MSG_2_FRAME7LECONNSLAVELAT_POS) 358962306a36Sopenharmony_ci#define BT_UART_MSG_2_FRAME7LEPROFILE1_POS (3) 359062306a36Sopenharmony_ci#define BT_UART_MSG_2_FRAME7LEPROFILE1_MSK \ 359162306a36Sopenharmony_ci (0x1<<BT_UART_MSG_2_FRAME7LEPROFILE1_POS) 359262306a36Sopenharmony_ci#define BT_UART_MSG_2_FRAME7LEPROFILE2_POS (4) 359362306a36Sopenharmony_ci#define BT_UART_MSG_2_FRAME7LEPROFILE2_MSK \ 359462306a36Sopenharmony_ci (0x1<<BT_UART_MSG_2_FRAME7LEPROFILE2_POS) 359562306a36Sopenharmony_ci#define BT_UART_MSG_2_FRAME7LEPROFILEOTHER_POS (5) 359662306a36Sopenharmony_ci#define BT_UART_MSG_2_FRAME7LEPROFILEOTHER_MSK \ 359762306a36Sopenharmony_ci (0x1<<BT_UART_MSG_2_FRAME7LEPROFILEOTHER_POS) 359862306a36Sopenharmony_ci#define BT_UART_MSG_2_FRAME7RESERVED_POS (6) 359962306a36Sopenharmony_ci#define BT_UART_MSG_2_FRAME7RESERVED_MSK \ 360062306a36Sopenharmony_ci (0x3<<BT_UART_MSG_2_FRAME7RESERVED_POS) 360162306a36Sopenharmony_ci 360262306a36Sopenharmony_ci 360362306a36Sopenharmony_ci#define BT_ENABLE_REDUCED_TXPOWER_THRESHOLD (-62) 360462306a36Sopenharmony_ci#define BT_DISABLE_REDUCED_TXPOWER_THRESHOLD (-65) 360562306a36Sopenharmony_ci 360662306a36Sopenharmony_cistruct iwl_bt_uart_msg { 360762306a36Sopenharmony_ci u8 header; 360862306a36Sopenharmony_ci u8 frame1; 360962306a36Sopenharmony_ci u8 frame2; 361062306a36Sopenharmony_ci u8 frame3; 361162306a36Sopenharmony_ci u8 frame4; 361262306a36Sopenharmony_ci u8 frame5; 361362306a36Sopenharmony_ci u8 frame6; 361462306a36Sopenharmony_ci u8 frame7; 361562306a36Sopenharmony_ci} __packed; 361662306a36Sopenharmony_ci 361762306a36Sopenharmony_cistruct iwl_bt_coex_profile_notif { 361862306a36Sopenharmony_ci struct iwl_bt_uart_msg last_bt_uart_msg; 361962306a36Sopenharmony_ci u8 bt_status; /* 0 - off, 1 - on */ 362062306a36Sopenharmony_ci u8 bt_traffic_load; /* 0 .. 3? */ 362162306a36Sopenharmony_ci u8 bt_ci_compliance; /* 0 - not complied, 1 - complied */ 362262306a36Sopenharmony_ci u8 reserved; 362362306a36Sopenharmony_ci} __packed; 362462306a36Sopenharmony_ci 362562306a36Sopenharmony_ci#define IWL_BT_COEX_PRIO_TBL_SHARED_ANTENNA_POS 0 362662306a36Sopenharmony_ci#define IWL_BT_COEX_PRIO_TBL_SHARED_ANTENNA_MSK 0x1 362762306a36Sopenharmony_ci#define IWL_BT_COEX_PRIO_TBL_PRIO_POS 1 362862306a36Sopenharmony_ci#define IWL_BT_COEX_PRIO_TBL_PRIO_MASK 0x0e 362962306a36Sopenharmony_ci#define IWL_BT_COEX_PRIO_TBL_RESERVED_POS 4 363062306a36Sopenharmony_ci#define IWL_BT_COEX_PRIO_TBL_RESERVED_MASK 0xf0 363162306a36Sopenharmony_ci#define IWL_BT_COEX_PRIO_TBL_PRIO_SHIFT 1 363262306a36Sopenharmony_ci 363362306a36Sopenharmony_ci/* 363462306a36Sopenharmony_ci * BT Coexistence Priority table 363562306a36Sopenharmony_ci * REPLY_BT_COEX_PRIO_TABLE = 0xcc 363662306a36Sopenharmony_ci */ 363762306a36Sopenharmony_cienum bt_coex_prio_table_events { 363862306a36Sopenharmony_ci BT_COEX_PRIO_TBL_EVT_INIT_CALIB1 = 0, 363962306a36Sopenharmony_ci BT_COEX_PRIO_TBL_EVT_INIT_CALIB2 = 1, 364062306a36Sopenharmony_ci BT_COEX_PRIO_TBL_EVT_PERIODIC_CALIB_LOW1 = 2, 364162306a36Sopenharmony_ci BT_COEX_PRIO_TBL_EVT_PERIODIC_CALIB_LOW2 = 3, /* DC calib */ 364262306a36Sopenharmony_ci BT_COEX_PRIO_TBL_EVT_PERIODIC_CALIB_HIGH1 = 4, 364362306a36Sopenharmony_ci BT_COEX_PRIO_TBL_EVT_PERIODIC_CALIB_HIGH2 = 5, 364462306a36Sopenharmony_ci BT_COEX_PRIO_TBL_EVT_DTIM = 6, 364562306a36Sopenharmony_ci BT_COEX_PRIO_TBL_EVT_SCAN52 = 7, 364662306a36Sopenharmony_ci BT_COEX_PRIO_TBL_EVT_SCAN24 = 8, 364762306a36Sopenharmony_ci BT_COEX_PRIO_TBL_EVT_RESERVED0 = 9, 364862306a36Sopenharmony_ci BT_COEX_PRIO_TBL_EVT_RESERVED1 = 10, 364962306a36Sopenharmony_ci BT_COEX_PRIO_TBL_EVT_RESERVED2 = 11, 365062306a36Sopenharmony_ci BT_COEX_PRIO_TBL_EVT_RESERVED3 = 12, 365162306a36Sopenharmony_ci BT_COEX_PRIO_TBL_EVT_RESERVED4 = 13, 365262306a36Sopenharmony_ci BT_COEX_PRIO_TBL_EVT_RESERVED5 = 14, 365362306a36Sopenharmony_ci BT_COEX_PRIO_TBL_EVT_RESERVED6 = 15, 365462306a36Sopenharmony_ci /* BT_COEX_PRIO_TBL_EVT_MAX should always be last */ 365562306a36Sopenharmony_ci BT_COEX_PRIO_TBL_EVT_MAX, 365662306a36Sopenharmony_ci}; 365762306a36Sopenharmony_ci 365862306a36Sopenharmony_cienum bt_coex_prio_table_priorities { 365962306a36Sopenharmony_ci BT_COEX_PRIO_TBL_DISABLED = 0, 366062306a36Sopenharmony_ci BT_COEX_PRIO_TBL_PRIO_LOW = 1, 366162306a36Sopenharmony_ci BT_COEX_PRIO_TBL_PRIO_HIGH = 2, 366262306a36Sopenharmony_ci BT_COEX_PRIO_TBL_PRIO_BYPASS = 3, 366362306a36Sopenharmony_ci BT_COEX_PRIO_TBL_PRIO_COEX_OFF = 4, 366462306a36Sopenharmony_ci BT_COEX_PRIO_TBL_PRIO_COEX_ON = 5, 366562306a36Sopenharmony_ci BT_COEX_PRIO_TBL_PRIO_RSRVD1 = 6, 366662306a36Sopenharmony_ci BT_COEX_PRIO_TBL_PRIO_RSRVD2 = 7, 366762306a36Sopenharmony_ci BT_COEX_PRIO_TBL_MAX, 366862306a36Sopenharmony_ci}; 366962306a36Sopenharmony_ci 367062306a36Sopenharmony_cistruct iwl_bt_coex_prio_table_cmd { 367162306a36Sopenharmony_ci u8 prio_tbl[BT_COEX_PRIO_TBL_EVT_MAX]; 367262306a36Sopenharmony_ci} __packed; 367362306a36Sopenharmony_ci 367462306a36Sopenharmony_ci#define IWL_BT_COEX_ENV_CLOSE 0 367562306a36Sopenharmony_ci#define IWL_BT_COEX_ENV_OPEN 1 367662306a36Sopenharmony_ci/* 367762306a36Sopenharmony_ci * BT Protection Envelope 367862306a36Sopenharmony_ci * REPLY_BT_COEX_PROT_ENV = 0xcd 367962306a36Sopenharmony_ci */ 368062306a36Sopenharmony_cistruct iwl_bt_coex_prot_env_cmd { 368162306a36Sopenharmony_ci u8 action; /* 0 = closed, 1 = open */ 368262306a36Sopenharmony_ci u8 type; /* 0 .. 15 */ 368362306a36Sopenharmony_ci u8 reserved[2]; 368462306a36Sopenharmony_ci} __packed; 368562306a36Sopenharmony_ci 368662306a36Sopenharmony_ci/* 368762306a36Sopenharmony_ci * REPLY_D3_CONFIG 368862306a36Sopenharmony_ci */ 368962306a36Sopenharmony_cienum iwlagn_d3_wakeup_filters { 369062306a36Sopenharmony_ci IWLAGN_D3_WAKEUP_RFKILL = BIT(0), 369162306a36Sopenharmony_ci IWLAGN_D3_WAKEUP_SYSASSERT = BIT(1), 369262306a36Sopenharmony_ci}; 369362306a36Sopenharmony_ci 369462306a36Sopenharmony_cistruct iwlagn_d3_config_cmd { 369562306a36Sopenharmony_ci __le32 min_sleep_time; 369662306a36Sopenharmony_ci __le32 wakeup_flags; 369762306a36Sopenharmony_ci} __packed; 369862306a36Sopenharmony_ci 369962306a36Sopenharmony_ci/* 370062306a36Sopenharmony_ci * REPLY_WOWLAN_PATTERNS 370162306a36Sopenharmony_ci */ 370262306a36Sopenharmony_ci#define IWLAGN_WOWLAN_MIN_PATTERN_LEN 16 370362306a36Sopenharmony_ci#define IWLAGN_WOWLAN_MAX_PATTERN_LEN 128 370462306a36Sopenharmony_ci 370562306a36Sopenharmony_cistruct iwlagn_wowlan_pattern { 370662306a36Sopenharmony_ci u8 mask[IWLAGN_WOWLAN_MAX_PATTERN_LEN / 8]; 370762306a36Sopenharmony_ci u8 pattern[IWLAGN_WOWLAN_MAX_PATTERN_LEN]; 370862306a36Sopenharmony_ci u8 mask_size; 370962306a36Sopenharmony_ci u8 pattern_size; 371062306a36Sopenharmony_ci __le16 reserved; 371162306a36Sopenharmony_ci} __packed; 371262306a36Sopenharmony_ci 371362306a36Sopenharmony_ci#define IWLAGN_WOWLAN_MAX_PATTERNS 20 371462306a36Sopenharmony_ci 371562306a36Sopenharmony_cistruct iwlagn_wowlan_patterns_cmd { 371662306a36Sopenharmony_ci __le32 n_patterns; 371762306a36Sopenharmony_ci struct iwlagn_wowlan_pattern patterns[]; 371862306a36Sopenharmony_ci} __packed; 371962306a36Sopenharmony_ci 372062306a36Sopenharmony_ci/* 372162306a36Sopenharmony_ci * REPLY_WOWLAN_WAKEUP_FILTER 372262306a36Sopenharmony_ci */ 372362306a36Sopenharmony_cienum iwlagn_wowlan_wakeup_filters { 372462306a36Sopenharmony_ci IWLAGN_WOWLAN_WAKEUP_MAGIC_PACKET = BIT(0), 372562306a36Sopenharmony_ci IWLAGN_WOWLAN_WAKEUP_PATTERN_MATCH = BIT(1), 372662306a36Sopenharmony_ci IWLAGN_WOWLAN_WAKEUP_BEACON_MISS = BIT(2), 372762306a36Sopenharmony_ci IWLAGN_WOWLAN_WAKEUP_LINK_CHANGE = BIT(3), 372862306a36Sopenharmony_ci IWLAGN_WOWLAN_WAKEUP_GTK_REKEY_FAIL = BIT(4), 372962306a36Sopenharmony_ci IWLAGN_WOWLAN_WAKEUP_EAP_IDENT_REQ = BIT(5), 373062306a36Sopenharmony_ci IWLAGN_WOWLAN_WAKEUP_4WAY_HANDSHAKE = BIT(6), 373162306a36Sopenharmony_ci IWLAGN_WOWLAN_WAKEUP_ALWAYS = BIT(7), 373262306a36Sopenharmony_ci IWLAGN_WOWLAN_WAKEUP_ENABLE_NET_DETECT = BIT(8), 373362306a36Sopenharmony_ci}; 373462306a36Sopenharmony_ci 373562306a36Sopenharmony_cistruct iwlagn_wowlan_wakeup_filter_cmd { 373662306a36Sopenharmony_ci __le32 enabled; 373762306a36Sopenharmony_ci __le16 non_qos_seq; 373862306a36Sopenharmony_ci __le16 reserved; 373962306a36Sopenharmony_ci __le16 qos_seq[8]; 374062306a36Sopenharmony_ci}; 374162306a36Sopenharmony_ci 374262306a36Sopenharmony_ci/* 374362306a36Sopenharmony_ci * REPLY_WOWLAN_TSC_RSC_PARAMS 374462306a36Sopenharmony_ci */ 374562306a36Sopenharmony_ci#define IWLAGN_NUM_RSC 16 374662306a36Sopenharmony_ci 374762306a36Sopenharmony_cistruct tkip_sc { 374862306a36Sopenharmony_ci __le16 iv16; 374962306a36Sopenharmony_ci __le16 pad; 375062306a36Sopenharmony_ci __le32 iv32; 375162306a36Sopenharmony_ci} __packed; 375262306a36Sopenharmony_ci 375362306a36Sopenharmony_cistruct iwlagn_tkip_rsc_tsc { 375462306a36Sopenharmony_ci struct tkip_sc unicast_rsc[IWLAGN_NUM_RSC]; 375562306a36Sopenharmony_ci struct tkip_sc multicast_rsc[IWLAGN_NUM_RSC]; 375662306a36Sopenharmony_ci struct tkip_sc tsc; 375762306a36Sopenharmony_ci} __packed; 375862306a36Sopenharmony_ci 375962306a36Sopenharmony_cistruct aes_sc { 376062306a36Sopenharmony_ci __le64 pn; 376162306a36Sopenharmony_ci} __packed; 376262306a36Sopenharmony_ci 376362306a36Sopenharmony_cistruct iwlagn_aes_rsc_tsc { 376462306a36Sopenharmony_ci struct aes_sc unicast_rsc[IWLAGN_NUM_RSC]; 376562306a36Sopenharmony_ci struct aes_sc multicast_rsc[IWLAGN_NUM_RSC]; 376662306a36Sopenharmony_ci struct aes_sc tsc; 376762306a36Sopenharmony_ci} __packed; 376862306a36Sopenharmony_ci 376962306a36Sopenharmony_ciunion iwlagn_all_tsc_rsc { 377062306a36Sopenharmony_ci struct iwlagn_tkip_rsc_tsc tkip; 377162306a36Sopenharmony_ci struct iwlagn_aes_rsc_tsc aes; 377262306a36Sopenharmony_ci}; 377362306a36Sopenharmony_ci 377462306a36Sopenharmony_cistruct iwlagn_wowlan_rsc_tsc_params_cmd { 377562306a36Sopenharmony_ci union iwlagn_all_tsc_rsc all_tsc_rsc; 377662306a36Sopenharmony_ci} __packed; 377762306a36Sopenharmony_ci 377862306a36Sopenharmony_ci/* 377962306a36Sopenharmony_ci * REPLY_WOWLAN_TKIP_PARAMS 378062306a36Sopenharmony_ci */ 378162306a36Sopenharmony_ci#define IWLAGN_MIC_KEY_SIZE 8 378262306a36Sopenharmony_ci#define IWLAGN_P1K_SIZE 5 378362306a36Sopenharmony_cistruct iwlagn_mic_keys { 378462306a36Sopenharmony_ci u8 tx[IWLAGN_MIC_KEY_SIZE]; 378562306a36Sopenharmony_ci u8 rx_unicast[IWLAGN_MIC_KEY_SIZE]; 378662306a36Sopenharmony_ci u8 rx_mcast[IWLAGN_MIC_KEY_SIZE]; 378762306a36Sopenharmony_ci} __packed; 378862306a36Sopenharmony_ci 378962306a36Sopenharmony_cistruct iwlagn_p1k_cache { 379062306a36Sopenharmony_ci __le16 p1k[IWLAGN_P1K_SIZE]; 379162306a36Sopenharmony_ci} __packed; 379262306a36Sopenharmony_ci 379362306a36Sopenharmony_ci#define IWLAGN_NUM_RX_P1K_CACHE 2 379462306a36Sopenharmony_ci 379562306a36Sopenharmony_cistruct iwlagn_wowlan_tkip_params_cmd { 379662306a36Sopenharmony_ci struct iwlagn_mic_keys mic_keys; 379762306a36Sopenharmony_ci struct iwlagn_p1k_cache tx; 379862306a36Sopenharmony_ci struct iwlagn_p1k_cache rx_uni[IWLAGN_NUM_RX_P1K_CACHE]; 379962306a36Sopenharmony_ci struct iwlagn_p1k_cache rx_multi[IWLAGN_NUM_RX_P1K_CACHE]; 380062306a36Sopenharmony_ci} __packed; 380162306a36Sopenharmony_ci 380262306a36Sopenharmony_ci/* 380362306a36Sopenharmony_ci * REPLY_WOWLAN_KEK_KCK_MATERIAL 380462306a36Sopenharmony_ci */ 380562306a36Sopenharmony_ci 380662306a36Sopenharmony_ci#define IWLAGN_KCK_MAX_SIZE 32 380762306a36Sopenharmony_ci#define IWLAGN_KEK_MAX_SIZE 32 380862306a36Sopenharmony_ci 380962306a36Sopenharmony_cistruct iwlagn_wowlan_kek_kck_material_cmd { 381062306a36Sopenharmony_ci u8 kck[IWLAGN_KCK_MAX_SIZE]; 381162306a36Sopenharmony_ci u8 kek[IWLAGN_KEK_MAX_SIZE]; 381262306a36Sopenharmony_ci __le16 kck_len; 381362306a36Sopenharmony_ci __le16 kek_len; 381462306a36Sopenharmony_ci __le64 replay_ctr; 381562306a36Sopenharmony_ci} __packed; 381662306a36Sopenharmony_ci 381762306a36Sopenharmony_ci#define RF_KILL_INDICATOR_FOR_WOWLAN 0x87 381862306a36Sopenharmony_ci 381962306a36Sopenharmony_ci/* 382062306a36Sopenharmony_ci * REPLY_WOWLAN_GET_STATUS = 0xe5 382162306a36Sopenharmony_ci */ 382262306a36Sopenharmony_cistruct iwlagn_wowlan_status { 382362306a36Sopenharmony_ci __le64 replay_ctr; 382462306a36Sopenharmony_ci __le32 rekey_status; 382562306a36Sopenharmony_ci __le32 wakeup_reason; 382662306a36Sopenharmony_ci u8 pattern_number; 382762306a36Sopenharmony_ci u8 reserved1; 382862306a36Sopenharmony_ci __le16 qos_seq_ctr[8]; 382962306a36Sopenharmony_ci __le16 non_qos_seq_ctr; 383062306a36Sopenharmony_ci __le16 reserved2; 383162306a36Sopenharmony_ci union iwlagn_all_tsc_rsc tsc_rsc; 383262306a36Sopenharmony_ci __le16 reserved3; 383362306a36Sopenharmony_ci} __packed; 383462306a36Sopenharmony_ci 383562306a36Sopenharmony_ci/* 383662306a36Sopenharmony_ci * REPLY_WIPAN_PARAMS = 0xb2 (Commands and Notification) 383762306a36Sopenharmony_ci */ 383862306a36Sopenharmony_ci 383962306a36Sopenharmony_ci/* 384062306a36Sopenharmony_ci * Minimum slot time in TU 384162306a36Sopenharmony_ci */ 384262306a36Sopenharmony_ci#define IWL_MIN_SLOT_TIME 20 384362306a36Sopenharmony_ci 384462306a36Sopenharmony_ci/** 384562306a36Sopenharmony_ci * struct iwl_wipan_slot 384662306a36Sopenharmony_ci * @width: Time in TU 384762306a36Sopenharmony_ci * @type: 384862306a36Sopenharmony_ci * 0 - BSS 384962306a36Sopenharmony_ci * 1 - PAN 385062306a36Sopenharmony_ci */ 385162306a36Sopenharmony_cistruct iwl_wipan_slot { 385262306a36Sopenharmony_ci __le16 width; 385362306a36Sopenharmony_ci u8 type; 385462306a36Sopenharmony_ci u8 reserved; 385562306a36Sopenharmony_ci} __packed; 385662306a36Sopenharmony_ci 385762306a36Sopenharmony_ci#define IWL_WIPAN_PARAMS_FLG_LEAVE_CHANNEL_CTS BIT(1) /* reserved */ 385862306a36Sopenharmony_ci#define IWL_WIPAN_PARAMS_FLG_LEAVE_CHANNEL_QUIET BIT(2) /* reserved */ 385962306a36Sopenharmony_ci#define IWL_WIPAN_PARAMS_FLG_SLOTTED_MODE BIT(3) /* reserved */ 386062306a36Sopenharmony_ci#define IWL_WIPAN_PARAMS_FLG_FILTER_BEACON_NOTIF BIT(4) 386162306a36Sopenharmony_ci#define IWL_WIPAN_PARAMS_FLG_FULL_SLOTTED_MODE BIT(5) 386262306a36Sopenharmony_ci 386362306a36Sopenharmony_ci/** 386462306a36Sopenharmony_ci * struct iwl_wipan_params_cmd 386562306a36Sopenharmony_ci * @flags: 386662306a36Sopenharmony_ci * bit0: reserved 386762306a36Sopenharmony_ci * bit1: CP leave channel with CTS 386862306a36Sopenharmony_ci * bit2: CP leave channel qith Quiet 386962306a36Sopenharmony_ci * bit3: slotted mode 387062306a36Sopenharmony_ci * 1 - work in slotted mode 387162306a36Sopenharmony_ci * 0 - work in non slotted mode 387262306a36Sopenharmony_ci * bit4: filter beacon notification 387362306a36Sopenharmony_ci * bit5: full tx slotted mode. if this flag is set, 387462306a36Sopenharmony_ci * uCode will perform leaving channel methods in context switch 387562306a36Sopenharmony_ci * also when working in same channel mode 387662306a36Sopenharmony_ci * @num_slots: 1 - 10 387762306a36Sopenharmony_ci */ 387862306a36Sopenharmony_cistruct iwl_wipan_params_cmd { 387962306a36Sopenharmony_ci __le16 flags; 388062306a36Sopenharmony_ci u8 reserved; 388162306a36Sopenharmony_ci u8 num_slots; 388262306a36Sopenharmony_ci struct iwl_wipan_slot slots[10]; 388362306a36Sopenharmony_ci} __packed; 388462306a36Sopenharmony_ci 388562306a36Sopenharmony_ci/* 388662306a36Sopenharmony_ci * REPLY_WIPAN_P2P_CHANNEL_SWITCH = 0xb9 388762306a36Sopenharmony_ci * 388862306a36Sopenharmony_ci * TODO: Figure out what this is used for, 388962306a36Sopenharmony_ci * it can only switch between 2.4 GHz 389062306a36Sopenharmony_ci * channels!! 389162306a36Sopenharmony_ci */ 389262306a36Sopenharmony_ci 389362306a36Sopenharmony_cistruct iwl_wipan_p2p_channel_switch_cmd { 389462306a36Sopenharmony_ci __le16 channel; 389562306a36Sopenharmony_ci __le16 reserved; 389662306a36Sopenharmony_ci}; 389762306a36Sopenharmony_ci 389862306a36Sopenharmony_ci/* 389962306a36Sopenharmony_ci * REPLY_WIPAN_NOA_NOTIFICATION = 0xbc 390062306a36Sopenharmony_ci * 390162306a36Sopenharmony_ci * This is used by the device to notify us of the 390262306a36Sopenharmony_ci * NoA schedule it determined so we can forward it 390362306a36Sopenharmony_ci * to userspace for inclusion in probe responses. 390462306a36Sopenharmony_ci * 390562306a36Sopenharmony_ci * In beacons, the NoA schedule is simply appended 390662306a36Sopenharmony_ci * to the frame we give the device. 390762306a36Sopenharmony_ci */ 390862306a36Sopenharmony_ci 390962306a36Sopenharmony_cistruct iwl_wipan_noa_descriptor { 391062306a36Sopenharmony_ci u8 count; 391162306a36Sopenharmony_ci __le32 duration; 391262306a36Sopenharmony_ci __le32 interval; 391362306a36Sopenharmony_ci __le32 starttime; 391462306a36Sopenharmony_ci} __packed; 391562306a36Sopenharmony_ci 391662306a36Sopenharmony_cistruct iwl_wipan_noa_attribute { 391762306a36Sopenharmony_ci u8 id; 391862306a36Sopenharmony_ci __le16 length; 391962306a36Sopenharmony_ci u8 index; 392062306a36Sopenharmony_ci u8 ct_window; 392162306a36Sopenharmony_ci struct iwl_wipan_noa_descriptor descr0, descr1; 392262306a36Sopenharmony_ci u8 reserved; 392362306a36Sopenharmony_ci} __packed; 392462306a36Sopenharmony_ci 392562306a36Sopenharmony_cistruct iwl_wipan_noa_notification { 392662306a36Sopenharmony_ci u32 noa_active; 392762306a36Sopenharmony_ci struct iwl_wipan_noa_attribute noa_attribute; 392862306a36Sopenharmony_ci} __packed; 392962306a36Sopenharmony_ci 393062306a36Sopenharmony_ci#endif /* __iwl_commands_h__ */ 3931