18c2ecf20Sopenharmony_ci/******************************************************************************
28c2ecf20Sopenharmony_ci *
38c2ecf20Sopenharmony_ci * This file is provided under a dual BSD/GPLv2 license.  When using or
48c2ecf20Sopenharmony_ci * redistributing this file, you may do so under either license.
58c2ecf20Sopenharmony_ci *
68c2ecf20Sopenharmony_ci * GPL LICENSE SUMMARY
78c2ecf20Sopenharmony_ci *
88c2ecf20Sopenharmony_ci * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
98c2ecf20Sopenharmony_ci * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
108c2ecf20Sopenharmony_ci * Copyright(c) 2008 - 2014, 2018 - 2020 Intel Corporation
118c2ecf20Sopenharmony_ci *
128c2ecf20Sopenharmony_ci * This program is free software; you can redistribute it and/or modify
138c2ecf20Sopenharmony_ci * it under the terms of version 2 of the GNU General Public License as
148c2ecf20Sopenharmony_ci * published by the Free Software Foundation.
158c2ecf20Sopenharmony_ci *
168c2ecf20Sopenharmony_ci * This program is distributed in the hope that it will be useful, but
178c2ecf20Sopenharmony_ci * WITHOUT ANY WARRANTY; without even the implied warranty of
188c2ecf20Sopenharmony_ci * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
198c2ecf20Sopenharmony_ci * General Public License for more details.
208c2ecf20Sopenharmony_ci *
218c2ecf20Sopenharmony_ci * The full GNU General Public License is included in this distribution
228c2ecf20Sopenharmony_ci * in the file called COPYING.
238c2ecf20Sopenharmony_ci *
248c2ecf20Sopenharmony_ci * Contact Information:
258c2ecf20Sopenharmony_ci *  Intel Linux Wireless <linuxwifi@intel.com>
268c2ecf20Sopenharmony_ci * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
278c2ecf20Sopenharmony_ci *
288c2ecf20Sopenharmony_ci * BSD LICENSE
298c2ecf20Sopenharmony_ci *
308c2ecf20Sopenharmony_ci * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
318c2ecf20Sopenharmony_ci * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
328c2ecf20Sopenharmony_ci * Copyright(c) 2008 - 2014, 2018 - 2020 Intel Corporation
338c2ecf20Sopenharmony_ci * All rights reserved.
348c2ecf20Sopenharmony_ci *
358c2ecf20Sopenharmony_ci * Redistribution and use in source and binary forms, with or without
368c2ecf20Sopenharmony_ci * modification, are permitted provided that the following conditions
378c2ecf20Sopenharmony_ci * are met:
388c2ecf20Sopenharmony_ci *
398c2ecf20Sopenharmony_ci *  * Redistributions of source code must retain the above copyright
408c2ecf20Sopenharmony_ci *    notice, this list of conditions and the following disclaimer.
418c2ecf20Sopenharmony_ci *  * Redistributions in binary form must reproduce the above copyright
428c2ecf20Sopenharmony_ci *    notice, this list of conditions and the following disclaimer in
438c2ecf20Sopenharmony_ci *    the documentation and/or other materials provided with the
448c2ecf20Sopenharmony_ci *    distribution.
458c2ecf20Sopenharmony_ci *  * Neither the name Intel Corporation nor the names of its
468c2ecf20Sopenharmony_ci *    contributors may be used to endorse or promote products derived
478c2ecf20Sopenharmony_ci *    from this software without specific prior written permission.
488c2ecf20Sopenharmony_ci *
498c2ecf20Sopenharmony_ci * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
508c2ecf20Sopenharmony_ci * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
518c2ecf20Sopenharmony_ci * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
528c2ecf20Sopenharmony_ci * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
538c2ecf20Sopenharmony_ci * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
548c2ecf20Sopenharmony_ci * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
558c2ecf20Sopenharmony_ci * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
568c2ecf20Sopenharmony_ci * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
578c2ecf20Sopenharmony_ci * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
588c2ecf20Sopenharmony_ci * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
598c2ecf20Sopenharmony_ci * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
608c2ecf20Sopenharmony_ci *****************************************************************************/
618c2ecf20Sopenharmony_ci
628c2ecf20Sopenharmony_ci#ifndef __iwl_fw_file_h__
638c2ecf20Sopenharmony_ci#define __iwl_fw_file_h__
648c2ecf20Sopenharmony_ci
658c2ecf20Sopenharmony_ci#include <linux/netdevice.h>
668c2ecf20Sopenharmony_ci#include <linux/nl80211.h>
678c2ecf20Sopenharmony_ci
688c2ecf20Sopenharmony_ci/* v1/v2 uCode file layout */
698c2ecf20Sopenharmony_cistruct iwl_ucode_header {
708c2ecf20Sopenharmony_ci	__le32 ver;	/* major/minor/API/serial */
718c2ecf20Sopenharmony_ci	union {
728c2ecf20Sopenharmony_ci		struct {
738c2ecf20Sopenharmony_ci			__le32 inst_size;	/* bytes of runtime code */
748c2ecf20Sopenharmony_ci			__le32 data_size;	/* bytes of runtime data */
758c2ecf20Sopenharmony_ci			__le32 init_size;	/* bytes of init code */
768c2ecf20Sopenharmony_ci			__le32 init_data_size;	/* bytes of init data */
778c2ecf20Sopenharmony_ci			__le32 boot_size;	/* bytes of bootstrap code */
788c2ecf20Sopenharmony_ci			u8 data[0];		/* in same order as sizes */
798c2ecf20Sopenharmony_ci		} v1;
808c2ecf20Sopenharmony_ci		struct {
818c2ecf20Sopenharmony_ci			__le32 build;		/* build number */
828c2ecf20Sopenharmony_ci			__le32 inst_size;	/* bytes of runtime code */
838c2ecf20Sopenharmony_ci			__le32 data_size;	/* bytes of runtime data */
848c2ecf20Sopenharmony_ci			__le32 init_size;	/* bytes of init code */
858c2ecf20Sopenharmony_ci			__le32 init_data_size;	/* bytes of init data */
868c2ecf20Sopenharmony_ci			__le32 boot_size;	/* bytes of bootstrap code */
878c2ecf20Sopenharmony_ci			u8 data[0];		/* in same order as sizes */
888c2ecf20Sopenharmony_ci		} v2;
898c2ecf20Sopenharmony_ci	} u;
908c2ecf20Sopenharmony_ci};
918c2ecf20Sopenharmony_ci
928c2ecf20Sopenharmony_ci#define IWL_UCODE_TLV_DEBUG_BASE	0x1000005
938c2ecf20Sopenharmony_ci#define IWL_UCODE_TLV_CONST_BASE	0x100
948c2ecf20Sopenharmony_ci
958c2ecf20Sopenharmony_ci/*
968c2ecf20Sopenharmony_ci * new TLV uCode file layout
978c2ecf20Sopenharmony_ci *
988c2ecf20Sopenharmony_ci * The new TLV file format contains TLVs, that each specify
998c2ecf20Sopenharmony_ci * some piece of data.
1008c2ecf20Sopenharmony_ci */
1018c2ecf20Sopenharmony_ci
1028c2ecf20Sopenharmony_cienum iwl_ucode_tlv_type {
1038c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_INVALID		= 0, /* unused */
1048c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_INST		= 1,
1058c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_DATA		= 2,
1068c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_INIT		= 3,
1078c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_INIT_DATA		= 4,
1088c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_BOOT		= 5,
1098c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_PROBE_MAX_LEN	= 6, /* a u32 value */
1108c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_PAN		= 7,
1118c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_RUNT_EVTLOG_PTR	= 8,
1128c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_RUNT_EVTLOG_SIZE	= 9,
1138c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_RUNT_ERRLOG_PTR	= 10,
1148c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_INIT_EVTLOG_PTR	= 11,
1158c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_INIT_EVTLOG_SIZE	= 12,
1168c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_INIT_ERRLOG_PTR	= 13,
1178c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_ENHANCE_SENS_TBL	= 14,
1188c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_PHY_CALIBRATION_SIZE = 15,
1198c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_WOWLAN_INST	= 16,
1208c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_WOWLAN_DATA	= 17,
1218c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_FLAGS		= 18,
1228c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_SEC_RT		= 19,
1238c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_SEC_INIT		= 20,
1248c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_SEC_WOWLAN	= 21,
1258c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_DEF_CALIB		= 22,
1268c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_PHY_SKU		= 23,
1278c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_SECURE_SEC_RT	= 24,
1288c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_SECURE_SEC_INIT	= 25,
1298c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_SECURE_SEC_WOWLAN	= 26,
1308c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_NUM_OF_CPU	= 27,
1318c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_CSCHEME		= 28,
1328c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_API_CHANGES_SET	= 29,
1338c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_ENABLED_CAPABILITIES	= 30,
1348c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_N_SCAN_CHANNELS		= 31,
1358c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_PAGING		= 32,
1368c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_SEC_RT_USNIFFER	= 34,
1378c2ecf20Sopenharmony_ci	/* 35 is unused */
1388c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_FW_VERSION	= 36,
1398c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_FW_DBG_DEST	= 38,
1408c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_FW_DBG_CONF	= 39,
1418c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_FW_DBG_TRIGGER	= 40,
1428c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_CMD_VERSIONS	= 48,
1438c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_FW_GSCAN_CAPA	= 50,
1448c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_FW_MEM_SEG	= 51,
1458c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_IML		= 52,
1468c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_UMAC_DEBUG_ADDRS	= 54,
1478c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_LMAC_DEBUG_ADDRS	= 55,
1488c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_FW_RECOVERY_INFO	= 57,
1498c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_HW_TYPE			= 58,
1508c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_FW_FSEQ_VERSION		= 60,
1518c2ecf20Sopenharmony_ci
1528c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_PNVM_VERSION		= 62,
1538c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_PNVM_SKU			= 64,
1548c2ecf20Sopenharmony_ci
1558c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_FW_NUM_STATIONS		= IWL_UCODE_TLV_CONST_BASE + 0,
1568c2ecf20Sopenharmony_ci
1578c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_TYPE_DEBUG_INFO		= IWL_UCODE_TLV_DEBUG_BASE + 0,
1588c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_TYPE_BUFFER_ALLOCATION	= IWL_UCODE_TLV_DEBUG_BASE + 1,
1598c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_TYPE_HCMD			= IWL_UCODE_TLV_DEBUG_BASE + 2,
1608c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_TYPE_REGIONS		= IWL_UCODE_TLV_DEBUG_BASE + 3,
1618c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_TYPE_TRIGGERS		= IWL_UCODE_TLV_DEBUG_BASE + 4,
1628c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_DEBUG_MAX = IWL_UCODE_TLV_TYPE_TRIGGERS,
1638c2ecf20Sopenharmony_ci
1648c2ecf20Sopenharmony_ci	/* TLVs 0x1000-0x2000 are for internal driver usage */
1658c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_FW_DBG_DUMP_LST	= 0x1000,
1668c2ecf20Sopenharmony_ci};
1678c2ecf20Sopenharmony_ci
1688c2ecf20Sopenharmony_cistruct iwl_ucode_tlv {
1698c2ecf20Sopenharmony_ci	__le32 type;		/* see above */
1708c2ecf20Sopenharmony_ci	__le32 length;		/* not including type/length fields */
1718c2ecf20Sopenharmony_ci	u8 data[0];
1728c2ecf20Sopenharmony_ci};
1738c2ecf20Sopenharmony_ci
1748c2ecf20Sopenharmony_ci#define IWL_TLV_UCODE_MAGIC		0x0a4c5749
1758c2ecf20Sopenharmony_ci#define FW_VER_HUMAN_READABLE_SZ	64
1768c2ecf20Sopenharmony_ci
1778c2ecf20Sopenharmony_cistruct iwl_tlv_ucode_header {
1788c2ecf20Sopenharmony_ci	/*
1798c2ecf20Sopenharmony_ci	 * The TLV style ucode header is distinguished from
1808c2ecf20Sopenharmony_ci	 * the v1/v2 style header by first four bytes being
1818c2ecf20Sopenharmony_ci	 * zero, as such is an invalid combination of
1828c2ecf20Sopenharmony_ci	 * major/minor/API/serial versions.
1838c2ecf20Sopenharmony_ci	 */
1848c2ecf20Sopenharmony_ci	__le32 zero;
1858c2ecf20Sopenharmony_ci	__le32 magic;
1868c2ecf20Sopenharmony_ci	u8 human_readable[FW_VER_HUMAN_READABLE_SZ];
1878c2ecf20Sopenharmony_ci	/* major/minor/API/serial or major in new format */
1888c2ecf20Sopenharmony_ci	__le32 ver;
1898c2ecf20Sopenharmony_ci	__le32 build;
1908c2ecf20Sopenharmony_ci	__le64 ignore;
1918c2ecf20Sopenharmony_ci	/*
1928c2ecf20Sopenharmony_ci	 * The data contained herein has a TLV layout,
1938c2ecf20Sopenharmony_ci	 * see above for the TLV header and types.
1948c2ecf20Sopenharmony_ci	 * Note that each TLV is padded to a length
1958c2ecf20Sopenharmony_ci	 * that is a multiple of 4 for alignment.
1968c2ecf20Sopenharmony_ci	 */
1978c2ecf20Sopenharmony_ci	u8 data[0];
1988c2ecf20Sopenharmony_ci};
1998c2ecf20Sopenharmony_ci
2008c2ecf20Sopenharmony_ci/*
2018c2ecf20Sopenharmony_ci * ucode TLVs
2028c2ecf20Sopenharmony_ci *
2038c2ecf20Sopenharmony_ci * ability to get extension for: flags & capabilities from ucode binaries files
2048c2ecf20Sopenharmony_ci */
2058c2ecf20Sopenharmony_cistruct iwl_ucode_api {
2068c2ecf20Sopenharmony_ci	__le32 api_index;
2078c2ecf20Sopenharmony_ci	__le32 api_flags;
2088c2ecf20Sopenharmony_ci} __packed;
2098c2ecf20Sopenharmony_ci
2108c2ecf20Sopenharmony_cistruct iwl_ucode_capa {
2118c2ecf20Sopenharmony_ci	__le32 api_index;
2128c2ecf20Sopenharmony_ci	__le32 api_capa;
2138c2ecf20Sopenharmony_ci} __packed;
2148c2ecf20Sopenharmony_ci
2158c2ecf20Sopenharmony_ci/**
2168c2ecf20Sopenharmony_ci * enum iwl_ucode_tlv_flag - ucode API flags
2178c2ecf20Sopenharmony_ci * @IWL_UCODE_TLV_FLAGS_PAN: This is PAN capable microcode; this previously
2188c2ecf20Sopenharmony_ci *	was a separate TLV but moved here to save space.
2198c2ecf20Sopenharmony_ci * @IWL_UCODE_TLV_FLAGS_NEWSCAN: new uCode scan behavior on hidden SSID,
2208c2ecf20Sopenharmony_ci *	treats good CRC threshold as a boolean
2218c2ecf20Sopenharmony_ci * @IWL_UCODE_TLV_FLAGS_MFP: This uCode image supports MFP (802.11w).
2228c2ecf20Sopenharmony_ci * @IWL_UCODE_TLV_FLAGS_UAPSD_SUPPORT: This uCode image supports uAPSD
2238c2ecf20Sopenharmony_ci * @IWL_UCODE_TLV_FLAGS_SHORT_BL: 16 entries of block list instead of 64 in scan
2248c2ecf20Sopenharmony_ci *	offload profile config command.
2258c2ecf20Sopenharmony_ci * @IWL_UCODE_TLV_FLAGS_D3_6_IPV6_ADDRS: D3 image supports up to six
2268c2ecf20Sopenharmony_ci *	(rather than two) IPv6 addresses
2278c2ecf20Sopenharmony_ci * @IWL_UCODE_TLV_FLAGS_NO_BASIC_SSID: not sending a probe with the SSID element
2288c2ecf20Sopenharmony_ci *	from the probe request template.
2298c2ecf20Sopenharmony_ci * @IWL_UCODE_TLV_FLAGS_NEW_NSOFFL_SMALL: new NS offload (small version)
2308c2ecf20Sopenharmony_ci * @IWL_UCODE_TLV_FLAGS_NEW_NSOFFL_LARGE: new NS offload (large version)
2318c2ecf20Sopenharmony_ci * @IWL_UCODE_TLV_FLAGS_UAPSD_SUPPORT: General support for uAPSD
2328c2ecf20Sopenharmony_ci * @IWL_UCODE_TLV_FLAGS_P2P_PS_UAPSD: P2P client supports uAPSD power save
2338c2ecf20Sopenharmony_ci * @IWL_UCODE_TLV_FLAGS_BCAST_FILTERING: uCode supports broadcast filtering.
2348c2ecf20Sopenharmony_ci * @IWL_UCODE_TLV_FLAGS_EBS_SUPPORT: this uCode image supports EBS.
2358c2ecf20Sopenharmony_ci */
2368c2ecf20Sopenharmony_cienum iwl_ucode_tlv_flag {
2378c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_FLAGS_PAN			= BIT(0),
2388c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_FLAGS_NEWSCAN		= BIT(1),
2398c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_FLAGS_MFP			= BIT(2),
2408c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_FLAGS_SHORT_BL		= BIT(7),
2418c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_FLAGS_D3_6_IPV6_ADDRS	= BIT(10),
2428c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_FLAGS_NO_BASIC_SSID	= BIT(12),
2438c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_FLAGS_NEW_NSOFFL_SMALL	= BIT(15),
2448c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_FLAGS_NEW_NSOFFL_LARGE	= BIT(16),
2458c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_FLAGS_UAPSD_SUPPORT	= BIT(24),
2468c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_FLAGS_EBS_SUPPORT		= BIT(25),
2478c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_FLAGS_P2P_PS_UAPSD	= BIT(26),
2488c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_FLAGS_BCAST_FILTERING	= BIT(29),
2498c2ecf20Sopenharmony_ci};
2508c2ecf20Sopenharmony_ci
2518c2ecf20Sopenharmony_citypedef unsigned int __bitwise iwl_ucode_tlv_api_t;
2528c2ecf20Sopenharmony_ci
2538c2ecf20Sopenharmony_ci/**
2548c2ecf20Sopenharmony_ci * enum iwl_ucode_tlv_api - ucode api
2558c2ecf20Sopenharmony_ci * @IWL_UCODE_TLV_API_FRAGMENTED_SCAN: This ucode supports active dwell time
2568c2ecf20Sopenharmony_ci *	longer than the passive one, which is essential for fragmented scan.
2578c2ecf20Sopenharmony_ci * @IWL_UCODE_TLV_API_WIFI_MCC_UPDATE: ucode supports MCC updates with source.
2588c2ecf20Sopenharmony_ci * @IWL_UCODE_TLV_API_LQ_SS_PARAMS: Configure STBC/BFER via LQ CMD ss_params
2598c2ecf20Sopenharmony_ci * @IWL_UCODE_TLV_API_NEW_VERSION: new versioning format
2608c2ecf20Sopenharmony_ci * @IWL_UCODE_TLV_API_SCAN_TSF_REPORT: Scan start time reported in scan
2618c2ecf20Sopenharmony_ci *	iteration complete notification, and the timestamp reported for RX
2628c2ecf20Sopenharmony_ci *	received during scan, are reported in TSF of the mac specified in the
2638c2ecf20Sopenharmony_ci *	scan request.
2648c2ecf20Sopenharmony_ci * @IWL_UCODE_TLV_API_TKIP_MIC_KEYS: This ucode supports version 2 of
2658c2ecf20Sopenharmony_ci *	ADD_MODIFY_STA_KEY_API_S_VER_2.
2668c2ecf20Sopenharmony_ci * @IWL_UCODE_TLV_API_STA_TYPE: This ucode supports station type assignement.
2678c2ecf20Sopenharmony_ci * @IWL_UCODE_TLV_API_NAN2_VER2: This ucode supports NAN API version 2
2688c2ecf20Sopenharmony_ci * @IWL_UCODE_TLV_API_NEW_RX_STATS: should new RX STATISTICS API be used
2698c2ecf20Sopenharmony_ci * @IWL_UCODE_TLV_API_QUOTA_LOW_LATENCY: Quota command includes a field
2708c2ecf20Sopenharmony_ci *	indicating low latency direction.
2718c2ecf20Sopenharmony_ci * @IWL_UCODE_TLV_API_DEPRECATE_TTAK: RX status flag TTAK ok (bit 7) is
2728c2ecf20Sopenharmony_ci *	deprecated.
2738c2ecf20Sopenharmony_ci * @IWL_UCODE_TLV_API_ADAPTIVE_DWELL_V2: This ucode supports version 8
2748c2ecf20Sopenharmony_ci *	of scan request: SCAN_REQUEST_CMD_UMAC_API_S_VER_8
2758c2ecf20Sopenharmony_ci * @IWL_UCODE_TLV_API_FRAG_EBS: This ucode supports fragmented EBS
2768c2ecf20Sopenharmony_ci * @IWL_UCODE_TLV_API_REDUCE_TX_POWER: This ucode supports v5 of
2778c2ecf20Sopenharmony_ci *	the REDUCE_TX_POWER_CMD.
2788c2ecf20Sopenharmony_ci * @IWL_UCODE_TLV_API_SHORT_BEACON_NOTIF: This ucode supports the short
2798c2ecf20Sopenharmony_ci *	version of the beacon notification.
2808c2ecf20Sopenharmony_ci * @IWL_UCODE_TLV_API_BEACON_FILTER_V4: This ucode supports v4 of
2818c2ecf20Sopenharmony_ci *	BEACON_FILTER_CONFIG_API_S_VER_4.
2828c2ecf20Sopenharmony_ci * @IWL_UCODE_TLV_API_REGULATORY_NVM_INFO: This ucode supports v4 of
2838c2ecf20Sopenharmony_ci *	REGULATORY_NVM_GET_INFO_RSP_API_S.
2848c2ecf20Sopenharmony_ci * @IWL_UCODE_TLV_API_FTM_NEW_RANGE_REQ: This ucode supports v7 of
2858c2ecf20Sopenharmony_ci *	LOCATION_RANGE_REQ_CMD_API_S and v6 of LOCATION_RANGE_RESP_NTFY_API_S.
2868c2ecf20Sopenharmony_ci * @IWL_UCODE_TLV_API_SCAN_OFFLOAD_CHANS: This ucode supports v2 of
2878c2ecf20Sopenharmony_ci *	SCAN_OFFLOAD_PROFILE_MATCH_RESULTS_S and v3 of
2888c2ecf20Sopenharmony_ci *	SCAN_OFFLOAD_PROFILES_QUERY_RSP_S.
2898c2ecf20Sopenharmony_ci * @IWL_UCODE_TLV_API_MBSSID_HE: This ucode supports v2 of
2908c2ecf20Sopenharmony_ci *	STA_CONTEXT_DOT11AX_API_S
2918c2ecf20Sopenharmony_ci * @IWL_UCODE_TLV_CAPA_SAR_TABLE_VER: This ucode supports different sar
2928c2ecf20Sopenharmony_ci *	version tables.
2938c2ecf20Sopenharmony_ci * @IWL_UCODE_TLV_API_REDUCED_SCAN_CONFIG: This ucode supports v3 of
2948c2ecf20Sopenharmony_ci *  SCAN_CONFIG_DB_CMD_API_S.
2958c2ecf20Sopenharmony_ci *
2968c2ecf20Sopenharmony_ci * @NUM_IWL_UCODE_TLV_API: number of bits used
2978c2ecf20Sopenharmony_ci */
2988c2ecf20Sopenharmony_cienum iwl_ucode_tlv_api {
2998c2ecf20Sopenharmony_ci	/* API Set 0 */
3008c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_API_FRAGMENTED_SCAN	= (__force iwl_ucode_tlv_api_t)8,
3018c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_API_WIFI_MCC_UPDATE	= (__force iwl_ucode_tlv_api_t)9,
3028c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_API_LQ_SS_PARAMS		= (__force iwl_ucode_tlv_api_t)18,
3038c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_API_NEW_VERSION		= (__force iwl_ucode_tlv_api_t)20,
3048c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_API_SCAN_TSF_REPORT	= (__force iwl_ucode_tlv_api_t)28,
3058c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_API_TKIP_MIC_KEYS		= (__force iwl_ucode_tlv_api_t)29,
3068c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_API_STA_TYPE		= (__force iwl_ucode_tlv_api_t)30,
3078c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_API_NAN2_VER2		= (__force iwl_ucode_tlv_api_t)31,
3088c2ecf20Sopenharmony_ci	/* API Set 1 */
3098c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_API_ADAPTIVE_DWELL	= (__force iwl_ucode_tlv_api_t)32,
3108c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_API_OCE			= (__force iwl_ucode_tlv_api_t)33,
3118c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_API_NEW_BEACON_TEMPLATE	= (__force iwl_ucode_tlv_api_t)34,
3128c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_API_NEW_RX_STATS		= (__force iwl_ucode_tlv_api_t)35,
3138c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_API_WOWLAN_KEY_MATERIAL	= (__force iwl_ucode_tlv_api_t)36,
3148c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_API_QUOTA_LOW_LATENCY	= (__force iwl_ucode_tlv_api_t)38,
3158c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_API_DEPRECATE_TTAK	= (__force iwl_ucode_tlv_api_t)41,
3168c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_API_ADAPTIVE_DWELL_V2	= (__force iwl_ucode_tlv_api_t)42,
3178c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_API_FRAG_EBS		= (__force iwl_ucode_tlv_api_t)44,
3188c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_API_REDUCE_TX_POWER	= (__force iwl_ucode_tlv_api_t)45,
3198c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_API_SHORT_BEACON_NOTIF	= (__force iwl_ucode_tlv_api_t)46,
3208c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_API_BEACON_FILTER_V4      = (__force iwl_ucode_tlv_api_t)47,
3218c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_API_REGULATORY_NVM_INFO   = (__force iwl_ucode_tlv_api_t)48,
3228c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_API_FTM_NEW_RANGE_REQ     = (__force iwl_ucode_tlv_api_t)49,
3238c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_API_SCAN_OFFLOAD_CHANS    = (__force iwl_ucode_tlv_api_t)50,
3248c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_API_MBSSID_HE		= (__force iwl_ucode_tlv_api_t)52,
3258c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_API_WOWLAN_TCP_SYN_WAKE	= (__force iwl_ucode_tlv_api_t)53,
3268c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_API_FTM_RTT_ACCURACY      = (__force iwl_ucode_tlv_api_t)54,
3278c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_API_SAR_TABLE_VER         = (__force iwl_ucode_tlv_api_t)55,
3288c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_API_REDUCED_SCAN_CONFIG   = (__force iwl_ucode_tlv_api_t)56,
3298c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_API_ADWELL_HB_DEF_N_AP	= (__force iwl_ucode_tlv_api_t)57,
3308c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_API_SCAN_EXT_CHAN_VER	= (__force iwl_ucode_tlv_api_t)58,
3318c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_API_BAND_IN_RX_DATA	= (__force iwl_ucode_tlv_api_t)59,
3328c2ecf20Sopenharmony_ci
3338c2ecf20Sopenharmony_ci
3348c2ecf20Sopenharmony_ci	NUM_IWL_UCODE_TLV_API
3358c2ecf20Sopenharmony_ci#ifdef __CHECKER__
3368c2ecf20Sopenharmony_ci		/* sparse says it cannot increment the previous enum member */
3378c2ecf20Sopenharmony_ci		= 128
3388c2ecf20Sopenharmony_ci#endif
3398c2ecf20Sopenharmony_ci};
3408c2ecf20Sopenharmony_ci
3418c2ecf20Sopenharmony_citypedef unsigned int __bitwise iwl_ucode_tlv_capa_t;
3428c2ecf20Sopenharmony_ci
3438c2ecf20Sopenharmony_ci/**
3448c2ecf20Sopenharmony_ci * enum iwl_ucode_tlv_capa - ucode capabilities
3458c2ecf20Sopenharmony_ci * @IWL_UCODE_TLV_CAPA_D0I3_SUPPORT: supports D0i3
3468c2ecf20Sopenharmony_ci * @IWL_UCODE_TLV_CAPA_LAR_SUPPORT: supports Location Aware Regulatory
3478c2ecf20Sopenharmony_ci * @IWL_UCODE_TLV_CAPA_UMAC_SCAN: supports UMAC scan.
3488c2ecf20Sopenharmony_ci * @IWL_UCODE_TLV_CAPA_BEAMFORMER: supports Beamformer
3498c2ecf20Sopenharmony_ci * @IWL_UCODE_TLV_CAPA_TDLS_SUPPORT: support basic TDLS functionality
3508c2ecf20Sopenharmony_ci * @IWL_UCODE_TLV_CAPA_TXPOWER_INSERTION_SUPPORT: supports insertion of current
3518c2ecf20Sopenharmony_ci *	tx power value into TPC Report action frame and Link Measurement Report
3528c2ecf20Sopenharmony_ci *	action frame
3538c2ecf20Sopenharmony_ci * @IWL_UCODE_TLV_CAPA_DS_PARAM_SET_IE_SUPPORT: supports updating current
3548c2ecf20Sopenharmony_ci *	channel in DS parameter set element in probe requests.
3558c2ecf20Sopenharmony_ci * @IWL_UCODE_TLV_CAPA_WFA_TPC_REP_IE_SUPPORT: supports adding TPC Report IE in
3568c2ecf20Sopenharmony_ci *	probe requests.
3578c2ecf20Sopenharmony_ci * @IWL_UCODE_TLV_CAPA_QUIET_PERIOD_SUPPORT: supports Quiet Period requests
3588c2ecf20Sopenharmony_ci * @IWL_UCODE_TLV_CAPA_DQA_SUPPORT: supports dynamic queue allocation (DQA),
3598c2ecf20Sopenharmony_ci *	which also implies support for the scheduler configuration command
3608c2ecf20Sopenharmony_ci * @IWL_UCODE_TLV_CAPA_TDLS_CHANNEL_SWITCH: supports TDLS channel switching
3618c2ecf20Sopenharmony_ci * @IWL_UCODE_TLV_CAPA_CNSLDTD_D3_D0_IMG: Consolidated D3-D0 image
3628c2ecf20Sopenharmony_ci * @IWL_UCODE_TLV_CAPA_HOTSPOT_SUPPORT: supports Hot Spot Command
3638c2ecf20Sopenharmony_ci * @IWL_UCODE_TLV_CAPA_DC2DC_SUPPORT: supports DC2DC Command
3648c2ecf20Sopenharmony_ci * @IWL_UCODE_TLV_CAPA_CSUM_SUPPORT: supports TCP Checksum Offload
3658c2ecf20Sopenharmony_ci * @IWL_UCODE_TLV_CAPA_RADIO_BEACON_STATS: support radio and beacon statistics
3668c2ecf20Sopenharmony_ci * @IWL_UCODE_TLV_CAPA_P2P_SCM_UAPSD: supports U-APSD on p2p interface when it
3678c2ecf20Sopenharmony_ci *	is standalone or with a BSS station interface in the same binding.
3688c2ecf20Sopenharmony_ci * @IWL_UCODE_TLV_CAPA_BT_COEX_PLCR: enabled BT Coex packet level co-running
3698c2ecf20Sopenharmony_ci * @IWL_UCODE_TLV_CAPA_LAR_MULTI_MCC: ucode supports LAR updates with different
3708c2ecf20Sopenharmony_ci *	sources for the MCC. This TLV bit is a future replacement to
3718c2ecf20Sopenharmony_ci *	IWL_UCODE_TLV_API_WIFI_MCC_UPDATE. When either is set, multi-source LAR
3728c2ecf20Sopenharmony_ci *	is supported.
3738c2ecf20Sopenharmony_ci * @IWL_UCODE_TLV_CAPA_BT_COEX_RRC: supports BT Coex RRC
3748c2ecf20Sopenharmony_ci * @IWL_UCODE_TLV_CAPA_GSCAN_SUPPORT: supports gscan (no longer used)
3758c2ecf20Sopenharmony_ci * @IWL_UCODE_TLV_CAPA_SOC_LATENCY_SUPPORT: the firmware supports setting
3768c2ecf20Sopenharmony_ci *	stabilization latency for SoCs.
3778c2ecf20Sopenharmony_ci * @IWL_UCODE_TLV_CAPA_STA_PM_NOTIF: firmware will send STA PM notification
3788c2ecf20Sopenharmony_ci * @IWL_UCODE_TLV_CAPA_TLC_OFFLOAD: firmware implements rate scaling algorithm
3798c2ecf20Sopenharmony_ci * @IWL_UCODE_TLV_CAPA_DYNAMIC_QUOTA: firmware implements quota related
3808c2ecf20Sopenharmony_ci * @IWL_UCODE_TLV_CAPA_COEX_SCHEMA_2: firmware implements Coex Schema 2
3818c2ecf20Sopenharmony_ci * IWL_UCODE_TLV_CAPA_CHANNEL_SWITCH_CMD: firmware supports CSA command
3828c2ecf20Sopenharmony_ci * @IWL_UCODE_TLV_CAPA_ULTRA_HB_CHANNELS: firmware supports ultra high band
3838c2ecf20Sopenharmony_ci *	(6 GHz).
3848c2ecf20Sopenharmony_ci * @IWL_UCODE_TLV_CAPA_CS_MODIFY: firmware supports modify action CSA command
3858c2ecf20Sopenharmony_ci * @IWL_UCODE_TLV_CAPA_EXTENDED_DTS_MEASURE: extended DTS measurement
3868c2ecf20Sopenharmony_ci * @IWL_UCODE_TLV_CAPA_SHORT_PM_TIMEOUTS: supports short PM timeouts
3878c2ecf20Sopenharmony_ci * @IWL_UCODE_TLV_CAPA_BT_MPLUT_SUPPORT: supports bt-coex Multi-priority LUT
3888c2ecf20Sopenharmony_ci * @IWL_UCODE_TLV_CAPA_CSA_AND_TBTT_OFFLOAD: the firmware supports CSA
3898c2ecf20Sopenharmony_ci *	countdown offloading. Beacon notifications are not sent to the host.
3908c2ecf20Sopenharmony_ci *	The fw also offloads TBTT alignment.
3918c2ecf20Sopenharmony_ci * @IWL_UCODE_TLV_CAPA_BEACON_ANT_SELECTION: firmware will decide on what
3928c2ecf20Sopenharmony_ci *	antenna the beacon should be transmitted
3938c2ecf20Sopenharmony_ci * @IWL_UCODE_TLV_CAPA_BEACON_STORING: firmware will store the latest beacon
3948c2ecf20Sopenharmony_ci *	from AP and will send it upon d0i3 exit.
3958c2ecf20Sopenharmony_ci * @IWL_UCODE_TLV_CAPA_LAR_SUPPORT_V3: support LAR API V3
3968c2ecf20Sopenharmony_ci * @IWL_UCODE_TLV_CAPA_CT_KILL_BY_FW: firmware responsible for CT-kill
3978c2ecf20Sopenharmony_ci * @IWL_UCODE_TLV_CAPA_TEMP_THS_REPORT_SUPPORT: supports temperature
3988c2ecf20Sopenharmony_ci *	thresholds reporting
3998c2ecf20Sopenharmony_ci * @IWL_UCODE_TLV_CAPA_CTDP_SUPPORT: supports cTDP command
4008c2ecf20Sopenharmony_ci * @IWL_UCODE_TLV_CAPA_USNIFFER_UNIFIED: supports usniffer enabled in
4018c2ecf20Sopenharmony_ci *	regular image.
4028c2ecf20Sopenharmony_ci * @IWL_UCODE_TLV_CAPA_EXTEND_SHARED_MEM_CFG: support getting more shared
4038c2ecf20Sopenharmony_ci *	memory addresses from the firmware.
4048c2ecf20Sopenharmony_ci * @IWL_UCODE_TLV_CAPA_LQM_SUPPORT: supports Link Quality Measurement
4058c2ecf20Sopenharmony_ci * @IWL_UCODE_TLV_CAPA_TX_POWER_ACK: reduced TX power API has larger
4068c2ecf20Sopenharmony_ci *	command size (command version 4) that supports toggling ACK TX
4078c2ecf20Sopenharmony_ci *	power reduction.
4088c2ecf20Sopenharmony_ci * @IWL_UCODE_TLV_CAPA_D3_DEBUG: supports debug recording during D3
4098c2ecf20Sopenharmony_ci * @IWL_UCODE_TLV_CAPA_MCC_UPDATE_11AX_SUPPORT: MCC response support 11ax
4108c2ecf20Sopenharmony_ci *	capability.
4118c2ecf20Sopenharmony_ci * @IWL_UCODE_TLV_CAPA_CSI_REPORTING: firmware is capable of being configured
4128c2ecf20Sopenharmony_ci *	to report the CSI information with (certain) RX frames
4138c2ecf20Sopenharmony_ci * @IWL_UCODE_TLV_CAPA_FTM_CALIBRATED: has FTM calibrated and thus supports both
4148c2ecf20Sopenharmony_ci *	initiator and responder
4158c2ecf20Sopenharmony_ci * @IWL_UCODE_TLV_CAPA_MLME_OFFLOAD: supports MLME offload
4168c2ecf20Sopenharmony_ci * @IWL_UCODE_TLV_CAPA_PROTECTED_TWT: Supports protection of TWT action frames
4178c2ecf20Sopenharmony_ci *
4188c2ecf20Sopenharmony_ci * @NUM_IWL_UCODE_TLV_CAPA: number of bits used
4198c2ecf20Sopenharmony_ci */
4208c2ecf20Sopenharmony_cienum iwl_ucode_tlv_capa {
4218c2ecf20Sopenharmony_ci	/* set 0 */
4228c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_CAPA_D0I3_SUPPORT			= (__force iwl_ucode_tlv_capa_t)0,
4238c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_CAPA_LAR_SUPPORT			= (__force iwl_ucode_tlv_capa_t)1,
4248c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_CAPA_UMAC_SCAN			= (__force iwl_ucode_tlv_capa_t)2,
4258c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_CAPA_BEAMFORMER			= (__force iwl_ucode_tlv_capa_t)3,
4268c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_CAPA_TDLS_SUPPORT			= (__force iwl_ucode_tlv_capa_t)6,
4278c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_CAPA_TXPOWER_INSERTION_SUPPORT	= (__force iwl_ucode_tlv_capa_t)8,
4288c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_CAPA_DS_PARAM_SET_IE_SUPPORT	= (__force iwl_ucode_tlv_capa_t)9,
4298c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_CAPA_WFA_TPC_REP_IE_SUPPORT	= (__force iwl_ucode_tlv_capa_t)10,
4308c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_CAPA_QUIET_PERIOD_SUPPORT		= (__force iwl_ucode_tlv_capa_t)11,
4318c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_CAPA_DQA_SUPPORT			= (__force iwl_ucode_tlv_capa_t)12,
4328c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_CAPA_TDLS_CHANNEL_SWITCH		= (__force iwl_ucode_tlv_capa_t)13,
4338c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_CAPA_CNSLDTD_D3_D0_IMG		= (__force iwl_ucode_tlv_capa_t)17,
4348c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_CAPA_HOTSPOT_SUPPORT		= (__force iwl_ucode_tlv_capa_t)18,
4358c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_CAPA_DC2DC_CONFIG_SUPPORT		= (__force iwl_ucode_tlv_capa_t)19,
4368c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_CAPA_CSUM_SUPPORT			= (__force iwl_ucode_tlv_capa_t)21,
4378c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_CAPA_RADIO_BEACON_STATS		= (__force iwl_ucode_tlv_capa_t)22,
4388c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_CAPA_P2P_SCM_UAPSD		= (__force iwl_ucode_tlv_capa_t)26,
4398c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_CAPA_BT_COEX_PLCR			= (__force iwl_ucode_tlv_capa_t)28,
4408c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_CAPA_LAR_MULTI_MCC		= (__force iwl_ucode_tlv_capa_t)29,
4418c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_CAPA_BT_COEX_RRC			= (__force iwl_ucode_tlv_capa_t)30,
4428c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_CAPA_GSCAN_SUPPORT		= (__force iwl_ucode_tlv_capa_t)31,
4438c2ecf20Sopenharmony_ci
4448c2ecf20Sopenharmony_ci	/* set 1 */
4458c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_CAPA_SOC_LATENCY_SUPPORT		= (__force iwl_ucode_tlv_capa_t)37,
4468c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_CAPA_STA_PM_NOTIF			= (__force iwl_ucode_tlv_capa_t)38,
4478c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_CAPA_BINDING_CDB_SUPPORT		= (__force iwl_ucode_tlv_capa_t)39,
4488c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_CAPA_CDB_SUPPORT			= (__force iwl_ucode_tlv_capa_t)40,
4498c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_CAPA_D0I3_END_FIRST		= (__force iwl_ucode_tlv_capa_t)41,
4508c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_CAPA_TLC_OFFLOAD                  = (__force iwl_ucode_tlv_capa_t)43,
4518c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_CAPA_DYNAMIC_QUOTA                = (__force iwl_ucode_tlv_capa_t)44,
4528c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_CAPA_COEX_SCHEMA_2		= (__force iwl_ucode_tlv_capa_t)45,
4538c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_CAPA_CHANNEL_SWITCH_CMD		= (__force iwl_ucode_tlv_capa_t)46,
4548c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_CAPA_FTM_CALIBRATED		= (__force iwl_ucode_tlv_capa_t)47,
4558c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_CAPA_ULTRA_HB_CHANNELS		= (__force iwl_ucode_tlv_capa_t)48,
4568c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_CAPA_CS_MODIFY			= (__force iwl_ucode_tlv_capa_t)49,
4578c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_CAPA_SET_LTR_GEN2			= (__force iwl_ucode_tlv_capa_t)50,
4588c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_CAPA_SET_PPAG			= (__force iwl_ucode_tlv_capa_t)52,
4598c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_CAPA_TAS_CFG			= (__force iwl_ucode_tlv_capa_t)53,
4608c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_CAPA_SESSION_PROT_CMD		= (__force iwl_ucode_tlv_capa_t)54,
4618c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_CAPA_PROTECTED_TWT		= (__force iwl_ucode_tlv_capa_t)56,
4628c2ecf20Sopenharmony_ci
4638c2ecf20Sopenharmony_ci	/* set 2 */
4648c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_CAPA_EXTENDED_DTS_MEASURE		= (__force iwl_ucode_tlv_capa_t)64,
4658c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_CAPA_SHORT_PM_TIMEOUTS		= (__force iwl_ucode_tlv_capa_t)65,
4668c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_CAPA_BT_MPLUT_SUPPORT		= (__force iwl_ucode_tlv_capa_t)67,
4678c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_CAPA_MULTI_QUEUE_RX_SUPPORT	= (__force iwl_ucode_tlv_capa_t)68,
4688c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_CAPA_CSA_AND_TBTT_OFFLOAD		= (__force iwl_ucode_tlv_capa_t)70,
4698c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_CAPA_BEACON_ANT_SELECTION		= (__force iwl_ucode_tlv_capa_t)71,
4708c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_CAPA_BEACON_STORING		= (__force iwl_ucode_tlv_capa_t)72,
4718c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_CAPA_LAR_SUPPORT_V3		= (__force iwl_ucode_tlv_capa_t)73,
4728c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_CAPA_CT_KILL_BY_FW		= (__force iwl_ucode_tlv_capa_t)74,
4738c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_CAPA_TEMP_THS_REPORT_SUPPORT	= (__force iwl_ucode_tlv_capa_t)75,
4748c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_CAPA_CTDP_SUPPORT			= (__force iwl_ucode_tlv_capa_t)76,
4758c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_CAPA_USNIFFER_UNIFIED		= (__force iwl_ucode_tlv_capa_t)77,
4768c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_CAPA_EXTEND_SHARED_MEM_CFG	= (__force iwl_ucode_tlv_capa_t)80,
4778c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_CAPA_LQM_SUPPORT			= (__force iwl_ucode_tlv_capa_t)81,
4788c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_CAPA_TX_POWER_ACK			= (__force iwl_ucode_tlv_capa_t)84,
4798c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_CAPA_D3_DEBUG			= (__force iwl_ucode_tlv_capa_t)87,
4808c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_CAPA_LED_CMD_SUPPORT		= (__force iwl_ucode_tlv_capa_t)88,
4818c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_CAPA_MCC_UPDATE_11AX_SUPPORT	= (__force iwl_ucode_tlv_capa_t)89,
4828c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_CAPA_CSI_REPORTING		= (__force iwl_ucode_tlv_capa_t)90,
4838c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_CAPA_DBG_SUSPEND_RESUME_CMD_SUPP	= (__force iwl_ucode_tlv_capa_t)92,
4848c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_CAPA_DBG_BUF_ALLOC_CMD_SUPP	= (__force iwl_ucode_tlv_capa_t)93,
4858c2ecf20Sopenharmony_ci
4868c2ecf20Sopenharmony_ci	/* set 3 */
4878c2ecf20Sopenharmony_ci	IWL_UCODE_TLV_CAPA_MLME_OFFLOAD			= (__force iwl_ucode_tlv_capa_t)96,
4888c2ecf20Sopenharmony_ci
4898c2ecf20Sopenharmony_ci	NUM_IWL_UCODE_TLV_CAPA
4908c2ecf20Sopenharmony_ci#ifdef __CHECKER__
4918c2ecf20Sopenharmony_ci		/* sparse says it cannot increment the previous enum member */
4928c2ecf20Sopenharmony_ci		= 128
4938c2ecf20Sopenharmony_ci#endif
4948c2ecf20Sopenharmony_ci};
4958c2ecf20Sopenharmony_ci
4968c2ecf20Sopenharmony_ci/* The default calibrate table size if not specified by firmware file */
4978c2ecf20Sopenharmony_ci#define IWL_DEFAULT_STANDARD_PHY_CALIBRATE_TBL_SIZE	18
4988c2ecf20Sopenharmony_ci#define IWL_MAX_STANDARD_PHY_CALIBRATE_TBL_SIZE		19
4998c2ecf20Sopenharmony_ci#define IWL_MAX_PHY_CALIBRATE_TBL_SIZE			253
5008c2ecf20Sopenharmony_ci
5018c2ecf20Sopenharmony_ci/* The default max probe length if not specified by the firmware file */
5028c2ecf20Sopenharmony_ci#define IWL_DEFAULT_MAX_PROBE_LENGTH	200
5038c2ecf20Sopenharmony_ci
5048c2ecf20Sopenharmony_ci/*
5058c2ecf20Sopenharmony_ci * For 16.0 uCode and above, there is no differentiation between sections,
5068c2ecf20Sopenharmony_ci * just an offset to the HW address.
5078c2ecf20Sopenharmony_ci */
5088c2ecf20Sopenharmony_ci#define CPU1_CPU2_SEPARATOR_SECTION	0xFFFFCCCC
5098c2ecf20Sopenharmony_ci#define PAGING_SEPARATOR_SECTION	0xAAAABBBB
5108c2ecf20Sopenharmony_ci
5118c2ecf20Sopenharmony_ci/* uCode version contains 4 values: Major/Minor/API/Serial */
5128c2ecf20Sopenharmony_ci#define IWL_UCODE_MAJOR(ver)	(((ver) & 0xFF000000) >> 24)
5138c2ecf20Sopenharmony_ci#define IWL_UCODE_MINOR(ver)	(((ver) & 0x00FF0000) >> 16)
5148c2ecf20Sopenharmony_ci#define IWL_UCODE_API(ver)	(((ver) & 0x0000FF00) >> 8)
5158c2ecf20Sopenharmony_ci#define IWL_UCODE_SERIAL(ver)	((ver) & 0x000000FF)
5168c2ecf20Sopenharmony_ci
5178c2ecf20Sopenharmony_ci/**
5188c2ecf20Sopenharmony_ci * struct iwl_tlv_calib_ctrl - Calibration control struct.
5198c2ecf20Sopenharmony_ci * Sent as part of the phy configuration command.
5208c2ecf20Sopenharmony_ci * @flow_trigger: bitmap for which calibrations to perform according to
5218c2ecf20Sopenharmony_ci *		flow triggers.
5228c2ecf20Sopenharmony_ci * @event_trigger: bitmap for which calibrations to perform according to
5238c2ecf20Sopenharmony_ci *		event triggers.
5248c2ecf20Sopenharmony_ci */
5258c2ecf20Sopenharmony_cistruct iwl_tlv_calib_ctrl {
5268c2ecf20Sopenharmony_ci	__le32 flow_trigger;
5278c2ecf20Sopenharmony_ci	__le32 event_trigger;
5288c2ecf20Sopenharmony_ci} __packed;
5298c2ecf20Sopenharmony_ci
5308c2ecf20Sopenharmony_cienum iwl_fw_phy_cfg {
5318c2ecf20Sopenharmony_ci	FW_PHY_CFG_RADIO_TYPE_POS = 0,
5328c2ecf20Sopenharmony_ci	FW_PHY_CFG_RADIO_TYPE = 0x3 << FW_PHY_CFG_RADIO_TYPE_POS,
5338c2ecf20Sopenharmony_ci	FW_PHY_CFG_RADIO_STEP_POS = 2,
5348c2ecf20Sopenharmony_ci	FW_PHY_CFG_RADIO_STEP = 0x3 << FW_PHY_CFG_RADIO_STEP_POS,
5358c2ecf20Sopenharmony_ci	FW_PHY_CFG_RADIO_DASH_POS = 4,
5368c2ecf20Sopenharmony_ci	FW_PHY_CFG_RADIO_DASH = 0x3 << FW_PHY_CFG_RADIO_DASH_POS,
5378c2ecf20Sopenharmony_ci	FW_PHY_CFG_TX_CHAIN_POS = 16,
5388c2ecf20Sopenharmony_ci	FW_PHY_CFG_TX_CHAIN = 0xf << FW_PHY_CFG_TX_CHAIN_POS,
5398c2ecf20Sopenharmony_ci	FW_PHY_CFG_RX_CHAIN_POS = 20,
5408c2ecf20Sopenharmony_ci	FW_PHY_CFG_RX_CHAIN = 0xf << FW_PHY_CFG_RX_CHAIN_POS,
5418c2ecf20Sopenharmony_ci	FW_PHY_CFG_CHAIN_SAD_POS = 23,
5428c2ecf20Sopenharmony_ci	FW_PHY_CFG_CHAIN_SAD_ENABLED = 0x1 << FW_PHY_CFG_CHAIN_SAD_POS,
5438c2ecf20Sopenharmony_ci	FW_PHY_CFG_CHAIN_SAD_ANT_A = 0x2 << FW_PHY_CFG_CHAIN_SAD_POS,
5448c2ecf20Sopenharmony_ci	FW_PHY_CFG_CHAIN_SAD_ANT_B = 0x4 << FW_PHY_CFG_CHAIN_SAD_POS,
5458c2ecf20Sopenharmony_ci	FW_PHY_CFG_SHARED_CLK = BIT(31),
5468c2ecf20Sopenharmony_ci};
5478c2ecf20Sopenharmony_ci
5488c2ecf20Sopenharmony_ci#define IWL_UCODE_MAX_CS		1
5498c2ecf20Sopenharmony_ci
5508c2ecf20Sopenharmony_ci/**
5518c2ecf20Sopenharmony_ci * struct iwl_fw_cipher_scheme - a cipher scheme supported by FW.
5528c2ecf20Sopenharmony_ci * @cipher: a cipher suite selector
5538c2ecf20Sopenharmony_ci * @flags: cipher scheme flags (currently reserved for a future use)
5548c2ecf20Sopenharmony_ci * @hdr_len: a size of MPDU security header
5558c2ecf20Sopenharmony_ci * @pn_len: a size of PN
5568c2ecf20Sopenharmony_ci * @pn_off: an offset of pn from the beginning of the security header
5578c2ecf20Sopenharmony_ci * @key_idx_off: an offset of key index byte in the security header
5588c2ecf20Sopenharmony_ci * @key_idx_mask: a bit mask of key_idx bits
5598c2ecf20Sopenharmony_ci * @key_idx_shift: bit shift needed to get key_idx
5608c2ecf20Sopenharmony_ci * @mic_len: mic length in bytes
5618c2ecf20Sopenharmony_ci * @hw_cipher: a HW cipher index used in host commands
5628c2ecf20Sopenharmony_ci */
5638c2ecf20Sopenharmony_cistruct iwl_fw_cipher_scheme {
5648c2ecf20Sopenharmony_ci	__le32 cipher;
5658c2ecf20Sopenharmony_ci	u8 flags;
5668c2ecf20Sopenharmony_ci	u8 hdr_len;
5678c2ecf20Sopenharmony_ci	u8 pn_len;
5688c2ecf20Sopenharmony_ci	u8 pn_off;
5698c2ecf20Sopenharmony_ci	u8 key_idx_off;
5708c2ecf20Sopenharmony_ci	u8 key_idx_mask;
5718c2ecf20Sopenharmony_ci	u8 key_idx_shift;
5728c2ecf20Sopenharmony_ci	u8 mic_len;
5738c2ecf20Sopenharmony_ci	u8 hw_cipher;
5748c2ecf20Sopenharmony_ci} __packed;
5758c2ecf20Sopenharmony_ci
5768c2ecf20Sopenharmony_cienum iwl_fw_dbg_reg_operator {
5778c2ecf20Sopenharmony_ci	CSR_ASSIGN,
5788c2ecf20Sopenharmony_ci	CSR_SETBIT,
5798c2ecf20Sopenharmony_ci	CSR_CLEARBIT,
5808c2ecf20Sopenharmony_ci
5818c2ecf20Sopenharmony_ci	PRPH_ASSIGN,
5828c2ecf20Sopenharmony_ci	PRPH_SETBIT,
5838c2ecf20Sopenharmony_ci	PRPH_CLEARBIT,
5848c2ecf20Sopenharmony_ci
5858c2ecf20Sopenharmony_ci	INDIRECT_ASSIGN,
5868c2ecf20Sopenharmony_ci	INDIRECT_SETBIT,
5878c2ecf20Sopenharmony_ci	INDIRECT_CLEARBIT,
5888c2ecf20Sopenharmony_ci
5898c2ecf20Sopenharmony_ci	PRPH_BLOCKBIT,
5908c2ecf20Sopenharmony_ci};
5918c2ecf20Sopenharmony_ci
5928c2ecf20Sopenharmony_ci/**
5938c2ecf20Sopenharmony_ci * struct iwl_fw_dbg_reg_op - an operation on a register
5948c2ecf20Sopenharmony_ci *
5958c2ecf20Sopenharmony_ci * @op: &enum iwl_fw_dbg_reg_operator
5968c2ecf20Sopenharmony_ci * @addr: offset of the register
5978c2ecf20Sopenharmony_ci * @val: value
5988c2ecf20Sopenharmony_ci */
5998c2ecf20Sopenharmony_cistruct iwl_fw_dbg_reg_op {
6008c2ecf20Sopenharmony_ci	u8 op;
6018c2ecf20Sopenharmony_ci	u8 reserved[3];
6028c2ecf20Sopenharmony_ci	__le32 addr;
6038c2ecf20Sopenharmony_ci	__le32 val;
6048c2ecf20Sopenharmony_ci} __packed;
6058c2ecf20Sopenharmony_ci
6068c2ecf20Sopenharmony_ci/**
6078c2ecf20Sopenharmony_ci * enum iwl_fw_dbg_monitor_mode - available monitor recording modes
6088c2ecf20Sopenharmony_ci *
6098c2ecf20Sopenharmony_ci * @SMEM_MODE: monitor stores the data in SMEM
6108c2ecf20Sopenharmony_ci * @EXTERNAL_MODE: monitor stores the data in allocated DRAM
6118c2ecf20Sopenharmony_ci * @MARBH_MODE: monitor stores the data in MARBH buffer
6128c2ecf20Sopenharmony_ci * @MIPI_MODE: monitor outputs the data through the MIPI interface
6138c2ecf20Sopenharmony_ci */
6148c2ecf20Sopenharmony_cienum iwl_fw_dbg_monitor_mode {
6158c2ecf20Sopenharmony_ci	SMEM_MODE = 0,
6168c2ecf20Sopenharmony_ci	EXTERNAL_MODE = 1,
6178c2ecf20Sopenharmony_ci	MARBH_MODE = 2,
6188c2ecf20Sopenharmony_ci	MIPI_MODE = 3,
6198c2ecf20Sopenharmony_ci};
6208c2ecf20Sopenharmony_ci
6218c2ecf20Sopenharmony_ci/**
6228c2ecf20Sopenharmony_ci * struct iwl_fw_dbg_mem_seg_tlv - configures the debug data memory segments
6238c2ecf20Sopenharmony_ci *
6248c2ecf20Sopenharmony_ci * @data_type: the memory segment type to record
6258c2ecf20Sopenharmony_ci * @ofs: the memory segment offset
6268c2ecf20Sopenharmony_ci * @len: the memory segment length, in bytes
6278c2ecf20Sopenharmony_ci *
6288c2ecf20Sopenharmony_ci * This parses IWL_UCODE_TLV_FW_MEM_SEG
6298c2ecf20Sopenharmony_ci */
6308c2ecf20Sopenharmony_cistruct iwl_fw_dbg_mem_seg_tlv {
6318c2ecf20Sopenharmony_ci	__le32 data_type;
6328c2ecf20Sopenharmony_ci	__le32 ofs;
6338c2ecf20Sopenharmony_ci	__le32 len;
6348c2ecf20Sopenharmony_ci} __packed;
6358c2ecf20Sopenharmony_ci
6368c2ecf20Sopenharmony_ci/**
6378c2ecf20Sopenharmony_ci * struct iwl_fw_dbg_dest_tlv_v1 - configures the destination of the debug data
6388c2ecf20Sopenharmony_ci *
6398c2ecf20Sopenharmony_ci * @version: version of the TLV - currently 0
6408c2ecf20Sopenharmony_ci * @monitor_mode: &enum iwl_fw_dbg_monitor_mode
6418c2ecf20Sopenharmony_ci * @size_power: buffer size will be 2^(size_power + 11)
6428c2ecf20Sopenharmony_ci * @base_reg: addr of the base addr register (PRPH)
6438c2ecf20Sopenharmony_ci * @end_reg:  addr of the end addr register (PRPH)
6448c2ecf20Sopenharmony_ci * @write_ptr_reg: the addr of the reg of the write pointer
6458c2ecf20Sopenharmony_ci * @wrap_count: the addr of the reg of the wrap_count
6468c2ecf20Sopenharmony_ci * @base_shift: shift right of the base addr reg
6478c2ecf20Sopenharmony_ci * @end_shift: shift right of the end addr reg
6488c2ecf20Sopenharmony_ci * @reg_ops: array of registers operations
6498c2ecf20Sopenharmony_ci *
6508c2ecf20Sopenharmony_ci * This parses IWL_UCODE_TLV_FW_DBG_DEST
6518c2ecf20Sopenharmony_ci */
6528c2ecf20Sopenharmony_cistruct iwl_fw_dbg_dest_tlv_v1 {
6538c2ecf20Sopenharmony_ci	u8 version;
6548c2ecf20Sopenharmony_ci	u8 monitor_mode;
6558c2ecf20Sopenharmony_ci	u8 size_power;
6568c2ecf20Sopenharmony_ci	u8 reserved;
6578c2ecf20Sopenharmony_ci	__le32 base_reg;
6588c2ecf20Sopenharmony_ci	__le32 end_reg;
6598c2ecf20Sopenharmony_ci	__le32 write_ptr_reg;
6608c2ecf20Sopenharmony_ci	__le32 wrap_count;
6618c2ecf20Sopenharmony_ci	u8 base_shift;
6628c2ecf20Sopenharmony_ci	u8 end_shift;
6638c2ecf20Sopenharmony_ci	struct iwl_fw_dbg_reg_op reg_ops[0];
6648c2ecf20Sopenharmony_ci} __packed;
6658c2ecf20Sopenharmony_ci
6668c2ecf20Sopenharmony_ci/* Mask of the register for defining the LDBG MAC2SMEM buffer SMEM size */
6678c2ecf20Sopenharmony_ci#define IWL_LDBG_M2S_BUF_SIZE_MSK	0x0fff0000
6688c2ecf20Sopenharmony_ci/* Mask of the register for defining the LDBG MAC2SMEM SMEM base address */
6698c2ecf20Sopenharmony_ci#define IWL_LDBG_M2S_BUF_BA_MSK		0x00000fff
6708c2ecf20Sopenharmony_ci/* The smem buffer chunks are in units of 256 bits */
6718c2ecf20Sopenharmony_ci#define IWL_M2S_UNIT_SIZE			0x100
6728c2ecf20Sopenharmony_ci
6738c2ecf20Sopenharmony_cistruct iwl_fw_dbg_dest_tlv {
6748c2ecf20Sopenharmony_ci	u8 version;
6758c2ecf20Sopenharmony_ci	u8 monitor_mode;
6768c2ecf20Sopenharmony_ci	u8 size_power;
6778c2ecf20Sopenharmony_ci	u8 reserved;
6788c2ecf20Sopenharmony_ci	__le32 cfg_reg;
6798c2ecf20Sopenharmony_ci	__le32 write_ptr_reg;
6808c2ecf20Sopenharmony_ci	__le32 wrap_count;
6818c2ecf20Sopenharmony_ci	u8 base_shift;
6828c2ecf20Sopenharmony_ci	u8 size_shift;
6838c2ecf20Sopenharmony_ci	struct iwl_fw_dbg_reg_op reg_ops[0];
6848c2ecf20Sopenharmony_ci} __packed;
6858c2ecf20Sopenharmony_ci
6868c2ecf20Sopenharmony_cistruct iwl_fw_dbg_conf_hcmd {
6878c2ecf20Sopenharmony_ci	u8 id;
6888c2ecf20Sopenharmony_ci	u8 reserved;
6898c2ecf20Sopenharmony_ci	__le16 len;
6908c2ecf20Sopenharmony_ci	u8 data[0];
6918c2ecf20Sopenharmony_ci} __packed;
6928c2ecf20Sopenharmony_ci
6938c2ecf20Sopenharmony_ci/**
6948c2ecf20Sopenharmony_ci * enum iwl_fw_dbg_trigger_mode - triggers functionalities
6958c2ecf20Sopenharmony_ci *
6968c2ecf20Sopenharmony_ci * @IWL_FW_DBG_TRIGGER_START: when trigger occurs re-conf the dbg mechanism
6978c2ecf20Sopenharmony_ci * @IWL_FW_DBG_TRIGGER_STOP: when trigger occurs pull the dbg data
6988c2ecf20Sopenharmony_ci * @IWL_FW_DBG_TRIGGER_MONITOR_ONLY: when trigger occurs trigger is set to
6998c2ecf20Sopenharmony_ci *	collect only monitor data
7008c2ecf20Sopenharmony_ci */
7018c2ecf20Sopenharmony_cienum iwl_fw_dbg_trigger_mode {
7028c2ecf20Sopenharmony_ci	IWL_FW_DBG_TRIGGER_START = BIT(0),
7038c2ecf20Sopenharmony_ci	IWL_FW_DBG_TRIGGER_STOP = BIT(1),
7048c2ecf20Sopenharmony_ci	IWL_FW_DBG_TRIGGER_MONITOR_ONLY = BIT(2),
7058c2ecf20Sopenharmony_ci};
7068c2ecf20Sopenharmony_ci
7078c2ecf20Sopenharmony_ci/**
7088c2ecf20Sopenharmony_ci * enum iwl_fw_dbg_trigger_flags - the flags supported by wrt triggers
7098c2ecf20Sopenharmony_ci * @IWL_FW_DBG_FORCE_RESTART: force a firmware restart
7108c2ecf20Sopenharmony_ci */
7118c2ecf20Sopenharmony_cienum iwl_fw_dbg_trigger_flags {
7128c2ecf20Sopenharmony_ci	IWL_FW_DBG_FORCE_RESTART = BIT(0),
7138c2ecf20Sopenharmony_ci};
7148c2ecf20Sopenharmony_ci
7158c2ecf20Sopenharmony_ci/**
7168c2ecf20Sopenharmony_ci * enum iwl_fw_dbg_trigger_vif_type - define the VIF type for a trigger
7178c2ecf20Sopenharmony_ci * @IWL_FW_DBG_CONF_VIF_ANY: any vif type
7188c2ecf20Sopenharmony_ci * @IWL_FW_DBG_CONF_VIF_IBSS: IBSS mode
7198c2ecf20Sopenharmony_ci * @IWL_FW_DBG_CONF_VIF_STATION: BSS mode
7208c2ecf20Sopenharmony_ci * @IWL_FW_DBG_CONF_VIF_AP: AP mode
7218c2ecf20Sopenharmony_ci * @IWL_FW_DBG_CONF_VIF_P2P_CLIENT: P2P Client mode
7228c2ecf20Sopenharmony_ci * @IWL_FW_DBG_CONF_VIF_P2P_GO: P2P GO mode
7238c2ecf20Sopenharmony_ci * @IWL_FW_DBG_CONF_VIF_P2P_DEVICE: P2P device
7248c2ecf20Sopenharmony_ci */
7258c2ecf20Sopenharmony_cienum iwl_fw_dbg_trigger_vif_type {
7268c2ecf20Sopenharmony_ci	IWL_FW_DBG_CONF_VIF_ANY = NL80211_IFTYPE_UNSPECIFIED,
7278c2ecf20Sopenharmony_ci	IWL_FW_DBG_CONF_VIF_IBSS = NL80211_IFTYPE_ADHOC,
7288c2ecf20Sopenharmony_ci	IWL_FW_DBG_CONF_VIF_STATION = NL80211_IFTYPE_STATION,
7298c2ecf20Sopenharmony_ci	IWL_FW_DBG_CONF_VIF_AP = NL80211_IFTYPE_AP,
7308c2ecf20Sopenharmony_ci	IWL_FW_DBG_CONF_VIF_P2P_CLIENT = NL80211_IFTYPE_P2P_CLIENT,
7318c2ecf20Sopenharmony_ci	IWL_FW_DBG_CONF_VIF_P2P_GO = NL80211_IFTYPE_P2P_GO,
7328c2ecf20Sopenharmony_ci	IWL_FW_DBG_CONF_VIF_P2P_DEVICE = NL80211_IFTYPE_P2P_DEVICE,
7338c2ecf20Sopenharmony_ci};
7348c2ecf20Sopenharmony_ci
7358c2ecf20Sopenharmony_ci/**
7368c2ecf20Sopenharmony_ci * struct iwl_fw_dbg_trigger_tlv - a TLV that describes the trigger
7378c2ecf20Sopenharmony_ci * @id: &enum iwl_fw_dbg_trigger
7388c2ecf20Sopenharmony_ci * @vif_type: &enum iwl_fw_dbg_trigger_vif_type
7398c2ecf20Sopenharmony_ci * @stop_conf_ids: bitmap of configurations this trigger relates to.
7408c2ecf20Sopenharmony_ci *	if the mode is %IWL_FW_DBG_TRIGGER_STOP, then if the bit corresponding
7418c2ecf20Sopenharmony_ci *	to the currently running configuration is set, the data should be
7428c2ecf20Sopenharmony_ci *	collected.
7438c2ecf20Sopenharmony_ci * @stop_delay: how many milliseconds to wait before collecting the data
7448c2ecf20Sopenharmony_ci *	after the STOP trigger fires.
7458c2ecf20Sopenharmony_ci * @mode: &enum iwl_fw_dbg_trigger_mode - can be stop / start of both
7468c2ecf20Sopenharmony_ci * @start_conf_id: if mode is %IWL_FW_DBG_TRIGGER_START, this defines what
7478c2ecf20Sopenharmony_ci *	configuration should be applied when the triggers kicks in.
7488c2ecf20Sopenharmony_ci * @occurrences: number of occurrences. 0 means the trigger will never fire.
7498c2ecf20Sopenharmony_ci * @trig_dis_ms: the time, in milliseconds, after an occurrence of this
7508c2ecf20Sopenharmony_ci *	trigger in which another occurrence should be ignored.
7518c2ecf20Sopenharmony_ci * @flags: &enum iwl_fw_dbg_trigger_flags
7528c2ecf20Sopenharmony_ci */
7538c2ecf20Sopenharmony_cistruct iwl_fw_dbg_trigger_tlv {
7548c2ecf20Sopenharmony_ci	__le32 id;
7558c2ecf20Sopenharmony_ci	__le32 vif_type;
7568c2ecf20Sopenharmony_ci	__le32 stop_conf_ids;
7578c2ecf20Sopenharmony_ci	__le32 stop_delay;
7588c2ecf20Sopenharmony_ci	u8 mode;
7598c2ecf20Sopenharmony_ci	u8 start_conf_id;
7608c2ecf20Sopenharmony_ci	__le16 occurrences;
7618c2ecf20Sopenharmony_ci	__le16 trig_dis_ms;
7628c2ecf20Sopenharmony_ci	u8 flags;
7638c2ecf20Sopenharmony_ci	u8 reserved[5];
7648c2ecf20Sopenharmony_ci
7658c2ecf20Sopenharmony_ci	u8 data[0];
7668c2ecf20Sopenharmony_ci} __packed;
7678c2ecf20Sopenharmony_ci
7688c2ecf20Sopenharmony_ci#define FW_DBG_START_FROM_ALIVE	0
7698c2ecf20Sopenharmony_ci#define FW_DBG_CONF_MAX		32
7708c2ecf20Sopenharmony_ci#define FW_DBG_INVALID		0xff
7718c2ecf20Sopenharmony_ci
7728c2ecf20Sopenharmony_ci/**
7738c2ecf20Sopenharmony_ci * struct iwl_fw_dbg_trigger_missed_bcon - configures trigger for missed beacons
7748c2ecf20Sopenharmony_ci * @stop_consec_missed_bcon: stop recording if threshold is crossed.
7758c2ecf20Sopenharmony_ci * @stop_consec_missed_bcon_since_rx: stop recording if threshold is crossed.
7768c2ecf20Sopenharmony_ci * @start_consec_missed_bcon: start recording if threshold is crossed.
7778c2ecf20Sopenharmony_ci * @start_consec_missed_bcon_since_rx: start recording if threshold is crossed.
7788c2ecf20Sopenharmony_ci * @reserved1: reserved
7798c2ecf20Sopenharmony_ci * @reserved2: reserved
7808c2ecf20Sopenharmony_ci */
7818c2ecf20Sopenharmony_cistruct iwl_fw_dbg_trigger_missed_bcon {
7828c2ecf20Sopenharmony_ci	__le32 stop_consec_missed_bcon;
7838c2ecf20Sopenharmony_ci	__le32 stop_consec_missed_bcon_since_rx;
7848c2ecf20Sopenharmony_ci	__le32 reserved2[2];
7858c2ecf20Sopenharmony_ci	__le32 start_consec_missed_bcon;
7868c2ecf20Sopenharmony_ci	__le32 start_consec_missed_bcon_since_rx;
7878c2ecf20Sopenharmony_ci	__le32 reserved1[2];
7888c2ecf20Sopenharmony_ci} __packed;
7898c2ecf20Sopenharmony_ci
7908c2ecf20Sopenharmony_ci/**
7918c2ecf20Sopenharmony_ci * struct iwl_fw_dbg_trigger_cmd - configures trigger for messages from FW.
7928c2ecf20Sopenharmony_ci * cmds: the list of commands to trigger the collection on
7938c2ecf20Sopenharmony_ci */
7948c2ecf20Sopenharmony_cistruct iwl_fw_dbg_trigger_cmd {
7958c2ecf20Sopenharmony_ci	struct cmd {
7968c2ecf20Sopenharmony_ci		u8 cmd_id;
7978c2ecf20Sopenharmony_ci		u8 group_id;
7988c2ecf20Sopenharmony_ci	} __packed cmds[16];
7998c2ecf20Sopenharmony_ci} __packed;
8008c2ecf20Sopenharmony_ci
8018c2ecf20Sopenharmony_ci/**
8028c2ecf20Sopenharmony_ci * iwl_fw_dbg_trigger_stats - configures trigger for statistics
8038c2ecf20Sopenharmony_ci * @stop_offset: the offset of the value to be monitored
8048c2ecf20Sopenharmony_ci * @stop_threshold: the threshold above which to collect
8058c2ecf20Sopenharmony_ci * @start_offset: the offset of the value to be monitored
8068c2ecf20Sopenharmony_ci * @start_threshold: the threshold above which to start recording
8078c2ecf20Sopenharmony_ci */
8088c2ecf20Sopenharmony_cistruct iwl_fw_dbg_trigger_stats {
8098c2ecf20Sopenharmony_ci	__le32 stop_offset;
8108c2ecf20Sopenharmony_ci	__le32 stop_threshold;
8118c2ecf20Sopenharmony_ci	__le32 start_offset;
8128c2ecf20Sopenharmony_ci	__le32 start_threshold;
8138c2ecf20Sopenharmony_ci} __packed;
8148c2ecf20Sopenharmony_ci
8158c2ecf20Sopenharmony_ci/**
8168c2ecf20Sopenharmony_ci * struct iwl_fw_dbg_trigger_low_rssi - trigger for low beacon RSSI
8178c2ecf20Sopenharmony_ci * @rssi: RSSI value to trigger at
8188c2ecf20Sopenharmony_ci */
8198c2ecf20Sopenharmony_cistruct iwl_fw_dbg_trigger_low_rssi {
8208c2ecf20Sopenharmony_ci	__le32 rssi;
8218c2ecf20Sopenharmony_ci} __packed;
8228c2ecf20Sopenharmony_ci
8238c2ecf20Sopenharmony_ci/**
8248c2ecf20Sopenharmony_ci * struct iwl_fw_dbg_trigger_mlme - configures trigger for mlme events
8258c2ecf20Sopenharmony_ci * @stop_auth_denied: number of denied authentication to collect
8268c2ecf20Sopenharmony_ci * @stop_auth_timeout: number of authentication timeout to collect
8278c2ecf20Sopenharmony_ci * @stop_rx_deauth: number of Rx deauth before to collect
8288c2ecf20Sopenharmony_ci * @stop_tx_deauth: number of Tx deauth before to collect
8298c2ecf20Sopenharmony_ci * @stop_assoc_denied: number of denied association to collect
8308c2ecf20Sopenharmony_ci * @stop_assoc_timeout: number of association timeout to collect
8318c2ecf20Sopenharmony_ci * @stop_connection_loss: number of connection loss to collect
8328c2ecf20Sopenharmony_ci * @start_auth_denied: number of denied authentication to start recording
8338c2ecf20Sopenharmony_ci * @start_auth_timeout: number of authentication timeout to start recording
8348c2ecf20Sopenharmony_ci * @start_rx_deauth: number of Rx deauth to start recording
8358c2ecf20Sopenharmony_ci * @start_tx_deauth: number of Tx deauth to start recording
8368c2ecf20Sopenharmony_ci * @start_assoc_denied: number of denied association to start recording
8378c2ecf20Sopenharmony_ci * @start_assoc_timeout: number of association timeout to start recording
8388c2ecf20Sopenharmony_ci * @start_connection_loss: number of connection loss to start recording
8398c2ecf20Sopenharmony_ci */
8408c2ecf20Sopenharmony_cistruct iwl_fw_dbg_trigger_mlme {
8418c2ecf20Sopenharmony_ci	u8 stop_auth_denied;
8428c2ecf20Sopenharmony_ci	u8 stop_auth_timeout;
8438c2ecf20Sopenharmony_ci	u8 stop_rx_deauth;
8448c2ecf20Sopenharmony_ci	u8 stop_tx_deauth;
8458c2ecf20Sopenharmony_ci
8468c2ecf20Sopenharmony_ci	u8 stop_assoc_denied;
8478c2ecf20Sopenharmony_ci	u8 stop_assoc_timeout;
8488c2ecf20Sopenharmony_ci	u8 stop_connection_loss;
8498c2ecf20Sopenharmony_ci	u8 reserved;
8508c2ecf20Sopenharmony_ci
8518c2ecf20Sopenharmony_ci	u8 start_auth_denied;
8528c2ecf20Sopenharmony_ci	u8 start_auth_timeout;
8538c2ecf20Sopenharmony_ci	u8 start_rx_deauth;
8548c2ecf20Sopenharmony_ci	u8 start_tx_deauth;
8558c2ecf20Sopenharmony_ci
8568c2ecf20Sopenharmony_ci	u8 start_assoc_denied;
8578c2ecf20Sopenharmony_ci	u8 start_assoc_timeout;
8588c2ecf20Sopenharmony_ci	u8 start_connection_loss;
8598c2ecf20Sopenharmony_ci	u8 reserved2;
8608c2ecf20Sopenharmony_ci} __packed;
8618c2ecf20Sopenharmony_ci
8628c2ecf20Sopenharmony_ci/**
8638c2ecf20Sopenharmony_ci * struct iwl_fw_dbg_trigger_txq_timer - configures the Tx queue's timer
8648c2ecf20Sopenharmony_ci * @command_queue: timeout for the command queue in ms
8658c2ecf20Sopenharmony_ci * @bss: timeout for the queues of a BSS (except for TDLS queues) in ms
8668c2ecf20Sopenharmony_ci * @softap: timeout for the queues of a softAP in ms
8678c2ecf20Sopenharmony_ci * @p2p_go: timeout for the queues of a P2P GO in ms
8688c2ecf20Sopenharmony_ci * @p2p_client: timeout for the queues of a P2P client in ms
8698c2ecf20Sopenharmony_ci * @p2p_device: timeout for the queues of a P2P device in ms
8708c2ecf20Sopenharmony_ci * @ibss: timeout for the queues of an IBSS in ms
8718c2ecf20Sopenharmony_ci * @tdls: timeout for the queues of a TDLS station in ms
8728c2ecf20Sopenharmony_ci */
8738c2ecf20Sopenharmony_cistruct iwl_fw_dbg_trigger_txq_timer {
8748c2ecf20Sopenharmony_ci	__le32 command_queue;
8758c2ecf20Sopenharmony_ci	__le32 bss;
8768c2ecf20Sopenharmony_ci	__le32 softap;
8778c2ecf20Sopenharmony_ci	__le32 p2p_go;
8788c2ecf20Sopenharmony_ci	__le32 p2p_client;
8798c2ecf20Sopenharmony_ci	__le32 p2p_device;
8808c2ecf20Sopenharmony_ci	__le32 ibss;
8818c2ecf20Sopenharmony_ci	__le32 tdls;
8828c2ecf20Sopenharmony_ci	__le32 reserved[4];
8838c2ecf20Sopenharmony_ci} __packed;
8848c2ecf20Sopenharmony_ci
8858c2ecf20Sopenharmony_ci/**
8868c2ecf20Sopenharmony_ci * struct iwl_fw_dbg_trigger_time_event - configures a time event trigger
8878c2ecf20Sopenharmony_ci * time_Events: a list of tuples <id, action_bitmap>. The driver will issue a
8888c2ecf20Sopenharmony_ci *	trigger each time a time event notification that relates to time event
8898c2ecf20Sopenharmony_ci *	id with one of the actions in the bitmap is received and
8908c2ecf20Sopenharmony_ci *	BIT(notif->status) is set in status_bitmap.
8918c2ecf20Sopenharmony_ci *
8928c2ecf20Sopenharmony_ci */
8938c2ecf20Sopenharmony_cistruct iwl_fw_dbg_trigger_time_event {
8948c2ecf20Sopenharmony_ci	struct {
8958c2ecf20Sopenharmony_ci		__le32 id;
8968c2ecf20Sopenharmony_ci		__le32 action_bitmap;
8978c2ecf20Sopenharmony_ci		__le32 status_bitmap;
8988c2ecf20Sopenharmony_ci	} __packed time_events[16];
8998c2ecf20Sopenharmony_ci} __packed;
9008c2ecf20Sopenharmony_ci
9018c2ecf20Sopenharmony_ci/**
9028c2ecf20Sopenharmony_ci * struct iwl_fw_dbg_trigger_ba - configures BlockAck related trigger
9038c2ecf20Sopenharmony_ci * rx_ba_start: tid bitmap to configure on what tid the trigger should occur
9048c2ecf20Sopenharmony_ci *	when an Rx BlockAck session is started.
9058c2ecf20Sopenharmony_ci * rx_ba_stop: tid bitmap to configure on what tid the trigger should occur
9068c2ecf20Sopenharmony_ci *	when an Rx BlockAck session is stopped.
9078c2ecf20Sopenharmony_ci * tx_ba_start: tid bitmap to configure on what tid the trigger should occur
9088c2ecf20Sopenharmony_ci *	when a Tx BlockAck session is started.
9098c2ecf20Sopenharmony_ci * tx_ba_stop: tid bitmap to configure on what tid the trigger should occur
9108c2ecf20Sopenharmony_ci *	when a Tx BlockAck session is stopped.
9118c2ecf20Sopenharmony_ci * rx_bar: tid bitmap to configure on what tid the trigger should occur
9128c2ecf20Sopenharmony_ci *	when a BAR is received (for a Tx BlockAck session).
9138c2ecf20Sopenharmony_ci * tx_bar: tid bitmap to configure on what tid the trigger should occur
9148c2ecf20Sopenharmony_ci *	when a BAR is send (for an Rx BlocAck session).
9158c2ecf20Sopenharmony_ci * frame_timeout: tid bitmap to configure on what tid the trigger should occur
9168c2ecf20Sopenharmony_ci *	when a frame times out in the reodering buffer.
9178c2ecf20Sopenharmony_ci */
9188c2ecf20Sopenharmony_cistruct iwl_fw_dbg_trigger_ba {
9198c2ecf20Sopenharmony_ci	__le16 rx_ba_start;
9208c2ecf20Sopenharmony_ci	__le16 rx_ba_stop;
9218c2ecf20Sopenharmony_ci	__le16 tx_ba_start;
9228c2ecf20Sopenharmony_ci	__le16 tx_ba_stop;
9238c2ecf20Sopenharmony_ci	__le16 rx_bar;
9248c2ecf20Sopenharmony_ci	__le16 tx_bar;
9258c2ecf20Sopenharmony_ci	__le16 frame_timeout;
9268c2ecf20Sopenharmony_ci} __packed;
9278c2ecf20Sopenharmony_ci
9288c2ecf20Sopenharmony_ci/**
9298c2ecf20Sopenharmony_ci * struct iwl_fw_dbg_trigger_tdls - configures trigger for TDLS events.
9308c2ecf20Sopenharmony_ci * @action_bitmap: the TDLS action to trigger the collection upon
9318c2ecf20Sopenharmony_ci * @peer_mode: trigger on specific peer or all
9328c2ecf20Sopenharmony_ci * @peer: the TDLS peer to trigger the collection on
9338c2ecf20Sopenharmony_ci */
9348c2ecf20Sopenharmony_cistruct iwl_fw_dbg_trigger_tdls {
9358c2ecf20Sopenharmony_ci	u8 action_bitmap;
9368c2ecf20Sopenharmony_ci	u8 peer_mode;
9378c2ecf20Sopenharmony_ci	u8 peer[ETH_ALEN];
9388c2ecf20Sopenharmony_ci	u8 reserved[4];
9398c2ecf20Sopenharmony_ci} __packed;
9408c2ecf20Sopenharmony_ci
9418c2ecf20Sopenharmony_ci/**
9428c2ecf20Sopenharmony_ci * struct iwl_fw_dbg_trigger_tx_status - configures trigger for tx response
9438c2ecf20Sopenharmony_ci *  status.
9448c2ecf20Sopenharmony_ci * @statuses: the list of statuses to trigger the collection on
9458c2ecf20Sopenharmony_ci */
9468c2ecf20Sopenharmony_cistruct iwl_fw_dbg_trigger_tx_status {
9478c2ecf20Sopenharmony_ci	struct tx_status {
9488c2ecf20Sopenharmony_ci		u8 status;
9498c2ecf20Sopenharmony_ci		u8 reserved[3];
9508c2ecf20Sopenharmony_ci	} __packed statuses[16];
9518c2ecf20Sopenharmony_ci	__le32 reserved[2];
9528c2ecf20Sopenharmony_ci} __packed;
9538c2ecf20Sopenharmony_ci
9548c2ecf20Sopenharmony_ci/**
9558c2ecf20Sopenharmony_ci * struct iwl_fw_dbg_conf_tlv - a TLV that describes a debug configuration.
9568c2ecf20Sopenharmony_ci * @id: conf id
9578c2ecf20Sopenharmony_ci * @usniffer: should the uSniffer image be used
9588c2ecf20Sopenharmony_ci * @num_of_hcmds: how many HCMDs to send are present here
9598c2ecf20Sopenharmony_ci * @hcmd: a variable length host command to be sent to apply the configuration.
9608c2ecf20Sopenharmony_ci *	If there is more than one HCMD to send, they will appear one after the
9618c2ecf20Sopenharmony_ci *	other and be sent in the order that they appear in.
9628c2ecf20Sopenharmony_ci * This parses IWL_UCODE_TLV_FW_DBG_CONF. The user can add up-to
9638c2ecf20Sopenharmony_ci * %FW_DBG_CONF_MAX configuration per run.
9648c2ecf20Sopenharmony_ci */
9658c2ecf20Sopenharmony_cistruct iwl_fw_dbg_conf_tlv {
9668c2ecf20Sopenharmony_ci	u8 id;
9678c2ecf20Sopenharmony_ci	u8 usniffer;
9688c2ecf20Sopenharmony_ci	u8 reserved;
9698c2ecf20Sopenharmony_ci	u8 num_of_hcmds;
9708c2ecf20Sopenharmony_ci	struct iwl_fw_dbg_conf_hcmd hcmd;
9718c2ecf20Sopenharmony_ci} __packed;
9728c2ecf20Sopenharmony_ci
9738c2ecf20Sopenharmony_ci#define IWL_FW_CMD_VER_UNKNOWN 99
9748c2ecf20Sopenharmony_ci
9758c2ecf20Sopenharmony_ci/**
9768c2ecf20Sopenharmony_ci * struct iwl_fw_cmd_version - firmware command version entry
9778c2ecf20Sopenharmony_ci * @cmd: command ID
9788c2ecf20Sopenharmony_ci * @group: group ID
9798c2ecf20Sopenharmony_ci * @cmd_ver: command version
9808c2ecf20Sopenharmony_ci * @notif_ver: notification version
9818c2ecf20Sopenharmony_ci */
9828c2ecf20Sopenharmony_cistruct iwl_fw_cmd_version {
9838c2ecf20Sopenharmony_ci	u8 cmd;
9848c2ecf20Sopenharmony_ci	u8 group;
9858c2ecf20Sopenharmony_ci	u8 cmd_ver;
9868c2ecf20Sopenharmony_ci	u8 notif_ver;
9878c2ecf20Sopenharmony_ci} __packed;
9888c2ecf20Sopenharmony_ci
9898c2ecf20Sopenharmony_cistatic inline size_t _iwl_tlv_array_len(const struct iwl_ucode_tlv *tlv,
9908c2ecf20Sopenharmony_ci					size_t fixed_size, size_t var_size)
9918c2ecf20Sopenharmony_ci{
9928c2ecf20Sopenharmony_ci	size_t var_len = le32_to_cpu(tlv->length) - fixed_size;
9938c2ecf20Sopenharmony_ci
9948c2ecf20Sopenharmony_ci	if (WARN_ON(var_len % var_size))
9958c2ecf20Sopenharmony_ci		return 0;
9968c2ecf20Sopenharmony_ci
9978c2ecf20Sopenharmony_ci	return var_len / var_size;
9988c2ecf20Sopenharmony_ci}
9998c2ecf20Sopenharmony_ci
10008c2ecf20Sopenharmony_ci#define iwl_tlv_array_len(_tlv_ptr, _struct_ptr, _memb)			\
10018c2ecf20Sopenharmony_ci	_iwl_tlv_array_len((_tlv_ptr), sizeof(*(_struct_ptr)),		\
10028c2ecf20Sopenharmony_ci			   sizeof(_struct_ptr->_memb[0]))
10038c2ecf20Sopenharmony_ci
10048c2ecf20Sopenharmony_ci#endif  /* __iwl_fw_file_h__ */
1005