21 Nov, 2017

1 commit


17 Nov, 2017

1 commit


27 Oct, 2017

1 commit


16 Oct, 2017

1 commit


15 Oct, 2017

1 commit


04 Oct, 2017

1 commit

  • U-Boot widely uses error() as a bit noisier variant of printf().

    This macro causes name conflict with the following line in
    include/linux/compiler-gcc.h:

    # define __compiletime_error(message) __attribute__((error(message)))

    This prevents us from using __compiletime_error(), and makes it
    difficult to fully sync BUILD_BUG macros with Linux. (Notice
    Linux's BUILD_BUG_ON_MSG is implemented by using compiletime_assert().)

    Let's convert error() into now treewide-available pr_err().

    Done with the help of Coccinelle, excluing tools/ directory.

    The semantic patch I used is as follows:

    //
    @@@@
    -error
    +pr_err
    (...)
    //

    Signed-off-by: Masahiro Yamada
    Reviewed-by: Simon Glass
    [trini: Re-run Coccinelle]
    Signed-off-by: Tom Rini

    Masahiro Yamada
     

09 Sep, 2017

1 commit

  • The underlying implementation for ENV_AES has security complications and
    is not recommended for use. Please see CVE-2017-3225 and CVE-2017-3226
    for more details. Mark this as deprecated now and delete this in the
    medium term if no one comes forward to re-work the support.

    Signed-off-by: Tom Rini

    Tom Rini
     

03 Sep, 2017

1 commit

  • Add the following options to drivers/misc/Kconfig:
    SYS_I2C_EEPROM_ADDR
    SYS_I2C_EEPROM_BUS
    SYS_EEPROM_SIZE
    SYS_EEPROM_PAGE_WRITE_BITS
    SYS_EEPROM_PAGE_WRITE_DELAY_MS
    SYS_I2C_EEPROM_ADDR_LEN
    SYS_I2C_EEPROM_ADDR_OVERFLOW

    This does not migrate any boards, but provides a foundations for
    those who want/need these options

    Signed-off-by: Adam Ford
    [trini: Migrate uniphier]
    Signed-off-by: Tom Rini

    Adam Ford
     

21 Aug, 2017

3 commits

  • Some of these were missed in the conversion.
    Signed-off-by: Simon Glass

    Simon Glass
     
  • Now that we have errors available in the environment driver's load()
    method, check the return valid.

    Signed-off-by: Simon Glass

    Simon Glass
     
  • With the change to the environment code to remove the common init stage
    of pointing to the default environment and setting it as valid, combined
    with the change to switch gd->env_valid from 0/1/2 to an enum we now
    must set env_valid to one of the enum values rather than an int. And in
    this case, not only was setting it to an int wrong, it was now the wrong
    value. Finally, in the case of ENV_IS_NOWHERE we must still say that
    our envionrment is invalid after init for things to continue to
    function.

    Fixes: 7938822a6b75 ("env: Drop common init() functions")
    Tested-by: Marek Vasut
    Reported-by: Marek Vasut
    Reported-by: Andy Shevchenko
    Signed-off-by: Tom Rini
    ---
    Changes in v3:
    - Actually include changes for env/nowhere.c

    Tom Rini
     

20 Aug, 2017

1 commit


16 Aug, 2017

15 commits

  • The load() methods have inconsistent behaviour on error. Some of them load
    an empty default environment. Some load an environment containing an error
    message. Others do nothing.

    As a step in the right direction, have the method return an error code.
    Then the caller could handle this itself in a consistent way.

    Signed-off-by: Simon Glass

    Simon Glass
     
  • In principle this can fail, e.g. if the index is out of range. Adjust the
    driver signature to allow returning an error code.

    Signed-off-by: Simon Glass
    Reviewed-by: Tom Rini

    Simon Glass
     
  • We are now using an env_ prefix for environment functions. Rename these
    other functions as well, for consistency:

    getenv_vlan()
    getenv_bootm_size()
    getenv_bootm_low()
    getenv_bootm_mapsize()
    env_get_default()

    Suggested-by: Wolfgang Denk
    Signed-off-by: Simon Glass

    Simon Glass
     
  • We are now using an env_ prefix for environment functions. Rename these
    for consistency. Also add function comments in common.h.

    Suggested-by: Wolfgang Denk
    Signed-off-by: Simon Glass

    Simon Glass
     
  • We are now using an env_ prefix for environment functions. Rename these
    two functions for consistency. Also add function comments in common.h.

    Quite a few places use getenv() in a condition context, provoking a
    warning from checkpatch. These are fixed up in this patch also.

    Suggested-by: Wolfgang Denk
    Signed-off-by: Simon Glass

    Simon Glass
     
  • Use the env_save() function directly now that there is only one
    implementation of saveenv().

    Signed-off-by: Simon Glass
    Reviewed-by: Wolfgang Denk
    Reviewed-by: Tom Rini

    Simon Glass
     
  • This is a strange name for a function that loads the environment. There is
    now only one implementation of this function, so use the new env_load()
    function directly instead.

    Signed-off-by: Simon Glass
    Reviewed-by: Tom Rini

    Simon Glass
     
  • We only have a single implementation of this function now and it is called
    env_get_char(). Drop the old function and the weak version.

    Reviewed-by: Tom Rini
    Signed-off-by: Simon Glass

    Simon Glass
     
  • Now that env_init() is only defined once we can drop the env_init_new()
    name and just use env_init().

    Signed-off-by: Simon Glass
    Reviewed-by: Tom Rini

    Simon Glass
     
  • This variable is declared as a global in most environment location
    drivers. But it is not used outside the drivers and most of the
    declarations are unnecessary.

    Also some drivers call free() on env_ptr which seems wrong since it is
    not in the heap.

    Drop the variable where possible, and all calls to free().

    Signed-off-by: Simon Glass
    Reviewed-by: Tom Rini

    Simon Glass
     
  • Add a name to the driver and use that instead of the global variable
    declared by each driver.

    Signed-off-by: Simon Glass
    Reviewed-by: Tom Rini

    Simon Glass
     
  • 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
    Reviewed-by: Tom Rini

    Simon Glass
     
  • 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
    Reviewed-by: Tom Rini

    Simon Glass
     
  • 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

    Simon Glass
     
  • 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
    [trini: Move all of the imply logic to default X if Y so it works again]
    Signed-off-by: Tom Rini

    Simon Glass
     

15 Aug, 2017

10 commits

  • 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

    Simon Glass
     
  • 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
    Reviewed-by: Tom Rini

    Simon Glass
     
  • 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
    Reviewed-by: Tom Rini

    Simon Glass
     
  • 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
    Reviewed-by: Tom Rini

    Simon Glass
     
  • This function does nothing but call env_get_char_spec(). Drop it and
    adjust its only caller.

    Signed-off-by: Simon Glass
    Reviewed-by: Tom Rini

    Simon Glass
     
  • 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
    Reviewed-by: Tom Rini

    Simon Glass
     
  • This function is not used anywhere other than env_get_char(). Move the
    code into that function.

    Reviewed-by: Tom Rini
    Signed-off-by: Simon Glass

    Simon Glass
     
  • These functions are not used outside this file. Make them static and order
    them to avoid forward declarations.

    Signed-off-by: Simon Glass
    Reviewed-by: Tom Rini

    Simon Glass
     
  • Tidy up the formatting of this option.

    Signed-off-by: Simon Glass

    Simon Glass
     
  • 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
    Reviewed-by: Tom Rini

    Simon Glass