forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/drivers/net/wireless/rockchip_wlan/cywdhd/bcmdhd/include/bcmnvram.h
....@@ -1,15 +1,16 @@
1
-/* SPDX-License-Identifier: GPL-2.0 */
21 /*
32 * NVRAM variable manipulation
43 *
5
- * Copyright (C) 1999-2019, Broadcom Corporation
6
- *
4
+ * Portions of this code are copyright (c) 2022 Cypress Semiconductor Corporation
5
+ *
6
+ * Copyright (C) 1999-2017, Broadcom Corporation
7
+ *
78 * Unless you and Broadcom execute a separate written software license
89 * agreement governing use of this software, this software is licensed to you
910 * under the terms of the GNU General Public License version 2 (the "GPL"),
1011 * available at http://www.broadcom.com/licenses/GPLv2.php, with the
1112 * following added to such license:
12
- *
13
+ *
1314 * As a special exception, the copyright holders of this software give you
1415 * permission to link this software with independent modules, and to copy and
1516 * distribute the resulting executable under terms of your choice, provided that
....@@ -17,7 +18,7 @@
1718 * the license of that module. An independent module is a module which is not
1819 * derived from this software. The special exception does not apply to any
1920 * modifications of the software.
20
- *
21
+ *
2122 * Notwithstanding the above, under no circumstances may you combine this
2223 * software in any way with any other Broadcom software provided under a license
2324 * other than the GPL, without Broadcom's express prior written consent.
....@@ -25,7 +26,7 @@
2526 *
2627 * <<Broadcom-WL-IPTag/Open:>>
2728 *
28
- * $Id: bcmnvram.h 514727 2014-11-12 03:02:48Z $
29
+ * $Id: bcmnvram.h 655606 2016-08-22 17:16:11Z $
2930 */
3031
3132 #ifndef _bcmnvram_h_
....@@ -71,6 +72,7 @@
7172 extern int nvram_init(void *sih);
7273 extern int nvram_deinit(void *sih);
7374
75
+extern int nvram_file_read(char **nvramp, int *nvraml);
7476
7577 /*
7678 * Append a chunk of nvram variables to the global list
....@@ -78,7 +80,6 @@
7880 extern int nvram_append(void *si, char *vars, uint varsz);
7981
8082 extern void nvram_get_global_vars(char **varlst, uint *varsz);
81
-
8283
8384 /*
8485 * Check for reset button press for restoring factory defaults.
....@@ -137,6 +138,15 @@
137138 nvram_match(const char *name, const char *match)
138139 {
139140 const char *value = nvram_get(name);
141
+
142
+ /* In nvramstubs.c builds, nvram_get() is defined as returning zero,
143
+ * so the return line below never executes the strcmp(),
144
+ * resulting in 'match' being an unused parameter.
145
+ * Make a ref to 'match' to quiet the compiler warning.
146
+ */
147
+
148
+ BCM_REFERENCE(match);
149
+
140150 return (value && !strcmp(value, match));
141151 }
142152
....@@ -152,6 +162,7 @@
152162 nvram_match_bitflag(const char *name, const int bit, const char *match)
153163 {
154164 const char *value = nvram_get_bitflag(name, bit);
165
+ BCM_REFERENCE(match);
155166 return (value && !strcmp(value, match));
156167 }
157168
....@@ -166,6 +177,15 @@
166177 nvram_invmatch(const char *name, const char *invmatch)
167178 {
168179 const char *value = nvram_get(name);
180
+
181
+ /* In nvramstubs.c builds, nvram_get() is defined as returning zero,
182
+ * so the return line below never executes the strcmp(),
183
+ * resulting in 'invmatch' being an unused parameter.
184
+ * Make a ref to 'invmatch' to quiet the compiler warning.
185
+ */
186
+
187
+ BCM_REFERENCE(invmatch);
188
+
169189 return (value && strcmp(value, invmatch));
170190 }
171191
....@@ -247,7 +267,7 @@
247267 /* For CFE builds this gets passed in thru the makefile */
248268 #ifndef MAX_NVRAM_SPACE
249269 #define MAX_NVRAM_SPACE 0x10000
250
-#endif
270
+#endif // endif
251271 #define DEF_NVRAM_SPACE 0x8000
252272 #define ROM_ENVRAM_SPACE 0x1000
253273 #define NVRAM_LZMA_MAGIC 0x4c5a4d41 /* 'LZMA' */
....@@ -265,7 +285,6 @@
265285 #define BCM_JUMBO_NVRAM_DELIMIT '\n'
266286 #define BCM_JUMBO_START "Broadcom Jumbo Nvram file"
267287
268
-
269288 #if (defined(FAILSAFE_UPGRADE) || defined(CONFIG_FAILSAFE_UPGRADE) || \
270289 defined(__CONFIG_FAILSAFE_UPGRADE_SUPPORT__))
271290 #define IMAGE_SIZE "image_size"
....@@ -281,7 +300,7 @@
281300 #define IMAGE_SECOND_OFFSET "image_second_offset"
282301 #define LINUX_FIRST "linux"
283302 #define LINUX_SECOND "linux2"
284
-#endif
303
+#endif // endif
285304
286305 #if (defined(DUAL_IMAGE) || defined(CONFIG_DUAL_IMAGE) || \
287306 defined(__CONFIG_DUAL_IMAGE_FLASH_SUPPORT__))