26 Jul, 2019

1 commit


19 Jul, 2019

1 commit

  • This CONFIG_ENV_DEFAULT_NOWHERE config must be enabled for USB download
    when we implemented the override function to select env storage medium.
    To avoid adding it to every imx8mn defconfig, enable the config as default
    on imx8mn.

    Signed-off-by: Ye Li
    (cherry picked from commit 3f94cf98113af6c31e146afcf394f34ff4d2bc00)

    Ye Li
     

18 Jul, 2019

1 commit


17 Jul, 2019

2 commits

  • When booting from USB there is no place to store the environment and
    should use default env. However CONFIG_ENV_IS_NOWHERE has dependence
    with other env storage config. If we enable multiple storages, NOWHERE
    can't be enabled. And saveenv won't be built if NOWHERE is set.

    This patch introduces a new CONFIG_ENV_DEFAULT_NOWHERE, that can enable
    NOWHERE as a default env location when other storage are not avaliable.
    And allow to build saveenv.

    Signed-off-by: Ye Li
    (cherry picked from commit 64c02d26555491eb7cb758f58511620c1590c378)

    Ye Li
     
  • Add env_get_offset interface to override static CONFIG_ENV_OFFSET,
    and update env location driver to use env_get_offset. So for different
    storage medium, we are able to store the env at different offset.

    We don't support this feature when CONFIG_ENV_IS_EMBEDDED is set.

    Signed-off-by: Ye Li
    (cherry picked from commit 5b12d7cabb14bab9a95af7460b36c6c85db1b328)

    Ye Li
     

24 May, 2019

2 commits

  • The ENV_IS_IN_SATA config is missed, add it into env/Kconfig, that
    we can enable it for SATA boot.

    Signed-off-by: Ye Li
    (cherry picked from commit 75b6d78fbb2ed29039852f9e652f9acd80bf7eaa)

    Ye Li
     
  • Fix below build warning and errors:
    env/sata.c: In function ‘env_sata_save’:
    env/sata.c:59:9: warning: implicit declaration of function ‘sata_get_dev’ [-Wimplicit-function-declaration]
    sata = sata_get_dev(env_sata);
    ^~~~~~~~~~~~
    env/sata.c:59:7: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
    sata = sata_get_dev(env_sata);
    ^
    env/sata.c: In function ‘env_sata_load’:
    env/sata.c:101:10: warning: ‘return’ with a value, in function returning void
    return -EIO;
    ^
    env/sata.c:94:13: note: declared here
    static void env_sata_load(void)
    ^~~~~~~~~~~~~
    env/sata.c:105:7: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
    sata = sata_get_dev(env_sata);
    ^
    env/sata.c:108:10: warning: ‘return’ with a value, in function returning void
    return -EIO;
    ^
    env/sata.c:94:13: note: declared here
    static void env_sata_load(void)
    ^~~~~~~~~~~~~
    env/sata.c:113:10: warning: ‘return’ with a value, in function returning void
    return -EIO;
    ^
    env/sata.c:94:13: note: declared here
    static void env_sata_load(void)
    ^~~~~~~~~~~~~
    env/sata.c:116:9: warning: ‘return’ with a value, in function returning void
    return env_import(buf, 1);
    ^~~~~~~~~~~~~~~~~~
    env/sata.c:94:13: note: declared here
    static void env_sata_load(void)
    ^~~~~~~~~~~~~
    env/sata.c: At top level:
    env/sata.c:120:14: error: ‘ENVL_ESATA’ undeclared here (not in a function)
    .location = ENVL_ESATA,
    ^~~~~~~~~~
    env/sata.c:122:11: warning: initialization from incompatible pointer type [-Wincompatible-pointer-types]
    .load = env_sata_load,

    Signed-off-by: Ye Li

    Ye Li
     

26 Mar, 2019

1 commit

  • This converts the following to Kconfig:
    CONFIG_ENV_SPI_BUS
    CONFIG_ENV_SPI_CS
    CONFIG_ENV_SPI_MAX_HZ
    CONFIG_ENV_SPI_MODE

    Most of time these value are not needed, CONFIG_SF_DEFAULT
    with same value is used, so I introduced CONFIG_USE_ENV_SPI_*
    to force the associated value for the environment.

    Signed-off-by: Patrick Delaunay

    Patrick Delaunay
     

14 Mar, 2019

1 commit

  • This reverts commit 9a9d66f5eff0f443de4c2c6ca3e27771ed14b1b4.

    because it breaks fw_setenv and U-Boot interworking, if
    U-Boot environment is stored in a SPI-NOR.

    Reproduce it with:
    boot linux with empty Environment and store a variable
    with fw_setenv into it, the Environment is now filled
    with 0xff:

    root@ckey5e:10:8e:~# hexdump -C /dev/mtd4
    00000000 e9 e8 07 fa 01 62 6f 6f 74 63 6d 64 3d 72 75 6e |.....bootcmd=run|
    [...]
    00000f30 7d 00 75 62 69 62 6f 6f 74 76 6f 6c 3d 32 00 00 |}.ubibootvol=2..|
    00000f40 00 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|

    Boot now U-Boot prints:

    Loading Environment from SPI Flash... SF: Detected s25fl128l with page size 256 Bytes, erase size 4 KiB, total 16 MiB
    *** Warning - bad CRC, using default environment

    Reason is the above commit, as it only reads until \0\0
    is found, and assumes the rest of the Environment
    space is filled with 0x00, which is not the case when
    saving an Environment under linux with fw_setenv.

    Signed-off-by: Heiko Schocher
    Acked-by: Stefano Babic

    Heiko Schocher
     

27 Jan, 2019

1 commit


26 Jan, 2019

2 commits

  • In case when the environment on some location is malformed (CRC isn't
    matching), there is a chance we won't be able to save the environment to
    that location. For example, consider the case when we only have the
    environment on eMMC, but it's zeroed out. In that case, we won't be able
    to "env save" to it, because of "bad CRC" error. That's happening
    because in env_load() function we consider malformed environment as
    incorrect one, and defaulting to the location with highest (0)
    priority, which can be different from one we are dealing with right now
    (e.g., highest priority can be ENV_FAT on SD card, which is not
    inserted, but we want to use ENV_MMC on eMMC, where we were booted
    from).

    This issue began to reproduce after commit d30ba2315ae3 ("u-boot: remove
    driver lookup loop from env_save()") on BeagleBone Black, but that
    commit didn't introduce the wrong logic, it just changed the behavior
    for default location to use, merely revealing this issue.

    To fix that, let's implement next logic in env_load():
    1. Try to find out correct environment; if found -- use it
    2. If working environment wasn't found, but we found malformed one
    (with bad CRC), let's use it for further "env save". But make sure
    to use malformed environment location with highest priority.
    3. If neither correct nor malformed environment was found, let's
    default to environment location with highest priority (0)

    Steps to reproduce mentioned issue on BeagleBone Black (fixed in this
    patch):

    1. Boot from SD card and erase eMMC in U-Boot shell:
    => mmc dev 1
    => mmc erase 0 100000
    => gpt write mmc 1 $partitions
    2. Write new SPL and U-Boot to eMMC; the rest of eMMC will stay filled
    with zeroes
    3. Boot from eMMC; try to do:
    => env save
    4. Observe the error (incorrect behavior). Correct behavior: environment
    should be stored correctly on eMMC, in spite of it has "bad CRC"

    Fixes: d30ba2315ae3 ("u-boot: remove driver lookup loop from env_save()")
    Signed-off-by: Sam Protsenko
    Reviewed-by: Simon Goldschmidt

    Sam Protsenko
     
  • Callers of env_import*() functions might want to check the case when we
    have incorrect environment (with bad CRC). For example, when environment
    location is being defined in env_load(), call chain may look like this:

    env_load() -> drv->load() = env_mmc_load() -> env_import()

    Return code will be passed from env_import() all way up to env_load().
    Right now both env_mmc_load() and env_import() return -EIO error code,
    so env_load() can't differentiate between two cases:
    1. Driver reports the error, because device is not accessible
    2. Device is actually accessible, but environment is broken

    Let's return -ENOMSG in env_import(), so we can distinguish two cases
    mentioned above. It will make it possible to continue working with "bad
    CRC" environment (like doing "env save"), instead of considering it not
    functional (implemented in subsequent patch).

    Signed-off-by: Sam Protsenko
    Reviewed-by: Simon Goldschmidt

    Sam Protsenko
     

25 Jan, 2019

1 commit


22 Jan, 2019

1 commit


19 Jan, 2019

1 commit

  • commit 9a9d66f5eff0 ("env: add spi_flash_read_env function")

    breaks Environment functionality, as it reads only
    until 2 \0 are found, but fills the buffer with 0x0
    instead 0xff which leads in an incorrect crc sum.

    Fix: init the read buffer with 0xff instead 0x00

    Signed-off-by: Heiko Schocher

    Heiko Schocher
     

17 Jan, 2019

1 commit

  • The spi_flash_read_env function is a wrapper over spi_flash_read, which
    enables the env to read multiple flash page size from flash until '\0\0'
    is read or the end of env partition is reached. Instead of reading the
    entire env size. When it reads '\0\0', it stops reading further the env
    and assumes that the rest of env is '\0'.

    This is an optimization for large environments that contain few bytes
    environment variables. In this case it doesn't need to read the entire
    environment and only few pages.

    Signed-off-by: Horatiu Vultur

    Horatiu Vultur
     

16 Jan, 2019

1 commit

  • Add the dollar_complete() function to auto-complete arguments starting
    with a '$' and use it in the cmd_auto_complete() path such that all
    args starting with a $ can be auto-completed based on the available env
    vars.

    Signed-off-by: Boris Brezillon
    [trini: Fix some linking problems]
    Signed-off-by: Tom Rini

    Boris Brezillon
     

09 Jan, 2019

2 commits


05 Dec, 2018

2 commits


16 Oct, 2018

1 commit

  • Xilinx is introducing Versal, an adaptive compute acceleration platform
    (ACAP), built on 7nm FinFET process technology. Versal ACAPs combine
    Scalar Processing Engines, Adaptable Hardware Engines, and Intelligent
    Engines with leading-edge memory and interfacing technologies to deliver
    powerful heterogeneous acceleration for any application. The Versal AI
    Core series has five devices, offering 128 to 400 AI Engines. The series
    includes dual-core Arm Cortex™-A72 application processors, dual-core Arm
    Cortex-R5 real-time processors, 256KB of on-chip memory with ECC, more
    than 1,900 DSP engines optimized for high-precision floating point with
    low latency.

    The patch is adding necessary infrastructure in place without enabling
    platform which is done in separate patch.

    Signed-off-by: Michal Simek

    Michal Simek
     

19 Sep, 2018

1 commit

  • For some reason the spi_flash_probe_bus_cs() is called
    inside the setup_flash_device() with zero values in place
    of configurated SPI flash mode and maximum flash speed.
    This code causes HALT error during startup environment
    relocation on some platforms - namely Armada-38x-GP board.
    Fix the function call by replacing zeros with the appropriate
    values - CONFIG_ENV_SPI_MAX_HZ and CONFIG_ENV_SPI_MODE.

    Signed-off-by: Konstantin Porotchkin
    Cc: Igal Liberman
    Cc: Stefan Roese
    Signed-off-by: Stefan Roese

    Konstantin Porotchkin
     

25 Aug, 2018

1 commit


20 Aug, 2018

1 commit

  • There is no reason to have the same Kconfig options for different SoCs
    separately. The patch is merging them together.

    Signed-off-by: Michal Simek
    Acked-by: Maxime Ripard
    [trini: Fix ENV_SIZE around ENV_IS_NOWHERE]
    Signed-off-by: Tom Rini

    Signed-off-by: Tom Rini

    Michal Simek
     

11 Aug, 2018

1 commit

  • "Failed" error message from env_load() only clutters the log with
    unnecessary details, as we already have all needed warnings by that
    time. Example:

    Loading Environment from FAT... MMC: no card present
    ** Bad device mmc 0 **
    Failed (-5)

    Let's only print it in case when DEBUG is defined to keep log clear.

    Signed-off-by: Sam Protsenko

    Sam Protsenko
     

30 Jul, 2018

1 commit

  • When called with ENVOP_SAVE, env_get_location() only returns the
    gd->env_load_location variable without actually checking for
    the environment location and priority.

    This behaviour causes env_save() to fall into an infinite loop when
    the low-level drv->save() call fails.

    The env_save() function should not loop through the environment
    location list but it should save the environment into the location
    stored in gd->env_load_location by the last env_load() call.

    Signed-off-by: Nicholas Faustini
    Reviewed-by: Simon Goldschmidt

    Nicholas Faustini
     

22 Jul, 2018

2 commits


21 Jul, 2018

1 commit

  • The error message should start with `## Error: ` so that it's easily
    detectable by tests without needing to have a complex regexp for
    matching all possible error message patterns.

    Let's add the `## Error: ` prefix to the error messages since it's the
    one already in use.

    Suggested-by: Stephen Warren
    Signed-off-by: Quentin Schulz
    Reviewed-by: Simon Glass
    Reviewed-by: Stephen Warren
    Tested-by: Stephen Warren

    Quentin Schulz
     

20 Jul, 2018

3 commits

  • The function set_default_env() sets the hashtable flags for import_r().
    Formally set_default_env() doesn't accept flags from its callers. In
    practice the caller can (un)set the H_INTERACTIVE flag, but it has to be
    done using the first character of the function's string argument. Other
    flags like H_FORCE can't be set by the caller.

    Change the function to accept flags argument. The benefits are:
    1. The caller will have to explicitly set the H_INTERACTIVE flag,
    instead of un-setting it using a special char in a string.
    2. Add the ability to propagate flags from the caller to himport(),
    especially the H_FORCE flag from do_env_default() in nvedit.c that
    currently gets ignored for "env default -a -f" commands.
    3. Flags and messages will not be coupled together. A caller will be
    able to set flags without passing a string and vice versa.

    Please note:
    The propagation of H_FORCE from do_env_default() does not introduce any
    functional changes, because currently himport_r() is set to destroy the
    old environment regardless if H_FORCE flag is set or not. More changes
    are needed to utilize the propagation of H_FORCE.

    Signed-off-by: Yaniv Levinsky
    Acked-by: Igor Grinberg

    Yaniv Levinsky
     
  • The function set_default_vars() in common.c adds H_INTERACTIVE to the
    h_import() flag, but the function has no way of telling if the command
    actually was user directed like this flag suggest. The flag should be
    set by the calling function do_env_default() in nvedit.c instead, where
    the command is certainty user directed.

    Move the H_INTERACTIVE flag from set_default_vars() to do_env_default().

    Signed-off-by: Yaniv Levinsky
    Acked-by: Igor Grinberg

    Yaniv Levinsky
     
  • The env_flag in do_env_default() doesn't get propagated and therefore
    gets ignored by himport_r(). This breaks to ability to "forcibly" reset
    variables to their default values using the environment command.

    Scenario example of the problem:
    # setenv kernel uImage
    # setenv .flags kernel:so
    # env default -f kernel
    ## Error: Can't overwrite "kernel"
    himport_r: can't insert "kernel=zImage" into hash table

    Change the call path so it will pass the flag correctly.

    Signed-off-by: Yaniv Levinsky
    Acked-by: Igor Grinberg

    Yaniv Levinsky
     

19 Jul, 2018

1 commit


13 Jun, 2018

2 commits


07 May, 2018

1 commit

  • When U-Boot started using SPDX tags we were among the early adopters and
    there weren't a lot of other examples to borrow from. So we picked the
    area of the file that usually had a full license text and replaced it
    with an appropriate SPDX-License-Identifier: entry. Since then, the
    Linux Kernel has adopted SPDX tags and they place it as the very first
    line in a file (except where shebangs are used, then it's second line)
    and with slightly different comment styles than us.

    In part due to community overlap, in part due to better tag visibility
    and in part for other minor reasons, switch over to that style.

    This commit changes all instances where we have a single declared
    license in the tag as both the before and after are identical in tag
    contents. There's also a few places where I found we did not have a tag
    and have introduced one.

    Signed-off-by: Tom Rini

    Tom Rini
     

28 Apr, 2018

1 commit


17 Apr, 2018

2 commits