.. | .. |
---|
1 | | -/* SPDX-License-Identifier: GPL-2.0 */ |
---|
2 | 1 | /* |
---|
3 | 2 | * NVRAM variable manipulation |
---|
4 | 3 | * |
---|
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 | + * |
---|
7 | 8 | * Unless you and Broadcom execute a separate written software license |
---|
8 | 9 | * agreement governing use of this software, this software is licensed to you |
---|
9 | 10 | * under the terms of the GNU General Public License version 2 (the "GPL"), |
---|
10 | 11 | * available at http://www.broadcom.com/licenses/GPLv2.php, with the |
---|
11 | 12 | * following added to such license: |
---|
12 | | - * |
---|
| 13 | + * |
---|
13 | 14 | * As a special exception, the copyright holders of this software give you |
---|
14 | 15 | * permission to link this software with independent modules, and to copy and |
---|
15 | 16 | * distribute the resulting executable under terms of your choice, provided that |
---|
.. | .. |
---|
17 | 18 | * the license of that module. An independent module is a module which is not |
---|
18 | 19 | * derived from this software. The special exception does not apply to any |
---|
19 | 20 | * modifications of the software. |
---|
20 | | - * |
---|
| 21 | + * |
---|
21 | 22 | * Notwithstanding the above, under no circumstances may you combine this |
---|
22 | 23 | * software in any way with any other Broadcom software provided under a license |
---|
23 | 24 | * other than the GPL, without Broadcom's express prior written consent. |
---|
.. | .. |
---|
25 | 26 | * |
---|
26 | 27 | * <<Broadcom-WL-IPTag/Open:>> |
---|
27 | 28 | * |
---|
28 | | - * $Id: bcmnvram.h 514727 2014-11-12 03:02:48Z $ |
---|
| 29 | + * $Id: bcmnvram.h 655606 2016-08-22 17:16:11Z $ |
---|
29 | 30 | */ |
---|
30 | 31 | |
---|
31 | 32 | #ifndef _bcmnvram_h_ |
---|
.. | .. |
---|
71 | 72 | extern int nvram_init(void *sih); |
---|
72 | 73 | extern int nvram_deinit(void *sih); |
---|
73 | 74 | |
---|
| 75 | +extern int nvram_file_read(char **nvramp, int *nvraml); |
---|
74 | 76 | |
---|
75 | 77 | /* |
---|
76 | 78 | * Append a chunk of nvram variables to the global list |
---|
.. | .. |
---|
78 | 80 | extern int nvram_append(void *si, char *vars, uint varsz); |
---|
79 | 81 | |
---|
80 | 82 | extern void nvram_get_global_vars(char **varlst, uint *varsz); |
---|
81 | | - |
---|
82 | 83 | |
---|
83 | 84 | /* |
---|
84 | 85 | * Check for reset button press for restoring factory defaults. |
---|
.. | .. |
---|
137 | 138 | nvram_match(const char *name, const char *match) |
---|
138 | 139 | { |
---|
139 | 140 | 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 | + |
---|
140 | 150 | return (value && !strcmp(value, match)); |
---|
141 | 151 | } |
---|
142 | 152 | |
---|
.. | .. |
---|
152 | 162 | nvram_match_bitflag(const char *name, const int bit, const char *match) |
---|
153 | 163 | { |
---|
154 | 164 | const char *value = nvram_get_bitflag(name, bit); |
---|
| 165 | + BCM_REFERENCE(match); |
---|
155 | 166 | return (value && !strcmp(value, match)); |
---|
156 | 167 | } |
---|
157 | 168 | |
---|
.. | .. |
---|
166 | 177 | nvram_invmatch(const char *name, const char *invmatch) |
---|
167 | 178 | { |
---|
168 | 179 | 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 | + |
---|
169 | 189 | return (value && strcmp(value, invmatch)); |
---|
170 | 190 | } |
---|
171 | 191 | |
---|
.. | .. |
---|
247 | 267 | /* For CFE builds this gets passed in thru the makefile */ |
---|
248 | 268 | #ifndef MAX_NVRAM_SPACE |
---|
249 | 269 | #define MAX_NVRAM_SPACE 0x10000 |
---|
250 | | -#endif |
---|
| 270 | +#endif // endif |
---|
251 | 271 | #define DEF_NVRAM_SPACE 0x8000 |
---|
252 | 272 | #define ROM_ENVRAM_SPACE 0x1000 |
---|
253 | 273 | #define NVRAM_LZMA_MAGIC 0x4c5a4d41 /* 'LZMA' */ |
---|
.. | .. |
---|
265 | 285 | #define BCM_JUMBO_NVRAM_DELIMIT '\n' |
---|
266 | 286 | #define BCM_JUMBO_START "Broadcom Jumbo Nvram file" |
---|
267 | 287 | |
---|
268 | | - |
---|
269 | 288 | #if (defined(FAILSAFE_UPGRADE) || defined(CONFIG_FAILSAFE_UPGRADE) || \ |
---|
270 | 289 | defined(__CONFIG_FAILSAFE_UPGRADE_SUPPORT__)) |
---|
271 | 290 | #define IMAGE_SIZE "image_size" |
---|
.. | .. |
---|
281 | 300 | #define IMAGE_SECOND_OFFSET "image_second_offset" |
---|
282 | 301 | #define LINUX_FIRST "linux" |
---|
283 | 302 | #define LINUX_SECOND "linux2" |
---|
284 | | -#endif |
---|
| 303 | +#endif // endif |
---|
285 | 304 | |
---|
286 | 305 | #if (defined(DUAL_IMAGE) || defined(CONFIG_DUAL_IMAGE) || \ |
---|
287 | 306 | defined(__CONFIG_DUAL_IMAGE_FLASH_SUPPORT__)) |
---|