summaryrefslogtreecommitdiffstats
path: root/include/env_internal.h
Commit message (Collapse)AuthorAgeFilesLines
* env: add ENV_ERASE_PTR macroPatrick Delaunay2021-04-161-0/+1
| | | | | | | | | | Add ENV_ERASE_PTR macro to handle erase opts and remove the associated ifdef. This patch is a extension of previous commit 82b2f4135719 ("env_internal.h: add alternative ENV_SAVE_PTR macro"). Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
* env: Allow to set default_environment[] from board code via compile option ↵Pali Rohár2021-02-081-0/+4
| | | | | | | | | | | | | | DEFAULT_ENV_IS_RW This change allows board code to modify default_environment[] array when compile option DEFAULT_ENV_IS_RW is specified in board config file. Some board default variables depend on runtime configuration which is not known at compile time. Therefore allow to set default_environment[] array as non-const and allow board code to modify it when it is needed. Signed-off-by: Pali Rohár <pali@kernel.org> Acked-by: Andre Heider <a.heider@gmail.com>
* env: the ops driver load becomes mandatory in struct env_driverPatrick Delaunay2020-07-311-2/+1
| | | | | | | The ops driver load becomes mandatory in struct env_drive, change the comment for this ops and remove unnecessary test. Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
* env: add prototypes for weak functionPatrick Delaunay2020-07-311-0/+20
| | | | | | | | | | | | | | | | | | | | | | | This patch adds prototypes for several weak functions: - env_ext4_get_intf - env_ext4_get_dev_part - env_get_location It solves the following warnings when compiling with W=1 on stm32mp1 board: board/st/stm32mp1/stm32mp1.c:849:19: warning: no previous prototype for 'env_get_location' [-Wmissing-prototypes] enum env_location env_get_location(enum env_operation op, int prio) ^~~~~~~~~~~~~~~~ board/st/stm32mp1/stm32mp1.c:876:13: warning: no previous prototype for 'env_ext4_get_intf' [-Wmissing-prototypes] const char *env_ext4_get_intf(void) ^~~~~~~~~~~~~~~~~ board/st/stm32mp1/stm32mp1.c:889:13: warning: no previous prototype for 'env_ext4_get_dev_part' [-Wmissing-prototypes] const char *env_ext4_get_dev_part(void) ^~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Patrice Chotard <patrice.chotard@st.com> Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
* cmd: env: check real location for env info commandPatrick Delaunay2020-07-261-0/+11
| | | | | | | | | | | | | | | | | Check the current ENV location, dynamically provided by the weak function env_get_location to be sure that the environment can be persistent. The compilation flag ENV_IS_IN_DEVICE is not enough when the board dynamically select the available storage location (according boot device for example). This patch solves issue for stm32mp1 platform, when the boot device is USB. Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
* env_internal.h: add alternative ENV_SAVE_PTR macroRasmus Villemoes2020-04-241-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | The current definition of the env_save_ptr does not take SPL_SAVEENV into account. Moreover, the way it is implemented means that drivers need to guard the definitions of their _save methods with ifdefs to avoid "defined but unused" warnings in case CMD_SAVEENV=n. The ifdeffery can be avoided by using a "something ? x : NULL" construction instead and still have the compiler elide the _save method when it is not referenced. Unfortunately we can't just switch the existing env_save_ptr macro, since that would give a lot of build errors unless all the ifdeffery is removed at the same time. Conversely, removing that ifdeffery first would merely lead to the "defined but unused" warnings temporarily, but for some storage drivers it requires a bit more work than just removing their private CMD_SAVEENV logic. So introduce an alternative to env_save_ptr, which for lack of a better name is simply uppercased, allowing one to update storage drivers piecemeal to both reduce their ifdeffery and honour CONFIG_SPL_SAVEENV. Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
* env: Finish migration of common ENV optionsTom Rini2019-11-201-52/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | - In ARMv8 NXP Layerscape platforms we also need to make use of CONFIG_SYS_RELOC_GD_ENV_ADDR now, do so. - On ENV_IS_IN_REMOTE, CONFIG_ENV_OFFSET is never used, drop the define to 0. - Add Kconfig entry for ENV_ADDR. - Make ENV_ADDR / ENV_OFFSET depend on the env locations that use it. - Add ENV_xxx_REDUND options that depend on their primary option and SYS_REDUNDAND_ENVIRONMENT - On a number of PowerPC platforms, use SPL_ENV_ADDR not CONFIG_ENV_ADDR for the pre-main-U-Boot environment location. - On ENV_IS_IN_SPI_FLASH, check not for CONFIG_ENV_ADDR being set but rather it being non-zero, as it will now be zero by default. - Rework the env_offset absolute in env/embedded.o to not use CONFIG_ENV_OFFSET as it was the only use of ENV_OFFSET within ENV_IS_IN_FLASH. - Migrate all platforms. Cc: Wolfgang Denk <wd@denx.de> Cc: Joe Hershberger <joe.hershberger@ni.com> Cc: Patrick Delaunay <patrick.delaunay@st.com> Cc: uboot-stm32@st-md-mailman.stormreply.com Signed-off-by: Tom Rini <trini@konsulko.com> Acked-by: Joe Hershberger <joe.hershberger@ni.com> Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
* env: Remove useless CONFIG_ENV_SIZE_REDUND and fix ENV_IS_REDUND checkTom Rini2019-11-201-2/+5
| | | | | | | | | | | | | | | We have CONFIG_ENV_SIZE_IS_REDUND but don't really use it. We have one board where we can simply multiple CONFIG_ENV_SIZE by two for the same result. The other place where we could but were not previously using this is for where env_internal.h checks for if we should set ENV_IS_EMBEDDED. This seems like the most likely use, historically, of the variable, but it was not used. Add logic to check for this now. Cc: Wolfgang Denk <wd@denx.de> Cc: Joe Hershberger <joe.hershberger@ni.com> Signed-off-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
* defconfigs: Migrate CONFIG_SYS_REDUNDAND_ENVIRONMENTTom Rini2019-11-121-15/+0
| | | | | | | | Move this symbol to Kconfig. As part of this we can drop a UBI-specific symbol that was a stop-gap for not having this particular symbol in Kconfig. Signed-off-by: Tom Rini <trini@konsulko.com>
* ubi: env: fix redundand managementPhilippe Reynes2019-10-161-1/+1
| | | | | | | | | | | | | | | | We check (with a #if defined()) the config ENV_UBI_VOLUME_REDUND to know if there is a redundant env. But this config is a string and is always defined with env is in ubi, so we always consider that a redundand env is used. To fix this issue, I've added a hidden flag ENV_UBI_IS_VOLUME_REDUND that is true when ENV_UBI_VOLUME_REDUND is not "". Then, I check this flag in the code, instead of the string ENV_UBI_VOLUME_REDUND. hs: fixed typo s/condider/consider Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com> Reviewed-by: Heiko Schocher <hs@denx.de>
* env: Rename environment.h to env_internal.hSimon Glass2019-08-111-0/+278
This file contains lots of internal details about the environment. Most code can include env.h instead, calling the functions there as needed. Rename this file and add a comment at the top to indicate its internal nature. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Joe Hershberger <joe.hershberger@ni.com> Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com> [trini: Fixup apalis-tk1.c] Signed-off-by: Tom Rini <trini@konsulko.com>