summaryrefslogtreecommitdiff
path: root/env
AgeCommit message (Collapse)AuthorFilesLines
2017-08-16env: Drop common init() functionsSimon Glass12-127/+10
Most of the init() implementations just use the default environment. Adjust env_init_new() to do this automatically, and drop the redundant code. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
2017-08-16env: Switch over to use environment location driversSimon Glass15-114/+128
Move over to use a the master implementation of the location drivers, with each method calling out to the appropriate driver. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
2017-08-16env: Add a new implementation of environment accessSimon Glass2-1/+146
We plan to move to a environment access via drivers for each location where the environment can be stored. Add an implementation for this. So far it is not used, but will be pressed into service in a future patch. Signed-off-by: Simon Glass <sjg@chromium.org>
2017-08-16env: Convert CONFIG_ENV_IS_IN... to a choiceSimon Glass1-6/+41
At present we support multiple environment drivers but there is not way to select between them at run time. Also settings related to the position and size of the environment area are global (i.e. apply to all locations). Until these limitations are removed we cannot really support more than one environment location. Adjust the location to be a choice so that only one can be selected. By default the environment is 'nowhere', meaning that the environment exists only in memory and cannot be saved. Also expand the help for the 'nowhere' option and move it to the top since it is the default. Signed-off-by: Simon Glass <sjg@chromium.org> [trini: Move all of the imply logic to default X if Y so it works again] Signed-off-by: Tom Rini <trini@konsulko.com>
2017-08-15env: Create a location driver for each locationSimon Glass14-7/+176
Set up a location driver for each supported environment location. At present this just points to the global functions and is not used. A later patch will switch this over to use private functions in each driver. There are several special cases here in various drivers to handle peculiarities of certain boards: 1. Some boards define CONFIG_ENV_IS_IN_FAT and CONFIG_SPL_ENV_SUPPORT but do not actually load the environment in SPL. The env load code was optimised out before but with the driver, it is not. Therefore a special case is added to env/fat.c. The correct fix (depending on board testing might be to disable CONFIG_SPL_ENV_SUPPORT. 2. A similar situations happens with CONFIG_ENV_IS_IN_FLASH. Some boards do not actually load the environment in SPL, so to reduce code size we need to drop that code. A similar fix may be possible with these boards, or it may be possible to adjust the environment CONFIG settings. Added to the above is that the CONFIG_SPL_ENV_SUPPORT option does not apply when the environment is in flash. Obviously the above has been discovered through painful and time-consuming trial and error. Hopefully board maintainers can take a look and figure out what is actually needed. Signed-off-by: Simon Glass <sjg@chromium.org>
2017-08-15env: Rename nand env_location to nand_env_locationSimon Glass1-3/+3
We want to use this name for all environment drivers. Update the nand driver to use a more specific name. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
2017-08-15env: Add an enum for environment stateSimon Glass13-69/+70
At present we have three states for the environment, numbered 0, 1 and 2. Add an enum to record this to avoid open-coded values. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
2017-08-15env: common: Drop env_get_char_memory()Simon Glass1-7/+0
This function is the same as env_get_char_spec() apart from dropping the brackets. Drop the brackets from env_get_char_spec() and use that instead of env_get_char_memory(). Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
2017-08-15env: common: Drop env_get_char_init()Simon Glass1-6/+1
This function does nothing but call env_get_char_spec(). Drop it and adjust its only caller. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
2017-08-15env: common: Factor out the common env_valid checkSimon Glass1-11/+6
The check for gd->env_valid is used in both the 'if' and 'else' part of env_get_char(). Move it into that function instead for simplicity. Drop that code from the two leaf functions. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
2017-08-15env: common: Drop env_get_addr()Simon Glass1-8/+3
This function is not used anywhere other than env_get_char(). Move the code into that function. Reviewed-by: Tom Rini <trini@konsulko.com> Signed-off-by: Simon Glass <sjg@chromium.org>
2017-08-15env: common: Make env_get_addr/get_char_memory() staticSimon Glass1-9/+9
These functions are not used outside this file. Make them static and order them to avoid forward declarations. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
2017-08-15env: Use tabs in ENV_IS_IN_FATSimon Glass1-4/+3
Tidy up the formatting of this option. Signed-off-by: Simon Glass <sjg@chromium.org>
2017-08-15Move environment files from common/ to env/Simon Glass21-0/+4561
About a quarter of the files in common/ relate to the environment. It seems better to put these into their own subdirectory and remove the prefix. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>