From d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d Mon Sep 17 00:00:00 2001
From: hc <hc@nodka.com>
Date: Mon, 11 Dec 2023 02:45:28 +0000
Subject: [PATCH] add boot partition  size

---
 kernel/drivers/net/wireless/rockchip_wlan/cywdhd/bcmdhd/bcmwifi_rates.h |  222 +++++++++++++++----------------------------------------
 1 files changed, 62 insertions(+), 160 deletions(-)

diff --git a/kernel/drivers/net/wireless/rockchip_wlan/cywdhd/bcmdhd/bcmwifi_rates.h b/kernel/drivers/net/wireless/rockchip_wlan/cywdhd/bcmdhd/bcmwifi_rates.h
index da92971..79b629e 100644
--- a/kernel/drivers/net/wireless/rockchip_wlan/cywdhd/bcmdhd/bcmwifi_rates.h
+++ b/kernel/drivers/net/wireless/rockchip_wlan/cywdhd/bcmdhd/bcmwifi_rates.h
@@ -1,15 +1,16 @@
-/* SPDX-License-Identifier: GPL-2.0 */
 /*
  * Indices for 802.11 a/b/g/n/ac 1-3 chain symmetric transmit rates
  *
- * Copyright (C) 1999-2019, Broadcom Corporation
- * 
+ * Portions of this code are copyright (c) 2022 Cypress Semiconductor Corporation
+ *
+ * Copyright (C) 1999-2017, Broadcom Corporation
+ *
  *      Unless you and Broadcom execute a separate written software license
  * agreement governing use of this software, this software is licensed to you
  * under the terms of the GNU General Public License version 2 (the "GPL"),
  * available at http://www.broadcom.com/licenses/GPLv2.php, with the
  * following added to such license:
- * 
+ *
  *      As a special exception, the copyright holders of this software give you
  * permission to link this software with independent modules, and to copy and
  * distribute the resulting executable under terms of your choice, provided that
@@ -17,7 +18,7 @@
  * the license of that module.  An independent module is a module which is not
  * derived from this software.  The special exception does not apply to any
  * modifications of the software.
- * 
+ *
  *      Notwithstanding the above, under no circumstances may you combine this
  * software in any way with any other Broadcom software provided under a license
  * other than the GPL, without Broadcom's express prior written consent.
@@ -25,27 +26,25 @@
  *
  * <<Broadcom-WL-IPTag/Open:>>
  *
- * $Id: bcmwifi_rates.h 5187 2012-06-29 06:17:50Z $
+ * $Id: bcmwifi_rates.h 697006 2017-05-01 19:13:40Z $
  */
 
 #ifndef _bcmwifi_rates_h_
 #define _bcmwifi_rates_h_
 
+#include <typedefs.h>
+
 #ifdef __cplusplus
 extern "C" {
 #endif /* __cplusplus */
 
-
 #define WL_RATESET_SZ_DSSS		4
 #define WL_RATESET_SZ_OFDM		8
-#define WL_RATESET_SZ_VHT_MCS	10
-#define WL_RATESET_SZ_VHT_MCS_P	12
+#define WL_RATESET_SZ_VHT_MCS		10
+#define WL_RATESET_SZ_VHT_MCS_P		12	/* 10 VHT rates + 2 proprietary rates */
+#define WL_RATESET_SZ_HE_MCS		12	/* 12 HE rates (mcs 0-11) */
 
-#if defined(WLPROPRIETARY_11N_RATES)
-#define WL_RATESET_SZ_HT_MCS	WL_RATESET_SZ_VHT_MCS
-#else
 #define WL_RATESET_SZ_HT_MCS	8
-#endif
 
 #define WL_RATESET_SZ_HT_IOCTL	8	/* MAC histogram, compatibility with wl utility */
 
@@ -76,7 +75,6 @@
 	WL_TX_BW_10
 } wl_tx_bw_t;
 
-
 /*
  * Transmit modes.
  * Not all modes are listed here, only those required for disambiguation. e.g. SPEXP is not listed
@@ -89,7 +87,6 @@
 	WL_NUM_TX_MODES
 } wl_tx_mode_t;
 
-
 /* Number of transmit chains */
 typedef enum wl_tx_chains {
 	WL_TX_CHAINS_1 = 1,
@@ -97,7 +94,6 @@
 	WL_TX_CHAINS_3,
 	WL_TX_CHAINS_4
 } wl_tx_chains_t;
-
 
 /* Number of transmit streams */
 typedef enum wl_tx_nss {
@@ -107,147 +103,9 @@
 	WL_TX_NSS_4
 } wl_tx_nss_t;
 
-
 /* This enum maps each rate to a CLM index */
 
 typedef enum clm_rates {
-#ifdef WL_OLDPPR
-	/************
-	 * 1 chain  *
-	 ************
-	 */
-
-	CLM_RATE_1X1_DSSS_1			= 0,
-	CLM_RATE_1X1_DSSS_2			= 1,
-	CLM_RATE_1X1_DSSS_5_5		= 2,
-	CLM_RATE_1X1_DSSS_11		= 3,
-
-	CLM_RATE_1X1_OFDM_6			= 4,
-	CLM_RATE_1X1_OFDM_9			= 5,
-	CLM_RATE_1X1_OFDM_12		= 6,
-	CLM_RATE_1X1_OFDM_18		= 7,
-	CLM_RATE_1X1_OFDM_24		= 8,
-	CLM_RATE_1X1_OFDM_36		= 9,
-	CLM_RATE_1X1_OFDM_48		= 10,
-	CLM_RATE_1X1_OFDM_54		= 11,
-
-	CLM_RATE_1X1_MCS0			= 12,
-	CLM_RATE_1X1_MCS1			= 13,
-	CLM_RATE_1X1_MCS2			= 14,
-	CLM_RATE_1X1_MCS3			= 15,
-	CLM_RATE_1X1_MCS4			= 16,
-	CLM_RATE_1X1_MCS5			= 17,
-	CLM_RATE_1X1_MCS6			= 18,
-	CLM_RATE_1X1_MCS7			= 19,
-
-	/************
-	 * 2 chains *
-	 ************
-	 */
-
-	/* 1 Stream expanded + 1 */
-	CLM_RATE_1X2_DSSS_1			= 20,
-	CLM_RATE_1X2_DSSS_2			= 21,
-	CLM_RATE_1X2_DSSS_5_5		= 22,
-	CLM_RATE_1X2_DSSS_11		= 23,
-
-	CLM_RATE_1X2_CDD_OFDM_6		= 24,
-	CLM_RATE_1X2_CDD_OFDM_9		= 25,
-	CLM_RATE_1X2_CDD_OFDM_12	= 26,
-	CLM_RATE_1X2_CDD_OFDM_18	= 27,
-	CLM_RATE_1X2_CDD_OFDM_24	= 28,
-	CLM_RATE_1X2_CDD_OFDM_36	= 29,
-	CLM_RATE_1X2_CDD_OFDM_48	= 30,
-	CLM_RATE_1X2_CDD_OFDM_54	= 31,
-
-	CLM_RATE_1X2_CDD_MCS0		= 32,
-	CLM_RATE_1X2_CDD_MCS1		= 33,
-	CLM_RATE_1X2_CDD_MCS2		= 34,
-	CLM_RATE_1X2_CDD_MCS3		= 35,
-	CLM_RATE_1X2_CDD_MCS4		= 36,
-	CLM_RATE_1X2_CDD_MCS5		= 37,
-	CLM_RATE_1X2_CDD_MCS6		= 38,
-	CLM_RATE_1X2_CDD_MCS7		= 39,
-
-	/* 2 Streams */
-	CLM_RATE_2X2_STBC_MCS0		= 40,
-	CLM_RATE_2X2_STBC_MCS1		= 41,
-	CLM_RATE_2X2_STBC_MCS2		= 42,
-	CLM_RATE_2X2_STBC_MCS3		= 43,
-	CLM_RATE_2X2_STBC_MCS4		= 44,
-	CLM_RATE_2X2_STBC_MCS5		= 45,
-	CLM_RATE_2X2_STBC_MCS6		= 46,
-	CLM_RATE_2X2_STBC_MCS7		= 47,
-
-	CLM_RATE_2X2_SDM_MCS8		= 48,
-	CLM_RATE_2X2_SDM_MCS9		= 49,
-	CLM_RATE_2X2_SDM_MCS10		= 50,
-	CLM_RATE_2X2_SDM_MCS11		= 51,
-	CLM_RATE_2X2_SDM_MCS12		= 52,
-	CLM_RATE_2X2_SDM_MCS13		= 53,
-	CLM_RATE_2X2_SDM_MCS14		= 54,
-	CLM_RATE_2X2_SDM_MCS15		= 55,
-
-
-	/************
-	 * 3 chains *
-	 ************
-	 */
-
-	/* 1 Stream expanded + 2 */
-	CLM_RATE_1X3_DSSS_1			= 56,
-	CLM_RATE_1X3_DSSS_2			= 57,
-	CLM_RATE_1X3_DSSS_5_5		= 58,
-	CLM_RATE_1X3_DSSS_11		= 59,
-
-	CLM_RATE_1X3_CDD_OFDM_6		= 60,
-	CLM_RATE_1X3_CDD_OFDM_9		= 61,
-	CLM_RATE_1X3_CDD_OFDM_12	= 62,
-	CLM_RATE_1X3_CDD_OFDM_18	= 63,
-	CLM_RATE_1X3_CDD_OFDM_24	= 64,
-	CLM_RATE_1X3_CDD_OFDM_36	= 65,
-	CLM_RATE_1X3_CDD_OFDM_48	= 66,
-	CLM_RATE_1X3_CDD_OFDM_54	= 67,
-
-	CLM_RATE_1X3_CDD_MCS0		= 68,
-	CLM_RATE_1X3_CDD_MCS1		= 69,
-	CLM_RATE_1X3_CDD_MCS2		= 70,
-	CLM_RATE_1X3_CDD_MCS3		= 71,
-	CLM_RATE_1X3_CDD_MCS4		= 72,
-	CLM_RATE_1X3_CDD_MCS5		= 73,
-	CLM_RATE_1X3_CDD_MCS6		= 74,
-	CLM_RATE_1X3_CDD_MCS7		= 75,
-
-	/* 2 Streams expanded + 1 */
-	CLM_RATE_2X3_STBC_MCS0		= 76,
-	CLM_RATE_2X3_STBC_MCS1		= 77,
-	CLM_RATE_2X3_STBC_MCS2		= 78,
-	CLM_RATE_2X3_STBC_MCS3		= 79,
-	CLM_RATE_2X3_STBC_MCS4		= 80,
-	CLM_RATE_2X3_STBC_MCS5		= 81,
-	CLM_RATE_2X3_STBC_MCS6		= 82,
-	CLM_RATE_2X3_STBC_MCS7		= 83,
-
-	CLM_RATE_2X3_SDM_MCS8		= 84,
-	CLM_RATE_2X3_SDM_MCS9		= 85,
-	CLM_RATE_2X3_SDM_MCS10		= 86,
-	CLM_RATE_2X3_SDM_MCS11		= 87,
-	CLM_RATE_2X3_SDM_MCS12		= 88,
-	CLM_RATE_2X3_SDM_MCS13		= 89,
-	CLM_RATE_2X3_SDM_MCS14		= 90,
-	CLM_RATE_2X3_SDM_MCS15		= 91,
-
-	/* 3 Streams */
-	CLM_RATE_3X3_SDM_MCS16		= 92,
-	CLM_RATE_3X3_SDM_MCS17		= 93,
-	CLM_RATE_3X3_SDM_MCS18		= 94,
-	CLM_RATE_3X3_SDM_MCS19		= 95,
-	CLM_RATE_3X3_SDM_MCS20		= 96,
-	CLM_RATE_3X3_SDM_MCS21		= 97,
-	CLM_RATE_3X3_SDM_MCS22		= 98,
-	CLM_RATE_3X3_SDM_MCS23		= 99,
-#endif /* WL_OLDPPR */
-
 	/************
 	* 1 chain  *
 	************
@@ -291,7 +149,6 @@
 	WL_RATE_1X1_VHT9SS1           = 21,
 	WL_RATE_P_1X1_VHT10SS1        = 22,
 	WL_RATE_P_1X1_VHT11SS1        = 23,
-
 
 	/************
 	* 2 chains *
@@ -450,7 +307,6 @@
 	WL_RATE_P_2X2_TXBF_VHT10SS2   = 102,
 	WL_RATE_P_2X2_TXBF_VHT11SS2   = 103,
 
-
 	/************
 	* 3 chains *
 	************
@@ -569,7 +425,6 @@
 	WL_RATE_P_3X3_VHT10SS3        = 162,
 	WL_RATE_P_3X3_VHT11SS3        = 163,
 
-
 	/****************************
 	 * TX Beamforming, 3 chains *
 	 ****************************
@@ -658,7 +513,6 @@
 	WL_RATE_3X3_TXBF_VHT9SS3      = 205,
 	WL_RATE_P_3X3_TXBF_VHT10SS3   = 206,
 	WL_RATE_P_3X3_TXBF_VHT11SS3   = 207,
-
 
 	/************
 	* 4 chains *
@@ -778,7 +632,6 @@
 	WL_RATE_P_3X4_VHT10SS3        = 266,
 	WL_RATE_P_3X4_VHT11SS3        = 267,
 
-
 	/* 4 Streams */
 	WL_RATE_4X4_SDM_MCS24         = 268,
 	WL_RATE_4X4_SDM_MCS25         = 269,
@@ -803,7 +656,6 @@
 	WL_RATE_4X4_VHT9SS4           = 277,
 	WL_RATE_P_4X4_VHT10SS4        = 278,
 	WL_RATE_P_4X4_VHT11SS4        = 279,
-
 
 	/****************************
 	 * TX Beamforming, 4 chains *
@@ -924,6 +776,56 @@
 /* Number of rate codes */
 #define WL_NUMRATES 336
 
+/* MCS rates */
+#define WLC_MAX_VHT_MCS	11	/**< Std VHT MCS 0-9 plus prop VHT MCS 10-11 */
+#define WLC_MAX_HE_MCS	11	/**< Std HE MCS 0-11 */
+
+/* Convert encoded rate value in plcp header to numerical rates in 500 KHz increments */
+#define OFDM_PHY2MAC_RATE(rlpt)         plcp_ofdm_rate_tbl[(rlpt) & 0x7]
+#define CCK_PHY2MAC_RATE(signal)	((signal)/5)
+
+/* given a proprietary MCS, get number of spatial streams */
+#define GET_PROPRIETARY_11N_MCS_NSS(mcs) (1 + ((mcs) - 85) / 8)
+
+#define GET_11N_MCS_NSS(mcs) ((mcs) < 32 ? (1 + ((mcs) / 8)) : \
+			      ((mcs) == 32 ? 1 : GET_PROPRIETARY_11N_MCS_NSS(mcs)))
+
+#define IS_PROPRIETARY_11N_MCS(mcs)	FALSE
+#define IS_PROPRIETARY_11N_SS_MCS(mcs)	FALSE /**< is proprietary HT single stream MCS */
+
+/* Store HE mcs map for all NSS in a compact form:
+ *
+ * bit[0:2] mcs code for NSS 1
+ * bit[3:5] mcs code for NSS 2
+ * ...
+ * bit[21:23] mcs code for NSS 8
+ */
+
+/**
+ * 3 bits are used for encoding each NSS mcs map (HE MCS MAP is 24 bits)
+ */
+#define HE_CAP_MCS_CODE_NONE		7
+
+/* macros to access above compact format */
+#define HE_CAP_MCS_NSS_SET_MASK		0x00ffffff /* Field is to be 24 bits long */
+#define HE_CAP_MCS_NSS_GET_SS_IDX(nss) (((nss)-1) * HE_CAP_MCS_CODE_SIZE)
+#define HE_CAP_MCS_NSS_GET_MCS(nss, mcs_nss_map) \
+	(((mcs_nss_map) >> HE_CAP_MCS_NSS_GET_SS_IDX(nss)) & HE_CAP_MCS_CODE_MASK)
+#define HE_CAP_MCS_NSS_SET_MCS(nss, mcs_code, mcs_nss_map) \
+	do { \
+	(mcs_nss_map) &= (~(HE_CAP_MCS_CODE_MASK << HE_CAP_MCS_NSS_GET_SS_IDX(nss))); \
+	(mcs_nss_map) |= (((mcs_code) & HE_CAP_MCS_CODE_MASK) << HE_CAP_MCS_NSS_GET_SS_IDX(nss)); \
+	(mcs_nss_map) &= (HE_CAP_MCS_NSS_SET_MASK); \
+	} while (0)
+
+extern const uint8 plcp_ofdm_rate_tbl[];
+
+uint8 wf_get_single_stream_mcs(uint mcs);
+
+uint8 wf_vht_plcp_to_rate(uint8 *plcp);
+uint wf_mcs_to_rate(uint mcs, uint nss, uint bw, int sgi);
+uint wf_he_mcs_to_rate(uint mcs, uint nss, uint bw, uint gi, bool dcm);
+uint wf_mcs_to_Ndbps(uint mcs, uint nss, uint bw);
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */

--
Gitblit v1.6.2