Skip to contentSkip to conversation

efi_loader: non-volatile variables support

PATCH Superseded AKASHI Takahiro 5 participants 38 messages Sep 5, 2019 – Nov 5, 2019 Page 1 of 2

Subsystems (46)
lore
Share & tools
lore
#0 lore raw

v5 cover efi_loader: non-volatile variables support

# In version 5 of this patch set, the implementation is changed again. #
# I believe that this is NOT intrusive, and that my approach here is NOT

# selfish at all. If Wolfgang doesn't accept this approach, however,
# I would like to go for "Plan B" for UEFI variables implementation, in
# which EFI will have its own drivers for storage instead of env/*.

This patch set is an attempt to implement non-volatile attribute for UEFI variables. Under the current implementation,
* SetVariable API doesn't recognize non-volatile attribute
* While some variables are defined non-volatile in UEFI specification, they are NOT marked as non-volatile in the code.
* env_save() (or "env save" command) allows us to save all the variables into persistent storage, but it may cause volatile UEFI variables, along with irrelevant U-Boot variables, to be saved unconditionally.

Those observation rationalizes that the implementation of UEFI variables should be revamped utilizing dedicated storage for them.

Basic ideas:
* Sub-system users of U-Boot environment variables may have their own "env contexts". More than one contexts allowed.

See Patch#2 and Patch#18.

* Each context is isolated from other contexts with different name spaces.
* Each context is associated with one backing storage driver and media location.
* Different contexts may use different drivers and locations.

* To access (get or set) a variable, associated context must be presented. So, almost of all existing env interfaces are changed to accept one extra argument, ctx.
(I believe that this is Wolfgang's *requirement*.)

From viewpoint of APIs, env context is a pointer to opaque structure.

* Non-volatile feature is not implemented in a general form and must be implemented by users in their sub-systems.

In version 4, U-Boot environment's attributes are extended to support non-volatile (or auto-save capability), but Wolfgang rejected my approach.
As modifying attributes for this purpose would cause bunch of incompatibility issues (as far as I said in my cover letter and the discussions in ML), I would prefer a much simple approach.

See patch#19 about how it is easily implemented for UEFI variables.

* Each backing storage driver must be converted to be aligned with new env interfaces to handle multiple contexts in parallel and provide context-specific Kconfig configurations for driver parameters.

In this version, only FAT file system and flash devices are supported, but it is quite straightforward to modify other drivers.

See Patch#4 and Patch#5 about how drivers can shift to new interfaces.

* Finally, all existing U-Boot variables hold the same semantics as before.

Known issues/restriction/TODO:
* The current form of patchset is not 'bisect'able.
Not to break 'bisect,' all the patches in this patch set must be put into a single commit when merging.
(This can be mitigated by modifying/splitting Patch#18/#19 though.)

* Unfortunately, this code fails to read U-Boot environment from flash at boot time due to incomprehensible memory corruption. See murky workaround, which is marked as FIXME, in env/flash.c.

Despite this bug, I was still be able to run/test my patch by hacking the code with gdb.
(modifying data to correct value on the fly :)
I hope that it won't affect code review in most places for now.

* Some minor issues for better coding.
They are also marked as FIXME in the source code.

* Only FAT file system and flash are supported.

* The whole area of storage will be saved at *every* update of one UEFI variable. It should be optimized if possible.

* An error during "save" operation may cause inconsistency between cache (hash table) and the storage.

    -> This is not UEFI specific though.

* Add tests if necessary.

* I cannot test all the platforms affected by this patchset.

Note:
If we need "secure storage" for UEFI variables, efi_get_variable/ efi_get_next_variable_name/efi_set_variable() should be completely replaced with stub functions to communicate with secure world. This patchset has nothing to do with such an implementation.

Usage:
To enable this feature for example with FAT file system, the following configs must be enabled:
CONFIG_ENV_IS_IN_FAT
CONFIG_ENV_FAT_INTERFACE CONFIG_ENV_EFI_FAT_DEVICE_AND_PART CONFIG_ENV_EFI_FAT_FILE

You may define a non-volatile variable from command interface:
=> setenv -e -nv FOO baa
=> printenv -e FOO
FOO: NV|BS|RT, DataSize = 0x3
00000000: 62 61 61 baa

Patch#1 and #2 are to add multiples 'context' support to env interfaces
and to provide new env interfaces.
Patch#3 to #5 are to show how the existing drivers for U-Boot environment
should be modified to be aligned with new env interfaces. (Only FAT file system and flash in this version of patch set.)
Patch#6 to #17 are to shift all the existing users of old env interfaces
to new ones. (But not tested for all the platforms.)
Patch#18 and #19 are to modify UEFI variable implementation to utilize
new env interfaces.

Changes in v5 (September 4, 2019)
* rebased to v2019.10-rc3
* revamp the implementation, removing changes on environment variable's attributes (See above)

Changes in v4 (July 17, 2019)
* remove already-merged patches
* revamp after Wolfgang's suggestion

Changes in v3 (June 4, 2019)
* remove already-merged patches
* revamp the code again
* introduce CONFIG_EFI_VARIABLE_USE_ENV for this configuration. Once another backing storage, i.e. StMM services for secure boot, is supported, another option will be added.

Changes in v2 (Apr 24, 2019)
* rebased on efi-2019-07
* revamp the implementation

v1 (Nov 28, 2018)
* initial

AKASHI Takahiro (19):
env: extend interfaces allowing for env contexts
env: define env context for U-Boot environment
env: nowhere: rework with new env interfaces
env: flash: support multiple env contexts
env: fat: support multiple env contexts
hashtable: support multiple env contexts
api: converted with new env interfaces
arch: converted with new env interfaces
board: converted with new env interfaces
cmd: converted with new env interfaces
common: converted with new env interfaces
disk: converted with new env interfaces
drivers: converted with new env interfaces
fs: converted with new env interfaces
lib: converted with new env interfaces (except efi_loader)
net: converted with new env interfaces
post: converted with new env interfaces env,efi_loader: define env context for UEFI variables
efi_loader: variable: rework with new env interfaces

 api/api.c                                     |   8 +-
 arch/arc/lib/bootm.c                          |   2 +-
 arch/arm/cpu/arm926ejs/spear/spr_misc.c       |   8 +-
 arch/arm/cpu/armv8/fsl-layerscape/cpu.c       |   5 +-
 arch/arm/cpu/armv8/fsl-layerscape/soc.c       |  14 +-
 arch/arm/lib/bootm.c                          |   6 +-
 arch/arm/lib/semihosting.c                    |   2 +-
 arch/arm/mach-imx/mx6/opos6ul.c               |   4 +-
 arch/arm/mach-imx/mx7/soc.c                   |   4 +-
 arch/arm/mach-imx/video.c                     |   2 +-
 arch/arm/mach-keystone/ddr3.c                 |   2 +-
 arch/arm/mach-keystone/keystone.c             |   2 +-
 arch/arm/mach-kirkwood/cpu.c                  |   4 +-
 arch/arm/mach-meson/board-common.c            |   2 +-
 arch/arm/mach-omap2/utils.c                   |  20 +-
 arch/arm/mach-rmobile/cpu_info.c              |   2 +-
 arch/arm/mach-rockchip/boot_mode.c            |   4 +-
 arch/arm/mach-rockchip/rk3288/rk3288.c        |   2 +-
 arch/arm/mach-socfpga/misc_gen5.c             |   5 +-
 arch/arm/mach-socfpga/misc_s10.c              |   2 +-
 arch/arm/mach-stm32mp/cpu.c                   |  35 +-
 arch/arm/mach-tegra/board2.c                  |   4 +-
 arch/arm/mach-tegra/cboot.c                   |  18 +-
 arch/arm/mach-uniphier/board_late_init.c      |  19 +-
 arch/arm/mach-uniphier/mmc-first-dev.c        |   2 +-
 arch/m68k/lib/bootm.c                         |   2 +-
 arch/microblaze/lib/bootm.c                   |   2 +-
 arch/mips/lib/bootm.c                         |   6 +-
 arch/nds32/lib/bootm.c                        |   4 +-
 arch/powerpc/cpu/mpc85xx/cpu_init.c           |  10 +-
 arch/powerpc/cpu/mpc85xx/fdt.c                |   2 +-
 arch/powerpc/cpu/mpc85xx/fsl_corenet_serdes.c |   2 +-
 arch/powerpc/lib/bootm.c                      |   2 +-
 arch/sh/lib/bootm.c                           |   2 +-
 arch/sh/lib/zimageboot.c                      |   2 +-
 arch/x86/lib/zimage.c                         |  11 +-
 arch/xtensa/lib/bootm.c                       |   2 +-
 board/Arcturus/ucp1020/cmd_arc.c              |  40 +-
 board/Arcturus/ucp1020/ucp1020.c              |  16 +-
 board/BuR/brppt1/board.c                      |   4 +-
 board/BuR/brxre1/board.c                      |   9 +-
 board/BuR/common/br_resetc.c                  |   2 +-
 board/BuR/common/common.c                     |  47 +-
 board/BuS/eb_cpu5282/eb_cpu5282.c             |   8 +-
 board/CZ.NIC/turris_mox/turris_mox.c          |   4 +-
 board/CZ.NIC/turris_omnia/turris_omnia.c      |   6 +-
 board/CarMediaLab/flea3/flea3.c               |   2 +-
 board/LaCie/net2big_v2/net2big_v2.c           |   2 +-
 board/LaCie/netspace_v2/netspace_v2.c         |   2 +-
 board/Synology/ds414/cmd_syno.c               |   6 +-
 board/alliedtelesis/x530/x530.c               |   2 +-
 board/amazon/kc1/kc1.c                        |   4 +-
 board/amlogic/p200/p200.c                     |   4 +-
 board/amlogic/p201/p201.c                     |   4 +-
 board/amlogic/p212/p212.c                     |   4 +-
 board/amlogic/q200/q200.c                     |   4 +-
 board/aristainetos/aristainetos-v2.c          |   8 +-
 board/armltd/integrator/integrator.c          |   2 +-
 board/atmel/common/board.c                    |   4 +-
 board/atmel/common/mac_eeprom.c               |   2 +-
 board/atmel/sama5d3xek/sama5d3xek.c           |   2 +-
 board/bachmann/ot1200/ot1200.c                |   4 +-
 board/birdland/bav335x/board.c                |   8 +-
 board/bluegiga/apx4devkit/apx4devkit.c        |   5 +-
 board/bluewater/gurnard/gurnard.c             |   6 +-
 board/bosch/shc/board.c                       |   2 +-
 board/boundary/nitrogen6x/nitrogen6x.c        |  14 +-
 board/broadcom/bcm23550_w1d/bcm23550_w1d.c    |   2 +-
 board/broadcom/bcm28155_ap/bcm28155_ap.c      |   2 +-
 board/broadcom/bcmstb/bcmstb.c                |   2 +-
 board/buffalo/lsxl/lsxl.c                     |   2 +-
 board/cadence/xtfpga/xtfpga.c                 |   4 +-
 board/ccv/xpress/xpress.c                     |   2 +-
 board/compulab/cl-som-imx7/cl-som-imx7.c      |   2 +-
 board/compulab/cm_fx6/cm_fx6.c                |  10 +-
 board/compulab/common/omap3_display.c         |   4 +-
 board/congatec/cgtqmx6eval/cgtqmx6eval.c      |   8 +-
 board/cssi/MCR3000/MCR3000.c                  |   2 +-
 board/davinci/da8xxevm/da850evm.c             |   2 +-
 board/davinci/da8xxevm/omapl138_lcdk.c        |   6 +-
 board/dhelectronics/dh_imx6/dh_imx6.c         |   2 +-
 board/eets/pdu001/board.c                     |   8 +-
 board/el/el6x/el6x.c                          |   2 +-
 board/emulation/qemu-riscv/qemu-riscv.c       |   2 +-
 board/engicam/common/board.c                  |  32 +-
 board/esd/meesc/meesc.c                       |   6 +-
 board/freescale/b4860qds/b4860qds.c           |   5 +-
 board/freescale/common/cmd_esbc_validate.c    |   2 +-
 board/freescale/common/fsl_chain_of_trust.c   |   6 +-
 board/freescale/common/sys_eeprom.c           |   4 +-
 board/freescale/common/vid.c                  |   4 +-
 board/freescale/imx8mq_evk/imx8mq_evk.c       |   4 +-
 board/freescale/imx8qm_mek/imx8qm_mek.c       |   4 +-
 board/freescale/imx8qxp_mek/imx8qxp_mek.c     |   4 +-
 board/freescale/ls1088a/eth_ls1088aqds.c      |   4 +-
 board/freescale/ls1088a/ls1088a.c             |   2 +-
 board/freescale/ls2080aqds/eth.c              |   6 +-
 board/freescale/ls2080aqds/ls2080aqds.c       |   2 +-
 board/freescale/ls2080ardb/ls2080ardb.c       |   6 +-
 board/freescale/lx2160a/eth_lx2160aqds.c      |   2 +-
 board/freescale/mpc8323erdb/mpc8323erdb.c     |   3 +-
 board/freescale/mpc837xemds/pci.c             |   2 +-
 board/freescale/mpc837xerdb/mpc837xerdb.c     |   2 +-
 board/freescale/mx51evk/mx51evk_video.c       |   2 +-
 board/freescale/mx53loco/mx53loco.c           |   4 +-
 board/freescale/mx53loco/mx53loco_video.c     |   2 +-
 board/freescale/mx6sabreauto/mx6sabreauto.c   |   8 +-
 board/freescale/mx6sabresd/mx6sabresd.c       |   8 +-
 board/freescale/mx6sxsabresd/mx6sxsabresd.c   |   2 +-
 .../mx6ul_14x14_evk/mx6ul_14x14_evk.c         |   6 +-
 board/freescale/mx6ullevk/mx6ullevk.c         |   4 +-
 board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c   |   2 +-
 board/freescale/qemu-ppce500/qemu-ppce500.c   |   4 +-
 board/freescale/t4qds/t4240qds.c              |   2 +-
 board/gardena/smart-gateway-at91sam/board.c   |   2 +-
 board/gardena/smart-gateway-mt7688/board.c    |  16 +-
 board/gateworks/gw_ventana/common.c           |   2 +-
 board/gateworks/gw_ventana/gw_ventana.c       |  61 +-
 board/gateworks/gw_ventana/gw_ventana_spl.c   |   4 +-
 board/gdsys/a38x/keyprogram.c                 |   4 +-
 board/gdsys/mpc8308/gazerbeam.c               |   4 +-
 board/gdsys/mpc8308/hrcon.c                   |   2 +-
 board/gdsys/mpc8308/strider.c                 |   2 +-
 board/gdsys/p1022/controlcenterd-id.c         |  10 +-
 board/gdsys/p1022/controlcenterd.c            |   2 +-
 board/ge/bx50v3/bx50v3.c                      |  13 +-
 board/ge/common/ge_common.c                   |   4 +-
 board/ge/mx53ppd/mx53ppd.c                    |   2 +-
 board/grinn/chiliboard/board.c                |   4 +-
 board/grinn/liteboard/board.c                 |   6 +-
 board/highbank/highbank.c                     |   9 +-
 board/hisilicon/poplar/poplar.c               |   2 +-
 board/imgtec/ci20/ci20.c                      |   6 +-
 board/intel/edison/edison.c                   |  14 +-
 board/isee/igep003x/board.c                   |   6 +-
 board/isee/igep00x0/igep00x0.c                |   4 +-
 board/k+p/kp_imx53/kp_id_rev.c                |  20 +-
 board/k+p/kp_imx53/kp_imx53.c                 |   4 +-
 board/k+p/kp_imx6q_tpc/kp_imx6q_tpc.c         |   4 +-
 board/keymile/common/common.c                 |  26 +-
 board/keymile/common/ivm.c                    |   8 +-
 board/keymile/km83xx/km83xx.c                 |   2 +-
 board/keymile/km_arm/km_arm.c                 |   6 +-
 board/keymile/kmp204x/kmp204x.c               |   4 +-
 board/kosagi/novena/novena.c                  |   2 +-
 board/laird/wb50n/wb50n.c                     |   2 +-
 board/lg/sniper/sniper.c                      |   4 +-
 board/liebherr/display5/spl.c                 |   4 +-
 board/liebherr/mccmon6/mccmon6.c              |   6 +-
 board/logicpd/imx6/imx6logic.c                |   8 +-
 board/menlo/m53menlo/m53menlo.c               |   2 +-
 board/micronas/vct/vct.c                      |   2 +-
 board/nokia/rx51/rx51.c                       |  10 +-
 board/overo/overo.c                           |  45 +-
 board/phytec/pcm052/pcm052.c                  |   4 +-
 board/phytec/pfla02/pfla02.c                  |   2 +-
 .../dragonboard410c/dragonboard410c.c         |   6 +-
 .../dragonboard820c/dragonboard820c.c         |   2 +-
 board/raspberrypi/rpi/rpi.c                   |  26 +-
 board/renesas/alt/alt.c                       |   3 +-
 board/renesas/gose/gose.c                     |   3 +-
 board/renesas/koelsch/koelsch.c               |   3 +-
 board/renesas/lager/lager.c                   |   3 +-
 board/renesas/porter/porter.c                 |   3 +-
 board/renesas/sh7752evb/sh7752evb.c           |   4 +-
 board/renesas/sh7753evb/sh7753evb.c           |   4 +-
 board/renesas/sh7757lcr/sh7757lcr.c           |   6 +-
 board/renesas/silk/silk.c                     |   3 +-
 board/renesas/stout/stout.c                   |   3 +-
 board/rockchip/kylin_rk3036/kylin_rk3036.c    |   2 +-
 board/samsung/common/exynos5-dt.c             |   2 +-
 board/samsung/common/misc.c                   |  14 +-
 board/samsung/odroid/odroid.c                 |   2 +-
 board/samsung/trats/trats.c                   |   2 +-
 board/samsung/universal_c210/universal.c      |   2 +-
 board/samtec/vining_fpga/socfpga.c            |  16 +-
 board/siemens/common/board.c                  |   4 +-
 board/siemens/draco/board.c                   |   6 +-
 board/siemens/pxm2/board.c                    |   4 +-
 board/siemens/rut/board.c                     |   2 +-
 board/siemens/taurus/taurus.c                 |  50 +-
 board/socrates/socrates.c                     |   4 +-
 board/softing/vining_2000/vining_2000.c       |   8 +-
 board/solidrun/mx6cuboxi/mx6cuboxi.c          |  16 +-
 .../stm32f429-discovery/stm32f429-discovery.c |   4 +-
 .../stm32f429-evaluation.c                    |   4 +-
 .../stm32f469-discovery/stm32f469-discovery.c |   4 +-
 board/st/stm32mp1/stm32mp1.c                  |  11 +-
 board/sunxi/board.c                           |  25 +-
 board/synopsys/hsdk/env-lib.c                 |  11 +-
 board/synopsys/hsdk/hsdk.c                    |   6 +-
 board/syteco/zmx25/zmx25.c                    |   8 +-
 board/tcl/sl50/board.c                        |   6 +-
 .../puma_rk3399/puma-rk3399.c                 |   8 +-
 board/ti/am335x/board.c                       |  18 +-
 board/ti/am43xx/board.c                       |   6 +-
 board/ti/am57xx/board.c                       |  14 +-
 board/ti/beagle/beagle.c                      |  43 +-
 board/ti/common/board_detect.c                |  14 +-
 board/ti/dra7xx/evm.c                         |  12 +-
 board/ti/evm/evm.c                            |   2 +-
 board/ti/ks2_evm/board.c                      |  10 +-
 board/ti/ks2_evm/board_k2g.c                  |   8 +-
 board/ti/panda/panda.c                        |   4 +-
 board/toradex/apalis-imx8/apalis-imx8.c       |   4 +-
 board/toradex/apalis_imx6/apalis_imx6.c       |  12 +-
 .../toradex/colibri-imx6ull/colibri-imx6ull.c |   6 +-
 board/toradex/colibri-imx8x/colibri-imx8x.c   |   4 +-
 board/toradex/colibri_imx6/colibri_imx6.c     |   8 +-
 board/toradex/colibri_vf/colibri_vf.c         |   2 +-
 board/toradex/common/tdx-cfg-block.c          |   2 +-
 board/toradex/common/tdx-common.c             |   2 +-
 board/tqc/tqma6/tqma6.c                       |   2 +-
 board/udoo/neo/neo.c                          |   2 +-
 board/udoo/udoo.c                             |   4 +-
 board/varisys/common/sys_eeprom.c             |   6 +-
 board/vscom/baltos/board.c                    |   6 +-
 board/wandboard/wandboard.c                   |  12 +-
 board/warp7/warp7.c                           |   6 +-
 .../work_92105/work_92105_display.c           |   2 +-
 board/xes/common/board.c                      |   6 +-
 board/xilinx/zynq/board.c                     |  16 +-
 board/xilinx/zynqmp/cmds.c                    |   2 +-
 board/xilinx/zynqmp/zynqmp.c                  |  24 +-
 cmd/ab_select.c                               |   2 +-
 cmd/avb.c                                     |   2 +-
 cmd/bdinfo.c                                  |   6 +-
 cmd/binop.c                                   |   4 +-
 cmd/bootefi.c                                 |   8 +-
 cmd/bootm.c                                   |   4 +-
 cmd/bootmenu.c                                |   6 +-
 cmd/cbfs.c                                    |   2 +-
 cmd/cramfs.c                                  |   8 +-
 cmd/dtimg.c                                   |   2 +-
 cmd/elf.c                                     |  29 +-
 cmd/fdt.c                                     |  22 +-
 cmd/fpga.c                                    |   4 +-
 cmd/gpt.c                                     |   8 +-
 cmd/ini.c                                     |   6 +-
 cmd/itest.c                                   |   2 +-
 cmd/jffs2.c                                   |   4 +-
 cmd/load.c                                    |  10 +-
 cmd/lzmadec.c                                 |   2 +-
 cmd/md5sum.c                                  |   4 +-
 cmd/mtdparts.c                                |  41 +-
 cmd/mvebu/bubt.c                              |   2 +-
 cmd/nand.c                                    |  12 +-
 cmd/net.c                                     |  46 +-
 cmd/nvedit.c                                  | 394 +++++++---
 cmd/part.c                                    |   6 +-
 cmd/pxe.c                                     |  33 +-
 cmd/qfw.c                                     |   6 +-
 cmd/reiser.c                                  |   8 +-
 cmd/setexpr.c                                 |   8 +-
 cmd/spl.c                                     |   5 +-
 cmd/ti/ddr3.c                                 |   2 +-
 cmd/tpm-common.c                              |   2 +-
 cmd/tpm-v1.c                                  |   2 +-
 cmd/trace.c                                   |  18 +-
 cmd/ubi.c                                     |   2 +-
 cmd/unzip.c                                   |   2 +-
 cmd/ximg.c                                    |   4 +-
 cmd/zfs.c                                     |   6 +-
 cmd/zip.c                                     |   2 +-
 common/autoboot.c                             |  22 +-
 common/board_f.c                              |   3 +-
 common/board_r.c                              |  10 +-
 common/bootm.c                                |  12 +-
 common/bootm_os.c                             |  12 +-
 common/bootretry.c                            |   2 +-
 common/cli.c                                  |   2 +-
 common/cli_hush.c                             |  14 +-
 common/cli_simple.c                           |   2 +-
 common/command.c                              |   2 +-
 common/console.c                              |  14 +-
 common/fdt_support.c                          |   6 +-
 common/hash.c                                 |   4 +-
 common/hwconfig.c                             |   5 +-
 common/image-android.c                        |   4 +-
 common/image-fdt.c                            |   4 +-
 common/image.c                                |  15 +-
 common/main.c                                 |   5 +-
 common/spl/spl_dfu.c                          |   6 +-
 common/spl/spl_ext.c                          |   4 +-
 common/spl/spl_fat.c                          |   4 +-
 common/spl/spl_net.c                          |   4 +-
 common/splash.c                               |   4 +-
 common/splash_source.c                        |   8 +-
 common/update.c                               |  10 +-
 common/usb_hub.c                              |   2 +-
 common/usb_kbd.c                              |   6 +-
 disk/part.c                                   |   2 +-
 disk/part_amiga.c                             |   4 +-
 drivers/bootcount/bootcount_env.c             |  12 +-
 drivers/ddr/fsl/fsl_ddr_gen4.c                |   2 +-
 drivers/ddr/fsl/interactive.c                 |   5 +-
 drivers/ddr/fsl/options.c                     |   4 +-
 drivers/dfu/dfu.c                             |   6 +-
 drivers/fastboot/fb_command.c                 |   4 +-
 drivers/fastboot/fb_common.c                  |   2 +-
 drivers/fastboot/fb_getvar.c                  |   8 +-
 drivers/fastboot/fb_mmc.c                     |   2 +-
 drivers/input/i8042.c                         |   2 +-
 drivers/input/input.c                         |   2 +-
 drivers/misc/fs_loader.c                      |   8 +-
 drivers/mtd/cfi_flash.c                       |   2 +-
 drivers/mtd/mtd_uboot.c                       |  11 +-
 drivers/net/fec_mxc.c                         |   2 +-
 drivers/net/fm/b4860.c                        |   3 +-
 drivers/net/fm/fdt.c                          |   2 +-
 drivers/net/fm/fm.c                           |   4 +-
 drivers/net/fsl-mc/mc.c                       |   7 +-
 drivers/net/netconsole.c                      |  14 +-
 drivers/net/phy/micrel_ksz90x1.c              |   4 +-
 drivers/net/sandbox-raw.c                     |   4 +-
 drivers/pci/pci.c                             |   4 +-
 drivers/pci/pci_common.c                      |   2 +-
 drivers/reset/reset-socfpga.c                 |   2 +-
 drivers/rtc/m41t60.c                          |   2 +-
 drivers/scsi/scsi.c                           |   2 +-
 drivers/serial/usbtty.c                       |   4 +-
 drivers/usb/gadget/designware_udc.c           |   2 +-
 drivers/usb/gadget/ether.c                    |  13 +-
 drivers/usb/gadget/f_dfu.c                    |   2 +-
 drivers/usb/gadget/f_fastboot.c               |   2 +-
 drivers/usb/gadget/f_rockusb.c                |   2 +-
 drivers/usb/gadget/f_sdp.c                    |   2 +-
 drivers/usb/host/ehci-fsl.c                   |   2 +-
 drivers/video/ati_radeon_fb.c                 |   2 +-
 drivers/video/cfb_console.c                   |   2 +-
 drivers/video/mb862xx.c                       |   2 +-
 drivers/video/mx3fb.c                         |   2 +-
 drivers/video/mxsfb.c                         |   2 +-
 drivers/video/videomodes.c                    |   4 +-
 env/Kconfig                                   | 683 +-----------------
 env/Kconfig.efi                               | 152 ++++
 env/Kconfig.uboot                             | 671 +++++++++++++++++
 env/Makefile                                  |  33 +-
 env/callback.c                                |  40 +-
 env/common.c                                  | 255 ++++---
 env/env.c                                     | 158 ++--
 env/env_ctx_efi.c                             | 131 ++++
 env/env_ctx_uboot.c                           | 292 ++++++++
 env/fat.c                                     | 102 ++-
 env/flags.c                                   |  35 +-
 env/flash.c                                   | 397 ++++++----
 env/nowhere.c                                 |   7 +-
 fs/fs.c                                       |  14 +-
 fs/ubifs/ubifs.c                              |   2 +-
 include/_exports.h                            |   6 +-
 include/common.h                              |   6 +-
 include/env.h                                 | 114 ++-
 include/env_internal.h                        |  89 ++-
 include/exports.h                             |   5 +-
 include/search.h                              |   6 +-
 lib/efi_loader/efi_console.c                  |   2 +-
 lib/efi_loader/efi_variable.c                 |  91 ++-
 lib/fdtdec.c                                  |   2 +-
 lib/hashtable.c                               |  14 +-
 lib/smbios.c                                  |   2 +-
 lib/uuid.c                                    |   2 +-
 net/bootp.c                                   |  17 +-
 net/dns.c                                     |   2 +-
 net/eth-uclass.c                              |   6 +-
 net/eth_common.c                              |  18 +-
 net/eth_legacy.c                              |   2 +-
 net/link_local.c                              |   2 +-
 net/net.c                                     |  11 +-
 net/tftp.c                                    |  10 +-
 net/wol.c                                     |   2 +-
 post/post.c                                   |   2 +-
 371 files changed, 3690 insertions(+), 2337 deletions(-)
 create mode 100644 env/Kconfig.efi
 create mode 100644 env/Kconfig.uboot
 create mode 100644 env/env_ctx_efi.c
 create mode 100644 env/env_ctx_uboot.c
Signature · 1 line
2.21.0
#1 lore raw

PATCH v5 1/19 env: extend interfaces allowing for env contexts

The notion of "env context" (or simply "context") will provide users of env interfaces to manage their own domain of variables, which is separated from other contexts and can be loaded/stored with dedicated backing storage device.

With this patch, almost of all env interfaces are extended to accept additional argument of a pointer to env context to identify targeted domain after Wolfgang's requirement.

Optionally, a context may have no backing storage, in this case, all the entries associated with this context will be lost after reboot and env_save() returns -ENODEV.

In addition, "env" command is also modified to allow for specifying a context with "-C <context name>" option.
Please note "-e" in "env set" and "env print" is still maintained not only for backward compatibility but also for usefullness at non-U-Boot-environment-based UEFI variables implementation, in particular, secure storage solution in the future.

---
 cmd/nvedit.c           | 394 +++++++++++++++++-------
 env/Kconfig            | 682 ++---------------------------------------
 env/Makefile           |  30 +-
 env/callback.c         |  40 ++-
 env/common.c           | 255 ++++++++-------
 env/env.c              | 158 ++++++----
 env/flags.c            |  35 ++-
 include/_exports.h     |   6 +-
 include/common.h       |   6 +-
 include/env.h          |  95 ++++--
 include/env_internal.h |  89 +++++-
 include/exports.h      |   5 +-
 12 files changed, 802 insertions(+), 993 deletions(-)
cmd/nvedit.c +283 -111
index 1cb0bc1460b9..04af78d71b47 100644
@@ -40,34 +40,24 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-#if	defined(CONFIG_ENV_IS_IN_EEPROM)	|| \
-	defined(CONFIG_ENV_IS_IN_FLASH)		|| \
-	defined(CONFIG_ENV_IS_IN_MMC)		|| \
-	defined(CONFIG_ENV_IS_IN_FAT)		|| \
-	defined(CONFIG_ENV_IS_IN_EXT4)		|| \
-	defined(CONFIG_ENV_IS_IN_NAND)		|| \
-	defined(CONFIG_ENV_IS_IN_NVRAM)		|| \
-	defined(CONFIG_ENV_IS_IN_ONENAND)	|| \
-	defined(CONFIG_ENV_IS_IN_SATA)		|| \
-	defined(CONFIG_ENV_IS_IN_SPI_FLASH)	|| \
-	defined(CONFIG_ENV_IS_IN_REMOTE)	|| \
-	defined(CONFIG_ENV_IS_IN_UBI)
-
-#define ENV_IS_IN_DEVICE
-
-#endif
-
-#if	!defined(ENV_IS_IN_DEVICE)		&& \
-	!defined(CONFIG_ENV_IS_NOWHERE)
-# error Define one of CONFIG_ENV_IS_IN_{EEPROM|FLASH|MMC|FAT|EXT4|\
-NAND|NVRAM|ONENAND|SATA|SPI_FLASH|REMOTE|UBI} or CONFIG_ENV_IS_NOWHERE
-#endif
-
 /*
  * Maximum expected input data size for import command
  */
 #define	MAX_ENV_SIZE	(1 << 20)	/* 1 MiB */
 
+static struct env_context *get_env_context(const char *arg)
+{
+	struct env_context *ctx;
+	int i;
+
+	for (i = 0, ctx = U_BOOT_ENV_CTX_START; i < U_BOOT_ENV_CTX_COUNT;
+	     i++, ctx++)
+		if (!strcmp(arg, ctx->name))
+			return ctx;
+
+	return NULL;
+}
+
 /*
  * This variable is incremented on each do_env_set(), so it can
  * be used via env_get_id() as an indication, if the environment
@@ -75,11 +65,9 @@ NAND|NVRAM|ONENAND|SATA|SPI_FLASH|REMOTE|UBI} or CONFIG_ENV_IS_NOWHERE
  * variable only if the environment was changed ... done so for
  * example in NetInitLoop()
  */
-static int env_id = 1;
-
-int env_get_id(void)
+int env_get_id(struct env_context *ctx)
 {
-	return env_id;
+	return ctx->env_id;
 }
 
 #ifndef CONFIG_SPL_BUILD
@@ -88,7 +76,7 @@ int env_get_id(void)
  *
  * Returns 0 in case of error, or length of printed string
  */
-static int env_print(char *name, int flag)
+static int env_print(struct env_context *ctx, char *name, int flag)
 {
 	char *res = NULL;
 	ssize_t len;
@@ -96,9 +84,10 @@ static int env_print(char *name, int flag)
 	if (name) {		/* print a single name */
 		struct env_entry e, *ep;
 
+		e.ctx = ctx;
 		e.key = name;
 		e.data = NULL;
-		hsearch_r(e, ENV_FIND, &ep, &env_htab, flag);
+		hsearch_r(e, ENV_FIND, &ep, ctx->htab, flag);
 		if (ep == NULL)
 			return 0;
 		len = printf("%s=%s\n", ep->key, ep->data);
@@ -106,7 +95,7 @@ static int env_print(char *name, int flag)
 	}
 
 	/* print whole list */
-	len = hexport_r(&env_htab, '\n', flag, &res, 0, 0, NULL);
+	len = hexport_r(ctx->htab, '\n', flag, &res, 0, 0, NULL);
 
 	if (len > 0) {
 		puts(res);
@@ -122,24 +111,48 @@ static int env_print(char *name, int flag)
 static int do_env_print(cmd_tbl_t *cmdtp, int flag, int argc,
 			char * const argv[])
 {
+	struct env_context *ctx = ctx_uboot;
 	int i;
 	int rcode = 0;
 	int env_flag = H_HIDE_DOT;
 
+	while (argc > 1 && argv[1][0] == '-') {
 #if defined(CONFIG_CMD_NVEDIT_EFI)
-	if (argc > 1 && argv[1][0] == '-' && argv[1][1] == 'e')
-		return do_env_print_efi(cmdtp, flag, --argc, ++argv);
+		if (!strcmp(argv[1], "-e")) {
+			argc--;
+			argv++;
+
+			return do_env_print_efi(cmdtp, flag, argc, argv);
+		}
 #endif
 
-	if (argc > 1 && argv[1][0] == '-' && argv[1][1] == 'a') {
-		argc--;
-		argv++;
-		env_flag &= ~H_HIDE_DOT;
+		if (!strcmp(argv[1], "-a")) {
+			argc--;
+			argv++;
+			env_flag &= ~H_HIDE_DOT;
+			continue;
+		}
+
+		if (!strcmp(argv[1], "-C")) {
+			if (argc == 2) {
+				printf("\nNo context specified\n");
+				return 0;
+			}
+			ctx = get_env_context(argv[2]);
+			if (!ctx) {
+				printf("\nInvalid context: %s\n", argv[2]);
+				return 0;
+			}
+			argc -= 2;
+			argv += 2;
+
+			continue;
+		}
 	}
 
 	if (argc == 1) {
 		/* print all env vars */
-		rcode = env_print(NULL, env_flag);
+		rcode = env_print(ctx, NULL, env_flag);
 		if (!rcode)
 			return 1;
 		printf("\nEnvironment size: %d/%ld bytes\n",
@@ -150,7 +163,7 @@ static int do_env_print(cmd_tbl_t *cmdtp, int flag, int argc,
 	/* print selected env vars */
 	env_flag &= ~H_HIDE_DOT;
 	for (i = 1; i < argc; ++i) {
-		int rc = env_print(argv[i], env_flag);
+		int rc = env_print(ctx, argv[i], env_flag);
 		if (!rc) {
 			printf("## Error: \"%s\" not defined\n", argv[i]);
 			++rcode;
@@ -164,12 +177,23 @@ static int do_env_print(cmd_tbl_t *cmdtp, int flag, int argc,
 static int do_env_grep(cmd_tbl_t *cmdtp, int flag,
 		       int argc, char * const argv[])
 {
+	struct env_context *ctx = ctx_uboot;
 	char *res = NULL;
 	int len, grep_how, grep_what;
 
 	if (argc < 2)
 		return CMD_RET_USAGE;
 
+	if (argc >= 5 && !strcmp(argc[0], "-C")) {
+		ctx = get_env_context(argv[1]);
+		if (!ctx) {
+			printf("\nInvalid context: %s\n", argv[2]);
+			return CMD_RET_FAILURE;
+		}
+		argc -= 2;
+		argv += 2;
+	}
+
 	grep_how  = H_MATCH_SUBSTR;	/* default: substring search	*/
 	grep_what = H_MATCH_BOTH;	/* default: grep names and values */
 
@@ -200,7 +224,7 @@ static int do_env_grep(cmd_tbl_t *cmdtp, int flag,
 	}
 
 DONE:
-	len = hexport_r(&env_htab, '\n',
+	len = hexport_r(ctx->htab, '\n',
 			flag | grep_what | grep_how,
 			&res, 0, argc, argv);
 
@@ -223,6 +247,7 @@ DONE:
  */
 static int _do_env_set(int flag, int argc, char * const argv[], int env_flag)
 {
+	struct env_context *ctx = ctx_uboot;
 	int   i, len;
 	char  *name, *value, *s;
 	struct env_entry e, *ep;
@@ -230,9 +255,23 @@ static int _do_env_set(int flag, int argc, char * const argv[], int env_flag)
 	debug("Initial value for argc=%d\n", argc);
 
 #if CONFIG_IS_ENABLED(CMD_NVEDIT_EFI)
-	if (argc > 1 && argv[1][0] == '-' && argv[1][1] == 'e')
-		return do_env_set_efi(NULL, flag, --argc, ++argv);
+	if (argc > 1 && !strcmp(argv[1], "-e")) {
+		argc--;
+		argv++;
+
+		/* FIXME: env_flag */
+		return do_env_set_efi(NULL, flag, argc, argv);
+	}
 #endif
+	if (argc >= 3 && !strcmp(argv[1], "-C")) {
+		ctx = get_env_context(argv[2]);
+		if (!ctx) {
+			printf("\nInvalid context: %s\n", argv[2]);
+			return CMD_RET_FAILURE;
+		}
+		argc -= 2;
+		argv += 2;
+	}
 
 	while (argc > 1 && **(argv + 1) == '-') {
 		char *arg = *++argv;
@@ -257,11 +296,11 @@ static int _do_env_set(int flag, int argc, char * const argv[], int env_flag)
 		return 1;
 	}
 
-	env_id++;
+	ctx->env_id++;
 
 	/* Delete only ? */
 	if (argc < 3 || argv[2] == NULL) {
-		int rc = hdelete_r(name, &env_htab, env_flag);
+		int rc = hdelete_r(name, ctx->htab, env_flag);
 		return !rc;
 	}
 
@@ -286,9 +325,10 @@ static int _do_env_set(int flag, int argc, char * const argv[], int env_flag)
 	if (s != value)
 		*--s = '\0';
 
+	e.ctx	= ctx;
 	e.key	= name;
 	e.data	= value;
-	hsearch_r(e, ENV_ENTER, &ep, &env_htab, env_flag);
+	hsearch_r(e, ENV_ENTER, &ep, ctx->htab, env_flag);
 	free(value);
 	if (!ep) {
 		printf("## Error inserting \"%s\" variable, errno=%d\n",
@@ -299,18 +339,19 @@ static int _do_env_set(int flag, int argc, char * const argv[], int env_flag)
 	return 0;
 }
 
-int env_set(const char *varname, const char *varvalue)
+int env_set(struct env_context *ctx, const char *varname, const char *varvalue)
 {
-	const char * const argv[4] = { "setenv", varname, varvalue, NULL };
+	const char * const argv[6] = { "setenv", "-C", ctx->name,
+					varname, varvalue, NULL };
 
 	/* before import into hashtable */
-	if (!(gd->flags & GD_FLG_ENV_READY))
+	if (!env_is_ready(ctx))
 		return 1;
 
 	if (varvalue == NULL || varvalue[0] == '\0')
-		return _do_env_set(0, 2, (char * const *)argv, H_PROGRAMMATIC);
+		return _do_env_set(0, 4, (char * const *)argv, H_PROGRAMMATIC);
 	else
-		return _do_env_set(0, 3, (char * const *)argv, H_PROGRAMMATIC);
+		return _do_env_set(0, 5, (char * const *)argv, H_PROGRAMMATIC);
 }
 
 /**
@@ -320,12 +361,12 @@ int env_set(const char *varname, const char *varvalue)
  * @param value		Value to set it to
  * @return 0 if ok, 1 on error
  */
-int env_set_ulong(const char *varname, ulong value)
+int env_set_ulong(struct env_context *ctx, const char *varname, ulong value)
 {
 	/* TODO: this should be unsigned */
 	char *str = simple_itoa(value);
 
-	return env_set(varname, str);
+	return env_set(ctx, varname, str);
 }
 
 /**
@@ -335,21 +376,22 @@ int env_set_ulong(const char *varname, ulong value)
  * @param value		Value to set it to
  * @return 0 if ok, 1 on error
  */
-int env_set_hex(const char *varname, ulong value)
+int env_set_hex(struct env_context *ctx, const char *varname, ulong value)
 {
 	char str[17];
 
 	sprintf(str, "%lx", value);
-	return env_set(varname, str);
+	return env_set(ctx, varname, str);
 }
 
-ulong env_get_hex(const char *varname, ulong default_val)
+ulong env_get_hex(struct env_context *ctx, const char *varname,
+		  ulong default_val)
 {
 	const char *s;
 	ulong value;
 	char *endp;
 
-	s = env_get(varname);
+	s = env_get(ctx, varname);
 	if (s)
 		value = simple_strtoul(s, &endp, 16);
 	if (!s || endp == s)
@@ -360,7 +402,7 @@ ulong env_get_hex(const char *varname, ulong default_val)
 
 int eth_env_get_enetaddr(const char *name, uint8_t *enetaddr)
 {
-	eth_parse_enetaddr(env_get(name), enetaddr);
+	eth_parse_enetaddr(env_get(ctx_uboot, name), enetaddr);
 	return is_valid_ethaddr(enetaddr);
 }
 
@@ -373,7 +415,7 @@ int eth_env_set_enetaddr(const char *name, const uint8_t *enetaddr)
 
 	sprintf(buf, "%pM", enetaddr);
 
-	return env_set(name, buf);
+	return env_set(ctx_uboot, name, buf);
 }
 
 #ifndef CONFIG_SPL_BUILD
@@ -509,10 +551,21 @@ static int print_active_callback(struct env_entry *entry)
  */
 int do_env_callback(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
+	struct env_context *ctx = ctx_uboot;
 	struct env_clbk_tbl *clbkp;
 	int i;
 	int num_callbacks;
 
+	if (argc > 3 && !strcmp(argv[1], "-C")) {
+		ctx = get_env_context(argv[2]);
+		if (!ctx) {
+			printf("\nInvalid context: %s\n", argv[2]);
+			return CMD_RET_FAILURE;
+		}
+		argc -= 2;
+		argv += 2;
+	}
+
 	/* Print the available callbacks */
 	puts("Available callbacks:\n");
 	puts("\tCallback Name\n");
@@ -535,7 +588,7 @@ int do_env_callback(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	puts("Active callback bindings:\n");
 	printf("\t%-20s %-20s\n", "Variable Name", "Callback Name");
 	printf("\t%-20s %-20s\n", "-------------", "-------------");
-	hwalk_r(&env_htab, print_active_callback);
+	hwalk_r(ctx->htab, print_active_callback);
 	return 0;
 }
 #endif
@@ -577,6 +630,18 @@ static int print_active_flags(struct env_entry *entry)
  */
 int do_env_flags(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
+	struct env_context *ctx = ctx_uboot;
+
+	if (argc > 3 && !strcmp(argv[1], "-C")) {
+		ctx = get_env_context(argv[2]);
+		if (!ctx) {
+			printf("\nInvalid context: %s\n", argv[2]);
+			return CMD_RET_FAILURE;
+		}
+		argc -= 2;
+		argv += 2;
+	}
+
 	/* Print the available variable types */
 	printf("Available variable type flags (position %d):\n",
 		ENV_FLAGS_VARTYPE_LOC);
@@ -608,7 +673,7 @@ int do_env_flags(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 		"Variable Access");
 	printf("\t%-20s %-20s %-20s\n", "-------------", "-------------",
 		"---------------");
-	hwalk_r(&env_htab, print_active_flags);
+	hwalk_r(ctx->htab, print_active_flags);
 	return 0;
 }
 #endif
@@ -620,18 +685,31 @@ int do_env_flags(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 static int do_env_edit(cmd_tbl_t *cmdtp, int flag, int argc,
 		       char * const argv[])
 {
+	struct env_context *ctx = ctx_uboot;
 	char buffer[CONFIG_SYS_CBSIZE];
 	char *init_val;
 
 	if (argc < 2)
 		return CMD_RET_USAGE;
 
+	if (argc > 3 && !strcmp(argv[1], "-C")) {
+		ctx = get_env_context(argv[2]);
+		if (!ctx) {
+			printf("\nInvalid context: %s\n", argv[2]);
+			return CMD_RET_FAILURE;
+		}
+		argc -= 2;
+		argv += 2;
+		if (argc < 2)
+			return CMD_RET_USAGE;
+	}
+
 	/* before import into hashtable */
-	if (!(gd->flags & GD_FLG_ENV_READY))
+	if (!ctx->is_ready(ctx))
 		return 1;
 
 	/* Set read buffer to initial value or empty sting */
-	init_val = env_get(argv[1]);
+	init_val = env_get(ctx, argv[1]);
 	if (init_val)
 		snprintf(buffer, CONFIG_SYS_CBSIZE, "%s", init_val);
 	else
@@ -641,14 +719,15 @@ static int do_env_edit(cmd_tbl_t *cmdtp, int flag, int argc,
 		return 1;
 
 	if (buffer[0] == '\0') {
-		const char * const _argv[3] = { "setenv", argv[1], NULL };
+		const char * const _argv[5] = { "setenv", "-C", ctx->name,
+						argv[1], NULL };
 
-		return _do_env_set(0, 2, (char * const *)_argv, H_INTERACTIVE);
+		return _do_env_set(0, 4, (char * const *)_argv, H_INTERACTIVE);
 	} else {
-		const char * const _argv[4] = { "setenv", argv[1], buffer,
-			NULL };
+		const char * const _argv[6] = { "setenv", "-C", ctx->name,
+						argv[1], buffer, NULL };
 
-		return _do_env_set(0, 3, (char * const *)_argv, H_INTERACTIVE);
+		return _do_env_set(0, 5, (char * const *)_argv, H_INTERACTIVE);
 	}
 }
 #endif /* CONFIG_CMD_EDITENV */
@@ -659,22 +738,28 @@ static int do_env_edit(cmd_tbl_t *cmdtp, int flag, int argc,
  * return address of storage for that variable,
  * or NULL if not found
  */
-char *env_get(const char *name)
+char *env_get(struct env_context *ctx, const char *name)
 {
-	if (gd->flags & GD_FLG_ENV_READY) { /* after import into hashtable */
+	if (env_is_ready(ctx)) { /* after import into hashtable */
 		struct env_entry e, *ep;
 
 		WATCHDOG_RESET();
 
+		e.ctx	= ctx;
 		e.key	= name;
 		e.data	= NULL;
-		hsearch_r(e, ENV_FIND, &ep, &env_htab, 0);
+		hsearch_r(e, ENV_FIND, &ep, ctx->htab, 0);
 
 		return ep ? ep->data : NULL;
 	}
 
+	/* FIXME: env_buf should be place in env_context? */
+	if (ctx != ctx_uboot)
+		return NULL;
+
 	/* restricted capabilities before import */
-	if (env_get_f(name, (char *)(gd->env_buf), sizeof(gd->env_buf)) > 0)
+	if (env_get_f(ctx, name, (char *)gd->env_buf, sizeof(gd->env_buf))
+	    > 0)
 		return (char *)(gd->env_buf);
 
 	return NULL;
@@ -683,27 +768,28 @@ char *env_get(const char *name)
 /*
  * Look up variable from environment for restricted C runtime env.
  */
-int env_get_f(const char *name, char *buf, unsigned len)
+int env_get_f(struct env_context *ctx, const char *name, char *buf,
+	      unsigned int len)
 {
 	int i, nxt, c;
 
-	for (i = 0; env_get_char(i) != '\0'; i = nxt + 1) {
+	for (i = 0; env_get_char(ctx, i) != '\0'; i = nxt + 1) {
 		int val, n;
 
-		for (nxt = i; (c = env_get_char(nxt)) != '\0'; ++nxt) {
+		for (nxt = i; (c = env_get_char(ctx, nxt)) != '\0'; ++nxt) {
 			if (c < 0)
 				return c;
-			if (nxt >= CONFIG_ENV_SIZE)
+			if (nxt >= ctx->env_size)
 				return -1;
 		}
 
-		val = env_match((uchar *)name, i);
+		val = env_match(ctx, (uchar *)name, i);
 		if (val < 0)
 			continue;
 
 		/* found; copy out */
 		for (n = 0; n < len; ++n, ++buf) {
-			c = env_get_char(val++);
+			c = env_get_char(ctx, val++);
 			if (c < 0)
 				return c;
 			*buf = c;
@@ -732,13 +818,14 @@ int env_get_f(const char *name, char *buf, unsigned len)
  *			found
  * @return the decoded value, or default_val if not found
  */
-ulong env_get_ulong(const char *name, int base, ulong default_val)
+ulong env_get_ulong(struct env_context *ctx, const char *name, int base,
+		    ulong default_val)
 {
 	/*
 	 * We can use env_get() here, even before relocation, since the
 	 * environment variable value is an integer and thus short.
 	 */
-	const char *str = env_get(name);
+	const char *str = env_get(ctx, name);
 
 	return str ? simple_strtoul(str, NULL, base) : default_val;
 }
@@ -748,11 +835,23 @@ ulong env_get_ulong(const char *name, int base, ulong default_val)
 static int do_env_save(cmd_tbl_t *cmdtp, int flag, int argc,
 		       char * const argv[])
 {
-	return env_save() ? 1 : 0;
+	struct env_context *ctx = ctx_uboot;
+
+	if (argc >= 3 && !strcmp(argv[1], "-C")) {
+		ctx = get_env_context(argv[2]);
+		if (!ctx) {
+			printf("\nInvalid context: %s\n", argv[2]);
+			return CMD_RET_FAILURE;
+		}
+		argc -= 2;
+		argv += 2;
+	}
+
+	return env_save(ctx) ? 1 : 0;
 }
 
 U_BOOT_CMD(
-	saveenv, 1, 0,	do_env_save,
+	saveenv, 3, 0,	do_env_save,
 	"save environment variables to persistent storage",
 	""
 );
@@ -761,11 +860,21 @@ U_BOOT_CMD(
 static int do_env_erase(cmd_tbl_t *cmdtp, int flag, int argc,
 			char * const argv[])
 {
-	return env_erase() ? 1 : 0;
+	if (argc >= 3 && !strcmp(argv[1], "-C")) {
+		ctx = get_env_context(argv[2]);
+		if (!ctx) {
+			printf("\nInvalid context: %s\n", argv[2]);
+			return CMD_RET_FAILURE;
+		}
+		argc -= 2;
+		argv += 2;
+	}
+
+	return env_erase(ctx) ? 1 : 0;
 }
 
 U_BOOT_CMD(
-	eraseenv, 1, 0,	do_env_erase,
+	eraseenv, 3, 0,	do_env_erase,
 	"erase environment variables from persistent storage",
 	""
 );
@@ -773,16 +882,16 @@ U_BOOT_CMD(
 #endif
 #endif /* CONFIG_SPL_BUILD */
 
-int env_match(uchar *s1, int i2)
+int env_match(struct env_context *ctx, uchar *s1, int i2)
 {
 	if (s1 == NULL)
 		return -1;
 
-	while (*s1 == env_get_char(i2++))
+	while (*s1 == env_get_char(ctx, i2++))
 		if (*s1++ == '=')
 			return i2;
 
-	if (*s1 == '\0' && env_get_char(i2-1) == '=')
+	if (*s1 == '\0' && env_get_char(ctx, i2 - 1) == '=')
 		return i2;
 
 	return -1;
@@ -792,9 +901,20 @@ int env_match(uchar *s1, int i2)
 static int do_env_default(cmd_tbl_t *cmdtp, int flag,
 			  int argc, char * const argv[])
 {
+	struct env_context *ctx = ctx_uboot;
 	int all = 0, env_flag = H_INTERACTIVE;
 
 	debug("Initial value for argc=%d\n", argc);
+	if (argc >= 3 && !strcmp(argv[1], "-C")) {
+		ctx = get_env_context(argv[2]);
+		if (!ctx) {
+			printf("\nInvalid context: %s\n", argv[2]);
+			return CMD_RET_FAILURE;
+		}
+		argc -= 2;
+		argv += 2;
+	}
+
 	while (--argc > 0 && **++argv == '-') {
 		char *arg = *argv;
 
@@ -814,13 +934,13 @@ static int do_env_default(cmd_tbl_t *cmdtp, int flag,
 	debug("Final value for argc=%d\n", argc);
 	if (all && (argc == 0)) {
 		/* Reset the whole environment */
-		env_set_default("## Resetting to default environment\n",
+		env_set_default(ctx, "## Resetting to default environment\n",
 				env_flag);
 		return 0;
 	}
 	if (!all && (argc > 0)) {
 		/* Reset individual variables */
-		env_set_default_vars(argc, argv, env_flag);
+		env_set_default_vars(ctx, argc, argv, env_flag);
 		return 0;
 	}
 
@@ -830,10 +950,21 @@ static int do_env_default(cmd_tbl_t *cmdtp, int flag,
 static int do_env_delete(cmd_tbl_t *cmdtp, int flag,
 			 int argc, char * const argv[])
 {
+	struct env_context *ctx = ctx_uboot;
 	int env_flag = H_INTERACTIVE;
 	int ret = 0;
 
 	debug("Initial value for argc=%d\n", argc);
+	if (argc >= 3 && !strcmp(argv[1], "-C")) {
+		ctx = get_env_context(argv[2]);
+		if (!ctx) {
+			printf("\nInvalid context: %s\n", argv[2]);
+			return CMD_RET_FAILURE;
+		}
+		argc -= 2;
+		argv += 2;
+	}
+
 	while (argc > 1 && **(argv + 1) == '-') {
 		char *arg = *++argv;
 
@@ -850,12 +981,12 @@ static int do_env_delete(cmd_tbl_t *cmdtp, int flag,
 	}
 	debug("Final value for argc=%d\n", argc);
 
-	env_id++;
+	ctx->env_id++;
 
 	while (--argc > 0) {
 		char *name = *++argv;
 
-		if (!hdelete_r(name, &env_htab, env_flag))
+		if (!hdelete_r(name, ctx->htab, env_flag))
 			ret = 1;
 	}
 
@@ -911,12 +1042,13 @@ static int do_env_delete(cmd_tbl_t *cmdtp, int flag,
 static int do_env_export(cmd_tbl_t *cmdtp, int flag,
 			 int argc, char * const argv[])
 {
+	struct  env_context *ctx = ctx_uboot;
 	char	buf[32];
 	ulong	addr;
 	char	*ptr, *cmd, *res;
 	size_t	size = 0;
 	ssize_t	len;
-	env_t	*envp;
+	env_hdr_t *envp;
 	char	sep = '\n';
 	int	chk = 0;
 	int	fmt = 0;
@@ -927,6 +1059,18 @@ static int do_env_export(cmd_tbl_t *cmdtp, int flag,
 		char *arg = *argv;
 		while (*++arg) {
 			switch (*arg) {
+			case 'C':
+				if (--argc <= 0)
+					return cmd_usage(cmdtp);
+
+				++argv;
+				ctx = get_env_context(argv[0]);
+				if (!ctx) {
+					printf("\nInvalid context: %s\n",
+					       argv[0]);
+					return CMD_RET_FAILURE;
+				}
+				break;
 			case 'b':		/* raw binary format */
 				if (fmt++)
 					goto sep_err;
@@ -968,7 +1112,7 @@ NXTARG:		;
 	argv++;
 
 	if (sep) {		/* export as text file */
-		len = hexport_r(&env_htab, sep,
+		len = hexport_r(ctx->htab, sep,
 				H_MATCH_KEY | H_MATCH_IDENT,
 				&ptr, size, argc, argv);
 		if (len < 0) {
@@ -977,21 +1121,21 @@ NXTARG:		;
 			return 1;
 		}
 		sprintf(buf, "%zX", (size_t)len);
-		env_set("filesize", buf);
+		env_set(ctx_uboot, "filesize", buf);
 
 		return 0;
 	}
 
-	envp = (env_t *)ptr;
+	envp = (env_hdr_t *)ptr;
 
 	if (chk)		/* export as checksum protected block */
 		res = (char *)envp->data;
 	else			/* export as raw binary data */
 		res = ptr;
 
-	len = hexport_r(&env_htab, '\0',
+	len = hexport_r(ctx->htab, '\0',
 			H_MATCH_KEY | H_MATCH_IDENT,
-			&res, ENV_SIZE, argc, argv);
+			&res, ctx->env_size, argc, argv);
 	if (len < 0) {
 		pr_err("## Error: Cannot export environment: errno = %d\n",
 		       errno);
@@ -1000,12 +1144,13 @@ NXTARG:		;
 
 	if (chk) {
 		envp->crc = crc32(0, envp->data,
-				size ? size - offsetof(env_t, data) : ENV_SIZE);
+				size ? size - offsetof(env_t, data)
+					: ctx->env_size);
 #ifdef CONFIG_ENV_ADDR_REDUND
 		envp->flags = ENV_REDUND_ACTIVE;
 #endif
 	}
-	env_set_hex("filesize", len + offsetof(env_t, data));
+	env_set_hex(ctx_uboot, "filesize", len + offsetof(env_t, data));
 
 	return 0;
 
@@ -1044,6 +1189,7 @@ sep_err:
 static int do_env_import(cmd_tbl_t *cmdtp, int flag,
 			 int argc, char * const argv[])
 {
+	struct env_context *ctx = ctx_uboot;
 	ulong	addr;
 	char	*cmd, *ptr;
 	char	sep = '\n';
@@ -1060,6 +1206,18 @@ static int do_env_import(cmd_tbl_t *cmdtp, int flag,
 		char *arg = *argv;
 		while (*++arg) {
 			switch (*arg) {
+			case 'C':
+				if (--argc <= 0)
+					return cmd_usage(cmdtp);
+
+				++argv;
+				ctx = get_env_context(argv[0]);
+				if (!ctx) {
+					printf("\nInvalid context: %s\n",
+					       argv[0]);
+					return CMD_RET_FAILURE;
+				}
+				break;
 			case 'b':		/* raw binary format */
 				if (fmt++)
 					goto sep_err;
@@ -1129,9 +1287,9 @@ static int do_env_import(cmd_tbl_t *cmdtp, int flag,
 
 	if (chk) {
 		uint32_t crc;
-		env_t *ep = (env_t *)ptr;
+		env_hdr_t *ep = (env_hdr_t *)ptr;
 
-		size -= offsetof(env_t, data);
+		size -= offsetof(env_hdr_t, data);
 		memcpy(&crc, &ep->crc, sizeof(crc));
 
 		if (crc32(0, ep->data, size) != crc) {
@@ -1141,13 +1299,13 @@ static int do_env_import(cmd_tbl_t *cmdtp, int flag,
 		ptr = (char *)ep->data;
 	}
 
-	if (!himport_r(&env_htab, ptr, size, sep, del ? 0 : H_NOCLEAR,
+	if (!himport_r(ctx->htab, ptr, size, sep, del ? 0 : H_NOCLEAR,
 		       crlf_is_lf, wl ? argc - 2 : 0, wl ? &argv[2] : NULL)) {
 		pr_err("## Error: Environment import failed: errno = %d\n",
 		       errno);
 		return 1;
 	}
-	gd->flags |= GD_FLG_ENV_READY;
+	env_set_ready(ctx);
 
 	return 0;
 
@@ -1262,14 +1420,28 @@ static int do_env_info(cmd_tbl_t *cmdtp, int flag,
 static int do_env_exists(cmd_tbl_t *cmdtp, int flag, int argc,
 		       char * const argv[])
 {
+	struct env_context *ctx =  ctx_uboot;
 	struct env_entry e, *ep;
 
 	if (argc < 2)
 		return CMD_RET_USAGE;
 
+	if (argc >= 3 && !strcmp(argv[1], "-c")) {
+		ctx = get_env_context(argv[2]);
+		if (!ctx) {
+			printf("\nInvalid context: %s\n", argv[2]);
+			return CMD_RET_FAILURE;
+		}
+		argc -= 2;
+		argv += 2;
+		if (argc < 2)
+			return CMD_RET_USAGE;
+	}
+
+	e.ctx = ctx;
 	e.key = argv[1];
 	e.data = NULL;
-	hsearch_r(e, ENV_FIND, &ep, &env_htab, 0);
+	hsearch_r(e, ENV_FIND, &ep, ctx->htab, 0);
 
 	return (ep == NULL) ? 1 : 0;
 }
@@ -1285,22 +1457,22 @@ static cmd_tbl_t cmd_env_sub[] = {
 	U_BOOT_CMD_MKENT(default, 1, 0, do_env_default, "", ""),
 	U_BOOT_CMD_MKENT(delete, CONFIG_SYS_MAXARGS, 0, do_env_delete, "", ""),
 #if defined(CONFIG_CMD_EDITENV)
-	U_BOOT_CMD_MKENT(edit, 2, 0, do_env_edit, "", ""),
+	U_BOOT_CMD_MKENT(edit, 4, 0, do_env_edit, "", ""),
 #endif
 #if defined(CONFIG_CMD_ENV_CALLBACK)
-	U_BOOT_CMD_MKENT(callbacks, 1, 0, do_env_callback, "", ""),
+	U_BOOT_CMD_MKENT(callbacks, 3, 0, do_env_callback, "", ""),
 #endif
 #if defined(CONFIG_CMD_ENV_FLAGS)
-	U_BOOT_CMD_MKENT(flags, 1, 0, do_env_flags, "", ""),
+	U_BOOT_CMD_MKENT(flags, 3, 0, do_env_flags, "", ""),
 #endif
 #if defined(CONFIG_CMD_EXPORTENV)
-	U_BOOT_CMD_MKENT(export, 4, 0, do_env_export, "", ""),
+	U_BOOT_CMD_MKENT(export, 6, 0, do_env_export, "", ""),
 #endif
 #if defined(CONFIG_CMD_GREPENV)
 	U_BOOT_CMD_MKENT(grep, CONFIG_SYS_MAXARGS, 1, do_env_grep, "", ""),
 #endif
 #if defined(CONFIG_CMD_IMPORTENV)
-	U_BOOT_CMD_MKENT(import, 5, 0, do_env_import, "", ""),
+	U_BOOT_CMD_MKENT(import, 7, 0, do_env_import, "", ""),
 #endif
 #if defined(CONFIG_CMD_NVEDIT_INFO)
 	U_BOOT_CMD_MKENT(info, 2, 0, do_env_info, "", ""),
@@ -1310,14 +1482,14 @@ static cmd_tbl_t cmd_env_sub[] = {
 	U_BOOT_CMD_MKENT(run, CONFIG_SYS_MAXARGS, 1, do_run, "", ""),
 #endif
 #if defined(CONFIG_CMD_SAVEENV) && defined(ENV_IS_IN_DEVICE)
-	U_BOOT_CMD_MKENT(save, 1, 0, do_env_save, "", ""),
+	U_BOOT_CMD_MKENT(save, 3, 0, do_env_save, "", ""),
 #if defined(CONFIG_CMD_ERASEENV)
-	U_BOOT_CMD_MKENT(erase, 1, 0, do_env_erase, "", ""),
+	U_BOOT_CMD_MKENT(erase, 3, 0, do_env_erase, "", ""),
 #endif
 #endif
 	U_BOOT_CMD_MKENT(set, CONFIG_SYS_MAXARGS, 0, do_env_set, "", ""),
 #if defined(CONFIG_CMD_ENV_EXISTS)
-	U_BOOT_CMD_MKENT(exists, 2, 0, do_env_exists, "", ""),
+	U_BOOT_CMD_MKENT(exists, 4, 0, do_env_exists, "", ""),
 #endif
 };
 
@@ -1415,7 +1587,7 @@ U_BOOT_CMD(
 
 #if defined(CONFIG_CMD_EDITENV)
 U_BOOT_CMD_COMPLETE(
-	editenv, 2, 0,	do_env_edit,
+	editenv, 4, 0,	do_env_edit,
 	"edit environment variable",
 	"name\n"
 	"    - edit environment variable 'name'",
env/Kconfig +33 -649

700 lines not on this page · raw message

env/Makefile +15 -15
index 90144d6caf34..ee37cc822024 100644
@@ -9,16 +9,16 @@ ifndef CONFIG_SPL_BUILD
 obj-y += attr.o
 obj-y += callback.o
 obj-y += flags.o
-obj-$(CONFIG_ENV_IS_IN_EEPROM) += eeprom.o
+obj-$(CONFIG_ENV_DRV_EEPROM) += eeprom.o
 extra-$(CONFIG_ENV_IS_EMBEDDED) += embedded.o
-obj-$(CONFIG_ENV_IS_IN_EEPROM) += embedded.o
-extra-$(CONFIG_ENV_IS_IN_FLASH) += embedded.o
-obj-$(CONFIG_ENV_IS_IN_NVRAM) += embedded.o
-obj-$(CONFIG_ENV_IS_IN_NVRAM) += nvram.o
-obj-$(CONFIG_ENV_IS_IN_ONENAND) += onenand.o
-obj-$(CONFIG_ENV_IS_IN_SATA) += sata.o
-obj-$(CONFIG_ENV_IS_IN_REMOTE) += remote.o
-obj-$(CONFIG_ENV_IS_IN_UBI) += ubi.o
+obj-$(CONFIG_ENV_DRV_EEPROM) += embedded.o
+extra-$(CONFIG_ENV_DRV_FLASH) += embedded.o
+obj-$(CONFIG_ENV_DRV_NVRAM) += embedded.o
+obj-$(CONFIG_ENV_DRV_NVRAM) += nvram.o
+obj-$(CONFIG_ENV_DRV_ONENAND) += onenand.o
+obj-$(CONFIG_ENV_DRV_SATA) += sata.o
+obj-$(CONFIG_ENV_DRV_REMOTE) += remote.o
+obj-$(CONFIG_ENV_DRV_UBI) += ubi.o
 else
 obj-$(CONFIG_$(SPL_TPL_)ENV_SUPPORT) += attr.o
 obj-$(CONFIG_$(SPL_TPL_)ENV_SUPPORT) += flags.o
@@ -26,11 +26,11 @@ obj-$(CONFIG_$(SPL_TPL_)ENV_SUPPORT) += callback.o
 endif
 
 obj-$(CONFIG_$(SPL_TPL_)ENV_IS_NOWHERE) += nowhere.o
-obj-$(CONFIG_$(SPL_TPL_)ENV_IS_IN_MMC) += mmc.o
-obj-$(CONFIG_$(SPL_TPL_)ENV_IS_IN_FAT) += fat.o
-obj-$(CONFIG_$(SPL_TPL_)ENV_IS_IN_EXT4) += ext4.o
-obj-$(CONFIG_$(SPL_TPL_)ENV_IS_IN_NAND) += nand.o
-obj-$(CONFIG_$(SPL_TPL_)ENV_IS_IN_SPI_FLASH) += sf.o
-obj-$(CONFIG_$(SPL_TPL_)ENV_IS_IN_FLASH) += flash.o
+obj-$(CONFIG_$(SPL_TPL_)ENV_DRV_MMC) += mmc.o
+obj-$(CONFIG_$(SPL_TPL_)ENV_DRV_FAT) += fat.o
+obj-$(CONFIG_$(SPL_TPL_)ENV_DRV_EXT4) += ext4.o
+obj-$(CONFIG_$(SPL_TPL_)ENV_DRV_NAND) += nand.o
+obj-$(CONFIG_$(SPL_TPL_)ENV_DRV_SPI_FLASH) += sf.o
+obj-$(CONFIG_$(SPL_TPL_)ENV_DRV_FLASH) += flash.o
 
 CFLAGS_embedded.o := -Wa,--no-warn -DENV_CRC=$(shell tools/envcrc 2>/dev/null)
env/callback.c +27 -13
index f0904cfdc535..4c7b0103f286 100644
@@ -15,7 +15,8 @@ DECLARE_GLOBAL_DATA_PTR;
 /*
  * Look up a callback function pointer by name
  */
-static struct env_clbk_tbl *find_env_callback(const char *name)
+static struct env_clbk_tbl *find_env_callback(struct env_context *ctx,
+					      const char *name)
 {
 	struct env_clbk_tbl *clbkp;
 	int i;
@@ -28,13 +29,18 @@ static struct env_clbk_tbl *find_env_callback(const char *name)
 	for (i = 0, clbkp = ll_entry_start(struct env_clbk_tbl, env_clbk);
 	     i < num_callbacks;
 	     i++, clbkp++) {
-		if (strcmp(name, clbkp->name) == 0)
+		if (!strcmp(name, clbkp->name))
 			return clbkp;
 	}
 
 	return NULL;
 }
 
+/*
+ * TODO
+ * Should we provide per-context callback list,
+ * either for ".callbacks"(default) or "callbacks"(user defined)?
+ */
 static int first_call = 1;
 static const char *callback_list;
 
@@ -51,7 +57,7 @@ void env_callback_init(struct env_entry *var_entry)
 	int ret = 1;
 
 	if (first_call) {
-		callback_list = env_get(ENV_CALLBACK_VAR);
+		callback_list = env_get(ctx_uboot, ENV_CALLBACK_VAR);
 		first_call = 0;
 	}
 
@@ -66,7 +72,7 @@ void env_callback_init(struct env_entry *var_entry)
 
 	/* if an association was found, set the callback pointer */
 	if (!ret && strlen(callback_name)) {
-		clbkp = find_env_callback(callback_name);
+		clbkp = find_env_callback(var_entry->ctx, callback_name);
 		if (clbkp != NULL)
 #if defined(CONFIG_NEEDS_MANUAL_RELOC)
 			var_entry->callback = clbkp->callback + gd->reloc_off;
@@ -92,13 +98,15 @@ static int clear_callback(struct env_entry *entry)
  */
 static int set_callback(const char *name, const char *value, void *priv)
 {
+	struct env_context *ctx = priv;
 	struct env_entry e, *ep;
 	struct env_clbk_tbl *clbkp;
 
 	e.key	= name;
+	e.ctx	= ctx;
 	e.data	= NULL;
 	e.callback = NULL;
-	hsearch_r(e, ENV_FIND, &ep, &env_htab, 0);
+	hsearch_r(e, ENV_FIND, &ep, ctx->htab, 0);
 
 	/* does the env variable actually exist? */
 	if (ep != NULL) {
@@ -107,7 +115,7 @@ static int set_callback(const char *name, const char *value, void *priv)
 			ep->callback = NULL;
 		else {
 			/* assign the requested callback */
-			clbkp = find_env_callback(value);
+			clbkp = find_env_callback(ctx, value);
 			if (clbkp != NULL)
 #if defined(CONFIG_NEEDS_MANUAL_RELOC)
 				ep->callback = clbkp->callback + gd->reloc_off;
@@ -121,15 +129,21 @@ static int set_callback(const char *name, const char *value, void *priv)
 }
 
 static int on_callbacks(const char *name, const char *value, enum env_op op,
-	int flags)
+			int flags)
 {
-	/* remove all callbacks */
-	hwalk_r(&env_htab, clear_callback);
+	struct env_context *ctx;
+	int i;
 
-	/* configure any static callback bindings */
-	env_attr_walk(ENV_CALLBACK_LIST_STATIC, set_callback, NULL);
-	/* configure any dynamic callback bindings */
-	env_attr_walk(value, set_callback, NULL);
+	for (i = 0, ctx = U_BOOT_ENV_CTX_START; i < U_BOOT_ENV_CTX_COUNT;
+	     i++, ctx++) {
+		/* remove all callbacks */
+		hwalk_r(ctx->htab, clear_callback);
+
+		/* configure any static callback bindings */
+		env_attr_walk(ENV_CALLBACK_LIST_STATIC, set_callback, ctx);
+		/* configure any dynamic callback bindings */
+		env_attr_walk(value, set_callback, ctx);
+	}
 
 	return 0;
 }
env/common.c +146 -109

376 lines not on this page · raw message

env/env.c +104 -54

311 lines not on this page · raw message

env/flags.c +24 -11
index 418d6cc7425a..334bb08c88db 100644
@@ -308,7 +308,7 @@ static inline int env_flags_lookup(const char *flags_list, const char *name,
  */
 enum env_flags_vartype env_flags_get_type(const char *name)
 {
-	const char *flags_list = env_get(ENV_FLAGS_VAR);
+	const char *flags_list = env_get(ctx_uboot, ENV_FLAGS_VAR);
 	char flags[ENV_FLAGS_ATTR_MAX_LEN + 1];
 
 	if (env_flags_lookup(flags_list, name, flags))
@@ -325,7 +325,7 @@ enum env_flags_vartype env_flags_get_type(const char *name)
  */
 enum env_flags_varaccess env_flags_get_varaccess(const char *name)
 {
-	const char *flags_list = env_get(ENV_FLAGS_VAR);
+	const char *flags_list = env_get(ctx_uboot, ENV_FLAGS_VAR);
 	char flags[ENV_FLAGS_ATTR_MAX_LEN + 1];
 
 	if (env_flags_lookup(flags_list, name, flags))
@@ -411,6 +411,11 @@ static int env_parse_flags_to_bin(const char *flags)
 	return binflags;
 }
 
+/*
+ * TODO
+ * Should we provide per-context flags list,
+ * either for ".flags"(default) or "flags"(user defined)?
+ */
 static int first_call = 1;
 static const char *flags_list;
 
@@ -426,7 +431,7 @@ void env_flags_init(struct env_entry *var_entry)
 	int ret = 1;
 
 	if (first_call) {
-		flags_list = env_get(ENV_FLAGS_VAR);
+		flags_list = env_get(ctx_uboot, ENV_FLAGS_VAR);
 		first_call = 0;
 	}
 	/* look in the ".flags" and static for a reference to this variable */
@@ -453,12 +458,14 @@ static int clear_flags(struct env_entry *entry)
  */
 static int set_flags(const char *name, const char *value, void *priv)
 {
+	struct env_context *ctx = priv;
 	struct env_entry e, *ep;
 
 	e.key	= name;
+	e.ctx	= ctx;
 	e.data	= NULL;
 	e.callback = NULL;
-	hsearch_r(e, ENV_FIND, &ep, &env_htab, 0);
+	hsearch_r(e, ENV_FIND, &ep, ctx->htab, 0);
 
 	/* does the env variable actually exist? */
 	if (ep != NULL) {
@@ -476,13 +483,19 @@ static int set_flags(const char *name, const char *value, void *priv)
 static int on_flags(const char *name, const char *value, enum env_op op,
 	int flags)
 {
-	/* remove all flags */
-	hwalk_r(&env_htab, clear_flags);
+	struct env_context *ctx;
+	int i;
 
-	/* configure any static flags */
-	env_attr_walk(ENV_FLAGS_LIST_STATIC, set_flags, NULL);
-	/* configure any dynamic flags */
-	env_attr_walk(value, set_flags, NULL);
+	for (i = 0, ctx = U_BOOT_ENV_CTX_START; i < U_BOOT_ENV_CTX_COUNT;
+	     i++, ctx++) {
+		/* remove all flags */
+		hwalk_r(ctx->htab, clear_flags);
+
+		/* configure any static flags */
+		env_attr_walk(ENV_FLAGS_LIST_STATIC, set_flags, ctx);
+		/* configure any dynamic flags */
+		env_attr_walk(value, set_flags, ctx);
+	}
 
 	return 0;
 }
@@ -541,7 +554,7 @@ int env_flags_validate(const struct env_entry *item, const char *newval,
 			return 1;
 		} else if (item->flags &
 		    ENV_FLAGS_VARACCESS_PREVENT_NONDEF_OVERWR) {
-			const char *defval = env_get_default(name);
+			const char *defval = env_get_default(item->ctx, name);
 
 			if (defval == NULL)
 				defval = "";
include/_exports.h +4 -2
index 0dee05f077a6..8e072668d198 100644
@@ -31,8 +31,10 @@
 	EXPORT_FUNC(vprintf, int, vprintf, const char *, va_list)
 	EXPORT_FUNC(do_reset, int, do_reset, cmd_tbl_t *,
 		    int , int , char * const [])
-	EXPORT_FUNC(env_get, char  *, env_get, const char*)
-	EXPORT_FUNC(env_set, int, env_set, const char *, const char *)
+	EXPORT_FUNC(env_get, char  *, env_get, struct env_context *,
+		    const char*)
+	EXPORT_FUNC(env_set, int, env_set, struct env_context *, const char *,
+		    const char *)
 	EXPORT_FUNC(simple_strtoul, unsigned long, simple_strtoul,
 		    const char *, char **, unsigned int)
 	EXPORT_FUNC(strict_strtoul, int, strict_strtoul,
include/common.h +4 -2
index d8f302ea92f0..cdc0bf7042c2 100644
@@ -46,6 +46,8 @@ typedef volatile unsigned char	vu_char;
 
 #include <log.h>
 
+struct env_context;
+
 typedef void (interrupt_handler_t)(void *);
 
 #include <asm/u-boot.h> /* boot information for Linux kernel */
@@ -340,9 +342,9 @@ int	serial_printf (const char *fmt, ...)
 
 /* lib/net_utils.c */
 #include <net.h>
-static inline struct in_addr env_get_ip(char *var)
+static inline struct in_addr env_get_ip(struct env_context *ctx, char *var)
 {
-	return string_to_ip(env_get(var));
+	return string_to_ip(env_get(ctx, var));
 }
 
 #ifdef CONFIG_LED_STATUS
include/env.h +74 -21

273 lines not on this page · raw message

include/env_internal.h +85 -4

156 lines not on this page · raw message

include/exports.h +3 -2
index 147a00f860b0..60a482de1313 100644
@@ -27,8 +27,9 @@ unsigned long get_timer(unsigned long);
 int vprintf(const char *, va_list);
 unsigned long simple_strtoul(const char *cp, char **endp, unsigned int base);
 int strict_strtoul(const char *cp, unsigned int base, unsigned long *res);
-char *env_get(const char *name);
-int env_set(const char *varname, const char *value);
+struct env_context;
+char *env_get(struct env_context *ctx, const char *name);
+int env_set(struct env_context *ctx, const char *varname, const char *value);
 long simple_strtol(const char *cp, char **endp, unsigned int base);
 int strcmp(const char *cs, const char *ct);
 unsigned long ustrtoul(const char *cp, char **endp, unsigned int base);
Signature · 1 line
2.21.0
#2 lore raw

PATCH v5 2/19 env: define env context for U-Boot environment

In reply to AKASHI Takahiro

In this patch, env context fo U-Boot environment is defined to utilize new env interfaces, maintaining the compatibility with the existing semantics and Kconfig configuration.

In this commit, FAT file system and flash device are only supported devices for backing storages, but extending to other devices will be quite straightforward.

---
 env/Kconfig.uboot   | 671 ++++++++++++++++++++++++++++++++++++++++++++
 env/Makefile        |   2 +-
 env/env_ctx_uboot.c | 292 +++++++++++++++++++
 include/env.h       |   3 +
 4 files changed, 967 insertions(+), 1 deletion(-)
 create mode 100644 env/Kconfig.uboot
 create mode 100644 env/env_ctx_uboot.c
env/Kconfig.uboot new file +671 -0
new file mode 100644
index 000000000000..e4334f7f2878
@@ -0,0 +1,671 @@
+config ENV_IS_NOWHERE
+	bool "U-Boot Environment is not stored"
+	default y if !ENV_IS_IN_EEPROM && !ENV_IS_IN_EXT4 && \
+		     !ENV_IS_IN_FAT && !ENV_IS_IN_FLASH && \
+		     !ENV_IS_IN_MMC && !ENV_IS_IN_NAND && \
+		     !ENV_IS_IN_NVRAM && !ENV_IS_IN_ONENAND && \
+		     !ENV_IS_IN_REMOTE && !ENV_IS_IN_SPI_FLASH && \
+		     !ENV_IS_IN_UBI
+	help
+	  Define this if you don't want to or can't have an environment stored
+	  on a storage medium. In this case the environment will still exist
+	  while U-Boot is running, but once U-Boot exits it will not be
+	  stored. U-Boot will therefore always start up with a default
+	  environment.
+
+config ENV_IS_IN_EEPROM
+	bool "Environment in EEPROM"
+	depends on !CHAIN_OF_TRUST
+	select ENV_DRV_EEPROM
+	help
+	  Use this if you have an EEPROM or similar serial access
+	  device and a driver for it.
+
+	  - CONFIG_ENV_OFFSET:
+	  - CONFIG_ENV_SIZE:
+
+	  These two #defines specify the offset and size of the
+	  environment area within the total memory of your EEPROM.
+
+	  Note that we consider the length of the address field to
+	  still be one byte because the extra address bits are hidden
+	  in the chip address.
+
+	  - CONFIG_ENV_EEPROM_IS_ON_I2C
+	  define this, if you have I2C and SPI activated, and your
+	  EEPROM, which holds the environment, is on the I2C bus.
+
+	  - CONFIG_I2C_ENV_EEPROM_BUS
+	  if you have an Environment on an EEPROM reached over
+	  I2C muxes, you can define here, how to reach this
+	  EEPROM. For example:
+
+	  #define CONFIG_I2C_ENV_EEPROM_BUS	  1
+
+	  EEPROM which holds the environment, is reached over
+	  a pca9547 i2c mux with address 0x70, channel 3.
+
+config ENV_IS_IN_FAT
+	bool "Environment is in a FAT filesystem"
+	depends on !CHAIN_OF_TRUST
+	default y if ARCH_BCM283X
+	default y if ARCH_SUNXI && MMC
+	default y if MMC_OMAP_HS && TI_COMMON_CMD_OPTIONS
+	select ENV_DRV_FAT
+	help
+	  Define this if you want to use the FAT file system for the environment.
+
+config ENV_IS_IN_EXT4
+	bool "Environment is in a EXT4 filesystem"
+	depends on !CHAIN_OF_TRUST
+	select ENV_DRV_EXT4
+	help
+	  Define this if you want to use the EXT4 file system for the environment.
+
+config ENV_IS_IN_FLASH
+	bool "Environment in flash memory"
+	depends on !CHAIN_OF_TRUST
+	select ENV_DRV_FLASH
+	default y if ARCH_CINTEGRATOR
+	default y if ARCH_INTEGRATOR_CP
+	default y if M548x || M547x || M5282 || MCF547x_8x
+	default y if MCF532x || MCF52x2
+	default y if MPC86xx || MPC83xx
+	default y if ARCH_MPC8572 || ARCH_MPC8548 || ARCH_MPC8641
+	default y if SH && !CPU_SH4
+	help
+	  Define this if you have a flash device which you want to use for the
+	  environment.
+
+	  a) The environment occupies one whole flash sector, which is
+	   "embedded" in the text segment with the U-Boot code. This
+	   happens usually with "bottom boot sector" or "top boot
+	   sector" type flash chips, which have several smaller
+	   sectors at the start or the end. For instance, such a
+	   layout can have sector sizes of 8, 2x4, 16, Nx32 kB. In
+	   such a case you would place the environment in one of the
+	   4 kB sectors - with U-Boot code before and after it. With
+	   "top boot sector" type flash chips, you would put the
+	   environment in one of the last sectors, leaving a gap
+	   between U-Boot and the environment.
+
+	  CONFIG_ENV_OFFSET:
+
+	   Offset of environment data (variable area) to the
+	   beginning of flash memory; for instance, with bottom boot
+	   type flash chips the second sector can be used: the offset
+	   for this sector is given here.
+
+	   CONFIG_ENV_OFFSET is used relative to CONFIG_SYS_FLASH_BASE.
+
+	  CONFIG_ENV_ADDR:
+
+	   This is just another way to specify the start address of
+	   the flash sector containing the environment (instead of
+	   CONFIG_ENV_OFFSET).
+
+	  CONFIG_ENV_SECT_SIZE:
+
+	   Size of the sector containing the environment.
+
+
+	  b) Sometimes flash chips have few, equal sized, BIG sectors.
+	   In such a case you don't want to spend a whole sector for
+	   the environment.
+
+	  CONFIG_ENV_SIZE:
+
+	   If you use this in combination with CONFIG_ENV_IS_IN_FLASH
+	   and CONFIG_ENV_SECT_SIZE, you can specify to use only a part
+	   of this flash sector for the environment. This saves
+	   memory for the RAM copy of the environment.
+
+	   It may also save flash memory if you decide to use this
+	   when your environment is "embedded" within U-Boot code,
+	   since then the remainder of the flash sector could be used
+	   for U-Boot code. It should be pointed out that this is
+	   STRONGLY DISCOURAGED from a robustness point of view:
+	   updating the environment in flash makes it always
+	   necessary to erase the WHOLE sector. If something goes
+	   wrong before the contents has been restored from a copy in
+	   RAM, your target system will be dead.
+
+	  CONFIG_ENV_ADDR_REDUND
+	  CONFIG_ENV_SIZE_REDUND
+
+	   These settings describe a second storage area used to hold
+	   a redundant copy of the environment data, so that there is
+	   a valid backup copy in case there is a power failure during
+	   a "saveenv" operation.
+
+	  BE CAREFUL! Any changes to the flash layout, and some changes to the
+	  source code will make it necessary to adapt <board>/u-boot.lds*
+	  accordingly!
+
+config ENV_IS_IN_MMC
+	bool "Environment in an MMC device"
+	depends on !CHAIN_OF_TRUST
+	depends on MMC
+	select ENV_DRV_MMC
+	default y if ARCH_EXYNOS4
+	default y if MX6SX || MX7D
+	default y if TEGRA30 || TEGRA124
+	default y if TEGRA_ARMV8_COMMON
+	help
+	  Define this if you have an MMC device which you want to use for the
+	  environment.
+
+	  CONFIG_SYS_MMC_ENV_DEV:
+
+	  Specifies which MMC device the environment is stored in.
+
+	  CONFIG_SYS_MMC_ENV_PART (optional):
+
+	  Specifies which MMC partition the environment is stored in. If not
+	  set, defaults to partition 0, the user area. Common values might be
+	  1 (first MMC boot partition), 2 (second MMC boot partition).
+
+	  CONFIG_ENV_OFFSET:
+	  CONFIG_ENV_SIZE:
+
+	  These two #defines specify the offset and size of the environment
+	  area within the specified MMC device.
+
+	  If offset is positive (the usual case), it is treated as relative to
+	  the start of the MMC partition. If offset is negative, it is treated
+	  as relative to the end of the MMC partition. This can be useful if
+	  your board may be fitted with different MMC devices, which have
+	  different sizes for the MMC partitions, and you always want the
+	  environment placed at the very end of the partition, to leave the
+	  maximum possible space before it, to store other data.
+
+	  These two values are in units of bytes, but must be aligned to an
+	  MMC sector boundary.
+
+	  CONFIG_ENV_OFFSET_REDUND (optional):
+
+	  Specifies a second storage area, of CONFIG_ENV_SIZE size, used to
+	  hold a redundant copy of the environment data. This provides a
+	  valid backup copy in case the other copy is corrupted, e.g. due
+	  to a power failure during a "saveenv" operation.
+
+	  This value may also be positive or negative; this is handled in the
+	  same way as CONFIG_ENV_OFFSET.
+
+	  This value is also in units of bytes, but must also be aligned to
+	  an MMC sector boundary.
+
+	  CONFIG_ENV_SIZE_REDUND (optional):
+
+	  This value need not be set, even when CONFIG_ENV_OFFSET_REDUND is
+	  set. If this value is set, it must be set to the same value as
+	  CONFIG_ENV_SIZE.
+
+config ENV_IS_IN_NAND
+	bool "Environment in a NAND device"
+	depends on !CHAIN_OF_TRUST
+	select ENV_DRV_NAND
+	help
+	  Define this if you have a NAND device which you want to use for the
+	  environment.
+
+	  - CONFIG_ENV_OFFSET:
+	  - CONFIG_ENV_SIZE:
+
+	  These two #defines specify the offset and size of the environment
+	  area within the first NAND device.  CONFIG_ENV_OFFSET must be
+	  aligned to an erase block boundary.
+
+	  - CONFIG_ENV_OFFSET_REDUND (optional):
+
+	  This setting describes a second storage area of CONFIG_ENV_SIZE
+	  size used to hold a redundant copy of the environment data, so
+	  that there is a valid backup copy in case there is a power failure
+	  during a "saveenv" operation.	 CONFIG_ENV_OFFSET_REDUND must be
+	  aligned to an erase block boundary.
+
+	  - CONFIG_ENV_RANGE (optional):
+
+	  Specifies the length of the region in which the environment
+	  can be written.  This should be a multiple of the NAND device's
+	  block size.  Specifying a range with more erase blocks than
+	  are needed to hold CONFIG_ENV_SIZE allows bad blocks within
+	  the range to be avoided.
+
+	  - CONFIG_ENV_OFFSET_OOB (optional):
+
+	  Enables support for dynamically retrieving the offset of the
+	  environment from block zero's out-of-band data.  The
+	  "nand env.oob" command can be used to record this offset.
+	  Currently, CONFIG_ENV_OFFSET_REDUND is not supported when
+	  using CONFIG_ENV_OFFSET_OOB.
+
+config ENV_IS_IN_NVRAM
+	bool "Environment in a non-volatile RAM"
+	depends on !CHAIN_OF_TRUST
+	select ENV_DRV_NVRAM
+	help
+	  Define this if you have some non-volatile memory device
+	  (NVRAM, battery buffered SRAM) which you want to use for the
+	  environment.
+
+	  - CONFIG_ENV_ADDR:
+	  - CONFIG_ENV_SIZE:
+
+	  These two #defines are used to determine the memory area you
+	  want to use for environment. It is assumed that this memory
+	  can just be read and written to, without any special
+	  provision.
+
+config ENV_IS_IN_ONENAND
+	bool "Environment is in OneNAND"
+	depends on !CHAIN_OF_TRUST
+	select ENV_DRV_ONENAND
+	help
+	  Define this if you want to put your local device's environment in
+	  OneNAND.
+
+	  - CONFIG_ENV_ADDR:
+	  - CONFIG_ENV_SIZE:
+
+	  These two #defines are used to determine the device range you
+	  want to use for environment. It is assumed that this memory
+	  can just be read and written to, without any special
+	  provision.
+
+config ENV_IS_IN_REMOTE
+	bool "Environment is in remote memory space"
+	depends on !CHAIN_OF_TRUST
+	select ENV_DRV_REMOTE
+	help
+	  Define this if you have a remote memory space which you
+	  want to use for the local device's environment.
+
+	  - CONFIG_ENV_ADDR:
+	  - CONFIG_ENV_SIZE:
+
+	  These two #defines specify the address and size of the
+	  environment area within the remote memory space. The
+	  local device can get the environment from remote memory
+	  space by SRIO or PCIE links.
+
+config ENV_IS_IN_SPI_FLASH
+	bool "Environment is in SPI flash"
+	depends on !CHAIN_OF_TRUST && SPI
+	select ENV_DRV_SPI_FLASH
+	default y if ARMADA_XP
+	default y if INTEL_BAYTRAIL
+	default y if INTEL_BRASWELL
+	default y if INTEL_BROADWELL
+	default y if NORTHBRIDGE_INTEL_IVYBRIDGE
+	default y if INTEL_QUARK
+	default y if INTEL_QUEENSBAY
+	help
+	  Define this if you have a SPI Flash memory device which you
+	  want to use for the environment.
+
+	  - CONFIG_ENV_OFFSET:
+	  - CONFIG_ENV_SIZE:
+
+	  These two #defines specify the offset and size of the
+	  environment area within the SPI Flash. CONFIG_ENV_OFFSET must be
+	  aligned to an erase sector boundary.
+
+	  - CONFIG_ENV_SECT_SIZE:
+
+	  Define the SPI flash's sector size.
+
+	  - CONFIG_ENV_OFFSET_REDUND (optional):
+
+	  This setting describes a second storage area of CONFIG_ENV_SIZE
+	  size used to hold a redundant copy of the environment data, so
+	  that there is a valid backup copy in case there is a power failure
+	  during a "saveenv" operation. CONFIG_ENV_OFFSET_REDUND must be
+	  aligned to an erase sector boundary.
+
+config USE_ENV_SPI_BUS
+	bool "SPI flash bus for environment"
+	depends on ENV_IS_IN_SPI_FLASH
+	help
+	  Force the SPI bus for environment.
+	  If not defined, use CONFIG_SF_DEFAULT_BUS.
+
+config ENV_SPI_BUS
+	int "Value of SPI flash bus for environment"
+	depends on USE_ENV_SPI_BUS
+	help
+	  Value the SPI bus and chip select for environment.
+
+config USE_ENV_SPI_CS
+	bool "SPI flash chip select for environment"
+	depends on ENV_IS_IN_SPI_FLASH
+	help
+	  Force the SPI chip select for environment.
+	  If not defined, use CONFIG_SF_DEFAULT_CS.
+
+config ENV_SPI_CS
+	int "Value of SPI flash chip select for environment"
+	depends on USE_ENV_SPI_CS
+	help
+	  Value of the SPI chip select for environment.
+
+config USE_ENV_SPI_MAX_HZ
+	bool "SPI flash max frequency for environment"
+	depends on ENV_IS_IN_SPI_FLASH
+	help
+	  Force the SPI max work clock for environment.
+	  If not defined, use CONFIG_SF_DEFAULT_SPEED.
+
+config ENV_SPI_MAX_HZ
+	int "Value of SPI flash max frequency for environment"
+	depends on USE_ENV_SPI_MAX_HZ
+	help
+	  Value of the SPI max work clock for environment.
+
+config USE_ENV_SPI_MODE
+	bool "SPI flash mode for environment"
+	depends on ENV_IS_IN_SPI_FLASH
+	help
+	  Force the SPI work mode for environment.
+
+config ENV_SPI_MODE
+	hex "Value of SPI flash work mode for environment"
+	depends on USE_ENV_SPI_MODE
+	help
+	  Value of the SPI work mode for environment.
+	  See include/spi.h for value.
+
+config ENV_IS_IN_UBI
+	bool "Environment in a UBI volume"
+	depends on !CHAIN_OF_TRUST
+	select ENV_DRV_UBI
+	help
+	  Define this if you have an UBI volume that you want to use for the
+	  environment.  This has the benefit of wear-leveling the environment
+	  accesses, which is important on NAND.
+
+	  - CONFIG_ENV_UBI_PART:
+
+	  Define this to a string that is the mtd partition containing the UBI.
+
+	  - CONFIG_ENV_UBI_VOLUME:
+
+	  Define this to the name of the volume that you want to store the
+	  environment in.
+
+	  - CONFIG_ENV_UBI_VOLUME_REDUND:
+
+	  Define this to the name of another volume to store a second copy of
+	  the environment in.  This will enable redundant environments in UBI.
+	  It is assumed that both volumes are in the same MTD partition.
+
+config ENV_FAT_INTERFACE
+	string "Name of the block device for the environment"
+	depends on ENV_IS_IN_FAT
+	default "mmc" if ARCH_SUNXI
+	default "mmc" if TI_COMMON_CMD_OPTIONS || ARCH_ZYNQMP || ARCH_AT91
+	help
+	  Define this to a string that is the name of the block device.
+
+config ENV_FAT_DEVICE_AND_PART
+	string "Device and partition for where to store the environment in FAT"
+	depends on ENV_IS_IN_FAT
+	default "0:1" if TI_COMMON_CMD_OPTIONS
+	default "0:auto" if ARCH_ZYNQMP
+	default "0:auto" if ARCH_SUNXI && MMC_SUNXI_SLOT_EXTRA = -1
+	default "1:auto" if ARCH_SUNXI && MMC_SUNXI_SLOT_EXTRA != -1
+	default "0" if ARCH_AT91
+	help
+	  Define this to a string to specify the partition of the device. It can
+	  be as following:
+
+	    "D:P", "D:0", "D", "D:" or "D:auto" (D, P are integers. And P >= 1)
+	       - "D:P": device D partition P. Error occurs if device D has no
+	                partition table.
+	       - "D:0": device D.
+	       - "D" or "D:": device D partition 1 if device D has partition
+	                      table, or the whole device D if has no partition
+	                      table.
+	       - "D:auto": first partition in device D with bootable flag set.
+	                   If none, first valid partition in device D. If no
+	                   partition table then means device D.
+
+config ENV_FAT_FILE
+	string "Name of the FAT file to use for the environment"
+	depends on ENV_IS_IN_FAT
+	default "uboot.env"
+	help
+	  It's a string of the FAT file name. This file use to store the
+	  environment.
+
+config ENV_EXT4_INTERFACE
+	string "Name of the block device for the environment"
+	depends on ENV_IS_IN_EXT4
+	help
+	  Define this to a string that is the name of the block device.
+
+config ENV_EXT4_DEVICE_AND_PART
+	string "Device and partition for where to store the environment in EXT4"
+	depends on ENV_IS_IN_EXT4
+	help
+	  Define this to a string to specify the partition of the device. It can
+	  be as following:
+
+	    "D:P", "D:0", "D", "D:" or "D:auto" (D, P are integers. And P >= 1)
+	       - "D:P": device D partition P. Error occurs if device D has no
+	                partition table.
+	       - "D:0": device D.
+	       - "D" or "D:": device D partition 1 if device D has partition
+	                      table, or the whole device D if has no partition
+	                      table.
+	       - "D:auto": first partition in device D with bootable flag set.
+	                   If none, first valid partition in device D. If no
+	                   partition table then means device D.
+
+config ENV_EXT4_FILE
+	string "Name of the EXT4 file to use for the environment"
+	depends on ENV_IS_IN_EXT4
+	default "uboot.env"
+	help
+	  It's a string of the EXT4 file name. This file use to store the
+	  environment (explicit path to the file)
+
+if ARCH_ROCKCHIP || ARCH_SUNXI || ARCH_ZYNQ || ARCH_ZYNQMP || ARCH_VERSAL || ARC || ARCH_STM32MP || ARCH_OMAP2PLUS || ARCH_AT91
+
+config ENV_OFFSET
+	hex "Environment Offset"
+	depends on (!ENV_IS_IN_UBI && !ENV_IS_NOWHERE) || ARCH_STM32MP
+	default 0x3f8000 if ARCH_ROCKCHIP
+	default 0x88000 if ARCH_SUNXI
+	default 0xE0000 if ARCH_ZYNQ
+	default 0x1E00000 if ARCH_ZYNQMP
+	default 0 if ARC
+	default 0x140000 if ARCH_AT91
+	default 0x260000 if ARCH_OMAP2PLUS
+	help
+	  Offset from the start of the device (or partition)
+
+config ENV_SIZE
+	hex "Environment Size"
+	default 0x40000 if ENV_IS_IN_SPI_FLASH && ARCH_ZYNQMP
+	default 0x20000 if ARCH_SUNXI || ARCH_ZYNQ || ARCH_OMAP2PLUS || ARCH_AT91
+	default 0x8000 if ARCH_ROCKCHIP || ARCH_ZYNQMP || ARCH_VERSAL
+	default 0x4000 if ARC
+	default 0x1f000
+	help
+	  Size of the environment storage area
+
+config ENV_SECT_SIZE
+	hex "Environment Sector-Size"
+	depends on (!ENV_IS_NOWHERE && (ARCH_ZYNQ || ARCH_ZYNQMP || ARCH_OMAP2PLUS || ARCH_AT91) )|| ARCH_STM32MP
+	default 0x40000 if ARCH_ZYNQMP
+	default 0x20000 if ARCH_ZYNQ || ARCH_OMAP2PLUS || ARCH_AT91
+	help
+	  Size of the sector containing the environment.
+
+config ENV_UBI_PART
+	string "UBI partition name"
+	depends on ENV_IS_IN_UBI
+	help
+	  MTD partition containing the UBI device
+
+config ENV_UBI_VOLUME
+	string "UBI volume name"
+	depends on ENV_IS_IN_UBI
+	help
+	  Name of the volume that you want to store the environment in.
+
+config ENV_UBI_VOLUME_REDUND
+	string "UBI redundant volume name"
+	depends on ENV_IS_IN_UBI
+	help
+	  Name of the redundant volume that you want to store the environment in.
+
+config ENV_UBI_VID_OFFSET
+	int "ubi environment VID offset"
+	depends on ENV_IS_IN_UBI
+	default 0
+	help
+	  UBI VID offset for environment. If 0, no custom VID offset is used.
+
+endif
+
+config USE_DEFAULT_ENV_FILE
+	bool "Create default environment from file"
+	help
+	  Normally, the default environment is automatically generated
+	  based on the settings of various CONFIG_* options, as well
+	  as the CONFIG_EXTRA_ENV_SETTINGS. By selecting this option,
+	  you can instead define the entire default environment in an
+	  external file.
+
+config DEFAULT_ENV_FILE
+	string "Path to default environment file"
+	depends on USE_DEFAULT_ENV_FILE
+	help
+	  The path containing the default environment. The format is
+	  the same as accepted by the mkenvimage tool: lines
+	  containing key=value pairs, blank lines and lines beginning
+	  with # are ignored.
+
+config ENV_VARS_UBOOT_RUNTIME_CONFIG
+	bool "Add run-time information to the environment"
+	help
+	  Enable this in order to add variables describing certain
+	  run-time determined information about the hardware to the
+	  environment.  These will be named board_name, board_rev.
+
+if SPL_ENV_SUPPORT
+config SPL_ENV_IS_NOWHERE
+	bool "SPL Environment is not stored"
+	default y if ENV_IS_NOWHERE
+	help
+	  Similar to ENV_IS_NOWHERE, used for SPL environment.
+
+config SPL_ENV_IS_IN_MMC
+	bool "SPL Environment in an MMC device"
+	depends on !SPL_ENV_IS_NOWHERE
+	select ENV_DRV_MMC
+	default y
+	help
+	  Similar to ENV_IS_IN_MMC, used for SPL environment.
+
+config SPL_ENV_IS_IN_FAT
+	bool "SPL Environment is in a FAT filesystem"
+	depends on !SPL_ENV_IS_NOWHERE
+	select ENV_DRV_FAT
+	default y
+	help
+	  Similar to ENV_IS_IN_FAT, used for SPL environment.
+
+config SPL_ENV_IS_IN_EXT4
+	bool "SPL Environment is in a EXT4 filesystem"
+	depends on !SPL_ENV_IS_NOWHERE
+	select ENV_DRV_EXT4
+	default y
+	help
+	  Similar to ENV_IS_IN_EXT4, used for SPL environment.
+
+config SPL_ENV_IS_IN_NAND
+	bool "SPL Environment in a NAND device"
+	depends on !SPL_ENV_IS_NOWHERE
+	select ENV_DRV_NAND
+	default y
+	help
+	  Similar to ENV_IS_IN_NAND, used for SPL environment.
+
+config SPL_ENV_IS_IN_SPI_FLASH
+	bool "SPL Environment is in SPI flash"
+	depends on !SPL_ENV_IS_NOWHERE
+	select ENV_DRV_SPI_FLASH
+	default y
+	help
+	  Similar to ENV_IS_IN_SPI_FLASH, used for SPL environment.
+
+config SPL_ENV_IS_IN_FLASH
+	bool "SPL Environment in flash memory"
+	depends on !SPL_ENV_IS_NOWHERE
+	select ENV_DRV_FLASH
+	default y
+	help
+	  Similar to ENV_IS_IN_FLASH, used for SPL environment.
+
+endif
+
+if TPL_ENV_SUPPORT
+
+config TPL_ENV_IS_NOWHERE
+	bool "TPL Environment is not stored"
+	default y if ENV_IS_NOWHERE
+	help
+	  Similar to ENV_IS_NOWHERE, used for TPL environment.
+
+config TPL_ENV_IS_IN_MMC
+	bool "TPL Environment in an MMC device"
+	depends on !TPL_ENV_IS_NOWHERE
+	select ENV_DRV_MMC
+	default y
+	help
+	  Similar to ENV_IS_IN_MMC, used for TPL environment.
+
+config TPL_ENV_IS_IN_FAT
+	bool "TPL Environment is in a FAT filesystem"
+	depends on !TPL_ENV_IS_NOWHERE
+	select ENV_DRV_FAT
+	default y
+	help
+	  Similar to ENV_IS_IN_FAT, used for TPL environment.
+
+config TPL_ENV_IS_IN_EXT4
+	bool "TPL Environment is in a EXT4 filesystem"
+	depends on !TPL_ENV_IS_NOWHERE
+	select ENV_DRV_EXT4
+	default y
+	help
+	  Similar to ENV_IS_IN_EXT4, used for TPL environment.
+
+config TPL_ENV_IS_IN_NAND
+	bool "TPL Environment in a NAND device"
+	depends on !TPL_ENV_IS_NOWHERE
+	select ENV_DRV_NAND
+	default y
+	help
+	  Similar to ENV_IS_IN_NAND, used for TPL environment.
+
+config TPL_ENV_IS_IN_SPI_FLASH
+	bool "TPL Environment is in SPI flash"
+	depends on !TPL_ENV_IS_NOWHERE
+	select ENV_DRV_SPI_FLASH
+	default y
+	help
+	  Similar to ENV_IS_IN_SPI_FLASH, used for TPL environment.
+
+config TPL_ENV_IS_IN_FLASH
+	bool "TPL Environment in flash memory"
+	depends on !TPL_ENV_IS_NOWHERE
+	select ENV_DRV_FLASH
+	default y
+	help
+	  Similar to ENV_IS_IN_FLASH, used for TPL environment.
+
+endif
env/Makefile +1 -1
index ee37cc822024..0168eb47f00d 100644
@@ -3,7 +3,7 @@
 # (C) Copyright 2004-2006
 # Wolfgang Denk, DENX Software Engineering, wd at denx.de.
 
-obj-y += common.o env.o
+obj-y += common.o env.o env_ctx_uboot.o
 
 ifndef CONFIG_SPL_BUILD
 obj-y += attr.o
env/env_ctx_uboot.c new file +292 -0

292 lines not on this page · raw message

include/env.h +3 -0
index 203605e5e778..26abae2a5c42 100644
@@ -9,6 +9,7 @@
 #ifndef __ENV_H
 #define __ENV_H
 
+#include <linker_lists.h>
 #include <stdbool.h>
 #include <linux/types.h>
 
@@ -63,6 +64,8 @@ enum env_redund_flags {
 	ENV_REDUND_ACTIVE = 1,
 };
 
+#define ctx_uboot ll_entry_get(struct env_context, uboot, env_contexts)
+
 /* Accessor functions */
 void env_set_ready(struct env_context *ctx);
 bool env_is_ready(struct env_context *ctx);
Signature · 1 line
2.21.0
#3 lore raw

PATCH v5 2/19 env: define env context for U-Boot environment

env/Kconfig.uboot

Quoted 24 lines · AKASHI Takahiro

In this patch, env context fo U-Boot environment is defined to utilize new env interfaces, maintaining the compatibility with the existing semantics and Kconfig configuration.

In this commit, FAT file system and flash device are only supported devices for backing storages, but extending to other devices will be quite straightforward.

---
  env/Kconfig.uboot   | 671 ++++++++++++++++++++++++++++++++++++++++++++
  env/Makefile        |   2 +-
  env/env_ctx_uboot.c | 292 +++++++++++++++++++
  include/env.h       |   3 +
  4 files changed, 967 insertions(+), 1 deletion(-)

create mode 100644 env/Kconfig.uboot
create mode 100644 env/env_ctx_uboot.c

env/Kconfig.uboot new file +0 -0
new file mode 100644
index 000000000000..e4334f7f2878
@@ -0,0 +1,671 @@

Only one of the options below should be selected. So, please, use a 'choice' statement. drives/video/Kconfig has an example.

Quoted 995 lines
env/Kconfig.uboot new file +671 -0
+config ENV_IS_NOWHERE
+	bool "U-Boot Environment is not stored"
+	default y if !ENV_IS_IN_EEPROM && !ENV_IS_IN_EXT4 && \
+		     !ENV_IS_IN_FAT && !ENV_IS_IN_FLASH && \
+		     !ENV_IS_IN_MMC && !ENV_IS_IN_NAND && \
+		     !ENV_IS_IN_NVRAM && !ENV_IS_IN_ONENAND && \
+		     !ENV_IS_IN_REMOTE && !ENV_IS_IN_SPI_FLASH && \
+		     !ENV_IS_IN_UBI
+	help
+	  Define this if you don't want to or can't have an environment stored
+	  on a storage medium. In this case the environment will still exist
+	  while U-Boot is running, but once U-Boot exits it will not be
+	  stored. U-Boot will therefore always start up with a default
+	  environment.
+
+config ENV_IS_IN_EEPROM
+	bool "Environment in EEPROM"
+	depends on !CHAIN_OF_TRUST
+	select ENV_DRV_EEPROM
+	help
+	  Use this if you have an EEPROM or similar serial access
+	  device and a driver for it.
+
+	  - CONFIG_ENV_OFFSET:
+	  - CONFIG_ENV_SIZE:
+
+	  These two #defines specify the offset and size of the
+	  environment area within the total memory of your EEPROM.
+
+	  Note that we consider the length of the address field to
+	  still be one byte because the extra address bits are hidden
+	  in the chip address.
+
+	  - CONFIG_ENV_EEPROM_IS_ON_I2C
+	  define this, if you have I2C and SPI activated, and your
+	  EEPROM, which holds the environment, is on the I2C bus.
+
+	  - CONFIG_I2C_ENV_EEPROM_BUS
+	  if you have an Environment on an EEPROM reached over
+	  I2C muxes, you can define here, how to reach this
+	  EEPROM. For example:
+
+	  #define CONFIG_I2C_ENV_EEPROM_BUS	  1
+
+	  EEPROM which holds the environment, is reached over
+	  a pca9547 i2c mux with address 0x70, channel 3.
+
+config ENV_IS_IN_FAT
+	bool "Environment is in a FAT filesystem"
+	depends on !CHAIN_OF_TRUST
+	default y if ARCH_BCM283X
+	default y if ARCH_SUNXI && MMC
+	default y if MMC_OMAP_HS && TI_COMMON_CMD_OPTIONS
+	select ENV_DRV_FAT
+	help
+	  Define this if you want to use the FAT file system for the environment.
+
+config ENV_IS_IN_EXT4
+	bool "Environment is in a EXT4 filesystem"
+	depends on !CHAIN_OF_TRUST
+	select ENV_DRV_EXT4
+	help
+	  Define this if you want to use the EXT4 file system for the environment.
+
+config ENV_IS_IN_FLASH
+	bool "Environment in flash memory"
+	depends on !CHAIN_OF_TRUST
+	select ENV_DRV_FLASH
+	default y if ARCH_CINTEGRATOR
+	default y if ARCH_INTEGRATOR_CP
+	default y if M548x || M547x || M5282 || MCF547x_8x
+	default y if MCF532x || MCF52x2
+	default y if MPC86xx || MPC83xx
+	default y if ARCH_MPC8572 || ARCH_MPC8548 || ARCH_MPC8641
+	default y if SH && !CPU_SH4
+	help
+	  Define this if you have a flash device which you want to use for the
+	  environment.
+
+	  a) The environment occupies one whole flash sector, which is
+	   "embedded" in the text segment with the U-Boot code. This
+	   happens usually with "bottom boot sector" or "top boot
+	   sector" type flash chips, which have several smaller
+	   sectors at the start or the end. For instance, such a
+	   layout can have sector sizes of 8, 2x4, 16, Nx32 kB. In
+	   such a case you would place the environment in one of the
+	   4 kB sectors - with U-Boot code before and after it. With
+	   "top boot sector" type flash chips, you would put the
+	   environment in one of the last sectors, leaving a gap
+	   between U-Boot and the environment.
+
+	  CONFIG_ENV_OFFSET:
+
+	   Offset of environment data (variable area) to the
+	   beginning of flash memory; for instance, with bottom boot
+	   type flash chips the second sector can be used: the offset
+	   for this sector is given here.
+
+	   CONFIG_ENV_OFFSET is used relative to CONFIG_SYS_FLASH_BASE.
+
+	  CONFIG_ENV_ADDR:
+
+	   This is just another way to specify the start address of
+	   the flash sector containing the environment (instead of
+	   CONFIG_ENV_OFFSET).
+
+	  CONFIG_ENV_SECT_SIZE:
+
+	   Size of the sector containing the environment.
+
+
+	  b) Sometimes flash chips have few, equal sized, BIG sectors.
+	   In such a case you don't want to spend a whole sector for
+	   the environment.
+
+	  CONFIG_ENV_SIZE:
+
+	   If you use this in combination with CONFIG_ENV_IS_IN_FLASH
+	   and CONFIG_ENV_SECT_SIZE, you can specify to use only a part
+	   of this flash sector for the environment. This saves
+	   memory for the RAM copy of the environment.
+
+	   It may also save flash memory if you decide to use this
+	   when your environment is "embedded" within U-Boot code,
+	   since then the remainder of the flash sector could be used
+	   for U-Boot code. It should be pointed out that this is
+	   STRONGLY DISCOURAGED from a robustness point of view:
+	   updating the environment in flash makes it always
+	   necessary to erase the WHOLE sector. If something goes
+	   wrong before the contents has been restored from a copy in
+	   RAM, your target system will be dead.
+
+	  CONFIG_ENV_ADDR_REDUND
+	  CONFIG_ENV_SIZE_REDUND
+
+	   These settings describe a second storage area used to hold
+	   a redundant copy of the environment data, so that there is
+	   a valid backup copy in case there is a power failure during
+	   a "saveenv" operation.
+
+	  BE CAREFUL! Any changes to the flash layout, and some changes to the
+	  source code will make it necessary to adapt <board>/u-boot.lds*
+	  accordingly!
+
+config ENV_IS_IN_MMC
+	bool "Environment in an MMC device"
+	depends on !CHAIN_OF_TRUST
+	depends on MMC
+	select ENV_DRV_MMC
+	default y if ARCH_EXYNOS4
+	default y if MX6SX || MX7D
+	default y if TEGRA30 || TEGRA124
+	default y if TEGRA_ARMV8_COMMON
+	help
+	  Define this if you have an MMC device which you want to use for the
+	  environment.
+
+	  CONFIG_SYS_MMC_ENV_DEV:
+
+	  Specifies which MMC device the environment is stored in.
+
+	  CONFIG_SYS_MMC_ENV_PART (optional):
+
+	  Specifies which MMC partition the environment is stored in. If not
+	  set, defaults to partition 0, the user area. Common values might be
+	  1 (first MMC boot partition), 2 (second MMC boot partition).
+
+	  CONFIG_ENV_OFFSET:
+	  CONFIG_ENV_SIZE:
+
+	  These two #defines specify the offset and size of the environment
+	  area within the specified MMC device.
+
+	  If offset is positive (the usual case), it is treated as relative to
+	  the start of the MMC partition. If offset is negative, it is treated
+	  as relative to the end of the MMC partition. This can be useful if
+	  your board may be fitted with different MMC devices, which have
+	  different sizes for the MMC partitions, and you always want the
+	  environment placed at the very end of the partition, to leave the
+	  maximum possible space before it, to store other data.
+
+	  These two values are in units of bytes, but must be aligned to an
+	  MMC sector boundary.
+
+	  CONFIG_ENV_OFFSET_REDUND (optional):
+
+	  Specifies a second storage area, of CONFIG_ENV_SIZE size, used to
+	  hold a redundant copy of the environment data. This provides a
+	  valid backup copy in case the other copy is corrupted, e.g. due
+	  to a power failure during a "saveenv" operation.
+
+	  This value may also be positive or negative; this is handled in the
+	  same way as CONFIG_ENV_OFFSET.
+
+	  This value is also in units of bytes, but must also be aligned to
+	  an MMC sector boundary.
+
+	  CONFIG_ENV_SIZE_REDUND (optional):
+
+	  This value need not be set, even when CONFIG_ENV_OFFSET_REDUND is
+	  set. If this value is set, it must be set to the same value as
+	  CONFIG_ENV_SIZE.
+
+config ENV_IS_IN_NAND
+	bool "Environment in a NAND device"
+	depends on !CHAIN_OF_TRUST
+	select ENV_DRV_NAND
+	help
+	  Define this if you have a NAND device which you want to use for the
+	  environment.
+
+	  - CONFIG_ENV_OFFSET:
+	  - CONFIG_ENV_SIZE:
+
+	  These two #defines specify the offset and size of the environment
+	  area within the first NAND device.  CONFIG_ENV_OFFSET must be
+	  aligned to an erase block boundary.
+
+	  - CONFIG_ENV_OFFSET_REDUND (optional):
+
+	  This setting describes a second storage area of CONFIG_ENV_SIZE
+	  size used to hold a redundant copy of the environment data, so
+	  that there is a valid backup copy in case there is a power failure
+	  during a "saveenv" operation.	 CONFIG_ENV_OFFSET_REDUND must be
+	  aligned to an erase block boundary.
+
+	  - CONFIG_ENV_RANGE (optional):
+
+	  Specifies the length of the region in which the environment
+	  can be written.  This should be a multiple of the NAND device's
+	  block size.  Specifying a range with more erase blocks than
+	  are needed to hold CONFIG_ENV_SIZE allows bad blocks within
+	  the range to be avoided.
+
+	  - CONFIG_ENV_OFFSET_OOB (optional):
+
+	  Enables support for dynamically retrieving the offset of the
+	  environment from block zero's out-of-band data.  The
+	  "nand env.oob" command can be used to record this offset.
+	  Currently, CONFIG_ENV_OFFSET_REDUND is not supported when
+	  using CONFIG_ENV_OFFSET_OOB.
+
+config ENV_IS_IN_NVRAM
+	bool "Environment in a non-volatile RAM"
+	depends on !CHAIN_OF_TRUST
+	select ENV_DRV_NVRAM
+	help
+	  Define this if you have some non-volatile memory device
+	  (NVRAM, battery buffered SRAM) which you want to use for the
+	  environment.
+
+	  - CONFIG_ENV_ADDR:
+	  - CONFIG_ENV_SIZE:
+
+	  These two #defines are used to determine the memory area you
+	  want to use for environment. It is assumed that this memory
+	  can just be read and written to, without any special
+	  provision.
+
+config ENV_IS_IN_ONENAND
+	bool "Environment is in OneNAND"
+	depends on !CHAIN_OF_TRUST
+	select ENV_DRV_ONENAND
+	help
+	  Define this if you want to put your local device's environment in
+	  OneNAND.
+
+	  - CONFIG_ENV_ADDR:
+	  - CONFIG_ENV_SIZE:
+
+	  These two #defines are used to determine the device range you
+	  want to use for environment. It is assumed that this memory
+	  can just be read and written to, without any special
+	  provision.
+
+config ENV_IS_IN_REMOTE
+	bool "Environment is in remote memory space"
+	depends on !CHAIN_OF_TRUST
+	select ENV_DRV_REMOTE
+	help
+	  Define this if you have a remote memory space which you
+	  want to use for the local device's environment.
+
+	  - CONFIG_ENV_ADDR:
+	  - CONFIG_ENV_SIZE:
+
+	  These two #defines specify the address and size of the
+	  environment area within the remote memory space. The
+	  local device can get the environment from remote memory
+	  space by SRIO or PCIE links.
+
+config ENV_IS_IN_SPI_FLASH
+	bool "Environment is in SPI flash"
+	depends on !CHAIN_OF_TRUST && SPI
+	select ENV_DRV_SPI_FLASH
+	default y if ARMADA_XP
+	default y if INTEL_BAYTRAIL
+	default y if INTEL_BRASWELL
+	default y if INTEL_BROADWELL
+	default y if NORTHBRIDGE_INTEL_IVYBRIDGE
+	default y if INTEL_QUARK
+	default y if INTEL_QUEENSBAY
+	help
+	  Define this if you have a SPI Flash memory device which you
+	  want to use for the environment.
+
+	  - CONFIG_ENV_OFFSET:
+	  - CONFIG_ENV_SIZE:
+
+	  These two #defines specify the offset and size of the
+	  environment area within the SPI Flash. CONFIG_ENV_OFFSET must be
+	  aligned to an erase sector boundary.
+
+	  - CONFIG_ENV_SECT_SIZE:
+
+	  Define the SPI flash's sector size.
+
+	  - CONFIG_ENV_OFFSET_REDUND (optional):
+
+	  This setting describes a second storage area of CONFIG_ENV_SIZE
+	  size used to hold a redundant copy of the environment data, so
+	  that there is a valid backup copy in case there is a power failure
+	  during a "saveenv" operation. CONFIG_ENV_OFFSET_REDUND must be
+	  aligned to an erase sector boundary.
+
+config USE_ENV_SPI_BUS
+	bool "SPI flash bus for environment"
+	depends on ENV_IS_IN_SPI_FLASH
+	help
+	  Force the SPI bus for environment.
+	  If not defined, use CONFIG_SF_DEFAULT_BUS.
+
+config ENV_SPI_BUS
+	int "Value of SPI flash bus for environment"
+	depends on USE_ENV_SPI_BUS
+	help
+	  Value the SPI bus and chip select for environment.
+
+config USE_ENV_SPI_CS
+	bool "SPI flash chip select for environment"
+	depends on ENV_IS_IN_SPI_FLASH
+	help
+	  Force the SPI chip select for environment.
+	  If not defined, use CONFIG_SF_DEFAULT_CS.
+
+config ENV_SPI_CS
+	int "Value of SPI flash chip select for environment"
+	depends on USE_ENV_SPI_CS
+	help
+	  Value of the SPI chip select for environment.
+
+config USE_ENV_SPI_MAX_HZ
+	bool "SPI flash max frequency for environment"
+	depends on ENV_IS_IN_SPI_FLASH
+	help
+	  Force the SPI max work clock for environment.
+	  If not defined, use CONFIG_SF_DEFAULT_SPEED.
+
+config ENV_SPI_MAX_HZ
+	int "Value of SPI flash max frequency for environment"
+	depends on USE_ENV_SPI_MAX_HZ
+	help
+	  Value of the SPI max work clock for environment.
+
+config USE_ENV_SPI_MODE
+	bool "SPI flash mode for environment"
+	depends on ENV_IS_IN_SPI_FLASH
+	help
+	  Force the SPI work mode for environment.
+
+config ENV_SPI_MODE
+	hex "Value of SPI flash work mode for environment"
+	depends on USE_ENV_SPI_MODE
+	help
+	  Value of the SPI work mode for environment.
+	  See include/spi.h for value.
+
+config ENV_IS_IN_UBI
+	bool "Environment in a UBI volume"
+	depends on !CHAIN_OF_TRUST
+	select ENV_DRV_UBI
+	help
+	  Define this if you have an UBI volume that you want to use for the
+	  environment.  This has the benefit of wear-leveling the environment
+	  accesses, which is important on NAND.
+
+	  - CONFIG_ENV_UBI_PART:
+
+	  Define this to a string that is the mtd partition containing the UBI.
+
+	  - CONFIG_ENV_UBI_VOLUME:
+
+	  Define this to the name of the volume that you want to store the
+	  environment in.
+
+	  - CONFIG_ENV_UBI_VOLUME_REDUND:
+
+	  Define this to the name of another volume to store a second copy of
+	  the environment in.  This will enable redundant environments in UBI.
+	  It is assumed that both volumes are in the same MTD partition.
+
+config ENV_FAT_INTERFACE
+	string "Name of the block device for the environment"
+	depends on ENV_IS_IN_FAT
+	default "mmc" if ARCH_SUNXI
+	default "mmc" if TI_COMMON_CMD_OPTIONS || ARCH_ZYNQMP || ARCH_AT91
+	help
+	  Define this to a string that is the name of the block device.
+
+config ENV_FAT_DEVICE_AND_PART
+	string "Device and partition for where to store the environment in FAT"
+	depends on ENV_IS_IN_FAT
+	default "0:1" if TI_COMMON_CMD_OPTIONS
+	default "0:auto" if ARCH_ZYNQMP
+	default "0:auto" if ARCH_SUNXI && MMC_SUNXI_SLOT_EXTRA = -1
+	default "1:auto" if ARCH_SUNXI && MMC_SUNXI_SLOT_EXTRA != -1
+	default "0" if ARCH_AT91
+	help
+	  Define this to a string to specify the partition of the device. It can
+	  be as following:
+
+	    "D:P", "D:0", "D", "D:" or "D:auto" (D, P are integers. And P >= 1)
+	       - "D:P": device D partition P. Error occurs if device D has no
+	                partition table.
+	       - "D:0": device D.
+	       - "D" or "D:": device D partition 1 if device D has partition
+	                      table, or the whole device D if has no partition
+	                      table.
+	       - "D:auto": first partition in device D with bootable flag set.
+	                   If none, first valid partition in device D. If no
+	                   partition table then means device D.
+
+config ENV_FAT_FILE
+	string "Name of the FAT file to use for the environment"
+	depends on ENV_IS_IN_FAT
+	default "uboot.env"
+	help
+	  It's a string of the FAT file name. This file use to store the
+	  environment.
+
+config ENV_EXT4_INTERFACE
+	string "Name of the block device for the environment"
+	depends on ENV_IS_IN_EXT4
+	help
+	  Define this to a string that is the name of the block device.
+
+config ENV_EXT4_DEVICE_AND_PART
+	string "Device and partition for where to store the environment in EXT4"
+	depends on ENV_IS_IN_EXT4
+	help
+	  Define this to a string to specify the partition of the device. It can
+	  be as following:
+
+	    "D:P", "D:0", "D", "D:" or "D:auto" (D, P are integers. And P >= 1)
+	       - "D:P": device D partition P. Error occurs if device D has no
+	                partition table.
+	       - "D:0": device D.
+	       - "D" or "D:": device D partition 1 if device D has partition
+	                      table, or the whole device D if has no partition
+	                      table.
+	       - "D:auto": first partition in device D with bootable flag set.
+	                   If none, first valid partition in device D. If no
+	                   partition table then means device D.
+
+config ENV_EXT4_FILE
+	string "Name of the EXT4 file to use for the environment"
+	depends on ENV_IS_IN_EXT4
+	default "uboot.env"
+	help
+	  It's a string of the EXT4 file name. This file use to store the
+	  environment (explicit path to the file)
+
+if ARCH_ROCKCHIP || ARCH_SUNXI || ARCH_ZYNQ || ARCH_ZYNQMP || ARCH_VERSAL || ARC || ARCH_STM32MP || ARCH_OMAP2PLUS || ARCH_AT91
+
+config ENV_OFFSET
+	hex "Environment Offset"
+	depends on (!ENV_IS_IN_UBI && !ENV_IS_NOWHERE) || ARCH_STM32MP
+	default 0x3f8000 if ARCH_ROCKCHIP
+	default 0x88000 if ARCH_SUNXI
+	default 0xE0000 if ARCH_ZYNQ
+	default 0x1E00000 if ARCH_ZYNQMP
+	default 0 if ARC
+	default 0x140000 if ARCH_AT91
+	default 0x260000 if ARCH_OMAP2PLUS
+	help
+	  Offset from the start of the device (or partition)
+
+config ENV_SIZE
+	hex "Environment Size"
+	default 0x40000 if ENV_IS_IN_SPI_FLASH && ARCH_ZYNQMP
+	default 0x20000 if ARCH_SUNXI || ARCH_ZYNQ || ARCH_OMAP2PLUS || ARCH_AT91
+	default 0x8000 if ARCH_ROCKCHIP || ARCH_ZYNQMP || ARCH_VERSAL
+	default 0x4000 if ARC
+	default 0x1f000
+	help
+	  Size of the environment storage area
+
+config ENV_SECT_SIZE
+	hex "Environment Sector-Size"
+	depends on (!ENV_IS_NOWHERE && (ARCH_ZYNQ || ARCH_ZYNQMP || ARCH_OMAP2PLUS || ARCH_AT91) )|| ARCH_STM32MP
+	default 0x40000 if ARCH_ZYNQMP
+	default 0x20000 if ARCH_ZYNQ || ARCH_OMAP2PLUS || ARCH_AT91
+	help
+	  Size of the sector containing the environment.
+
+config ENV_UBI_PART
+	string "UBI partition name"
+	depends on ENV_IS_IN_UBI
+	help
+	  MTD partition containing the UBI device
+
+config ENV_UBI_VOLUME
+	string "UBI volume name"
+	depends on ENV_IS_IN_UBI
+	help
+	  Name of the volume that you want to store the environment in.
+
+config ENV_UBI_VOLUME_REDUND
+	string "UBI redundant volume name"
+	depends on ENV_IS_IN_UBI
+	help
+	  Name of the redundant volume that you want to store the environment in.
+
+config ENV_UBI_VID_OFFSET
+	int "ubi environment VID offset"
+	depends on ENV_IS_IN_UBI
+	default 0
+	help
+	  UBI VID offset for environment. If 0, no custom VID offset is used.
+
+endif
+
+config USE_DEFAULT_ENV_FILE
+	bool "Create default environment from file"
+	help
+	  Normally, the default environment is automatically generated
+	  based on the settings of various CONFIG_* options, as well
+	  as the CONFIG_EXTRA_ENV_SETTINGS. By selecting this option,
+	  you can instead define the entire default environment in an
+	  external file.
+
+config DEFAULT_ENV_FILE
+	string "Path to default environment file"
+	depends on USE_DEFAULT_ENV_FILE
+	help
+	  The path containing the default environment. The format is
+	  the same as accepted by the mkenvimage tool: lines
+	  containing key=value pairs, blank lines and lines beginning
+	  with # are ignored.
+
+config ENV_VARS_UBOOT_RUNTIME_CONFIG
+	bool "Add run-time information to the environment"
+	help
+	  Enable this in order to add variables describing certain
+	  run-time determined information about the hardware to the
+	  environment.  These will be named board_name, board_rev.
+
+if SPL_ENV_SUPPORT
+config SPL_ENV_IS_NOWHERE
+	bool "SPL Environment is not stored"
+	default y if ENV_IS_NOWHERE
+	help
+	  Similar to ENV_IS_NOWHERE, used for SPL environment.
+
+config SPL_ENV_IS_IN_MMC
+	bool "SPL Environment in an MMC device"
+	depends on !SPL_ENV_IS_NOWHERE
+	select ENV_DRV_MMC
+	default y
+	help
+	  Similar to ENV_IS_IN_MMC, used for SPL environment.
+
+config SPL_ENV_IS_IN_FAT
+	bool "SPL Environment is in a FAT filesystem"
+	depends on !SPL_ENV_IS_NOWHERE
+	select ENV_DRV_FAT
+	default y
+	help
+	  Similar to ENV_IS_IN_FAT, used for SPL environment.
+
+config SPL_ENV_IS_IN_EXT4
+	bool "SPL Environment is in a EXT4 filesystem"
+	depends on !SPL_ENV_IS_NOWHERE
+	select ENV_DRV_EXT4
+	default y
+	help
+	  Similar to ENV_IS_IN_EXT4, used for SPL environment.
+
+config SPL_ENV_IS_IN_NAND
+	bool "SPL Environment in a NAND device"
+	depends on !SPL_ENV_IS_NOWHERE
+	select ENV_DRV_NAND
+	default y
+	help
+	  Similar to ENV_IS_IN_NAND, used for SPL environment.
+
+config SPL_ENV_IS_IN_SPI_FLASH
+	bool "SPL Environment is in SPI flash"
+	depends on !SPL_ENV_IS_NOWHERE
+	select ENV_DRV_SPI_FLASH
+	default y
+	help
+	  Similar to ENV_IS_IN_SPI_FLASH, used for SPL environment.
+
+config SPL_ENV_IS_IN_FLASH
+	bool "SPL Environment in flash memory"
+	depends on !SPL_ENV_IS_NOWHERE
+	select ENV_DRV_FLASH
+	default y
+	help
+	  Similar to ENV_IS_IN_FLASH, used for SPL environment.
+
+endif
+
+if TPL_ENV_SUPPORT
+
+config TPL_ENV_IS_NOWHERE
+	bool "TPL Environment is not stored"
+	default y if ENV_IS_NOWHERE
+	help
+	  Similar to ENV_IS_NOWHERE, used for TPL environment.
+
+config TPL_ENV_IS_IN_MMC
+	bool "TPL Environment in an MMC device"
+	depends on !TPL_ENV_IS_NOWHERE
+	select ENV_DRV_MMC
+	default y
+	help
+	  Similar to ENV_IS_IN_MMC, used for TPL environment.
+
+config TPL_ENV_IS_IN_FAT
+	bool "TPL Environment is in a FAT filesystem"
+	depends on !TPL_ENV_IS_NOWHERE
+	select ENV_DRV_FAT
+	default y
+	help
+	  Similar to ENV_IS_IN_FAT, used for TPL environment.
+
+config TPL_ENV_IS_IN_EXT4
+	bool "TPL Environment is in a EXT4 filesystem"
+	depends on !TPL_ENV_IS_NOWHERE
+	select ENV_DRV_EXT4
+	default y
+	help
+	  Similar to ENV_IS_IN_EXT4, used for TPL environment.
+
+config TPL_ENV_IS_IN_NAND
+	bool "TPL Environment in a NAND device"
+	depends on !TPL_ENV_IS_NOWHERE
+	select ENV_DRV_NAND
+	default y
+	help
+	  Similar to ENV_IS_IN_NAND, used for TPL environment.
+
+config TPL_ENV_IS_IN_SPI_FLASH
+	bool "TPL Environment is in SPI flash"
+	depends on !TPL_ENV_IS_NOWHERE
+	select ENV_DRV_SPI_FLASH
+	default y
+	help
+	  Similar to ENV_IS_IN_SPI_FLASH, used for TPL environment.
+
+config TPL_ENV_IS_IN_FLASH
+	bool "TPL Environment in flash memory"
+	depends on !TPL_ENV_IS_NOWHERE
+	select ENV_DRV_FLASH
+	default y
+	help
+	  Similar to ENV_IS_IN_FLASH, used for TPL environment.
+
+endif
env/Makefile +1 -1
index ee37cc822024..0168eb47f00d 100644
@@ -3,7 +3,7 @@
  # (C) Copyright 2004-2006
  # Wolfgang Denk, DENX Software Engineering, wd at denx.de.
 
-obj-y += common.o env.o
+obj-y += common.o env.o env_ctx_uboot.o
 
  ifndef CONFIG_SPL_BUILD
  obj-y += attr.o
env/env_ctx_uboot.c new file +292 -0
new file mode 100644
index 000000000000..5ca645599347
@@ -0,0 +1,292 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2019 Linaro Limited
+ *		Author: AKASHI Takahiro
+ */
+
+#include <common.h>
+#include <env_default.h>
+#include <env_flags.h>
+#include <env_internal.h>
+#include <search.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+#if !defined(ENV_IS_IN_DEVICE) && !defined(CONFIG_ENV_IS_NOWHERE)
+# error Define one of CONFIG_ENV_IS_IN_{EEPROM|FLASH|MMC|FAT|EXT4|\
+NAND|NVRAM|ONENAND|SATA|SPI_FLASH|REMOTE|UBI} or CONFIG_ENV_IS_NOWHERE
+#endif
+
+struct hsearch_data env_htab = {
+#if CONFIG_IS_ENABLED(ENV_SUPPORT)
+	/* defined in flags.c, only compile with ENV_SUPPORT */
+	.change_ok = env_flags_validate,
+#endif
+};
+
+/*
+ * NOTE: extracted from env/env.c
+ */
+static bool env_has_inited_uboot(struct env_context *ctx,
+				 enum env_location location)
+{
+	return gd->env_has_init & BIT(location);
+}
+
+static void env_set_inited_uboot(struct env_context *ctx,
+				 enum env_location location)
+{
+	gd->env_has_init |= BIT(location);
+}
+
+static int env_get_load_prio_uboot(struct env_context *ctx)
+{
+	return gd->env_load_prio;
+}
+
+static enum env_location env_get_location_uboot(struct env_context *ctx,
+						enum env_operation op, int prio)
+{
+	gd->env_load_prio = prio;
+
+	return env_locations[prio];
+}
+
+int env_get_char_default_uboot(struct env_context *ctx, int index)
+{
+	return default_environment[index];
+}
+
+int env_get_char_spec_uboot(struct env_context *ctx, int index)
+{
+	return *(uchar *)(gd->env_addr + index);
+}
+
+static int env_init_uboot(struct env_context *ctx)
+{
+	struct env_driver *drv;
+	int ret = -ENOENT;
+	int prio;
+
+	for (prio = 0; (drv = env_driver_lookup(ctx, ENVOP_INIT, prio));
+	     prio++) {
+		if (!drv->init || !(ret = drv->init(ctx)))
+			gd->env_has_init |= BIT(drv->location);
+
+		debug("%s: Environment %s init done (ret=%d)\n", __func__,
+		      drv->name, ret);
+	}
+
+	if (!prio)
+		return -ENODEV;
+
+	if (ret == -ENOENT) {
+		gd->env_addr = (ulong)&default_environment[0];
+		gd->env_valid = ENV_VALID;
+
+		return 0;
+	}
+
+	return ret;
+}
+
+static int env_drv_init_uboot(struct env_context *ctx, enum env_location loc)
+{
+	__maybe_unused int ret;
+
+	switch (loc) {
+#ifdef CONFIG_ENV_IS_IN_FLASH
+	case ENVL_FLASH: {
+		env_hdr_t *env_ptr;
+		env_hdr_t *flash_addr;
+		ulong end_addr;
+		env_hdr_t *flash_addr_new;
+		ulong end_addr_new;
+
+#ifdef ENV_IS_EMBEDDED
+		env_ptr = &embedded_environment;
+#else /* ! ENV_IS_EMBEDDED */
+		env_ptr = (env_hdr_t *)CONFIG_ENV_ADDR;
+#endif /* ENV_IS_EMBEDDED */
+		flash_addr = (env_hdr_t *)CONFIG_ENV_ADDR;
+
+/* CONFIG_ENV_ADDR is supposed to be on sector boundary */
+		end_addr = CONFIG_ENV_ADDR + CONFIG_ENV_SECT_SIZE - 1;
+
+#ifdef CONFIG_ENV_ADDR_REDUND
+		flash_addr_new = (env_hdr_t *)CONFIG_ENV_ADDR_REDUND;
+/* CONFIG_ENV_ADDR_REDUND is supposed to be on sector boundary */
+		end_addr_new = CONFIG_ENV_ADDR_REDUND
+					+ CONFIG_ENV_SECT_SIZE - 1;
+#else
+		flash_addr_new = NULL;
+		end_addr_new = 0;
+#endif /* CONFIG_ENV_ADDR_REDUND */
+
+		ret = env_flash_init_params(ctx, env_ptr, flash_addr, end_addr,
+					    flash_addr_new, end_addr_new,
+					    (ulong)&default_environment[0]);
+		if (ret)
+			return -ENOENT;
+
+		return 0;
+		}
+#endif
+#ifdef CONFIG_ENV_IS_IN_FAT
+	case ENVL_FAT: {
+		ret = env_fat_init_params(ctx,
+					  CONFIG_ENV_FAT_INTERFACE,
+					  CONFIG_ENV_FAT_DEVICE_AND_PART,
+					  CONFIG_ENV_FAT_FILE);
+
+		return -ENOENT;
+		}
+#endif
+#ifdef CONFIG_ENV_DRV_NONE
+	case ENVL_NOWHERE:
+#ifdef CONFIG_ENV_IS_NOWHERE
+		gd->env_addr = (ulong)&default_environment[0];
+		gd->env_valid = ENV_INVALID;
+
+		return 0;
+#else
+		return -ENOENT;
+#endif
+#endif
+	default:
+		return -ENOENT;
+	}
+}
+
+/*
+ * NOTE: extracted from env/common.c
+ */
+void env_set_ready_uboot(struct env_context *ctx)
+{
+	gd->flags |= GD_FLG_ENV_READY;
+}
+
+bool env_is_ready_uboot(struct env_context *ctx)
+{
+	return (gd->flags & GD_FLG_ENV_READY);
+}
+
+void env_set_valid_uboot(struct env_context *ctx, enum env_valid valid)
+{
+	gd->env_valid = valid;
+}
+
+enum env_valid env_get_valid_uboot(struct env_context *ctx)
+{
+	return gd->env_valid;
+}
+
+void env_set_addr_uboot(struct env_context *ctx, ulong env_addr)
+{
+	gd->env_addr = env_addr;
+}
+
+ulong env_get_addr_uboot(struct env_context *ctx)
+{
+	return gd->env_addr;
+}
+
+/*
+ * Look up the variable from the default environment
+ */
+char *env_get_default_uboot(struct env_context *ctx, const char *name)
+{
+	char *ret_val;
+	unsigned long really_valid = gd->env_valid;
+	unsigned long real_gd_flags = gd->flags;
+
+	/* Pretend that the image is bad. */
+	gd->flags &= ~GD_FLG_ENV_READY;
+	gd->env_valid = ENV_INVALID;
+	ret_val = env_get(ctx, name);
+	gd->env_valid = really_valid;
+	gd->flags = real_gd_flags;
+	return ret_val;
+}
+
+void env_set_default_env_uboot(struct env_context *ctx, const char *s,
+			       int flags)
+{
+	if (sizeof(default_environment) > ctx->env_size) {
+		puts("*** Error - default environment is too large\n\n");
+		return;
+	}
+
+	if (s) {
+		if ((flags & H_INTERACTIVE) == 0)
+			printf("*** Warning - %s, using default environment\n\n", s);
+		else
+			puts(s);
+	} else {
+		debug("Using default environment\n");
+	}
+
+	env_htab.ctx = ctx;
+	if (himport_r(&env_htab, (char *)default_environment,
+		      sizeof(default_environment), '\0', flags, 0,
+		      0, NULL) == 0)
+		pr_err("## Error: Environment import failed: errno = %d\n",
+		       errno);
+
+	gd->flags |= GD_FLG_ENV_READY;
+	gd->flags |= GD_FLG_ENV_DEFAULT;
+}
+
+/* [re]set individual variables to their value in the default environment */
+int env_set_default_vars_uboot(struct env_context *ctx, int nvars,
+			       char * const vars[], int flags)
+{
+	/*
+	 * Special use-case: import from default environment
+	 * (and use \0 as a separator)
+	 */
+	flags |= H_NOCLEAR;
+	env_htab.ctx = ctx;
+	return himport_r(&env_htab, (const char *)default_environment,
+				sizeof(default_environment), '\0',
+				flags, 0, nvars, vars);
+}
+
+void env_post_relocate_uboot(struct env_context *ctx)
+{
+	if (gd->env_valid == ENV_INVALID) {
+#if defined(CONFIG_ENV_IS_NOWHERE) || defined(CONFIG_SPL_BUILD)
+		/* Environment not changeable */
+		env_set_default(ctx, NULL, 0);
+#else
+		bootstage_error(BOOTSTAGE_ID_NET_CHECKSUM);
+		env_set_default(ctx, "bad CRC", 0);
+#endif
+	} else {
+		env_load(ctx);
+	}
+}
+
+U_BOOT_ENV_CONTEXT(uboot) = {
+	.name = "uboot",
+	.htab = &env_htab,
+	.env_size = ENV_SIZE,
+	.has_inited = env_has_inited_uboot,
+	.set_inited = env_set_inited_uboot,
+	.get_load_prio = env_get_load_prio_uboot,
+	.get_location = env_get_location_uboot,
+	.get_char_default = env_get_char_default_uboot,
+	.get_char_spec = env_get_char_spec_uboot,
+	.init = env_init_uboot,
+	.drv_init = env_drv_init_uboot,
+	.get_default = env_get_default_uboot,
+	.set_default = env_set_default_env_uboot,
+	.set_default_vars = env_set_default_vars_uboot,
+	.set_ready = env_set_ready_uboot,
+	.is_ready = env_is_ready_uboot,
+	.set_valid = env_set_valid_uboot,
+	.get_valid = env_get_valid_uboot,
+	.set_addr = env_set_addr_uboot,
+	.get_addr = env_get_addr_uboot,
+	.post_relocate = env_post_relocate_uboot,
+};
include/env.h +1 -0
index 203605e5e778..26abae2a5c42 100644
@@ -9,6 +9,7 @@
  #ifndef __ENV_H
  #define __ENV_H
 
+#include <linker_lists.h>
  #include <stdbool.h>
  #include <linux/types.h>
 

include/env.h enum env_redund_flags { · line 67

Quoted 4 lines
include/env.h +1 -0
@@ -63,6 +64,8 @@ enum env_redund_flags {
  	ENV_REDUND_ACTIVE = 1,
  };
 
+#define ctx_uboot ll_entry_get(struct env_context, uboot, env_contexts)

Please, do not call ll_entry_get(,uboot,) multiple times. Just call it once during initialization and store the reference in a global variable. In this case you do not need the macro.

Best regards

Heinrich

Quoted 5 lines
include/env.h +1 -0
+
  /* Accessor functions */
  void env_set_ready(struct env_context *ctx);
  bool env_is_ready(struct env_context *ctx);
#4 lore raw

PATCH v5 2/19 env: define env context for U-Boot environment

Quoted 19 lines · Heinrich Schuchardt
Quoted 18 lines · AKASHI Takahiro

In this patch, env context fo U-Boot environment is defined to utilize new env interfaces, maintaining the compatibility with the existing semantics and Kconfig configuration.

In this commit, FAT file system and flash device are only supported devices for backing storages, but extending to other devices will be quite straightforward.

---
 env/Kconfig.uboot   | 671 ++++++++++++++++++++++++++++++++++++++++++++
 env/Makefile        |   2 +-
 env/env_ctx_uboot.c | 292 +++++++++++++++++++
 include/env.h       |   3 +
 4 files changed, 967 insertions(+), 1 deletion(-)
 create mode 100644 env/Kconfig.uboot
 create mode 100644 env/env_ctx_uboot.c
Quoted 9 lines

env/Kconfig.uboot

Quoted 6 lines
env/Kconfig.uboot new file +0 -0
new file mode 100644
index 000000000000..e4334f7f2878
@@ -0,0 +1,671 @@

Only one of the options below should be selected. So, please, use a 'choice' statement. drives/video/Kconfig has an example.

I didn't change much from the original env/Kconfig.
So there may be some reason for not using 'choice' here that I don't know yet.

Quoted 998 lines
Quoted 998 lines
env/Kconfig.uboot new file +671 -0
+config ENV_IS_NOWHERE
+	bool "U-Boot Environment is not stored"
+	default y if !ENV_IS_IN_EEPROM && !ENV_IS_IN_EXT4 && \
+		     !ENV_IS_IN_FAT && !ENV_IS_IN_FLASH && \
+		     !ENV_IS_IN_MMC && !ENV_IS_IN_NAND && \
+		     !ENV_IS_IN_NVRAM && !ENV_IS_IN_ONENAND && \
+		     !ENV_IS_IN_REMOTE && !ENV_IS_IN_SPI_FLASH && \
+		     !ENV_IS_IN_UBI
+	help
+	  Define this if you don't want to or can't have an environment stored
+	  on a storage medium. In this case the environment will still exist
+	  while U-Boot is running, but once U-Boot exits it will not be
+	  stored. U-Boot will therefore always start up with a default
+	  environment.
+
+config ENV_IS_IN_EEPROM
+	bool "Environment in EEPROM"
+	depends on !CHAIN_OF_TRUST
+	select ENV_DRV_EEPROM
+	help
+	  Use this if you have an EEPROM or similar serial access
+	  device and a driver for it.
+
+	  - CONFIG_ENV_OFFSET:
+	  - CONFIG_ENV_SIZE:
+
+	  These two #defines specify the offset and size of the
+	  environment area within the total memory of your EEPROM.
+
+	  Note that we consider the length of the address field to
+	  still be one byte because the extra address bits are hidden
+	  in the chip address.
+
+	  - CONFIG_ENV_EEPROM_IS_ON_I2C
+	  define this, if you have I2C and SPI activated, and your
+	  EEPROM, which holds the environment, is on the I2C bus.
+
+	  - CONFIG_I2C_ENV_EEPROM_BUS
+	  if you have an Environment on an EEPROM reached over
+	  I2C muxes, you can define here, how to reach this
+	  EEPROM. For example:
+
+	  #define CONFIG_I2C_ENV_EEPROM_BUS	  1
+
+	  EEPROM which holds the environment, is reached over
+	  a pca9547 i2c mux with address 0x70, channel 3.
+
+config ENV_IS_IN_FAT
+	bool "Environment is in a FAT filesystem"
+	depends on !CHAIN_OF_TRUST
+	default y if ARCH_BCM283X
+	default y if ARCH_SUNXI && MMC
+	default y if MMC_OMAP_HS && TI_COMMON_CMD_OPTIONS
+	select ENV_DRV_FAT
+	help
+	  Define this if you want to use the FAT file system for the environment.
+
+config ENV_IS_IN_EXT4
+	bool "Environment is in a EXT4 filesystem"
+	depends on !CHAIN_OF_TRUST
+	select ENV_DRV_EXT4
+	help
+	  Define this if you want to use the EXT4 file system for the environment.
+
+config ENV_IS_IN_FLASH
+	bool "Environment in flash memory"
+	depends on !CHAIN_OF_TRUST
+	select ENV_DRV_FLASH
+	default y if ARCH_CINTEGRATOR
+	default y if ARCH_INTEGRATOR_CP
+	default y if M548x || M547x || M5282 || MCF547x_8x
+	default y if MCF532x || MCF52x2
+	default y if MPC86xx || MPC83xx
+	default y if ARCH_MPC8572 || ARCH_MPC8548 || ARCH_MPC8641
+	default y if SH && !CPU_SH4
+	help
+	  Define this if you have a flash device which you want to use for the
+	  environment.
+
+	  a) The environment occupies one whole flash sector, which is
+	   "embedded" in the text segment with the U-Boot code. This
+	   happens usually with "bottom boot sector" or "top boot
+	   sector" type flash chips, which have several smaller
+	   sectors at the start or the end. For instance, such a
+	   layout can have sector sizes of 8, 2x4, 16, Nx32 kB. In
+	   such a case you would place the environment in one of the
+	   4 kB sectors - with U-Boot code before and after it. With
+	   "top boot sector" type flash chips, you would put the
+	   environment in one of the last sectors, leaving a gap
+	   between U-Boot and the environment.
+
+	  CONFIG_ENV_OFFSET:
+
+	   Offset of environment data (variable area) to the
+	   beginning of flash memory; for instance, with bottom boot
+	   type flash chips the second sector can be used: the offset
+	   for this sector is given here.
+
+	   CONFIG_ENV_OFFSET is used relative to CONFIG_SYS_FLASH_BASE.
+
+	  CONFIG_ENV_ADDR:
+
+	   This is just another way to specify the start address of
+	   the flash sector containing the environment (instead of
+	   CONFIG_ENV_OFFSET).
+
+	  CONFIG_ENV_SECT_SIZE:
+
+	   Size of the sector containing the environment.
+
+
+	  b) Sometimes flash chips have few, equal sized, BIG sectors.
+	   In such a case you don't want to spend a whole sector for
+	   the environment.
+
+	  CONFIG_ENV_SIZE:
+
+	   If you use this in combination with CONFIG_ENV_IS_IN_FLASH
+	   and CONFIG_ENV_SECT_SIZE, you can specify to use only a part
+	   of this flash sector for the environment. This saves
+	   memory for the RAM copy of the environment.
+
+	   It may also save flash memory if you decide to use this
+	   when your environment is "embedded" within U-Boot code,
+	   since then the remainder of the flash sector could be used
+	   for U-Boot code. It should be pointed out that this is
+	   STRONGLY DISCOURAGED from a robustness point of view:
+	   updating the environment in flash makes it always
+	   necessary to erase the WHOLE sector. If something goes
+	   wrong before the contents has been restored from a copy in
+	   RAM, your target system will be dead.
+
+	  CONFIG_ENV_ADDR_REDUND
+	  CONFIG_ENV_SIZE_REDUND
+
+	   These settings describe a second storage area used to hold
+	   a redundant copy of the environment data, so that there is
+	   a valid backup copy in case there is a power failure during
+	   a "saveenv" operation.
+
+	  BE CAREFUL! Any changes to the flash layout, and some changes to the
+	  source code will make it necessary to adapt <board>/u-boot.lds*
+	  accordingly!
+
+config ENV_IS_IN_MMC
+	bool "Environment in an MMC device"
+	depends on !CHAIN_OF_TRUST
+	depends on MMC
+	select ENV_DRV_MMC
+	default y if ARCH_EXYNOS4
+	default y if MX6SX || MX7D
+	default y if TEGRA30 || TEGRA124
+	default y if TEGRA_ARMV8_COMMON
+	help
+	  Define this if you have an MMC device which you want to use for the
+	  environment.
+
+	  CONFIG_SYS_MMC_ENV_DEV:
+
+	  Specifies which MMC device the environment is stored in.
+
+	  CONFIG_SYS_MMC_ENV_PART (optional):
+
+	  Specifies which MMC partition the environment is stored in. If not
+	  set, defaults to partition 0, the user area. Common values might be
+	  1 (first MMC boot partition), 2 (second MMC boot partition).
+
+	  CONFIG_ENV_OFFSET:
+	  CONFIG_ENV_SIZE:
+
+	  These two #defines specify the offset and size of the environment
+	  area within the specified MMC device.
+
+	  If offset is positive (the usual case), it is treated as relative to
+	  the start of the MMC partition. If offset is negative, it is treated
+	  as relative to the end of the MMC partition. This can be useful if
+	  your board may be fitted with different MMC devices, which have
+	  different sizes for the MMC partitions, and you always want the
+	  environment placed at the very end of the partition, to leave the
+	  maximum possible space before it, to store other data.
+
+	  These two values are in units of bytes, but must be aligned to an
+	  MMC sector boundary.
+
+	  CONFIG_ENV_OFFSET_REDUND (optional):
+
+	  Specifies a second storage area, of CONFIG_ENV_SIZE size, used to
+	  hold a redundant copy of the environment data. This provides a
+	  valid backup copy in case the other copy is corrupted, e.g. due
+	  to a power failure during a "saveenv" operation.
+
+	  This value may also be positive or negative; this is handled in the
+	  same way as CONFIG_ENV_OFFSET.
+
+	  This value is also in units of bytes, but must also be aligned to
+	  an MMC sector boundary.
+
+	  CONFIG_ENV_SIZE_REDUND (optional):
+
+	  This value need not be set, even when CONFIG_ENV_OFFSET_REDUND is
+	  set. If this value is set, it must be set to the same value as
+	  CONFIG_ENV_SIZE.
+
+config ENV_IS_IN_NAND
+	bool "Environment in a NAND device"
+	depends on !CHAIN_OF_TRUST
+	select ENV_DRV_NAND
+	help
+	  Define this if you have a NAND device which you want to use for the
+	  environment.
+
+	  - CONFIG_ENV_OFFSET:
+	  - CONFIG_ENV_SIZE:
+
+	  These two #defines specify the offset and size of the environment
+	  area within the first NAND device.  CONFIG_ENV_OFFSET must be
+	  aligned to an erase block boundary.
+
+	  - CONFIG_ENV_OFFSET_REDUND (optional):
+
+	  This setting describes a second storage area of CONFIG_ENV_SIZE
+	  size used to hold a redundant copy of the environment data, so
+	  that there is a valid backup copy in case there is a power failure
+	  during a "saveenv" operation.	 CONFIG_ENV_OFFSET_REDUND must be
+	  aligned to an erase block boundary.
+
+	  - CONFIG_ENV_RANGE (optional):
+
+	  Specifies the length of the region in which the environment
+	  can be written.  This should be a multiple of the NAND device's
+	  block size.  Specifying a range with more erase blocks than
+	  are needed to hold CONFIG_ENV_SIZE allows bad blocks within
+	  the range to be avoided.
+
+	  - CONFIG_ENV_OFFSET_OOB (optional):
+
+	  Enables support for dynamically retrieving the offset of the
+	  environment from block zero's out-of-band data.  The
+	  "nand env.oob" command can be used to record this offset.
+	  Currently, CONFIG_ENV_OFFSET_REDUND is not supported when
+	  using CONFIG_ENV_OFFSET_OOB.
+
+config ENV_IS_IN_NVRAM
+	bool "Environment in a non-volatile RAM"
+	depends on !CHAIN_OF_TRUST
+	select ENV_DRV_NVRAM
+	help
+	  Define this if you have some non-volatile memory device
+	  (NVRAM, battery buffered SRAM) which you want to use for the
+	  environment.
+
+	  - CONFIG_ENV_ADDR:
+	  - CONFIG_ENV_SIZE:
+
+	  These two #defines are used to determine the memory area you
+	  want to use for environment. It is assumed that this memory
+	  can just be read and written to, without any special
+	  provision.
+
+config ENV_IS_IN_ONENAND
+	bool "Environment is in OneNAND"
+	depends on !CHAIN_OF_TRUST
+	select ENV_DRV_ONENAND
+	help
+	  Define this if you want to put your local device's environment in
+	  OneNAND.
+
+	  - CONFIG_ENV_ADDR:
+	  - CONFIG_ENV_SIZE:
+
+	  These two #defines are used to determine the device range you
+	  want to use for environment. It is assumed that this memory
+	  can just be read and written to, without any special
+	  provision.
+
+config ENV_IS_IN_REMOTE
+	bool "Environment is in remote memory space"
+	depends on !CHAIN_OF_TRUST
+	select ENV_DRV_REMOTE
+	help
+	  Define this if you have a remote memory space which you
+	  want to use for the local device's environment.
+
+	  - CONFIG_ENV_ADDR:
+	  - CONFIG_ENV_SIZE:
+
+	  These two #defines specify the address and size of the
+	  environment area within the remote memory space. The
+	  local device can get the environment from remote memory
+	  space by SRIO or PCIE links.
+
+config ENV_IS_IN_SPI_FLASH
+	bool "Environment is in SPI flash"
+	depends on !CHAIN_OF_TRUST && SPI
+	select ENV_DRV_SPI_FLASH
+	default y if ARMADA_XP
+	default y if INTEL_BAYTRAIL
+	default y if INTEL_BRASWELL
+	default y if INTEL_BROADWELL
+	default y if NORTHBRIDGE_INTEL_IVYBRIDGE
+	default y if INTEL_QUARK
+	default y if INTEL_QUEENSBAY
+	help
+	  Define this if you have a SPI Flash memory device which you
+	  want to use for the environment.
+
+	  - CONFIG_ENV_OFFSET:
+	  - CONFIG_ENV_SIZE:
+
+	  These two #defines specify the offset and size of the
+	  environment area within the SPI Flash. CONFIG_ENV_OFFSET must be
+	  aligned to an erase sector boundary.
+
+	  - CONFIG_ENV_SECT_SIZE:
+
+	  Define the SPI flash's sector size.
+
+	  - CONFIG_ENV_OFFSET_REDUND (optional):
+
+	  This setting describes a second storage area of CONFIG_ENV_SIZE
+	  size used to hold a redundant copy of the environment data, so
+	  that there is a valid backup copy in case there is a power failure
+	  during a "saveenv" operation. CONFIG_ENV_OFFSET_REDUND must be
+	  aligned to an erase sector boundary.
+
+config USE_ENV_SPI_BUS
+	bool "SPI flash bus for environment"
+	depends on ENV_IS_IN_SPI_FLASH
+	help
+	  Force the SPI bus for environment.
+	  If not defined, use CONFIG_SF_DEFAULT_BUS.
+
+config ENV_SPI_BUS
+	int "Value of SPI flash bus for environment"
+	depends on USE_ENV_SPI_BUS
+	help
+	  Value the SPI bus and chip select for environment.
+
+config USE_ENV_SPI_CS
+	bool "SPI flash chip select for environment"
+	depends on ENV_IS_IN_SPI_FLASH
+	help
+	  Force the SPI chip select for environment.
+	  If not defined, use CONFIG_SF_DEFAULT_CS.
+
+config ENV_SPI_CS
+	int "Value of SPI flash chip select for environment"
+	depends on USE_ENV_SPI_CS
+	help
+	  Value of the SPI chip select for environment.
+
+config USE_ENV_SPI_MAX_HZ
+	bool "SPI flash max frequency for environment"
+	depends on ENV_IS_IN_SPI_FLASH
+	help
+	  Force the SPI max work clock for environment.
+	  If not defined, use CONFIG_SF_DEFAULT_SPEED.
+
+config ENV_SPI_MAX_HZ
+	int "Value of SPI flash max frequency for environment"
+	depends on USE_ENV_SPI_MAX_HZ
+	help
+	  Value of the SPI max work clock for environment.
+
+config USE_ENV_SPI_MODE
+	bool "SPI flash mode for environment"
+	depends on ENV_IS_IN_SPI_FLASH
+	help
+	  Force the SPI work mode for environment.
+
+config ENV_SPI_MODE
+	hex "Value of SPI flash work mode for environment"
+	depends on USE_ENV_SPI_MODE
+	help
+	  Value of the SPI work mode for environment.
+	  See include/spi.h for value.
+
+config ENV_IS_IN_UBI
+	bool "Environment in a UBI volume"
+	depends on !CHAIN_OF_TRUST
+	select ENV_DRV_UBI
+	help
+	  Define this if you have an UBI volume that you want to use for the
+	  environment.  This has the benefit of wear-leveling the environment
+	  accesses, which is important on NAND.
+
+	  - CONFIG_ENV_UBI_PART:
+
+	  Define this to a string that is the mtd partition containing the UBI.
+
+	  - CONFIG_ENV_UBI_VOLUME:
+
+	  Define this to the name of the volume that you want to store the
+	  environment in.
+
+	  - CONFIG_ENV_UBI_VOLUME_REDUND:
+
+	  Define this to the name of another volume to store a second copy of
+	  the environment in.  This will enable redundant environments in UBI.
+	  It is assumed that both volumes are in the same MTD partition.
+
+config ENV_FAT_INTERFACE
+	string "Name of the block device for the environment"
+	depends on ENV_IS_IN_FAT
+	default "mmc" if ARCH_SUNXI
+	default "mmc" if TI_COMMON_CMD_OPTIONS || ARCH_ZYNQMP || ARCH_AT91
+	help
+	  Define this to a string that is the name of the block device.
+
+config ENV_FAT_DEVICE_AND_PART
+	string "Device and partition for where to store the environment in FAT"
+	depends on ENV_IS_IN_FAT
+	default "0:1" if TI_COMMON_CMD_OPTIONS
+	default "0:auto" if ARCH_ZYNQMP
+	default "0:auto" if ARCH_SUNXI && MMC_SUNXI_SLOT_EXTRA = -1
+	default "1:auto" if ARCH_SUNXI && MMC_SUNXI_SLOT_EXTRA != -1
+	default "0" if ARCH_AT91
+	help
+	  Define this to a string to specify the partition of the device. It can
+	  be as following:
+
+	    "D:P", "D:0", "D", "D:" or "D:auto" (D, P are integers. And P >= 1)
+	       - "D:P": device D partition P. Error occurs if device D has no
+	                partition table.
+	       - "D:0": device D.
+	       - "D" or "D:": device D partition 1 if device D has partition
+	                      table, or the whole device D if has no partition
+	                      table.
+	       - "D:auto": first partition in device D with bootable flag set.
+	                   If none, first valid partition in device D. If no
+	                   partition table then means device D.
+
+config ENV_FAT_FILE
+	string "Name of the FAT file to use for the environment"
+	depends on ENV_IS_IN_FAT
+	default "uboot.env"
+	help
+	  It's a string of the FAT file name. This file use to store the
+	  environment.
+
+config ENV_EXT4_INTERFACE
+	string "Name of the block device for the environment"
+	depends on ENV_IS_IN_EXT4
+	help
+	  Define this to a string that is the name of the block device.
+
+config ENV_EXT4_DEVICE_AND_PART
+	string "Device and partition for where to store the environment in EXT4"
+	depends on ENV_IS_IN_EXT4
+	help
+	  Define this to a string to specify the partition of the device. It can
+	  be as following:
+
+	    "D:P", "D:0", "D", "D:" or "D:auto" (D, P are integers. And P >= 1)
+	       - "D:P": device D partition P. Error occurs if device D has no
+	                partition table.
+	       - "D:0": device D.
+	       - "D" or "D:": device D partition 1 if device D has partition
+	                      table, or the whole device D if has no partition
+	                      table.
+	       - "D:auto": first partition in device D with bootable flag set.
+	                   If none, first valid partition in device D. If no
+	                   partition table then means device D.
+
+config ENV_EXT4_FILE
+	string "Name of the EXT4 file to use for the environment"
+	depends on ENV_IS_IN_EXT4
+	default "uboot.env"
+	help
+	  It's a string of the EXT4 file name. This file use to store the
+	  environment (explicit path to the file)
+
+if ARCH_ROCKCHIP || ARCH_SUNXI || ARCH_ZYNQ || ARCH_ZYNQMP || ARCH_VERSAL || ARC || ARCH_STM32MP || ARCH_OMAP2PLUS || ARCH_AT91
+
+config ENV_OFFSET
+	hex "Environment Offset"
+	depends on (!ENV_IS_IN_UBI && !ENV_IS_NOWHERE) || ARCH_STM32MP
+	default 0x3f8000 if ARCH_ROCKCHIP
+	default 0x88000 if ARCH_SUNXI
+	default 0xE0000 if ARCH_ZYNQ
+	default 0x1E00000 if ARCH_ZYNQMP
+	default 0 if ARC
+	default 0x140000 if ARCH_AT91
+	default 0x260000 if ARCH_OMAP2PLUS
+	help
+	  Offset from the start of the device (or partition)
+
+config ENV_SIZE
+	hex "Environment Size"
+	default 0x40000 if ENV_IS_IN_SPI_FLASH && ARCH_ZYNQMP
+	default 0x20000 if ARCH_SUNXI || ARCH_ZYNQ || ARCH_OMAP2PLUS || ARCH_AT91
+	default 0x8000 if ARCH_ROCKCHIP || ARCH_ZYNQMP || ARCH_VERSAL
+	default 0x4000 if ARC
+	default 0x1f000
+	help
+	  Size of the environment storage area
+
+config ENV_SECT_SIZE
+	hex "Environment Sector-Size"
+	depends on (!ENV_IS_NOWHERE && (ARCH_ZYNQ || ARCH_ZYNQMP || ARCH_OMAP2PLUS || ARCH_AT91) )|| ARCH_STM32MP
+	default 0x40000 if ARCH_ZYNQMP
+	default 0x20000 if ARCH_ZYNQ || ARCH_OMAP2PLUS || ARCH_AT91
+	help
+	  Size of the sector containing the environment.
+
+config ENV_UBI_PART
+	string "UBI partition name"
+	depends on ENV_IS_IN_UBI
+	help
+	  MTD partition containing the UBI device
+
+config ENV_UBI_VOLUME
+	string "UBI volume name"
+	depends on ENV_IS_IN_UBI
+	help
+	  Name of the volume that you want to store the environment in.
+
+config ENV_UBI_VOLUME_REDUND
+	string "UBI redundant volume name"
+	depends on ENV_IS_IN_UBI
+	help
+	  Name of the redundant volume that you want to store the environment in.
+
+config ENV_UBI_VID_OFFSET
+	int "ubi environment VID offset"
+	depends on ENV_IS_IN_UBI
+	default 0
+	help
+	  UBI VID offset for environment. If 0, no custom VID offset is used.
+
+endif
+
+config USE_DEFAULT_ENV_FILE
+	bool "Create default environment from file"
+	help
+	  Normally, the default environment is automatically generated
+	  based on the settings of various CONFIG_* options, as well
+	  as the CONFIG_EXTRA_ENV_SETTINGS. By selecting this option,
+	  you can instead define the entire default environment in an
+	  external file.
+
+config DEFAULT_ENV_FILE
+	string "Path to default environment file"
+	depends on USE_DEFAULT_ENV_FILE
+	help
+	  The path containing the default environment. The format is
+	  the same as accepted by the mkenvimage tool: lines
+	  containing key=value pairs, blank lines and lines beginning
+	  with # are ignored.
+
+config ENV_VARS_UBOOT_RUNTIME_CONFIG
+	bool "Add run-time information to the environment"
+	help
+	  Enable this in order to add variables describing certain
+	  run-time determined information about the hardware to the
+	  environment.  These will be named board_name, board_rev.
+
+if SPL_ENV_SUPPORT
+config SPL_ENV_IS_NOWHERE
+	bool "SPL Environment is not stored"
+	default y if ENV_IS_NOWHERE
+	help
+	  Similar to ENV_IS_NOWHERE, used for SPL environment.
+
+config SPL_ENV_IS_IN_MMC
+	bool "SPL Environment in an MMC device"
+	depends on !SPL_ENV_IS_NOWHERE
+	select ENV_DRV_MMC
+	default y
+	help
+	  Similar to ENV_IS_IN_MMC, used for SPL environment.
+
+config SPL_ENV_IS_IN_FAT
+	bool "SPL Environment is in a FAT filesystem"
+	depends on !SPL_ENV_IS_NOWHERE
+	select ENV_DRV_FAT
+	default y
+	help
+	  Similar to ENV_IS_IN_FAT, used for SPL environment.
+
+config SPL_ENV_IS_IN_EXT4
+	bool "SPL Environment is in a EXT4 filesystem"
+	depends on !SPL_ENV_IS_NOWHERE
+	select ENV_DRV_EXT4
+	default y
+	help
+	  Similar to ENV_IS_IN_EXT4, used for SPL environment.
+
+config SPL_ENV_IS_IN_NAND
+	bool "SPL Environment in a NAND device"
+	depends on !SPL_ENV_IS_NOWHERE
+	select ENV_DRV_NAND
+	default y
+	help
+	  Similar to ENV_IS_IN_NAND, used for SPL environment.
+
+config SPL_ENV_IS_IN_SPI_FLASH
+	bool "SPL Environment is in SPI flash"
+	depends on !SPL_ENV_IS_NOWHERE
+	select ENV_DRV_SPI_FLASH
+	default y
+	help
+	  Similar to ENV_IS_IN_SPI_FLASH, used for SPL environment.
+
+config SPL_ENV_IS_IN_FLASH
+	bool "SPL Environment in flash memory"
+	depends on !SPL_ENV_IS_NOWHERE
+	select ENV_DRV_FLASH
+	default y
+	help
+	  Similar to ENV_IS_IN_FLASH, used for SPL environment.
+
+endif
+
+if TPL_ENV_SUPPORT
+
+config TPL_ENV_IS_NOWHERE
+	bool "TPL Environment is not stored"
+	default y if ENV_IS_NOWHERE
+	help
+	  Similar to ENV_IS_NOWHERE, used for TPL environment.
+
+config TPL_ENV_IS_IN_MMC
+	bool "TPL Environment in an MMC device"
+	depends on !TPL_ENV_IS_NOWHERE
+	select ENV_DRV_MMC
+	default y
+	help
+	  Similar to ENV_IS_IN_MMC, used for TPL environment.
+
+config TPL_ENV_IS_IN_FAT
+	bool "TPL Environment is in a FAT filesystem"
+	depends on !TPL_ENV_IS_NOWHERE
+	select ENV_DRV_FAT
+	default y
+	help
+	  Similar to ENV_IS_IN_FAT, used for TPL environment.
+
+config TPL_ENV_IS_IN_EXT4
+	bool "TPL Environment is in a EXT4 filesystem"
+	depends on !TPL_ENV_IS_NOWHERE
+	select ENV_DRV_EXT4
+	default y
+	help
+	  Similar to ENV_IS_IN_EXT4, used for TPL environment.
+
+config TPL_ENV_IS_IN_NAND
+	bool "TPL Environment in a NAND device"
+	depends on !TPL_ENV_IS_NOWHERE
+	select ENV_DRV_NAND
+	default y
+	help
+	  Similar to ENV_IS_IN_NAND, used for TPL environment.
+
+config TPL_ENV_IS_IN_SPI_FLASH
+	bool "TPL Environment is in SPI flash"
+	depends on !TPL_ENV_IS_NOWHERE
+	select ENV_DRV_SPI_FLASH
+	default y
+	help
+	  Similar to ENV_IS_IN_SPI_FLASH, used for TPL environment.
+
+config TPL_ENV_IS_IN_FLASH
+	bool "TPL Environment in flash memory"
+	depends on !TPL_ENV_IS_NOWHERE
+	select ENV_DRV_FLASH
+	default y
+	help
+	  Similar to ENV_IS_IN_FLASH, used for TPL environment.
+
+endif
env/Makefile +1 -1
index ee37cc822024..0168eb47f00d 100644
@@ -3,7 +3,7 @@
 # (C) Copyright 2004-2006
 # Wolfgang Denk, DENX Software Engineering, wd at denx.de.
 
-obj-y += common.o env.o
+obj-y += common.o env.o env_ctx_uboot.o
 
 ifndef CONFIG_SPL_BUILD
 obj-y += attr.o
env/env_ctx_uboot.c new file +292 -0
new file mode 100644
index 000000000000..5ca645599347
@@ -0,0 +1,292 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2019 Linaro Limited
+ *		Author: AKASHI Takahiro
+ */
+
+#include <common.h>
+#include <env_default.h>
+#include <env_flags.h>
+#include <env_internal.h>
+#include <search.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+#if !defined(ENV_IS_IN_DEVICE) && !defined(CONFIG_ENV_IS_NOWHERE)
+# error Define one of CONFIG_ENV_IS_IN_{EEPROM|FLASH|MMC|FAT|EXT4|\
+NAND|NVRAM|ONENAND|SATA|SPI_FLASH|REMOTE|UBI} or CONFIG_ENV_IS_NOWHERE
+#endif
+
+struct hsearch_data env_htab = {
+#if CONFIG_IS_ENABLED(ENV_SUPPORT)
+	/* defined in flags.c, only compile with ENV_SUPPORT */
+	.change_ok = env_flags_validate,
+#endif
+};
+
+/*
+ * NOTE: extracted from env/env.c
+ */
+static bool env_has_inited_uboot(struct env_context *ctx,
+				 enum env_location location)
+{
+	return gd->env_has_init & BIT(location);
+}
+
+static void env_set_inited_uboot(struct env_context *ctx,
+				 enum env_location location)
+{
+	gd->env_has_init |= BIT(location);
+}
+
+static int env_get_load_prio_uboot(struct env_context *ctx)
+{
+	return gd->env_load_prio;
+}
+
+static enum env_location env_get_location_uboot(struct env_context *ctx,
+						enum env_operation op, int prio)
+{
+	gd->env_load_prio = prio;
+
+	return env_locations[prio];
+}
+
+int env_get_char_default_uboot(struct env_context *ctx, int index)
+{
+	return default_environment[index];
+}
+
+int env_get_char_spec_uboot(struct env_context *ctx, int index)
+{
+	return *(uchar *)(gd->env_addr + index);
+}
+
+static int env_init_uboot(struct env_context *ctx)
+{
+	struct env_driver *drv;
+	int ret = -ENOENT;
+	int prio;
+
+	for (prio = 0; (drv = env_driver_lookup(ctx, ENVOP_INIT, prio));
+	     prio++) {
+		if (!drv->init || !(ret = drv->init(ctx)))
+			gd->env_has_init |= BIT(drv->location);
+
+		debug("%s: Environment %s init done (ret=%d)\n", __func__,
+		      drv->name, ret);
+	}
+
+	if (!prio)
+		return -ENODEV;
+
+	if (ret == -ENOENT) {
+		gd->env_addr = (ulong)&default_environment[0];
+		gd->env_valid = ENV_VALID;
+
+		return 0;
+	}
+
+	return ret;
+}
+
+static int env_drv_init_uboot(struct env_context *ctx, enum env_location loc)
+{
+	__maybe_unused int ret;
+
+	switch (loc) {
+#ifdef CONFIG_ENV_IS_IN_FLASH
+	case ENVL_FLASH: {
+		env_hdr_t *env_ptr;
+		env_hdr_t *flash_addr;
+		ulong end_addr;
+		env_hdr_t *flash_addr_new;
+		ulong end_addr_new;
+
+#ifdef ENV_IS_EMBEDDED
+		env_ptr = &embedded_environment;
+#else /* ! ENV_IS_EMBEDDED */
+		env_ptr = (env_hdr_t *)CONFIG_ENV_ADDR;
+#endif /* ENV_IS_EMBEDDED */
+		flash_addr = (env_hdr_t *)CONFIG_ENV_ADDR;
+
+/* CONFIG_ENV_ADDR is supposed to be on sector boundary */
+		end_addr = CONFIG_ENV_ADDR + CONFIG_ENV_SECT_SIZE - 1;
+
+#ifdef CONFIG_ENV_ADDR_REDUND
+		flash_addr_new = (env_hdr_t *)CONFIG_ENV_ADDR_REDUND;
+/* CONFIG_ENV_ADDR_REDUND is supposed to be on sector boundary */
+		end_addr_new = CONFIG_ENV_ADDR_REDUND
+					+ CONFIG_ENV_SECT_SIZE - 1;
+#else
+		flash_addr_new = NULL;
+		end_addr_new = 0;
+#endif /* CONFIG_ENV_ADDR_REDUND */
+
+		ret = env_flash_init_params(ctx, env_ptr, flash_addr, end_addr,
+					    flash_addr_new, end_addr_new,
+					    (ulong)&default_environment[0]);
+		if (ret)
+			return -ENOENT;
+
+		return 0;
+		}
+#endif
+#ifdef CONFIG_ENV_IS_IN_FAT
+	case ENVL_FAT: {
+		ret = env_fat_init_params(ctx,
+					  CONFIG_ENV_FAT_INTERFACE,
+					  CONFIG_ENV_FAT_DEVICE_AND_PART,
+					  CONFIG_ENV_FAT_FILE);
+
+		return -ENOENT;
+		}
+#endif
+#ifdef CONFIG_ENV_DRV_NONE
+	case ENVL_NOWHERE:
+#ifdef CONFIG_ENV_IS_NOWHERE
+		gd->env_addr = (ulong)&default_environment[0];
+		gd->env_valid = ENV_INVALID;
+
+		return 0;
+#else
+		return -ENOENT;
+#endif
+#endif
+	default:
+		return -ENOENT;
+	}
+}
+
+/*
+ * NOTE: extracted from env/common.c
+ */
+void env_set_ready_uboot(struct env_context *ctx)
+{
+	gd->flags |= GD_FLG_ENV_READY;
+}
+
+bool env_is_ready_uboot(struct env_context *ctx)
+{
+	return (gd->flags & GD_FLG_ENV_READY);
+}
+
+void env_set_valid_uboot(struct env_context *ctx, enum env_valid valid)
+{
+	gd->env_valid = valid;
+}
+
+enum env_valid env_get_valid_uboot(struct env_context *ctx)
+{
+	return gd->env_valid;
+}
+
+void env_set_addr_uboot(struct env_context *ctx, ulong env_addr)
+{
+	gd->env_addr = env_addr;
+}
+
+ulong env_get_addr_uboot(struct env_context *ctx)
+{
+	return gd->env_addr;
+}
+
+/*
+ * Look up the variable from the default environment
+ */
+char *env_get_default_uboot(struct env_context *ctx, const char *name)
+{
+	char *ret_val;
+	unsigned long really_valid = gd->env_valid;
+	unsigned long real_gd_flags = gd->flags;
+
+	/* Pretend that the image is bad. */
+	gd->flags &= ~GD_FLG_ENV_READY;
+	gd->env_valid = ENV_INVALID;
+	ret_val = env_get(ctx, name);
+	gd->env_valid = really_valid;
+	gd->flags = real_gd_flags;
+	return ret_val;
+}
+
+void env_set_default_env_uboot(struct env_context *ctx, const char *s,
+			       int flags)
+{
+	if (sizeof(default_environment) > ctx->env_size) {
+		puts("*** Error - default environment is too large\n\n");
+		return;
+	}
+
+	if (s) {
+		if ((flags & H_INTERACTIVE) == 0)
+			printf("*** Warning - %s, using default environment\n\n", s);
+		else
+			puts(s);
+	} else {
+		debug("Using default environment\n");
+	}
+
+	env_htab.ctx = ctx;
+	if (himport_r(&env_htab, (char *)default_environment,
+		      sizeof(default_environment), '\0', flags, 0,
+		      0, NULL) == 0)
+		pr_err("## Error: Environment import failed: errno = %d\n",
+		       errno);
+
+	gd->flags |= GD_FLG_ENV_READY;
+	gd->flags |= GD_FLG_ENV_DEFAULT;
+}
+
+/* [re]set individual variables to their value in the default environment */
+int env_set_default_vars_uboot(struct env_context *ctx, int nvars,
+			       char * const vars[], int flags)
+{
+	/*
+	 * Special use-case: import from default environment
+	 * (and use \0 as a separator)
+	 */
+	flags |= H_NOCLEAR;
+	env_htab.ctx = ctx;
+	return himport_r(&env_htab, (const char *)default_environment,
+				sizeof(default_environment), '\0',
+				flags, 0, nvars, vars);
+}
+
+void env_post_relocate_uboot(struct env_context *ctx)
+{
+	if (gd->env_valid == ENV_INVALID) {
+#if defined(CONFIG_ENV_IS_NOWHERE) || defined(CONFIG_SPL_BUILD)
+		/* Environment not changeable */
+		env_set_default(ctx, NULL, 0);
+#else
+		bootstage_error(BOOTSTAGE_ID_NET_CHECKSUM);
+		env_set_default(ctx, "bad CRC", 0);
+#endif
+	} else {
+		env_load(ctx);
+	}
+}
+
+U_BOOT_ENV_CONTEXT(uboot) = {
+	.name = "uboot",
+	.htab = &env_htab,
+	.env_size = ENV_SIZE,
+	.has_inited = env_has_inited_uboot,
+	.set_inited = env_set_inited_uboot,
+	.get_load_prio = env_get_load_prio_uboot,
+	.get_location = env_get_location_uboot,
+	.get_char_default = env_get_char_default_uboot,
+	.get_char_spec = env_get_char_spec_uboot,
+	.init = env_init_uboot,
+	.drv_init = env_drv_init_uboot,
+	.get_default = env_get_default_uboot,
+	.set_default = env_set_default_env_uboot,
+	.set_default_vars = env_set_default_vars_uboot,
+	.set_ready = env_set_ready_uboot,
+	.is_ready = env_is_ready_uboot,
+	.set_valid = env_set_valid_uboot,
+	.get_valid = env_get_valid_uboot,
+	.set_addr = env_set_addr_uboot,
+	.get_addr = env_get_addr_uboot,
+	.post_relocate = env_post_relocate_uboot,
+};
include/env.h +1 -0
index 203605e5e778..26abae2a5c42 100644
@@ -9,6 +9,7 @@
 #ifndef __ENV_H
 #define __ENV_H
 
+#include <linker_lists.h>
 #include <stdbool.h>
 #include <linux/types.h>
 
@@ -63,6 +64,8 @@ enum env_redund_flags {
 	ENV_REDUND_ACTIVE = 1,
 };
 
Quoted 5 lines

include/env.h enum env_redund_flags { · line 67

Quoted 1 line
include/env.h +1 -0
+#define ctx_uboot ll_entry_get(struct env_context, uboot, env_contexts)

Please, do not call ll_entry_get(,uboot,) multiple times. Just call it once during initialization and store the reference in a global variable. In this case you do not need the macro.

ll_entry_get() won't hurt anything, but for efficiency I agree.

Thanks,
-Takahiro Akashi

Quoted 10 lines

Best regards

Heinrich

Quoted 5 lines
include/env.h +1 -0
+
 /* Accessor functions */
 void env_set_ready(struct env_context *ctx);
 bool env_is_ready(struct env_context *ctx);
#5 lore raw

PATCH v5 3/19 env: nowhere: rework with new env interfaces

In reply to AKASHI Takahiro

Make this function a place holder.
Managing default values, in particular for U-Boot environment, should go into context-specific initialization.

---
 env/nowhere.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
env/nowhere.c +3 -4
index f5b0a17652c5..1a4d40f4a2de 100644
@@ -19,12 +19,11 @@ DECLARE_GLOBAL_DATA_PTR;
  * Because we only ever have the default environment available we must mark
  * it as invalid.
  */
-static int env_nowhere_init(void)
+static int env_nowhere_init(struct env_context *ctx)
 {
-	gd->env_addr	= (ulong)&default_environment[0];
-	gd->env_valid	= ENV_INVALID;
+	/* Just a placeholder */
 
-	return 0;
+	return -ENOENT;
 }
 
 U_BOOT_ENV_LOCATION(nowhere) = {
Signature · 1 line
2.21.0
#6 lore raw

PATCH v5 4/19 env: flash: support multiple env contexts

In reply to AKASHI Takahiro

To support multiple env contexts in this backing store driver, all the necessary parameters to load/save context data with will be contained in dedicated structure, env_flash_context.

All the contexts that want to support their own context must provide its own Kconfig to fill in the parameters.

---
 env/flash.c   | 397 ++++++++++++++++++++++++++++++--------------------
 include/env.h |  11 ++
 2 files changed, 249 insertions(+), 159 deletions(-)
env/flash.c +238 -159
index 231a5fdf24d0..0338e1be7a5a 100644
@@ -45,73 +45,95 @@ DECLARE_GLOBAL_DATA_PTR;
 #define INITENV
 #endif
 
-#if defined(CONFIG_ENV_ADDR_REDUND) && defined(CMD_SAVEENV) || \
-	!defined(CONFIG_ENV_ADDR_REDUND) && defined(INITENV)
-#ifdef ENV_IS_EMBEDDED
-static env_t *env_ptr = &embedded_environment;
-#else /* ! ENV_IS_EMBEDDED */
-
-static env_t *env_ptr = (env_t *)CONFIG_ENV_ADDR;
-#endif /* ENV_IS_EMBEDDED */
-#endif
-static __maybe_unused env_t *flash_addr = (env_t *)CONFIG_ENV_ADDR;
-
-/* CONFIG_ENV_ADDR is supposed to be on sector boundary */
-static ulong __maybe_unused end_addr =
-		CONFIG_ENV_ADDR + CONFIG_ENV_SECT_SIZE - 1;
-
-#ifdef CONFIG_ENV_ADDR_REDUND
+struct env_flash_context {
+	env_hdr_t *env_ptr;
+	env_hdr_t *flash_addr;
+	ulong end_addr;
+	env_hdr_t *flash_addr_new;
+	ulong end_addr_new;
+	ulong default_env_addr;
+};
 
-static env_t __maybe_unused *flash_addr_new = (env_t *)CONFIG_ENV_ADDR_REDUND;
+int env_flash_init_params(struct env_context *ctx,
+			  env_hdr_t *env_ptr,
+			  env_hdr_t *flash_addr, ulong end_addr,
+			  env_hdr_t *flash_addr_new, ulong end_addr_new,
+			  ulong default_env_addr)
+{
+	struct env_flash_context *params;
+
+	params = calloc(sizeof(*params), 1);
+	if (!params)
+		return -1;
+
+	params->env_ptr = env_ptr;
+	params->flash_addr = flash_addr;
+	params->end_addr = end_addr;
+	params->flash_addr_new = flash_addr_new;
+	params->end_addr_new = end_addr_new;
+	params->default_env_addr = default_env_addr;
+#if 1 /* FIXME: cause hang-up */
+	ctx->drv_params[ENVL_FLASH] = NULL;
+#else
+	ctx->drv_params[ENVL_FLASH] = params;
+#endif
 
-/* CONFIG_ENV_ADDR_REDUND is supposed to be on sector boundary */
-static ulong __maybe_unused end_addr_new =
-		CONFIG_ENV_ADDR_REDUND + CONFIG_ENV_SECT_SIZE - 1;
-#endif /* CONFIG_ENV_ADDR_REDUND */
+	return 0;
+}
 
 #ifdef CONFIG_ENV_ADDR_REDUND
 #ifdef INITENV
-static int env_flash_init(void)
+static int env_flash_init(struct env_context *ctx)
 {
+	struct env_flash_context *params;
 	int crc1_ok = 0, crc2_ok = 0;
 
-	uchar flag1 = flash_addr->flags;
-	uchar flag2 = flash_addr_new->flags;
+	if (ctx->drv_init)
+		if (ctx->drv_init(ctx, ENVL_FLASH))
+			return -ENOENT;
+
+	params = ctx->drv_params[ENVL_FLASH];
+	if (!params)
+		return -ENODEV;
+
+	uchar flag1 = params->flash_addr->flags;
+	uchar flag2 = params->flash_addr_new->flags;
 
-	ulong addr_default = (ulong)&default_environment[0];
-	ulong addr1 = (ulong)&(flash_addr->data);
-	ulong addr2 = (ulong)&(flash_addr_new->data);
+	ulong addr_default = params->default_env_addr;
+	ulong addr1 = (ulong)&params->flash_addr->data;
+	ulong addr2 = (ulong)&params->flash_addr_new->data;
 
-	crc1_ok = crc32(0, flash_addr->data, ENV_SIZE) == flash_addr->crc;
-	crc2_ok =
-		crc32(0, flash_addr_new->data, ENV_SIZE) == flash_addr_new->crc;
+	crc1_ok = crc32(0, params->flash_addr->data, ctx->env_size)
+			== params->flash_addr->crc;
+	crc2_ok = crc32(0, params->flash_addr_new->data, ctx->env_size)
+			== params->flash_addr_new->crc;
 
 	if (crc1_ok && !crc2_ok) {
-		gd->env_addr	= addr1;
-		gd->env_valid	= ENV_VALID;
+		env_set_env_addr(ctx, addr1);
+		env_set_valid(ctx, ENV_VALID);
 	} else if (!crc1_ok && crc2_ok) {
-		gd->env_addr	= addr2;
-		gd->env_valid	= ENV_VALID;
+		env_set_env_addr(ctx, addr2);
+		env_set_valid(ctx, ENV_VALID);
 	} else if (!crc1_ok && !crc2_ok) {
-		gd->env_addr	= addr_default;
-		gd->env_valid	= ENV_INVALID;
+		env_set_env_addr(ctx, addr_default);
+		env_set_valid(ctx, ENV_INVALID);
 	} else if (flag1 == ENV_REDUND_ACTIVE &&
 		   flag2 == ENV_REDUND_OBSOLETE) {
-		gd->env_addr	= addr1;
-		gd->env_valid	= ENV_VALID;
+		env_set_env_addr(ctx, addr1);
+		env_set_valid(ctx, ENV_VALID);
 	} else if (flag1 == ENV_REDUND_OBSOLETE &&
 		   flag2 == ENV_REDUND_ACTIVE) {
-		gd->env_addr	= addr2;
-		gd->env_valid	= ENV_VALID;
+		env_set_env_addr(ctx, addr2);
+		env_set_valid(ctx, ENV_VALID);
 	} else if (flag1 == flag2) {
-		gd->env_addr	= addr1;
-		gd->env_valid	= ENV_REDUND;
+		env_set_env_addr(ctx, addr1);
+		env_set_valid(ctx, ENV_REDUND);
 	} else if (flag1 == 0xFF) {
-		gd->env_addr	= addr1;
-		gd->env_valid	= ENV_REDUND;
+		env_set_env_addr(ctx, addr1);
+		env_set_valid(ctx, ENV_REDUND);
 	} else if (flag2 == 0xFF) {
-		gd->env_addr	= addr2;
-		gd->env_valid	= ENV_REDUND;
+		env_set_env_addr(ctx, addr2);
+		env_set_valid(ctx, ENV_REDUND);
 	}
 
 	return 0;
@@ -119,91 +141,107 @@ static int env_flash_init(void)
 #endif
 
 #ifdef CMD_SAVEENV
-static int env_flash_save(void)
+static int env_flash_save(struct env_context *ctx)
 {
-	env_t	env_new;
+	struct env_flash_context *params = ctx->drv_params[ENVL_FLASH];
+	env_hdr_t *env_new = NULL;
+	size_t	env_size;
 	char	*saved_data = NULL;
 	char	flag = ENV_REDUND_OBSOLETE, new_flag = ENV_REDUND_ACTIVE;
 	int	rc = 1;
-#if CONFIG_ENV_SECT_SIZE > CONFIG_ENV_SIZE
 	ulong	up_data = 0;
-#endif
 
-	debug("Protect off %08lX ... %08lX\n", (ulong)flash_addr, end_addr);
+	debug("Protect off %08lX ... %08lX\n", (ulong)params->flash_addr,
+	      params->end_addr);
+
+	if (!params)
+		return 1;
 
-	if (flash_sect_protect(0, (ulong)flash_addr, end_addr))
+	env_size = sizeof(env_hdr_t) + ctx->env_size;
+	env_new = malloc(env_size);
+	if (!env_new)
+		return 1;
+
+	if (flash_sect_protect(0, (ulong)params->flash_addr, params->end_addr))
 		goto done;
 
 	debug("Protect off %08lX ... %08lX\n",
-		(ulong)flash_addr_new, end_addr_new);
+		(ulong)params->flash_addr_new, params->end_addr_new);
 
-	if (flash_sect_protect(0, (ulong)flash_addr_new, end_addr_new))
+	if (flash_sect_protect(0, (ulong)params->flash_addr_new,
+			       params->end_addr_new))
 		goto done;
 
-	rc = env_export(&env_new);
+	rc = env_export(ctx, env_new);
 	if (rc)
-		return rc;
-	env_new.flags	= new_flag;
-
-#if CONFIG_ENV_SECT_SIZE > CONFIG_ENV_SIZE
-	up_data = end_addr_new + 1 - ((long)flash_addr_new + CONFIG_ENV_SIZE);
-	debug("Data to save 0x%lX\n", up_data);
-	if (up_data) {
-		saved_data = malloc(up_data);
-		if (saved_data == NULL) {
-			printf("Unable to save the rest of sector (%ld)\n",
-				up_data);
-			goto done;
+		goto done;
+	env_new->flags	= new_flag;
+
+	if (env_size < CONFIG_ENV_SECT_SIZE) {
+		up_data = params->end_addr_new + 1
+				- ((long)params->flash_addr_new + env_size);
+		debug("Data to save 0x%lX\n", up_data);
+		if (up_data) {
+			saved_data = malloc(up_data);
+			if (!saved_data) {
+				printf("Unable to save the rest of sector (%ld)\n",
+				       up_data);
+				goto done;
+			}
+			memcpy(saved_data,
+			       (void *)
+			       ((long)params->flash_addr_new + env_size),
+			       up_data);
+			debug("Data (start 0x%lX, len 0x%lX) saved at 0x%p\n",
+			      (long)params->flash_addr_new + env_size,
+			      up_data, saved_data);
 		}
-		memcpy(saved_data,
-			(void *)((long)flash_addr_new + CONFIG_ENV_SIZE),
-			up_data);
-		debug("Data (start 0x%lX, len 0x%lX) saved at 0x%p\n",
-			(long)flash_addr_new + CONFIG_ENV_SIZE,
-			up_data, saved_data);
 	}
-#endif
+
 	puts("Erasing Flash...");
-	debug(" %08lX ... %08lX ...", (ulong)flash_addr_new, end_addr_new);
+	debug(" %08lX ... %08lX ...", (ulong)params->flash_addr_new,
+	      params->end_addr_new);
 
-	if (flash_sect_erase((ulong)flash_addr_new, end_addr_new))
+	if (flash_sect_erase((ulong)params->flash_addr_new,
+			     params->end_addr_new))
 		goto done;
 
 	puts("Writing to Flash... ");
 	debug(" %08lX ... %08lX ...",
-		(ulong)&(flash_addr_new->data),
-		sizeof(env_ptr->data) + (ulong)&(flash_addr_new->data));
-	rc = flash_write((char *)&env_new, (ulong)flash_addr_new,
-			 sizeof(env_new));
+	      (ulong)&params->flash_addr_new->data,
+	      ctx->env_size + (ulong)&params->flash_addr_new->data);
+	rc = flash_write((char *)env_new, (ulong)params->flash_addr_new,
+			 sizeof(*env_new) + ctx->env_size);
 	if (rc)
 		goto perror;
 
-	rc = flash_write(&flag, (ulong)&(flash_addr->flags),
-			 sizeof(flash_addr->flags));
+	rc = flash_write(&flag, (ulong)&params->flash_addr->flags,
+			 sizeof(params->flash_addr->flags));
 	if (rc)
 		goto perror;
 
-#if CONFIG_ENV_SECT_SIZE > CONFIG_ENV_SIZE
-	if (up_data) { /* restore the rest of sector */
-		debug("Restoring the rest of data to 0x%lX len 0x%lX\n",
-			(long)flash_addr_new + CONFIG_ENV_SIZE, up_data);
-		if (flash_write(saved_data,
-				(long)flash_addr_new + CONFIG_ENV_SIZE,
-				up_data))
-			goto perror;
+	if (env_size < CONFIG_ENV_SECT_SIZE) {
+		if (up_data) { /* restore the rest of sector */
+			debug("Restoring the rest of data to 0x%lX len 0x%lX\n",
+			      (long)params->flash_addr_new + env_size, up_data);
+			if (flash_write(saved_data,
+					(long)params->flash_addr_new + env_size,
+					up_data))
+				goto perror;
+		}
 	}
-#endif
+
 	puts("done\n");
 
 	{
-		env_t *etmp = flash_addr;
-		ulong ltmp = end_addr;
+		env_hdr_t *etmp = params->flash_addr;
+		ulong ltmp = params->end_addr;
 
-		flash_addr = flash_addr_new;
-		flash_addr_new = etmp;
+		params->flash_addr = params->flash_addr_new;
+		params->flash_addr_new = etmp;
 
-		end_addr = end_addr_new;
-		end_addr_new = ltmp;
+		params->end_addr = params->end_addr_new;
+		params->end_addr_new = ltmp;
 	}
 
 	rc = 0;
@@ -214,8 +252,11 @@ done:
 	if (saved_data)
 		free(saved_data);
 	/* try to re-protect */
-	flash_sect_protect(1, (ulong)flash_addr, end_addr);
-	flash_sect_protect(1, (ulong)flash_addr_new, end_addr_new);
+	flash_sect_protect(1, (ulong)params->flash_addr, params->end_addr);
+	flash_sect_protect(1, (ulong)params->flash_addr_new,
+			   params->end_addr_new);
+
+	free(env_new);
 
 	return rc;
 }
@@ -224,75 +265,100 @@ done:
 #else /* ! CONFIG_ENV_ADDR_REDUND */
 
 #ifdef INITENV
-static int env_flash_init(void)
+static int env_flash_init(struct env_context *ctx)
 {
-	if (crc32(0, env_ptr->data, ENV_SIZE) == env_ptr->crc) {
-		gd->env_addr	= (ulong)&(env_ptr->data);
-		gd->env_valid	= ENV_VALID;
+	struct env_flash_context *params;
+
+	if (ctx->drv_init)
+		if (ctx->drv_init(ctx, ENVL_FLASH))
+			return -ENOENT;
+
+	params = ctx->drv_params[ENVL_FLASH];
+	if (!params)
+		return -ENODEV;
+
+	if (crc32(0, params->env_ptr->data, ctx->env_size)
+	    == params->env_ptr->crc) {
+		env_set_env_addr(ctx, (ulong)&params->env_ptr->data);
+		env_set_valid(ctx, ENV_VALID);
+
 		return 0;
 	}
 
-	gd->env_addr	= (ulong)&default_environment[0];
-	gd->env_valid	= ENV_INVALID;
+	env_set_env_addr(ctx, params->default_env_addr);
+	env_set_valid(ctx, ENV_INVALID);
+
 	return 0;
 }
 #endif
 
 #ifdef CMD_SAVEENV
-static int env_flash_save(void)
+static int env_flash_save(struct env_context *ctx)
 {
-	env_t	env_new;
+	struct env_flash_context *params = ctx->drv_params[ENVL_FLASH];
+	env_hdr_t *env_new;
 	int	rc = 1;
 	char	*saved_data = NULL;
-#if CONFIG_ENV_SECT_SIZE > CONFIG_ENV_SIZE
 	ulong	up_data = 0;
-
-	up_data = end_addr + 1 - ((long)flash_addr + CONFIG_ENV_SIZE);
-	debug("Data to save 0x%lx\n", up_data);
-	if (up_data) {
-		saved_data = malloc(up_data);
-		if (saved_data == NULL) {
-			printf("Unable to save the rest of sector (%ld)\n",
-				up_data);
-			goto done;
+	size_t	env_size;
+
+	if (!params)
+		return 1;
+
+	env_size = sizeof(env_hdr_t) + ctx->env_size;
+	env_new = malloc(env_size);
+	if (!env_new)
+		return 1;
+
+	if (env_size < CONFIG_ENV_SECT_SIZE) {
+		up_data = params->end_addr + 1
+				- ((long)params->flash_addr + env_size);
+		debug("Data to save 0x%lx\n", up_data);
+		if (up_data) {
+			saved_data = malloc(up_data);
+			if (!saved_data) {
+				printf("Unable to save the rest of sector (%ld)\n",
+				       up_data);
+				goto done;
+			}
+			memcpy(saved_data,
+			       (void *)((long)params->flash_addr + env_size),
+			       up_data);
+			debug("Data (start 0x%lx, len 0x%lx) saved at 0x%lx\n",
+			      (ulong)params->flash_addr + env_size,
+			      up_data,
+			      (ulong)saved_data);
 		}
-		memcpy(saved_data,
-			(void *)((long)flash_addr + CONFIG_ENV_SIZE), up_data);
-		debug("Data (start 0x%lx, len 0x%lx) saved at 0x%lx\n",
-			(ulong)flash_addr + CONFIG_ENV_SIZE,
-			up_data,
-			(ulong)saved_data);
 	}
-#endif	/* CONFIG_ENV_SECT_SIZE */
 
-	debug("Protect off %08lX ... %08lX\n", (ulong)flash_addr, end_addr);
+	debug("Protect off %08lX ... %08lX\n", (ulong)params->flash_addr,
+	      params->end_addr);
 
-	if (flash_sect_protect(0, (long)flash_addr, end_addr))
+	if (flash_sect_protect(0, (long)params->flash_addr, params->end_addr))
 		goto done;
 
-	rc = env_export(&env_new);
+	rc = env_export(ctx, env_new);
 	if (rc)
 		goto done;
 
 	puts("Erasing Flash...");
-	if (flash_sect_erase((long)flash_addr, end_addr))
+	if (flash_sect_erase((long)params->flash_addr, params->end_addr))
 		goto done;
 
 	puts("Writing to Flash... ");
-	rc = flash_write((char *)&env_new, (long)flash_addr, CONFIG_ENV_SIZE);
+	rc = flash_write((char *)env_new, (long)params->flash_addr, env_size);
 	if (rc != 0)
 		goto perror;
 
-#if CONFIG_ENV_SECT_SIZE > CONFIG_ENV_SIZE
-	if (up_data) {	/* restore the rest of sector */
+	if ((env_size < CONFIG_ENV_SECT_SIZE) && up_data) {
+		/* restore the rest of sector */
 		debug("Restoring the rest of data to 0x%lx len 0x%lx\n",
-			(ulong)flash_addr + CONFIG_ENV_SIZE, up_data);
-		if (flash_write(saved_data,
-				(long)flash_addr + CONFIG_ENV_SIZE,
+			(ulong)params->flash_addr + env_size, up_data);
+		if (flash_write(saved_data, (long)params->flash_addr + env_size,
 				up_data))
 			goto perror;
 	}
-#endif
+
 	puts("done\n");
 	rc = 0;
 	goto done;
@@ -302,7 +368,9 @@ done:
 	if (saved_data)
 		free(saved_data);
 	/* try to re-protect */
-	flash_sect_protect(1, (long)flash_addr, end_addr);
+	flash_sect_protect(1, (long)params->flash_addr, params->end_addr);
+	free(env_new);
+
 	return rc;
 }
 #endif /* CMD_SAVEENV */
@@ -310,50 +378,61 @@ done:
 #endif /* CONFIG_ENV_ADDR_REDUND */
 
 #ifdef LOADENV
-static int env_flash_load(void)
+static int env_flash_load(struct env_context *ctx)
 {
+	struct env_flash_context *params = ctx->drv_params[ENVL_FLASH];
+
+	if (!params)
+		return -ENODEV;
+
 #ifdef CONFIG_ENV_ADDR_REDUND
-	if (gd->env_addr != (ulong)&(flash_addr->data)) {
-		env_t *etmp = flash_addr;
-		ulong ltmp = end_addr;
+	if (env_get_env_addr(ctx) != (ulong)&params->flash_addr->data) {
+		struct environment_hdr *etmp = params->flash_addr;
+		ulong ltmp = params->end_addr;
 
-		flash_addr = flash_addr_new;
-		flash_addr_new = etmp;
+		params->flash_addr = params->flash_addr_new;
+		params->flash_addr_new = etmp;
 
-		end_addr = end_addr_new;
-		end_addr_new = ltmp;
+		params->end_addr = params->end_addr_new;
+		params->end_addr_new = ltmp;
 	}
 
 	if (flash_addr_new->flags != ENV_REDUND_OBSOLETE &&
-	    crc32(0, flash_addr_new->data, ENV_SIZE) == flash_addr_new->crc) {
+	    crc32(0, params->flash_addr_new->data, ctx->env_size)
+			== params->flash_addr_new->crc) {
 		char flag = ENV_REDUND_OBSOLETE;
 
-		gd->env_valid = ENV_REDUND;
-		flash_sect_protect(0, (ulong)flash_addr_new, end_addr_new);
+		env_set_valid(ctx, ENV_REDUND);
+		flash_sect_protect(0, (ulong)params->flash_addr_new,
+				   params->end_addr_new);
 		flash_write(&flag,
-			    (ulong)&(flash_addr_new->flags),
-			    sizeof(flash_addr_new->flags));
-		flash_sect_protect(1, (ulong)flash_addr_new, end_addr_new);
+			    (ulong)&params->flash_addr_new->flags,
+			    sizeof(params->flash_addr_new->flags));
+		flash_sect_protect(1, (ulong)params->flash_addr_new,
+				   params->end_addr_new);
 	}
 
-	if (flash_addr->flags != ENV_REDUND_ACTIVE &&
-	    (flash_addr->flags & ENV_REDUND_ACTIVE) == ENV_REDUND_ACTIVE) {
+	if (params->flash_addr->flags != ENV_REDUND_ACTIVE &&
+	    (params->flash_addr->flags & ENV_REDUND_ACTIVE)
+			== ENV_REDUND_ACTIVE) {
 		char flag = ENV_REDUND_ACTIVE;
 
-		gd->env_valid = ENV_REDUND;
-		flash_sect_protect(0, (ulong)flash_addr, end_addr);
+		env_set_valid(ctx, ENV_REDUND);
+		flash_sect_protect(0, (ulong)params->flash_addr,
+				   params->end_addr);
 		flash_write(&flag,
-			    (ulong)&(flash_addr->flags),
-			    sizeof(flash_addr->flags));
-		flash_sect_protect(1, (ulong)flash_addr, end_addr);
+			    (ulong)&params->flash_addr->flags,
+			    sizeof(params->flash_addr->flags));
+		flash_sect_protect(1, (ulong)params->flash_addr,
+				   params->end_addr);
 	}
 
-	if (gd->env_valid == ENV_REDUND)
+	if (env_get_valid(ctx) == ENV_REDUND)
 		puts("*** Warning - some problems detected "
 		     "reading environment; recovered successfully\n\n");
 #endif /* CONFIG_ENV_ADDR_REDUND */
 
-	return env_import((char *)flash_addr, 1);
+	return env_import(ctx, (char *)params->flash_addr, 1);
 }
 #endif /* LOADENV */
 
include/env.h +11 -0
index 26abae2a5c42..9b4b9debc36d 100644
@@ -14,6 +14,7 @@
 #include <linux/types.h>
 
 struct env_context;
+struct environment_hdr;
 struct environment_s;
 enum env_operation; /* TODO: move it from env_internal.h? */
 
@@ -388,4 +389,14 @@ int env_get_char(struct env_context *ctx, int index);
  */
 void env_reloc(void);
 
+/*
+ * driver parameters initialization
+ */
+int env_flash_init_params(struct env_context *ctx,
+			  struct environment_hdr *env_ptr,
+			  struct environment_hdr *flash_addr, ulong end_addr,
+			  struct environment_hdr *flash_addr_new,
+			  ulong end_addr_new,
+			  ulong default_env_addr);
+
 #endif
Signature · 1 line
2.21.0
#7 lore raw

PATCH v5 5/19 env: fat: support multiple env contexts

In reply to AKASHI Takahiro

To support multiple env contexts in this backing store driver, all the necessary parameters to load/save context data with will be contained in dedicated structure, env_fat_context.

All the contexts that want to support their own context must provide its own Kconfig to fill in the parameters.

---
 env/fat.c     | 102 +++++++++++++++++++++++++++++++++++++-------------
 include/env.h |   2 +
 2 files changed, 78 insertions(+), 26 deletions(-)
env/fat.c +76 -26
index 1836556f361d..0236c82849b3 100644
@@ -31,25 +31,57 @@
 # endif
 #endif
 
+struct env_fat_context {
+	const char *interface;
+	const char *dev_and_part;
+	const char *file;
+};
+
+int env_fat_init_params(struct env_context *ctx, const char *interface,
+			const char *dev_part, const char *file)
+{
+	struct env_fat_context *params;
+
+	params = calloc(sizeof(*params), 1);
+	if (!params)
+		return -1;
+
+	params->interface = interface;
+	params->dev_and_part = dev_part;
+	params->file = file;
+	ctx->drv_params[ENVL_FAT] = params;
+
+	return 0;
+}
+
 #ifdef CMD_SAVEENV
-static int env_fat_save(void)
+static int env_fat_save(struct env_context *ctx)
 {
-	env_t __aligned(ARCH_DMA_MINALIGN) env_new;
+	env_hdr_t *env_new;
 	struct blk_desc *dev_desc = NULL;
 	disk_partition_t info;
 	int dev, part;
+	struct env_fat_context *params = ctx->drv_params[ENVL_FAT];
 	int err;
 	loff_t size;
 
-	err = env_export(&env_new);
+	if (!params)
+		return 1;
+
+	env_new = malloc_cache_aligned(sizeof(env_hdr_t) + ctx->env_size);
+	if (!env_new)
+		return 1;
+
+	err = env_export(ctx, env_new);
 	if (err)
-		return err;
+		goto out;
+	err = 1;
 
-	part = blk_get_device_part_str(CONFIG_ENV_FAT_INTERFACE,
-					CONFIG_ENV_FAT_DEVICE_AND_PART,
-					&dev_desc, &info, 1);
+	part = blk_get_device_part_str(params->interface,
+				       params->dev_and_part,
+				       &dev_desc, &info, 1);
 	if (part < 0)
-		return 1;
+		goto out;
 
 	dev = dev_desc->devnum;
 	if (fat_set_blk_dev(dev_desc, &info) != 0) {
@@ -58,43 +90,51 @@ static int env_fat_save(void)
 		 * will calling it. The missing \n is intentional.
 		 */
 		printf("Unable to use %s %d:%d... ",
-		       CONFIG_ENV_FAT_INTERFACE, dev, part);
-		return 1;
+		       params->interface, dev, part);
+		goto out;
 	}
 
-	err = file_fat_write(CONFIG_ENV_FAT_FILE, (void *)&env_new, 0, sizeof(env_t),
-			     &size);
+	err = file_fat_write(params->file, (void *)env_new, 0,
+			     sizeof(env_hdr_t) + ctx->env_size, &size);
 	if (err == -1) {
 		/*
 		 * This printf is embedded in the messages from env_save that
 		 * will calling it. The missing \n is intentional.
 		 */
 		printf("Unable to write \"%s\" from %s%d:%d... ",
-			CONFIG_ENV_FAT_FILE, CONFIG_ENV_FAT_INTERFACE, dev, part);
-		return 1;
+			params->file, params->interface, dev, part);
+		err = 1;
+		goto out;
 	}
+	err = 0;
+out:
+	free(env_new);
 
-	return 0;
+	return err;
 }
 #endif /* CMD_SAVEENV */
 
 #ifdef LOADENV
-static int env_fat_load(void)
+static int env_fat_load(struct env_context *ctx)
 {
-	ALLOC_CACHE_ALIGN_BUFFER(char, buf, CONFIG_ENV_SIZE);
+	struct env_fat_context *params = ctx->drv_params[ENVL_FAT];
+	ALLOC_CACHE_ALIGN_BUFFER(char, buf, sizeof(env_hdr_t) + ctx->env_size);
 	struct blk_desc *dev_desc = NULL;
 	disk_partition_t info;
 	int dev, part;
 	int err;
 
+	if (!params)
+		return -ENODEV;
+
 #ifdef CONFIG_MMC
-	if (!strcmp(CONFIG_ENV_FAT_INTERFACE, "mmc"))
+	if (!strcmp(params->interface, "mmc"))
 		mmc_initialize(NULL);
 #endif
 
-	part = blk_get_device_part_str(CONFIG_ENV_FAT_INTERFACE,
-					CONFIG_ENV_FAT_DEVICE_AND_PART,
-					&dev_desc, &info, 1);
+	part = blk_get_device_part_str(params->interface,
+				       params->dev_and_part,
+				       &dev_desc, &info, 1);
 	if (part < 0)
 		goto err_env_relocate;
 
@@ -105,30 +145,39 @@ static int env_fat_load(void)
 		 * will calling it. The missing \n is intentional.
 		 */
 		printf("Unable to use %s %d:%d... ",
-		       CONFIG_ENV_FAT_INTERFACE, dev, part);
+		       params->interface, dev, part);
 		goto err_env_relocate;
 	}
 
-	err = file_fat_read(CONFIG_ENV_FAT_FILE, buf, CONFIG_ENV_SIZE);
+	err = file_fat_read(params->file, buf,
+			    sizeof(env_hdr_t) + ctx->env_size);
 	if (err == -1) {
 		/*
 		 * This printf is embedded in the messages from env_save that
 		 * will calling it. The missing \n is intentional.
 		 */
 		printf("Unable to read \"%s\" from %s%d:%d... ",
-			CONFIG_ENV_FAT_FILE, CONFIG_ENV_FAT_INTERFACE, dev, part);
+			params->file, params->interface, dev, part);
 		goto err_env_relocate;
 	}
 
-	return env_import(buf, 1);
+	return env_import(ctx, buf, 1);
 
 err_env_relocate:
-	env_set_default(NULL, 0);
+	env_set_default(ctx, NULL, 0);
 
 	return -EIO;
 }
 #endif /* LOADENV */
 
+static int env_fat_init(struct env_context *ctx)
+{
+	if (ctx->drv_init)
+		return ctx->drv_init(ctx, ENVL_FAT);
+
+	return -ENOENT;
+}
+
 U_BOOT_ENV_LOCATION(fat) = {
 	.location	= ENVL_FAT,
 	ENV_NAME("FAT")
@@ -138,4 +187,5 @@ U_BOOT_ENV_LOCATION(fat) = {
 #ifdef CMD_SAVEENV
 	.save		= env_save_ptr(env_fat_save),
 #endif
+	.init		= env_fat_init,
 };
include/env.h +2 -0
index 9b4b9debc36d..8045dda9f811 100644
@@ -398,5 +398,7 @@ int env_flash_init_params(struct env_context *ctx,
 			  struct environment_hdr *flash_addr_new,
 			  ulong end_addr_new,
 			  ulong default_env_addr);
+int env_fat_init_params(struct env_context *ctx, const char *interface,
+			const char *dev_part, const char *file);
 
 #endif
Signature · 1 line
2.21.0
#8 lore raw

PATCH v5 6/19 hashtable: support multiple env contexts

In reply to AKASHI Takahiro

With this patch, variable's context is always honored in all operations, FIND/ENTER (including delete).

---
 include/search.h |  6 +++++-
 lib/hashtable.c  | 14 +++++++++++---
 2 files changed, 16 insertions(+), 4 deletions(-)
include/search.h +5 -1
index 0469a852e07c..202cf652de5f 100644
@@ -25,13 +25,16 @@ enum env_action {
 	ENV_ENTER,
 };
 
+struct env_context;
+
 /** struct env_entry - An entry in the environment hashtable */
 struct env_entry {
 	const char *key;
 	char *data;
 	int (*callback)(const char *name, const char *value, enum env_op op,
-		int flags);
+			int flags);
 	int flags;
+	struct env_context *ctx;
 };
 
 /*
@@ -45,6 +48,7 @@ struct hsearch_data {
 	struct env_entry_node *table;
 	unsigned int size;
 	unsigned int filled;
+	struct env_context *ctx;
 /*
  * Callback function which will check whether the given change for variable
  * "item" to "newval" may be applied or not, and possibly apply such change.
lib/hashtable.c +11 -3
index 2caab0a4c6d3..8fe017470256 100644
@@ -231,6 +231,7 @@ static inline int _compare_and_overwrite_entry(struct env_entry item,
 		unsigned int idx)
 {
 	if (htab->table[idx].used == hval
+	    && (item.ctx && (item.ctx == htab->table[idx].entry.ctx))
 	    && strcmp(item.key, htab->table[idx].entry.key) == 0) {
 		/* Overwrite existing value? */
 		if (action == ENV_ENTER && item.data) {
@@ -247,8 +248,9 @@ static inline int _compare_and_overwrite_entry(struct env_entry item,
 
 			/* If there is a callback, call it */
 			if (htab->table[idx].entry.callback &&
-			    htab->table[idx].entry.callback(item.key,
-			    item.data, env_op_overwrite, flag)) {
+			    htab->table[idx].entry.callback(item.key, item.data,
+							    env_op_overwrite,
+							    flag)) {
 				debug("callback() rejected setting variable "
 					"%s, skipping it!\n", item.key);
 				__set_errno(EINVAL);
@@ -340,6 +342,9 @@ int hsearch_r(struct env_entry item, enum env_action action,
 			if (idx == hval)
 				break;
 
+			if (htab->table[idx].used == USED_FREE)
+				break;
+
 			if (htab->table[idx].used == USED_DELETED
 			    && !first_deleted)
 				first_deleted = idx;
@@ -381,6 +386,7 @@ int hsearch_r(struct env_entry item, enum env_action action,
 			*retval = NULL;
 			return 0;
 		}
+		htab->table[idx].entry.ctx = item.ctx;
 
 		++htab->filled;
 
@@ -403,7 +409,7 @@ int hsearch_r(struct env_entry item, enum env_action action,
 		/* If there is a callback, call it */
 		if (htab->table[idx].entry.callback &&
 		    htab->table[idx].entry.callback(item.key, item.data,
-		    env_op_create, flag)) {
+						    env_op_create, flag)) {
 			debug("callback() rejected setting variable "
 				"%s, skipping it!\n", item.key);
 			_hdelete(item.key, htab, &htab->table[idx].entry, idx);
@@ -454,6 +460,7 @@ int hdelete_r(const char *key, struct hsearch_data *htab, int flag)
 
 	debug("hdelete: DELETE key \"%s\"\n", key);
 
+	e.ctx = htab->ctx;
 	e.key = (char *)key;
 
 	idx = hsearch_r(e, ENV_FIND, &ep, htab, 0);
@@ -928,6 +935,7 @@ int himport_r(struct hsearch_data *htab,
 			continue;
 
 		/* enter into hash table */
+		e.ctx = htab->ctx;
 		e.key = name;
 		e.data = value;
 
Signature · 1 line
2.21.0
#9 lore raw

PATCH v5 7/19 api: converted with new env interfaces

In reply to AKASHI Takahiro

env_xxx(...) -> env_xxx(ctx_uboot, ...)

---
 api/api.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
api/api.c +5 -3
index bc9454eb4b63..d1dd8bfc60af 100644
@@ -458,7 +458,8 @@ static int API_env_get(va_list ap)
 	if ((value = (char **)va_arg(ap, uintptr_t)) == NULL)
 		return API_EINVAL;
 
-	*value = env_get(name);
+	/* TODO: context */
+	*value = env_get(ctx_uboot, name);
 
 	return 0;
 }
@@ -481,7 +482,8 @@ static int API_env_set(va_list ap)
 	if ((value = (char *)va_arg(ap, uintptr_t)) == NULL)
 		return API_EINVAL;
 
-	env_set(name, value);
+	/* TODO: context */
+	env_set(ctx_uboot, name, value);
 
 	return 0;
 }
@@ -663,7 +665,7 @@ void api_init(void)
 		return;
 	}
 
-	env_set_hex("api_address", (unsigned long)sig);
+	env_set_hex(ctx_uboot, "api_address", (unsigned long)sig);
 	debugf("API sig @ 0x%lX\n", (unsigned long)sig);
 	memcpy(sig->magic, API_SIG_MAGIC, 8);
 	sig->version = API_SIG_VERSION;
Signature · 1 line
2.21.0
#10 lore raw

PATCH v5 8/19 arch: converted with new env interfaces

In reply to AKASHI Takahiro

env_xxx(...) -> env_xxx(ctx_uboot, ...)

---
 arch/arc/lib/bootm.c                          |  2 +-
 arch/arm/cpu/arm926ejs/spear/spr_misc.c       |  8 ++---
 arch/arm/cpu/armv8/fsl-layerscape/cpu.c       |  5 +--
 arch/arm/cpu/armv8/fsl-layerscape/soc.c       | 14 ++++----
 arch/arm/lib/bootm.c                          |  6 ++--
 arch/arm/lib/semihosting.c                    |  2 +-
 arch/arm/mach-imx/mx6/opos6ul.c               |  4 +--
 arch/arm/mach-imx/mx7/soc.c                   |  4 +--
 arch/arm/mach-imx/video.c                     |  2 +-
 arch/arm/mach-keystone/ddr3.c                 |  2 +-
 arch/arm/mach-keystone/keystone.c             |  2 +-
 arch/arm/mach-kirkwood/cpu.c                  |  4 +--
 arch/arm/mach-meson/board-common.c            |  2 +-
 arch/arm/mach-omap2/utils.c                   | 20 +++++------
 arch/arm/mach-rmobile/cpu_info.c              |  2 +-
 arch/arm/mach-rockchip/boot_mode.c            |  4 +--
 arch/arm/mach-rockchip/rk3288/rk3288.c        |  2 +-
 arch/arm/mach-socfpga/misc_gen5.c             |  5 +--
 arch/arm/mach-socfpga/misc_s10.c              |  2 +-
 arch/arm/mach-stm32mp/cpu.c                   | 35 ++++++++++---------
 arch/arm/mach-tegra/board2.c                  |  4 +--
 arch/arm/mach-tegra/cboot.c                   | 18 +++++-----
 arch/arm/mach-uniphier/board_late_init.c      | 19 +++++-----
 arch/arm/mach-uniphier/mmc-first-dev.c        |  2 +-
 arch/m68k/lib/bootm.c                         |  2 +-
 arch/microblaze/lib/bootm.c                   |  2 +-
 arch/mips/lib/bootm.c                         |  6 ++--
 arch/nds32/lib/bootm.c                        |  4 +--
 arch/powerpc/cpu/mpc85xx/cpu_init.c           | 10 +++---
 arch/powerpc/cpu/mpc85xx/fdt.c                |  2 +-
 arch/powerpc/cpu/mpc85xx/fsl_corenet_serdes.c |  2 +-
 arch/powerpc/lib/bootm.c                      |  2 +-
 arch/sh/lib/bootm.c                           |  2 +-
 arch/sh/lib/zimageboot.c                      |  2 +-
 arch/x86/lib/zimage.c                         | 11 +++---
 arch/xtensa/lib/bootm.c                       |  2 +-
 36 files changed, 111 insertions(+), 106 deletions(-)
arch/arc/lib/bootm.c +1 -1
index 254e0284b3fb..fb11d6c8c08b 100644
@@ -91,7 +91,7 @@ static void boot_jump_linux(bootm_headers_t *images, int flag)
 		r2 = (unsigned int)images->ft_addr;
 	} else {
 		r0 = 1;
-		r2 = (unsigned int)env_get("bootargs");
+		r2 = (unsigned int)env_get(ctx_uboot, "bootargs");
 	}
 
 	cleanup_before_linux();
arch/arm/cpu/arm926ejs/spear/spr_misc.c +4 -4
index d36484c9d69a..78ef0650dd1f 100644
@@ -56,12 +56,12 @@ int misc_init_r(void)
 	if (!eth_env_get_enetaddr("ethaddr", mac_id) && !i2c_read_mac(mac_id))
 		eth_env_set_enetaddr("ethaddr", mac_id);
 #endif
-	env_set("verify", "n");
+	env_set(ctx_uboot, "verify", "n");
 
 #if defined(CONFIG_SPEAR_USBTTY)
-	env_set("stdin", "usbtty");
-	env_set("stdout", "usbtty");
-	env_set("stderr", "usbtty");
+	env_set(ctx_uboot, "stdin", "usbtty");
+	env_set(ctx_uboot, "stdout", "usbtty");
+	env_set(ctx_uboot, "stderr", "usbtty");
 
 #ifndef CONFIG_SYS_NO_DCACHE
 	dcache_enable();
arch/arm/cpu/armv8/fsl-layerscape/cpu.c +3 -2
index 26f4fdacdb82..f42ce1f9aefb 100644
@@ -801,7 +801,8 @@ int mmc_get_env_dev(void)
 }
 #endif
 
-enum env_location env_get_location(enum env_operation op, int prio)
+enum env_location env_get_location(struct env_context *ctx,
+				   enum env_operation op, int prio)
 {
 	enum boot_src src = get_boot_src();
 	enum env_location env_loc = ENVL_NOWHERE;
@@ -1067,7 +1068,7 @@ static void config_core_prefetch(void)
 	unsigned int mask;
 	struct pt_regs regs;
 
-	if (env_get_f("hwconfig", buffer, sizeof(buffer)) > 0)
+	if (env_get_f(ctx_uboot, "hwconfig", buffer, sizeof(buffer)) > 0)
 		buf = buffer;
 
 	prefetch_arg = hwconfig_subarg_f("core_prefetch", "disable",
arch/arm/cpu/armv8/fsl-layerscape/soc.c +7 -7
index 3fd34e3a435d..9300e8de8e04 100644
@@ -761,7 +761,7 @@ int fsl_setenv_bootcmd(void)
 		break;
 	}
 
-	ret = env_set("bootcmd", bootcmd_str);
+	ret = env_set(ctx_uboot, "bootcmd", bootcmd_str);
 	if (ret) {
 		printf("Failed to set bootcmd: ret = %d\n", ret);
 		return ret;
@@ -778,34 +778,34 @@ int fsl_setenv_mcinitcmd(void)
 #ifdef IFC_MC_INIT_CMD
 	case BOOT_SOURCE_IFC_NAND:
 	case BOOT_SOURCE_IFC_NOR:
-	ret = env_set("mcinitcmd", IFC_MC_INIT_CMD);
+	ret = env_set(ctx_uboot, "mcinitcmd", IFC_MC_INIT_CMD);
 		break;
 #endif
 #ifdef QSPI_MC_INIT_CMD
 	case BOOT_SOURCE_QSPI_NAND:
 	case BOOT_SOURCE_QSPI_NOR:
-	ret = env_set("mcinitcmd", QSPI_MC_INIT_CMD);
+	ret = env_set(ctx_uboot, "mcinitcmd", QSPI_MC_INIT_CMD);
 		break;
 #endif
 #ifdef XSPI_MC_INIT_CMD
 	case BOOT_SOURCE_XSPI_NAND:
 	case BOOT_SOURCE_XSPI_NOR:
-	ret = env_set("mcinitcmd", XSPI_MC_INIT_CMD);
+	ret = env_set(ctx_uboot, "mcinitcmd", XSPI_MC_INIT_CMD);
 		break;
 #endif
 #ifdef SD_MC_INIT_CMD
 	case BOOT_SOURCE_SD_MMC:
-	ret = env_set("mcinitcmd", SD_MC_INIT_CMD);
+	ret = env_set(ctx_uboot, "mcinitcmd", SD_MC_INIT_CMD);
 		break;
 #endif
 #ifdef SD2_MC_INIT_CMD
 	case BOOT_SOURCE_SD_MMC2:
-	ret = env_set("mcinitcmd", SD2_MC_INIT_CMD);
+	ret = env_set(ctx_uboot, "mcinitcmd", SD2_MC_INIT_CMD);
 		break;
 #endif
 	default:
 #ifdef QSPI_MC_INIT_CMD
-	ret = env_set("mcinitcmd", QSPI_MC_INIT_CMD);
+	ret = env_set(ctx_uboot, "mcinitcmd", QSPI_MC_INIT_CMD);
 #endif
 		break;
 	}
arch/arm/lib/bootm.c +3 -3
index 1638f1e81d70..df105bc6da72 100644
@@ -227,7 +227,7 @@ static void do_nonsec_virt_switch(void)
 /* Subcommand: PREP */
 static void boot_prep_linux(bootm_headers_t *images)
 {
-	char *commandline = env_get("bootargs");
+	char *commandline = env_get(ctx_uboot, "bootargs");
 
 	if (IMAGE_ENABLE_OF_LIBFDT && images->ft_len) {
 #ifdef CONFIG_OF_LIBFDT
@@ -284,7 +284,7 @@ __weak bool armv7_boot_nonsec_default(void)
 #ifdef CONFIG_ARMV7_NONSEC
 bool armv7_boot_nonsec(void)
 {
-	char *s = env_get("bootm_boot_mode");
+	char *s = env_get(ctx_uboot, "bootm_boot_mode");
 	bool nonsec = armv7_boot_nonsec_default();
 
 	if (s && !strcmp(s, "sec"))
@@ -372,7 +372,7 @@ static void boot_jump_linux(bootm_headers_t *images, int flag)
 	ulong addr = (ulong)kernel_entry | 1;
 	kernel_entry = (void *)addr;
 #endif
-	s = env_get("machid");
+	s = env_get(ctx_uboot, "machid");
 	if (s) {
 		if (strict_strtoul(s, 16, &machid) < 0) {
 			debug("strict_strtoul failed!\n");
arch/arm/lib/semihosting.c +1 -1
index 2658026cf49e..73d18053a1c8 100644
@@ -199,7 +199,7 @@ static int do_smhload(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 		/* Optionally save returned end to the environment */
 		if (argc == 4) {
 			sprintf(end_str, "0x%08lx", end_addr);
-			env_set(argv[3], end_str);
+			env_set(ctx_uboot, argv[3], end_str);
 		}
 	} else {
 		return CMD_RET_USAGE;
arch/arm/mach-imx/mx6/opos6ul.c +2 -2
index 3ab9a3f022f7..a1eb8bbe8417 100644
@@ -127,8 +127,8 @@ int board_late_init(void)
 
 	/* In bootstrap don't use the env vars */
 	if (((reg & 0x3000000) >> 24) == 0x1) {
-		env_set_default(NULL, 0);
-		env_set("preboot", "");
+		env_set_default(ctx_uboot, NULL, 0);
+		env_set(ctx_uboot, "preboot", "");
 	}
 
 	return opos6ul_board_late_init();
arch/arm/mach-imx/mx7/soc.c +2 -2
index 3b8e1ba9c3ac..365488858d39 100644
@@ -307,9 +307,9 @@ int arch_misc_init(void)
 {
 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
 	if (is_mx7d())
-		env_set("soc", "imx7d");
+		env_set(ctx_uboot, "soc", "imx7d");
 	else
-		env_set("soc", "imx7s");
+		env_set(ctx_uboot, "soc", "imx7s");
 #endif
 
 #ifdef CONFIG_FSL_CAAM
arch/arm/mach-imx/video.c +1 -1
index 1bc9b7cc7e15..2deb5b1f9382 100644
@@ -20,7 +20,7 @@ int board_video_skip(void)
 {
 	int i;
 	int ret = 0;
-	char const *panel = env_get("panel");
+	char const *panel = env_get(ctx_uboot, "panel");
 
 	if (!panel) {
 		for (i = 0; i < display_count; i++) {
arch/arm/mach-keystone/ddr3.c +1 -1
index 863ae6321ba3..04559e015bb8 100644
@@ -330,7 +330,7 @@ void ddr3_check_ecc_int(u32 base)
 	int ecc_test = 0;
 	u32 value = __raw_readl(base + KS2_DDR3_ECC_INT_STATUS_OFFSET);
 
-	env = env_get("ecc_test");
+	env = env_get(ctx_uboot, "ecc_test");
 	if (env)
 		ecc_test = simple_strtol(env, NULL, 0);
 
arch/arm/mach-keystone/keystone.c +1 -1
index 7441052a5539..7b1f9e209670 100644
@@ -45,7 +45,7 @@ int misc_init_r(void)
 	char *env;
 	long ks2_debug = 0;
 
-	env = env_get("ks2_debug");
+	env = env_get(ctx_uboot, "ks2_debug");
 
 	if (env)
 		ks2_debug = simple_strtol(env, NULL, 0);
arch/arm/mach-kirkwood/cpu.c +2 -2
index 6ad254343867..31ee6714458a 100644
@@ -91,7 +91,7 @@ static struct mbus_win windows[] = {
 static void kw_sysrst_action(void)
 {
 	int ret;
-	char *s = env_get("sysrstcmd");
+	char *s = env_get(ctx_uboot, "sysrstcmd");
 
 	if (!s) {
 		debug("Error.. %s failed, check sysrstcmd\n",
@@ -115,7 +115,7 @@ static void kw_sysrst_check(void)
 	/*
 	 * no action if sysrstdelay environment variable is not defined
 	 */
-	s = env_get("sysrstdelay");
+	s = env_get(ctx_uboot, "sysrstdelay");
 	if (s == NULL)
 		return;
 
arch/arm/mach-meson/board-common.c +1 -1
index d261b4ea331c..4f005e97fc75 100644
@@ -132,7 +132,7 @@ static void meson_set_boot_source(void)
 		source = "unknown";
 	}
 
-	env_set("boot_source", source);
+	env_set(ctx_uboot, "boot_source", source);
 }
 
 __weak int meson_board_late_init(void)
arch/arm/mach-omap2/utils.c +10 -10
index 0d5ca20e8e87..0d0f33c5e576 100644
@@ -48,7 +48,7 @@ static void omap_set_fastboot_cpu(void)
 		printf("Warning: fastboot.cpu: unknown CPU rev: %u\n", cpu_rev);
 	}
 
-	env_set("fastboot.cpu", cpu);
+	env_set(ctx_uboot, "fastboot.cpu", cpu);
 }
 
 static void omap_set_fastboot_secure(void)
@@ -71,18 +71,18 @@ static void omap_set_fastboot_secure(void)
 		printf("Warning: fastboot.secure: unknown CPU sec: %u\n", dev);
 	}
 
-	env_set("fastboot.secure", secure);
+	env_set(ctx_uboot, "fastboot.secure", secure);
 }
 
 static void omap_set_fastboot_board_rev(void)
 {
 	const char *board_rev;
 
-	board_rev = env_get("board_rev");
+	board_rev = env_get(ctx_uboot, "board_rev");
 	if (board_rev == NULL)
 		printf("Warning: fastboot.board_rev: unknown board revision\n");
 
-	env_set("fastboot.board_rev", board_rev);
+	env_set(ctx_uboot, "fastboot.board_rev", board_rev);
 }
 
 #ifdef CONFIG_FASTBOOT_FLASH_MMC
@@ -122,7 +122,7 @@ static void omap_set_fastboot_userdata_size(void)
 		return; /* probably it's not Android partition table */
 
 	sprintf(buf, "%u", sz_kb);
-	env_set("fastboot.userdata_size", buf);
+	env_set(ctx_uboot, "fastboot.userdata_size", buf);
 }
 #else
 static inline void omap_set_fastboot_userdata_size(void)
@@ -186,11 +186,11 @@ void omap_die_id_serial(void)
 
 	omap_die_id((unsigned int *)&die_id);
 
-	if (!env_get("serial#")) {
+	if (!env_get(ctx_uboot, "serial#")) {
 		snprintf(serial_string, sizeof(serial_string),
 			"%08x%08x", die_id[0], die_id[3]);
 
-		env_set("serial#", serial_string);
+		env_set(ctx_uboot, "serial#", serial_string);
 	}
 }
 
@@ -199,7 +199,7 @@ void omap_die_id_get_board_serial(struct tag_serialnr *serialnr)
 	char *serial_string;
 	unsigned long long serial;
 
-	serial_string = env_get("serial#");
+	serial_string = env_get(ctx_uboot, "serial#");
 
 	if (serial_string) {
 		serial = simple_strtoull(serial_string, NULL, 16);
@@ -219,7 +219,7 @@ void omap_die_id_usbethaddr(void)
 
 	omap_die_id((unsigned int *)&die_id);
 
-	if (!env_get("usbethaddr")) {
+	if (!env_get(ctx_uboot, "usbethaddr")) {
 		/*
 		 * Create a fake MAC address from the processor ID code.
 		 * First byte is 0x02 to signify locally administered.
@@ -233,7 +233,7 @@ void omap_die_id_usbethaddr(void)
 
 		eth_env_set_enetaddr("usbethaddr", mac);
 
-		if (!env_get("ethaddr"))
+		if (!env_get(ctx_uboot, "ethaddr"))
 			eth_env_set_enetaddr("ethaddr", mac);
 	}
 }
arch/arm/mach-rmobile/cpu_info.c +1 -1
index 9ef94a489935..35528a3b90f8 100644
@@ -92,7 +92,7 @@ int arch_misc_init(void)
 	for (i = 0; i < sizeof(cpu); i++)
 		cpu[i] = tolower(rmobile_cpuinfo[idx].cpu_name[i]);
 
-	env_set("platform", cpu);
+	env_set(ctx_uboot, "platform", cpu);
 
 	return 0;
 }
arch/arm/mach-rockchip/boot_mode.c +2 -2
index 08f80bd91aae..158f01e830f5 100644
@@ -72,11 +72,11 @@ int setup_boot_mode(void)
 	switch (boot_mode) {
 	case BOOT_FASTBOOT:
 		debug("%s: enter fastboot!\n", __func__);
-		env_set("preboot", "setenv preboot; fastboot usb0");
+		env_set(ctx_uboot, "preboot", "setenv preboot; fastboot usb0");
 		break;
 	case BOOT_UMS:
 		debug("%s: enter UMS!\n", __func__);
-		env_set("preboot", "setenv preboot; ums mmc 0");
+		env_set(ctx_uboot, "preboot", "setenv preboot; ums mmc 0");
 		break;
 	}
 
arch/arm/mach-rockchip/rk3288/rk3288.c +1 -1
index 057ce920809e..83a7ebc4c1a1 100644
@@ -129,7 +129,7 @@ static void rk3288_detect_reset_reason(void)
 		reason = "unknown reset";
 	}
 
-	env_set("reset_reason", reason);
+	env_set(ctx_uboot, "reset_reason", reason);
 
 	/*
 	 * Clear cru_glb_rst_st, so we can determine the last reset cause
arch/arm/mach-socfpga/misc_gen5.c +3 -2
index 31681b799d46..f56c86ee4500 100644
@@ -134,9 +134,10 @@ int arch_misc_init(void)
 {
 	const u32 bsel = readl(&sysmgr_regs->bootinfo) & 0x7;
 	const int fpga_id = socfpga_fpga_id(0);
-	env_set("bootmode", bsel_str[bsel].mode);
+	env_set(ctx_uboot, "bootmode", bsel_str[bsel].mode);
 	if (fpga_id >= 0)
-		env_set("fpgatype", socfpga_fpga_model[fpga_id].var);
+		env_set(ctx_uboot, "fpgatype",
+			socfpga_fpga_model[fpga_id].var);
 	return 0;
 }
 #endif
arch/arm/mach-socfpga/misc_s10.c +1 -1
index 0a5fab11c0de..c7bec59aff94 100644
@@ -138,7 +138,7 @@ int arch_misc_init(void)
 	char qspi_string[13];
 
 	sprintf(qspi_string, "<0x%08x>", cm_get_qspi_controller_clk_hz());
-	env_set("qspi_clock", qspi_string);
+	env_set(ctx_uboot, "qspi_clock", qspi_string);
 
 	socfpga_set_phymode();
 	return 0;
arch/arm/mach-stm32mp/cpu.c +18 -17
index a46e8438f7c2..6aa7d26bf87b 100644
@@ -380,8 +380,8 @@ static void setup_boot_mode(void)
 					 dev_of_offset(dev), &alias))
 			break;
 		sprintf(cmd, "%d", alias);
-		env_set("boot_device", "serial");
-		env_set("boot_instance", cmd);
+		env_set(ctx_uboot, "boot_device", "serial");
+		env_set(ctx_uboot, "boot_instance", cmd);
 
 		/* restore console on uart when not used */
 		if (gd->cur_serial_dev != dev) {
@@ -391,22 +391,22 @@ static void setup_boot_mode(void)
 		}
 		break;
 	case BOOT_SERIAL_USB:
-		env_set("boot_device", "usb");
-		env_set("boot_instance", "0");
+		env_set(ctx_uboot, "boot_device", "usb");
+		env_set(ctx_uboot, "boot_instance", "0");
 		break;
 	case BOOT_FLASH_SD:
 	case BOOT_FLASH_EMMC:
 		sprintf(cmd, "%d", instance);
-		env_set("boot_device", "mmc");
-		env_set("boot_instance", cmd);
+		env_set(ctx_uboot, "boot_device", "mmc");
+		env_set(ctx_uboot, "boot_instance", cmd);
 		break;
 	case BOOT_FLASH_NAND:
-		env_set("boot_device", "nand");
-		env_set("boot_instance", "0");
+		env_set(ctx_uboot, "boot_device", "nand");
+		env_set(ctx_uboot, "boot_instance", "0");
 		break;
 	case BOOT_FLASH_NOR:
-		env_set("boot_device", "nor");
-		env_set("boot_instance", "0");
+		env_set(ctx_uboot, "boot_device", "nor");
+		env_set(ctx_uboot, "boot_instance", "0");
 		break;
 	default:
 		pr_debug("unexpected boot mode = %x\n", boot_mode);
@@ -416,11 +416,11 @@ static void setup_boot_mode(void)
 	switch (forced_mode) {
 	case BOOT_FASTBOOT:
 		printf("Enter fastboot!\n");
-		env_set("preboot", "env set preboot; fastboot 0");
+		env_set(ctx_uboot, "preboot", "env set preboot; fastboot 0");
 		break;
 	case BOOT_STM32PROG:
-		env_set("boot_device", "usb");
-		env_set("boot_instance", "0");
+		env_set(ctx_uboot, "boot_device", "usb");
+		env_set(ctx_uboot, "boot_instance", "0");
 		break;
 	case BOOT_UMS_MMC0:
 	case BOOT_UMS_MMC1:
@@ -428,10 +428,11 @@ static void setup_boot_mode(void)
 		printf("Enter UMS!\n");
 		instance = forced_mode - BOOT_UMS_MMC0;
 		sprintf(cmd, "env set preboot; ums 0 mmc %d", instance);
-		env_set("preboot", cmd);
+		env_set(ctx_uboot, "preboot", cmd);
 		break;
 	case BOOT_RECOVERY:
-		env_set("preboot", "env set preboot; run altbootcmd");
+		env_set(ctx_uboot, "preboot",
+			"env set preboot; run altbootcmd");
 		break;
 	case BOOT_NORMAL:
 		break;
@@ -496,7 +497,7 @@ static int setup_serial_number(void)
 	struct udevice *dev;
 	int ret;
 
-	if (env_get("serial#"))
+	if (env_get(ctx_uboot, "serial#"))
 		return 0;
 
 	ret = uclass_get_device_by_driver(UCLASS_MISC,
@@ -511,7 +512,7 @@ static int setup_serial_number(void)
 		return ret;
 
 	sprintf(serial_string, "%08X%08X%08X", otp[0], otp[1], otp[2]);
-	env_set("serial#", serial_string);
+	env_set(ctx_uboot, "serial#", serial_string);
 
 	return 0;
 }
arch/arm/mach-tegra/board2.c +2 -2
index f13bd256cc2a..1711424151ca 100644
@@ -240,9 +240,9 @@ int board_late_init(void)
 #if defined(CONFIG_TEGRA_SUPPORT_NON_SECURE)
 	if (tegra_cpu_is_non_secure()) {
 		printf("CPU is in NS mode\n");
-		env_set("cpu_ns_mode", "1");
+		env_set(ctx_uboot, "cpu_ns_mode", "1");
 	} else {
-		env_set("cpu_ns_mode", "");
+		env_set(ctx_uboot, "cpu_ns_mode", "");
 	}
 #endif
 	start_cpu_fan();
arch/arm/mach-tegra/cboot.c +9 -9
index 0433081c6c55..ec24447a6b4a 100644
@@ -315,7 +315,7 @@ static void set_calculated_aliases(char *aliases, u64 address)
 		if (!alias)
 			break;
 		debug("%s: alias: %s\n", __func__, alias);
-		err = env_set_hex(alias, address);
+		err = env_set_hex(ctx_uboot, alias, address);
 		if (err)
 			pr_err("Could not set %s\n", alias);
 	}
@@ -349,17 +349,17 @@ static void set_calculated_env_var(const char *var)
 	if (!var_aliases)
 		goto out_free_var_offset;
 
-	size = env_get_hex(var_size, 0);
+	size = env_get_hex(ctx_uboot, var_size, 0);
 	if (!size) {
 		pr_err("%s not set or zero\n", var_size);
 		goto out_free_var_aliases;
 	}
-	align = env_get_hex(var_align, 1);
+	align = env_get_hex(ctx_uboot, var_align, 1);
 	/* Handle extant variables, but with a value of 0 */
 	if (!align)
 		align = 1;
-	offset = env_get_hex(var_offset, 0);
-	aliases = env_get(var_aliases);
+	offset = env_get_hex(ctx_uboot, var_offset, 0);
+	aliases = env_get(ctx_uboot, var_aliases);
 
 	debug("%s: Calc var %s; size=%llx, align=%llx, offset=%llx\n",
 	      __func__, var, size, align, offset);
@@ -373,7 +373,7 @@ static void set_calculated_env_var(const char *var)
 	}
 	debug("%s: Address %llx\n", __func__, address);
 
-	err = env_set_hex(var, address);
+	err = env_set_hex(ctx_uboot, var, address);
 	if (err)
 		pr_err("Could not set %s\n", var);
 	if (aliases)
@@ -423,7 +423,7 @@ static void set_calculated_env_vars(void)
 	dump_ram_banks();
 #endif
 
-	vars = env_get("calculated_vars");
+	vars = env_get(ctx_uboot, "calculated_vars");
 	if (!vars) {
 		debug("%s: No env var calculated_vars\n", __func__);
 		return;
@@ -455,7 +455,7 @@ static int set_fdt_addr(void)
 {
 	int ret;
 
-	ret = env_set_hex("fdt_addr", cboot_boot_x0);
+	ret = env_set_hex(ctx_uboot, "fdt_addr", cboot_boot_x0);
 	if (ret) {
 		printf("Failed to set fdt_addr to point at DTB: %d\n", ret);
 		return ret;
@@ -612,7 +612,7 @@ int cboot_late_init(void)
 
 	bootargs = cboot_get_bootargs(fdt);
 	if (bootargs) {
-		env_set("cbootargs", bootargs);
+		env_set(ctx_uboot, "cbootargs", bootargs);
 		free(bootargs);
 	}
 
arch/arm/mach-uniphier/board_late_init.c +10 -9
index 14b61fc7dfda..4eefe85c539d 100644
@@ -40,7 +40,7 @@ static void uniphier_set_env_fdt_file(void)
 	int buf_len = sizeof(dtb_name);
 	int ret;
 
-	if (env_get("fdtfile"))
+	if (env_get(ctx_uboot, "fdtfile"))
 		return;		/* do nothing if it is already set */
 
 	compat = fdt_stringlist_get(gd->fdt_blob, 0, "compatible", 0, NULL);
@@ -58,7 +58,7 @@ static void uniphier_set_env_fdt_file(void)
 
 	strncat(dtb_name, ".dtb", buf_len);
 
-	ret = env_set("fdtfile", dtb_name);
+	ret = env_set(ctx_uboot, "fdtfile", dtb_name);
 	if (ret)
 		goto fail;
 
@@ -74,11 +74,11 @@ static void uniphier_set_env_addr(const char *env, const char *offset_env)
 	char *end;
 	int ret;
 
-	if (env_get(env))
+	if (env_get(ctx_uboot, env))
 		return;		/* do nothing if it is already set */
 
 	if (offset_env) {
-		str = env_get(offset_env);
+		str = env_get(ctx_uboot, offset_env);
 		if (!str)
 			goto fail;
 
@@ -87,7 +87,7 @@ static void uniphier_set_env_addr(const char *env, const char *offset_env)
 			goto fail;
 	}
 
-	ret = env_set_hex(env, gd->ram_base + offset);
+	ret = env_set_hex(ctx_uboot, env, gd->ram_base + offset);
 	if (ret)
 		goto fail;
 
@@ -95,6 +95,7 @@ static void uniphier_set_env_addr(const char *env, const char *offset_env)
 
 fail:
 	pr_warn("\"%s\" environment variable was not set correctly\n", env);
+	return env_set(ctx_uboot, "fdtfile", dtb_name);
 }
 
 int board_late_init(void)
@@ -104,7 +105,7 @@ int board_late_init(void)
 	switch (uniphier_boot_device_raw()) {
 	case BOOT_DEVICE_MMC1:
 		printf("eMMC Boot");
-		env_set("bootdev", "emmc");
+		env_set(ctx_uboot, "bootdev", "emmc");
 		break;
 	case BOOT_DEVICE_MMC2:
 		printf("SD Boot");
@@ -112,16 +113,16 @@ int board_late_init(void)
 		break;
 	case BOOT_DEVICE_NAND:
 		printf("NAND Boot");
-		env_set("bootdev", "nand");
+		env_set(ctx_uboot, "bootdev", "nand");
 		nand_denali_wp_disable();
 		break;
 	case BOOT_DEVICE_NOR:
 		printf("NOR Boot");
-		env_set("bootdev", "nor");
+		env_set(ctx_uboot, "bootdev", "nor");
 		break;
 	case BOOT_DEVICE_USB:
 		printf("USB Boot");
-		env_set("bootdev", "usb");
+		env_set(ctx_uboot, "bootdev", "usb");
 		break;
 	default:
 		printf("Unknown");
arch/arm/mach-uniphier/mmc-first-dev.c +1 -1
index 149e662070ff..0298813303ba 100644
@@ -35,7 +35,7 @@ static int do_mmcsetn(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	if (dev < 0)
 		return CMD_RET_FAILURE;
 
-	env_set_ulong("mmc_first_dev", dev);
+	env_set_ulong(ctx_uboot, "mmc_first_dev", dev);
 	return CMD_RET_SUCCESS;
 }
 
arch/m68k/lib/bootm.c +1 -1
index 19445b3fc7a5..9160dc4ca50b 100644
@@ -112,7 +112,7 @@ static void set_clocks_in_mhz (bd_t *kbd)
 {
 	char *s;
 
-	s = env_get("clocks_in_mhz");
+	s = env_get(ctx_uboot, "clocks_in_mhz");
 	if (s) {
 		/* convert all clock information to MHz */
 		kbd->bi_intfreq /= 1000000L;
arch/microblaze/lib/bootm.c +1 -1
index ec332944d8e8..95ee555edb53 100644
@@ -20,7 +20,7 @@ int do_bootm_linux(int flag, int argc, char * const argv[],
 {
 	/* First parameter is mapped to $r5 for kernel boot args */
 	void	(*thekernel) (char *, ulong, ulong);
-	char	*commandline = env_get("bootargs");
+	char	*commandline = env_get(ctx_uboot, "bootargs");
 	ulong	rd_data_start, rd_data_end;
 
 	/*
arch/mips/lib/bootm.c +3 -3
index 8c0d7672f24c..07c9582cc847 100644
@@ -80,7 +80,7 @@ static void linux_cmdline_legacy(bootm_headers_t *images)
 
 	linux_cmdline_init();
 
-	bootargs = env_get("bootargs");
+	bootargs = env_get(ctx_uboot, "bootargs");
 	if (!bootargs)
 		return;
 
@@ -202,11 +202,11 @@ static void linux_env_legacy(bootm_headers_t *images)
 	sprintf(env_buf, "0x%X", (uint) (gd->bd->bi_flashsize));
 	linux_env_set("flash_size", env_buf);
 
-	cp = env_get("ethaddr");
+	cp = env_get(ctx_uboot, "ethaddr");
 	if (cp)
 		linux_env_set("ethaddr", cp);
 
-	cp = env_get("eth1addr");
+	cp = env_get(ctx_uboot, "eth1addr");
 	if (cp)
 		linux_env_set("eth1addr", cp);
 
arch/nds32/lib/bootm.c +2 -2
index a472f6a18737..1a50a8b5aefb 100644
@@ -43,7 +43,7 @@ int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images)
 	void	(*theKernel)(int zero, int arch, uint params);
 
 #ifdef CONFIG_CMDLINE_TAG
-	char *commandline = env_get("bootargs");
+	char *commandline = env_get(ctx_uboot, "bootargs");
 #endif
 
 	/*
@@ -57,7 +57,7 @@ int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images)
 
 	theKernel = (void (*)(int, int, uint))images->ep;
 
-	s = env_get("machid");
+	s = env_get(ctx_uboot, "machid");
 	if (s) {
 		machid = simple_strtoul(s, NULL, 16);
 		printf("Using machid 0x%x from environment\n", machid);
arch/powerpc/cpu/mpc85xx/cpu_init.c +5 -5
index cac928079042..c4800f2c410f 100644
@@ -255,7 +255,7 @@ static void enable_tdm_law(void)
 	 * is not setup properly yet. Search for tdm entry in
 	 * hwconfig.
 	 */
-	ret = env_get_f("hwconfig", buffer, sizeof(buffer));
+	ret = env_get_f(ctx_uboot, "hwconfig", buffer, sizeof(buffer));
 	if (ret > 0) {
 		tdm_hwconfig_enabled = hwconfig_f("tdm", buffer);
 		/* If tdm is defined in hwconfig, set law for tdm workaround */
@@ -279,7 +279,7 @@ void enable_cpc(void)
 	cpc_corenet_t *cpc = (cpc_corenet_t *)CONFIG_SYS_FSL_CPC_ADDR;
 
 	/* Extract hwconfig from environment */
-	ret = env_get_f("hwconfig", buffer, sizeof(buffer));
+	ret = env_get_f(ctx_uboot, "hwconfig", buffer, sizeof(buffer));
 	if (ret > 0) {
 		/*
 		 * If "en_cpc" is not defined in hwconfig then by default all
@@ -753,7 +753,7 @@ int cpu_init_r(void)
 	char *buf = NULL;
 	int n, res;
 
-	n = env_get_f("hwconfig", buffer, sizeof(buffer));
+	n = env_get_f(ctx_uboot, "hwconfig", buffer, sizeof(buffer));
 	if (n > 0)
 		buf = buffer;
 
@@ -793,7 +793,7 @@ int cpu_init_r(void)
 #endif
 
 #if defined(CONFIG_PPC_SPINTABLE_COMPATIBLE) && defined(CONFIG_MP)
-	spin = env_get("spin_table_compat");
+	spin = env_get(ctx_uboot, "spin_table_compat");
 	if (spin && (*spin == 'n'))
 		spin_table_compat = 0;
 	else
@@ -844,7 +844,7 @@ int cpu_init_r(void)
 #ifdef CONFIG_SYS_SRIO
 	srio_init();
 #ifdef CONFIG_SRIO_PCIE_BOOT_MASTER
-	char *s = env_get("bootmaster");
+	char *s = env_get(ctx_uboot, "bootmaster");
 	if (s) {
 		if (!strcmp(s, "SRIO1")) {
 			srio_boot_master(1);
arch/powerpc/cpu/mpc85xx/fdt.c +1 -1
index db12aefb2903..096019073a24 100644
@@ -93,7 +93,7 @@ void ft_fixup_cpu(void *blob, u64 memory_limit)
 	 * Extract hwconfig from environment.
 	 * Search for tdm entry in hwconfig.
 	 */
-	ret = env_get_f("hwconfig", buffer, sizeof(buffer));
+	ret = env_get_f(ctx_uboot, "hwconfig", buffer, sizeof(buffer));
 	if (ret > 0)
 		tdm_hwconfig_enabled = hwconfig_f("tdm", buffer);
 
arch/powerpc/cpu/mpc85xx/fsl_corenet_serdes.c +1 -1
index fcfa73023347..7aac230f3fee 100644
@@ -514,7 +514,7 @@ void fsl_serdes_init(void)
 	 * Extract hwconfig from environment since we have not properly setup
 	 * the environment but need it for ddr config params
 	 */
-	if (env_get_f("hwconfig", buffer, sizeof(buffer)) > 0)
+	if (env_get_f(ctx_uboot, "hwconfig", buffer, sizeof(buffer)) > 0)
 		buf = buffer;
 #endif
 	if (serdes_prtcl_map & (1 << NONE))
arch/powerpc/lib/bootm.c +1 -1
index 84691b755463..16dbe520afcb 100644
@@ -269,7 +269,7 @@ static void set_clocks_in_mhz (bd_t *kbd)
 {
 	char	*s;
 
-	s = env_get("clocks_in_mhz");
+	s = env_get(ctx_uboot, "clocks_in_mhz");
 	if (s) {
 		/* convert all clock information to MHz */
 		kbd->bi_intfreq /= 1000000L;
arch/sh/lib/bootm.c +1 -1
index 2896e45f0df8..86aa49d0d0ba 100644
@@ -60,7 +60,7 @@ int do_bootm_linux(int flag, int argc, char * const argv[], bootm_headers_t *ima
 	char *cmdline = (char *)param + COMMAND_LINE;
 	/* PAGE_SIZE */
 	unsigned long size = images->ep - (unsigned long)param;
-	char *bootargs = env_get("bootargs");
+	char *bootargs = env_get(ctx_uboot, "bootargs");
 
 	/*
 	 * allow the PREP bootm subcommand, it is required for bootm to work
arch/sh/lib/zimageboot.c +1 -1
index 93933b7931d7..769535e1a3c8 100644
@@ -41,7 +41,7 @@ int do_sh_zimageboot (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 
 	/* Linux kernel command line */
 	cmdline = (char *)param + COMMAND_LINE;
-	bootargs = env_get("bootargs");
+	bootargs = env_get(ctx_uboot, "bootargs");
 
 	/* Clear zero page */
 	/* cppcheck-suppress nullPointer */
arch/x86/lib/zimage.c +6 -5
index 6a6258a5057a..996fb015871f 100644
@@ -49,15 +49,15 @@ static void build_command_line(char *command_line, int auto_boot)
 
 	command_line[0] = '\0';
 
-	env_command_line =  env_get("bootargs");
+	env_command_line =  env_get(ctx_uboot, "bootargs");
 
 	/* set console= argument if we use a serial console */
 	if (!strstr(env_command_line, "console=")) {
-		if (!strcmp(env_get("stdout"), "serial")) {
+		if (!strcmp(env_get(ctx_uboot, "stdout"), "serial")) {
 
 			/* We seem to use serial console */
 			sprintf(command_line, "console=ttyS0,%s ",
-				env_get("baudrate"));
+				env_get(ctx_uboot, "baudrate"));
 		}
 	}
 
@@ -288,7 +288,8 @@ int setup_zimage(struct boot_params *setup_base, char *cmd_line, int auto_boot,
 		hdr->hardware_subarch = X86_SUBARCH_INTEL_MID;
 #endif
 
-	setup_device_tree(hdr, (const void *)env_get_hex("fdtaddr", 0));
+	setup_device_tree(hdr, (const void *)env_get_hex(ctx_uboot, "fdtaddr",
+							 0));
 	setup_video(&setup_base->screen_info);
 
 #ifdef CONFIG_EFI_STUB
@@ -324,7 +325,7 @@ int do_zboot(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
 		/* argv[1] holds the address of the bzImage */
 		s = argv[1];
 	} else {
-		s = env_get("fileaddr");
+		s = env_get(ctx_uboot, "fileaddr");
 	}
 
 	if (s)
arch/xtensa/lib/bootm.c +1 -1
index 93eea53c5f29..d41b544faa9a 100644
@@ -136,7 +136,7 @@ int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images)
 {
 	struct bp_tag *params, *params_start;
 	ulong initrd_start, initrd_end;
-	char *commandline = env_get("bootargs");
+	char *commandline = env_get(ctx_uboot, "bootargs");
 
 	if (!(flag & (BOOTM_STATE_OS_GO | BOOTM_STATE_OS_FAKE_GO)))
 		return 0;
Signature · 1 line
2.21.0
#11 lore raw

PATCH v5 9/19 board: converted with new env interfaces

In reply to AKASHI Takahiro

env_xxx(...) -> env_xxx(ctx_uboot, ...)

---
 board/Arcturus/ucp1020/cmd_arc.c              | 40 ++++++------
 board/Arcturus/ucp1020/ucp1020.c              | 16 ++---
 board/BuR/brppt1/board.c                      |  4 +-
 board/BuR/brxre1/board.c                      |  9 +--
 board/BuR/common/br_resetc.c                  |  2 +-
 board/BuR/common/common.c                     | 47 +++++++-------
 board/BuS/eb_cpu5282/eb_cpu5282.c             |  8 +--
 board/CZ.NIC/turris_mox/turris_mox.c          |  4 +-
 board/CZ.NIC/turris_omnia/turris_omnia.c      |  6 +-
 board/CarMediaLab/flea3/flea3.c               |  2 +-
 board/LaCie/net2big_v2/net2big_v2.c           |  2 +-
 board/LaCie/netspace_v2/netspace_v2.c         |  2 +-
 board/Synology/ds414/cmd_syno.c               |  6 +-
 board/alliedtelesis/x530/x530.c               |  2 +-
 board/amazon/kc1/kc1.c                        |  4 +-
 board/amlogic/p200/p200.c                     |  4 +-
 board/amlogic/p201/p201.c                     |  4 +-
 board/amlogic/p212/p212.c                     |  4 +-
 board/amlogic/q200/q200.c                     |  4 +-
 board/aristainetos/aristainetos-v2.c          |  8 +--
 board/armltd/integrator/integrator.c          |  2 +-
 board/atmel/common/board.c                    |  4 +-
 board/atmel/common/mac_eeprom.c               |  2 +-
 board/atmel/sama5d3xek/sama5d3xek.c           |  2 +-
 board/bachmann/ot1200/ot1200.c                |  4 +-
 board/birdland/bav335x/board.c                |  8 +--
 board/bluegiga/apx4devkit/apx4devkit.c        |  5 +-
 board/bluewater/gurnard/gurnard.c             |  6 +-
 board/bosch/shc/board.c                       |  2 +-
 board/boundary/nitrogen6x/nitrogen6x.c        | 14 ++---
 board/broadcom/bcm23550_w1d/bcm23550_w1d.c    |  2 +-
 board/broadcom/bcm28155_ap/bcm28155_ap.c      |  2 +-
 board/broadcom/bcmstb/bcmstb.c                |  2 +-
 board/buffalo/lsxl/lsxl.c                     |  2 +-
 board/cadence/xtfpga/xtfpga.c                 |  4 +-
 board/ccv/xpress/xpress.c                     |  2 +-
 board/compulab/cl-som-imx7/cl-som-imx7.c      |  2 +-
 board/compulab/cm_fx6/cm_fx6.c                | 10 +--
 board/compulab/common/omap3_display.c         |  4 +-
 board/congatec/cgtqmx6eval/cgtqmx6eval.c      |  8 +--
 board/cssi/MCR3000/MCR3000.c                  |  2 +-
 board/davinci/da8xxevm/da850evm.c             |  2 +-
 board/davinci/da8xxevm/omapl138_lcdk.c        |  6 +-
 board/dhelectronics/dh_imx6/dh_imx6.c         |  2 +-
 board/eets/pdu001/board.c                     |  8 +--
 board/el/el6x/el6x.c                          |  2 +-
 board/emulation/qemu-riscv/qemu-riscv.c       |  2 +-
 board/engicam/common/board.c                  | 32 +++++-----
 board/esd/meesc/meesc.c                       |  6 +-
 board/freescale/b4860qds/b4860qds.c           |  5 +-
 board/freescale/common/cmd_esbc_validate.c    |  2 +-
 board/freescale/common/fsl_chain_of_trust.c   |  6 +-
 board/freescale/common/sys_eeprom.c           |  4 +-
 board/freescale/common/vid.c                  |  4 +-
 board/freescale/imx8mq_evk/imx8mq_evk.c       |  4 +-
 board/freescale/imx8qm_mek/imx8qm_mek.c       |  4 +-
 board/freescale/imx8qxp_mek/imx8qxp_mek.c     |  4 +-
 board/freescale/ls1088a/eth_ls1088aqds.c      |  4 +-
 board/freescale/ls1088a/ls1088a.c             |  2 +-
 board/freescale/ls2080aqds/eth.c              |  6 +-
 board/freescale/ls2080aqds/ls2080aqds.c       |  2 +-
 board/freescale/ls2080ardb/ls2080ardb.c       |  6 +-
 board/freescale/lx2160a/eth_lx2160aqds.c      |  2 +-
 board/freescale/mpc8323erdb/mpc8323erdb.c     |  3 +-
 board/freescale/mpc837xemds/pci.c             |  2 +-
 board/freescale/mpc837xerdb/mpc837xerdb.c     |  2 +-
 board/freescale/mx51evk/mx51evk_video.c       |  2 +-
 board/freescale/mx53loco/mx53loco.c           |  4 +-
 board/freescale/mx53loco/mx53loco_video.c     |  2 +-
 board/freescale/mx6sabreauto/mx6sabreauto.c   |  8 +--
 board/freescale/mx6sabresd/mx6sabresd.c       |  8 +--
 board/freescale/mx6sxsabresd/mx6sxsabresd.c   |  2 +-
 .../mx6ul_14x14_evk/mx6ul_14x14_evk.c         |  6 +-
 board/freescale/mx6ullevk/mx6ullevk.c         |  4 +-
 board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c   |  2 +-
 board/freescale/qemu-ppce500/qemu-ppce500.c   |  4 +-
 board/freescale/t4qds/t4240qds.c              |  2 +-
 board/gardena/smart-gateway-at91sam/board.c   |  2 +-
 board/gardena/smart-gateway-mt7688/board.c    | 16 ++---
 board/gateworks/gw_ventana/common.c           |  2 +-
 board/gateworks/gw_ventana/gw_ventana.c       | 61 ++++++++++---------
 board/gateworks/gw_ventana/gw_ventana_spl.c   |  4 +-
 board/gdsys/a38x/keyprogram.c                 |  4 +-
 board/gdsys/mpc8308/gazerbeam.c               |  4 +-
 board/gdsys/mpc8308/hrcon.c                   |  2 +-
 board/gdsys/mpc8308/strider.c                 |  2 +-
 board/gdsys/p1022/controlcenterd-id.c         | 10 +--
 board/gdsys/p1022/controlcenterd.c            |  2 +-
 board/ge/bx50v3/bx50v3.c                      | 13 ++--
 board/ge/common/ge_common.c                   |  4 +-
 board/ge/mx53ppd/mx53ppd.c                    |  2 +-
 board/grinn/chiliboard/board.c                |  4 +-
 board/grinn/liteboard/board.c                 |  6 +-
 board/highbank/highbank.c                     |  9 +--
 board/hisilicon/poplar/poplar.c               |  2 +-
 board/imgtec/ci20/ci20.c                      |  6 +-
 board/intel/edison/edison.c                   | 14 ++---
 board/isee/igep003x/board.c                   |  6 +-
 board/isee/igep00x0/igep00x0.c                |  4 +-
 board/k+p/kp_imx53/kp_id_rev.c                | 20 +++---
 board/k+p/kp_imx53/kp_imx53.c                 |  4 +-
 board/k+p/kp_imx6q_tpc/kp_imx6q_tpc.c         |  4 +-
 board/keymile/common/common.c                 | 26 ++++----
 board/keymile/common/ivm.c                    |  8 +--
 board/keymile/km83xx/km83xx.c                 |  2 +-
 board/keymile/km_arm/km_arm.c                 |  6 +-
 board/keymile/kmp204x/kmp204x.c               |  4 +-
 board/kosagi/novena/novena.c                  |  2 +-
 board/laird/wb50n/wb50n.c                     |  2 +-
 board/lg/sniper/sniper.c                      |  4 +-
 board/liebherr/display5/spl.c                 |  4 +-
 board/liebherr/mccmon6/mccmon6.c              |  6 +-
 board/logicpd/imx6/imx6logic.c                |  8 +--
 board/menlo/m53menlo/m53menlo.c               |  2 +-
 board/micronas/vct/vct.c                      |  2 +-
 board/nokia/rx51/rx51.c                       | 10 +--
 board/overo/overo.c                           | 45 +++++++-------
 board/phytec/pcm052/pcm052.c                  |  4 +-
 board/phytec/pfla02/pfla02.c                  |  2 +-
 .../dragonboard410c/dragonboard410c.c         |  6 +-
 .../dragonboard820c/dragonboard820c.c         |  2 +-
 board/raspberrypi/rpi/rpi.c                   | 26 ++++----
 board/renesas/alt/alt.c                       |  3 +-
 board/renesas/gose/gose.c                     |  3 +-
 board/renesas/koelsch/koelsch.c               |  3 +-
 board/renesas/lager/lager.c                   |  3 +-
 board/renesas/porter/porter.c                 |  3 +-
 board/renesas/sh7752evb/sh7752evb.c           |  4 +-
 board/renesas/sh7753evb/sh7753evb.c           |  4 +-
 board/renesas/sh7757lcr/sh7757lcr.c           |  6 +-
 board/renesas/silk/silk.c                     |  3 +-
 board/renesas/stout/stout.c                   |  3 +-
 board/rockchip/kylin_rk3036/kylin_rk3036.c    |  2 +-
 board/samsung/common/exynos5-dt.c             |  2 +-
 board/samsung/common/misc.c                   | 14 ++---
 board/samsung/odroid/odroid.c                 |  2 +-
 board/samsung/trats/trats.c                   |  2 +-
 board/samsung/universal_c210/universal.c      |  2 +-
 board/samtec/vining_fpga/socfpga.c            | 16 ++---
 board/siemens/common/board.c                  |  4 +-
 board/siemens/draco/board.c                   |  6 +-
 board/siemens/pxm2/board.c                    |  4 +-
 board/siemens/rut/board.c                     |  2 +-
 board/siemens/taurus/taurus.c                 | 50 +++++++--------
 board/socrates/socrates.c                     |  4 +-
 board/softing/vining_2000/vining_2000.c       |  8 +--
 board/solidrun/mx6cuboxi/mx6cuboxi.c          | 16 ++---
 .../stm32f429-discovery/stm32f429-discovery.c |  4 +-
 .../stm32f429-evaluation.c                    |  4 +-
 .../stm32f469-discovery/stm32f469-discovery.c |  4 +-
 board/st/stm32mp1/stm32mp1.c                  | 11 ++--
 board/sunxi/board.c                           | 25 ++++----
 board/synopsys/hsdk/env-lib.c                 | 11 ++--
 board/synopsys/hsdk/hsdk.c                    |  6 +-
 board/syteco/zmx25/zmx25.c                    |  8 ++-
 board/tcl/sl50/board.c                        |  6 +-
 .../puma_rk3399/puma-rk3399.c                 |  8 +--
 board/ti/am335x/board.c                       | 18 +++---
 board/ti/am43xx/board.c                       |  6 +-
 board/ti/am57xx/board.c                       | 14 ++---
 board/ti/beagle/beagle.c                      | 43 ++++++-------
 board/ti/common/board_detect.c                | 14 ++---
 board/ti/dra7xx/evm.c                         | 12 ++--
 board/ti/evm/evm.c                            |  2 +-
 board/ti/ks2_evm/board.c                      | 10 +--
 board/ti/ks2_evm/board_k2g.c                  |  8 +--
 board/ti/panda/panda.c                        |  4 +-
 board/toradex/apalis-imx8/apalis-imx8.c       |  4 +-
 board/toradex/apalis_imx6/apalis_imx6.c       | 12 ++--
 .../toradex/colibri-imx6ull/colibri-imx6ull.c |  6 +-
 board/toradex/colibri-imx8x/colibri-imx8x.c   |  4 +-
 board/toradex/colibri_imx6/colibri_imx6.c     |  8 +--
 board/toradex/colibri_vf/colibri_vf.c         |  2 +-
 board/toradex/common/tdx-cfg-block.c          |  2 +-
 board/toradex/common/tdx-common.c             |  2 +-
 board/tqc/tqma6/tqma6.c                       |  2 +-
 board/udoo/neo/neo.c                          |  2 +-
 board/udoo/udoo.c                             |  4 +-
 board/varisys/common/sys_eeprom.c             |  6 +-
 board/vscom/baltos/board.c                    |  6 +-
 board/wandboard/wandboard.c                   | 12 ++--
 board/warp7/warp7.c                           |  6 +-
 .../work_92105/work_92105_display.c           |  2 +-
 board/xes/common/board.c                      |  6 +-
 board/xilinx/zynq/board.c                     | 16 ++---
 board/xilinx/zynqmp/cmds.c                    |  2 +-
 board/xilinx/zynqmp/zynqmp.c                  | 24 ++++----
 187 files changed, 677 insertions(+), 649 deletions(-)
board/Arcturus/ucp1020/cmd_arc.c +20 -20
index 2e8477ed3b7a..fbe1f2dba123 100644
@@ -252,8 +252,8 @@ static int read_arc_info(void)
 static int do_get_arc_info(void)
 {
 	int l = read_arc_info();
-	char *oldserial = env_get("SERIAL");
-	char *oldversion = env_get("VERSION");
+	char *oldserial = env_get(ctx_uboot, "SERIAL");
+	char *oldversion = env_get(ctx_uboot, "VERSION");
 
 	if (oldversion != NULL)
 		if (strcmp(oldversion, U_BOOT_VERSION) != 0)
@@ -269,13 +269,13 @@ static int do_get_arc_info(void)
 		printf("<not found>\n");
 	} else {
 		printf("%s\n", smac[0]);
-		env_set("SERIAL", smac[0]);
+		env_set(ctx_uboot, "SERIAL", smac[0]);
 	}
 
 	if (strcmp(smac[1], "00:00:00:00:00:00") == 0) {
-		env_set("ethaddr", NULL);
-		env_set("eth1addr", NULL);
-		env_set("eth2addr", NULL);
+		env_set(ctx_uboot, "ethaddr", NULL);
+		env_set(ctx_uboot, "eth1addr", NULL);
+		env_set(ctx_uboot, "eth2addr", NULL);
 		goto done;
 	}
 
@@ -283,13 +283,13 @@ static int do_get_arc_info(void)
 	if (smac[1][0] == EMPY_CHAR) {
 		printf("<not found>\n");
 	} else {
-		char *ret = env_get("ethaddr");
+		char *ret = env_get(ctx_uboot, "ethaddr");
 
 		if (ret == NULL) {
-			env_set("ethaddr", smac[1]);
+			env_set(ctx_uboot, "ethaddr", smac[1]);
 			printf("%s\n", smac[1]);
 		} else if (strcmp(ret, __stringify(CONFIG_ETHADDR)) == 0) {
-			env_set("ethaddr", smac[1]);
+			env_set(ctx_uboot, "ethaddr", smac[1]);
 			printf("%s (factory)\n", smac[1]);
 		} else {
 			printf("%s\n", ret);
@@ -297,8 +297,8 @@ static int do_get_arc_info(void)
 	}
 
 	if (strcmp(smac[2], "00:00:00:00:00:00") == 0) {
-		env_set("eth1addr", NULL);
-		env_set("eth2addr", NULL);
+		env_set(ctx_uboot, "eth1addr", NULL);
+		env_set(ctx_uboot, "eth2addr", NULL);
 		goto done;
 	}
 
@@ -306,13 +306,13 @@ static int do_get_arc_info(void)
 	if (smac[2][0] == EMPY_CHAR) {
 		printf("<not found>\n");
 	} else {
-		char *ret = env_get("eth1addr");
+		char *ret = env_get(ctx_uboot, "eth1addr");
 
 		if (ret == NULL) {
-			env_set("ethaddr", smac[2]);
+			env_set(ctx_uboot, "ethaddr", smac[2]);
 			printf("%s\n", smac[2]);
 		} else if (strcmp(ret, __stringify(CONFIG_ETH1ADDR)) == 0) {
-			env_set("eth1addr", smac[2]);
+			env_set(ctx_uboot, "eth1addr", smac[2]);
 			printf("%s (factory)\n", smac[2]);
 		} else {
 			printf("%s\n", ret);
@@ -320,7 +320,7 @@ static int do_get_arc_info(void)
 	}
 
 	if (strcmp(smac[3], "00:00:00:00:00:00") == 0) {
-		env_set("eth2addr", NULL);
+		env_set(ctx_uboot, "eth2addr", NULL);
 		goto done;
 	}
 
@@ -328,13 +328,13 @@ static int do_get_arc_info(void)
 	if (smac[3][0] == EMPY_CHAR) {
 		printf("<not found>\n");
 	} else {
-		char *ret = env_get("eth2addr");
+		char *ret = env_get(ctx_uboot, "eth2addr");
 
 		if (ret == NULL) {
-			env_set("ethaddr", smac[3]);
+			env_set(ctx_uboot, "ethaddr", smac[3]);
 			printf("%s\n", smac[3]);
 		} else if (strcmp(ret, __stringify(CONFIG_ETH2ADDR)) == 0) {
-			env_set("eth2addr", smac[3]);
+			env_set(ctx_uboot, "eth2addr", smac[3]);
 			printf("%s (factory)\n", smac[3]);
 		} else {
 			printf("%s\n", ret);
@@ -343,8 +343,8 @@ static int do_get_arc_info(void)
 done:
 	if (oldserial == NULL || oldversion == NULL) {
 		if (oldversion == NULL)
-			env_set("VERSION", U_BOOT_VERSION);
-		env_save();
+			env_set(ctx_uboot, "VERSION", U_BOOT_VERSION);
+		env_save(ctx_uboot);
 	}
 
 	return 0;
board/Arcturus/ucp1020/ucp1020.c +8 -8
index 6a880c97bcb7..1aa7f96b5e1c 100644
@@ -64,7 +64,7 @@ void board_gpio_init(void)
 
 	for (i = 0; i < GPIO_MAX_NUM; i++) {
 		sprintf(envname, "GPIO%d", i);
-		val = env_get(envname);
+		val = env_get(ctx_uboot, envname);
 		if (val) {
 			char direction = toupper(val[0]);
 			char level = toupper(val[1]);
@@ -82,7 +82,7 @@ void board_gpio_init(void)
 		}
 	}
 
-	val = env_get("PCIE_OFF");
+	val = env_get(ctx_uboot, "PCIE_OFF");
 	if (val) {
 		gpio_direction_input(GPIO_PCIE1_EN);
 		gpio_direction_input(GPIO_PCIE2_EN);
@@ -91,7 +91,7 @@ void board_gpio_init(void)
 		gpio_direction_output(GPIO_PCIE2_EN, 1);
 	}
 
-	val = env_get("SDHC_CDWP_OFF");
+	val = env_get(ctx_uboot, "SDHC_CDWP_OFF");
 	if (!val) {
 		ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
 
@@ -218,7 +218,7 @@ int last_stage_init(void)
 	else
 		printf("NCT72(0x%x): ready\n", id2);
 
-	kval = env_get("kernelargs");
+	kval = env_get(ctx_uboot, "kernelargs");
 
 #ifdef CONFIG_MMC
 	mmc = find_mmc_device(0);
@@ -235,22 +235,22 @@ int last_stage_init(void)
 				strcat(newkernelargs, mmckargs);
 				strcat(newkernelargs, " ");
 				strcat(newkernelargs, &tmp[n]);
-				env_set("kernelargs", newkernelargs);
+				env_set(ctx_uboot, "kernelargs", newkernelargs);
 			} else {
-				env_set("kernelargs", mmckargs);
+				env_set(ctx_uboot, "kernelargs", mmckargs);
 			}
 		}
 #endif
 	get_arc_info();
 
 	if (kval) {
-		sval = env_get("SERIAL");
+		sval = env_get(ctx_uboot, "SERIAL");
 		if (sval) {
 			strcpy(newkernelargs, "SN=");
 			strcat(newkernelargs, sval);
 			strcat(newkernelargs, " ");
 			strcat(newkernelargs, kval);
-			env_set("kernelargs", newkernelargs);
+			env_set(ctx_uboot, "kernelargs", newkernelargs);
 		}
 	} else {
 		printf("Error reading kernelargs env variable!\n");
board/BuR/brppt1/board.c +2 -2
index ef4f5c950140..4278dda5988f 100644
@@ -180,10 +180,10 @@ int board_late_init(void)
 		bmode = 4;
 
 	printf("Mode:  %s\n", bootmodeascii[bmode & 0x0F]);
-	env_set_ulong("b_mode", bmode);
+	env_set_ulong(ctx_uboot, "b_mode", bmode);
 
 	/* get sure that bootcmd isn't affected by any bootcount value */
-	env_set_ulong("bootlimit", 0);
+	env_set_ulong(ctx_uboot, "bootlimit", 0);
 
 	return 0;
 }
board/BuR/brxre1/board.c +5 -4
index 873208c668d7..69bcccbc5a0d 100644
@@ -165,10 +165,11 @@ int board_late_init(void)
 	snprintf(othbootargs, sizeof(othbootargs),
 		 "u=vxWorksFTP pw=vxWorks o=0x%08x;0x%08x;0x%08x;0x%08x",
 		 (u32)gd->fb_base - 0x20,
-		 (u32)env_get_ulong("vx_memtop", 16, gd->fb_base - 0x20),
-		 (u32)env_get_ulong("vx_romfsbase", 16, 0),
-		 (u32)env_get_ulong("vx_romfssize", 16, 0));
-	env_set("othbootargs", othbootargs);
+		 (u32)env_get_ulong(ctx_uboot, "vx_memtop", 16,
+				    gd->fb_base - 0x20),
+		 (u32)env_get_ulong(ctx_uboot, "vx_romfsbase", 16, 0),
+		 (u32)env_get_ulong(ctx_uboot, "vx_romfssize", 16, 0));
+	env_set(ctx_uboot, "othbootargs", othbootargs);
 	/*
 	 * reset VBAR registers to its reset location, VxWorks 6.9.3.2 does
 	 * expect that vectors are there, original u-boot moves them to _start
board/BuR/common/br_resetc.c +1 -1
index c0e7fb65b298..36d49967dd82 100644
@@ -230,7 +230,7 @@ int br_resetc_bmode(void)
 		printf("Reset: STM32 controller\n");
 
 	printf("Mode:  %s\n", bootmodeascii[regw & 0x0F]);
-	env_set_ulong("b_mode", regw & 0x0F);
+	env_set_ulong(ctx_uboot, "b_mode", regw & 0x0F);
 
 	return rc;
 }
board/BuR/common/common.c +25 -22

80 lines not on this page · raw message

board/BuS/eb_cpu5282/eb_cpu5282.c +4 -4
index 0b916d2482c5..03d2b276a132 100644
@@ -139,7 +139,7 @@ void hw_watchdog_init(void)
 	int enable;
 
 	enable = 1;
-	s = env_get("watchdog");
+	s = env_get(ctx_uboot, "watchdog");
 	if (s != NULL)
 		if ((strncmp(s, "off", 3) == 0) || (strncmp(s, "0", 1) == 0))
 			enable = 0;
@@ -191,13 +191,13 @@ int drv_video_init(void)
 	unsigned long splash;
 #endif
 	printf("Init Video as ");
-	s = env_get("displaywidth");
+	s = env_get(ctx_uboot, "displaywidth");
 	if (s != NULL)
 		display_width = simple_strtoul(s, NULL, 10);
 	else
 		display_width = 256;
 
-	s = env_get("displayheight");
+	s = env_get(ctx_uboot, "displayheight");
 	if (s != NULL)
 		display_height = simple_strtoul(s, NULL, 10);
 	else
@@ -211,7 +211,7 @@ int drv_video_init(void)
 	vcxk_init(display_width, display_height);
 
 #ifdef CONFIG_SPLASH_SCREEN
-	s = env_get("splashimage");
+	s = env_get(ctx_uboot, "splashimage");
 	if (s != NULL) {
 		splash = simple_strtoul(s, NULL, 16);
 		vcxk_acknowledge_wait();
board/CZ.NIC/turris_mox/turris_mox.c +2 -2
index 946e20ab492f..b23ecb3fefaa 100644
@@ -362,10 +362,10 @@ int misc_init_r(void)
 		return 0;
 	}
 
-	if (is_valid_ethaddr(mac1) && !env_get("ethaddr"))
+	if (is_valid_ethaddr(mac1) && !env_get(ctx_uboot, "ethaddr"))
 		eth_env_set_enetaddr("ethaddr", mac1);
 
-	if (is_valid_ethaddr(mac2) && !env_get("eth1addr"))
+	if (is_valid_ethaddr(mac2) && !env_get(ctx_uboot, "eth1addr"))
 		eth_env_set_enetaddr("eth1addr", mac2);
 
 	return 0;
board/CZ.NIC/turris_omnia/turris_omnia.c +3 -3
index 1d8d08a847d9..bbbeaf75fc97 100644
@@ -326,7 +326,7 @@ static int set_regdomain(void)
 		puts("EEPROM regdomain read failed.\n");
 
 	printf("Regdomain set to %s\n", rd);
-	return env_set("regdomain", rd);
+	return env_set(ctx_uboot, "regdomain", rd);
 }
 
 /*
@@ -359,11 +359,11 @@ static void handle_reset_button(void)
 		return;
 	}
 
-	env_set_ulong("omnia_reset", reset_status);
+	env_set_ulong(ctx_uboot, "omnia_reset", reset_status);
 
 	if (reset_status) {
 		printf("RESET button was pressed, overwriting bootcmd!\n");
-		env_set("bootcmd", OMNIA_FACTORY_RESET_BOOTCMD);
+		env_set(ctx_uboot, "bootcmd", OMNIA_FACTORY_RESET_BOOTCMD);
 	}
 }
 #endif
board/CarMediaLab/flea3/flea3.c +1 -1
index be0bc228ec71..9a5fe1e2252d 100644
@@ -211,7 +211,7 @@ int ft_board_setup(void *blob, bd_t *bd)
 		{ "mxc_nand", MTD_DEV_TYPE_NAND, }, /* NAND flash */
 	};
 
-	if (env_get("fdt_noauto")) {
+	if (env_get(ctx_uboot, "fdt_noauto")) {
 		puts("   Skiping ft_board_setup (fdt_noauto defined)\n");
 		return 0;
 	}
board/LaCie/net2big_v2/net2big_v2.c +1 -1
index 686608d25a5a..659a351deaea 100644
@@ -221,7 +221,7 @@ int misc_init_r(void)
 {
 	init_fan();
 #if defined(CONFIG_CMD_I2C) && defined(CONFIG_SYS_I2C_EEPROM_ADDR)
-	if (!env_get("ethaddr")) {
+	if (!env_get(ctx_uboot, "ethaddr")) {
 		uchar mac[6];
 		if (lacie_read_mac_address(mac) == 0)
 			eth_env_set_enetaddr("ethaddr", mac);
board/LaCie/netspace_v2/netspace_v2.c +1 -1
index bd7ab22948b2..83b07300354e 100644
@@ -83,7 +83,7 @@ int board_init(void)
 int misc_init_r(void)
 {
 #if defined(CONFIG_CMD_I2C) && defined(CONFIG_SYS_I2C_EEPROM_ADDR)
-	if (!env_get("ethaddr")) {
+	if (!env_get(ctx_uboot, "ethaddr")) {
 		uchar mac[6];
 		if (lacie_read_mac_address(mac) == 0)
 			eth_env_set_enetaddr("ethaddr", mac);
board/Synology/ds414/cmd_syno.c +3 -3
index 777948f90f58..abd38b24fff0 100644
@@ -80,7 +80,7 @@ static int do_syno_populate(int argc, char * const argv[])
 		         ethaddr[0], ethaddr[1], ethaddr[2],
 			 ethaddr[3], ethaddr[4], ethaddr[5]);
 		printf("parsed %s = %s\n", var, val);
-		env_set(var, val);
+		env_set(ctx_uboot, var, val);
 	}
 	if (!strncmp(buf + 32, SYNO_SN_TAG, strlen(SYNO_SN_TAG))) {
 		char *snp, *csump;
@@ -110,7 +110,7 @@ static int do_syno_populate(int argc, char * const argv[])
 			goto out_unmap;
 		}
 		printf("parsed SN = %s\n", snp);
-		env_set("SN", snp);
+		env_set(ctx_uboot, "SN", snp);
 	} else {	/* old style format */
 		unsigned char csum = 0;
 
@@ -124,7 +124,7 @@ static int do_syno_populate(int argc, char * const argv[])
 		}
 		bufp[n] = '\0';
 		printf("parsed SN = %s\n", buf + 32);
-		env_set("SN", buf + 32);
+		env_set(ctx_uboot, "SN", buf + 32);
 	}
 out_unmap:
 	unmap_physmem(buf, len);
board/alliedtelesis/x530/x530.c +1 -1
index e0fa8067c1c5..53bc9dd286e2 100644
@@ -157,7 +157,7 @@ int misc_init_r(void)
 	gpio_hog(&led_en, "atl,led-enable", "enable-gpio", 1);
 
 #ifdef MTDPARTS_MTDOOPS
-	env_set("mtdoops", MTDPARTS_MTDOOPS);
+	env_set(ctx_uboot, "mtdoops", MTDPARTS_MTDOOPS);
 #endif
 
 	led_7seg_init(0xff);
board/amazon/kc1/kc1.c +2 -2
index 9034c4fbfff0..9f183da00a9e 100644
@@ -118,8 +118,8 @@ int misc_init_r(void)
 	}
 
 	if (reboot_mode[0] > 0 && isascii(reboot_mode[0])) {
-		if (!env_get("reboot-mode"))
-			env_set("reboot-mode", (char *)reboot_mode);
+		if (!env_get(ctx_uboot, "reboot-mode"))
+			env_set(ctx_uboot, "reboot-mode", (char *)reboot_mode);
 	}
 
 	omap_reboot_mode_clear();
board/amlogic/p200/p200.c +2 -2
index 41d331dda2d4..4b1a158f1750 100644
@@ -32,11 +32,11 @@ int misc_init_r(void)
 			eth_env_set_enetaddr("ethaddr", mac_addr);
 	}
 
-	if (!env_get("serial#")) {
+	if (!env_get(ctx_uboot, "serial#")) {
 		len = meson_sm_read_efuse(EFUSE_SN_OFFSET, serial,
 			EFUSE_SN_SIZE);
 		if (len == EFUSE_SN_SIZE)
-			env_set("serial#", serial);
+			env_set(ctx_uboot, "serial#", serial);
 	}
 
 	return 0;
board/amlogic/p201/p201.c +2 -2
index e46fcaea6dcd..ba2a5387a120 100644
@@ -32,11 +32,11 @@ int misc_init_r(void)
 			eth_env_set_enetaddr("ethaddr", mac_addr);
 	}
 
-	if (!env_get("serial#")) {
+	if (!env_get(ctx_uboot, "serial#")) {
 		len = meson_sm_read_efuse(EFUSE_SN_OFFSET, serial,
 			EFUSE_SN_SIZE);
 		if (len == EFUSE_SN_SIZE)
-			env_set("serial#", serial);
+			env_set(ctx_uboot, "serial#", serial);
 	}
 
 	return 0;
board/amlogic/p212/p212.c +2 -2
index 094ab5478d00..3fabf79a4b41 100644
@@ -36,11 +36,11 @@ int misc_init_r(void)
 			meson_generate_serial_ethaddr();
 	}
 
-	if (!env_get("serial#")) {
+	if (!env_get(ctx_uboot, "serial#")) {
 		len = meson_sm_read_efuse(EFUSE_SN_OFFSET, serial,
 			EFUSE_SN_SIZE);
 		if (len == EFUSE_SN_SIZE)
-			env_set("serial#", serial);
+			env_set(ctx_uboot, "serial#", serial);
 	}
 
 	return 0;
board/amlogic/q200/q200.c +2 -2
index f1faa7418e07..2cf2af3e1899 100644
@@ -35,11 +35,11 @@ int misc_init_r(void)
 			meson_generate_serial_ethaddr();
 	}
 
-	if (!env_get("serial#")) {
+	if (!env_get(ctx_uboot, "serial#")) {
 		len = meson_sm_read_efuse(EFUSE_SN_OFFSET, serial,
 					  EFUSE_SN_SIZE);
 		if (len == EFUSE_SN_SIZE)
-			env_set("serial#", serial);
+			env_set(ctx_uboot, "serial#", serial);
 	}
 
 	return 0;
board/aristainetos/aristainetos-v2.c +4 -4
index c0a2e41f02e8..061baf0255db 100644
@@ -651,7 +651,7 @@ int board_late_init(void)
 {
 	char *my_bootdelay;
 	char bootmode = 0;
-	char const *panel = env_get("panel");
+	char const *panel = env_get(ctx_uboot, "panel");
 
 	/*
 	 * Check the boot-source. If booting from NOR Flash,
@@ -668,11 +668,11 @@ int board_late_init(void)
 	bootmode |= (gpio_get_value(IMX_GPIO_NR(7, 1)) ? 1 : 0) << 2;
 
 	if (bootmode == 7) {
-		my_bootdelay = env_get("nor_bootdelay");
+		my_bootdelay = env_get(ctx_uboot, "nor_bootdelay");
 		if (my_bootdelay != NULL)
-			env_set("bootdelay", my_bootdelay);
+			env_set(ctx_uboot, "bootdelay", my_bootdelay);
 		else
-			env_set("bootdelay", "-2");
+			env_set(ctx_uboot, "bootdelay", "-2");
 	}
 
 	/* if we have the lg panel, we can initialze it now */
board/armltd/integrator/integrator.c +1 -1
index 0a2baa72976c..72c9678218ae 100644
@@ -116,7 +116,7 @@ extern void cm_remap(void);
 
 int misc_init_r (void)
 {
-	env_set("verify", "n");
+	env_set(ctx_uboot, "verify", "n");
 	return (0);
 }
 
board/atmel/common/board.c +2 -2
index c41706c4005c..aef6babfd37a 100644
@@ -64,7 +64,7 @@ void at91_pda_detect(void)
 	}
 
 pda_detect_err:
-	env_set("pda", (const char *)buf);
+	env_set(ctx_uboot, "pda", (const char *)buf);
 }
 #else
 void at91_pda_detect(void)
@@ -74,5 +74,5 @@ void at91_pda_detect(void)
 
 void at91_prepare_cpu_var(void)
 {
-	env_set("cpu", get_cpu_name());
+	env_set(ctx_uboot, "cpu", get_cpu_name());
 }
board/atmel/common/mac_eeprom.c +1 -1
index 83a7778e9954..4c9a5c0b0d0e 100644
@@ -18,7 +18,7 @@ int at91_set_ethaddr(int offset)
 	struct udevice *dev;
 	int ret;
 
-	if (env_get(ETHADDR_NAME))
+	if (env_get(ctx_uboot, ETHADDR_NAME))
 		return 0;
 
 	ret = uclass_first_device_err(UCLASS_I2C_EEPROM, &dev);
board/atmel/sama5d3xek/sama5d3xek.c +1 -1
index acf61486d20b..6c27c3dbe148 100644
@@ -187,7 +187,7 @@ int board_late_init(void)
 		*p = tolower(*p);
 
 	strcat(name, "ek.dtb");
-	env_set("dtb_name", name);
+	env_set(ctx_uboot, "dtb_name", name);
 #endif
 #ifdef CONFIG_DM_VIDEO
 	at91_video_show_board_info();
board/bachmann/ot1200/ot1200.c +2 -2
index 36f37084b36c..baf7b7cdf7f3 100644
@@ -301,9 +301,9 @@ int board_eth_init(bd_t *bis)
 
 	/* depending on the phy address we can detect our board version */
 	if (phydev->addr == 0)
-		env_set("boardver", "");
+		env_set(ctx_uboot, "boardver", "");
 	else
-		env_set("boardver", "mr");
+		env_set(ctx_uboot, "boardver", "mr");
 
 	printf("using phy at %d\n", phydev->addr);
 	ret = fec_probe(bis, -1, base, bus, phydev);
board/birdland/bav335x/board.c +4 -4
index 8811583ac628..9a8b69df3891 100644
@@ -161,7 +161,7 @@ int spl_start_uboot(void)
 
 #ifdef CONFIG_SPL_ENV_SUPPORT
 	env_init();
-	env_load();
+	env_load(ctx_uboot);
 	if (env_get_yesno("boot_os") != 1)
 		return 1;
 #endif
@@ -300,8 +300,8 @@ int board_init(void)
 int board_late_init(void)
 {
 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
-	env_set("board_name", "BAV335xB");
-	env_set("board_rev", "B"); /* Fix me, but why bother.. */
+	env_set(ctx_uboot, "board_name", "BAV335xB");
+	env_set(ctx_uboot, "board_rev", "B"); /* Fix me, but why bother.. */
 #endif
 	return 0;
 }
@@ -391,7 +391,7 @@ int board_eth_init(bd_t *bis)
 #if (defined(CONFIG_DRIVER_TI_CPSW) && !defined(CONFIG_SPL_BUILD)) || \
 	(defined(CONFIG_SPL_ETH_SUPPORT) && defined(CONFIG_SPL_BUILD))
 
-	if (!env_get("ethaddr")) {
+	if (!env_get(ctx_uboot, "ethaddr")) {
 		printf("<ethaddr> not set. Validating first E-fuse MAC\n");
 
 		if (is_valid_ethaddr(mac_addr))
board/bluegiga/apx4devkit/apx4devkit.c +3 -2
index 9268aa0daafc..a7116e8c0c06 100644
@@ -133,8 +133,9 @@ void get_board_serial(struct tag_serialnr *serialnr)
 #ifdef CONFIG_REVISION_TAG
 u32 get_board_rev(void)
 {
-	if (env_get("revision#") != NULL)
-		return simple_strtoul(env_get("revision#"), NULL, 10);
+	if (env_get(ctx_uboot, "revision#"))
+		return simple_strtoul(env_get(ctx_uboot, "revision#"), NULL,
+				      10);
 	return 0;
 }
 #endif
board/bluewater/gurnard/gurnard.c +3 -3
index 48e31d9065a2..560db5fee639 100644
@@ -340,7 +340,7 @@ int board_init(void)
 	at91_set_A_periph(AT91_PIN_PE6, 1);	/* power up */
 
 	/* Select the second timing index for board rev 2 */
-	rev_str = env_get("board_rev");
+	rev_str = env_get(ctx_uboot, "board_rev");
 	if (rev_str && !strncmp(rev_str, "2", 1)) {
 		struct udevice *dev;
 
@@ -367,7 +367,7 @@ int board_late_init(void)
 	 * Set MAC address so we do not need to init Ethernet before Linux
 	 * boot
 	 */
-	env_str = env_get("ethaddr");
+	env_str = env_get(ctx_uboot, "ethaddr");
 	if (env_str) {
 		struct at91_emac *emac = (struct at91_emac *)ATMEL_BASE_EMAC;
 		/* Parse MAC address */
@@ -384,7 +384,7 @@ int board_late_init(void)
 		       &emac->sa2l);
 		writel((env_enetaddr[4] | env_enetaddr[5] << 8), &emac->sa2h);
 
-		printf("MAC:   %s\n", env_get("ethaddr"));
+		printf("MAC:   %s\n", env_get(ctx_uboot, "ethaddr"));
 	} else {
 		/* Not set in environment */
 		printf("MAC:   not set\n");
board/bosch/shc/board.c +1 -1
index a96fdef992d2..6afbdb9737ac 100644
@@ -246,7 +246,7 @@ static void check_button_status(void)
 
 	if (value == 0) {
 		printf("front button activated !\n");
-		env_set("harakiri", "1");
+		env_set(ctx_uboot, "harakiri", "1");
 	}
 }
 
board/boundary/nitrogen6x/nitrogen6x.c +7 -7
index 26af3f710250..e9a1cde72390 100644
@@ -749,7 +749,7 @@ size_t display_count = ARRAY_SIZE(displays);
 
 int board_cfb_skip(void)
 {
-	return NULL != env_get("novideo");
+	return env_get(ctx_uboot, "novideo") != NULL;
 }
 
 static void setup_display(void)
@@ -954,7 +954,7 @@ static int do_kbd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
 	char envvalue[ARRAY_SIZE(buttons)+1];
 	int numpressed = read_keys(envvalue);
-	env_set("keybd", envvalue);
+	env_set(ctx_uboot, "keybd", envvalue);
 	return numpressed == 0;
 }
 
@@ -974,7 +974,7 @@ static void preboot_keys(void)
 	char keypress[ARRAY_SIZE(buttons)+1];
 	numpressed = read_keys(keypress);
 	if (numpressed) {
-		char *kbd_magic_keys = env_get("magic_keys");
+		char *kbd_magic_keys = env_get(ctx_uboot, "magic_keys");
 		char *suffix;
 		/*
 		 * loop over all magic keys
@@ -983,7 +983,7 @@ static void preboot_keys(void)
 			char *keys;
 			char magic[sizeof(kbd_magic_prefix) + 1];
 			sprintf(magic, "%s%c", kbd_magic_prefix, *suffix);
-			keys = env_get(magic);
+			keys = env_get(ctx_uboot, magic);
 			if (keys) {
 				if (!strcmp(keys, keypress))
 					break;
@@ -993,9 +993,9 @@ static void preboot_keys(void)
 			char cmd_name[sizeof(kbd_command_prefix) + 1];
 			char *cmd;
 			sprintf(cmd_name, "%s%c", kbd_command_prefix, *suffix);
-			cmd = env_get(cmd_name);
+			cmd = env_get(ctx_uboot, cmd_name);
 			if (cmd) {
-				env_set("preboot", cmd);
+				env_set(ctx_uboot, "preboot", cmd);
 				return;
 			}
 		}
@@ -1021,6 +1021,6 @@ int misc_init_r(void)
 #ifdef CONFIG_CMD_BMODE
 	add_board_boot_modes(board_boot_modes);
 #endif
-	env_set_hex("reset_cause", get_imx_reset_cause());
+	env_set_hex(ctx_uboot, "reset_cause", get_imx_reset_cause(void));
 	return 0;
 }
board/broadcom/bcm23550_w1d/bcm23550_w1d.c +1 -1
index ce9f0494ee59..51e7f2c0c847 100644
@@ -103,7 +103,7 @@ int board_usb_init(int index, enum usb_init_type init)
 int g_dnl_bind_fixup(struct usb_device_descriptor *dev, const char *name)
 {
 	debug("%s\n", __func__);
-	if (!env_get("serial#"))
+	if (!env_get(ctx_uboot, "serial#"))
 		g_dnl_set_serialnumber(CONFIG_USB_SERIALNO);
 	return 0;
 }
board/broadcom/bcm28155_ap/bcm28155_ap.c +1 -1
index 87616386cb84..d9240cf35c8c 100644
@@ -110,7 +110,7 @@ int board_usb_init(int index, enum usb_init_type init)
 int g_dnl_bind_fixup(struct usb_device_descriptor *dev, const char *name)
 {
 	debug("%s\n", __func__);
-	if (!env_get("serial#"))
+	if (!env_get(ctx_uboot, "serial#"))
 		g_dnl_set_serialnumber(CONFIG_USB_SERIALNO);
 	return 0;
 }
board/broadcom/bcmstb/bcmstb.c +1 -1
index 5fc2c0591b84..494c03d3eb79 100644
@@ -120,7 +120,7 @@ int board_late_init(void)
 	 * Set fdtcontroladdr in the environment so that scripts can
 	 * refer to it, for example, to reuse it for fdtaddr.
 	 */
-	env_set_hex("fdtcontroladdr", prior_stage_fdt_address);
+	env_set_hex(ctx_uboot, "fdtcontroladdr", prior_stage_fdt_address);
 
 	/*
 	 * Do not set machid to the machine identifier value provided
board/buffalo/lsxl/lsxl.c +1 -1
index 95d3a5e1f579..f1baed84e268 100644
@@ -229,7 +229,7 @@ static void erase_environment(void)
 static void rescue_mode(void)
 {
 	printf("Entering rescue mode..\n");
-	env_set("bootsource", "rescue");
+	env_set(ctx_uboot, "bootsource", "rescue");
 }
 
 static void check_push_button(void)
board/cadence/xtfpga/xtfpga.c +2 -2
index 256611638a55..1aee9c6f95a0 100644
@@ -86,14 +86,14 @@ int misc_init_r(void)
 	 * Default MAC address comes from CONFIG_ETHADDR + DIP switches 1-6.
 	 */
 
-	char *s = env_get("ethaddr");
+	char *s = env_get(ctx_uboot, "ethaddr");
 	if (s == 0) {
 		unsigned int x;
 		char s[] = __stringify(CONFIG_ETHBASE);
 		x = (*(volatile u32 *)CONFIG_SYS_FPGAREG_DIPSW)
 			& FPGAREG_MAC_MASK;
 		sprintf(&s[15], "%02x", x);
-		env_set("ethaddr", s);
+		env_set(ctx_uboot, "ethaddr", s);
 	}
 #endif /* CONFIG_CMD_NET */
 
board/ccv/xpress/xpress.c +1 -1
index 05286e643c0e..9518307f7a76 100644
@@ -324,7 +324,7 @@ static const struct boot_mode board_boot_modes[] = {
 int board_late_init(void)
 {
 	add_board_boot_modes(board_boot_modes);
-	env_set("board_name", "xpress");
+	env_set(ctx_uboot, "board_name", "xpress");
 
 	return 0;
 }
board/compulab/cl-som-imx7/cl-som-imx7.c +1 -1
index 395d5dce1785..d05a0dcf32f5 100644
@@ -311,7 +311,7 @@ void cl_som_imx7_setup_wdog(void)
 
 int board_late_init(void)
 {
-	env_set("board_name", "CL-SOM-iMX7");
+	env_set(ctx_uboot, "board_name", "CL-SOM-iMX7");
 	cl_som_imx7_setup_wdog();
 	return 0;
 }
board/compulab/cm_fx6/cm_fx6.c +5 -5
index feb7a71f007d..50564fde2ba6 100644
@@ -117,10 +117,10 @@ int board_video_skip(void)
 {
 	int ret;
 	struct display_info_t *preset;
-	char const *panel = env_get("displaytype");
+	char const *panel = env_get(ctx_uboot, "displaytype");
 
 	if (!panel) /* Also accept panel for backward compatibility */
-		panel = env_get("panel");
+		panel = env_get(ctx_uboot, "panel");
 
 	if (!panel)
 		return -ENOENT;
@@ -628,16 +628,16 @@ int board_late_init(void)
 	int err;
 
 	if (is_mx6dq())
-		env_set("board_rev", "MX6Q");
+		env_set(ctx_uboot, "board_rev", "MX6Q");
 	else if (is_mx6dl())
-		env_set("board_rev", "MX6DL");
+		env_set(ctx_uboot, "board_rev", "MX6DL");
 
 	err = cl_eeprom_get_product_name((uchar *)baseboard_name, 0);
 	if (err)
 		return 0;
 
 	if (!strncmp("SB-FX6m", baseboard_name, 7))
-		env_set("board_name", "Utilite");
+		env_set(ctx_uboot, "board_name", "Utilite");
 #endif
 	return 0;
 }
board/compulab/common/omap3_display.c +2 -2
index cb9ebae7f964..9215a37d982a 100644
@@ -398,7 +398,7 @@ void lcd_ctrl_init(void *lcdbase)
 {
 	struct prcm *prcm = (struct prcm *)PRCM_BASE;
 	char *custom_lcd;
-	char *displaytype = env_get("displaytype");
+	char *displaytype = env_get(ctx_uboot, "displaytype");
 
 	if (displaytype == NULL)
 		return;
@@ -406,7 +406,7 @@ void lcd_ctrl_init(void *lcdbase)
 	lcd_def = env_parse_displaytype(displaytype);
 	/* If we did not recognize the preset, check if it's an env variable */
 	if (lcd_def == NONE) {
-		custom_lcd = env_get(displaytype);
+		custom_lcd = env_get(ctx_uboot, displaytype);
 		if (custom_lcd == NULL || parse_customlcd(custom_lcd) < 0)
 			return;
 	}
board/congatec/cgtqmx6eval/cgtqmx6eval.c +4 -4
index 6b3d5b833f44..8143f7680e7b 100644
@@ -236,7 +236,7 @@ int power_init_board(void)
 		return 0;
 
 	/* set level of MIPI if specified */
-	lv_mipi = env_get("lv_mipi");
+	lv_mipi = env_get(ctx_uboot, "lv_mipi");
 	if (lv_mipi)
 		return 0;
 
@@ -584,7 +584,7 @@ int board_video_skip(void)
 {
 	int i;
 	int ret;
-	char const *panel = env_get("panel");
+	char const *panel = env_get(ctx_uboot, "panel");
 	if (!panel) {
 		for (i = 0; i < ARRAY_SIZE(displays); i++) {
 			struct display_info_t const *dev = displays + i;
@@ -756,9 +756,9 @@ int board_late_init(void)
 {
 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
 	if (is_mx6dq())
-		env_set("board_rev", "MX6Q");
+		env_set(ctx_uboot, "board_rev", "MX6Q");
 	else
-		env_set("board_rev", "MX6DL");
+		env_set(ctx_uboot, "board_rev", "MX6DL");
 #endif
 
 	return 0;
board/cssi/MCR3000/MCR3000.c +1 -1
index 445b84c180fe..0f7ba71bb647 100644
@@ -127,7 +127,7 @@ int misc_init_r(void)
 
 	/* if BTN_ACQ_AL is pressed then bootdelay is changed to 60 second */
 	if ((in_be16(&iop->iop_pcdat) & 0x0004) == 0)
-		env_set("bootdelay", "60");
+		env_set(ctx_uboot, "bootdelay", "60");
 
 	return 0;
 }
board/davinci/da8xxevm/da850evm.c +1 -1
index d9019de6e006..31a380275553 100644
@@ -280,7 +280,7 @@ u32 get_board_rev(void)
 	u32 maxcpuclk = CONFIG_DA850_EVM_MAX_CPU_CLK;
 	u32 rev = 0;
 
-	s = env_get("maxcpuclk");
+	s = env_get(ctx_uboot, "maxcpuclk");
 	if (s)
 		maxcpuclk = simple_strtoul(s, NULL, 10);
 
board/davinci/da8xxevm/omapl138_lcdk.c +3 -3
index 27a51d6a7802..0856b25c16e4 100644
@@ -275,7 +275,7 @@ static void dspwake(void)
 	if ((REG(CHIP_REV_ID_REG) & 0x3f) == 0x10)
 		return;
 
-	if (!strcmp(env_get("dspwake"), "no"))
+	if (!strcmp(env_get(ctx_uboot, "dspwake"), "no"))
 		return;
 
 	*resetvect++ = 0x1E000; /* DSP Idle */
@@ -305,7 +305,7 @@ int misc_init_r(void)
 	uint8_t tmp[20], addr[10];
 
 
-	if (env_get("ethaddr") == NULL) {
+	if (!env_get(ctx_uboot, "ethaddr")) {
 		/* Read Ethernet MAC address from EEPROM */
 		if (dvevm_read_mac_address(addr)) {
 			/* Set Ethernet MAC address from EEPROM */
@@ -319,7 +319,7 @@ int misc_init_r(void)
 				addr[0], addr[1], addr[2], addr[3], addr[4],
 				addr[5]);
 
-			env_set("ethaddr", (char *)tmp);
+			env_set(ctx_uboot, "ethaddr", (char *)tmp);
 		} else {
 			printf("Invalid MAC address read.\n");
 		}
board/dhelectronics/dh_imx6/dh_imx6.c +1 -1
index 2d0f78da118f..d904ab4170d3 100644
@@ -251,7 +251,7 @@ int board_late_init(void)
 		break;
 	}
 
-	env_set("dhcom", buf);
+	env_set(ctx_uboot, "dhcom", buf);
 
 #ifdef CONFIG_CMD_BMODE
 	add_board_boot_modes(board_boot_modes);
board/eets/pdu001/board.c +4 -4
index 8a3d0ada270e..104dc1d3c6f7 100644
@@ -79,15 +79,15 @@ static void env_set_boot_device(void)
 {
 	switch (boot_device()) {
 		case BOOT_DEVICE_MMC1: {
-			env_set("boot_device", "emmc");
+			env_set(ctx_uboot, "boot_device", "emmc");
 			break;
 		}
 		case BOOT_DEVICE_MMC2: {
-			env_set("boot_device", "sdcard");
+			env_set(ctx_uboot, "boot_device", "sdcard");
 			break;
 		}
 		default: {
-			env_set("boot_device", "unknown");
+			env_set(ctx_uboot, "boot_device", "unknown");
 			break;
 		}
 	}
@@ -117,7 +117,7 @@ static void env_set_serial(struct udevice *dev)
 		sprintf(serial + n, "%02X", val);
 	}
 	serial[2 * NODE_ID_BYTE_COUNT] = '\0';
-	env_set("serial#", serial);
+	env_set(ctx_uboot, "serial#", serial);
 }
 
 static void set_mpu_and_core_voltage(void)
board/el/el6x/el6x.c +1 -1
index 18d69a7da388..606fe1530728 100644
@@ -467,7 +467,7 @@ int board_late_init(void)
 	add_board_boot_modes(board_boot_modes);
 #endif
 
-	env_set("board_name", BOARD_NAME);
+	env_set(ctx_uboot, "board_name", BOARD_NAME);
 	return 0;
 }
 
board/emulation/qemu-riscv/qemu-riscv.c +1 -1
index 37d48d04f2d0..6cb571ba036c 100644
@@ -46,7 +46,7 @@ int board_late_init(void)
 		return 0;
 	}
 
-	env_set_hex("kernel_start", kernel_start);
+	env_set_hex(ctx_uboot, "kernel_start", kernel_start);
 
 	return 0;
 }
board/engicam/common/board.c +16 -16
index 0c47afe5b566..b338c364efd0 100644
@@ -22,11 +22,11 @@ static void mmc_late_init(void)
 	char mmcblk[32];
 	u32 dev_no = mmc_get_env_dev();
 
-	env_set_ulong("mmcdev", dev_no);
+	env_set_ulong(ctx_uboot, "mmcdev", dev_no);
 
 	/* Set mmcblk env */
 	sprintf(mmcblk, "/dev/mmcblk%dp2 rootwait rw", dev_no);
-	env_set("mmcroot", mmcblk);
+	env_set(ctx_uboot, "mmcroot", mmcblk);
 
 	sprintf(cmd, "mmc dev %d", dev_no);
 	run_command(cmd, 0);
@@ -39,25 +39,25 @@ static void setenv_fdt_file(void)
 
 	if (!strcmp(cmp_dtb, "imx6q-icore")) {
 		if (is_mx6dq())
-			env_set("fdt_file", "imx6q-icore.dtb");
+			env_set(ctx_uboot, "fdt_file", "imx6q-icore.dtb");
 		else if (is_mx6dl() || is_mx6solo())
-			env_set("fdt_file", "imx6dl-icore.dtb");
+			env_set(ctx_uboot, "fdt_file", "imx6dl-icore.dtb");
 	} else if (!strcmp(cmp_dtb, "imx6q-icore-mipi")) {
 		if (is_mx6dq())
-			env_set("fdt_file", "imx6q-icore-mipi.dtb");
+			env_set(ctx_uboot, "fdt_file", "imx6q-icore-mipi.dtb");
 		else if (is_mx6dl() || is_mx6solo())
-			env_set("fdt_file", "imx6dl-icore-mipi.dtb");
+			env_set(ctx_uboot, "fdt_file", "imx6dl-icore-mipi.dtb");
 	} else if (!strcmp(cmp_dtb, "imx6q-icore-rqs")) {
 		if (is_mx6dq())
-			env_set("fdt_file", "imx6q-icore-rqs.dtb");
+			env_set(ctx_uboot, "fdt_file", "imx6q-icore-rqs.dtb");
 		else if (is_mx6dl() || is_mx6solo())
-			env_set("fdt_file", "imx6dl-icore-rqs.dtb");
+			env_set(ctx_uboot, "fdt_file", "imx6dl-icore-rqs.dtb");
 	} else if (!strcmp(cmp_dtb, "imx6ul-geam"))
-		env_set("fdt_file", "imx6ul-geam.dtb");
+		env_set(ctx_uboot, "fdt_file", "imx6ul-geam.dtb");
 	else if (!strcmp(cmp_dtb, "imx6ul-isiot-emmc"))
-		env_set("fdt_file", "imx6ul-isiot-emmc.dtb");
+		env_set(ctx_uboot, "fdt_file", "imx6ul-isiot-emmc.dtb");
 	else if (!strcmp(cmp_dtb, "imx6ul-isiot-nand"))
-		env_set("fdt_file", "imx6ul-isiot-nand.dtb");
+		env_set(ctx_uboot, "fdt_file", "imx6ul-isiot-nand.dtb");
 }
 
 int board_late_init(void)
@@ -71,20 +71,20 @@ int board_late_init(void)
 #ifdef CONFIG_ENV_IS_IN_MMC
 		mmc_late_init();
 #endif
-		env_set("modeboot", "mmcboot");
+		env_set(ctx_uboot, "modeboot", "mmcboot");
 		break;
 	case IMX6_BMODE_NAND_MIN ... IMX6_BMODE_NAND_MAX:
-		env_set("modeboot", "nandboot");
+		env_set(ctx_uboot, "modeboot", "nandboot");
 		break;
 	default:
-		env_set("modeboot", "");
+		env_set(ctx_uboot, "modeboot", "");
 		break;
 	}
 
 	if (is_mx6ul())
-		env_set("console", "ttymxc0");
+		env_set(ctx_uboot, "console", "ttymxc0");
 	else
-		env_set("console", "ttymxc3");
+		env_set(ctx_uboot, "console", "ttymxc3");
 
 	setenv_fdt_file();
 
board/esd/meesc/meesc.c +3 -3
index b0d2f7b6f87b..c9c1d77410cc 100644
@@ -181,7 +181,7 @@ int checkboard(void)
 		puts("Board: EtherCAN/2 Gateway");
 		break;
 	}
-	if (env_get_f("serial#", str, sizeof(str)) > 0) {
+	if (env_get_f("serial#", str, sizeof(ctx_uboot, str)) > 0) {
 		puts(", serial# ");
 		puts(str);
 	}
@@ -198,7 +198,7 @@ void get_board_serial(struct tag_serialnr *serialnr)
 {
 	char *str;
 
-	char *serial = env_get("serial#");
+	char *serial = env_get(ctx_uboot, "serial#");
 	if (serial) {
 		str = strchr(serial, '_');
 		if (str && (strlen(str) >= 4)) {
@@ -231,7 +231,7 @@ int misc_init_r(void)
 	 * In some cases this this needs to be set to 4.
 	 * Check the user has set environment mdiv to 4 to change the divisor.
 	 */
-	str = env_get("mdiv");
+	str = env_get(ctx_uboot, "mdiv");
 	if (str && (strcmp(str, "4") == 0)) {
 		writel((readl(&pmc->mckr) & ~AT91_PMC_MDIV) |
 			AT91SAM9_PMC_MDIV_4, &pmc->mckr);
board/freescale/b4860qds/b4860qds.c +3 -2
index 33cd4b496489..a8168e60a58a 100644
@@ -195,7 +195,7 @@ static int adjust_vdd(ulong vdd_override)
 	      vid, vdd_target/10);
 
 	/* check override variable for overriding VDD */
-	vdd_string = env_get("b4qds_vdd_mv");
+	vdd_string = env_get(ctx_uboot, "b4qds_vdd_mv");
 	if (vdd_override == 0 && vdd_string &&
 	    !strict_strtoul(vdd_string, 10, &vdd_string_override))
 		vdd_override = vdd_string_override;
@@ -542,7 +542,8 @@ int configure_vsc3316_3308(void)
 			 * Extract hwconfig from environment since environment
 			 * is not setup properly yet
 			 */
-			env_get_f("hwconfig", buffer, sizeof(buffer));
+			env_get_f(ctx_uboot, "hwconfig", buffer,
+				  sizeof(buffer));
 			buf = buffer;
 
 			if (hwconfig_subarg_cmp_f("fsl_b4860_serdes2",
board/freescale/common/cmd_esbc_validate.c +1 -1
index 36b620ca23a0..14ce924b8684 100644
@@ -53,7 +53,7 @@ static int do_esbc_validate(cmd_tbl_t *cmdtp, int flag, int argc,
 	 * to continue U-Boot
 	 */
 	sprintf(buf, "%lx", img_addr);
-	env_set("img_addr", buf);
+	env_set(ctx_uboot, "img_addr", buf);
 
 	if (ret)
 		return 1;
board/freescale/common/fsl_chain_of_trust.c +3 -3
index a024e7239e6e..9e216c3f51d7 100644
@@ -80,12 +80,12 @@ int fsl_setenv_chain_of_trust(void)
 	 * bootdelay = 0 (To disable Boot Prompt)
 	 * bootcmd = CONFIG_CHAIN_BOOT_CMD (Validate and execute Boot script)
 	 */
-	env_set("bootdelay", "-2");
+	env_set(ctx_uboot, "bootdelay", "-2");
 
 #ifdef CONFIG_ARM
-	env_set("secureboot", "y");
+	env_set(ctx_uboot, "secureboot", "y");
 #else
-	env_set("bootcmd", CONFIG_CHAIN_BOOT_CMD);
+	env_set(ctx_uboot, "bootcmd", CONFIG_CHAIN_BOOT_CMD);
 #endif
 
 	return 0;
board/freescale/common/sys_eeprom.c +2 -2
index bb655ca7447c..88640958c79d 100644
@@ -538,8 +538,8 @@ int mac_read_from_eeprom(void)
 			/* Only initialize environment variables that are blank
 			 * (i.e. have not yet been set)
 			 */
-			if (!env_get(enetvar))
-				env_set(enetvar, ethaddr);
+			if (!env_get(ctx_uboot, enetvar))
+				env_set(ctx_uboot, enetvar, ethaddr);
 		}
 	}
 
board/freescale/common/vid.c +2 -2
index b37f3bf4f8fe..db23c8387e5c 100644
@@ -617,7 +617,7 @@ int adjust_vdd(ulong vdd_override)
 	vdd_target = vdd[vid];
 
 	/* check override variable for overriding VDD */
-	vdd_string = env_get(CONFIG_VID_FLS_ENV);
+	vdd_string = env_get(ctx_uboot, CONFIG_VID_FLS_ENV);
 	if (vdd_override == 0 && vdd_string &&
 	    !strict_strtoul(vdd_string, 10, &vdd_string_override))
 		vdd_override = vdd_string_override;
@@ -824,7 +824,7 @@ int adjust_vdd(ulong vdd_override)
 	vdd_target = vdd[vid];
 
 	/* check override variable for overriding VDD */
-	vdd_string = env_get(CONFIG_VID_FLS_ENV);
+	vdd_string = env_get(ctx_uboot, CONFIG_VID_FLS_ENV);
 	if (vdd_override == 0 && vdd_string &&
 	    !strict_strtoul(vdd_string, 10, &vdd_string_override))
 		vdd_override = vdd_string_override;
board/freescale/imx8mq_evk/imx8mq_evk.c +2 -2
index 1463e6e6963b..1822df9f32e8 100644
@@ -123,8 +123,8 @@ int board_mmc_get_env_dev(int devno)
 int board_late_init(void)
 {
 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
-	env_set("board_name", "EVK");
-	env_set("board_rev", "iMX8MQ");
+	env_set(ctx_uboot, "board_name", "EVK");
+	env_set(ctx_uboot, "board_rev", "iMX8MQ");
 #endif
 
 	return 0;
board/freescale/imx8qm_mek/imx8qm_mek.c +2 -2
index 76634a3a28ad..34ed03c3dec1 100644
@@ -126,8 +126,8 @@ int board_mmc_get_env_dev(int devno)
 int board_late_init(void)
 {
 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
-	env_set("board_name", "MEK");
-	env_set("board_rev", "iMX8QM");
+	env_set(ctx_uboot, "board_name", "MEK");
+	env_set(ctx_uboot, "board_rev", "iMX8QM");
 #endif
 
 	return 0;
board/freescale/imx8qxp_mek/imx8qxp_mek.c +2 -2
index 4ba83142841a..0d6152ac9551 100644
@@ -139,8 +139,8 @@ int board_mmc_get_env_dev(int devno)
 int board_late_init(void)
 {
 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
-	env_set("board_name", "MEK");
-	env_set("board_rev", "iMX8QXP");
+	env_set(ctx_uboot, "board_name", "MEK");
+	env_set(ctx_uboot, "board_rev", "iMX8QXP");
 #endif
 
 	return 0;
board/freescale/ls1088a/eth_ls1088aqds.c +2 -2
index 237088a53710..f618db490f00 100644
@@ -529,7 +529,7 @@ void ls1088a_handle_phy_interface_sgmii(int dpmac_id)
 	serdes1_prtcl = serdes_get_number(FSL_SRDS_1, cfg);
 
 	int *riser_phy_addr;
-	char *env_hwconfig = env_get("hwconfig");
+	char *env_hwconfig = env_get(ctx_uboot, "hwconfig");
 
 	if (hwconfig_f("xqsgmii", env_hwconfig))
 		riser_phy_addr = &xqsgii_riser_phy_addr[0];
@@ -670,7 +670,7 @@ int board_eth_init(bd_t *bis)
 	int error = 0, i;
 #ifdef CONFIG_FSL_MC_ENET
 	struct memac_mdio_info *memac_mdio0_info;
-	char *env_hwconfig = env_get("hwconfig");
+	char *env_hwconfig = env_get(ctx_uboot, "hwconfig");
 
 	initialize_dpmac_to_slot();
 
board/freescale/ls1088a/ls1088a.c +1 -1
index f1592982a348..cdbfd90c19fa 100644
@@ -984,7 +984,7 @@ int ft_board_setup(void *blob, bd_t *bd)
 #ifdef CONFIG_MTD_NOR_FLASH
 int is_flash_available(void)
 {
-	char *env_hwconfig = env_get("hwconfig");
+	char *env_hwconfig = env_get(ctx_uboot, "hwconfig");
 	enum boot_src src = get_boot_src();
 	int is_nor_flash_available = 1;
 
board/freescale/ls2080aqds/eth.c +3 -3
index 6a8788c31254..1103ca1d430c 100644
@@ -506,7 +506,7 @@ static void initialize_dpmac_to_slot(void)
 		>> FSL_CHASSIS3_RCWSR28_SRDS2_PRTCL_SHIFT;
 
 	char *env_hwconfig;
-	env_hwconfig = env_get("hwconfig");
+	env_hwconfig = env_get(ctx_uboot, "hwconfig");
 
 	switch (serdes1_prtcl) {
 	case 0x07:
@@ -660,7 +660,7 @@ void ls2080a_handle_phy_interface_sgmii(int dpmac_id)
 		>> FSL_CHASSIS3_RCWSR28_SRDS2_PRTCL_SHIFT;
 
 	int *riser_phy_addr;
-	char *env_hwconfig = env_get("hwconfig");
+	char *env_hwconfig = env_get(ctx_uboot, "hwconfig");
 
 	if (hwconfig_f("xqsgmii", env_hwconfig))
 		riser_phy_addr = &xqsgii_riser_phy_addr[0];
@@ -906,7 +906,7 @@ int board_eth_init(bd_t *bis)
 	unsigned int i;
 	char *env_hwconfig;
 
-	env_hwconfig = env_get("hwconfig");
+	env_hwconfig = env_get(ctx_uboot, "hwconfig");
 
 	initialize_dpmac_to_slot();
 
board/freescale/ls2080aqds/ls2080aqds.c +1 -1
index 91c80353edd6..6eef0536d162 100644
@@ -212,7 +212,7 @@ int board_init(void)
 
 	val = in_le32(dcfg_ccsr + DCFG_RCWSR13 / 4);
 
-	env_hwconfig = env_get("hwconfig");
+	env_hwconfig = env_get(ctx_uboot, "hwconfig");
 
 	if (hwconfig_f("dspi", env_hwconfig) &&
 	    DCFG_RCWSR13_DSPI == (val & (u32)(0xf << 8)))
board/freescale/ls2080ardb/ls2080ardb.c +3 -3
index e20267f27ce0..d7ea56a6613a 100644
@@ -265,7 +265,7 @@ int misc_init_r(void)
 
 	val = in_le32(dcfg_ccsr + DCFG_RCWSR13 / 4);
 
-	env_hwconfig = env_get("hwconfig");
+	env_hwconfig = env_get(ctx_uboot, "hwconfig");
 
 	if (hwconfig_f("dspi", env_hwconfig) &&
 	    DCFG_RCWSR13_DSPI == (val & (u32)(0xf << 8)))
@@ -295,10 +295,10 @@ int misc_init_r(void)
 	 */
 	if ((SVR_SOC_VER(svr) == SVR_LS2088A) ||
 	    (SVR_SOC_VER(svr) == SVR_LS2048A))
-		env_set("board", "ls2088ardb");
+		env_set(ctx_uboot, "board", "ls2088ardb");
 	else if ((SVR_SOC_VER(svr) == SVR_LS2081A) ||
 	    (SVR_SOC_VER(svr) == SVR_LS2041A))
-		env_set("board", "ls2081ardb");
+		env_set(ctx_uboot, "board", "ls2081ardb");
 
 	return 0;
 }
board/freescale/lx2160a/eth_lx2160aqds.c +1 -1
index 92c06e5060f1..40fb5092c337 100644
@@ -484,7 +484,7 @@ int board_eth_init(bd_t *bis)
 	 * defining "dpmac_override" in hwconfig environment variable.
 	 */
 	if (hwconfig("dpmac_override")) {
-		env_dpmac = env_get("dpmac");
+		env_dpmac = env_get(ctx_uboot, "dpmac");
 		if (env_dpmac) {
 			ret = hwconfig_arg_f("srds", &len, env_dpmac);
 			if (ret) {
board/freescale/mpc8323erdb/mpc8323erdb.c +2 -1
index e5aecc4e1f28..aa19a1b8534d 100644
@@ -217,7 +217,8 @@ int mac_read_from_eeprom(void)
 						buf[i * 6 + 4], buf[i * 6 + 5]);
 					sprintf((char *)enetvar,
 						i ? "eth%daddr" : "ethaddr", i);
-					env_set((char *)enetvar, str);
+					env_set(ctx_uboot, (char *)enetvar,
+						str);
 				}
 			}
 		}
board/freescale/mpc837xemds/pci.c +1 -1
index 41b78cf5e4de..c6f734ef2625 100644
@@ -67,7 +67,7 @@ static struct pci_region pcie_regions_1[] = {
 
 static int is_pex_x2(void)
 {
-	const char *pex_x2 = env_get("pex_x2");
+	const char *pex_x2 = env_get(ctx_uboot, "pex_x2");
 
 	if (pex_x2 && !strcmp(pex_x2, "yes"))
 		return 1;
board/freescale/mpc837xerdb/mpc837xerdb.c +1 -1
index 4ad62bcf1d6b..71939b240dae 100644
@@ -173,7 +173,7 @@ int board_mmc_init(bd_t *bd)
 	char buffer[HWCONFIG_BUFFER_SIZE] = {0};
 	int esdhc_hwconfig_enabled = 0;
 
-	if (env_get_f("hwconfig", buffer, sizeof(buffer)) > 0)
+	if (env_get_f("hwconfig", buffer, sizeof(ctx_uboot, buffer)) > 0)
 		esdhc_hwconfig_enabled = hwconfig_f("esdhc", buffer);
 
 	if (esdhc_hwconfig_enabled == 0)
board/freescale/mx51evk/mx51evk_video.c +1 -1
index 3715c5d738f9..ed2a58ea4a9a 100644
@@ -76,7 +76,7 @@ void setup_iomux_lcd(void)
 int board_video_skip(void)
 {
 	int ret;
-	char const *e = env_get("panel");
+	char const *e = env_get(ctx_uboot, "panel");
 
 	if (e) {
 		if (strcmp(e, "claa") == 0) {
board/freescale/mx53loco/mx53loco.c +2 -2
index a177815bb8aa..a3328a134fb8 100644
@@ -208,7 +208,7 @@ static int power_init(void)
 		if (!p)
 			return -ENODEV;
 
-		env_set("fdt_file", "imx53-qsb.dtb");
+		env_set(ctx_uboot, "fdt_file", "imx53-qsb.dtb");
 
 		/* Set VDDA to 1.25V */
 		val = DA9052_BUCKCORE_BCOREEN | DA_BUCKCORE_VBCORE_1_250V;
@@ -251,7 +251,7 @@ static int power_init(void)
 		if (!p)
 			return -ENODEV;
 
-		env_set("fdt_file", "imx53-qsrb.dtb");
+		env_set(ctx_uboot, "fdt_file", "imx53-qsrb.dtb");
 
 		/* Set VDDGP to 1.25V for 1GHz on SW1 */
 		pmic_reg_read(p, REG_SW_0, &val);
board/freescale/mx53loco/mx53loco_video.c +1 -1
index ff3fc8ce3e6f..061c990bcfb5 100644
@@ -92,7 +92,7 @@ void setup_iomux_lcd(void)
 int board_video_skip(void)
 {
 	int ret;
-	char const *e = env_get("panel");
+	char const *e = env_get(ctx_uboot, "panel");
 
 	if (e) {
 		if (strcmp(e, "seiko") == 0) {
board/freescale/mx6sabreauto/mx6sabreauto.c +4 -4
index dc156efbbcbc..a1cd8f4bc52e 100644
@@ -623,14 +623,14 @@ int board_late_init(void)
 #endif
 
 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
-	env_set("board_name", "SABREAUTO");
+	env_set(ctx_uboot, "board_name", "SABREAUTO");
 
 	if (is_mx6dqp())
-		env_set("board_rev", "MX6QP");
+		env_set(ctx_uboot, "board_rev", "MX6QP");
 	else if (is_mx6dq())
-		env_set("board_rev", "MX6Q");
+		env_set(ctx_uboot, "board_rev", "MX6Q");
 	else if (is_mx6sdl())
-		env_set("board_rev", "MX6DL");
+		env_set(ctx_uboot, "board_rev", "MX6DL");
 #endif
 
 	return 0;
board/freescale/mx6sabresd/mx6sabresd.c +4 -4
index b0c0117968bf..fb4c03a428c8 100644
@@ -606,14 +606,14 @@ int board_late_init(void)
 #endif
 
 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
-	env_set("board_name", "SABRESD");
+	env_set(ctx_uboot, "board_name", "SABRESD");
 
 	if (is_mx6dqp())
-		env_set("board_rev", "MX6QP");
+		env_set(ctx_uboot, "board_rev", "MX6QP");
 	else if (is_mx6dq())
-		env_set("board_rev", "MX6Q");
+		env_set(ctx_uboot, "board_rev", "MX6Q");
 	else if (is_mx6sdl())
-		env_set("board_rev", "MX6DL");
+		env_set(ctx_uboot, "board_rev", "MX6DL");
 #endif
 
 	return 0;
board/freescale/mx6sxsabresd/mx6sxsabresd.c +1 -1
index 1c10958879b1..b4bc682a5160 100644
@@ -309,7 +309,7 @@ int board_late_init(void)
 {
 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
 	if (is_reva())
-		env_set("board_rev", "REVA");
+		env_set(ctx_uboot, "board_rev", "REVA");
 #endif
 	return 0;
 }
board/freescale/mx6ul_14x14_evk/mx6ul_14x14_evk.c +3 -3
index ccbe4044786c..913b2c6c57b8 100644
@@ -545,12 +545,12 @@ int board_late_init(void)
 #endif
 
 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
-	env_set("board_name", "EVK");
+	env_set(ctx_uboot, "board_name", "EVK");
 
 	if (is_mx6ul_9x9_evk())
-		env_set("board_rev", "9X9");
+		env_set(ctx_uboot, "board_rev", "9X9");
 	else
-		env_set("board_rev", "14X14");
+		env_set(ctx_uboot, "board_rev", "14X14");
 #endif
 
 	return 0;
board/freescale/mx6ullevk/mx6ullevk.c +2 -2
index e11934780262..8dc5511e245f 100644
@@ -84,8 +84,8 @@ int board_late_init(void)
 #endif
 
 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
-	env_set("board_name", "EVK");
-	env_set("board_rev", "14X14");
+	env_set(ctx_uboot, "board_name", "EVK");
+	env_set(ctx_uboot, "board_rev", "14X14");
 #endif
 
 	return 0;
board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c +1 -1
index a04a73528f8d..4a21c148b696 100644
@@ -350,7 +350,7 @@ int board_eth_init(bd_t *bis)
 
 #ifdef CONFIG_VSC7385_ENET
 	/* If a VSC7385 microcode image is present, then upload it. */
-	tmp = env_get("vscfw_addr");
+	tmp = env_get(ctx_uboot, "vscfw_addr");
 	if (tmp) {
 		vscfw_addr = simple_strtoul(tmp, NULL, 16);
 		printf("uploading VSC7385 microcode from %x\n", vscfw_addr);
board/freescale/qemu-ppce500/qemu-ppce500.c +2 -2
index fb36d8366c98..38608234b7d5 100644
@@ -211,10 +211,10 @@ int last_stage_init(void)
 	/* -kernel boot */
 	prop = fdt_getprop(fdt, chosen, "qemu,boot-kernel", &len);
 	if (prop && (len >= 8))
-		env_set_hex("qemu_kernel_addr", *prop);
+		env_set_hex(ctx_uboot, "qemu_kernel_addr", *prop);
 
 	/* Give the user a variable for the host fdt */
-	env_set_hex("fdt_addr_r", (ulong)fdt);
+	env_set_hex("fdt_addr_r", (ctx_uboot, ulong)fdt);
 
 	return 0;
 }
board/freescale/t4qds/t4240qds.c +1 -1
index bb18b97e6a2e..d4e92d6c8d51 100644
@@ -265,7 +265,7 @@ static int adjust_vdd(ulong vdd_override)
 	vdd_target = vdd[vid];
 
 	/* check override variable for overriding VDD */
-	vdd_string = env_get("t4240qds_vdd_mv");
+	vdd_string = env_get(ctx_uboot, "t4240qds_vdd_mv");
 	if (vdd_override == 0 && vdd_string &&
 	    !strict_strtoul(vdd_string, 10, &vdd_string_override))
 		vdd_override = vdd_string_override;
board/gardena/smart-gateway-at91sam/board.c +1 -1
index 3e2da0d6f8e0..499605d5b6a1 100644
@@ -15,7 +15,7 @@ DECLARE_GLOBAL_DATA_PTR;
 
 static void at91_prepare_cpu_var(void)
 {
-	env_set("cpu", get_cpu_name());
+	env_set(ctx_uboot, "cpu", get_cpu_name());
 }
 
 int board_late_init(void)
board/gardena/smart-gateway-mt7688/board.c +8 -8
index bd494c84fc80..fe39187d0738 100644
@@ -70,9 +70,9 @@ static bool prepare_uuid_var(const char *fd_ptr, const char *env_var_name,
 			str[i] = errorchar;
 	}
 
-	env = env_get(env_var_name);
+	env = env_get(ctx_uboot, env_var_name);
 	if (strcmp(env, str)) {
-		env_set(env_var_name, str);
+		env_set(ctx_uboot, env_var_name, str);
 		env_updated = true;
 	}
 
@@ -134,9 +134,9 @@ static void factory_data_env_config(void)
 	if (!is_valid_ethaddr(ptr))
 		printf("F-Data:Invalid MAC addr: wifi_mac %s\n", str);
 
-	env = env_get("wifiaddr");
+	env = env_get(ctx_uboot, "wifiaddr");
 	if (strcmp(env, str)) {
-		env_set("wifiaddr", str);
+		env_set(ctx_uboot, "wifiaddr", str);
 		env_updated = 1;
 	}
 
@@ -146,9 +146,9 @@ static void factory_data_env_config(void)
 	if (!is_valid_ethaddr(ptr))
 		printf("F-Data:Invalid MAC addr: eth_mac %s\n", str);
 
-	env = env_get("ethaddr");
+	env = env_get(ctx_uboot, "ethaddr");
 	if (strcmp(env, str)) {
-		env_set("ethaddr", str);
+		env_set(ctx_uboot, "ethaddr", str);
 		env_updated = 1;
 	}
 
@@ -161,7 +161,7 @@ static void factory_data_env_config(void)
 	/* Check if the environment was updated and needs to get stored */
 	if (env_updated != 0) {
 		printf("F-Data:Values don't match env values -> saving\n");
-		env_save();
+		env_save(ctx_uboot);
 	} else {
 		debug("F-Data:Values match current env values\n");
 	}
@@ -189,7 +189,7 @@ static void copy_or_generate_uuid(char *fd_ptr, const char *env_var_name)
 	char *env;
 
 	/* Don't use the UUID dest place, as the \0 char won't fit */
-	env = env_get(env_var_name);
+	env = env_get(ctx_uboot, env_var_name);
 	if (env)
 		strncpy(str, env, UUID_STR_LEN);
 	else
board/gateworks/gw_ventana/common.c +1 -1
index 1240a9da174f..0be40c2336ad 100644
@@ -1477,7 +1477,7 @@ void setup_board_gpio(int board, struct ventana_board_info *info)
 	char arg[10];
 	size_t len;
 	int i;
-	int quiet = simple_strtol(env_get("quiet"), NULL, 10);
+	int quiet = simple_strtol(env_get(ctx_uboot, "quiet"), NULL, 10);
 
 	if (board >= GW_UNKNOWN)
 		return;
board/gateworks/gw_ventana/gw_ventana.c +31 -30

174 lines not on this page · raw message

board/gateworks/gw_ventana/gw_ventana_spl.c +2 -2
index b0891379a170..a689ec16d98c 100644
@@ -758,8 +758,8 @@ int spl_start_uboot(void)
 	debug("%s\n", __func__);
 #ifdef CONFIG_SPL_ENV_SUPPORT
 	env_init();
-	env_load();
-	debug("boot_os=%s\n", env_get("boot_os"));
+	env_load(ctx_uboot);
+	debug("boot_os=%s\n", env_get(ctx_uboot, "boot_os"));
 	if (env_get_yesno("boot_os") == 1)
 		ret = 0;
 #else
board/gdsys/a38x/keyprogram.c +2 -2
index 000897984a6e..f65190d814c2 100644
@@ -131,12 +131,12 @@ int load_and_run_keyprog(struct udevice *tpm)
 	char *hexprog;
 	struct key_program *prog;
 
-	cmd = env_get("loadkeyprogram");
+	cmd = env_get(ctx_uboot, "loadkeyprogram");
 
 	if (!cmd || run_command(cmd, 0))
 		return 1;
 
-	hexprog = env_get("keyprogram");
+	hexprog = env_get(ctx_uboot, "keyprogram");
 
 	if (decode_hexstr(hexprog, &binprog))
 		return 1;
board/gdsys/mpc8308/gazerbeam.c +2 -2
index ddd6ee895384..4929296364b3 100644
@@ -85,7 +85,7 @@ int board_early_init_r(void)
 int checkboard(void)
 {
 	struct udevice *board;
-	char *s = env_get("serial#");
+	char *s = env_get(ctx_uboot, "serial#");
 	int mc = 0;
 	int con = 0;
 
@@ -137,7 +137,7 @@ int last_stage_init(void)
 			printf("Could not determind FPGA HW revision (res = %d)\n", res);
 	}
 
-	env_set_ulong("fpga_hw_rev", fpga_hw_rev);
+	env_set_ulong(ctx_uboot, "fpga_hw_rev", fpga_hw_rev);
 
 	ret = get_tpm(&tpm);
 	if (ret || tpm_init(tpm) || tpm_startup(tpm, TPM_ST_CLEAR) ||
board/gdsys/mpc8308/hrcon.c +1 -1
index 60faa4688cf8..666eb25c809c 100644
@@ -101,7 +101,7 @@ int fpga_get_reg(u32 fpga, u16 *reg, off_t regoff, u16 *data)
 
 int checkboard(void)
 {
-	char *s = env_get("serial#");
+	char *s = env_get(ctx_uboot, "serial#");
 	bool hw_type_cat = pca9698_get_value(0x20, 20);
 
 	puts("Board: ");
board/gdsys/mpc8308/strider.c +1 -1
index 886bc2b035de..cc3fcd7de172 100644
@@ -104,7 +104,7 @@ int fpga_get_reg(u32 fpga, u16 *reg, off_t regoff, u16 *data)
 
 int checkboard(void)
 {
-	char *s = env_get("serial#");
+	char *s = env_get(ctx_uboot, "serial#");
 	bool hw_type_cat = pca9698_get_value(0x20, 18);
 
 	puts("Board: ");
board/gdsys/p1022/controlcenterd-id.c +5 -5
index 43f5404231f0..db7c92446e75 100644
@@ -231,7 +231,7 @@ static u8 *get_2nd_stage_bl_location(ulong target_addr)
 {
 	ulong addr;
 #ifdef CCDM_SECOND_STAGE
-	addr = env_get_ulong("loadaddr", 16, CONFIG_LOADADDR);
+	addr = env_get_ulong(ctx_uboot, "loadaddr", 16, CONFIG_LOADADDR);
 #else
 	addr = target_addr;
 #endif
@@ -249,7 +249,7 @@ static u8 *get_image_location(void)
 {
 	ulong addr;
 	/* TODO use other area? */
-	addr = env_get_ulong("loadaddr", 16, CONFIG_LOADADDR);
+	addr = env_get_ulong(ctx_uboot, "loadaddr", 16, CONFIG_LOADADDR);
 	return (u8 *)(addr);
 }
 #endif
@@ -1072,13 +1072,13 @@ static int second_stage_init(void)
 		goto failure;
 
 	/* run "prepboot" from env to get "mmcdev" set */
-	cptr = env_get("prepboot");
+	cptr = env_get(ctx_uboot, "prepboot");
 	if (cptr && !run_command(cptr, 0))
-		mmcdev = env_get("mmcdev");
+		mmcdev = env_get(ctx_uboot, "mmcdev");
 	if (!mmcdev)
 		goto failure;
 
-	cptr = env_get("ramdiskimage");
+	cptr = env_get(ctx_uboot, "ramdiskimage");
 	if (cptr)
 		image_path = cptr;
 
board/gdsys/p1022/controlcenterd.c +1 -1
index 6eb3d6c5d06e..ec349d61ee33 100644
@@ -222,7 +222,7 @@ void hw_watchdog_reset(void)
 #ifdef CONFIG_TRAILBLAZER
 int do_bootd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
-	return run_command(env_get("bootcmd"), flag);
+	return run_command(env_get(ctx_uboot, "bootcmd"), flag);
 }
 
 int board_early_init_r(void)
board/ge/bx50v3/bx50v3.c +7 -6
index 917ecc4c1816..3262a73d0b80 100644
@@ -470,17 +470,17 @@ static void process_vpd(struct vpd_cache *vpd)
 
 	switch (vpd->product_id) {
 	case VPD_PRODUCT_B450:
-		env_set("confidx", "1");
+		env_set(ctx_uboot, "confidx", "1");
 		i210_index = 0;
 		fec_index = 1;
 		break;
 	case VPD_PRODUCT_B650:
-		env_set("confidx", "2");
+		env_set(ctx_uboot, "confidx", "2");
 		i210_index = 0;
 		fec_index = 1;
 		break;
 	case VPD_PRODUCT_B850:
-		env_set("confidx", "3");
+		env_set(ctx_uboot, "confidx", "3");
 		i210_index = 1;
 		fec_index = 2;
 		break;
@@ -647,9 +647,10 @@ int board_late_init(void)
 #endif
 
 	if (is_b850v3())
-		env_set("videoargs", "video=DP-1:1024x768 at 60 video=HDMI-A-1:1024x768 at 60");
+		env_set(ctx_uboot, "videoargs",
+			"video=DP-1:1024x768 at 60 video=HDMI-A-1:1024x768 at 60");
 	else
-		env_set("videoargs", "video=LVDS-1:1024x768 at 65");
+		env_set(ctx_uboot, "videoargs", "video=LVDS-1:1024x768 at 65");
 
 	/* board specific pmic init */
 	pmic_init();
@@ -669,7 +670,7 @@ static void remove_ethaddr_env_var(int index)
 	char env_var_name[9];
 
 	sprintf(env_var_name, index == 0 ? "ethaddr" : "eth%daddr", index);
-	env_set(env_var_name, NULL);
+	env_set(ctx_uboot, env_var_name, NULL);
 }
 
 int last_stage_init(void)
board/ge/common/ge_common.c +2 -2
index 501c8b2daf2a..1d5f7ac39350 100644
@@ -29,7 +29,7 @@ void check_time(void)
 	}
 
 	if (ret < 0)
-		env_set("rtc_status", "RTC_ERROR");
+		env_set(ctx_uboot, "rtc_status", "RTC_ERROR");
 
 	if (tm.tm_year > 2037) {
 		tm.tm_sec  = 0;
@@ -47,7 +47,7 @@ void check_time(void)
 		}
 
 		if (ret < 0)
-			env_set("rtc_status", "RTC_ERROR");
+			env_set(ctx_uboot, "rtc_status", "RTC_ERROR");
 	}
 
 	i2c_set_bus_num(current_i2c_bus);
board/ge/mx53ppd/mx53ppd.c +1 -1
index 544856729821..f2a76dc1ded8 100644
@@ -274,7 +274,7 @@ int misc_init_r(void)
 	else
 		cause = "POR";
 
-	env_set("bootcause", cause);
+	env_set(ctx_uboot, "bootcause", cause);
 
 	return 0;
 }
board/grinn/chiliboard/board.c +2 -2
index c6d53600fa1c..933bdc779601 100644
@@ -117,7 +117,7 @@ int board_late_init(void)
 	mac_addr[4] = mac_lo & 0xFF;
 	mac_addr[5] = (mac_lo & 0xFF00) >> 8;
 
-	if (!env_get("ethaddr")) {
+	if (!env_get(ctx_uboot, "ethaddr")) {
 		printf("<ethaddr> not set. Validating first E-fuse MAC\n");
 
 		if (is_valid_ethaddr(mac_addr))
@@ -133,7 +133,7 @@ int board_late_init(void)
 	mac_addr[4] = mac_lo & 0xFF;
 	mac_addr[5] = (mac_lo & 0xFF00) >> 8;
 
-	if (!env_get("eth1addr")) {
+	if (!env_get(ctx_uboot, "eth1addr")) {
 		if (is_valid_ethaddr(mac_addr))
 			eth_env_set_enetaddr("eth1addr", mac_addr);
 	}
board/grinn/liteboard/board.c +3 -3
index 1558ea4b84f5..53eabe2e4b3b 100644
@@ -127,7 +127,7 @@ int board_mmc_init(bd_t *bis)
 
 static int check_mmc_autodetect(void)
 {
-	char *autodetect_str = env_get("mmcautodetect");
+	char *autodetect_str = env_get(ctx_uboot, "mmcautodetect");
 
 	if ((autodetect_str != NULL) &&
 	    (strcmp(autodetect_str, "yes") == 0)) {
@@ -146,12 +146,12 @@ void board_late_mmc_init(void)
 	if (!check_mmc_autodetect())
 		return;
 
-	env_set_ulong("mmcdev", dev_no);
+	env_set_ulong(ctx_uboot, "mmcdev", dev_no);
 
 	/* Set mmcblk env */
 	sprintf(mmcblk, "/dev/mmcblk%dp2 rootwait rw",
 		dev_no);
-	env_set("mmcroot", mmcblk);
+	env_set(ctx_uboot, "mmcroot", mmcblk);
 
 	sprintf(cmd, "mmc dev %d", dev_no);
 	run_command(cmd, 0);
board/highbank/highbank.c +5 -4
index 9563763dfa53..ef2f6f1f16a8 100644
@@ -80,11 +80,12 @@ int misc_init_r(void)
 
 	boot_choice = readl(HB_SREG_A9_BOOT_SRC_STAT) & 0xff;
 	sprintf(envbuffer, "bootcmd%d", boot_choice);
-	if (env_get(envbuffer)) {
+	if (env_get(ctx_uboot, envbuffer)) {
 		sprintf(envbuffer, "run bootcmd%d", boot_choice);
-		env_set("bootcmd", envbuffer);
-	} else
-		env_set("bootcmd", "");
+		env_set(ctx_uboot, "bootcmd", envbuffer);
+	} else {
+		env_set(ctx_uboot, "bootcmd", "");
+	}
 
 	return 0;
 }
board/hisilicon/poplar/poplar.c +1 -1
index 4926419a905a..1177e91a688a 100644
@@ -177,7 +177,7 @@ int board_usb_init(int index, enum usb_init_type init)
 
 int g_dnl_bind_fixup(struct usb_device_descriptor *dev, const char *name)
 {
-	if (!env_get("serial#"))
+	if (!env_get(ctx_uboot, "serial#"))
 		g_dnl_set_serialnumber("0123456789POPLAR");
 	return 0;
 }
board/imgtec/ci20/ci20.c +3 -3
index 5368b67b38b6..a34553a7bb3b 100644
@@ -181,12 +181,12 @@ int misc_init_r(void)
 	eth_env_set_enetaddr("ethaddr", otp.mac);
 
 	/* Put other board information into the environment */
-	env_set_ulong("serial#", otp.serial_number);
-	env_set_ulong("board_date", otp.date);
+	env_set_ulong(ctx_uboot, "serial#", otp.serial_number);
+	env_set_ulong(ctx_uboot, "board_date", otp.date);
 	manufacturer[0] = otp.manufacturer[0];
 	manufacturer[1] = otp.manufacturer[1];
 	manufacturer[2] = 0;
-	env_set("board_mfr", manufacturer);
+	env_set(ctx_uboot, "board_mfr", manufacturer);
 
 	return 0;
 }
board/intel/edison/edison.c +7 -7
index f56b5b1affef..2de8a4936286 100644
@@ -71,14 +71,14 @@ static void assign_serial(void)
 
 	snprintf(usb0addr, sizeof(usb0addr), "02:00:86:%02x:%02x:%02x",
 		 ssn[13], ssn[14], ssn[15]);
-	env_set("usb0addr", usb0addr);
+	env_set(ctx_uboot, "usb0addr", usb0addr);
 
 	for (i = 0; i < 16; i++)
 		snprintf(&serial[2 * i], 3, "%02x", ssn[i]);
-	env_set("serial#", serial);
+	env_set(ctx_uboot, "serial#", serial);
 
 #if defined(CONFIG_CMD_SAVEENV) && !defined(CONFIG_ENV_IS_NOWHERE)
-	env_save();
+	env_save(ctx_uboot);
 #endif
 }
 
@@ -93,19 +93,19 @@ static void assign_hardware_id(void)
 		printf("Can't retrieve hardware revision\n");
 
 	snprintf(hardware_id, sizeof(hardware_id), "%02X", v.hardware_id);
-	env_set("hardware_id", hardware_id);
+	env_set(ctx_uboot, "hardware_id", hardware_id);
 
 #if defined(CONFIG_CMD_SAVEENV) && !defined(CONFIG_ENV_IS_NOWHERE)
-	env_save();
+	env_save(ctx_uboot);
 #endif
 }
 
 int board_late_init(void)
 {
-	if (!env_get("serial#"))
+	if (!env_get(ctx_uboot, "serial#"))
 		assign_serial();
 
-	if (!env_get("hardware_id"))
+	if (!env_get(ctx_uboot, "hardware_id"))
 		assign_hardware_id();
 
 	return 0;
board/isee/igep003x/board.c +3 -3
index a8c2b121a476..56ecf3497245 100644
@@ -193,13 +193,13 @@ int board_late_init(void)
 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
 	switch (get_board_revision()) {
 		case 0:
-			env_set("board_name", "igep0034-lite");
+			env_set(ctx_uboot, "board_name", "igep0034-lite");
 			break;
 		case 1:
-			env_set("board_name", "igep0034");
+			env_set(ctx_uboot, "board_name", "igep0034");
 			break;
 		default:
-			env_set("board_name", "igep0033");
+			env_set(ctx_uboot, "board_name", "igep0033");
 			break;
 	}
 #endif
board/isee/igep00x0/igep00x0.c +2 -2
index 74fc5f08900a..42476b2b657b 100644
@@ -199,8 +199,8 @@ void set_boardname(void)
 	int i = get_board_revision();
 
 	rev[i+1] = 0;
-	env_set("board_rev", rev + i);
-	env_set("board_name", i < 2 ? "igep0020" : "igep0030");
+	env_set(ctx_uboot, "board_rev", rev + i);
+	env_set(ctx_uboot, "board_name", i < 2 ? "igep0020" : "igep0030");
 }
 
 /*
board/k+p/kp_imx53/kp_id_rev.c +10 -10
index 9dae54dda5fc..5c9258912c89 100644
@@ -31,7 +31,7 @@ void show_eeprom(void)
 
 	if (!strncmp(safe_string, "TQM", 3)) {
 		printf("  ID: %s\n", safe_string);
-		env_set("boardtype", safe_string);
+		env_set(ctx_uboot, "boardtype", safe_string);
 	} else {
 		puts("  unknown hardware variant\n");
 	}
@@ -45,7 +45,7 @@ void show_eeprom(void)
 
 	if (strlen(safe_string) == 8) {
 		printf("  SN: %s\n", safe_string);
-		env_set("serial#", safe_string);
+		env_set(ctx_uboot, "serial#", safe_string);
 	} else {
 		puts("  unknown serial number\n");
 	}
@@ -103,18 +103,18 @@ int read_board_id(void)
 	sprintf(rev_str, "%02X", rev_id);
 	if (rev_id & 0x80) {
 		printf("BBoard:4x00 Rev:%s\n", rev_str);
-		env_set("boardtype", "ddc");
-		env_set("fit_config", "imx53_kb_conf");
+		env_set(ctx_uboot, "boardtype", "ddc");
+		env_set(ctx_uboot, "fit_config", "imx53_kb_conf");
 	} else {
 		printf("BBoard:40x0 Rev:%s\n", rev_str);
-		env_set("boardtype", "hsc");
-		env_set("fit_config", "imx53_kb_40x0_conf");
+		env_set(ctx_uboot, "boardtype", "hsc");
+		env_set(ctx_uboot, "fit_config", "imx53_kb_40x0_conf");
 	}
 
-	sprintf(buf, "kp-%s", env_get("boardtype"));
-	env_set("boardname", buf);
-	env_set("boardsoc", "imx53");
-	env_set("kb53_rev", rev_str);
+	sprintf(buf, "kp-%s", env_get(ctx_uboot, "boardtype"));
+	env_set(ctx_uboot, "boardname", buf);
+	env_set(ctx_uboot, "boardsoc", "imx53");
+	env_set(ctx_uboot, "kb53_rev", rev_str);
 
 	return 0;
 }
board/k+p/kp_imx53/kp_imx53.c +2 -2
index 84cddd489490..36b9b9377f03 100644
@@ -124,9 +124,9 @@ void board_misc_setup(void)
 	gpio_direction_input(KEY1);
 
 	if (gpio_get_value(KEY1))
-		env_set("key1", "off");
+		env_set(ctx_uboot, "key1", "off");
 	else
-		env_set("key1", "on");
+		env_set(ctx_uboot, "key1", "on");
 }
 
 int board_late_init(void)
board/k+p/kp_imx6q_tpc/kp_imx6q_tpc.c +2 -2
index 2c541ace0210..9536ae2171d2 100644
@@ -290,8 +290,8 @@ int board_late_init(void)
 	add_board_boot_modes(board_boot_modes);
 #endif
 
-	env_set("boardname", "kp-tpc");
-	env_set("boardsoc", "imx6q");
+	env_set(ctx_uboot, "boardname", "kp-tpc");
+	env_set(ctx_uboot, "boardsoc", "imx6q");
 	return 0;
 }
 
board/keymile/common/common.c +13 -13
index 08f7f8d88451..3e15a063b34a 100644
@@ -51,24 +51,24 @@ int set_km_env(void)
 	pnvramaddr = gd->ram_size - CONFIG_KM_RESERVED_PRAM - CONFIG_KM_PHRAM
 			- CONFIG_KM_PNVRAM;
 	sprintf((char *)buf, "0x%x", pnvramaddr);
-	env_set("pnvramaddr", (char *)buf);
+	env_set(ctx_uboot, "pnvramaddr", (char *)buf);
 
 	/* try to read rootfssize (ram image) from environment */
-	p = env_get("rootfssize");
+	p = env_get(ctx_uboot, "rootfssize");
 	if (p != NULL)
 		strict_strtoul(p, 16, &rootfssize);
 	pram = (rootfssize + CONFIG_KM_RESERVED_PRAM + CONFIG_KM_PHRAM +
 		CONFIG_KM_PNVRAM) / 0x400;
 	sprintf((char *)buf, "0x%x", pram);
-	env_set("pram", (char *)buf);
+	env_set(ctx_uboot, "pram", (char *)buf);
 
 	varaddr = gd->ram_size - CONFIG_KM_RESERVED_PRAM - CONFIG_KM_PHRAM;
 	sprintf((char *)buf, "0x%x", varaddr);
-	env_set("varaddr", (char *)buf);
+	env_set(ctx_uboot, "varaddr", (char *)buf);
 
 	kernelmem = gd->ram_size - 0x400 * pram;
 	sprintf((char *)buf, "0x%x", kernelmem);
-	env_set("kernelmem", (char *)buf);
+	env_set(ctx_uboot, "kernelmem", (char *)buf);
 
 	return 0;
 }
@@ -169,7 +169,7 @@ static int do_setboardid(cmd_tbl_t *cmdtp, int flag, int argc,
 		return 1;
 	}
 	strcpy((char *)buf, p);
-	env_set("boardid", (char *)buf);
+	env_set(ctx_uboot, "boardid", (char *)buf);
 	printf("set boardid=%s\n", buf);
 
 	p = get_local_var("IVM_HWKey");
@@ -178,7 +178,7 @@ static int do_setboardid(cmd_tbl_t *cmdtp, int flag, int argc,
 		return 1;
 	}
 	strcpy((char *)buf, p);
-	env_set("hwkey", (char *)buf);
+	env_set(ctx_uboot, "hwkey", (char *)buf);
 	printf("set hwkey=%s\n", buf);
 	printf("Execute manually saveenv for persistent storage.\n");
 
@@ -236,10 +236,10 @@ static int do_checkboardidhwk(cmd_tbl_t *cmdtp, int flag, int argc,
 	}
 
 	/* now try to read values from environment if available */
-	p = env_get("boardid");
+	p = env_get(ctx_uboot, "boardid");
 	if (p != NULL)
 		rc = strict_strtoul(p, 16, &envbid);
-	p = env_get("hwkey");
+	p = env_get(ctx_uboot, "hwkey");
 	if (p != NULL)
 		rc = strict_strtoul(p, 16, &envhwkey);
 
@@ -253,7 +253,7 @@ static int do_checkboardidhwk(cmd_tbl_t *cmdtp, int flag, int argc,
 		 * BoardId/HWkey not available in the environment, so try the
 		 * environment variable for BoardId/HWkey list
 		 */
-		char *bidhwklist = env_get("boardIdListHex");
+		char *bidhwklist = env_get(ctx_uboot, "boardIdListHex");
 
 		if (bidhwklist) {
 			int found = 0;
@@ -311,9 +311,9 @@ static int do_checkboardidhwk(cmd_tbl_t *cmdtp, int flag, int argc,
 					envbid   = bid;
 					envhwkey = hwkey;
 					sprintf(buf, "%lx", bid);
-					env_set("boardid", buf);
+					env_set(ctx_uboot, "boardid", buf);
 					sprintf(buf, "%lx", hwkey);
-					env_set("hwkey", buf);
+					env_set(ctx_uboot, "hwkey", buf);
 				}
 			} /* end while( ! found ) */
 		}
@@ -355,7 +355,7 @@ static int do_checktestboot(cmd_tbl_t *cmdtp, int flag, int argc,
 #if defined(CONFIG_POST)
 	testpin = post_hotkeys_pressed();
 #endif
-	s = env_get("test_bank");
+	s = env_get(ctx_uboot, "test_bank");
 	/* when test_bank is not set, act as if testpin is not asserted */
 	testboot = (testpin != 0) && (s);
 	if (verbose) {
board/keymile/common/ivm.c +4 -4
index 50df44d1c110..d255a34ae677 100644
@@ -261,7 +261,7 @@ int ivm_analyze_eeprom(unsigned char *buf, int len)
 
 	GET_STRING("IVM_Symbol", IVM_POS_SYMBOL_ONLY, 8)
 	GET_STRING("IVM_DeviceName", IVM_POS_SHORT_TEXT, 64)
-	tmp = (unsigned char *)env_get("IVM_DeviceName");
+	tmp = (unsigned char *)env_get(ctx_uboot, "IVM_DeviceName");
 	if (tmp) {
 		int	len = strlen((char *)tmp);
 		int	i = 0;
@@ -310,16 +310,16 @@ static int ivm_populate_env(unsigned char *buf, int len)
 #ifndef CONFIG_KMTEGR1
 	/* if an offset is defined, add it */
 	process_mac(valbuf, page2, CONFIG_PIGGY_MAC_ADRESS_OFFSET, true);
-	env_set((char *)"ethaddr", (char *)valbuf);
+	env_set(ctx_uboot, (char *)"ethaddr", (char *)valbuf);
 #else
 /* KMTEGR1 has a special setup. eth0 has no connection to the outside and
  * gets an locally administred MAC address, eth1 is the debug interface and
  * gets the official MAC address from the IVM
  */
 	process_mac(valbuf, page2, CONFIG_PIGGY_MAC_ADRESS_OFFSET, false);
-	env_set((char *)"ethaddr", (char *)valbuf);
+	env_set(ctx_uboot, (char *)"ethaddr", (char *)valbuf);
 	process_mac(valbuf, page2, CONFIG_PIGGY_MAC_ADRESS_OFFSET, true);
-	env_set((char *)"eth1addr", (char *)valbuf);
+	env_set(ctx_uboot, (char *)"eth1addr", (char *)valbuf);
 #endif
 
 	return 0;
board/keymile/km83xx/km83xx.c +1 -1
index 8846b64f7d79..68a1ddb886b9 100644
@@ -199,7 +199,7 @@ int last_stage_init(void)
 	if (dip_switch != 0) {
 		/* start bootloader */
 		puts("DIP:   Enabled\n");
-		env_set("actual_bank", "0");
+		env_set(ctx_uboot, "actual_bank", "0");
 	}
 #endif
 	set_km_env();
board/keymile/km_arm/km_arm.c +3 -3
index 922cc621f780..0c2ede5231bb 100644
@@ -193,7 +193,7 @@ static void set_bootcount_addr(void)
 	unsigned int bootcountaddr;
 	bootcountaddr = gd->ram_size - BOOTCOUNT_ADDR;
 	sprintf((char *)buf, "0x%x", bootcountaddr);
-	env_set("bootcountaddr", (char *)buf);
+	env_set(ctx_uboot, "bootcountaddr", (char *)buf);
 }
 
 int misc_init_r(void)
@@ -201,7 +201,7 @@ int misc_init_r(void)
 #if defined(CONFIG_KM_MGCOGE3UN)
 	char *wait_for_ne;
 	u8 dip_switch = kw_gpio_get_value(KM_FLASH_ERASE_ENABLE);
-	wait_for_ne = env_get("waitforne");
+	wait_for_ne = env_get(ctx_uboot, "waitforne");
 
 	if ((wait_for_ne != NULL) && (dip_switch == 0)) {
 		if (strcmp(wait_for_ne, "true") == 0) {
@@ -299,7 +299,7 @@ int board_late_init(void)
 	if (dip_switch != 0) {
 		/* start bootloader */
 		puts("DIP:   Enabled\n");
-		env_set("actual_bank", "0");
+		env_set(ctx_uboot, "actual_bank", "0");
 	}
 #endif
 
board/keymile/kmp204x/kmp204x.c +2 -2
index 4d1e38aa3a7a..f4901f6bed9d 100644
@@ -220,7 +220,7 @@ int last_stage_init(void)
 	if (dip_switch != 0) {
 		/* start bootloader */
 		puts("DIP:   Enabled\n");
-		env_set("actual_bank", "0");
+		env_set(ctx_uboot, "actual_bank", "0");
 	}
 #endif
 	set_km_env();
@@ -237,7 +237,7 @@ void fdt_fixup_fman_mac_addresses(void *blob)
 	unsigned char mac_addr[6];
 
 	/* get the mac addr from env */
-	tmp = env_get("ethaddr");
+	tmp = env_get(ctx_uboot, "ethaddr");
 	if (!tmp) {
 		printf("ethaddr env variable not defined\n");
 		return;
board/kosagi/novena/novena.c +1 -1
index b7b747d19658..968d455b45c6 100644
@@ -201,7 +201,7 @@ int misc_init_r(void)
 	int ret;
 
 	/* If 'ethaddr' is already set, do nothing. */
-	if (env_get("ethaddr"))
+	if (env_get(ctx_uboot, "ethaddr"))
 		return 0;
 
 	/* EEPROM is at bus 2. */
board/laird/wb50n/wb50n.c +1 -1
index a2f8eaf0ba34..cc7cd3cf7250 100644
@@ -122,7 +122,7 @@ int board_late_init(void)
 	for (p = name; *p != '\0'; *p = tolower(*p), p++)
 		;
 	strcat(name, "-wb50n");
-	env_set(LAIRD_NAME, name);
+	env_set(ctx_uboot, LAIRD_NAME, name);
 
 #endif
 
board/lg/sniper/sniper.c +2 -2
index b4205d6ed4c1..0dff96ef02aa 100644
@@ -133,8 +133,8 @@ int misc_init_r(void)
 	}
 
 	if (reboot_mode[0] > 0 && isascii(reboot_mode[0])) {
-		if (!env_get("reboot-mode"))
-			env_set("reboot-mode", (char *)reboot_mode);
+		if (!env_get(ctx_uboot, "reboot-mode"))
+			env_set(ctx_uboot, "reboot-mode", (char *)reboot_mode);
 	}
 
 	omap_reboot_mode_clear();
board/liebherr/display5/spl.c +2 -2
index 354b63e431f6..6ce1554e044d 100644
@@ -284,10 +284,10 @@ void board_boot_order(u32 *spl_boot_list)
 	/* 'fastboot' */
 	const char *s;
 
-	if (env_init() || env_load())
+	if (env_init() || env_load(ctx_uboot))
 		return;
 
-	s = env_get("BOOT_FROM");
+	s = env_get(ctx_uboot, "BOOT_FROM");
 	if (s && !bootcount_error() && strcmp(s, "ACTIVE") == 0) {
 		spl_boot_list[0] = BOOT_DEVICE_MMC1;
 		spl_boot_list[1] = spl_boot_device();
board/liebherr/mccmon6/mccmon6.c +3 -3
index 7d2751ab0393..6164317e607c 100644
@@ -367,7 +367,7 @@ int board_init(void)
 
 int board_late_init(void)
 {
-	env_set("board_name", "mccmon6");
+	env_set(ctx_uboot, "board_name", "mccmon6");
 
 	return 0;
 }
@@ -467,7 +467,7 @@ int spl_start_uboot(void)
 		return 1;
 
 	env_init();
-	ret = env_get_f("boot_os", s, sizeof(s));
+	ret = env_get_f("boot_os", s, sizeof(ctx_uboot, s));
 	if ((ret != -1) && (strcmp(s, "no") == 0))
 		return 1;
 
@@ -481,7 +481,7 @@ int spl_start_uboot(void)
 	 * recovery_status = <any value> -> start SWUpdate
 	 *
 	 */
-	ret = env_get_f("recovery_status", s, sizeof(s));
+	ret = env_get_f("recovery_status", s, sizeof(ctx_uboot, s));
 	if (ret != -1)
 		return 1;
 
board/logicpd/imx6/imx6logic.c +4 -4
index 7a59b89d94a2..204a92761459 100644
@@ -149,12 +149,12 @@ int board_init(void)
 
 int board_late_init(void)
 {
-	env_set("board_name", "imx6logic");
+	env_set(ctx_uboot, "board_name", "imx6logic");
 
 	if (is_mx6dq()) {
-		env_set("board_rev", "MX6DQ");
-		if (!env_get("fdt_file"))
-			env_set("fdt_file", "imx6q-logicpd.dtb");
+		env_set(ctx_uboot, "board_rev", "MX6DQ");
+		if (!env_get(ctx_uboot, "fdt_file"))
+			env_set(ctx_uboot, "fdt_file", "imx6q-logicpd.dtb");
 	}
 
 	return 0;
board/menlo/m53menlo/m53menlo.c +1 -1
index bda5f0df5bce..f84e0f7d5928 100644
@@ -339,7 +339,7 @@ int board_late_init(void)
 
 	splash_get_pos(&xpos, &ypos);
 
-	s = env_get("splashimage");
+	s = env_get(ctx_uboot, "splashimage");
 	if (!s)
 		return 0;
 
board/micronas/vct/vct.c +1 -1
index e73d16db3eaf..6ae3dceaef87 100644
@@ -72,7 +72,7 @@ int dram_init(void)
 int checkboard(void)
 {
 	char buf[64];
-	int i = env_get_f("serial#", buf, sizeof(buf));
+	int i = env_get_f("serial#", buf, sizeof(ctx_uboot, buf));
 	u32 config0 = read_c0_prid();
 
 	if ((config0 & 0xff0000) == PRID_COMP_LEGACY
board/nokia/rx51/rx51.c +5 -5
index 71ca79deab7f..ca486eab1e29 100644
@@ -234,18 +234,18 @@ void setup_board_tags(struct tag **in_params)
 	params->u.core.rootdev = 0x0;
 
 	/* append omap atag only if env setup_omap_atag is set to 1 */
-	str = env_get("setup_omap_atag");
+	str = env_get(ctx_uboot, "setup_omap_atag");
 	if (!str || str[0] != '1')
 		return;
 
-	str = env_get("setup_console_atag");
+	str = env_get(ctx_uboot, "setup_console_atag");
 	if (str && str[0] == '1')
 		setup_console_atag = 1;
 	else
 		setup_console_atag = 0;
 
-	setup_boot_reason_atag = env_get("setup_boot_reason_atag");
-	setup_boot_mode_atag = env_get("setup_boot_mode_atag");
+	setup_boot_reason_atag = env_get(ctx_uboot, "setup_boot_reason_atag");
+	setup_boot_mode_atag = env_get(ctx_uboot, "setup_boot_mode_atag");
 
 	params = *in_params;
 	t = (struct tag_omap *)&params->u;
@@ -413,7 +413,7 @@ int misc_init_r(void)
 
 	/* set env variable attkernaddr for relocated kernel */
 	sprintf(buf, "%#x", KERNEL_ADDRESS);
-	env_set("attkernaddr", buf);
+	env_set(ctx_uboot, "attkernaddr", buf);
 
 	/* initialize omap tags */
 	init_omap_tags();
board/overo/overo.c +23 -22

121 lines not on this page · raw message

board/phytec/pcm052/pcm052.c +2 -2
index e1ebe8e75d00..f66bacfb2172 100644
@@ -376,8 +376,8 @@ int board_late_init(void)
 	if ((reg & SRC_SBMR1_BOOTCFG1_SDMMC) &&
 	    !(reg & SRC_SBMR1_BOOTCFG1_MMC)) {
 		printf("------ SD card boot -------\n");
-		env_set_default("!LVFBootloader", 0);
-		env_set("bootcmd",
+		env_set_default(ctx_uboot, "!LVFBootloader", 0);
+		env_set(ctx_uboot, "bootcmd",
 			"run prepare_install_bk4r1_envs; run install_bk4r1rs");
 	}
 
board/phytec/pfla02/pfla02.c +1 -1
index ae9ffe0390c3..bbcd8cf934d3 100644
@@ -392,7 +392,7 @@ int board_late_init(void)
 #endif
 
 	snprintf(buf, sizeof(buf), "%d", get_board_rev());
-	env_set("board_rev", buf);
+	env_set(ctx_uboot, "board_rev", buf);
 
 	return 0;
 }
board/qualcomm/dragonboard410c/dragonboard410c.c +3 -3
index d7f0f93fb109..bdf6e13ad06f 100644
@@ -139,8 +139,8 @@ int misc_init_r(void)
 	}
 
 	if (dm_gpio_get_value(&resin)) {
-		env_set("bootdelay", "-1");
-		env_set("bootcmd", "fastboot 0");
+		env_set(ctx_uboot, "bootdelay", "-1");
+		env_set(ctx_uboot, "bootcmd", "fastboot 0");
 		printf("key_vol_down pressed - Starting fastboot.\n");
 	}
 
@@ -158,7 +158,7 @@ int board_late_init(void)
 
 	memset(serial, 0, 16);
 	snprintf(serial, 13, "%x", msm_board_serial());
-	env_set("serial#", serial);
+	env_set(ctx_uboot, "serial#", serial);
 	return 0;
 }
 
board/qualcomm/dragonboard820c/dragonboard820c.c +1 -1
index 7a889646df8d..475e1aa64560 100644
@@ -155,7 +155,7 @@ int misc_init_r(void)
 	}
 
 	if (dm_gpio_get_value(&resin)) {
-		env_set("bootdelay", "-1");
+		env_set(ctx_uboot, "bootdelay", "-1");
 		printf("Power button pressed - dropping to console.\n");
 	}
 
board/raspberrypi/rpi/rpi.c +13 -13
index 7a6ca8f759e6..5d4d59fd25ca 100644
@@ -290,11 +290,11 @@ static void set_fdtfile(void)
 {
 	const char *fdtfile;
 
-	if (env_get("fdtfile"))
+	if (env_get(ctx_uboot, "fdtfile"))
 		return;
 
 	fdtfile = model->fdtfile;
-	env_set("fdtfile", fdtfile);
+	env_set(ctx_uboot, "fdtfile", fdtfile);
 }
 
 /*
@@ -303,13 +303,13 @@ static void set_fdtfile(void)
  */
 static void set_fdt_addr(void)
 {
-	if (env_get("fdt_addr"))
+	if (env_get(ctx_uboot, "fdt_addr"))
 		return;
 
 	if (fdt_magic(fw_dtb_pointer) != FDT_MAGIC)
 		return;
 
-	env_set_hex("fdt_addr", fw_dtb_pointer);
+	env_set_hex(ctx_uboot, "fdt_addr", fw_dtb_pointer);
 }
 
 /*
@@ -330,7 +330,7 @@ static void set_usbethaddr(void)
 	if (!model->has_onboard_eth)
 		return;
 
-	if (env_get("usbethaddr"))
+	if (env_get(ctx_uboot, "usbethaddr"))
 		return;
 
 	BCM2835_MBOX_INIT_HDR(msg);
@@ -345,8 +345,8 @@ static void set_usbethaddr(void)
 
 	eth_env_set_enetaddr("usbethaddr", msg->get_mac_address.body.resp.mac);
 
-	if (!env_get("ethaddr"))
-		env_set("ethaddr", env_get("usbethaddr"));
+	if (!env_get(ctx_uboot, "ethaddr"))
+		env_set(ctx_uboot, "ethaddr", env_get("usbethaddr"));
 
 	return;
 }
@@ -357,13 +357,13 @@ static void set_board_info(void)
 	char s[11];
 
 	snprintf(s, sizeof(s), "0x%X", revision);
-	env_set("board_revision", s);
+	env_set(ctx_uboot, "board_revision", s);
 	snprintf(s, sizeof(s), "%d", rev_scheme);
-	env_set("board_rev_scheme", s);
+	env_set(ctx_uboot, "board_rev_scheme", s);
 	/* Can't rename this to board_rev_type since it's an ABI for scripts */
 	snprintf(s, sizeof(s), "0x%X", rev_type);
-	env_set("board_rev", s);
-	env_set("board_name", model->name);
+	env_set(ctx_uboot, "board_rev", s);
+	env_set(ctx_uboot, "board_name", model->name);
 }
 #endif /* CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG */
 
@@ -373,7 +373,7 @@ static void set_serial_number(void)
 	int ret;
 	char serial_string[17] = { 0 };
 
-	if (env_get("serial#"))
+	if (env_get(ctx_uboot, "serial#"))
 		return;
 
 	BCM2835_MBOX_INIT_HDR(msg);
@@ -388,7 +388,7 @@ static void set_serial_number(void)
 
 	snprintf(serial_string, sizeof(serial_string), "%016llx",
 		 msg->get_board_serial.body.resp.serial);
-	env_set("serial#", serial_string);
+	env_set(ctx_uboot, "serial#", serial_string);
 }
 
 int misc_init_r(void)
board/renesas/alt/alt.c +2 -1
index 10ef7f931b1f..bc94a22e9603 100644
@@ -128,7 +128,8 @@ void reset_cpu(ulong addr)
 		hang();
 }
 
-enum env_location env_get_location(enum env_operation op, int prio)
+enum env_location env_get_location(struct env_context *ctx,
+				   enum env_operation op, int prio)
 {
 	const u32 load_magic = 0xb33fc0de;
 
board/renesas/gose/gose.c +2 -1
index f86c9f1a6350..d3ec352e2a03 100644
@@ -134,7 +134,8 @@ void reset_cpu(ulong addr)
 		hang();
 }
 
-enum env_location env_get_location(enum env_operation op, int prio)
+enum env_location env_get_location(struct env_context *ctx,
+				   enum env_operation op, int prio)
 {
 	const u32 load_magic = 0xb33fc0de;
 
board/renesas/koelsch/koelsch.c +2 -1
index 841d337f4d3c..871308e405d3 100644
@@ -136,7 +136,8 @@ void reset_cpu(ulong addr)
 		hang();
 }
 
-enum env_location env_get_location(enum env_operation op, int prio)
+enum env_location env_get_location(struct env_context *ctx,
+				   enum env_operation op, int prio)
 {
 	const u32 load_magic = 0xb33fc0de;
 
board/renesas/lager/lager.c +2 -1
index 3cb1a56142a9..6867ae5c4008 100644
@@ -145,7 +145,8 @@ void reset_cpu(ulong addr)
 		hang();
 }
 
-enum env_location env_get_location(enum env_operation op, int prio)
+enum env_location env_get_location(struct env_context *ctx,
+				   enum env_operation op, int prio)
 {
 	const u32 load_magic = 0xb33fc0de;
 
board/renesas/porter/porter.c +2 -1
index 86f79da7fdb4..3dc9310e0fc4 100644
@@ -134,7 +134,8 @@ void reset_cpu(ulong addr)
 		hang();
 }
 
-enum env_location env_get_location(enum env_operation op, int prio)
+enum env_location env_get_location(struct env_context *ctx,
+				   enum env_operation op, int prio)
 {
 	const u32 load_magic = 0xb33fc0de;
 
board/renesas/sh7752evb/sh7752evb.c +2 -2
index d0b850f35d49..540ec9bfd019 100644
@@ -223,10 +223,10 @@ static void init_ethernet_mac(void)
 	for (i = 0; i < SH7752EVB_ETHERNET_NUM_CH; i++) {
 		get_sh_eth_mac(i, mac_string, buf);
 		if (i == 0)
-			env_set("ethaddr", mac_string);
+			env_set(ctx_uboot, "ethaddr", mac_string);
 		else {
 			sprintf(env_string, "eth%daddr", i);
-			env_set(env_string, mac_string);
+			env_set(ctx_uboot, env_string, mac_string);
 		}
 		set_mac_to_sh_giga_eth_register(i, mac_string);
 	}
board/renesas/sh7753evb/sh7753evb.c +2 -2
index e1bed7dcc371..3ec2591cb7ed 100644
@@ -239,10 +239,10 @@ static void init_ethernet_mac(void)
 	for (i = 0; i < SH7753EVB_ETHERNET_NUM_CH; i++) {
 		get_sh_eth_mac(i, mac_string, buf);
 		if (i == 0)
-			env_set("ethaddr", mac_string);
+			env_set(ctx_uboot, "ethaddr", mac_string);
 		else {
 			sprintf(env_string, "eth%daddr", i);
-			env_set(env_string, mac_string);
+			env_set(ctx_uboot, env_string, mac_string);
 		}
 		set_mac_to_sh_giga_eth_register(i, mac_string);
 	}
board/renesas/sh7757lcr/sh7757lcr.c +3 -3
index d2671202e981..4b06387d5f22 100644
@@ -285,10 +285,10 @@ static void init_ethernet_mac(void)
 	for (i = 0; i < SH7757LCR_ETHERNET_NUM_CH; i++) {
 		get_sh_eth_mac(i, mac_string, buf);
 		if (i == 0)
-			env_set("ethaddr", mac_string);
+			env_set(ctx_uboot, "ethaddr", mac_string);
 		else {
 			sprintf(env_string, "eth%daddr", i);
-			env_set(env_string, mac_string);
+			env_set(ctx_uboot, env_string, mac_string);
 		}
 
 		set_mac_to_sh_eth_register(i, mac_string);
@@ -298,7 +298,7 @@ static void init_ethernet_mac(void)
 	for (i = 0; i < SH7757LCR_GIGA_ETHERNET_NUM_CH; i++) {
 		get_sh_eth_mac(i + SH7757LCR_ETHERNET_NUM_CH, mac_string, buf);
 		sprintf(env_string, "eth%daddr", i + SH7757LCR_ETHERNET_NUM_CH);
-		env_set(env_string, mac_string);
+		env_set(ctx_uboot, env_string, mac_string);
 
 		set_mac_to_sh_giga_eth_register(i, mac_string);
 	}
board/renesas/silk/silk.c +2 -1
index 25221e3c55cc..946232e3ba7b 100644
@@ -129,7 +129,8 @@ void reset_cpu(ulong addr)
 		hang();
 }
 
-enum env_location env_get_location(enum env_operation op, int prio)
+enum env_location env_get_location(struct env_context *ctx,
+				   enum env_operation op, int prio)
 {
 	const u32 load_magic = 0xb33fc0de;
 
board/renesas/stout/stout.c +2 -1
index 0a0ff5ff76d2..d0b20f3c5902 100644
@@ -125,7 +125,8 @@ int board_phy_config(struct phy_device *phydev)
 	return 0;
 }
 
-enum env_location env_get_location(enum env_operation op, int prio)
+enum env_location env_get_location(struct env_context *ctx,
+				   enum env_operation op, int prio)
 {
 	const u32 load_magic = 0xb33fc0de;
 
board/rockchip/kylin_rk3036/kylin_rk3036.c +1 -1
index 2faeab9baf51..6481f6c11633 100644
@@ -41,7 +41,7 @@ int rk_board_late_init(void)
 {
 	if (fastboot_key_pressed()) {
 		printf("enter fastboot!\n");
-		env_set("preboot", "setenv preboot; fastboot usb0");
+		env_set(ctx_uboot, "preboot", "setenv preboot; fastboot usb0");
 	}
 
 	return 0;
board/samsung/common/exynos5-dt.c +1 -1
index 387d1b91809c..1c44effe7224 100644
@@ -154,7 +154,7 @@ char *get_dfu_alt_system(char *interface, char *devstr)
 	if (board_is_odroidxu4() || board_is_odroidhc1() || board_is_odroidhc2())
 		return info;
 
-	return env_get("dfu_alt_system");
+	return env_get(ctx_uboot, "dfu_alt_system");
 }
 
 char *get_dfu_alt_boot(char *interface, char *devstr)
board/samsung/common/misc.c +7 -7
index 3ef1e7998013..3086df745fe5 100644
@@ -51,7 +51,7 @@ void set_dfu_alt_info(char *interface, char *devstr)
 
 	alt_setting = get_dfu_alt_boot(interface, devstr);
 	if (alt_setting) {
-		env_set("dfu_alt_boot", alt_setting);
+		env_set(ctx_uboot, "dfu_alt_boot", alt_setting);
 		offset = snprintf(buf, buf_size, "%s", alt_setting);
 	}
 
@@ -71,7 +71,7 @@ void set_dfu_alt_info(char *interface, char *devstr)
 		status = "done\n";
 	}
 
-	env_set("dfu_alt_info", alt_info);
+	env_set(ctx_uboot, "dfu_alt_info", alt_info);
 	puts(status);
 }
 #endif
@@ -83,14 +83,14 @@ void set_board_info(void)
 
 	snprintf(info, ARRAY_SIZE(info), "%u.%u", (s5p_cpu_rev & 0xf0) >> 4,
 		 s5p_cpu_rev & 0xf);
-	env_set("soc_rev", info);
+	env_set(ctx_uboot, "soc_rev", info);
 
 	snprintf(info, ARRAY_SIZE(info), "%x", s5p_cpu_id);
-	env_set("soc_id", info);
+	env_set(ctx_uboot, "soc_id", info);
 
 #ifdef CONFIG_REVISION_TAG
 	snprintf(info, ARRAY_SIZE(info), "%x", get_board_rev());
-	env_set("board_rev", info);
+	env_set(ctx_uboot, "board_rev", info);
 #endif
 #ifdef CONFIG_OF_LIBFDT
 	const char *bdtype = "";
@@ -102,11 +102,11 @@ void set_board_info(void)
 		bdtype = "";
 
 	sprintf(info, "%s%s", bdname, bdtype);
-	env_set("board_name", info);
+	env_set(ctx_uboot, "board_name", info);
 #endif
 	snprintf(info, ARRAY_SIZE(info),  "%s%x-%s%s.dtb",
 		 CONFIG_SYS_SOC, s5p_cpu_id, bdname, bdtype);
-	env_set("fdtfile", info);
+	env_set(ctx_uboot, "fdtfile", info);
 #endif
 }
 #endif /* CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG */
board/samsung/odroid/odroid.c +1 -1
index 9aa97f0f2cad..472dce81f680 100644
@@ -74,7 +74,7 @@ const char *get_board_type(void)
 #ifdef CONFIG_SET_DFU_ALT_INFO
 char *get_dfu_alt_system(char *interface, char *devstr)
 {
-	return env_get("dfu_alt_system");
+	return env_get(ctx_uboot, "dfu_alt_system");
 }
 
 char *get_dfu_alt_boot(char *interface, char *devstr)
board/samsung/trats/trats.c +1 -1
index ec85f707c19a..d4540a2ac932 100644
@@ -467,7 +467,7 @@ void exynos_lcd_misc_init(vidinfo_t *vid)
 #endif
 #ifdef CONFIG_S6E8AX0
 	s6e8ax0_init();
-	env_set("lcdinfo", "lcd=s6e8ax0");
+	env_set(ctx_uboot, "lcdinfo", "lcd=s6e8ax0");
 #endif
 }
 #endif
board/samsung/universal_c210/universal.c +1 -1
index ed9c5b50d927..9fea29e965bd 100644
@@ -397,6 +397,6 @@ void exynos_lcd_misc_init(vidinfo_t *vid)
 	vid->pclk_name = 1;	/* MPLL */
 	vid->sclk_div = 1;
 
-	env_set("lcdinfo", "lcd=ld9040");
+	env_set(ctx_uboot, "lcdinfo", "lcd=ld9040");
 }
 #endif
board/samtec/vining_fpga/socfpga.c +8 -8
index 1e095a4e7db0..75ddbcf07fa7 100644
@@ -62,30 +62,30 @@ int misc_init_r(void)
 	/* Check EEPROM signature. */
 	if (!(data[0] == 0xa5 && data[1] == 0x5a)) {
 		puts("Invalid I2C EEPROM signature.\n");
-		env_set("unit_serial", "invalid");
-		env_set("unit_ident", "VINing-xxxx-STD");
-		env_set("hostname", "vining-invalid");
+		env_set(ctx_uboot, "unit_serial", "invalid");
+		env_set(ctx_uboot, "unit_ident", "VINing-xxxx-STD");
+		env_set(ctx_uboot, "hostname", "vining-invalid");
 		return 0;
 	}
 
 	/* If 'unit_serial' is already set, do nothing. */
-	if (!env_get("unit_serial")) {
+	if (!env_get(ctx_uboot, "unit_serial")) {
 		/* This field is Big Endian ! */
 		serial = (data[0x54] << 24) | (data[0x55] << 16) |
 			 (data[0x56] << 8) | (data[0x57] << 0);
 		memset(str, 0, sizeof(str));
 		sprintf(str, "%07i", serial);
-		env_set("unit_serial", str);
+		env_set(ctx_uboot, "unit_serial", str);
 	}
 
-	if (!env_get("unit_ident")) {
+	if (!env_get(ctx_uboot, "unit_ident")) {
 		memset(str, 0, sizeof(str));
 		memcpy(str, &data[0x2e], 18);
-		env_set("unit_ident", str);
+		env_set(ctx_uboot, "unit_ident", str);
 	}
 
 	/* Set ethernet address from EEPROM. */
-	if (!env_get("ethaddr") && is_valid_ethaddr(&data[0x62]))
+	if (!env_get(ctx_uboot, "ethaddr") && is_valid_ethaddr(&data[0x62]))
 		eth_env_set_enetaddr("ethaddr", &data[0x62]);
 
 	return 0;
board/siemens/common/board.c +2 -2
index 676935a84321..63dcf2b83132 100644
@@ -121,7 +121,7 @@ unsigned char get_button_state(char * const envname, unsigned char def)
 	char *ptr_env;
 
 	/* If button is not found we take default */
-	ptr_env = env_get(envname);
+	ptr_env = env_get(ctx_uboot, envname);
 	if (NULL == ptr_env) {
 		gpio = def;
 	} else {
@@ -199,7 +199,7 @@ void set_env_gpios(unsigned char state)
 		strcat(str_tmp, num);
 
 		/* If env var is not found we stop */
-		ptr_env = env_get(str_tmp);
+		ptr_env = env_get(ctx_uboot, str_tmp);
 		if (NULL == ptr_env)
 			break;
 
board/siemens/draco/board.c +3 -3
index a6840b895b27..9cb1b1301855 100644
@@ -270,13 +270,13 @@ int board_late_init(void)
 #ifdef CONFIG_FACTORYSET
 	/* Set ASN in environment*/
 	if (factory_dat.asn[0] != 0) {
-		env_set("dtb_name", (char *)factory_dat.asn);
+		env_set(ctx_uboot, "dtb_name", (char *)factory_dat.asn);
 	} else {
 		/* dtb suffix gets added in load script */
-		env_set("dtb_name", "am335x-draco");
+		env_set(ctx_uboot, "dtb_name", "am335x-draco");
 	}
 #else
-	env_set("dtb_name", "am335x-draco");
+	env_set(ctx_uboot, "dtb_name", "am335x-draco");
 #endif
 
 	return 0;
board/siemens/pxm2/board.c +2 -2
index 30f0902701ee..e57ab33da88b 100644
@@ -444,12 +444,12 @@ int board_late_init(void)
 			factory_dat.pxm50 = 0;
 		sprintf(tmp, "%s_%s", factory_dat.asn,
 			factory_dat.comp_version);
-		ret = env_set("boardid", tmp);
+		ret = env_set(ctx_uboot, "boardid", tmp);
 		if (ret)
 			printf("error setting board id\n");
 	} else {
 		factory_dat.pxm50 = 1;
-		ret = env_set("boardid", "PXM50_1.0");
+		ret = env_set(ctx_uboot, "boardid", "PXM50_1.0");
 		if (ret)
 			printf("error setting board id\n");
 	}
board/siemens/rut/board.c +1 -1
index 539ecef22cb4..809cea42f86b 100644
@@ -480,7 +480,7 @@ int board_late_init(void)
 	else
 		strcpy(tmp, "QMX7.E38_4.0");
 
-	ret = env_set("boardid", tmp);
+	ret = env_set(ctx_uboot, "boardid", tmp);
 	if (ret)
 		printf("error setting board id\n");
 
board/siemens/taurus/taurus.c +26 -24

76 lines not on this page · raw message

board/socrates/socrates.c +2 -2
index da9ae5bebb7e..277f9e107080 100644
@@ -38,7 +38,7 @@ int checkboard (void)
 	volatile ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
 	char buf[64];
 	int f;
-	int i = env_get_f("serial#", buf, sizeof(buf));
+	int i = env_get_f("serial#", buf, sizeof(ctx_uboot, buf));
 #ifdef CONFIG_PCI
 	char *src;
 #endif
@@ -409,7 +409,7 @@ void board_backlight_switch (int flag)
 		printf ("hwmon IC init failed\n");
 
 	if (flag) {
-		param = env_get("brightness");
+		param = env_get(ctx_uboot, "brightness");
 		rc = param ? simple_strtol(param, NULL, 10) : -1;
 		if (rc < 0)
 			rc = DEFAULT_BRIGHTNESS;
board/softing/vining_2000/vining_2000.c +4 -4
index 51985b91c226..5d4d0f29c44f 100644
@@ -102,7 +102,7 @@ int board_eth_init(bd_t *bis)
 
 	/* just to get secound mac address */
 	imx_get_mac_from_fuse(1, eth1addr);
-	if (!env_get("eth1addr") && is_valid_ethaddr(eth1addr))
+	if (!env_get(ctx_uboot, "eth1addr") && is_valid_ethaddr(eth1addr))
 		eth_env_set_enetaddr("eth1addr", eth1addr);
 
 	imx_iomux_v3_setup_multiple_pads(fec1_pads, ARRAY_SIZE(fec1_pads));
@@ -385,11 +385,11 @@ static int set_pin_state(void)
 		return ret;
 
 	if (val >= VAL_UPPER)
-		env_set("pin_state", "connected");
+		env_set(ctx_uboot, "pin_state", "connected");
 	else if (val < VAL_UPPER && val > VAL_LOWER)
-		env_set("pin_state", "open");
+		env_set(ctx_uboot, "pin_state", "open");
 	else
-		env_set("pin_state", "button");
+		env_set(ctx_uboot, "pin_state", "button");
 
 	return ret;
 }
board/solidrun/mx6cuboxi/mx6cuboxi.c +8 -8
index f82fb0786a94..52177b918d83 100644
@@ -569,29 +569,29 @@ int board_late_init(void)
 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
 	switch (board_type()) {
 	case CUBOXI:
-		env_set("board_name", "CUBOXI");
+		env_set(ctx_uboot, "board_name", "CUBOXI");
 		break;
 	case HUMMINGBOARD:
-		env_set("board_name", "HUMMINGBOARD");
+		env_set(ctx_uboot, "board_name", "HUMMINGBOARD");
 		break;
 	case HUMMINGBOARD2:
-		env_set("board_name", "HUMMINGBOARD2");
+		env_set(ctx_uboot, "board_name", "HUMMINGBOARD2");
 		break;
 	case UNKNOWN:
 	default:
-		env_set("board_name", "CUBOXI");
+		env_set(ctx_uboot, "board_name", "CUBOXI");
 	}
 
 	if (is_mx6dq())
-		env_set("board_rev", "MX6Q");
+		env_set(ctx_uboot, "board_rev", "MX6Q");
 	else
-		env_set("board_rev", "MX6DL");
+		env_set(ctx_uboot, "board_rev", "MX6DL");
 
 	if (is_rev_15_som())
-		env_set("som_rev", "V15");
+		env_set(ctx_uboot, "som_rev", "V15");
 
 	if (has_emmc())
-		env_set("has_emmc", "yes");
+		env_set(ctx_uboot, "has_emmc", "yes");
 
 #endif
 
board/st/stm32f429-discovery/stm32f429-discovery.c +2 -2
index 500dc5fe3a6b..3ae0c17d7720 100644
@@ -65,13 +65,13 @@ int misc_init_r(void)
 	char serialno[25];
 	uint32_t u_id_low, u_id_mid, u_id_high;
 
-	if (!env_get("serial#")) {
+	if (!env_get(ctx_uboot, "serial#")) {
 		u_id_low  = readl(&STM32_U_ID->u_id_low);
 		u_id_mid  = readl(&STM32_U_ID->u_id_mid);
 		u_id_high = readl(&STM32_U_ID->u_id_high);
 		sprintf(serialno, "%08x%08x%08x",
 			u_id_high, u_id_mid, u_id_low);
-		env_set("serial#", serialno);
+		env_set(ctx_uboot, "serial#", serialno);
 	}
 
 	return 0;
board/st/stm32f429-evaluation/stm32f429-evaluation.c +2 -2
index 8ab2fa5d59ab..3a1c578cdad8 100644
@@ -59,13 +59,13 @@ int misc_init_r(void)
 	char serialno[25];
 	u32 u_id_low, u_id_mid, u_id_high;
 
-	if (!env_get("serial#")) {
+	if (!env_get(ctx_uboot, "serial#")) {
 		u_id_low  = readl(&STM32_U_ID->u_id_low);
 		u_id_mid  = readl(&STM32_U_ID->u_id_mid);
 		u_id_high = readl(&STM32_U_ID->u_id_high);
 		sprintf(serialno, "%08x%08x%08x",
 			u_id_high, u_id_mid, u_id_low);
-		env_set("serial#", serialno);
+		env_set(ctx_uboot, "serial#", serialno);
 	}
 
 	return 0;
board/st/stm32f469-discovery/stm32f469-discovery.c +2 -2
index 70d23d90f4ca..e475296919e0 100644
@@ -59,13 +59,13 @@ int misc_init_r(void)
 	char serialno[25];
 	u32 u_id_low, u_id_mid, u_id_high;
 
-	if (!env_get("serial#")) {
+	if (!env_get(ctx_uboot, "serial#")) {
 		u_id_low  = readl(&STM32_U_ID->u_id_low);
 		u_id_mid  = readl(&STM32_U_ID->u_id_mid);
 		u_id_high = readl(&STM32_U_ID->u_id_high);
 		sprintf(serialno, "%08x%08x%08x",
 			u_id_high, u_id_mid, u_id_low);
-		env_set("serial#", serialno);
+		env_set(ctx_uboot, "serial#", serialno);
 	}
 
 	return 0;
board/st/stm32mp1/stm32mp1.c +6 -5
index 279c7b779799..188f4a7eae12 100644
@@ -544,9 +544,9 @@ int board_late_init(void)
 				 &fdt_compat_len);
 	if (fdt_compat && fdt_compat_len) {
 		if (strncmp(fdt_compat, "st,", 3) != 0)
-			env_set("board_name", fdt_compat);
+			env_set(ctx_uboot, "board_name", fdt_compat);
 		else
-			env_set("board_name", fdt_compat + 3);
+			env_set(ctx_uboot, "board_name", fdt_compat + 3);
 	}
 #endif
 
@@ -623,7 +623,8 @@ int board_interface_eth_init(phy_interface_t interface_type,
 	return 0;
 }
 
-enum env_location env_get_location(enum env_operation op, int prio)
+enum env_location env_get_location(struct env_context *ctx,
+				   enum env_operation op, int prio)
 {
 	u32 bootmode = get_bootmode();
 
@@ -688,8 +689,8 @@ const char *env_ext4_get_dev_part(void)
 static const char *env_get_mtdparts(const char *str, char *buf)
 {
 	if (gd->flags & GD_FLG_ENV_READY)
-		return env_get(str);
-	if (env_get_f(str, buf, MTDPARTS_LEN) != -1)
+		return env_get(ctx_uboot, str);
+	if (env_get_f(ctx_uboot, str, buf, MTDPARTS_LEN) != -1)
 		return buf;
 
 	return NULL;
board/sunxi/board.c +13 -12
index e3b2d13892c8..d5f172eb8082 100644
@@ -194,7 +194,8 @@ void i2c_init_board(void)
 }
 
 #if defined(CONFIG_ENV_IS_IN_MMC) && defined(CONFIG_ENV_IS_IN_FAT)
-enum env_location env_get_location(enum env_operation op, int prio)
+enum env_location env_get_location(struct env_context *ctx,
+				   enum env_operation op, int prio)
 {
 	switch (prio) {
 	case 0:
@@ -725,7 +726,7 @@ void get_board_serial(struct tag_serialnr *serialnr)
 	char *serial_string;
 	unsigned long long serial;
 
-	serial_string = env_get("serial#");
+	serial_string = env_get(ctx_uboot, "serial#");
 
 	if (serial_string) {
 		serial = simple_strtoull(serial_string, NULL, 16);
@@ -764,7 +765,7 @@ static void parse_spl_header(const uint32_t spl_addr)
 		return;
 	}
 	/* otherwise assume .scr format (mkimage-type script) */
-	env_set_hex("fel_scriptaddr", spl->fel_script_address);
+	env_set_hex(ctx_uboot, "fel_scriptaddr", spl->fel_script_address);
 }
 
 /*
@@ -812,7 +813,7 @@ static void setup_environment(const void *fdt)
 			else
 				sprintf(ethaddr, "eth%daddr", i);
 
-			if (env_get(ethaddr))
+			if (env_get(ctx_uboot, ethaddr))
 				continue;
 
 			/* Non OUI / registered MAC address */
@@ -826,11 +827,11 @@ static void setup_environment(const void *fdt)
 			eth_env_set_enetaddr(ethaddr, mac_addr);
 		}
 
-		if (!env_get("serial#")) {
+		if (!env_get(ctx_uboot, "serial#")) {
 			snprintf(serial_string, sizeof(serial_string),
 				"%08x%08x", sid[0], sid[3]);
 
-			env_set("serial#", serial_string);
+			env_set(ctx_uboot, "serial#", serial_string);
 		}
 	}
 }
@@ -839,20 +840,20 @@ int misc_init_r(void)
 {
 	uint boot;
 
-	env_set("fel_booted", NULL);
-	env_set("fel_scriptaddr", NULL);
-	env_set("mmc_bootdev", NULL);
[… more lines in the raw message]

Lines of this file are not shown. View the raw message.

board/synopsys/hsdk/env-lib.c +7 -4
index f443c21e6d99..eca2211246b4 100644

Lines of this file are not shown. View the raw message.

board/synopsys/hsdk/hsdk.c +3 -3
index 8a7642a0aaaa..ab97b97bcde3 100644

Lines of this file are not shown. View the raw message.

board/syteco/zmx25/zmx25.c +5 -3
index d2318457b431..c49ac35c2933 100644

Lines of this file are not shown. View the raw message.

board/tcl/sl50/board.c +3 -3
index c7eed319461a..79598cd36a5e 100644

Lines of this file are not shown. View the raw message.

board/theobroma-systems/puma_rk3399/puma-rk3399.c +4 -4
index 47259b714961..d0150a127dd6 100644

Lines of this file are not shown. View the raw message.

board/ti/am335x/board.c +9 -9
index 7eaa6cd96d60..b1f432332d8c 100644

Lines of this file are not shown. View the raw message.

board/ti/am43xx/board.c +3 -3
index 2e09cc20e8c2..7eb71cd4d8d1 100644

Lines of this file are not shown. View the raw message.

board/ti/am57xx/board.c +7 -7
index f78e6c2e1f6e..222049d541de 100644

Lines of this file are not shown. View the raw message.

board/ti/beagle/beagle.c +22 -21

43 lines not on this page · raw message

board/ti/common/board_detect.c +7 -7
index bc89cc57bd78..fe776f2428d2 100644

Lines of this file are not shown. View the raw message.

board/ti/dra7xx/evm.c +6 -6
index 74d04bb1e393..63ac5b1988bf 100644

Lines of this file are not shown. View the raw message.

board/ti/evm/evm.c +1 -1
index d0b9bafbd1b6..4053eb7448a6 100644

Lines of this file are not shown. View the raw message.

board/ti/ks2_evm/board.c +5 -5
index e9bc68049b4b..aa447fd886cc 100644

Lines of this file are not shown. View the raw message.

board/ti/ks2_evm/board_k2g.c +4 -4
index 4ff9a44b3712..49c09b88bd83 100644

Lines of this file are not shown. View the raw message.

board/ti/panda/panda.c +2 -2
index 20199da390ec..9d42123de9cc 100644

Lines of this file are not shown. View the raw message.

board/toradex/apalis-imx8/apalis-imx8.c +2 -2
index af48b560952e..7e0f01534a9e 100644

Lines of this file are not shown. View the raw message.

board/toradex/apalis_imx6/apalis_imx6.c +6 -6
index 6421a22c25a7..c40ccedc4c9d 100644

Lines of this file are not shown. View the raw message.

board/toradex/colibri-imx6ull/colibri-imx6ull.c +3 -3
index d1ae463941ae..160b79ba0b27 100644

Lines of this file are not shown. View the raw message.

board/toradex/colibri-imx8x/colibri-imx8x.c +2 -2
index eae3c591a164..ef52f95dc93e 100644

Lines of this file are not shown. View the raw message.

board/toradex/colibri_imx6/colibri_imx6.c +4 -4
index ad40b589c1ed..1c1c1577eb1f 100644

Lines of this file are not shown. View the raw message.

board/toradex/colibri_vf/colibri_vf.c +1 -1
index 04d8ffd1e666..e466d8aad6e1 100644

Lines of this file are not shown. View the raw message.

board/toradex/common/tdx-cfg-block.c +1 -1
index 9c86230595b9..6897ced0f7fe 100644

Lines of this file are not shown. View the raw message.

board/toradex/common/tdx-common.c +1 -1
index e9441a7979d2..a51749dd78c2 100644

Lines of this file are not shown. View the raw message.

board/tqc/tqma6/tqma6.c +1 -1
index 5b20afd48814..f13126c2ee59 100644

Lines of this file are not shown. View the raw message.

board/udoo/neo/neo.c +1 -1
index 5c468a6a973e..2a61dc29ef92 100644

Lines of this file are not shown. View the raw message.

board/udoo/udoo.c +2 -2
index f2c2bf47b0fd..88bc24b2b475 100644

Lines of this file are not shown. View the raw message.

board/varisys/common/sys_eeprom.c +3 -3
index 77772a6923e4..5b248f8b0f44 100644

Lines of this file are not shown. View the raw message.

board/vscom/baltos/board.c +3 -3
index 1ba58d0f11dd..5e799d546786 100644

Lines of this file are not shown. View the raw message.

board/wandboard/wandboard.c +6 -6
index 69cdf3e9c96b..4ba472cae9b8 100644

Lines of this file are not shown. View the raw message.

board/warp7/warp7.c +3 -3
index 39ae98225738..549d65b3469d 100644

Lines of this file are not shown. View the raw message.

board/work-microwave/work_92105/work_92105_display.c +1 -1
index db04dcabc7bc..e673921b7bbc 100644

Lines of this file are not shown. View the raw message.

board/xes/common/board.c +3 -3
index 43575bc302d6..b5cc9a69508a 100644

Lines of this file are not shown. View the raw message.

board/xilinx/zynq/board.c +8 -8
index 35191b2f813b..509834c679ab 100644

Lines of this file are not shown. View the raw message.

board/xilinx/zynqmp/cmds.c +1 -1
index ed7ba58c6475..e5c1dab091ca 100644

Lines of this file are not shown. View the raw message.

board/xilinx/zynqmp/zynqmp.c +12 -12
index d649daba96d4..31e26fb097a4 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.21.0

Part of the diff is not shown here. View the raw message.

#12 lore raw

PATCH v5 9/19 board: converted with new env interfaces

Quoted 1 line · On Thu, 5 Sep 2019 17:21:23 +0900 AKASHI Takahiro…

env_xxx(...) -> env_xxx(ctx_uboot, ...)

To be honest this doesn't explain much about the issue this patch tries to fix (however, on the mailing list only this particular patch is present).

Could you provide more verbose description?

board/xilinx/zynqmp/zynqmp.c

Quoted 5,320 lines
---
 board/Arcturus/ucp1020/cmd_arc.c              | 40 ++++++------
 board/Arcturus/ucp1020/ucp1020.c              | 16 ++---
 board/BuR/brppt1/board.c                      |  4 +-
 board/BuR/brxre1/board.c                      |  9 +--
 board/BuR/common/br_resetc.c                  |  2 +-
 board/BuR/common/common.c                     | 47 +++++++-------
 board/BuS/eb_cpu5282/eb_cpu5282.c             |  8 +--
 board/CZ.NIC/turris_mox/turris_mox.c          |  4 +-
 board/CZ.NIC/turris_omnia/turris_omnia.c      |  6 +-
 board/CarMediaLab/flea3/flea3.c               |  2 +-
 board/LaCie/net2big_v2/net2big_v2.c           |  2 +-
 board/LaCie/netspace_v2/netspace_v2.c         |  2 +-
 board/Synology/ds414/cmd_syno.c               |  6 +-
 board/alliedtelesis/x530/x530.c               |  2 +-
 board/amazon/kc1/kc1.c                        |  4 +-
 board/amlogic/p200/p200.c                     |  4 +-
 board/amlogic/p201/p201.c                     |  4 +-
 board/amlogic/p212/p212.c                     |  4 +-
 board/amlogic/q200/q200.c                     |  4 +-
 board/aristainetos/aristainetos-v2.c          |  8 +--
 board/armltd/integrator/integrator.c          |  2 +-
 board/atmel/common/board.c                    |  4 +-
 board/atmel/common/mac_eeprom.c               |  2 +-
 board/atmel/sama5d3xek/sama5d3xek.c           |  2 +-
 board/bachmann/ot1200/ot1200.c                |  4 +-
 board/birdland/bav335x/board.c                |  8 +--
 board/bluegiga/apx4devkit/apx4devkit.c        |  5 +-
 board/bluewater/gurnard/gurnard.c             |  6 +-
 board/bosch/shc/board.c                       |  2 +-
 board/boundary/nitrogen6x/nitrogen6x.c        | 14 ++---
 board/broadcom/bcm23550_w1d/bcm23550_w1d.c    |  2 +-
 board/broadcom/bcm28155_ap/bcm28155_ap.c      |  2 +-
 board/broadcom/bcmstb/bcmstb.c                |  2 +-
 board/buffalo/lsxl/lsxl.c                     |  2 +-
 board/cadence/xtfpga/xtfpga.c                 |  4 +-
 board/ccv/xpress/xpress.c                     |  2 +-
 board/compulab/cl-som-imx7/cl-som-imx7.c      |  2 +-
 board/compulab/cm_fx6/cm_fx6.c                | 10 +--
 board/compulab/common/omap3_display.c         |  4 +-
 board/congatec/cgtqmx6eval/cgtqmx6eval.c      |  8 +--
 board/cssi/MCR3000/MCR3000.c                  |  2 +-
 board/davinci/da8xxevm/da850evm.c             |  2 +-
 board/davinci/da8xxevm/omapl138_lcdk.c        |  6 +-
 board/dhelectronics/dh_imx6/dh_imx6.c         |  2 +-
 board/eets/pdu001/board.c                     |  8 +--
 board/el/el6x/el6x.c                          |  2 +-
 board/emulation/qemu-riscv/qemu-riscv.c       |  2 +-
 board/engicam/common/board.c                  | 32 +++++-----
 board/esd/meesc/meesc.c                       |  6 +-
 board/freescale/b4860qds/b4860qds.c           |  5 +-
 board/freescale/common/cmd_esbc_validate.c    |  2 +-
 board/freescale/common/fsl_chain_of_trust.c   |  6 +-
 board/freescale/common/sys_eeprom.c           |  4 +-
 board/freescale/common/vid.c                  |  4 +-
 board/freescale/imx8mq_evk/imx8mq_evk.c       |  4 +-
 board/freescale/imx8qm_mek/imx8qm_mek.c       |  4 +-
 board/freescale/imx8qxp_mek/imx8qxp_mek.c     |  4 +-
 board/freescale/ls1088a/eth_ls1088aqds.c      |  4 +-
 board/freescale/ls1088a/ls1088a.c             |  2 +-
 board/freescale/ls2080aqds/eth.c              |  6 +-
 board/freescale/ls2080aqds/ls2080aqds.c       |  2 +-
 board/freescale/ls2080ardb/ls2080ardb.c       |  6 +-
 board/freescale/lx2160a/eth_lx2160aqds.c      |  2 +-
 board/freescale/mpc8323erdb/mpc8323erdb.c     |  3 +-
 board/freescale/mpc837xemds/pci.c             |  2 +-
 board/freescale/mpc837xerdb/mpc837xerdb.c     |  2 +-
 board/freescale/mx51evk/mx51evk_video.c       |  2 +-
 board/freescale/mx53loco/mx53loco.c           |  4 +-
 board/freescale/mx53loco/mx53loco_video.c     |  2 +-
 board/freescale/mx6sabreauto/mx6sabreauto.c   |  8 +--
 board/freescale/mx6sabresd/mx6sabresd.c       |  8 +--
 board/freescale/mx6sxsabresd/mx6sxsabresd.c   |  2 +-
 .../mx6ul_14x14_evk/mx6ul_14x14_evk.c         |  6 +-
 board/freescale/mx6ullevk/mx6ullevk.c         |  4 +-
 board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c   |  2 +-
 board/freescale/qemu-ppce500/qemu-ppce500.c   |  4 +-
 board/freescale/t4qds/t4240qds.c              |  2 +-
 board/gardena/smart-gateway-at91sam/board.c   |  2 +-
 board/gardena/smart-gateway-mt7688/board.c    | 16 ++---
 board/gateworks/gw_ventana/common.c           |  2 +-
 board/gateworks/gw_ventana/gw_ventana.c       | 61
++++++++++--------- board/gateworks/gw_ventana/gw_ventana_spl.c   |
4 +- board/gdsys/a38x/keyprogram.c                 |  4 +-
 board/gdsys/mpc8308/gazerbeam.c               |  4 +-
 board/gdsys/mpc8308/hrcon.c                   |  2 +-
 board/gdsys/mpc8308/strider.c                 |  2 +-
 board/gdsys/p1022/controlcenterd-id.c         | 10 +--
 board/gdsys/p1022/controlcenterd.c            |  2 +-
 board/ge/bx50v3/bx50v3.c                      | 13 ++--
 board/ge/common/ge_common.c                   |  4 +-
 board/ge/mx53ppd/mx53ppd.c                    |  2 +-
 board/grinn/chiliboard/board.c                |  4 +-
 board/grinn/liteboard/board.c                 |  6 +-
 board/highbank/highbank.c                     |  9 +--
 board/hisilicon/poplar/poplar.c               |  2 +-
 board/imgtec/ci20/ci20.c                      |  6 +-
 board/intel/edison/edison.c                   | 14 ++---
 board/isee/igep003x/board.c                   |  6 +-
 board/isee/igep00x0/igep00x0.c                |  4 +-
 board/k+p/kp_imx53/kp_id_rev.c                | 20 +++---
 board/k+p/kp_imx53/kp_imx53.c                 |  4 +-
 board/k+p/kp_imx6q_tpc/kp_imx6q_tpc.c         |  4 +-
 board/keymile/common/common.c                 | 26 ++++----
 board/keymile/common/ivm.c                    |  8 +--
 board/keymile/km83xx/km83xx.c                 |  2 +-
 board/keymile/km_arm/km_arm.c                 |  6 +-
 board/keymile/kmp204x/kmp204x.c               |  4 +-
 board/kosagi/novena/novena.c                  |  2 +-
 board/laird/wb50n/wb50n.c                     |  2 +-
 board/lg/sniper/sniper.c                      |  4 +-
 board/liebherr/display5/spl.c                 |  4 +-
 board/liebherr/mccmon6/mccmon6.c              |  6 +-
 board/logicpd/imx6/imx6logic.c                |  8 +--
 board/menlo/m53menlo/m53menlo.c               |  2 +-
 board/micronas/vct/vct.c                      |  2 +-
 board/nokia/rx51/rx51.c                       | 10 +--
 board/overo/overo.c                           | 45 +++++++-------
 board/phytec/pcm052/pcm052.c                  |  4 +-
 board/phytec/pfla02/pfla02.c                  |  2 +-
 .../dragonboard410c/dragonboard410c.c         |  6 +-
 .../dragonboard820c/dragonboard820c.c         |  2 +-
 board/raspberrypi/rpi/rpi.c                   | 26 ++++----
 board/renesas/alt/alt.c                       |  3 +-
 board/renesas/gose/gose.c                     |  3 +-
 board/renesas/koelsch/koelsch.c               |  3 +-
 board/renesas/lager/lager.c                   |  3 +-
 board/renesas/porter/porter.c                 |  3 +-
 board/renesas/sh7752evb/sh7752evb.c           |  4 +-
 board/renesas/sh7753evb/sh7753evb.c           |  4 +-
 board/renesas/sh7757lcr/sh7757lcr.c           |  6 +-
 board/renesas/silk/silk.c                     |  3 +-
 board/renesas/stout/stout.c                   |  3 +-
 board/rockchip/kylin_rk3036/kylin_rk3036.c    |  2 +-
 board/samsung/common/exynos5-dt.c             |  2 +-
 board/samsung/common/misc.c                   | 14 ++---
 board/samsung/odroid/odroid.c                 |  2 +-
 board/samsung/trats/trats.c                   |  2 +-
 board/samsung/universal_c210/universal.c      |  2 +-
 board/samtec/vining_fpga/socfpga.c            | 16 ++---
 board/siemens/common/board.c                  |  4 +-
 board/siemens/draco/board.c                   |  6 +-
 board/siemens/pxm2/board.c                    |  4 +-
 board/siemens/rut/board.c                     |  2 +-
 board/siemens/taurus/taurus.c                 | 50 +++++++--------
 board/socrates/socrates.c                     |  4 +-
 board/softing/vining_2000/vining_2000.c       |  8 +--
 board/solidrun/mx6cuboxi/mx6cuboxi.c          | 16 ++---
 .../stm32f429-discovery/stm32f429-discovery.c |  4 +-
 .../stm32f429-evaluation.c                    |  4 +-
 .../stm32f469-discovery/stm32f469-discovery.c |  4 +-
 board/st/stm32mp1/stm32mp1.c                  | 11 ++--
 board/sunxi/board.c                           | 25 ++++----
 board/synopsys/hsdk/env-lib.c                 | 11 ++--
 board/synopsys/hsdk/hsdk.c                    |  6 +-
 board/syteco/zmx25/zmx25.c                    |  8 ++-
 board/tcl/sl50/board.c                        |  6 +-
 .../puma_rk3399/puma-rk3399.c                 |  8 +--
 board/ti/am335x/board.c                       | 18 +++---
 board/ti/am43xx/board.c                       |  6 +-
 board/ti/am57xx/board.c                       | 14 ++---
 board/ti/beagle/beagle.c                      | 43 ++++++-------
 board/ti/common/board_detect.c                | 14 ++---
 board/ti/dra7xx/evm.c                         | 12 ++--
 board/ti/evm/evm.c                            |  2 +-
 board/ti/ks2_evm/board.c                      | 10 +--
 board/ti/ks2_evm/board_k2g.c                  |  8 +--
 board/ti/panda/panda.c                        |  4 +-
 board/toradex/apalis-imx8/apalis-imx8.c       |  4 +-
 board/toradex/apalis_imx6/apalis_imx6.c       | 12 ++--
 .../toradex/colibri-imx6ull/colibri-imx6ull.c |  6 +-
 board/toradex/colibri-imx8x/colibri-imx8x.c   |  4 +-
 board/toradex/colibri_imx6/colibri_imx6.c     |  8 +--
 board/toradex/colibri_vf/colibri_vf.c         |  2 +-
 board/toradex/common/tdx-cfg-block.c          |  2 +-
 board/toradex/common/tdx-common.c             |  2 +-
 board/tqc/tqma6/tqma6.c                       |  2 +-
 board/udoo/neo/neo.c                          |  2 +-
 board/udoo/udoo.c                             |  4 +-
 board/varisys/common/sys_eeprom.c             |  6 +-
 board/vscom/baltos/board.c                    |  6 +-
 board/wandboard/wandboard.c                   | 12 ++--
 board/warp7/warp7.c                           |  6 +-
 .../work_92105/work_92105_display.c           |  2 +-
 board/xes/common/board.c                      |  6 +-
 board/xilinx/zynq/board.c                     | 16 ++---
 board/xilinx/zynqmp/cmds.c                    |  2 +-
 board/xilinx/zynqmp/zynqmp.c                  | 24 ++++----
 187 files changed, 677 insertions(+), 649 deletions(-)
(quoted diff) +0 -0

b/board/Arcturus/ucp1020/cmd_arc.c index 2e8477ed3b7a..fbe1f2dba123 100644 --- a/board/Arcturus/ucp1020/cmd_arc.c
+++ b/board/Arcturus/ucp1020/cmd_arc.c

board/Arcturus/ucp1020/cmd_arc.c +9 -9
@@ -252,8 +252,8 @@ static int read_arc_info(void)
 static int do_get_arc_info(void)
 {
 	int l = read_arc_info();
-	char *oldserial = env_get("SERIAL");
-	char *oldversion = env_get("VERSION");
+	char *oldserial = env_get(ctx_uboot, "SERIAL");
+	char *oldversion = env_get(ctx_uboot, "VERSION");
 
 	if (oldversion != NULL)
 		if (strcmp(oldversion, U_BOOT_VERSION) != 0)
@@ -269,13 +269,13 @@ static int do_get_arc_info(void)
 		printf("<not found>\n");
 	} else {
 		printf("%s\n", smac[0]);
-		env_set("SERIAL", smac[0]);
+		env_set(ctx_uboot, "SERIAL", smac[0]);
 	}
 
 	if (strcmp(smac[1], "00:00:00:00:00:00") == 0) {
-		env_set("ethaddr", NULL);
-		env_set("eth1addr", NULL);
-		env_set("eth2addr", NULL);
+		env_set(ctx_uboot, "ethaddr", NULL);
+		env_set(ctx_uboot, "eth1addr", NULL);
+		env_set(ctx_uboot, "eth2addr", NULL);
 		goto done;
 	}
 
@@ -283,13 +283,13 @@ static int do_get_arc_info(void)
 	if (smac[1][0] == EMPY_CHAR) {
 		printf("<not found>\n");
 	} else {
-		char *ret = env_get("ethaddr");
+		char *ret = env_get(ctx_uboot, "ethaddr");
 
 		if (ret == NULL) {
-			env_set("ethaddr", smac[1]);
+			env_set(ctx_uboot, "ethaddr", smac[1]);
 			printf("%s\n", smac[1]);
 		} else if (strcmp(ret, __stringify(CONFIG_ETHADDR))
 == 0) {
-			env_set("ethaddr", smac[1]);
+			env_set(ctx_uboot, "ethaddr", smac[1]);
 			printf("%s (factory)\n", smac[1]);
 		} else {
board/Arcturus/ucp1020/cmd_arc.c +5 -5
 			printf("%s\n", ret);
@@ -297,8 +297,8 @@ static int do_get_arc_info(void)
 	}
 
 	if (strcmp(smac[2], "00:00:00:00:00:00") == 0) {
-		env_set("eth1addr", NULL);
-		env_set("eth2addr", NULL);
+		env_set(ctx_uboot, "eth1addr", NULL);
+		env_set(ctx_uboot, "eth2addr", NULL);
 		goto done;
 	}
 
@@ -306,13 +306,13 @@ static int do_get_arc_info(void)
 	if (smac[2][0] == EMPY_CHAR) {
 		printf("<not found>\n");
 	} else {
-		char *ret = env_get("eth1addr");
+		char *ret = env_get(ctx_uboot, "eth1addr");
 
 		if (ret == NULL) {
-			env_set("ethaddr", smac[2]);
+			env_set(ctx_uboot, "ethaddr", smac[2]);
 			printf("%s\n", smac[2]);
 		} else if (strcmp(ret, __stringify(CONFIG_ETH1ADDR))
 == 0) {
-			env_set("eth1addr", smac[2]);
+			env_set(ctx_uboot, "eth1addr", smac[2]);
 			printf("%s (factory)\n", smac[2]);
 		} else {
board/Arcturus/ucp1020/cmd_arc.c +4 -4
 			printf("%s\n", ret);
@@ -320,7 +320,7 @@ static int do_get_arc_info(void)
 	}
 
 	if (strcmp(smac[3], "00:00:00:00:00:00") == 0) {
-		env_set("eth2addr", NULL);
+		env_set(ctx_uboot, "eth2addr", NULL);
 		goto done;
 	}
 
@@ -328,13 +328,13 @@ static int do_get_arc_info(void)
 	if (smac[3][0] == EMPY_CHAR) {
 		printf("<not found>\n");
 	} else {
-		char *ret = env_get("eth2addr");
+		char *ret = env_get(ctx_uboot, "eth2addr");
 
 		if (ret == NULL) {
-			env_set("ethaddr", smac[3]);
+			env_set(ctx_uboot, "ethaddr", smac[3]);
 			printf("%s\n", smac[3]);
 		} else if (strcmp(ret, __stringify(CONFIG_ETH2ADDR))
 == 0) {
-			env_set("eth2addr", smac[3]);
+			env_set(ctx_uboot, "eth2addr", smac[3]);
 			printf("%s (factory)\n", smac[3]);
 		} else {
board/Arcturus/ucp1020/cmd_arc.c +2 -2
 			printf("%s\n", ret);
@@ -343,8 +343,8 @@ static int do_get_arc_info(void)
 done:
 	if (oldserial == NULL || oldversion == NULL) {
 		if (oldversion == NULL)
-			env_set("VERSION", U_BOOT_VERSION);
-		env_save();
+			env_set(ctx_uboot, "VERSION",
 U_BOOT_VERSION);
+		env_save(ctx_uboot);
 	}
 
(quoted diff) +0 -0
 	return 0;
(quoted diff) +0 -0

b/board/Arcturus/ucp1020/ucp1020.c index 6a880c97bcb7..1aa7f96b5e1c 100644 --- a/board/Arcturus/ucp1020/ucp1020.c
+++ b/board/Arcturus/ucp1020/ucp1020.c

board/Arcturus/ucp1020/ucp1020.c +8 -8
@@ -64,7 +64,7 @@ void board_gpio_init(void)
 
 	for (i = 0; i < GPIO_MAX_NUM; i++) {
 		sprintf(envname, "GPIO%d", i);
-		val = env_get(envname);
+		val = env_get(ctx_uboot, envname);
 		if (val) {
 			char direction = toupper(val[0]);
 			char level = toupper(val[1]);
@@ -82,7 +82,7 @@ void board_gpio_init(void)
 		}
 	}
 
-	val = env_get("PCIE_OFF");
+	val = env_get(ctx_uboot, "PCIE_OFF");
 	if (val) {
 		gpio_direction_input(GPIO_PCIE1_EN);
 		gpio_direction_input(GPIO_PCIE2_EN);
@@ -91,7 +91,7 @@ void board_gpio_init(void)
 		gpio_direction_output(GPIO_PCIE2_EN, 1);
 	}
 
-	val = env_get("SDHC_CDWP_OFF");
+	val = env_get(ctx_uboot, "SDHC_CDWP_OFF");
 	if (!val) {
 		ccsr_gur_t *gur = (void
 *)(CONFIG_SYS_MPC85xx_GUTS_ADDR); 
@@ -218,7 +218,7 @@ int last_stage_init(void)
 	else
 		printf("NCT72(0x%x): ready\n", id2);
 
-	kval = env_get("kernelargs");
+	kval = env_get(ctx_uboot, "kernelargs");
 
 #ifdef CONFIG_MMC
 	mmc = find_mmc_device(0);
@@ -235,22 +235,22 @@ int last_stage_init(void)
 				strcat(newkernelargs, mmckargs);
 				strcat(newkernelargs, " ");
 				strcat(newkernelargs, &tmp[n]);
-				env_set("kernelargs", newkernelargs);
+				env_set(ctx_uboot, "kernelargs",
 newkernelargs); } else {
-				env_set("kernelargs", mmckargs);
+				env_set(ctx_uboot, "kernelargs",
 mmckargs); }
 		}
 #endif
 	get_arc_info();
 
 	if (kval) {
-		sval = env_get("SERIAL");
+		sval = env_get(ctx_uboot, "SERIAL");
 		if (sval) {
 			strcpy(newkernelargs, "SN=");
 			strcat(newkernelargs, sval);
 			strcat(newkernelargs, " ");
 			strcat(newkernelargs, kval);
-			env_set("kernelargs", newkernelargs);
+			env_set(ctx_uboot, "kernelargs",
 newkernelargs); }
 	} else {
 		printf("Error reading kernelargs env variable!\n");
board/BuR/brppt1/board.c +1 -1
index ef4f5c950140..4278dda5988f 100644
@@ -180,10 +180,10 @@ int board_late_init(void)
 		bmode = 4;
 
 	printf("Mode:  %s\n", bootmodeascii[bmode & 0x0F]);
-	env_set_ulong("b_mode", bmode);
+	env_set_ulong(ctx_uboot, "b_mode", bmode);
 
 	/* get sure that bootcmd isn't affected by any bootcount

value */

board/BuR/brppt1/board.c +1 -1
-	env_set_ulong("bootlimit", 0);
+	env_set_ulong(ctx_uboot, "bootlimit", 0);
 
 	return 0;
 }
board/BuR/brxre1/board.c +5 -4
index 873208c668d7..69bcccbc5a0d 100644
@@ -165,10 +165,11 @@ int board_late_init(void)
 	snprintf(othbootargs, sizeof(othbootargs),
 		 "u=vxWorksFTP pw=vxWorks
 o=0x%08x;0x%08x;0x%08x;0x%08x", (u32)gd->fb_base - 0x20,
-		 (u32)env_get_ulong("vx_memtop", 16, gd->fb_base -
 0x20),
-		 (u32)env_get_ulong("vx_romfsbase", 16, 0),
-		 (u32)env_get_ulong("vx_romfssize", 16, 0));
-	env_set("othbootargs", othbootargs);
+		 (u32)env_get_ulong(ctx_uboot, "vx_memtop", 16,
+				    gd->fb_base - 0x20),
+		 (u32)env_get_ulong(ctx_uboot, "vx_romfsbase", 16,
 0),
+		 (u32)env_get_ulong(ctx_uboot, "vx_romfssize", 16,
 0));
+	env_set(ctx_uboot, "othbootargs", othbootargs);
board/BuR/brxre1/board.c +0 -0
 	/*
 	 * reset VBAR registers to its reset location, VxWorks

6.9.3.2 does
* expect that vectors are there, original u-boot moves them
to _start diff --git a/board/BuR/common/br_resetc.c b/board/BuR/common/br_resetc.c index c0e7fb65b298..36d49967dd82 100644

board/BuR/common/br_resetc.c +1 -1
@@ -230,7 +230,7 @@ int br_resetc_bmode(void)
 		printf("Reset: STM32 controller\n");
 
 	printf("Mode:  %s\n", bootmodeascii[regw & 0x0F]);
-	env_set_ulong("b_mode", regw & 0x0F);
+	env_set_ulong(ctx_uboot, "b_mode", regw & 0x0F);
 
 	return rc;
 }
board/BuR/common/common.c +3 -3
index 148fc9075e4f..f3bc87daf19f 100644
@@ -29,9 +29,12 @@ DECLARE_GLOBAL_DATA_PTR;
 
 void lcdbacklight(int on)
 {
-	unsigned int driver = env_get_ulong("ds1_bright_drv", 16,
 0UL);
-	unsigned int bright = env_get_ulong("ds1_bright_def", 10,
 50);
-	unsigned int pwmfrq = env_get_ulong("ds1_pwmfreq", 10, ~0UL);
+	unsigned int driver = env_get_ulong(ctx_uboot,
 "ds1_bright_drv", 16,
+					    0UL);
+	unsigned int bright = env_get_ulong(ctx_uboot,

"ds1_bright_def", 10,

board/BuR/common/common.c +2 -0
+					    50);
+	unsigned int pwmfrq = env_get_ulong(ctx_uboot,

"ds1_pwmfreq", 10,

board/BuR/common/common.c +13 -14
+					    ~0UL);
 	unsigned int tmp;
 	struct gptimer *timerhw;
@@ -87,20 +90,20 @@ int load_lcdtiming(struct am335x_lcdpanel *panel)
 {
 	struct am335x_lcdpanel pnltmp;
 
-	pnltmp.hactive = env_get_ulong("ds1_hactive", 10, ~0UL);
-	pnltmp.vactive = env_get_ulong("ds1_vactive", 10, ~0UL);
-	pnltmp.bpp = env_get_ulong("ds1_bpp", 10, ~0UL);
-	pnltmp.hfp = env_get_ulong("ds1_hfp", 10, ~0UL);
-	pnltmp.hbp = env_get_ulong("ds1_hbp", 10, ~0UL);
-	pnltmp.hsw = env_get_ulong("ds1_hsw", 10, ~0UL);
-	pnltmp.vfp = env_get_ulong("ds1_vfp", 10, ~0UL);
-	pnltmp.vbp = env_get_ulong("ds1_vbp", 10, ~0UL);
-	pnltmp.vsw = env_get_ulong("ds1_vsw", 10, ~0UL);
-	pnltmp.pxl_clk = env_get_ulong("ds1_pxlclk", 10, ~0UL);
-	pnltmp.pol = env_get_ulong("ds1_pol", 16, ~0UL);
-	pnltmp.pup_delay = env_get_ulong("ds1_pupdelay", 10, ~0UL);
-	pnltmp.pon_delay = env_get_ulong("ds1_tondelay", 10, ~0UL);
-	panel_info.vl_rot = env_get_ulong("ds1_rotation", 10, 0);
+	pnltmp.hactive = env_get_ulong(ctx_uboot, "ds1_hactive", 10,
 ~0UL);
+	pnltmp.vactive = env_get_ulong(ctx_uboot, "ds1_vactive", 10,
 ~0UL);
+	pnltmp.bpp = env_get_ulong(ctx_uboot, "ds1_bpp", 10, ~0UL);
+	pnltmp.hfp = env_get_ulong(ctx_uboot, "ds1_hfp", 10, ~0UL);
+	pnltmp.hbp = env_get_ulong(ctx_uboot, "ds1_hbp", 10, ~0UL);
+	pnltmp.hsw = env_get_ulong(ctx_uboot, "ds1_hsw", 10, ~0UL);
+	pnltmp.vfp = env_get_ulong(ctx_uboot, "ds1_vfp", 10, ~0UL);
+	pnltmp.vbp = env_get_ulong(ctx_uboot, "ds1_vbp", 10, ~0UL);
+	pnltmp.vsw = env_get_ulong(ctx_uboot, "ds1_vsw", 10, ~0UL);
+	pnltmp.pxl_clk = env_get_ulong(ctx_uboot, "ds1_pxlclk", 10,
 ~0UL);
+	pnltmp.pol = env_get_ulong(ctx_uboot, "ds1_pol", 16, ~0UL);
+	pnltmp.pup_delay = env_get_ulong(ctx_uboot, "ds1_pupdelay",

10, ~0UL);

board/BuR/common/common.c +1 -0
+	pnltmp.pon_delay = env_get_ulong(ctx_uboot, "ds1_tondelay",

10, ~0UL);

board/BuR/common/common.c +1 -0
+	panel_info.vl_rot = env_get_ulong(ctx_uboot, "ds1_rotation",

10, 0);

board/BuR/common/common.c +3 -3
 	if (
 	   ~0UL == (pnltmp.hactive) ||
@@ -151,11 +154,11 @@ static void br_summaryscreen_printenv(char
 *prefix, char *name, char *altname,
 				       char *suffix)
 {
-	char *envval = env_get(name);
+	char *envval = env_get(ctx_uboot, name);
 	if (0 != envval) {
 		lcd_printf("%s %s %s", prefix, envval, suffix);
 	} else if (0 != altname) {
-		envval = env_get(altname);
+		envval = env_get(ctx_uboot, altname);
 		if (0 != envval)
 			lcd_printf("%s %s %s", prefix, envval,
 suffix); } else {
@@ -178,7 +181,7 @@ void lcdpower(int on)
 	u32 pin, swval, i;
 	char buf[16] = { 0 };
 
-	pin = env_get_ulong("ds1_pwr", 16, ~0UL);
+	pin = env_get_ulong(ctx_uboot, "ds1_pwr", 16, ~0UL);
 
 	if (pin == ~0UL) {
 		puts("no pwrpin in dtb/env, cannot powerup

display!\n"); @@ -295,8 +298,8 @@ int brdefaultip_setup(int bus, int chip) "if test -r ${ipaddr}; then; else setenv ipaddr 192.168.60.1; setenv serverip 192.168.60.254; setenv gatewayip 192.168.60.254; setenv netmask 255.255.255.0; fi;", sizeof(defip));

board/BuR/common/common.c +2 -2
-	env_set("brdefaultip", defip);
-	env_set_hex("board_id", u8buf);
+	env_set(ctx_uboot, "brdefaultip", defip);
+	env_set_hex(ctx_uboot, "board_id", u8buf);
 
 	return 0;
 }
(quoted diff) +0 -0

b/board/BuS/eb_cpu5282/eb_cpu5282.c index 0b916d2482c5..03d2b276a132 100644 --- a/board/BuS/eb_cpu5282/eb_cpu5282.c
+++ b/board/BuS/eb_cpu5282/eb_cpu5282.c

board/BuS/eb_cpu5282/eb_cpu5282.c +4 -4
@@ -139,7 +139,7 @@ void hw_watchdog_init(void)
 	int enable;
 
 	enable = 1;
-	s = env_get("watchdog");
+	s = env_get(ctx_uboot, "watchdog");
 	if (s != NULL)
 		if ((strncmp(s, "off", 3) == 0) || (strncmp(s, "0",
 1) == 0)) enable = 0;
@@ -191,13 +191,13 @@ int drv_video_init(void)
 	unsigned long splash;
 #endif
 	printf("Init Video as ");
-	s = env_get("displaywidth");
+	s = env_get(ctx_uboot, "displaywidth");
 	if (s != NULL)
 		display_width = simple_strtoul(s, NULL, 10);
 	else
 		display_width = 256;
 
-	s = env_get("displayheight");
+	s = env_get(ctx_uboot, "displayheight");
 	if (s != NULL)
 		display_height = simple_strtoul(s, NULL, 10);
 	else
@@ -211,7 +211,7 @@ int drv_video_init(void)
 	vcxk_init(display_width, display_height);
 
 #ifdef CONFIG_SPLASH_SCREEN
-	s = env_get("splashimage");
+	s = env_get(ctx_uboot, "splashimage");
 	if (s != NULL) {
 		splash = simple_strtoul(s, NULL, 16);
 		vcxk_acknowledge_wait();
(quoted diff) +0 -0

b/board/CZ.NIC/turris_mox/turris_mox.c index 946e20ab492f..b23ecb3fefaa 100644 --- a/board/CZ.NIC/turris_mox/turris_mox.c +++ b/board/CZ.NIC/turris_mox/turris_mox.c @@ -362,10 +362,10 @@ int misc_init_r(void) return 0;

board/CZ.NIC/turris_mox/turris_mox.c +2 -2
 	}
 
-	if (is_valid_ethaddr(mac1) && !env_get("ethaddr"))
+	if (is_valid_ethaddr(mac1) && !env_get(ctx_uboot, "ethaddr"))
 		eth_env_set_enetaddr("ethaddr", mac1);
 
-	if (is_valid_ethaddr(mac2) && !env_get("eth1addr"))
+	if (is_valid_ethaddr(mac2) && !env_get(ctx_uboot,

"eth1addr")) eth_env_set_enetaddr("eth1addr", mac2);

(quoted diff) +0 -0
 	return 0;
(quoted diff) +0 -0

b/board/CZ.NIC/turris_omnia/turris_omnia.c index 1d8d08a847d9..bbbeaf75fc97 100644 --- a/board/CZ.NIC/turris_omnia/turris_omnia.c +++ b/board/CZ.NIC/turris_omnia/turris_omnia.c @@ -326,7 +326,7 @@ static int set_regdomain(void) puts("EEPROM regdomain read failed.\n");

board/CZ.NIC/turris_omnia/turris_omnia.c +3 -3
 	printf("Regdomain set to %s\n", rd);
-	return env_set("regdomain", rd);
+	return env_set(ctx_uboot, "regdomain", rd);
 }
 
 /*
@@ -359,11 +359,11 @@ static void handle_reset_button(void)
 		return;
 	}
 
-	env_set_ulong("omnia_reset", reset_status);
+	env_set_ulong(ctx_uboot, "omnia_reset", reset_status);
 
 	if (reset_status) {
 		printf("RESET button was pressed, overwriting
 bootcmd!\n");
-		env_set("bootcmd", OMNIA_FACTORY_RESET_BOOTCMD);
+		env_set(ctx_uboot, "bootcmd",
 OMNIA_FACTORY_RESET_BOOTCMD); }
 }

#endif

(quoted diff) +0 -0

b/board/CarMediaLab/flea3/flea3.c index be0bc228ec71..9a5fe1e2252d 100644 --- a/board/CarMediaLab/flea3/flea3.c
+++ b/board/CarMediaLab/flea3/flea3.c

board/CarMediaLab/flea3/flea3.c +1 -1
@@ -211,7 +211,7 @@ int ft_board_setup(void *blob, bd_t *bd)
 		{ "mxc_nand", MTD_DEV_TYPE_NAND, }, /* NAND flash */
 	};
 
-	if (env_get("fdt_noauto")) {
+	if (env_get(ctx_uboot, "fdt_noauto")) {
 		puts("   Skiping ft_board_setup (fdt_noauto
 defined)\n"); return 0;
 	}
(quoted diff) +0 -0

b/board/LaCie/net2big_v2/net2big_v2.c index 686608d25a5a..659a351deaea 100644 --- a/board/LaCie/net2big_v2/net2big_v2.c +++ b/board/LaCie/net2big_v2/net2big_v2.c @@ -221,7 +221,7 @@ int misc_init_r(void) {

board/LaCie/net2big_v2/net2big_v2.c +1 -1
 	init_fan();
 #if defined(CONFIG_CMD_I2C) && defined(CONFIG_SYS_I2C_EEPROM_ADDR)
-	if (!env_get("ethaddr")) {
+	if (!env_get(ctx_uboot, "ethaddr")) {
 		uchar mac[6];
 		if (lacie_read_mac_address(mac) == 0)
 			eth_env_set_enetaddr("ethaddr", mac);
(quoted diff) +0 -0

b/board/LaCie/netspace_v2/netspace_v2.c index bd7ab22948b2..83b07300354e 100644 --- a/board/LaCie/netspace_v2/netspace_v2.c +++ b/board/LaCie/netspace_v2/netspace_v2.c @@ -83,7 +83,7 @@ int board_init(void) int misc_init_r(void)
{
#if defined(CONFIG_CMD_I2C) && defined(CONFIG_SYS_I2C_EEPROM_ADDR)

board/LaCie/net2big_v2/net2big_v2.c +1 -1
-	if (!env_get("ethaddr")) {
+	if (!env_get(ctx_uboot, "ethaddr")) {
 		uchar mac[6];
 		if (lacie_read_mac_address(mac) == 0)
 			eth_env_set_enetaddr("ethaddr", mac);
(quoted diff) +0 -0

b/board/Synology/ds414/cmd_syno.c index 777948f90f58..abd38b24fff0 100644 --- a/board/Synology/ds414/cmd_syno.c
+++ b/board/Synology/ds414/cmd_syno.c

board/Synology/ds414/cmd_syno.c +3 -3
@@ -80,7 +80,7 @@ static int do_syno_populate(int argc, char * const
 argv[]) ethaddr[0], ethaddr[1], ethaddr[2],
 			 ethaddr[3], ethaddr[4], ethaddr[5]);
 		printf("parsed %s = %s\n", var, val);
-		env_set(var, val);
+		env_set(ctx_uboot, var, val);
 	}
 	if (!strncmp(buf + 32, SYNO_SN_TAG, strlen(SYNO_SN_TAG))) {
 		char *snp, *csump;
@@ -110,7 +110,7 @@ static int do_syno_populate(int argc, char *
 const argv[]) goto out_unmap;
 		}
 		printf("parsed SN = %s\n", snp);
-		env_set("SN", snp);
+		env_set(ctx_uboot, "SN", snp);
 	} else {	/* old style format */
 		unsigned char csum = 0;
 
@@ -124,7 +124,7 @@ static int do_syno_populate(int argc, char *
 const argv[]) }
 		bufp[n] = '\0';
 		printf("parsed SN = %s\n", buf + 32);
-		env_set("SN", buf + 32);
+		env_set(ctx_uboot, "SN", buf + 32);
 	}
 out_unmap:
 	unmap_physmem(buf, len);
(quoted diff) +0 -0

b/board/alliedtelesis/x530/x530.c index e0fa8067c1c5..53bc9dd286e2 100644 --- a/board/alliedtelesis/x530/x530.c
+++ b/board/alliedtelesis/x530/x530.c

board/alliedtelesis/x530/x530.c +1 -1
@@ -157,7 +157,7 @@ int misc_init_r(void)
 	gpio_hog(&led_en, "atl,led-enable", "enable-gpio", 1);
 
 #ifdef MTDPARTS_MTDOOPS
-	env_set("mtdoops", MTDPARTS_MTDOOPS);
+	env_set(ctx_uboot, "mtdoops", MTDPARTS_MTDOOPS);
 #endif
 
 	led_7seg_init(0xff);
board/amazon/kc1/kc1.c +2 -2
index 9034c4fbfff0..9f183da00a9e 100644
@@ -118,8 +118,8 @@ int misc_init_r(void)
 	}
 
 	if (reboot_mode[0] > 0 && isascii(reboot_mode[0])) {
-		if (!env_get("reboot-mode"))
-			env_set("reboot-mode", (char *)reboot_mode);
+		if (!env_get(ctx_uboot, "reboot-mode"))
+			env_set(ctx_uboot, "reboot-mode", (char
 *)reboot_mode); }
 
 	omap_reboot_mode_clear();
board/amlogic/p200/p200.c +2 -2
index 41d331dda2d4..4b1a158f1750 100644
@@ -32,11 +32,11 @@ int misc_init_r(void)
 			eth_env_set_enetaddr("ethaddr", mac_addr);
 	}
 
-	if (!env_get("serial#")) {
+	if (!env_get(ctx_uboot, "serial#")) {
 		len = meson_sm_read_efuse(EFUSE_SN_OFFSET, serial,
 			EFUSE_SN_SIZE);
 		if (len == EFUSE_SN_SIZE)
-			env_set("serial#", serial);
+			env_set(ctx_uboot, "serial#", serial);
 	}
 
 	return 0;
board/amlogic/p201/p201.c +2 -2
index e46fcaea6dcd..ba2a5387a120 100644
@@ -32,11 +32,11 @@ int misc_init_r(void)
 			eth_env_set_enetaddr("ethaddr", mac_addr);
 	}
 
-	if (!env_get("serial#")) {
+	if (!env_get(ctx_uboot, "serial#")) {
 		len = meson_sm_read_efuse(EFUSE_SN_OFFSET, serial,
 			EFUSE_SN_SIZE);
 		if (len == EFUSE_SN_SIZE)
-			env_set("serial#", serial);
+			env_set(ctx_uboot, "serial#", serial);
 	}
 
 	return 0;
board/amlogic/p212/p212.c +2 -2
index 094ab5478d00..3fabf79a4b41 100644
@@ -36,11 +36,11 @@ int misc_init_r(void)
 			meson_generate_serial_ethaddr();
 	}
 
-	if (!env_get("serial#")) {
+	if (!env_get(ctx_uboot, "serial#")) {
 		len = meson_sm_read_efuse(EFUSE_SN_OFFSET, serial,
 			EFUSE_SN_SIZE);
 		if (len == EFUSE_SN_SIZE)
-			env_set("serial#", serial);
+			env_set(ctx_uboot, "serial#", serial);
 	}
 
 	return 0;
board/amlogic/q200/q200.c +2 -2
index f1faa7418e07..2cf2af3e1899 100644
@@ -35,11 +35,11 @@ int misc_init_r(void)
 			meson_generate_serial_ethaddr();
 	}
 
-	if (!env_get("serial#")) {
+	if (!env_get(ctx_uboot, "serial#")) {
 		len = meson_sm_read_efuse(EFUSE_SN_OFFSET, serial,
 					  EFUSE_SN_SIZE);
 		if (len == EFUSE_SN_SIZE)
-			env_set("serial#", serial);
+			env_set(ctx_uboot, "serial#", serial);
 	}
 
 	return 0;
(quoted diff) +0 -0

b/board/aristainetos/aristainetos-v2.c index c0a2e41f02e8..061baf0255db 100644 --- a/board/aristainetos/aristainetos-v2.c +++ b/board/aristainetos/aristainetos-v2.c @@ -651,7 +651,7 @@ int board_late_init(void) {

board/aristainetos/aristainetos-v2.c +3 -3
 	char *my_bootdelay;
 	char bootmode = 0;
-	char const *panel = env_get("panel");
+	char const *panel = env_get(ctx_uboot, "panel");
 
 	/*
 	 * Check the boot-source. If booting from NOR Flash,
@@ -668,11 +668,11 @@ int board_late_init(void)
 	bootmode |= (gpio_get_value(IMX_GPIO_NR(7, 1)) ? 1 : 0) << 2;
 
 	if (bootmode == 7) {
-		my_bootdelay = env_get("nor_bootdelay");
+		my_bootdelay = env_get(ctx_uboot, "nor_bootdelay");
 		if (my_bootdelay != NULL)
-			env_set("bootdelay", my_bootdelay);
+			env_set(ctx_uboot, "bootdelay",

my_bootdelay); else

board/aristainetos/aristainetos-v2.c +1 -1
-			env_set("bootdelay", "-2");
+			env_set(ctx_uboot, "bootdelay", "-2");
 	}
 
 	/* if we have the lg panel, we can initialze it now */
(quoted diff) +0 -0

b/board/armltd/integrator/integrator.c index 0a2baa72976c..72c9678218ae 100644 --- a/board/armltd/integrator/integrator.c +++ b/board/armltd/integrator/integrator.c @@ -116,7 +116,7 @@ extern void cm_remap(void);
int misc_init_r (void)
{

board/armltd/integrator/integrator.c +1 -1
-	env_set("verify", "n");
+	env_set(ctx_uboot, "verify", "n");
 	return (0);
 }
board/atmel/common/board.c +2 -2
index c41706c4005c..aef6babfd37a 100644
@@ -64,7 +64,7 @@ void at91_pda_detect(void)
 	}
 
 pda_detect_err:
-	env_set("pda", (const char *)buf);
+	env_set(ctx_uboot, "pda", (const char *)buf);
 }
 #else
 void at91_pda_detect(void)
@@ -74,5 +74,5 @@ void at91_pda_detect(void)
 
 void at91_prepare_cpu_var(void)
 {
-	env_set("cpu", get_cpu_name());
+	env_set(ctx_uboot, "cpu", get_cpu_name());
 }
(quoted diff) +0 -0

b/board/atmel/common/mac_eeprom.c index 83a7778e9954..4c9a5c0b0d0e 100644 --- a/board/atmel/common/mac_eeprom.c
+++ b/board/atmel/common/mac_eeprom.c

board/atmel/common/mac_eeprom.c +1 -1
@@ -18,7 +18,7 @@ int at91_set_ethaddr(int offset)
 	struct udevice *dev;
 	int ret;
 
-	if (env_get(ETHADDR_NAME))
+	if (env_get(ctx_uboot, ETHADDR_NAME))
 		return 0;
 
 	ret = uclass_first_device_err(UCLASS_I2C_EEPROM, &dev);
(quoted diff) +0 -0

b/board/atmel/sama5d3xek/sama5d3xek.c index acf61486d20b..6c27c3dbe148 100644 --- a/board/atmel/sama5d3xek/sama5d3xek.c +++ b/board/atmel/sama5d3xek/sama5d3xek.c @@ -187,7 +187,7 @@ int board_late_init(void) *p = tolower(*p);

board/atmel/sama5d3xek/sama5d3xek.c +1 -1
 	strcat(name, "ek.dtb");
-	env_set("dtb_name", name);
+	env_set(ctx_uboot, "dtb_name", name);
 #endif
 #ifdef CONFIG_DM_VIDEO
 	at91_video_show_board_info();
(quoted diff) +0 -0

b/board/bachmann/ot1200/ot1200.c index 36f37084b36c..baf7b7cdf7f3 100644 --- a/board/bachmann/ot1200/ot1200.c
+++ b/board/bachmann/ot1200/ot1200.c

board/bachmann/ot1200/ot1200.c +2 -2
@@ -301,9 +301,9 @@ int board_eth_init(bd_t *bis)
 
 	/* depending on the phy address we can detect our board
 version */ if (phydev->addr == 0)
-		env_set("boardver", "");
+		env_set(ctx_uboot, "boardver", "");
 	else
-		env_set("boardver", "mr");
+		env_set(ctx_uboot, "boardver", "mr");
 
 	printf("using phy at %d\n", phydev->addr);
 	ret = fec_probe(bis, -1, base, bus, phydev);
(quoted diff) +0 -0

b/board/birdland/bav335x/board.c index 8811583ac628..9a8b69df3891 100644 --- a/board/birdland/bav335x/board.c
+++ b/board/birdland/bav335x/board.c

board/birdland/bav335x/board.c +3 -3
@@ -161,7 +161,7 @@ int spl_start_uboot(void)
 
 #ifdef CONFIG_SPL_ENV_SUPPORT
 	env_init();
-	env_load();
+	env_load(ctx_uboot);
 	if (env_get_yesno("boot_os") != 1)
 		return 1;
 #endif
@@ -300,8 +300,8 @@ int board_init(void)
 int board_late_init(void)
 {
 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
-	env_set("board_name", "BAV335xB");
-	env_set("board_rev", "B"); /* Fix me, but why bother.. */
+	env_set(ctx_uboot, "board_name", "BAV335xB");
+	env_set(ctx_uboot, "board_rev", "B"); /* Fix me, but why

bother.. */ #endif

board/birdland/bav335x/board.c +1 -1
 	return 0;
 }
@@ -391,7 +391,7 @@ int board_eth_init(bd_t *bis)
 #if (defined(CONFIG_DRIVER_TI_CPSW) && !defined(CONFIG_SPL_BUILD))
 || \ (defined(CONFIG_SPL_ETH_SUPPORT) && defined(CONFIG_SPL_BUILD))
 
-	if (!env_get("ethaddr")) {
+	if (!env_get(ctx_uboot, "ethaddr")) {
 		printf("<ethaddr> not set. Validating first E-fuse
 MAC\n"); 
 		if (is_valid_ethaddr(mac_addr))
(quoted diff) +0 -0

b/board/bluegiga/apx4devkit/apx4devkit.c index 9268aa0daafc..a7116e8c0c06 100644 --- a/board/bluegiga/apx4devkit/apx4devkit.c +++ b/board/bluegiga/apx4devkit/apx4devkit.c @@ -133,8 +133,9 @@ void get_board_serial(struct tag_serialnr *serialnr) #ifdef CONFIG_REVISION_TAG u32 get_board_rev(void)
{

(quoted diff) +0 -2
-	if (env_get("revision#") != NULL)
-		return simple_strtoul(env_get("revision#"), NULL,

10);

(quoted diff) +2 -0
+	if (env_get(ctx_uboot, "revision#"))
+		return simple_strtoul(env_get(ctx_uboot,

"revision#"), NULL,

board/bluegiga/apx4devkit/apx4devkit.c +1 -0
+				      10);
 	return 0;
 }
 #endif
(quoted diff) +0 -0

b/board/bluewater/gurnard/gurnard.c index 48e31d9065a2..560db5fee639 100644 --- a/board/bluewater/gurnard/gurnard.c
+++ b/board/bluewater/gurnard/gurnard.c

board/bluewater/gurnard/gurnard.c +1 -1
@@ -340,7 +340,7 @@ int board_init(void)
 	at91_set_A_periph(AT91_PIN_PE6, 1);	/* power up */
 
 	/* Select the second timing index for board rev 2 */
-	rev_str = env_get("board_rev");
+	rev_str = env_get(ctx_uboot, "board_rev");
 	if (rev_str && !strncmp(rev_str, "2", 1)) {
 		struct udevice *dev;
 
@@ -367,7 +367,7 @@ int board_late_init(void)
 	 * Set MAC address so we do not need to init Ethernet before

Linux

board/bluewater/gurnard/gurnard.c +1 -1
 	 * boot
 	 */
-	env_str = env_get("ethaddr");
+	env_str = env_get(ctx_uboot, "ethaddr");
 	if (env_str) {
 		struct at91_emac *emac = (struct at91_emac

*)ATMEL_BASE_EMAC; /* Parse MAC address */

board/bluewater/gurnard/gurnard.c +1 -1
@@ -384,7 +384,7 @@ int board_late_init(void)
 		       &emac->sa2l);
 		writel((env_enetaddr[4] | env_enetaddr[5] << 8),
 &emac->sa2h); 
-		printf("MAC:   %s\n", env_get("ethaddr"));
+		printf("MAC:   %s\n", env_get(ctx_uboot, "ethaddr"));
 	} else {
 		/* Not set in environment */
 		printf("MAC:   not set\n");
board/bosch/shc/board.c +1 -1
index a96fdef992d2..6afbdb9737ac 100644
@@ -246,7 +246,7 @@ static void check_button_status(void)
 
 	if (value == 0) {
 		printf("front button activated !\n");
-		env_set("harakiri", "1");
+		env_set(ctx_uboot, "harakiri", "1");
 	}
 }
 
(quoted diff) +0 -0

b/board/boundary/nitrogen6x/nitrogen6x.c index 26af3f710250..e9a1cde72390 100644 --- a/board/boundary/nitrogen6x/nitrogen6x.c +++ b/board/boundary/nitrogen6x/nitrogen6x.c @@ -749,7 +749,7 @@ size_t display_count = ARRAY_SIZE(displays);
int board_cfb_skip(void)
{

board/boundary/nitrogen6x/nitrogen6x.c +4 -4
-	return NULL != env_get("novideo");
+	return env_get(ctx_uboot, "novideo") != NULL;
 }
 
 static void setup_display(void)
@@ -954,7 +954,7 @@ static int do_kbd(cmd_tbl_t *cmdtp, int flag, int
 argc, char * const argv[]) {
 	char envvalue[ARRAY_SIZE(buttons)+1];
 	int numpressed = read_keys(envvalue);
-	env_set("keybd", envvalue);
+	env_set(ctx_uboot, "keybd", envvalue);
 	return numpressed == 0;
 }
 
@@ -974,7 +974,7 @@ static void preboot_keys(void)
 	char keypress[ARRAY_SIZE(buttons)+1];
 	numpressed = read_keys(keypress);
 	if (numpressed) {
-		char *kbd_magic_keys = env_get("magic_keys");
+		char *kbd_magic_keys = env_get(ctx_uboot,
 "magic_keys"); char *suffix;
 		/*
 		 * loop over all magic keys
@@ -983,7 +983,7 @@ static void preboot_keys(void)
 			char *keys;
 			char magic[sizeof(kbd_magic_prefix) + 1];
 			sprintf(magic, "%s%c", kbd_magic_prefix,
 *suffix);
-			keys = env_get(magic);
+			keys = env_get(ctx_uboot, magic);
 			if (keys) {
 				if (!strcmp(keys, keypress))
board/boundary/nitrogen6x/nitrogen6x.c +2 -2
 					break;
@@ -993,9 +993,9 @@ static void preboot_keys(void)
 			char cmd_name[sizeof(kbd_command_prefix) +
 1]; char *cmd;
 			sprintf(cmd_name, "%s%c",
 kbd_command_prefix, *suffix);
-			cmd = env_get(cmd_name);
+			cmd = env_get(ctx_uboot, cmd_name);
 			if (cmd) {
-				env_set("preboot", cmd);
+				env_set(ctx_uboot, "preboot", cmd);
 				return;
 			}
board/boundary/nitrogen6x/nitrogen6x.c +1 -1
 		}
@@ -1021,6 +1021,6 @@ int misc_init_r(void)
 #ifdef CONFIG_CMD_BMODE
 	add_board_boot_modes(board_boot_modes);
 #endif
-	env_set_hex("reset_cause", get_imx_reset_cause());
+	env_set_hex(ctx_uboot, "reset_cause",
 get_imx_reset_cause(void)); return 0;
 }
(quoted diff) +0 -0

b/board/broadcom/bcm23550_w1d/bcm23550_w1d.c index ce9f0494ee59..51e7f2c0c847 100644 --- a/board/broadcom/bcm23550_w1d/bcm23550_w1d.c +++ b/board/broadcom/bcm23550_w1d/bcm23550_w1d.c @@ -103,7 +103,7 @@ int board_usb_init(int index, enum usb_init_type init) int g_dnl_bind_fixup(struct usb_device_descriptor *dev, const char *name) { debug("%s\n", __func__);

board/broadcom/bcm23550_w1d/bcm23550_w1d.c +1 -1
-	if (!env_get("serial#"))
+	if (!env_get(ctx_uboot, "serial#"))
 		g_dnl_set_serialnumber(CONFIG_USB_SERIALNO);
 	return 0;
 }
(quoted diff) +0 -0

b/board/broadcom/bcm28155_ap/bcm28155_ap.c index 87616386cb84..d9240cf35c8c 100644 --- a/board/broadcom/bcm28155_ap/bcm28155_ap.c +++ b/board/broadcom/bcm28155_ap/bcm28155_ap.c @@ -110,7 +110,7 @@ int board_usb_init(int index, enum usb_init_type init) int g_dnl_bind_fixup(struct usb_device_descriptor *dev, const char *name) { debug("%s\n", __func__);

board/broadcom/bcm23550_w1d/bcm23550_w1d.c +1 -1
-	if (!env_get("serial#"))
+	if (!env_get(ctx_uboot, "serial#"))
 		g_dnl_set_serialnumber(CONFIG_USB_SERIALNO);
 	return 0;
 }
(quoted diff) +0 -0

b/board/broadcom/bcmstb/bcmstb.c index 5fc2c0591b84..494c03d3eb79 100644 --- a/board/broadcom/bcmstb/bcmstb.c
+++ b/board/broadcom/bcmstb/bcmstb.c

board/broadcom/bcmstb/bcmstb.c +1 -1
@@ -120,7 +120,7 @@ int board_late_init(void)
 	 * Set fdtcontroladdr in the environment so that scripts can
 	 * refer to it, for example, to reuse it for fdtaddr.
 	 */
-	env_set_hex("fdtcontroladdr", prior_stage_fdt_address);
+	env_set_hex(ctx_uboot, "fdtcontroladdr",
 prior_stage_fdt_address); 
 	/*
 	 * Do not set machid to the machine identifier value provided
board/buffalo/lsxl/lsxl.c +1 -1
index 95d3a5e1f579..f1baed84e268 100644
@@ -229,7 +229,7 @@ static void erase_environment(void)
 static void rescue_mode(void)
 {
 	printf("Entering rescue mode..\n");
-	env_set("bootsource", "rescue");
+	env_set(ctx_uboot, "bootsource", "rescue");
 }
 
 static void check_push_button(void)
(quoted diff) +0 -0

b/board/cadence/xtfpga/xtfpga.c index 256611638a55..1aee9c6f95a0 100644 --- a/board/cadence/xtfpga/xtfpga.c
+++ b/board/cadence/xtfpga/xtfpga.c

(quoted diff) +0 -0
@@ -86,14 +86,14 @@ int misc_init_r(void)
 	 * Default MAC address comes from CONFIG_ETHADDR + DIP

switches 1-6. */

board/cadence/xtfpga/xtfpga.c +2 -2
-	char *s = env_get("ethaddr");
+	char *s = env_get(ctx_uboot, "ethaddr");
 	if (s == 0) {
 		unsigned int x;
 		char s[] = __stringify(CONFIG_ETHBASE);
 		x = (*(volatile u32 *)CONFIG_SYS_FPGAREG_DIPSW)
 			& FPGAREG_MAC_MASK;
 		sprintf(&s[15], "%02x", x);
-		env_set("ethaddr", s);
+		env_set(ctx_uboot, "ethaddr", s);
 	}
 #endif /* CONFIG_CMD_NET */
board/ccv/xpress/xpress.c +1 -1
index 05286e643c0e..9518307f7a76 100644
@@ -324,7 +324,7 @@ static const struct boot_mode board_boot_modes[]
 = { int board_late_init(void)
 {
 	add_board_boot_modes(board_boot_modes);
-	env_set("board_name", "xpress");
+	env_set(ctx_uboot, "board_name", "xpress");
 
 	return 0;
 }
(quoted diff) +0 -0

b/board/compulab/cl-som-imx7/cl-som-imx7.c index 395d5dce1785..d05a0dcf32f5 100644 --- a/board/compulab/cl-som-imx7/cl-som-imx7.c +++ b/board/compulab/cl-som-imx7/cl-som-imx7.c @@ -311,7 +311,7 @@ void cl_som_imx7_setup_wdog(void)
int board_late_init(void)
{

board/compulab/cl-som-imx7/cl-som-imx7.c +1 -1
-	env_set("board_name", "CL-SOM-iMX7");
+	env_set(ctx_uboot, "board_name", "CL-SOM-iMX7");
 	cl_som_imx7_setup_wdog();
 	return 0;
 }
(quoted diff) +0 -0

b/board/compulab/cm_fx6/cm_fx6.c index feb7a71f007d..50564fde2ba6 100644 --- a/board/compulab/cm_fx6/cm_fx6.c
+++ b/board/compulab/cm_fx6/cm_fx6.c

board/compulab/cm_fx6/cm_fx6.c +2 -2
@@ -117,10 +117,10 @@ int board_video_skip(void)
 {
 	int ret;
 	struct display_info_t *preset;
-	char const *panel = env_get("displaytype");
+	char const *panel = env_get(ctx_uboot, "displaytype");
 
 	if (!panel) /* Also accept panel for backward compatibility
 */
-		panel = env_get("panel");
+		panel = env_get(ctx_uboot, "panel");
 
 	if (!panel)
board/compulab/cm_fx6/cm_fx6.c +3 -3
 		return -ENOENT;
@@ -628,16 +628,16 @@ int board_late_init(void)
 	int err;
 
 	if (is_mx6dq())
-		env_set("board_rev", "MX6Q");
+		env_set(ctx_uboot, "board_rev", "MX6Q");
 	else if (is_mx6dl())
-		env_set("board_rev", "MX6DL");
+		env_set(ctx_uboot, "board_rev", "MX6DL");
 
 	err = cl_eeprom_get_product_name((uchar *)baseboard_name, 0);
 	if (err)
 		return 0;
 
 	if (!strncmp("SB-FX6m", baseboard_name, 7))
-		env_set("board_name", "Utilite");
+		env_set(ctx_uboot, "board_name", "Utilite");
 #endif
 	return 0;
 }
(quoted diff) +0 -0

b/board/compulab/common/omap3_display.c index cb9ebae7f964..9215a37d982a 100644 --- a/board/compulab/common/omap3_display.c +++ b/board/compulab/common/omap3_display.c @@ -398,7 +398,7 @@ void lcd_ctrl_init(void *lcdbase) {

board/compulab/common/omap3_display.c +2 -2
 	struct prcm *prcm = (struct prcm *)PRCM_BASE;
 	char *custom_lcd;
-	char *displaytype = env_get("displaytype");
+	char *displaytype = env_get(ctx_uboot, "displaytype");
 
 	if (displaytype == NULL)
 		return;
@@ -406,7 +406,7 @@ void lcd_ctrl_init(void *lcdbase)
 	lcd_def = env_parse_displaytype(displaytype);
 	/* If we did not recognize the preset, check if it's an env
 variable */ if (lcd_def == NONE) {
-		custom_lcd = env_get(displaytype);
+		custom_lcd = env_get(ctx_uboot, displaytype);
 		if (custom_lcd == NULL ||
 parse_customlcd(custom_lcd) < 0) return;
 	}
(quoted diff) +0 -0

b/board/congatec/cgtqmx6eval/cgtqmx6eval.c index 6b3d5b833f44..8143f7680e7b 100644 --- a/board/congatec/cgtqmx6eval/cgtqmx6eval.c +++ b/board/congatec/cgtqmx6eval/cgtqmx6eval.c @@ -236,7 +236,7 @@ int power_init_board(void) return 0;

board/congatec/cgtqmx6eval/cgtqmx6eval.c +5 -4
 	/* set level of MIPI if specified */
-	lv_mipi = env_get("lv_mipi");
+	lv_mipi = env_get(ctx_uboot, "lv_mipi");
 	if (lv_mipi)
 		return 0;
@@ -584,7 +584,7 @@ int board_video_skip(void)
 {
 	int i;
 	int ret;
-	char const *panel = env_get("panel");
+	char const *panel = env_get(ctx_uboot, "panel");
 	if (!panel) {
 		for (i = 0; i < ARRAY_SIZE(displays); i++) {
 			struct display_info_t const *dev = displays
+ i; @@ -756,9 +756,9 @@ int board_late_init(void)
 {
 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
 	if (is_mx6dq())
-		env_set("board_rev", "MX6Q");
+		env_set(ctx_uboot, "board_rev", "MX6Q");
 	else
-		env_set("board_rev", "MX6DL");
+		env_set(ctx_uboot, "board_rev", "MX6DL");
 #endif
 
 	return 0;
(quoted diff) +0 -0

b/board/cssi/MCR3000/MCR3000.c index 445b84c180fe..0f7ba71bb647 100644

board/cssi/MCR3000/MCR3000.c +1 -1
@@ -127,7 +127,7 @@ int misc_init_r(void)
 
 	/* if BTN_ACQ_AL is pressed then bootdelay is changed to 60
 second */ if ((in_be16(&iop->iop_pcdat) & 0x0004) == 0)
-		env_set("bootdelay", "60");
+		env_set(ctx_uboot, "bootdelay", "60");
 
 	return 0;
 }
(quoted diff) +0 -0

b/board/davinci/da8xxevm/da850evm.c index d9019de6e006..31a380275553 100644 --- a/board/davinci/da8xxevm/da850evm.c
+++ b/board/davinci/da8xxevm/da850evm.c

board/davinci/da8xxevm/da850evm.c +1 -1
@@ -280,7 +280,7 @@ u32 get_board_rev(void)
 	u32 maxcpuclk = CONFIG_DA850_EVM_MAX_CPU_CLK;
 	u32 rev = 0;
 
-	s = env_get("maxcpuclk");
+	s = env_get(ctx_uboot, "maxcpuclk");
 	if (s)
 		maxcpuclk = simple_strtoul(s, NULL, 10);
 
(quoted diff) +0 -0

b/board/davinci/da8xxevm/omapl138_lcdk.c index 27a51d6a7802..0856b25c16e4 100644 --- a/board/davinci/da8xxevm/omapl138_lcdk.c +++ b/board/davinci/da8xxevm/omapl138_lcdk.c @@ -275,7 +275,7 @@ static void dspwake(void) if ((REG(CHIP_REV_ID_REG) & 0x3f) == 0x10)

board/davinci/da8xxevm/omapl138_lcdk.c +3 -3
 		return;
 
-	if (!strcmp(env_get("dspwake"), "no"))
+	if (!strcmp(env_get(ctx_uboot, "dspwake"), "no"))
 		return;
 
 	*resetvect++ = 0x1E000; /* DSP Idle */
@@ -305,7 +305,7 @@ int misc_init_r(void)
 	uint8_t tmp[20], addr[10];
 
 
-	if (env_get("ethaddr") == NULL) {
+	if (!env_get(ctx_uboot, "ethaddr")) {
 		/* Read Ethernet MAC address from EEPROM */
 		if (dvevm_read_mac_address(addr)) {
 			/* Set Ethernet MAC address from EEPROM */
@@ -319,7 +319,7 @@ int misc_init_r(void)
 				addr[0], addr[1], addr[2], addr[3],
 addr[4], addr[5]);
 
-			env_set("ethaddr", (char *)tmp);
+			env_set(ctx_uboot, "ethaddr", (char *)tmp);
 		} else {
 			printf("Invalid MAC address read.\n");
 		}
(quoted diff) +0 -0

b/board/dhelectronics/dh_imx6/dh_imx6.c index 2d0f78da118f..d904ab4170d3 100644 --- a/board/dhelectronics/dh_imx6/dh_imx6.c +++ b/board/dhelectronics/dh_imx6/dh_imx6.c @@ -251,7 +251,7 @@ int board_late_init(void) break;

board/dhelectronics/dh_imx6/dh_imx6.c +1 -1
 	}
 
-	env_set("dhcom", buf);
+	env_set(ctx_uboot, "dhcom", buf);
 
 #ifdef CONFIG_CMD_BMODE
 	add_board_boot_modes(board_boot_modes);
board/eets/pdu001/board.c +4 -4
index 8a3d0ada270e..104dc1d3c6f7 100644
@@ -79,15 +79,15 @@ static void env_set_boot_device(void)
 {
 	switch (boot_device()) {
 		case BOOT_DEVICE_MMC1: {
-			env_set("boot_device", "emmc");
+			env_set(ctx_uboot, "boot_device", "emmc");
 			break;
 		}
 		case BOOT_DEVICE_MMC2: {
-			env_set("boot_device", "sdcard");
+			env_set(ctx_uboot, "boot_device", "sdcard");
 			break;
 		}
 		default: {
-			env_set("boot_device", "unknown");
+			env_set(ctx_uboot, "boot_device", "unknown");
 			break;
 		}
 	}
@@ -117,7 +117,7 @@ static void env_set_serial(struct udevice *dev)
 		sprintf(serial + n, "%02X", val);
 	}
 	serial[2 * NODE_ID_BYTE_COUNT] = '\0';
-	env_set("serial#", serial);
+	env_set(ctx_uboot, "serial#", serial);
 }
 
 static void set_mpu_and_core_voltage(void)
board/el/el6x/el6x.c +1 -1
index 18d69a7da388..606fe1530728 100644
@@ -467,7 +467,7 @@ int board_late_init(void)
 	add_board_boot_modes(board_boot_modes);
 #endif
 
-	env_set("board_name", BOARD_NAME);
+	env_set(ctx_uboot, "board_name", BOARD_NAME);
 	return 0;
 }
 
(quoted diff) +0 -0

b/board/emulation/qemu-riscv/qemu-riscv.c index 37d48d04f2d0..6cb571ba036c 100644 --- a/board/emulation/qemu-riscv/qemu-riscv.c +++ b/board/emulation/qemu-riscv/qemu-riscv.c @@ -46,7 +46,7 @@ int board_late_init(void) return 0;

board/emulation/qemu-riscv/qemu-riscv.c +1 -1
 	}
 
-	env_set_hex("kernel_start", kernel_start);
+	env_set_hex(ctx_uboot, "kernel_start", kernel_start);
 
 	return 0;
 }
(quoted diff) +0 -0

b/board/engicam/common/board.c index 0c47afe5b566..b338c364efd0 100644

board/engicam/common/board.c +11 -11
@@ -22,11 +22,11 @@ static void mmc_late_init(void)
 	char mmcblk[32];
 	u32 dev_no = mmc_get_env_dev();
 
-	env_set_ulong("mmcdev", dev_no);
+	env_set_ulong(ctx_uboot, "mmcdev", dev_no);
 
 	/* Set mmcblk env */
 	sprintf(mmcblk, "/dev/mmcblk%dp2 rootwait rw", dev_no);
-	env_set("mmcroot", mmcblk);
+	env_set(ctx_uboot, "mmcroot", mmcblk);
 
 	sprintf(cmd, "mmc dev %d", dev_no);
 	run_command(cmd, 0);
@@ -39,25 +39,25 @@ static void setenv_fdt_file(void)
 
 	if (!strcmp(cmp_dtb, "imx6q-icore")) {
 		if (is_mx6dq())
-			env_set("fdt_file", "imx6q-icore.dtb");
+			env_set(ctx_uboot, "fdt_file",
 "imx6q-icore.dtb"); else if (is_mx6dl() || is_mx6solo())
-			env_set("fdt_file", "imx6dl-icore.dtb");
+			env_set(ctx_uboot, "fdt_file",
 "imx6dl-icore.dtb"); } else if (!strcmp(cmp_dtb, "imx6q-icore-mipi"))
 { if (is_mx6dq())
-			env_set("fdt_file", "imx6q-icore-mipi.dtb");
+			env_set(ctx_uboot, "fdt_file",
 "imx6q-icore-mipi.dtb"); else if (is_mx6dl() || is_mx6solo())
-			env_set("fdt_file", "imx6dl-icore-mipi.dtb");
+			env_set(ctx_uboot, "fdt_file",
 "imx6dl-icore-mipi.dtb"); } else if (!strcmp(cmp_dtb,
 "imx6q-icore-rqs")) { if (is_mx6dq())
-			env_set("fdt_file", "imx6q-icore-rqs.dtb");
+			env_set(ctx_uboot, "fdt_file",
 "imx6q-icore-rqs.dtb"); else if (is_mx6dl() || is_mx6solo())
-			env_set("fdt_file", "imx6dl-icore-rqs.dtb");
+			env_set(ctx_uboot, "fdt_file",
 "imx6dl-icore-rqs.dtb"); } else if (!strcmp(cmp_dtb, "imx6ul-geam"))
-		env_set("fdt_file", "imx6ul-geam.dtb");
+		env_set(ctx_uboot, "fdt_file", "imx6ul-geam.dtb");
 	else if (!strcmp(cmp_dtb, "imx6ul-isiot-emmc"))
-		env_set("fdt_file", "imx6ul-isiot-emmc.dtb");
+		env_set(ctx_uboot, "fdt_file",
 "imx6ul-isiot-emmc.dtb"); else if (!strcmp(cmp_dtb,
 "imx6ul-isiot-nand"))
-		env_set("fdt_file", "imx6ul-isiot-nand.dtb");
+		env_set(ctx_uboot, "fdt_file",
 "imx6ul-isiot-nand.dtb"); }
 

int board_late_init(void)

board/engicam/common/board.c +5 -5
@@ -71,20 +71,20 @@ int board_late_init(void)
 #ifdef CONFIG_ENV_IS_IN_MMC
 		mmc_late_init();
 #endif
-		env_set("modeboot", "mmcboot");
+		env_set(ctx_uboot, "modeboot", "mmcboot");
 		break;
 	case IMX6_BMODE_NAND_MIN ... IMX6_BMODE_NAND_MAX:
-		env_set("modeboot", "nandboot");
+		env_set(ctx_uboot, "modeboot", "nandboot");
 		break;
 	default:
-		env_set("modeboot", "");
+		env_set(ctx_uboot, "modeboot", "");
 		break;
 	}
 
 	if (is_mx6ul())
-		env_set("console", "ttymxc0");
+		env_set(ctx_uboot, "console", "ttymxc0");
 	else
-		env_set("console", "ttymxc3");
+		env_set(ctx_uboot, "console", "ttymxc3");
 
 	setenv_fdt_file();
 
board/esd/meesc/meesc.c +2 -2
index b0d2f7b6f87b..c9c1d77410cc 100644
@@ -181,7 +181,7 @@ int checkboard(void)
 		puts("Board: EtherCAN/2 Gateway");
 		break;
 	}
-	if (env_get_f("serial#", str, sizeof(str)) > 0) {
+	if (env_get_f("serial#", str, sizeof(ctx_uboot, str)) > 0) {
 		puts(", serial# ");
 		puts(str);
 	}
@@ -198,7 +198,7 @@ void get_board_serial(struct tag_serialnr
 *serialnr) {
 	char *str;
 
-	char *serial = env_get("serial#");
+	char *serial = env_get(ctx_uboot, "serial#");
 	if (serial) {
 		str = strchr(serial, '_');
 		if (str && (strlen(str) >= 4)) {
@@ -231,7 +231,7 @@ int misc_init_r(void)
 	 * In some cases this this needs to be set to 4.
 	 * Check the user has set environment mdiv to 4 to change

the divisor. */

board/esd/meesc/meesc.c +1 -1
-	str = env_get("mdiv");
+	str = env_get(ctx_uboot, "mdiv");
 	if (str && (strcmp(str, "4") == 0)) {
 		writel((readl(&pmc->mckr) & ~AT91_PMC_MDIV) |
 			AT91SAM9_PMC_MDIV_4, &pmc->mckr);
(quoted diff) +0 -0

b/board/freescale/b4860qds/b4860qds.c index 33cd4b496489..a8168e60a58a 100644 --- a/board/freescale/b4860qds/b4860qds.c +++ b/board/freescale/b4860qds/b4860qds.c @@ -195,7 +195,7 @@ static int adjust_vdd(ulong vdd_override) vid, vdd_target/10);

board/freescale/b4860qds/b4860qds.c +1 -1
 	/* check override variable for overriding VDD */
-	vdd_string = env_get("b4qds_vdd_mv");
+	vdd_string = env_get(ctx_uboot, "b4qds_vdd_mv");
 	if (vdd_override == 0 && vdd_string &&
 	    !strict_strtoul(vdd_string, 10, &vdd_string_override))
 		vdd_override = vdd_string_override;
@@ -542,7 +542,8 @@ int configure_vsc3316_3308(void)
 			 * Extract hwconfig from environment since

environment

board/freescale/b4860qds/b4860qds.c +0 -1
 			 * is not setup properly yet
 			 */
-			env_get_f("hwconfig", buffer,

sizeof(buffer));

board/freescale/b4860qds/b4860qds.c +2 -0
+			env_get_f(ctx_uboot, "hwconfig", buffer,
+				  sizeof(buffer));
 			buf = buffer;
 
 			if

(hwconfig_subarg_cmp_f("fsl_b4860_serdes2", diff --git a/board/freescale/common/cmd_esbc_validate.c b/board/freescale/common/cmd_esbc_validate.c index 36b620ca23a0..14ce924b8684 100644 --- a/board/freescale/common/cmd_esbc_validate.c +++ b/board/freescale/common/cmd_esbc_validate.c @@ -53,7 +53,7 @@ static int do_esbc_validate(cmd_tbl_t *cmdtp, int flag, int argc,

board/freescale/common/cmd_esbc_validate.c +1 -1
 	 * to continue U-Boot
 	 */
 	sprintf(buf, "%lx", img_addr);
-	env_set("img_addr", buf);
+	env_set(ctx_uboot, "img_addr", buf);
 
 	if (ret)
 		return 1;
(quoted diff) +0 -0

b/board/freescale/common/fsl_chain_of_trust.c index a024e7239e6e..9e216c3f51d7 100644 --- a/board/freescale/common/fsl_chain_of_trust.c +++ b/board/freescale/common/fsl_chain_of_trust.c @@ -80,12 +80,12 @@ int fsl_setenv_chain_of_trust(void)

(quoted diff) +0 -0
 	 * bootdelay = 0 (To disable Boot Prompt)
 	 * bootcmd = CONFIG_CHAIN_BOOT_CMD (Validate and execute

Boot script) */

board/freescale/common/fsl_chain_of_trust.c +3 -3
-	env_set("bootdelay", "-2");
+	env_set(ctx_uboot, "bootdelay", "-2");
 
 #ifdef CONFIG_ARM
-	env_set("secureboot", "y");
+	env_set(ctx_uboot, "secureboot", "y");
 #else
-	env_set("bootcmd", CONFIG_CHAIN_BOOT_CMD);
+	env_set(ctx_uboot, "bootcmd", CONFIG_CHAIN_BOOT_CMD);
 #endif
 
 	return 0;
(quoted diff) +0 -0

b/board/freescale/common/sys_eeprom.c index bb655ca7447c..88640958c79d 100644 --- a/board/freescale/common/sys_eeprom.c +++ b/board/freescale/common/sys_eeprom.c @@ -538,8 +538,8 @@ int mac_read_from_eeprom(void) /* Only initialize environment variables that are blank

board/freescale/common/sys_eeprom.c +2 -2
 			 * (i.e. have not yet been set)
 			 */
-			if (!env_get(enetvar))
-				env_set(enetvar, ethaddr);
+			if (!env_get(ctx_uboot, enetvar))
+				env_set(ctx_uboot, enetvar, ethaddr);
 		}
 	}
(quoted diff) +0 -0

b/board/freescale/common/vid.c index b37f3bf4f8fe..db23c8387e5c 100644

board/freescale/common/vid.c +2 -2
@@ -617,7 +617,7 @@ int adjust_vdd(ulong vdd_override)
 	vdd_target = vdd[vid];
 
 	/* check override variable for overriding VDD */
-	vdd_string = env_get(CONFIG_VID_FLS_ENV);
+	vdd_string = env_get(ctx_uboot, CONFIG_VID_FLS_ENV);
 	if (vdd_override == 0 && vdd_string &&
 	    !strict_strtoul(vdd_string, 10, &vdd_string_override))
 		vdd_override = vdd_string_override;
@@ -824,7 +824,7 @@ int adjust_vdd(ulong vdd_override)
 	vdd_target = vdd[vid];
 
 	/* check override variable for overriding VDD */
-	vdd_string = env_get(CONFIG_VID_FLS_ENV);
+	vdd_string = env_get(ctx_uboot, CONFIG_VID_FLS_ENV);
 	if (vdd_override == 0 && vdd_string &&
 	    !strict_strtoul(vdd_string, 10, &vdd_string_override))
 		vdd_override = vdd_string_override;
(quoted diff) +0 -0

b/board/freescale/imx8mq_evk/imx8mq_evk.c index 1463e6e6963b..1822df9f32e8 100644 --- a/board/freescale/imx8mq_evk/imx8mq_evk.c +++ b/board/freescale/imx8mq_evk/imx8mq_evk.c @@ -123,8 +123,8 @@ int board_mmc_get_env_dev(int devno) int board_late_init(void)
{
#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG

board/freescale/imx8mq_evk/imx8mq_evk.c +2 -2
-	env_set("board_name", "EVK");
-	env_set("board_rev", "iMX8MQ");
+	env_set(ctx_uboot, "board_name", "EVK");
+	env_set(ctx_uboot, "board_rev", "iMX8MQ");
 #endif
 
 	return 0;
(quoted diff) +0 -0

b/board/freescale/imx8qm_mek/imx8qm_mek.c index 76634a3a28ad..34ed03c3dec1 100644 --- a/board/freescale/imx8qm_mek/imx8qm_mek.c +++ b/board/freescale/imx8qm_mek/imx8qm_mek.c @@ -126,8 +126,8 @@ int board_mmc_get_env_dev(int devno) int board_late_init(void)
{
#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG

board/freescale/imx8qm_mek/imx8qm_mek.c +2 -2
-	env_set("board_name", "MEK");
-	env_set("board_rev", "iMX8QM");
+	env_set(ctx_uboot, "board_name", "MEK");
+	env_set(ctx_uboot, "board_rev", "iMX8QM");
 #endif
 
 	return 0;
(quoted diff) +0 -0

b/board/freescale/imx8qxp_mek/imx8qxp_mek.c index 4ba83142841a..0d6152ac9551 100644 --- a/board/freescale/imx8qxp_mek/imx8qxp_mek.c +++ b/board/freescale/imx8qxp_mek/imx8qxp_mek.c @@ -139,8 +139,8 @@ int board_mmc_get_env_dev(int devno) int board_late_init(void)
{
#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG

board/freescale/imx8qxp_mek/imx8qxp_mek.c +2 -2
-	env_set("board_name", "MEK");
-	env_set("board_rev", "iMX8QXP");
+	env_set(ctx_uboot, "board_name", "MEK");
+	env_set(ctx_uboot, "board_rev", "iMX8QXP");
 #endif
 
 	return 0;
(quoted diff) +0 -0

b/board/freescale/ls1088a/eth_ls1088aqds.c index 237088a53710..f618db490f00 100644 --- a/board/freescale/ls1088a/eth_ls1088aqds.c +++ b/board/freescale/ls1088a/eth_ls1088aqds.c @@ -529,7 +529,7 @@ void ls1088a_handle_phy_interface_sgmii(int dpmac_id) serdes1_prtcl = serdes_get_number(FSL_SRDS_1, cfg);

board/freescale/ls1088a/eth_ls1088aqds.c +2 -2
 	int *riser_phy_addr;
-	char *env_hwconfig = env_get("hwconfig");
+	char *env_hwconfig = env_get(ctx_uboot, "hwconfig");
 
 	if (hwconfig_f("xqsgmii", env_hwconfig))
 		riser_phy_addr = &xqsgii_riser_phy_addr[0];
@@ -670,7 +670,7 @@ int board_eth_init(bd_t *bis)
 	int error = 0, i;
 #ifdef CONFIG_FSL_MC_ENET
 	struct memac_mdio_info *memac_mdio0_info;
-	char *env_hwconfig = env_get("hwconfig");
+	char *env_hwconfig = env_get(ctx_uboot, "hwconfig");
 
 	initialize_dpmac_to_slot();
 
(quoted diff) +0 -0

b/board/freescale/ls1088a/ls1088a.c index f1592982a348..cdbfd90c19fa 100644 --- a/board/freescale/ls1088a/ls1088a.c
+++ b/board/freescale/ls1088a/ls1088a.c

board/freescale/ls1088a/ls1088a.c +1 -1
@@ -984,7 +984,7 @@ int ft_board_setup(void *blob, bd_t *bd)
 #ifdef CONFIG_MTD_NOR_FLASH
 int is_flash_available(void)
 {
-	char *env_hwconfig = env_get("hwconfig");
+	char *env_hwconfig = env_get(ctx_uboot, "hwconfig");
 	enum boot_src src = get_boot_src();
 	int is_nor_flash_available = 1;
 
(quoted diff) +0 -0

b/board/freescale/ls2080aqds/eth.c index 6a8788c31254..1103ca1d430c 100644 --- a/board/freescale/ls2080aqds/eth.c
+++ b/board/freescale/ls2080aqds/eth.c

board/freescale/ls2080aqds/eth.c +2 -2
@@ -506,7 +506,7 @@ static void initialize_dpmac_to_slot(void)
 		>> FSL_CHASSIS3_RCWSR28_SRDS2_PRTCL_SHIFT;  
 
 	char *env_hwconfig;
-	env_hwconfig = env_get("hwconfig");
+	env_hwconfig = env_get(ctx_uboot, "hwconfig");
 
 	switch (serdes1_prtcl) {
 	case 0x07:
@@ -660,7 +660,7 @@ void ls2080a_handle_phy_interface_sgmii(int
 dpmac_id)
 		>> FSL_CHASSIS3_RCWSR28_SRDS2_PRTCL_SHIFT;  
 
 	int *riser_phy_addr;
-	char *env_hwconfig = env_get("hwconfig");
+	char *env_hwconfig = env_get(ctx_uboot, "hwconfig");
 
 	if (hwconfig_f("xqsgmii", env_hwconfig))
board/freescale/ls2080aqds/eth.c +1 -1
 		riser_phy_addr = &xqsgii_riser_phy_addr[0];
@@ -906,7 +906,7 @@ int board_eth_init(bd_t *bis)
 	unsigned int i;
 	char *env_hwconfig;
 
-	env_hwconfig = env_get("hwconfig");
+	env_hwconfig = env_get(ctx_uboot, "hwconfig");
 
 	initialize_dpmac_to_slot();
 
(quoted diff) +0 -0

b/board/freescale/ls2080aqds/ls2080aqds.c index 91c80353edd6..6eef0536d162 100644 --- a/board/freescale/ls2080aqds/ls2080aqds.c +++ b/board/freescale/ls2080aqds/ls2080aqds.c @@ -212,7 +212,7 @@ int board_init(void)

board/freescale/ls2080aqds/ls2080aqds.c +1 -1
 	val = in_le32(dcfg_ccsr + DCFG_RCWSR13 / 4);
 
-	env_hwconfig = env_get("hwconfig");
+	env_hwconfig = env_get(ctx_uboot, "hwconfig");
 
 	if (hwconfig_f("dspi", env_hwconfig) &&
 	    DCFG_RCWSR13_DSPI == (val & (u32)(0xf << 8)))
(quoted diff) +0 -0

b/board/freescale/ls2080ardb/ls2080ardb.c index e20267f27ce0..d7ea56a6613a 100644 --- a/board/freescale/ls2080ardb/ls2080ardb.c +++ b/board/freescale/ls2080ardb/ls2080ardb.c @@ -265,7 +265,7 @@ int misc_init_r(void)

board/freescale/ls2080aqds/ls2080aqds.c +3 -3
 	val = in_le32(dcfg_ccsr + DCFG_RCWSR13 / 4);
 
-	env_hwconfig = env_get("hwconfig");
+	env_hwconfig = env_get(ctx_uboot, "hwconfig");
 
 	if (hwconfig_f("dspi", env_hwconfig) &&
 	    DCFG_RCWSR13_DSPI == (val & (u32)(0xf << 8)))
@@ -295,10 +295,10 @@ int misc_init_r(void)
 	 */
 	if ((SVR_SOC_VER(svr) == SVR_LS2088A) ||
 	    (SVR_SOC_VER(svr) == SVR_LS2048A))
-		env_set("board", "ls2088ardb");
+		env_set(ctx_uboot, "board", "ls2088ardb");
 	else if ((SVR_SOC_VER(svr) == SVR_LS2081A) ||
 	    (SVR_SOC_VER(svr) == SVR_LS2041A))
-		env_set("board", "ls2081ardb");
+		env_set(ctx_uboot, "board", "ls2081ardb");
 
 	return 0;
 }
(quoted diff) +0 -0

b/board/freescale/lx2160a/eth_lx2160aqds.c index 92c06e5060f1..40fb5092c337 100644 --- a/board/freescale/lx2160a/eth_lx2160aqds.c +++ b/board/freescale/lx2160a/eth_lx2160aqds.c @@ -484,7 +484,7 @@ int board_eth_init(bd_t *bis)
* defining "dpmac_override" in hwconfig environment
variable. */

board/freescale/lx2160a/eth_lx2160aqds.c +1 -1
 	if (hwconfig("dpmac_override")) {
-		env_dpmac = env_get("dpmac");
+		env_dpmac = env_get(ctx_uboot, "dpmac");
 		if (env_dpmac) {
 			ret = hwconfig_arg_f("srds", &len,

env_dpmac); if (ret) {

(quoted diff) +0 -0

b/board/freescale/mpc8323erdb/mpc8323erdb.c index e5aecc4e1f28..aa19a1b8534d 100644 --- a/board/freescale/mpc8323erdb/mpc8323erdb.c +++ b/board/freescale/mpc8323erdb/mpc8323erdb.c @@ -217,7 +217,8 @@ int mac_read_from_eeprom(void) buf[i * 6 + 4], buf[i * 6 + 5]);

(quoted diff) +0 -0
 					sprintf((char *)enetvar,
 						i ? "eth%daddr" :

"ethaddr", i);

(quoted diff) +0 -1
-					env_set((char *)enetvar,

str);

(quoted diff) +1 -0
+					env_set(ctx_uboot, (char

*)enetvar,

board/freescale/mpc8323erdb/mpc8323erdb.c +1 -0
+						str);
 				}
 			}
 		}
(quoted diff) +0 -0

b/board/freescale/mpc837xemds/pci.c index 41b78cf5e4de..c6f734ef2625 100644 --- a/board/freescale/mpc837xemds/pci.c
+++ b/board/freescale/mpc837xemds/pci.c

board/freescale/mpc837xemds/pci.c +1 -1
@@ -67,7 +67,7 @@ static struct pci_region pcie_regions_1[] = {
 
 static int is_pex_x2(void)
 {
-	const char *pex_x2 = env_get("pex_x2");
+	const char *pex_x2 = env_get(ctx_uboot, "pex_x2");
 
 	if (pex_x2 && !strcmp(pex_x2, "yes"))
 		return 1;
(quoted diff) +0 -0

b/board/freescale/mpc837xerdb/mpc837xerdb.c index 4ad62bcf1d6b..71939b240dae 100644 --- a/board/freescale/mpc837xerdb/mpc837xerdb.c +++ b/board/freescale/mpc837xerdb/mpc837xerdb.c @@ -173,7 +173,7 @@ int board_mmc_init(bd_t *bd) char buffer[HWCONFIG_BUFFER_SIZE] = {0};

board/freescale/mpc837xerdb/mpc837xerdb.c +1 -1
 	int esdhc_hwconfig_enabled = 0;
 
-	if (env_get_f("hwconfig", buffer, sizeof(buffer)) > 0)
+	if (env_get_f("hwconfig", buffer, sizeof(ctx_uboot, buffer))
Quoted 1 line

0) esdhc_hwconfig_enabled = hwconfig_f("esdhc", buffer);

board/freescale/mpc837xerdb/mpc837xerdb.c +0 -0
 	if (esdhc_hwconfig_enabled == 0)
(quoted diff) +0 -0

b/board/freescale/mx51evk/mx51evk_video.c index 3715c5d738f9..ed2a58ea4a9a 100644 --- a/board/freescale/mx51evk/mx51evk_video.c +++ b/board/freescale/mx51evk/mx51evk_video.c @@ -76,7 +76,7 @@ void setup_iomux_lcd(void) int board_video_skip(void)
{

board/freescale/mx51evk/mx51evk_video.c +1 -1
 	int ret;
-	char const *e = env_get("panel");
+	char const *e = env_get(ctx_uboot, "panel");
 
 	if (e) {
 		if (strcmp(e, "claa") == 0) {
(quoted diff) +0 -0

b/board/freescale/mx53loco/mx53loco.c index a177815bb8aa..a3328a134fb8 100644 --- a/board/freescale/mx53loco/mx53loco.c +++ b/board/freescale/mx53loco/mx53loco.c @@ -208,7 +208,7 @@ static int power_init(void) if (!p)

board/freescale/mx53loco/mx53loco.c +1 -1
 			return -ENODEV;
 
-		env_set("fdt_file", "imx53-qsb.dtb");
+		env_set(ctx_uboot, "fdt_file", "imx53-qsb.dtb");
 
 		/* Set VDDA to 1.25V */
 		val = DA9052_BUCKCORE_BCOREEN |

DA_BUCKCORE_VBCORE_1_250V; @@ -251,7 +251,7 @@ static int power_init(void) if (!p)

board/freescale/mx53loco/mx53loco.c +1 -1
 			return -ENODEV;
 
-		env_set("fdt_file", "imx53-qsrb.dtb");
+		env_set(ctx_uboot, "fdt_file", "imx53-qsrb.dtb");
 
 		/* Set VDDGP to 1.25V for 1GHz on SW1 */
 		pmic_reg_read(p, REG_SW_0, &val);
(quoted diff) +0 -0

b/board/freescale/mx53loco/mx53loco_video.c index ff3fc8ce3e6f..061c990bcfb5 100644 --- a/board/freescale/mx53loco/mx53loco_video.c +++ b/board/freescale/mx53loco/mx53loco_video.c @@ -92,7 +92,7 @@ void setup_iomux_lcd(void) int board_video_skip(void)
{

board/freescale/mx53loco/mx53loco_video.c +1 -1
 	int ret;
-	char const *e = env_get("panel");
+	char const *e = env_get(ctx_uboot, "panel");
 
 	if (e) {
 		if (strcmp(e, "seiko") == 0) {
(quoted diff) +0 -0

b/board/freescale/mx6sabreauto/mx6sabreauto.c index dc156efbbcbc..a1cd8f4bc52e 100644 --- a/board/freescale/mx6sabreauto/mx6sabreauto.c +++ b/board/freescale/mx6sabreauto/mx6sabreauto.c @@ -623,14 +623,14 @@ int board_late_init(void) #endif

#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG

board/freescale/mx6sabreauto/mx6sabreauto.c +4 -4
-	env_set("board_name", "SABREAUTO");
+	env_set(ctx_uboot, "board_name", "SABREAUTO");
 
 	if (is_mx6dqp())
-		env_set("board_rev", "MX6QP");
+		env_set(ctx_uboot, "board_rev", "MX6QP");
 	else if (is_mx6dq())
-		env_set("board_rev", "MX6Q");
+		env_set(ctx_uboot, "board_rev", "MX6Q");
 	else if (is_mx6sdl())
-		env_set("board_rev", "MX6DL");
+		env_set(ctx_uboot, "board_rev", "MX6DL");
 #endif
 
 	return 0;
(quoted diff) +0 -0

b/board/freescale/mx6sabresd/mx6sabresd.c index b0c0117968bf..fb4c03a428c8 100644 --- a/board/freescale/mx6sabresd/mx6sabresd.c +++ b/board/freescale/mx6sabresd/mx6sabresd.c @@ -606,14 +606,14 @@ int board_late_init(void) #endif

#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG

board/freescale/mx6sabresd/mx6sabresd.c +4 -4
-	env_set("board_name", "SABRESD");
+	env_set(ctx_uboot, "board_name", "SABRESD");
 
 	if (is_mx6dqp())
-		env_set("board_rev", "MX6QP");
+		env_set(ctx_uboot, "board_rev", "MX6QP");
 	else if (is_mx6dq())
-		env_set("board_rev", "MX6Q");
+		env_set(ctx_uboot, "board_rev", "MX6Q");
 	else if (is_mx6sdl())
-		env_set("board_rev", "MX6DL");
+		env_set(ctx_uboot, "board_rev", "MX6DL");
 #endif
 
 	return 0;
(quoted diff) +0 -0

b/board/freescale/mx6sxsabresd/mx6sxsabresd.c index 1c10958879b1..b4bc682a5160 100644 --- a/board/freescale/mx6sxsabresd/mx6sxsabresd.c +++ b/board/freescale/mx6sxsabresd/mx6sxsabresd.c @@ -309,7 +309,7 @@ int board_late_init(void) {
#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG

board/freescale/mx6sxsabresd/mx6sxsabresd.c +1 -1
 	if (is_reva())
-		env_set("board_rev", "REVA");
+		env_set(ctx_uboot, "board_rev", "REVA");
 #endif
 	return 0;
 }
(quoted diff) +0 -0

b/board/freescale/mx6ul_14x14_evk/mx6ul_14x14_evk.c index ccbe4044786c..913b2c6c57b8 100644 --- a/board/freescale/mx6ul_14x14_evk/mx6ul_14x14_evk.c +++ b/board/freescale/mx6ul_14x14_evk/mx6ul_14x14_evk.c @@ -545,12 +545,12 @@ int board_late_init(void) #endif

#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG

board/freescale/mx6ul_14x14_evk/mx6ul_14x14_evk.c +3 -3
-	env_set("board_name", "EVK");
+	env_set(ctx_uboot, "board_name", "EVK");
 
 	if (is_mx6ul_9x9_evk())
-		env_set("board_rev", "9X9");
+		env_set(ctx_uboot, "board_rev", "9X9");
 	else
-		env_set("board_rev", "14X14");
+		env_set(ctx_uboot, "board_rev", "14X14");
 #endif
 
 	return 0;
(quoted diff) +0 -0

b/board/freescale/mx6ullevk/mx6ullevk.c index e11934780262..8dc5511e245f 100644 --- a/board/freescale/mx6ullevk/mx6ullevk.c +++ b/board/freescale/mx6ullevk/mx6ullevk.c @@ -84,8 +84,8 @@ int board_late_init(void) #endif

#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG

board/freescale/mx6ullevk/mx6ullevk.c +2 -2
-	env_set("board_name", "EVK");
-	env_set("board_rev", "14X14");
+	env_set(ctx_uboot, "board_name", "EVK");
+	env_set(ctx_uboot, "board_rev", "14X14");
 #endif
 
 	return 0;
(quoted diff) +0 -0

b/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c index a04a73528f8d..4a21c148b696 100644 --- a/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c +++ b/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c @@ -350,7 +350,7 @@ int board_eth_init(bd_t *bis)
#ifdef CONFIG_VSC7385_ENET
/* If a VSC7385 microcode image is present, then upload it.
*/

board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c +1 -1
-	tmp = env_get("vscfw_addr");
+	tmp = env_get(ctx_uboot, "vscfw_addr");
 	if (tmp) {
 		vscfw_addr = simple_strtoul(tmp, NULL, 16);
 		printf("uploading VSC7385 microcode from %x\n",

vscfw_addr); diff --git a/board/freescale/qemu-ppce500/qemu-ppce500.c b/board/freescale/qemu-ppce500/qemu-ppce500.c index fb36d8366c98..38608234b7d5 100644 --- a/board/freescale/qemu-ppce500/qemu-ppce500.c +++ b/board/freescale/qemu-ppce500/qemu-ppce500.c @@ -211,10 +211,10 @@ int last_stage_init(void) /* -kernel boot */

board/freescale/qemu-ppce500/qemu-ppce500.c +2 -2
 	prop = fdt_getprop(fdt, chosen, "qemu,boot-kernel", &len);
 	if (prop && (len >= 8))
-		env_set_hex("qemu_kernel_addr", *prop);
+		env_set_hex(ctx_uboot, "qemu_kernel_addr", *prop);
 
 	/* Give the user a variable for the host fdt */
-	env_set_hex("fdt_addr_r", (ulong)fdt);
+	env_set_hex("fdt_addr_r", (ctx_uboot, ulong)fdt);
 
 	return 0;
 }
(quoted diff) +0 -0

b/board/freescale/t4qds/t4240qds.c index bb18b97e6a2e..d4e92d6c8d51 100644 --- a/board/freescale/t4qds/t4240qds.c
+++ b/board/freescale/t4qds/t4240qds.c

board/freescale/t4qds/t4240qds.c +1 -1
@@ -265,7 +265,7 @@ static int adjust_vdd(ulong vdd_override)
 	vdd_target = vdd[vid];
 
 	/* check override variable for overriding VDD */
-	vdd_string = env_get("t4240qds_vdd_mv");
+	vdd_string = env_get(ctx_uboot, "t4240qds_vdd_mv");
 	if (vdd_override == 0 && vdd_string &&
 	    !strict_strtoul(vdd_string, 10, &vdd_string_override))
 		vdd_override = vdd_string_override;
(quoted diff) +0 -0

b/board/gardena/smart-gateway-at91sam/board.c index 3e2da0d6f8e0..499605d5b6a1 100644 --- a/board/gardena/smart-gateway-at91sam/board.c +++ b/board/gardena/smart-gateway-at91sam/board.c @@ -15,7 +15,7 @@ DECLARE_GLOBAL_DATA_PTR;
static void at91_prepare_cpu_var(void)
{

board/gardena/smart-gateway-at91sam/board.c +1 -1
-	env_set("cpu", get_cpu_name());
+	env_set(ctx_uboot, "cpu", get_cpu_name());
 }
 
 int board_late_init(void)
(quoted diff) +0 -0

b/board/gardena/smart-gateway-mt7688/board.c index bd494c84fc80..fe39187d0738 100644 --- a/board/gardena/smart-gateway-mt7688/board.c +++ b/board/gardena/smart-gateway-mt7688/board.c @@ -70,9 +70,9 @@ static bool prepare_uuid_var(const char *fd_ptr, const char *env_var_name, str[i] = errorchar; }

board/gardena/smart-gateway-mt7688/board.c +7 -7
-	env = env_get(env_var_name);
+	env = env_get(ctx_uboot, env_var_name);
 	if (strcmp(env, str)) {
-		env_set(env_var_name, str);
+		env_set(ctx_uboot, env_var_name, str);
 		env_updated = true;
 	}
@@ -134,9 +134,9 @@ static void factory_data_env_config(void)
 	if (!is_valid_ethaddr(ptr))
 		printf("F-Data:Invalid MAC addr: wifi_mac %s\n",
 str); 
-	env = env_get("wifiaddr");
+	env = env_get(ctx_uboot, "wifiaddr");
 	if (strcmp(env, str)) {
-		env_set("wifiaddr", str);
+		env_set(ctx_uboot, "wifiaddr", str);
 		env_updated = 1;
 	}
 
@@ -146,9 +146,9 @@ static void factory_data_env_config(void)
 	if (!is_valid_ethaddr(ptr))
 		printf("F-Data:Invalid MAC addr: eth_mac %s\n", str);
 
-	env = env_get("ethaddr");
+	env = env_get(ctx_uboot, "ethaddr");
 	if (strcmp(env, str)) {
-		env_set("ethaddr", str);
+		env_set(ctx_uboot, "ethaddr", str);
 		env_updated = 1;
 	}
 
@@ -161,7 +161,7 @@ static void factory_data_env_config(void)
 	/* Check if the environment was updated and needs to get
 stored */ if (env_updated != 0) {
 		printf("F-Data:Values don't match env values ->
 saving\n");
-		env_save();
+		env_save(ctx_uboot);
 	} else {
 		debug("F-Data:Values match current env values\n");
board/gardena/smart-gateway-mt7688/board.c +1 -1
 	}
@@ -189,7 +189,7 @@ static void copy_or_generate_uuid(char *fd_ptr,
 const char *env_var_name) char *env;
 
 	/* Don't use the UUID dest place, as the \0 char won't fit */
-	env = env_get(env_var_name);
+	env = env_get(ctx_uboot, env_var_name);
 	if (env)
 		strncpy(str, env, UUID_STR_LEN);
 	else
(quoted diff) +0 -0

b/board/gateworks/gw_ventana/common.c index 1240a9da174f..0be40c2336ad 100644 --- a/board/gateworks/gw_ventana/common.c +++ b/board/gateworks/gw_ventana/common.c @@ -1477,7 +1477,7 @@ void setup_board_gpio(int board, struct ventana_board_info *info) char arg[10]; size_t len;

board/gateworks/gw_ventana/common.c +1 -1
 	int i;
-	int quiet = simple_strtol(env_get("quiet"), NULL, 10);
+	int quiet = simple_strtol(env_get(ctx_uboot, "quiet"), NULL,

10);

board/gateworks/gw_ventana/common.c +0 -0
 	if (board >= GW_UNKNOWN)
 		return;
(quoted diff) +0 -0

b/board/gateworks/gw_ventana/gw_ventana.c index 8a694a71c90b..6782e6327978 100644 --- a/board/gateworks/gw_ventana/gw_ventana.c +++ b/board/gateworks/gw_ventana/gw_ventana.c @@ -299,11 +299,12 @@ int board_eth_init(bd_t *bis) #endif

board/gateworks/gw_ventana/gw_ventana.c +1 -3
 	/* default to the first detected enet dev */
-	if (!env_get("ethprime")) {
+	if (!env_get(ctx_uboot, "ethprime")) {
 		struct eth_device *dev = eth_get_dev_by_index(0);
 		if (dev) {
-			env_set("ethprime", dev->name);
-			printf("set ethprime to %s\n",

env_get("ethprime"));

board/gateworks/gw_ventana/gw_ventana.c +19 -16
+			env_set(ctx_uboot, "ethprime", dev->name);
+			printf("set ethprime to %s\n",
+			       env_get(ctx_uboot, "ethprime"));
 		}
 	}
@@ -602,7 +603,7 @@ void board_pci_fixup_dev(struct pci_controller
 *hose, pci_dev_t dev, */
 void get_board_serial(struct tag_serialnr *serialnr)
 {
-	char *serial = env_get("serial#");
+	char *serial = env_get(ctx_uboot, "serial#");
 
 	if (serial) {
 		serialnr->high = 0;
@@ -685,11 +686,11 @@ int checkboard(void)
 	int quiet; /* Quiet or minimal output mode */
 
 	quiet = 0;
-	p = env_get("quiet");
+	p = env_get(ctx_uboot, "quiet");
 	if (p)
 		quiet = simple_strtol(p, NULL, 10);
 	else
-		env_set("quiet", "0");
+		env_set(ctx_uboot, "quiet", "0");
 
 	puts("\nGateworks Corporation Copyright 2014\n");
 	if (info->model[0]) {
@@ -764,26 +765,26 @@ int misc_init_r(void)
 		else if (is_cpu_type(MXC_CPU_MX6DL) ||
 			 is_cpu_type(MXC_CPU_MX6SOLO))
 			cputype = "imx6dl";
-		env_set("soctype", cputype);
+		env_set(ctx_uboot, "soctype", cputype);
 		if (8 << (ventana_info.nand_flash_size-1) >= 2048)
-			env_set("flash_layout", "large");
+			env_set(ctx_uboot, "flash_layout", "large");
 		else
-			env_set("flash_layout", "normal");
+			env_set(ctx_uboot, "flash_layout", "normal");
 		memset(str, 0, sizeof(str));
 		for (i = 0; i < (sizeof(str)-1) && info->model[i];
 i++) str[i] = tolower(info->model[i]);
-		env_set("model", str);
-		if (!env_get("fdt_file")) {
+		env_set(ctx_uboot, "model", str);
+		if (!env_get(ctx_uboot, "fdt_file")) {
 			sprintf(fdt, "%s-%s.dtb", cputype, str);
-			env_set("fdt_file", fdt);
+			env_set(ctx_uboot, "fdt_file", fdt);
 		}
 		p = strchr(str, '-');
 		if (p) {
 			*p++ = 0;
 
-			env_set("model_base", str);
+			env_set(ctx_uboot, "model_base", str);
 			sprintf(fdt, "%s-%s.dtb", cputype, str);
-			env_set("fdt_file1", fdt);
+			env_set(ctx_uboot, "fdt_file1", fdt);
 			if (board_type != GW551x &&
 			    board_type != GW552x &&
 			    board_type != GW553x &&
@@ -792,30 +793,30 @@ int misc_init_r(void)
 			str[5] = 'x';
 			str[6] = 0;
 			sprintf(fdt, "%s-%s.dtb", cputype, str);
-			env_set("fdt_file2", fdt);
+			env_set(ctx_uboot, "fdt_file2", fdt);
 		}
 
 		/* initialize env from EEPROM */
 		if (test_bit(EECONFIG_ETH0, info->config) &&
-		    !env_get("ethaddr")) {
+		    !env_get(ctx_uboot, "ethaddr")) {
 			eth_env_set_enetaddr("ethaddr", info->mac0);
 		}
 		if (test_bit(EECONFIG_ETH1, info->config) &&
-		    !env_get("eth1addr")) {
+		    !env_get(ctx_uboot, "eth1addr")) {
 			eth_env_set_enetaddr("eth1addr", info->mac1);
 		}
 
 		/* board serial-number */
 		sprintf(str, "%6d", info->serial);
-		env_set("serial#", str);
+		env_set(ctx_uboot, "serial#", str);
 
 		/* memory MB */
 		sprintf(str, "%d", (int) (gd->ram_size >> 20));
-		env_set("mem_mb", str);
+		env_set(ctx_uboot, "mem_mb", str);
 	}
 
 	/* Set a non-initialized hwconfig based on board

configuration */

board/gateworks/gw_ventana/gw_ventana.c +3 -3
-	if (!strcmp(env_get("hwconfig"), "_UNKNOWN_")) {
+	if (!strcmp(env_get(ctx_uboot, "hwconfig"), "_UNKNOWN_")) {
 		buf[0] = 0;
 		if (gpio_cfg[board_type].rs232_en)
 			strcat(buf, "rs232;");
@@ -825,7 +826,7 @@ int misc_init_r(void)
 			if (strlen(buf) + strlen(buf1) < sizeof(buf))
 				strcat(buf, buf1);
 		}
-		env_set("hwconfig", buf);
+		env_set(ctx_uboot, "hwconfig", buf);
 	}
 
 	/* setup baseboard specific GPIO based on board and env */
@@ -1040,7 +1041,7 @@ int fdt_fixup_sky2(void *blob, int np, struct
 pci_dev *dev) int j;
 
 	sprintf(mac, "eth1addr");
-	tmp = env_get(mac);
+	tmp = env_get(ctx_uboot, mac);
 	if (tmp) {
 		for (j = 0; j < 6; j++) {
 			mac_addr[j] = tmp ?
@@ -1128,8 +1129,8 @@ int ft_board_setup(void *blob, bd_t *bd)
 		{ "sst,w25q256",          MTD_DEV_TYPE_NOR, },  /*

SPI flash */ { "fsl,imx6q-gpmi-nand", MTD_DEV_TYPE_NAND, }, /* NAND flash */ };

board/gateworks/gw_ventana/gw_ventana.c +6 -6
-	const char *model = env_get("model");
-	const char *display = env_get("display");
+	const char *model = env_get(ctx_uboot, "model");
+	const char *display = env_get(ctx_uboot, "display");
 	int i;
 	char rev = 0;
@@ -1141,7 +1142,7 @@ int ft_board_setup(void *blob, bd_t *bd)
 		}
 	}
 
-	if (env_get("fdt_noauto")) {
+	if (env_get(ctx_uboot, "fdt_noauto")) {
 		puts("   Skiping ft_board_setup (fdt_noauto
 defined)\n"); return 0;
 	}
@@ -1162,15 +1163,15 @@ int ft_board_setup(void *blob, bd_t *bd)
 	printf("   Adjusting FDT per EEPROM for %s...\n", model);
 
 	/* board serial number */
-	fdt_setprop(blob, 0, "system-serial", env_get("serial#"),
-		    strlen(env_get("serial#")) + 1);
+	fdt_setprop(blob, 0, "system-serial", env_get(ctx_uboot,
 "serial#"),
+		    strlen(env_get(ctx_uboot, "serial#")) + 1);
 
 	/* board (model contains model from device-tree) */
 	fdt_setprop(blob, 0, "board", info->model,
 		    strlen((const char *)info->model) + 1);
 
 	/* set desired digital video capture format */
-	ft_sethdmiinfmt(blob, env_get("hdmiinfmt"));
+	ft_sethdmiinfmt(blob, env_get(ctx_uboot, "hdmiinfmt"));
 
 	/*
board/gateworks/gw_ventana/gw_ventana.c +2 -2
 	 * Board model specific fixups
@@ -1340,7 +1341,7 @@ int ft_board_setup(void *blob, bd_t *bd)
 	}
 
 #if defined(CONFIG_CMD_PCI)
-	if (!env_get("nopcifixup"))
+	if (!env_get(ctx_uboot, "nopcifixup"))
 		ft_board_pci_fixup(blob, bd);
 #endif
 
@@ -1349,7 +1350,7 @@ int ft_board_setup(void *blob, bd_t *bd)
 	 *  remove nodes by alias path if EEPROM config tells us the
 	 *  peripheral is not loaded on the board.
 	 */
-	if (env_get("fdt_noconfig")) {
+	if (env_get(ctx_uboot, "fdt_noconfig")) {
 		puts("   Skiping periperhal config (fdt_noconfig
 defined)\n"); return 0;
 	}
(quoted diff) +0 -0

b/board/gateworks/gw_ventana/gw_ventana_spl.c index b0891379a170..a689ec16d98c 100644 --- a/board/gateworks/gw_ventana/gw_ventana_spl.c +++ b/board/gateworks/gw_ventana/gw_ventana_spl.c @@ -758,8 +758,8 @@ int spl_start_uboot(void) debug("%s\n", __func__);
#ifdef CONFIG_SPL_ENV_SUPPORT

board/gateworks/gw_ventana/gw_ventana_spl.c +2 -2
 	env_init();
-	env_load();
-	debug("boot_os=%s\n", env_get("boot_os"));
+	env_load(ctx_uboot);
+	debug("boot_os=%s\n", env_get(ctx_uboot, "boot_os"));
 	if (env_get_yesno("boot_os") == 1)
 		ret = 0;
 #else
(quoted diff) +0 -0

b/board/gdsys/a38x/keyprogram.c index 000897984a6e..f65190d814c2 100644 --- a/board/gdsys/a38x/keyprogram.c
+++ b/board/gdsys/a38x/keyprogram.c

board/gdsys/a38x/keyprogram.c +2 -2
@@ -131,12 +131,12 @@ int load_and_run_keyprog(struct udevice *tpm)
 	char *hexprog;
 	struct key_program *prog;
 
-	cmd = env_get("loadkeyprogram");
+	cmd = env_get(ctx_uboot, "loadkeyprogram");
 
 	if (!cmd || run_command(cmd, 0))
 		return 1;
 
-	hexprog = env_get("keyprogram");
+	hexprog = env_get(ctx_uboot, "keyprogram");
 
 	if (decode_hexstr(hexprog, &binprog))
 		return 1;
(quoted diff) +0 -0

b/board/gdsys/mpc8308/gazerbeam.c index ddd6ee895384..4929296364b3 100644 --- a/board/gdsys/mpc8308/gazerbeam.c
+++ b/board/gdsys/mpc8308/gazerbeam.c

board/gdsys/mpc8308/gazerbeam.c +2 -2
@@ -85,7 +85,7 @@ int board_early_init_r(void)
 int checkboard(void)
 {
 	struct udevice *board;
-	char *s = env_get("serial#");
+	char *s = env_get(ctx_uboot, "serial#");
 	int mc = 0;
 	int con = 0;
 
@@ -137,7 +137,7 @@ int last_stage_init(void)
 			printf("Could not determind FPGA HW revision
 (res = %d)\n", res); }
 
-	env_set_ulong("fpga_hw_rev", fpga_hw_rev);
+	env_set_ulong(ctx_uboot, "fpga_hw_rev", fpga_hw_rev);
 
 	ret = get_tpm(&tpm);
 	if (ret || tpm_init(tpm) || tpm_startup(tpm, TPM_ST_CLEAR) ||
board/gdsys/mpc8308/hrcon.c +1 -1
index 60faa4688cf8..666eb25c809c 100644
@@ -101,7 +101,7 @@ int fpga_get_reg(u32 fpga, u16 *reg, off_t
 regoff, u16 *data) 
 int checkboard(void)
 {
-	char *s = env_get("serial#");
+	char *s = env_get(ctx_uboot, "serial#");
 	bool hw_type_cat = pca9698_get_value(0x20, 20);
 
 	puts("Board: ");
(quoted diff) +0 -0

b/board/gdsys/mpc8308/strider.c index 886bc2b035de..cc3fcd7de172 100644 --- a/board/gdsys/mpc8308/strider.c
+++ b/board/gdsys/mpc8308/strider.c

board/gdsys/mpc8308/strider.c +1 -1
@@ -104,7 +104,7 @@ int fpga_get_reg(u32 fpga, u16 *reg, off_t
 regoff, u16 *data) 
 int checkboard(void)
 {
-	char *s = env_get("serial#");
+	char *s = env_get(ctx_uboot, "serial#");
 	bool hw_type_cat = pca9698_get_value(0x20, 18);
 
 	puts("Board: ");
(quoted diff) +0 -0

b/board/gdsys/p1022/controlcenterd-id.c index 43f5404231f0..db7c92446e75 100644 --- a/board/gdsys/p1022/controlcenterd-id.c +++ b/board/gdsys/p1022/controlcenterd-id.c @@ -231,7 +231,7 @@ static u8 *get_2nd_stage_bl_location(ulong target_addr) {

board/gdsys/p1022/controlcenterd-id.c +1 -1
 	ulong addr;
 #ifdef CCDM_SECOND_STAGE
-	addr = env_get_ulong("loadaddr", 16, CONFIG_LOADADDR);
+	addr = env_get_ulong(ctx_uboot, "loadaddr", 16,

CONFIG_LOADADDR); #else

board/gdsys/p1022/controlcenterd-id.c +4 -4
 	addr = target_addr;
 #endif
@@ -249,7 +249,7 @@ static u8 *get_image_location(void)
 {
 	ulong addr;
 	/* TODO use other area? */
-	addr = env_get_ulong("loadaddr", 16, CONFIG_LOADADDR);
+	addr = env_get_ulong(ctx_uboot, "loadaddr", 16,
 CONFIG_LOADADDR); return (u8 *)(addr);
 }
 #endif
@@ -1072,13 +1072,13 @@ static int second_stage_init(void)
 		goto failure;
 
 	/* run "prepboot" from env to get "mmcdev" set */
-	cptr = env_get("prepboot");
+	cptr = env_get(ctx_uboot, "prepboot");
 	if (cptr && !run_command(cptr, 0))
-		mmcdev = env_get("mmcdev");
+		mmcdev = env_get(ctx_uboot, "mmcdev");
 	if (!mmcdev)
 		goto failure;
 
-	cptr = env_get("ramdiskimage");
+	cptr = env_get(ctx_uboot, "ramdiskimage");
 	if (cptr)
 		image_path = cptr;
 
(quoted diff) +0 -0

b/board/gdsys/p1022/controlcenterd.c index 6eb3d6c5d06e..ec349d61ee33 100644 --- a/board/gdsys/p1022/controlcenterd.c
+++ b/board/gdsys/p1022/controlcenterd.c

board/gdsys/p1022/controlcenterd.c +1 -1
@@ -222,7 +222,7 @@ void hw_watchdog_reset(void)
 #ifdef CONFIG_TRAILBLAZER
 int do_bootd(cmd_tbl_t *cmdtp, int flag, int argc, char * const
 argv[]) {
-	return run_command(env_get("bootcmd"), flag);
+	return run_command(env_get(ctx_uboot, "bootcmd"), flag);
 }
 
 int board_early_init_r(void)
board/ge/bx50v3/bx50v3.c +5 -4
index 917ecc4c1816..3262a73d0b80 100644
@@ -470,17 +470,17 @@ static void process_vpd(struct vpd_cache *vpd)
 
 	switch (vpd->product_id) {
 	case VPD_PRODUCT_B450:
-		env_set("confidx", "1");
+		env_set(ctx_uboot, "confidx", "1");
 		i210_index = 0;
 		fec_index = 1;
 		break;
 	case VPD_PRODUCT_B650:
-		env_set("confidx", "2");
+		env_set(ctx_uboot, "confidx", "2");
 		i210_index = 0;
 		fec_index = 1;
 		break;
 	case VPD_PRODUCT_B850:
-		env_set("confidx", "3");
+		env_set(ctx_uboot, "confidx", "3");
 		i210_index = 1;
 		fec_index = 2;
 		break;
@@ -647,9 +647,10 @@ int board_late_init(void)
 #endif
 
 	if (is_b850v3())
-		env_set("videoargs", "video=DP-1:1024x768 at 60
 video=HDMI-A-1:1024x768 at 60");
+		env_set(ctx_uboot, "videoargs",
+			"video=DP-1:1024x768 at 60

video=HDMI-A-1:1024x768 at 60"); else

board/ge/bx50v3/bx50v3.c +1 -1
-		env_set("videoargs", "video=LVDS-1:1024x768 at 65");
+		env_set(ctx_uboot, "videoargs",

"video=LVDS-1:1024x768 at 65");

board/ge/bx50v3/bx50v3.c +1 -1
 	/* board specific pmic init */
 	pmic_init();
@@ -669,7 +670,7 @@ static void remove_ethaddr_env_var(int index)
 	char env_var_name[9];
 
 	sprintf(env_var_name, index == 0 ? "ethaddr" : "eth%daddr",
 index);
-	env_set(env_var_name, NULL);
+	env_set(ctx_uboot, env_var_name, NULL);
 }
 

int last_stage_init(void)

board/ge/common/ge_common.c +2 -2
index 501c8b2daf2a..1d5f7ac39350 100644
@@ -29,7 +29,7 @@ void check_time(void)
 	}
 
 	if (ret < 0)
-		env_set("rtc_status", "RTC_ERROR");
+		env_set(ctx_uboot, "rtc_status", "RTC_ERROR");
 
 	if (tm.tm_year > 2037) {
 		tm.tm_sec  = 0;
@@ -47,7 +47,7 @@ void check_time(void)
 		}
 
 		if (ret < 0)
-			env_set("rtc_status", "RTC_ERROR");
+			env_set(ctx_uboot, "rtc_status",
 "RTC_ERROR"); }
 
 	i2c_set_bus_num(current_i2c_bus);
board/ge/mx53ppd/mx53ppd.c +1 -1
index 544856729821..f2a76dc1ded8 100644
@@ -274,7 +274,7 @@ int misc_init_r(void)
 	else
 		cause = "POR";
 
-	env_set("bootcause", cause);
+	env_set(ctx_uboot, "bootcause", cause);
 
 	return 0;
 }
(quoted diff) +0 -0

b/board/grinn/chiliboard/board.c index c6d53600fa1c..933bdc779601 100644 --- a/board/grinn/chiliboard/board.c
+++ b/board/grinn/chiliboard/board.c

board/grinn/chiliboard/board.c +2 -2
@@ -117,7 +117,7 @@ int board_late_init(void)
 	mac_addr[4] = mac_lo & 0xFF;
 	mac_addr[5] = (mac_lo & 0xFF00) >> 8;
 
-	if (!env_get("ethaddr")) {
+	if (!env_get(ctx_uboot, "ethaddr")) {
 		printf("<ethaddr> not set. Validating first E-fuse
 MAC\n"); 
 		if (is_valid_ethaddr(mac_addr))
@@ -133,7 +133,7 @@ int board_late_init(void)
 	mac_addr[4] = mac_lo & 0xFF;
 	mac_addr[5] = (mac_lo & 0xFF00) >> 8;
 
-	if (!env_get("eth1addr")) {
+	if (!env_get(ctx_uboot, "eth1addr")) {
 		if (is_valid_ethaddr(mac_addr))
 			eth_env_set_enetaddr("eth1addr", mac_addr);
 	}
(quoted diff) +0 -0

b/board/grinn/liteboard/board.c index 1558ea4b84f5..53eabe2e4b3b 100644 --- a/board/grinn/liteboard/board.c
+++ b/board/grinn/liteboard/board.c

board/grinn/liteboard/board.c +3 -3
@@ -127,7 +127,7 @@ int board_mmc_init(bd_t *bis)
 
 static int check_mmc_autodetect(void)
 {
-	char *autodetect_str = env_get("mmcautodetect");
+	char *autodetect_str = env_get(ctx_uboot, "mmcautodetect");
 
 	if ((autodetect_str != NULL) &&
 	    (strcmp(autodetect_str, "yes") == 0)) {
@@ -146,12 +146,12 @@ void board_late_mmc_init(void)
 	if (!check_mmc_autodetect())
 		return;
 
-	env_set_ulong("mmcdev", dev_no);
+	env_set_ulong(ctx_uboot, "mmcdev", dev_no);
 
 	/* Set mmcblk env */
 	sprintf(mmcblk, "/dev/mmcblk%dp2 rootwait rw",
 		dev_no);
-	env_set("mmcroot", mmcblk);
+	env_set(ctx_uboot, "mmcroot", mmcblk);
 
 	sprintf(cmd, "mmc dev %d", dev_no);
 	run_command(cmd, 0);
board/highbank/highbank.c +5 -4
index 9563763dfa53..ef2f6f1f16a8 100644
@@ -80,11 +80,12 @@ int misc_init_r(void)
 
 	boot_choice = readl(HB_SREG_A9_BOOT_SRC_STAT) & 0xff;
 	sprintf(envbuffer, "bootcmd%d", boot_choice);
-	if (env_get(envbuffer)) {
+	if (env_get(ctx_uboot, envbuffer)) {
 		sprintf(envbuffer, "run bootcmd%d", boot_choice);
-		env_set("bootcmd", envbuffer);
-	} else
-		env_set("bootcmd", "");
+		env_set(ctx_uboot, "bootcmd", envbuffer);
+	} else {
+		env_set(ctx_uboot, "bootcmd", "");
+	}
 
 	return 0;
 }
(quoted diff) +0 -0

b/board/hisilicon/poplar/poplar.c index 4926419a905a..1177e91a688a 100644 --- a/board/hisilicon/poplar/poplar.c
+++ b/board/hisilicon/poplar/poplar.c

board/hisilicon/poplar/poplar.c +1 -1
@@ -177,7 +177,7 @@ int board_usb_init(int index, enum usb_init_type
 init) 
 int g_dnl_bind_fixup(struct usb_device_descriptor *dev, const char
 *name) {
-	if (!env_get("serial#"))
+	if (!env_get(ctx_uboot, "serial#"))
 		g_dnl_set_serialnumber("0123456789POPLAR");
 	return 0;
 }
board/imgtec/ci20/ci20.c +3 -3
index 5368b67b38b6..a34553a7bb3b 100644
@@ -181,12 +181,12 @@ int misc_init_r(void)
 	eth_env_set_enetaddr("ethaddr", otp.mac);
 
 	/* Put other board information into the environment */
-	env_set_ulong("serial#", otp.serial_number);
-	env_set_ulong("board_date", otp.date);
+	env_set_ulong(ctx_uboot, "serial#", otp.serial_number);
+	env_set_ulong(ctx_uboot, "board_date", otp.date);
 	manufacturer[0] = otp.manufacturer[0];
 	manufacturer[1] = otp.manufacturer[1];
 	manufacturer[2] = 0;
-	env_set("board_mfr", manufacturer);
+	env_set(ctx_uboot, "board_mfr", manufacturer);
 
 	return 0;
 }
board/intel/edison/edison.c +7 -7
index f56b5b1affef..2de8a4936286 100644
@@ -71,14 +71,14 @@ static void assign_serial(void)
 
 	snprintf(usb0addr, sizeof(usb0addr),
 "02:00:86:%02x:%02x:%02x", ssn[13], ssn[14], ssn[15]);
-	env_set("usb0addr", usb0addr);
+	env_set(ctx_uboot, "usb0addr", usb0addr);
 
 	for (i = 0; i < 16; i++)
 		snprintf(&serial[2 * i], 3, "%02x", ssn[i]);
-	env_set("serial#", serial);
+	env_set(ctx_uboot, "serial#", serial);
 
 #if defined(CONFIG_CMD_SAVEENV) && !defined(CONFIG_ENV_IS_NOWHERE)
-	env_save();
+	env_save(ctx_uboot);
 #endif
 }
 
@@ -93,19 +93,19 @@ static void assign_hardware_id(void)
 		printf("Can't retrieve hardware revision\n");
 
 	snprintf(hardware_id, sizeof(hardware_id), "%02X",
 v.hardware_id);
-	env_set("hardware_id", hardware_id);
+	env_set(ctx_uboot, "hardware_id", hardware_id);
 
 #if defined(CONFIG_CMD_SAVEENV) && !defined(CONFIG_ENV_IS_NOWHERE)
-	env_save();
+	env_save(ctx_uboot);
 #endif
 }
 
 int board_late_init(void)
 {
-	if (!env_get("serial#"))
+	if (!env_get(ctx_uboot, "serial#"))
 		assign_serial();
 
-	if (!env_get("hardware_id"))
+	if (!env_get(ctx_uboot, "hardware_id"))
 		assign_hardware_id();
 
board/intel/edison/edison.c +0 -0
 	return 0;
board/isee/igep003x/board.c +3 -3
index a8c2b121a476..56ecf3497245 100644
@@ -193,13 +193,13 @@ int board_late_init(void)
 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
 	switch (get_board_revision()) {
 		case 0:
-			env_set("board_name", "igep0034-lite");
+			env_set(ctx_uboot, "board_name",
 "igep0034-lite"); break;
 		case 1:
-			env_set("board_name", "igep0034");
+			env_set(ctx_uboot, "board_name", "igep0034");
 			break;
 		default:
-			env_set("board_name", "igep0033");
+			env_set(ctx_uboot, "board_name", "igep0033");
 			break;
 	}
 #endif
(quoted diff) +0 -0

b/board/isee/igep00x0/igep00x0.c index 74fc5f08900a..42476b2b657b 100644 --- a/board/isee/igep00x0/igep00x0.c
+++ b/board/isee/igep00x0/igep00x0.c

board/isee/igep00x0/igep00x0.c +2 -2
@@ -199,8 +199,8 @@ void set_boardname(void)
 	int i = get_board_revision();
 
 	rev[i+1] = 0;
-	env_set("board_rev", rev + i);
-	env_set("board_name", i < 2 ? "igep0020" : "igep0030");
+	env_set(ctx_uboot, "board_rev", rev + i);
+	env_set(ctx_uboot, "board_name", i < 2 ? "igep0020" :
 "igep0030"); }
 
 /*
(quoted diff) +0 -0

b/board/k+p/kp_imx53/kp_id_rev.c index 9dae54dda5fc..5c9258912c89 100644 --- a/board/k+p/kp_imx53/kp_id_rev.c
+++ b/board/k+p/kp_imx53/kp_id_rev.c

board/k+p/kp_imx53/kp_id_rev.c +10 -10
@@ -31,7 +31,7 @@ void show_eeprom(void)
 
 	if (!strncmp(safe_string, "TQM", 3)) {
 		printf("  ID: %s\n", safe_string);
-		env_set("boardtype", safe_string);
+		env_set(ctx_uboot, "boardtype", safe_string);
 	} else {
 		puts("  unknown hardware variant\n");
 	}
@@ -45,7 +45,7 @@ void show_eeprom(void)
 
 	if (strlen(safe_string) == 8) {
 		printf("  SN: %s\n", safe_string);
-		env_set("serial#", safe_string);
+		env_set(ctx_uboot, "serial#", safe_string);
 	} else {
 		puts("  unknown serial number\n");
 	}
@@ -103,18 +103,18 @@ int read_board_id(void)
 	sprintf(rev_str, "%02X", rev_id);
 	if (rev_id & 0x80) {
 		printf("BBoard:4x00 Rev:%s\n", rev_str);
-		env_set("boardtype", "ddc");
-		env_set("fit_config", "imx53_kb_conf");
+		env_set(ctx_uboot, "boardtype", "ddc");
+		env_set(ctx_uboot, "fit_config", "imx53_kb_conf");
 	} else {
 		printf("BBoard:40x0 Rev:%s\n", rev_str);
-		env_set("boardtype", "hsc");
-		env_set("fit_config", "imx53_kb_40x0_conf");
+		env_set(ctx_uboot, "boardtype", "hsc");
+		env_set(ctx_uboot, "fit_config",
 "imx53_kb_40x0_conf"); }
 
-	sprintf(buf, "kp-%s", env_get("boardtype"));
-	env_set("boardname", buf);
-	env_set("boardsoc", "imx53");
-	env_set("kb53_rev", rev_str);
+	sprintf(buf, "kp-%s", env_get(ctx_uboot, "boardtype"));
+	env_set(ctx_uboot, "boardname", buf);
+	env_set(ctx_uboot, "boardsoc", "imx53");
+	env_set(ctx_uboot, "kb53_rev", rev_str);
 
 	return 0;
 }
(quoted diff) +0 -0

b/board/k+p/kp_imx53/kp_imx53.c index 84cddd489490..36b9b9377f03 100644 --- a/board/k+p/kp_imx53/kp_imx53.c
+++ b/board/k+p/kp_imx53/kp_imx53.c

board/k+p/kp_imx53/kp_imx53.c +2 -2
@@ -124,9 +124,9 @@ void board_misc_setup(void)
 	gpio_direction_input(KEY1);
 
 	if (gpio_get_value(KEY1))
-		env_set("key1", "off");
+		env_set(ctx_uboot, "key1", "off");
 	else
-		env_set("key1", "on");
+		env_set(ctx_uboot, "key1", "on");
 }
 
 int board_late_init(void)
(quoted diff) +0 -0

b/board/k+p/kp_imx6q_tpc/kp_imx6q_tpc.c index 2c541ace0210..9536ae2171d2 100644 --- a/board/k+p/kp_imx6q_tpc/kp_imx6q_tpc.c +++ b/board/k+p/kp_imx6q_tpc/kp_imx6q_tpc.c @@ -290,8 +290,8 @@ int board_late_init(void) add_board_boot_modes(board_boot_modes);
#endif

board/k+p/kp_imx6q_tpc/kp_imx6q_tpc.c +2 -2
-	env_set("boardname", "kp-tpc");
-	env_set("boardsoc", "imx6q");
+	env_set(ctx_uboot, "boardname", "kp-tpc");
+	env_set(ctx_uboot, "boardsoc", "imx6q");
 	return 0;
 }
(quoted diff) +0 -0

b/board/keymile/common/common.c index 08f7f8d88451..3e15a063b34a 100644 --- a/board/keymile/common/common.c
+++ b/board/keymile/common/common.c

(quoted diff) +0 -0
@@ -51,24 +51,24 @@ int set_km_env(void)
 	pnvramaddr = gd->ram_size - CONFIG_KM_RESERVED_PRAM -

CONFIG_KM_PHRAM

board/keymile/common/common.c +2 -2
 			- CONFIG_KM_PNVRAM;
 	sprintf((char *)buf, "0x%x", pnvramaddr);
-	env_set("pnvramaddr", (char *)buf);
+	env_set(ctx_uboot, "pnvramaddr", (char *)buf);
 
 	/* try to read rootfssize (ram image) from environment */
-	p = env_get("rootfssize");
+	p = env_get(ctx_uboot, "rootfssize");
 	if (p != NULL)
 		strict_strtoul(p, 16, &rootfssize);
 	pram = (rootfssize + CONFIG_KM_RESERVED_PRAM +

CONFIG_KM_PHRAM + CONFIG_KM_PNVRAM) / 0x400;

board/keymile/common/common.c +1 -1
 	sprintf((char *)buf, "0x%x", pram);
-	env_set("pram", (char *)buf);
+	env_set(ctx_uboot, "pram", (char *)buf);
 
 	varaddr = gd->ram_size - CONFIG_KM_RESERVED_PRAM -

CONFIG_KM_PHRAM; sprintf((char *)buf, "0x%x", varaddr);

board/keymile/common/common.c +6 -6
-	env_set("varaddr", (char *)buf);
+	env_set(ctx_uboot, "varaddr", (char *)buf);
 
 	kernelmem = gd->ram_size - 0x400 * pram;
 	sprintf((char *)buf, "0x%x", kernelmem);
-	env_set("kernelmem", (char *)buf);
+	env_set(ctx_uboot, "kernelmem", (char *)buf);
 
 	return 0;
 }
@@ -169,7 +169,7 @@ static int do_setboardid(cmd_tbl_t *cmdtp, int
 flag, int argc, return 1;
 	}
 	strcpy((char *)buf, p);
-	env_set("boardid", (char *)buf);
+	env_set(ctx_uboot, "boardid", (char *)buf);
 	printf("set boardid=%s\n", buf);
 
 	p = get_local_var("IVM_HWKey");
@@ -178,7 +178,7 @@ static int do_setboardid(cmd_tbl_t *cmdtp, int
 flag, int argc, return 1;
 	}
 	strcpy((char *)buf, p);
-	env_set("hwkey", (char *)buf);
+	env_set(ctx_uboot, "hwkey", (char *)buf);
 	printf("set hwkey=%s\n", buf);
 	printf("Execute manually saveenv for persistent storage.\n");
 
@@ -236,10 +236,10 @@ static int do_checkboardidhwk(cmd_tbl_t *cmdtp,
 int flag, int argc, }
 
 	/* now try to read values from environment if available */
-	p = env_get("boardid");
+	p = env_get(ctx_uboot, "boardid");
 	if (p != NULL)
 		rc = strict_strtoul(p, 16, &envbid);
-	p = env_get("hwkey");
+	p = env_get(ctx_uboot, "hwkey");
 	if (p != NULL)
 		rc = strict_strtoul(p, 16, &envhwkey);
 
@@ -253,7 +253,7 @@ static int do_checkboardidhwk(cmd_tbl_t *cmdtp,
 int flag, int argc,
 		 * BoardId/HWkey not available in the environment,

so try the

board/keymile/common/common.c +1 -1
 		 * environment variable for BoardId/HWkey list
 		 */
-		char *bidhwklist = env_get("boardIdListHex");
+		char *bidhwklist = env_get(ctx_uboot,

"boardIdListHex");

board/keymile/common/common.c +3 -3
 		if (bidhwklist) {
 			int found = 0;
@@ -311,9 +311,9 @@ static int do_checkboardidhwk(cmd_tbl_t *cmdtp,
 int flag, int argc, envbid   = bid;
 					envhwkey = hwkey;
 					sprintf(buf, "%lx", bid);
-					env_set("boardid", buf);
+					env_set(ctx_uboot,
 "boardid", buf); sprintf(buf, "%lx", hwkey);
-					env_set("hwkey", buf);
+					env_set(ctx_uboot, "hwkey",
 buf); }
 			} /* end while( ! found ) */
 		}
@@ -355,7 +355,7 @@ static int do_checktestboot(cmd_tbl_t *cmdtp, int
 flag, int argc, #if defined(CONFIG_POST)
 	testpin = post_hotkeys_pressed();
 #endif
-	s = env_get("test_bank");
+	s = env_get(ctx_uboot, "test_bank");
 	/* when test_bank is not set, act as if testpin is not
 asserted */ testboot = (testpin != 0) && (s);
 	if (verbose) {
board/keymile/common/ivm.c +1 -1
index 50df44d1c110..d255a34ae677 100644
@@ -261,7 +261,7 @@ int ivm_analyze_eeprom(unsigned char *buf, int
 len) 
 	GET_STRING("IVM_Symbol", IVM_POS_SYMBOL_ONLY, 8)
 	GET_STRING("IVM_DeviceName", IVM_POS_SHORT_TEXT, 64)
-	tmp = (unsigned char *)env_get("IVM_DeviceName");
+	tmp = (unsigned char *)env_get(ctx_uboot, "IVM_DeviceName");
 	if (tmp) {
 		int	len = strlen((char *)tmp);
 		int	i = 0;
@@ -310,16 +310,16 @@ static int ivm_populate_env(unsigned char *buf,

int len) #ifndef CONFIG_KMTEGR1

board/keymile/common/ivm.c +0 -0
 	/* if an offset is defined, add it */
 	process_mac(valbuf, page2, CONFIG_PIGGY_MAC_ADRESS_OFFSET,

true);

board/keymile/common/ivm.c +1 -1
-	env_set((char *)"ethaddr", (char *)valbuf);
+	env_set(ctx_uboot, (char *)"ethaddr", (char *)valbuf);
 #else
 /* KMTEGR1 has a special setup. eth0 has no connection to the

outside and
* gets an locally administred MAC address, eth1 is the debug
interface and
* gets the official MAC address from the IVM
*/
process_mac(valbuf, page2, CONFIG_PIGGY_MAC_ADRESS_OFFSET,
false);

board/keymile/common/ivm.c +1 -1
-	env_set((char *)"ethaddr", (char *)valbuf);
+	env_set(ctx_uboot, (char *)"ethaddr", (char *)valbuf);
 	process_mac(valbuf, page2, CONFIG_PIGGY_MAC_ADRESS_OFFSET,

true);

board/keymile/common/ivm.c +1 -1
-	env_set((char *)"eth1addr", (char *)valbuf);
+	env_set(ctx_uboot, (char *)"eth1addr", (char *)valbuf);
 #endif
 
 	return 0;
(quoted diff) +0 -0

b/board/keymile/km83xx/km83xx.c index 8846b64f7d79..68a1ddb886b9 100644 --- a/board/keymile/km83xx/km83xx.c
+++ b/board/keymile/km83xx/km83xx.c

board/keymile/km83xx/km83xx.c +1 -1
@@ -199,7 +199,7 @@ int last_stage_init(void)
 	if (dip_switch != 0) {
 		/* start bootloader */
 		puts("DIP:   Enabled\n");
-		env_set("actual_bank", "0");
+		env_set(ctx_uboot, "actual_bank", "0");
 	}
 #endif
 	set_km_env();
(quoted diff) +0 -0

b/board/keymile/km_arm/km_arm.c index 922cc621f780..0c2ede5231bb 100644 --- a/board/keymile/km_arm/km_arm.c
+++ b/board/keymile/km_arm/km_arm.c

board/keymile/km_arm/km_arm.c +3 -3
@@ -193,7 +193,7 @@ static void set_bootcount_addr(void)
 	unsigned int bootcountaddr;
 	bootcountaddr = gd->ram_size - BOOTCOUNT_ADDR;
 	sprintf((char *)buf, "0x%x", bootcountaddr);
-	env_set("bootcountaddr", (char *)buf);
+	env_set(ctx_uboot, "bootcountaddr", (char *)buf);
 }
 
 int misc_init_r(void)
@@ -201,7 +201,7 @@ int misc_init_r(void)
 #if defined(CONFIG_KM_MGCOGE3UN)
 	char *wait_for_ne;
 	u8 dip_switch = kw_gpio_get_value(KM_FLASH_ERASE_ENABLE);
-	wait_for_ne = env_get("waitforne");
+	wait_for_ne = env_get(ctx_uboot, "waitforne");
 
 	if ((wait_for_ne != NULL) && (dip_switch == 0)) {
 		if (strcmp(wait_for_ne, "true") == 0) {
@@ -299,7 +299,7 @@ int board_late_init(void)
 	if (dip_switch != 0) {
 		/* start bootloader */
 		puts("DIP:   Enabled\n");
-		env_set("actual_bank", "0");
+		env_set(ctx_uboot, "actual_bank", "0");
 	}
 #endif
 
(quoted diff) +0 -0

b/board/keymile/kmp204x/kmp204x.c index 4d1e38aa3a7a..f4901f6bed9d 100644 --- a/board/keymile/kmp204x/kmp204x.c
+++ b/board/keymile/kmp204x/kmp204x.c

board/keymile/km83xx/km83xx.c +2 -2
@@ -220,7 +220,7 @@ int last_stage_init(void)
 	if (dip_switch != 0) {
 		/* start bootloader */
 		puts("DIP:   Enabled\n");
-		env_set("actual_bank", "0");
+		env_set(ctx_uboot, "actual_bank", "0");
 	}
 #endif
 	set_km_env();
@@ -237,7 +237,7 @@ void fdt_fixup_fman_mac_addresses(void *blob)
 	unsigned char mac_addr[6];
 
 	/* get the mac addr from env */
-	tmp = env_get("ethaddr");
+	tmp = env_get(ctx_uboot, "ethaddr");
 	if (!tmp) {
 		printf("ethaddr env variable not defined\n");
 		return;
(quoted diff) +0 -0

b/board/kosagi/novena/novena.c index b7b747d19658..968d455b45c6 100644

board/kosagi/novena/novena.c +1 -1
@@ -201,7 +201,7 @@ int misc_init_r(void)
 	int ret;
 
 	/* If 'ethaddr' is already set, do nothing. */
-	if (env_get("ethaddr"))
+	if (env_get(ctx_uboot, "ethaddr"))
 		return 0;
 
 	/* EEPROM is at bus 2. */
board/laird/wb50n/wb50n.c +1 -1
index a2f8eaf0ba34..cc7cd3cf7250 100644
@@ -122,7 +122,7 @@ int board_late_init(void)
 	for (p = name; *p != '\0'; *p = tolower(*p), p++)
 		;
 	strcat(name, "-wb50n");
-	env_set(LAIRD_NAME, name);
+	env_set(ctx_uboot, LAIRD_NAME, name);
 
 #endif
 
board/lg/sniper/sniper.c +2 -2
index b4205d6ed4c1..0dff96ef02aa 100644
@@ -133,8 +133,8 @@ int misc_init_r(void)
 	}
 
 	if (reboot_mode[0] > 0 && isascii(reboot_mode[0])) {
-		if (!env_get("reboot-mode"))
-			env_set("reboot-mode", (char *)reboot_mode);
+		if (!env_get(ctx_uboot, "reboot-mode"))
+			env_set(ctx_uboot, "reboot-mode", (char
 *)reboot_mode); }
 
 	omap_reboot_mode_clear();
(quoted diff) +0 -0

b/board/liebherr/display5/spl.c index 354b63e431f6..6ce1554e044d 100644 --- a/board/liebherr/display5/spl.c
+++ b/board/liebherr/display5/spl.c

board/liebherr/display5/spl.c +2 -2
@@ -284,10 +284,10 @@ void board_boot_order(u32 *spl_boot_list)
 	/* 'fastboot' */
 	const char *s;
 
-	if (env_init() || env_load())
+	if (env_init() || env_load(ctx_uboot))
 		return;
 
-	s = env_get("BOOT_FROM");
+	s = env_get(ctx_uboot, "BOOT_FROM");
 	if (s && !bootcount_error() && strcmp(s, "ACTIVE") == 0) {
 		spl_boot_list[0] = BOOT_DEVICE_MMC1;
 		spl_boot_list[1] = spl_boot_device();
(quoted diff) +0 -0

b/board/liebherr/mccmon6/mccmon6.c index 7d2751ab0393..6164317e607c 100644 --- a/board/liebherr/mccmon6/mccmon6.c
+++ b/board/liebherr/mccmon6/mccmon6.c

board/liebherr/mccmon6/mccmon6.c +3 -3
@@ -367,7 +367,7 @@ int board_init(void)
 
 int board_late_init(void)
 {
-	env_set("board_name", "mccmon6");
+	env_set(ctx_uboot, "board_name", "mccmon6");
 
 	return 0;
 }
@@ -467,7 +467,7 @@ int spl_start_uboot(void)
 		return 1;
 
 	env_init();
-	ret = env_get_f("boot_os", s, sizeof(s));
+	ret = env_get_f("boot_os", s, sizeof(ctx_uboot, s));
 	if ((ret != -1) && (strcmp(s, "no") == 0))
 		return 1;
 
@@ -481,7 +481,7 @@ int spl_start_uboot(void)
 	 * recovery_status = <any value> -> start SWUpdate
 	 *
 	 */
-	ret = env_get_f("recovery_status", s, sizeof(s));
+	ret = env_get_f("recovery_status", s, sizeof(ctx_uboot, s));
 	if (ret != -1)
 		return 1;
 
(quoted diff) +0 -0

b/board/logicpd/imx6/imx6logic.c index 7a59b89d94a2..204a92761459 100644 --- a/board/logicpd/imx6/imx6logic.c
+++ b/board/logicpd/imx6/imx6logic.c

board/logicpd/imx6/imx6logic.c +4 -4
@@ -149,12 +149,12 @@ int board_init(void)
 
 int board_late_init(void)
 {
-	env_set("board_name", "imx6logic");
+	env_set(ctx_uboot, "board_name", "imx6logic");
 
 	if (is_mx6dq()) {
-		env_set("board_rev", "MX6DQ");
-		if (!env_get("fdt_file"))
-			env_set("fdt_file", "imx6q-logicpd.dtb");
+		env_set(ctx_uboot, "board_rev", "MX6DQ");
+		if (!env_get(ctx_uboot, "fdt_file"))
+			env_set(ctx_uboot, "fdt_file",
 "imx6q-logicpd.dtb"); }
 
 	return 0;
(quoted diff) +0 -0

b/board/menlo/m53menlo/m53menlo.c index bda5f0df5bce..f84e0f7d5928 100644 --- a/board/menlo/m53menlo/m53menlo.c
+++ b/board/menlo/m53menlo/m53menlo.c

board/menlo/m53menlo/m53menlo.c +1 -1
@@ -339,7 +339,7 @@ int board_late_init(void)
 
 	splash_get_pos(&xpos, &ypos);
 
-	s = env_get("splashimage");
+	s = env_get(ctx_uboot, "splashimage");
 	if (!s)
 		return 0;
 
board/micronas/vct/vct.c +1 -1
index e73d16db3eaf..6ae3dceaef87 100644
@@ -72,7 +72,7 @@ int dram_init(void)
 int checkboard(void)
 {
 	char buf[64];
-	int i = env_get_f("serial#", buf, sizeof(buf));
+	int i = env_get_f("serial#", buf, sizeof(ctx_uboot, buf));
 	u32 config0 = read_c0_prid();
 
 	if ((config0 & 0xff0000) == PRID_COMP_LEGACY
board/nokia/rx51/rx51.c +4 -4
index 71ca79deab7f..ca486eab1e29 100644
@@ -234,18 +234,18 @@ void setup_board_tags(struct tag **in_params)
 	params->u.core.rootdev = 0x0;
 
 	/* append omap atag only if env setup_omap_atag is set to 1
 */
-	str = env_get("setup_omap_atag");
+	str = env_get(ctx_uboot, "setup_omap_atag");
 	if (!str || str[0] != '1')
 		return;
 
-	str = env_get("setup_console_atag");
+	str = env_get(ctx_uboot, "setup_console_atag");
 	if (str && str[0] == '1')
 		setup_console_atag = 1;
 	else
 		setup_console_atag = 0;
 
-	setup_boot_reason_atag = env_get("setup_boot_reason_atag");
-	setup_boot_mode_atag = env_get("setup_boot_mode_atag");
+	setup_boot_reason_atag = env_get(ctx_uboot,
 "setup_boot_reason_atag");
+	setup_boot_mode_atag = env_get(ctx_uboot,
 "setup_boot_mode_atag"); 
board/nokia/rx51/rx51.c +1 -1
 	params = *in_params;
 	t = (struct tag_omap *)&params->u;
@@ -413,7 +413,7 @@ int misc_init_r(void)
 
 	/* set env variable attkernaddr for relocated kernel */
 	sprintf(buf, "%#x", KERNEL_ADDRESS);
-	env_set("attkernaddr", buf);
+	env_set(ctx_uboot, "attkernaddr", buf);
 
 	/* initialize omap tags */
 	init_omap_tags();
board/overo/overo.c +11 -11
index 442028a764c7..f0b230eabb13 100644
@@ -170,47 +170,47 @@ int misc_init_r(void)
 			expansion_config.revision,
 			expansion_config.fab_revision);
 		MUX_GUMSTIX();
-		env_set("defaultdisplay", "dvi");
-		env_set("expansionname", "summit");
+		env_set(ctx_uboot, "defaultdisplay", "dvi");
+		env_set(ctx_uboot, "expansionname", "summit");
 		break;
 	case GUMSTIX_TOBI:
 		printf("Recognized Tobi expansion board (rev %d
 %s)\n", expansion_config.revision,
 			expansion_config.fab_revision);
 		MUX_GUMSTIX();
-		env_set("defaultdisplay", "dvi");
-		env_set("expansionname", "tobi");
+		env_set(ctx_uboot, "defaultdisplay", "dvi");
+		env_set(ctx_uboot, "expansionname", "tobi");
 		break;
 	case GUMSTIX_TOBI_DUO:
 		printf("Recognized Tobi Duo expansion board (rev %d
 %s)\n", expansion_config.revision,
 			expansion_config.fab_revision);
 		MUX_GUMSTIX();
-		env_set("expansionname", "tobiduo");
+		env_set(ctx_uboot, "expansionname", "tobiduo");
 		break;
 	case GUMSTIX_PALO35:
 		printf("Recognized Palo35 expansion board (rev %d
 %s)\n", expansion_config.revision,
 			expansion_config.fab_revision);
 		MUX_GUMSTIX();
-		env_set("defaultdisplay", "lcd35");
-		env_set("expansionname", "palo35");
+		env_set(ctx_uboot, "defaultdisplay", "lcd35");
+		env_set(ctx_uboot, "expansionname", "palo35");
 		break;
 	case GUMSTIX_PALO43:
 		printf("Recognized Palo43 expansion board (rev %d
 %s)\n", expansion_config.revision,
 			expansion_config.fab_revision);
 		MUX_GUMSTIX();
-		env_set("defaultdisplay", "lcd43");
-		env_set("expansionname", "palo43");
+		env_set(ctx_uboot, "defaultdisplay", "lcd43");
+		env_set(ctx_uboot, "expansionname", "palo43");
 		break;
 	case GUMSTIX_CHESTNUT43:
 		printf("Recognized Chestnut43 expansion board (rev
 %d %s)\n", expansion_config.revision,
 			expansion_config.fab_revision);
 		MUX_GUMSTIX();
-		env_set("defaultdisplay", "lcd43");
-		env_set("expansionname", "chestnut43");
+		env_set(ctx_uboot, "defaultdisplay", "lcd43");
+		env_set(ctx_uboot, "expansionname", "chestnut43");
 		break;
 	case GUMSTIX_PINTO:
 		printf("Recognized Pinto expansion board (rev %d

%s)\n", @@ -223,8 +223,8 @@ int misc_init_r(void)

board/overo/overo.c +2 -2
 			expansion_config.revision,
 			expansion_config.fab_revision);
 		MUX_GUMSTIX();
-		env_set("defaultdisplay", "lcd43");
-		env_set("expansionname", "gallop43");
+		env_set(ctx_uboot, "defaultdisplay", "lcd43");
+		env_set(ctx_uboot, "expansionname", "gallop43");
 		break;
 	case GUMSTIX_ALTO35:
 		printf("Recognized Alto35 expansion board (rev %d

%s)\n", @@ -232,8 +232,8 @@ int misc_init_r(void)

board/overo/overo.c +2 -2
 			expansion_config.fab_revision);
 		MUX_GUMSTIX();
 		MUX_ALTO35();
-		env_set("defaultdisplay", "lcd35");
-		env_set("expansionname", "alto35");
+		env_set(ctx_uboot, "defaultdisplay", "lcd35");
+		env_set(ctx_uboot, "expansionname", "alto35");
 		break;
 	case GUMSTIX_STAGECOACH:
 		printf("Recognized Stagecoach expansion board (rev

%d %s)\n", @@ -259,8 +259,8 @@ int misc_init_r(void)

board/overo/overo.c +2 -2
 			expansion_config.fab_revision);
 		MUX_GUMSTIX();
 		MUX_ARBOR43C();
-		env_set("defaultdisplay", "lcd43");
-		env_set("expansionname", "arbor43c");
+		env_set(ctx_uboot, "defaultdisplay", "lcd43");
+		env_set(ctx_uboot, "expansionname", "arbor43c");
 		break;
 	case ETTUS_USRP_E:
 		printf("Recognized Ettus Research USRP-E (rev %d

%s)\n", @@ -268,13 +268,13 @@ int misc_init_r(void)

board/overo/overo.c +2 -2
 			expansion_config.fab_revision);
 		MUX_GUMSTIX();
 		MUX_USRP_E();
-		env_set("defaultdisplay", "dvi");
+		env_set(ctx_uboot, "defaultdisplay", "dvi");
 		break;
 	case GUMSTIX_NO_EEPROM:
 	case GUMSTIX_EMPTY_EEPROM:
 		puts("No or empty EEPROM on expansion board\n");
 		MUX_GUMSTIX();
-		env_set("expansionname", "tobi");
+		env_set(ctx_uboot, "expansionname", "tobi");
 		break;
 	default:
 		printf("Unrecognized expansion board 0x%08x\n",

expansion_id); @@ -282,14 +282,15 @@ int misc_init_r(void)

board/overo/overo.c +0 -1
 	}
 
 	if (expansion_config.content == 1)
-		env_set(expansion_config.env_var,

expansion_config.env_setting);

board/overo/overo.c +4 -2
+		env_set(ctx_uboot, expansion_config.env_var,
+			expansion_config.env_setting);
 
 	omap_die_id_display();
 
 	if (get_cpu_family() == CPU_OMAP34XX)
-		env_set("boardname", "overo");
+		env_set(ctx_uboot, "boardname", "overo");
 	else
-		env_set("boardname", "overo-storm");
+		env_set(ctx_uboot, "boardname", "overo-storm");
 
 	return 0;
 }
(quoted diff) +0 -0

b/board/phytec/pcm052/pcm052.c index e1ebe8e75d00..f66bacfb2172 100644

board/phytec/pcm052/pcm052.c +2 -2
@@ -376,8 +376,8 @@ int board_late_init(void)
 	if ((reg & SRC_SBMR1_BOOTCFG1_SDMMC) &&
 	    !(reg & SRC_SBMR1_BOOTCFG1_MMC)) {
 		printf("------ SD card boot -------\n");
-		env_set_default("!LVFBootloader", 0);
-		env_set("bootcmd",
+		env_set_default(ctx_uboot, "!LVFBootloader", 0);
+		env_set(ctx_uboot, "bootcmd",
 			"run prepare_install_bk4r1_envs; run
 install_bk4r1rs"); }
 
(quoted diff) +0 -0

b/board/phytec/pfla02/pfla02.c index ae9ffe0390c3..bbcd8cf934d3 100644

board/phytec/pfla02/pfla02.c +1 -1
@@ -392,7 +392,7 @@ int board_late_init(void)
 #endif
 
 	snprintf(buf, sizeof(buf), "%d", get_board_rev());
-	env_set("board_rev", buf);
+	env_set(ctx_uboot, "board_rev", buf);
 
 	return 0;
 }
(quoted diff) +0 -0

b/board/qualcomm/dragonboard410c/dragonboard410c.c index d7f0f93fb109..bdf6e13ad06f 100644 --- a/board/qualcomm/dragonboard410c/dragonboard410c.c +++ b/board/qualcomm/dragonboard410c/dragonboard410c.c @@ -139,8 +139,8 @@ int misc_init_r(void) }

board/qualcomm/dragonboard410c/dragonboard410c.c +2 -2
 	if (dm_gpio_get_value(&resin)) {
-		env_set("bootdelay", "-1");
-		env_set("bootcmd", "fastboot 0");
+		env_set(ctx_uboot, "bootdelay", "-1");
+		env_set(ctx_uboot, "bootcmd", "fastboot 0");
 		printf("key_vol_down pressed - Starting

fastboot.\n"); }

board/qualcomm/dragonboard410c/dragonboard410c.c +1 -1
@@ -158,7 +158,7 @@ int board_late_init(void)
 
 	memset(serial, 0, 16);
 	snprintf(serial, 13, "%x", msm_board_serial());
-	env_set("serial#", serial);
+	env_set(ctx_uboot, "serial#", serial);
 	return 0;
 }
 
(quoted diff) +0 -0

b/board/qualcomm/dragonboard820c/dragonboard820c.c index 7a889646df8d..475e1aa64560 100644 --- a/board/qualcomm/dragonboard820c/dragonboard820c.c +++ b/board/qualcomm/dragonboard820c/dragonboard820c.c @@ -155,7 +155,7 @@ int misc_init_r(void) }

board/qualcomm/dragonboard410c/dragonboard410c.c +1 -1
 	if (dm_gpio_get_value(&resin)) {
-		env_set("bootdelay", "-1");
+		env_set(ctx_uboot, "bootdelay", "-1");
 		printf("Power button pressed - dropping to

console.\n"); }

board/raspberrypi/rpi/rpi.c +13 -13
index 7a6ca8f759e6..5d4d59fd25ca 100644
@@ -290,11 +290,11 @@ static void set_fdtfile(void)
 {
 	const char *fdtfile;
 
-	if (env_get("fdtfile"))
+	if (env_get(ctx_uboot, "fdtfile"))
 		return;
 
 	fdtfile = model->fdtfile;
-	env_set("fdtfile", fdtfile);
+	env_set(ctx_uboot, "fdtfile", fdtfile);
 }
 
 /*
@@ -303,13 +303,13 @@ static void set_fdtfile(void)
  */
 static void set_fdt_addr(void)
 {
-	if (env_get("fdt_addr"))
+	if (env_get(ctx_uboot, "fdt_addr"))
 		return;
 
 	if (fdt_magic(fw_dtb_pointer) != FDT_MAGIC)
 		return;
 
-	env_set_hex("fdt_addr", fw_dtb_pointer);
+	env_set_hex(ctx_uboot, "fdt_addr", fw_dtb_pointer);
 }
 
 /*
@@ -330,7 +330,7 @@ static void set_usbethaddr(void)
 	if (!model->has_onboard_eth)
 		return;
 
-	if (env_get("usbethaddr"))
+	if (env_get(ctx_uboot, "usbethaddr"))
 		return;
 
 	BCM2835_MBOX_INIT_HDR(msg);
@@ -345,8 +345,8 @@ static void set_usbethaddr(void)
 
 	eth_env_set_enetaddr("usbethaddr",
 msg->get_mac_address.body.resp.mac); 
-	if (!env_get("ethaddr"))
-		env_set("ethaddr", env_get("usbethaddr"));
+	if (!env_get(ctx_uboot, "ethaddr"))
+		env_set(ctx_uboot, "ethaddr", env_get("usbethaddr"));
 
 	return;
 }
@@ -357,13 +357,13 @@ static void set_board_info(void)
 	char s[11];
 
 	snprintf(s, sizeof(s), "0x%X", revision);
-	env_set("board_revision", s);
+	env_set(ctx_uboot, "board_revision", s);
 	snprintf(s, sizeof(s), "%d", rev_scheme);
-	env_set("board_rev_scheme", s);
+	env_set(ctx_uboot, "board_rev_scheme", s);
 	/* Can't rename this to board_rev_type since it's an ABI for
 scripts */ snprintf(s, sizeof(s), "0x%X", rev_type);
-	env_set("board_rev", s);
-	env_set("board_name", model->name);
+	env_set(ctx_uboot, "board_rev", s);
+	env_set(ctx_uboot, "board_name", model->name);
 }
 #endif /* CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG */
 
@@ -373,7 +373,7 @@ static void set_serial_number(void)
 	int ret;
 	char serial_string[17] = { 0 };
 
-	if (env_get("serial#"))
+	if (env_get(ctx_uboot, "serial#"))
 		return;
 
 	BCM2835_MBOX_INIT_HDR(msg);
@@ -388,7 +388,7 @@ static void set_serial_number(void)
 
 	snprintf(serial_string, sizeof(serial_string), "%016llx",
 		 msg->get_board_serial.body.resp.serial);
-	env_set("serial#", serial_string);
+	env_set(ctx_uboot, "serial#", serial_string);
 }
 
 int misc_init_r(void)
board/renesas/alt/alt.c +2 -1
index 10ef7f931b1f..bc94a22e9603 100644
@@ -128,7 +128,8 @@ void reset_cpu(ulong addr)
 		hang();
 }
 
-enum env_location env_get_location(enum env_operation op, int prio)
+enum env_location env_get_location(struct env_context *ctx,
+				   enum env_operation op, int prio)
 {
 	const u32 load_magic = 0xb33fc0de;
 
board/renesas/gose/gose.c +2 -1
index f86c9f1a6350..d3ec352e2a03 100644
@@ -134,7 +134,8 @@ void reset_cpu(ulong addr)
 		hang();
 }
 
-enum env_location env_get_location(enum env_operation op, int prio)
+enum env_location env_get_location(struct env_context *ctx,
+				   enum env_operation op, int prio)
 {
 	const u32 load_magic = 0xb33fc0de;
 
(quoted diff) +0 -0

b/board/renesas/koelsch/koelsch.c index 841d337f4d3c..871308e405d3 100644 --- a/board/renesas/koelsch/koelsch.c
+++ b/board/renesas/koelsch/koelsch.c

board/renesas/alt/alt.c +2 -1
@@ -136,7 +136,8 @@ void reset_cpu(ulong addr)
 		hang();
 }
 
-enum env_location env_get_location(enum env_operation op, int prio)
+enum env_location env_get_location(struct env_context *ctx,
+				   enum env_operation op, int prio)
 {
 	const u32 load_magic = 0xb33fc0de;
 
board/renesas/lager/lager.c +2 -1
index 3cb1a56142a9..6867ae5c4008 100644
@@ -145,7 +145,8 @@ void reset_cpu(ulong addr)
 		hang();
 }
 
-enum env_location env_get_location(enum env_operation op, int prio)
+enum env_location env_get_location(struct env_context *ctx,
+				   enum env_operation op, int prio)
 {
 	const u32 load_magic = 0xb33fc0de;
 
(quoted diff) +0 -0

b/board/renesas/porter/porter.c index 86f79da7fdb4..3dc9310e0fc4 100644 --- a/board/renesas/porter/porter.c
+++ b/board/renesas/porter/porter.c

board/renesas/alt/alt.c +2 -1
@@ -134,7 +134,8 @@ void reset_cpu(ulong addr)
 		hang();
 }
 
-enum env_location env_get_location(enum env_operation op, int prio)
+enum env_location env_get_location(struct env_context *ctx,
+				   enum env_operation op, int prio)
 {
 	const u32 load_magic = 0xb33fc0de;
 
(quoted diff) +0 -0

b/board/renesas/sh7752evb/sh7752evb.c index d0b850f35d49..540ec9bfd019 100644 --- a/board/renesas/sh7752evb/sh7752evb.c +++ b/board/renesas/sh7752evb/sh7752evb.c @@ -223,10 +223,10 @@ static void init_ethernet_mac(void) for (i = 0; i < SH7752EVB_ETHERNET_NUM_CH; i++) { get_sh_eth_mac(i, mac_string, buf);

board/renesas/sh7752evb/sh7752evb.c +2 -2
 		if (i == 0)
-			env_set("ethaddr", mac_string);
+			env_set(ctx_uboot, "ethaddr", mac_string);
 		else {
 			sprintf(env_string, "eth%daddr", i);
-			env_set(env_string, mac_string);
+			env_set(ctx_uboot, env_string, mac_string);
 		}
 		set_mac_to_sh_giga_eth_register(i, mac_string);
 	}
(quoted diff) +0 -0

b/board/renesas/sh7753evb/sh7753evb.c index e1bed7dcc371..3ec2591cb7ed 100644 --- a/board/renesas/sh7753evb/sh7753evb.c +++ b/board/renesas/sh7753evb/sh7753evb.c @@ -239,10 +239,10 @@ static void init_ethernet_mac(void) for (i = 0; i < SH7753EVB_ETHERNET_NUM_CH; i++) { get_sh_eth_mac(i, mac_string, buf);

board/renesas/sh7752evb/sh7752evb.c +2 -2
 		if (i == 0)
-			env_set("ethaddr", mac_string);
+			env_set(ctx_uboot, "ethaddr", mac_string);
 		else {
 			sprintf(env_string, "eth%daddr", i);
-			env_set(env_string, mac_string);
+			env_set(ctx_uboot, env_string, mac_string);
 		}
 		set_mac_to_sh_giga_eth_register(i, mac_string);
 	}
(quoted diff) +0 -0

b/board/renesas/sh7757lcr/sh7757lcr.c index d2671202e981..4b06387d5f22 100644 --- a/board/renesas/sh7757lcr/sh7757lcr.c +++ b/board/renesas/sh7757lcr/sh7757lcr.c @@ -285,10 +285,10 @@ static void init_ethernet_mac(void) for (i = 0; i < SH7757LCR_ETHERNET_NUM_CH; i++) { get_sh_eth_mac(i, mac_string, buf);

board/renesas/sh7757lcr/sh7757lcr.c +2 -2
 		if (i == 0)
-			env_set("ethaddr", mac_string);
+			env_set(ctx_uboot, "ethaddr", mac_string);
 		else {
 			sprintf(env_string, "eth%daddr", i);
-			env_set(env_string, mac_string);
+			env_set(ctx_uboot, env_string, mac_string);
 		}
 
 		set_mac_to_sh_eth_register(i, mac_string);
@@ -298,7 +298,7 @@ static void init_ethernet_mac(void)
 	for (i = 0; i < SH7757LCR_GIGA_ETHERNET_NUM_CH; i++) {
 		get_sh_eth_mac(i + SH7757LCR_ETHERNET_NUM_CH,

mac_string, buf); sprintf(env_string, "eth%daddr", i + SH7757LCR_ETHERNET_NUM_CH);

board/renesas/sh7757lcr/sh7757lcr.c +1 -1
-		env_set(env_string, mac_string);
+		env_set(ctx_uboot, env_string, mac_string);
 
 		set_mac_to_sh_giga_eth_register(i, mac_string);
 	}
board/renesas/silk/silk.c +2 -1
index 25221e3c55cc..946232e3ba7b 100644
@@ -129,7 +129,8 @@ void reset_cpu(ulong addr)
 		hang();
 }
 
-enum env_location env_get_location(enum env_operation op, int prio)
+enum env_location env_get_location(struct env_context *ctx,
+				   enum env_operation op, int prio)
 {
 	const u32 load_magic = 0xb33fc0de;
 
board/renesas/stout/stout.c +2 -1
index 0a0ff5ff76d2..d0b20f3c5902 100644
@@ -125,7 +125,8 @@ int board_phy_config(struct phy_device *phydev)
 	return 0;
 }
 
-enum env_location env_get_location(enum env_operation op, int prio)
+enum env_location env_get_location(struct env_context *ctx,
+				   enum env_operation op, int prio)
 {
 	const u32 load_magic = 0xb33fc0de;
 
(quoted diff) +0 -0

b/board/rockchip/kylin_rk3036/kylin_rk3036.c index 2faeab9baf51..6481f6c11633 100644 --- a/board/rockchip/kylin_rk3036/kylin_rk3036.c +++ b/board/rockchip/kylin_rk3036/kylin_rk3036.c @@ -41,7 +41,7 @@ int rk_board_late_init(void) {

board/rockchip/kylin_rk3036/kylin_rk3036.c +1 -1
 	if (fastboot_key_pressed()) {
 		printf("enter fastboot!\n");
-		env_set("preboot", "setenv preboot; fastboot usb0");
+		env_set(ctx_uboot, "preboot", "setenv preboot;

fastboot usb0"); }

(quoted diff) +0 -0
 	return 0;
(quoted diff) +0 -0

b/board/samsung/common/exynos5-dt.c index 387d1b91809c..1c44effe7224 100644 --- a/board/samsung/common/exynos5-dt.c
+++ b/board/samsung/common/exynos5-dt.c

board/samsung/common/exynos5-dt.c +1 -1
@@ -154,7 +154,7 @@ char *get_dfu_alt_system(char *interface, char
 *devstr) if (board_is_odroidxu4() || board_is_odroidhc1() ||
 board_is_odroidhc2()) return info;
 
-	return env_get("dfu_alt_system");
+	return env_get(ctx_uboot, "dfu_alt_system");
 }
 
 char *get_dfu_alt_boot(char *interface, char *devstr)
board/samsung/common/misc.c +7 -7
index 3ef1e7998013..3086df745fe5 100644
@@ -51,7 +51,7 @@ void set_dfu_alt_info(char *interface, char *devstr)
 
 	alt_setting = get_dfu_alt_boot(interface, devstr);
 	if (alt_setting) {
-		env_set("dfu_alt_boot", alt_setting);
+		env_set(ctx_uboot, "dfu_alt_boot", alt_setting);
 		offset = snprintf(buf, buf_size, "%s", alt_setting);
 	}
 
@@ -71,7 +71,7 @@ void set_dfu_alt_info(char *interface, char *devstr)
 		status = "done\n";
 	}
 
-	env_set("dfu_alt_info", alt_info);
+	env_set(ctx_uboot, "dfu_alt_info", alt_info);
 	puts(status);
 }
 #endif
@@ -83,14 +83,14 @@ void set_board_info(void)
 
 	snprintf(info, ARRAY_SIZE(info), "%u.%u", (s5p_cpu_rev &
 0xf0) >> 4, s5p_cpu_rev & 0xf);
-	env_set("soc_rev", info);
+	env_set(ctx_uboot, "soc_rev", info);
 
 	snprintf(info, ARRAY_SIZE(info), "%x", s5p_cpu_id);
-	env_set("soc_id", info);
+	env_set(ctx_uboot, "soc_id", info);
 
 #ifdef CONFIG_REVISION_TAG
 	snprintf(info, ARRAY_SIZE(info), "%x", get_board_rev());
-	env_set("board_rev", info);
+	env_set(ctx_uboot, "board_rev", info);
 #endif
 #ifdef CONFIG_OF_LIBFDT
 	const char *bdtype = "";
@@ -102,11 +102,11 @@ void set_board_info(void)
 		bdtype = "";
 
 	sprintf(info, "%s%s", bdname, bdtype);
-	env_set("board_name", info);
+	env_set(ctx_uboot, "board_name", info);
 #endif
 	snprintf(info, ARRAY_SIZE(info),  "%s%x-%s%s.dtb",
 		 CONFIG_SYS_SOC, s5p_cpu_id, bdname, bdtype);
-	env_set("fdtfile", info);
+	env_set(ctx_uboot, "fdtfile", info);
 #endif
 }
 #endif /* CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG */
(quoted diff) +0 -0

b/board/samsung/odroid/odroid.c index 9aa97f0f2cad..472dce81f680 100644 --- a/board/samsung/odroid/odroid.c
+++ b/board/samsung/odroid/odroid.c

board/samsung/odroid/odroid.c +1 -1
@@ -74,7 +74,7 @@ const char *get_board_type(void)
 #ifdef CONFIG_SET_DFU_ALT_INFO
 char *get_dfu_alt_system(char *interface, char *devstr)
 {
-	return env_get("dfu_alt_system");
+	return env_get(ctx_uboot, "dfu_alt_system");
 }
 
 char *get_dfu_alt_boot(char *interface, char *devstr)
board/samsung/trats/trats.c +1 -1
index ec85f707c19a..d4540a2ac932 100644
@@ -467,7 +467,7 @@ void exynos_lcd_misc_init(vidinfo_t *vid)
 #endif
 #ifdef CONFIG_S6E8AX0
 	s6e8ax0_init();
-	env_set("lcdinfo", "lcd=s6e8ax0");
+	env_set(ctx_uboot, "lcdinfo", "lcd=s6e8ax0");
 #endif
 }
 #endif
(quoted diff) +0 -0

b/board/samsung/universal_c210/universal.c index ed9c5b50d927..9fea29e965bd 100644 --- a/board/samsung/universal_c210/universal.c +++ b/board/samsung/universal_c210/universal.c @@ -397,6 +397,6 @@ void
exynos_lcd_misc_init(vidinfo_t *vid) vid->pclk_name = 1; /*
MPLL */ vid->sclk_div = 1;

board/samsung/universal_c210/universal.c +1 -1
-	env_set("lcdinfo", "lcd=ld9040");
+	env_set(ctx_uboot, "lcdinfo", "lcd=ld9040");
 }
 #endif
(quoted diff) +0 -0

b/board/samtec/vining_fpga/socfpga.c index 1e095a4e7db0..75ddbcf07fa7 100644 --- a/board/samtec/vining_fpga/socfpga.c
+++ b/board/samtec/vining_fpga/socfpga.c

board/samtec/vining_fpga/socfpga.c +8 -8
@@ -62,30 +62,30 @@ int misc_init_r(void)
 	/* Check EEPROM signature. */
 	if (!(data[0] == 0xa5 && data[1] == 0x5a)) {
 		puts("Invalid I2C EEPROM signature.\n");
-		env_set("unit_serial", "invalid");
-		env_set("unit_ident", "VINing-xxxx-STD");
-		env_set("hostname", "vining-invalid");
+		env_set(ctx_uboot, "unit_serial", "invalid");
+		env_set(ctx_uboot, "unit_ident", "VINing-xxxx-STD");
+		env_set(ctx_uboot, "hostname", "vining-invalid");
 		return 0;
 	}
 
 	/* If 'unit_serial' is already set, do nothing. */
-	if (!env_get("unit_serial")) {
+	if (!env_get(ctx_uboot, "unit_serial")) {
 		/* This field is Big Endian ! */
 		serial = (data[0x54] << 24) | (data[0x55] << 16) |
 			 (data[0x56] << 8) | (data[0x57] << 0);
 		memset(str, 0, sizeof(str));
 		sprintf(str, "%07i", serial);
-		env_set("unit_serial", str);
+		env_set(ctx_uboot, "unit_serial", str);
 	}
 
-	if (!env_get("unit_ident")) {
+	if (!env_get(ctx_uboot, "unit_ident")) {
 		memset(str, 0, sizeof(str));
 		memcpy(str, &data[0x2e], 18);
-		env_set("unit_ident", str);
+		env_set(ctx_uboot, "unit_ident", str);
 	}
 
 	/* Set ethernet address from EEPROM. */
-	if (!env_get("ethaddr") && is_valid_ethaddr(&data[0x62]))
+	if (!env_get(ctx_uboot, "ethaddr") &&
 is_valid_ethaddr(&data[0x62])) eth_env_set_enetaddr("ethaddr",
 &data[0x62]); 
 	return 0;
(quoted diff) +0 -0

b/board/siemens/common/board.c index 676935a84321..63dcf2b83132 100644

board/siemens/common/board.c +2 -2
@@ -121,7 +121,7 @@ unsigned char get_button_state(char * const
 envname, unsigned char def) char *ptr_env;
 
 	/* If button is not found we take default */
-	ptr_env = env_get(envname);
+	ptr_env = env_get(ctx_uboot, envname);
 	if (NULL == ptr_env) {
 		gpio = def;
 	} else {
@@ -199,7 +199,7 @@ void set_env_gpios(unsigned char state)
 		strcat(str_tmp, num);
 
 		/* If env var is not found we stop */
-		ptr_env = env_get(str_tmp);
+		ptr_env = env_get(ctx_uboot, str_tmp);
 		if (NULL == ptr_env)
 			break;
 
board/siemens/draco/board.c +3 -3
index a6840b895b27..9cb1b1301855 100644
@@ -270,13 +270,13 @@ int board_late_init(void)
 #ifdef CONFIG_FACTORYSET
 	/* Set ASN in environment*/
 	if (factory_dat.asn[0] != 0) {
-		env_set("dtb_name", (char *)factory_dat.asn);
+		env_set(ctx_uboot, "dtb_name", (char
 *)factory_dat.asn); } else {
 		/* dtb suffix gets added in load script */
-		env_set("dtb_name", "am335x-draco");
+		env_set(ctx_uboot, "dtb_name", "am335x-draco");
 	}
 #else
-	env_set("dtb_name", "am335x-draco");
+	env_set(ctx_uboot, "dtb_name", "am335x-draco");
 #endif
 
 	return 0;
board/siemens/pxm2/board.c +2 -2
index 30f0902701ee..e57ab33da88b 100644
@@ -444,12 +444,12 @@ int board_late_init(void)
 			factory_dat.pxm50 = 0;
 		sprintf(tmp, "%s_%s", factory_dat.asn,
 			factory_dat.comp_version);
-		ret = env_set("boardid", tmp);
+		ret = env_set(ctx_uboot, "boardid", tmp);
 		if (ret)
 			printf("error setting board id\n");
 	} else {
 		factory_dat.pxm50 = 1;
-		ret = env_set("boardid", "PXM50_1.0");
+		ret = env_set(ctx_uboot, "boardid", "PXM50_1.0");
 		if (ret)
 			printf("error setting board id\n");
 	}
board/siemens/rut/board.c +1 -1
index 539ecef22cb4..809cea42f86b 100644
@@ -480,7 +480,7 @@ int board_late_init(void)
 	else
 		strcpy(tmp, "QMX7.E38_4.0");
 
-	ret = env_set("boardid", tmp);
+	ret = env_set(ctx_uboot, "boardid", tmp);
 	if (ret)
 		printf("error setting board id\n");
 
(quoted diff) +0 -0

b/board/siemens/taurus/taurus.c index 1cf1f9e1f7ca..980d773a77bb 100644 --- a/board/siemens/taurus/taurus.c
+++ b/board/siemens/taurus/taurus.c

board/siemens/taurus/taurus.c +2 -2
@@ -350,36 +350,36 @@ static int upgrade_failure_fallback(void)
 	char *kern_size;
 	char *kern_size_fb;
 
-	partitionset_active = env_get("partitionset_active");
+	partitionset_active = env_get(ctx_uboot,
 "partitionset_active"); if (partitionset_active) {
 		if (partitionset_active[0] == 'A')
-			env_set("partitionset_active", "B");
+			env_set(ctx_uboot, "partitionset_active",

"B"); else

(quoted diff) +1 -1
-			env_set("partitionset_active", "A");
+			env_set(ctx_uboot, "partitionset_active",

"A"); } else {

board/siemens/taurus/taurus.c +23 -21
 		printf("partitionset_active missing.\n");
 		return -ENOENT;
 	}
 
-	rootfs = env_get("rootfs");
-	rootfs_fallback = env_get("rootfs_fallback");
-	env_set("rootfs", rootfs_fallback);
-	env_set("rootfs_fallback", rootfs);
+	rootfs = env_get(ctx_uboot, "rootfs");
+	rootfs_fallback = env_get(ctx_uboot, "rootfs_fallback");
+	env_set(ctx_uboot, "rootfs", rootfs_fallback);
+	env_set(ctx_uboot, "rootfs_fallback", rootfs);
 
-	kern_size = env_get("kernel_size");
-	kern_size_fb = env_get("kernel_size_fallback");
-	env_set("kernel_size", kern_size_fb);
-	env_set("kernel_size_fallback", kern_size);
+	kern_size = env_get(ctx_uboot, "kernel_size");
+	kern_size_fb = env_get(ctx_uboot, "kernel_size_fallback");
+	env_set(ctx_uboot, "kernel_size", kern_size_fb);
+	env_set(ctx_uboot, "kernel_size_fallback", kern_size);
 
-	kern_off = env_get("kernel_Off");
-	kern_off_fb = env_get("kernel_Off_fallback");
-	env_set("kernel_Off", kern_off_fb);
-	env_set("kernel_Off_fallback", kern_off);
+	kern_off = env_get(ctx_uboot, "kernel_Off");
+	kern_off_fb = env_get(ctx_uboot, "kernel_Off_fallback");
+	env_set(ctx_uboot, "kernel_Off", kern_off_fb);
+	env_set(ctx_uboot, "kernel_Off_fallback", kern_off);
 
-	env_set("bootargs", '\0');
-	env_set("upgrade_available", '\0');
-	env_set("boot_retries", '\0');
-	env_save();
+	env_set(ctx_uboot, "bootargs", '\0');
+	env_set(ctx_uboot, "upgrade_available", '\0');
+	env_set(ctx_uboot, "boot_retries", '\0');
+	env_save(ctx_uboot);
 
 	return 0;
 }
@@ -391,14 +391,16 @@ static int do_upgrade_available(cmd_tbl_t
 *cmdtp, int flag, int argc, unsigned long boot_retry = 0;
 	char boot_buf[10];
 
-	upgrade_available =
 simple_strtoul(env_get("upgrade_available"), NULL,
-					   10);
+	upgrade_available = simple_strtoul(env_get(ctx_uboot,
+
 "upgrade_available"),
+					   NULL, 10);
 	if (upgrade_available) {
-		boot_retry = simple_strtoul(env_get("boot_retries"),
 NULL, 10);
+		boot_retry = simple_strtoul(env_get(ctx_uboot,
 "boot_retries"),
+					    NULL, 10);
 		boot_retry++;
 		sprintf(boot_buf, "%lx", boot_retry);
-		env_set("boot_retries", boot_buf);
-		env_save();
+		env_set(ctx_uboot, "boot_retries", boot_buf);
+		env_save(ctx_uboot);
 
 		/*
 		 * Here the boot_retries count is checked, and if the
board/socrates/socrates.c +2 -2
index da9ae5bebb7e..277f9e107080 100644
@@ -38,7 +38,7 @@ int checkboard (void)
 	volatile ccsr_gur_t *gur = (void
 *)(CONFIG_SYS_MPC85xx_GUTS_ADDR); char buf[64];
 	int f;
-	int i = env_get_f("serial#", buf, sizeof(buf));
+	int i = env_get_f("serial#", buf, sizeof(ctx_uboot, buf));
 #ifdef CONFIG_PCI
 	char *src;
 #endif
@@ -409,7 +409,7 @@ void board_backlight_switch (int flag)
 		printf ("hwmon IC init failed\n");
 
 	if (flag) {
-		param = env_get("brightness");
+		param = env_get(ctx_uboot, "brightness");
 		rc = param ? simple_strtol(param, NULL, 10) : -1;
 		if (rc < 0)
 			rc = DEFAULT_BRIGHTNESS;
(quoted diff) +0 -0

b/board/softing/vining_2000/vining_2000.c index 51985b91c226..5d4d0f29c44f 100644 --- a/board/softing/vining_2000/vining_2000.c +++ b/board/softing/vining_2000/vining_2000.c @@ -102,7 +102,7 @@ int board_eth_init(bd_t *bis)

board/softing/vining_2000/vining_2000.c +1 -1
 	/* just to get secound mac address */
 	imx_get_mac_from_fuse(1, eth1addr);
-	if (!env_get("eth1addr") && is_valid_ethaddr(eth1addr))
+	if (!env_get(ctx_uboot, "eth1addr") &&

is_valid_ethaddr(eth1addr)) eth_env_set_enetaddr("eth1addr", eth1addr);
imx_iomux_v3_setup_multiple_pads(fec1_pads,
ARRAY_SIZE(fec1_pads)); @@ -385,11 +385,11 @@ static int set_pin_state(void) return ret;

board/softing/vining_2000/vining_2000.c +3 -3
 	if (val >= VAL_UPPER)
-		env_set("pin_state", "connected");
+		env_set(ctx_uboot, "pin_state", "connected");
 	else if (val < VAL_UPPER && val > VAL_LOWER)
-		env_set("pin_state", "open");
+		env_set(ctx_uboot, "pin_state", "open");
 	else
-		env_set("pin_state", "button");
+		env_set(ctx_uboot, "pin_state", "button");
 
 	return ret;
 }
(quoted diff) +0 -0

b/board/solidrun/mx6cuboxi/mx6cuboxi.c index f82fb0786a94..52177b918d83 100644 --- a/board/solidrun/mx6cuboxi/mx6cuboxi.c +++ b/board/solidrun/mx6cuboxi/mx6cuboxi.c @@ -569,29 +569,29 @@ int board_late_init(void) #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG

board/solidrun/mx6cuboxi/mx6cuboxi.c +8 -8
 	switch (board_type()) {
 	case CUBOXI:
-		env_set("board_name", "CUBOXI");
+		env_set(ctx_uboot, "board_name", "CUBOXI");
 		break;
 	case HUMMINGBOARD:
-		env_set("board_name", "HUMMINGBOARD");
+		env_set(ctx_uboot, "board_name", "HUMMINGBOARD");
 		break;
 	case HUMMINGBOARD2:
-		env_set("board_name", "HUMMINGBOARD2");
+		env_set(ctx_uboot, "board_name", "HUMMINGBOARD2");
 		break;
 	case UNKNOWN:
 	default:
-		env_set("board_name", "CUBOXI");
+		env_set(ctx_uboot, "board_name", "CUBOXI");
 	}
 
 	if (is_mx6dq())
-		env_set("board_rev", "MX6Q");
+		env_set(ctx_uboot, "board_rev", "MX6Q");
 	else
-		env_set("board_rev", "MX6DL");
+		env_set(ctx_uboot, "board_rev", "MX6DL");
 
 	if (is_rev_15_som())
-		env_set("som_rev", "V15");
+		env_set(ctx_uboot, "som_rev", "V15");
 
 	if (has_emmc())
-		env_set("has_emmc", "yes");
+		env_set(ctx_uboot, "has_emmc", "yes");
 
 #endif
(quoted diff) +0 -0

b/board/st/stm32f429-discovery/stm32f429-discovery.c index 500dc5fe3a6b..3ae0c17d7720 100644 --- a/board/st/stm32f429-discovery/stm32f429-discovery.c +++ b/board/st/stm32f429-discovery/stm32f429-discovery.c @@ -65,13 +65,13 @@ int misc_init_r(void) char serialno[25];

board/st/stm32f429-discovery/stm32f429-discovery.c +2 -2
 	uint32_t u_id_low, u_id_mid, u_id_high;
 
-	if (!env_get("serial#")) {
+	if (!env_get(ctx_uboot, "serial#")) {
 		u_id_low  = readl(&STM32_U_ID->u_id_low);
 		u_id_mid  = readl(&STM32_U_ID->u_id_mid);
 		u_id_high = readl(&STM32_U_ID->u_id_high);
 		sprintf(serialno, "%08x%08x%08x",
 			u_id_high, u_id_mid, u_id_low);
-		env_set("serial#", serialno);
+		env_set(ctx_uboot, "serial#", serialno);
 	}
 
 	return 0;
(quoted diff) +0 -0

b/board/st/stm32f429-evaluation/stm32f429-evaluation.c index 8ab2fa5d59ab..3a1c578cdad8 100644 --- a/board/st/stm32f429-evaluation/stm32f429-evaluation.c +++ b/board/st/stm32f429-evaluation/stm32f429-evaluation.c @@ -59,13 +59,13 @@ int misc_init_r(void) char serialno[25];

board/st/stm32f429-evaluation/stm32f429-evaluation.c +2 -2
 	u32 u_id_low, u_id_mid, u_id_high;
 
-	if (!env_get("serial#")) {
+	if (!env_get(ctx_uboot, "serial#")) {
 		u_id_low  = readl(&STM32_U_ID->u_id_low);
 		u_id_mid  = readl(&STM32_U_ID->u_id_mid);
 		u_id_high = readl(&STM32_U_ID->u_id_high);
 		sprintf(serialno, "%08x%08x%08x",
 			u_id_high, u_id_mid, u_id_low);
-		env_set("serial#", serialno);
+		env_set(ctx_uboot, "serial#", serialno);
 	}
 
 	return 0;
(quoted diff) +0 -0

b/board/st/stm32f469-discovery/stm32f469-discovery.c index 70d23d90f4ca..e475296919e0 100644 --- a/board/st/stm32f469-discovery/stm32f469-discovery.c +++ b/board/st/stm32f469-discovery/stm32f469-discovery.c @@ -59,13 +59,13 @@ int misc_init_r(void) char serialno[25];

board/st/stm32f429-evaluation/stm32f429-evaluation.c +2 -2
 	u32 u_id_low, u_id_mid, u_id_high;
 
-	if (!env_get("serial#")) {
+	if (!env_get(ctx_uboot, "serial#")) {
 		u_id_low  = readl(&STM32_U_ID->u_id_low);
 		u_id_mid  = readl(&STM32_U_ID->u_id_mid);
 		u_id_high = readl(&STM32_U_ID->u_id_high);
 		sprintf(serialno, "%08x%08x%08x",
 			u_id_high, u_id_mid, u_id_low);
-		env_set("serial#", serialno);
+		env_set(ctx_uboot, "serial#", serialno);
 	}
 
 	return 0;
(quoted diff) +0 -0

b/board/st/stm32mp1/stm32mp1.c index 279c7b779799..188f4a7eae12 100644

board/st/stm32mp1/stm32mp1.c +7 -5
@@ -544,9 +544,9 @@ int board_late_init(void)
 				 &fdt_compat_len);
 	if (fdt_compat && fdt_compat_len) {
 		if (strncmp(fdt_compat, "st,", 3) != 0)
-			env_set("board_name", fdt_compat);
+			env_set(ctx_uboot, "board_name", fdt_compat);
 		else
-			env_set("board_name", fdt_compat + 3);
+			env_set(ctx_uboot, "board_name", fdt_compat
+ 3); }
 #endif
 
@@ -623,7 +623,8 @@ int board_interface_eth_init(phy_interface_t
 interface_type, return 0;
 }
 
-enum env_location env_get_location(enum env_operation op, int prio)
+enum env_location env_get_location(struct env_context *ctx,
+				   enum env_operation op, int prio)
 {
 	u32 bootmode = get_bootmode();
 
@@ -688,8 +689,8 @@ const char *env_ext4_get_dev_part(void)
 static const char *env_get_mtdparts(const char *str, char *buf)
 {
 	if (gd->flags & GD_FLG_ENV_READY)
-		return env_get(str);
-	if (env_get_f(str, buf, MTDPARTS_LEN) != -1)
+		return env_get(ctx_uboot, str);
+	if (env_get_f(ctx_uboot, str, buf, MTDPARTS_LEN) != -1)
 		return buf;
 
 	return NULL;
board/sunxi/board.c +13 -12
index e3b2d13892c8..d5f172eb8082 100644
@@ -194,7 +194,8 @@ void i2c_init_board(void)
 }
 
 #if defined(CONFIG_ENV_IS_IN_MMC) && defined(CONFIG_ENV_IS_IN_FAT)
-enum env_location env_get_location(enum env_operation op, int prio)
+enum env_location env_get_location(struct env_context *ctx,
+				   enum env_operation op, int prio)
 {
 	switch (prio) {
 	case 0:
@@ -725,7 +726,7 @@ void get_board_serial(struct tag_serialnr
 *serialnr) char *serial_string;
 	unsigned long long serial;
 
-	serial_string = env_get("serial#");
+	serial_string = env_get(ctx_uboot, "serial#");
 
 	if (serial_string) {
 		serial = simple_strtoull(serial_string, NULL, 16);
@@ -764,7 +765,7 @@ static void parse_spl_header(const uint32_t
 spl_addr) return;
 	}
 	/* otherwise assume .scr format (mkimage-type script) */
-	env_set_hex("fel_scriptaddr", spl->fel_script_address);
+	env_set_hex(ctx_uboot, "fel_scriptaddr",
 spl->fel_script_address); }
 
 /*
@@ -812,7 +813,7 @@ static void setup_environment(const void *fdt)
 			else
 				sprintf(ethaddr, "eth%daddr", i);
 
-			if (env_get(ethaddr))
+			if (env_get(ctx_uboot, ethaddr))
 				continue;
 
 			/* Non OUI / registered MAC address */
@@ -826,11 +827,11 @@ static void setup_environment(const void *fdt)
 			eth_env_set_enetaddr(ethaddr, mac_addr);
 		}
 
-		if (!env_get("serial#")) {
+		if (!env_get(ctx_uboot, "serial#")) {
 			snprintf(serial_string,
 sizeof(serial_string), "%08x%08x", sid[0], sid[3]);
 
-			env_set("serial#", serial_string);
+			env_set(ctx_uboot, "serial#", serial_string);
 		}
 	}
 }
@@ -839,20 +840,20 @@ int misc_init_r(void)
 {
 	uint boot;
 
-	env_set("fel_booted", NULL);
-	env_set("fel_scriptaddr", NULL);
-	env_set("mmc_bootdev", NULL);
+	env_set(ctx_uboot, "fel_booted", NULL);
+	env_set(ctx_uboot, "fel_scriptaddr", NULL);
+	env_set(ctx_uboot, "mmc_bootdev", NULL);
 
 	boot = sunxi_get_boot_device();
 	/* determine if we are running in FEL mode */
 	if (boot == BOOT_DEVICE_BOARD) {
-		env_set("fel_booted", "1");
+		env_set(ctx_uboot, "fel_booted", "1");
 		parse_spl_header(SPL_ADDR);
 	/* or if we booted from MMC, and which one */
 	} else if (boot == BOOT_DEVICE_MMC1) {
-		env_set("mmc_bootdev", "0");
+		env_set(ctx_uboot, "mmc_bootdev", "0");
 	} else if (boot == BOOT_DEVICE_MMC2) {
-		env_set("mmc_bootdev", "1");
+		env_set(ctx_uboot, "mmc_bootdev", "1");
 	}
 
 	setup_environment(gd->fdt_blob);
(quoted diff) +0 -0

b/board/synopsys/hsdk/env-lib.c index f443c21e6d99..eca2211246b4 100644 --- a/board/synopsys/hsdk/env-lib.c
+++ b/board/synopsys/hsdk/env-lib.c

(quoted diff) +4 -2
@@ -21,10 +21,12 @@ static int env_read_common(u32 index, const
 struct env_map_common *map) 
 	if (!env_get_yesno(map[index].env_name)) {
 		if (map[index].type == ENV_HEX) {
-			val = (u32)env_get_hex(map[index].env_name,
 0);
+			val = (u32)env_get_hex(ctx_uboot,
 map[index].env_name,
+					       0);
 			debug("ENV: %s: = %#x\n",
 map[index].env_name, val); } else {
-			val =
 (u32)env_get_ulong(map[index].env_name, 10, 0);
+			val = (u32)env_get_ulong(ctx_uboot,
+

map[index].env_name, 10, 0); debug("ENV: %s: = %d\n", map[index].env_name, val); }

(quoted diff) +3 -2
@@ -52,10 +54,11 @@ static int env_read_core(u32 index, const struct
 env_map_percpu *map) sprintf(command, "%s_%u", map[index].env_name,
 i); if (!env_get_yesno(command)) {
 			if (map[index].type == ENV_HEX) {
-				val = (u32)env_get_hex(command, 0);
+				val = (u32)env_get_hex(ctx_uboot,
 command, 0); debug("ENV: %s: = %#x\n", command, val);
 			} else {
-				val = (u32)env_get_ulong(command,
 10, 0);
+				val = (u32)env_get_ulong(ctx_uboot,
 command,
+							 10, 0);
 				debug("ENV: %s: = %d\n", command,

val); }

board/synopsys/hsdk/hsdk.c +0 -0
index 8a7642a0aaaa..ab97b97bcde3 100644
@@ -854,19 +854,19 @@ static int do_hsdk_clock_get(cmd_tbl_t *cmdtp,

int flag, int argc, if (soc_clk_ctl("cpu-clk", &rate, CLK_GET | CLK_MHZ)) return CMD_RET_FAILURE;

board/synopsys/hsdk/hsdk.c +3 -3
-	if (env_set_ulong("cpu_freq", rate))
+	if (env_set_ulong(ctx_uboot, "cpu_freq", rate))
 		return CMD_RET_FAILURE;
 
 	if (soc_clk_ctl("tun-clk", &rate, CLK_GET | CLK_MHZ))
 		return CMD_RET_FAILURE;
 
-	if (env_set_ulong("tun_freq", rate))
+	if (env_set_ulong(ctx_uboot, "tun_freq", rate))
 		return CMD_RET_FAILURE;
 
 	if (soc_clk_ctl("axi-clk", &rate, CLK_GET | CLK_MHZ))
 		return CMD_RET_FAILURE;
 
-	if (env_set_ulong("axi_freq", rate))
+	if (env_set_ulong(ctx_uboot, "axi_freq", rate))
 		return CMD_RET_FAILURE;
 
 	printf("Clock values are saved to environment\n");
board/syteco/zmx25/zmx25.c +5 -3
index d2318457b431..c49ac35c2933 100644
@@ -145,7 +145,7 @@ int board_late_init(void)
 	udelay(5000);
 #endif
 
-	e = env_get("gs_base_board");
+	e = env_get(ctx_uboot, "gs_base_board");
 	if (e != NULL) {
 		if (strcmp(e, "G283") == 0) {
 			int key = gpio_get_value(IMX_GPIO_NR(2, 29));
@@ -155,9 +155,11 @@ int board_late_init(void)
 				gpio_set_value(IMX_GPIO_NR(1, 29),
 0); gpio_set_value(IMX_GPIO_NR(4, 21), 0);
 
-				env_set("preboot", "run
 gs_slow_boot");
+				env_set(ctx_uboot, "preboot",
+					"run gs_slow_boot");
 			} else
-				env_set("preboot", "run
 gs_fast_boot");
+				env_set(ctx_uboot, "preboot",
+					"run gs_fast_boot");
 		}
board/syteco/zmx25/zmx25.c +0 -0
 	}
board/tcl/sl50/board.c +3 -3
index c7eed319461a..79598cd36a5e 100644
@@ -75,7 +75,7 @@ int spl_start_uboot(void)
 
 #ifdef CONFIG_SPL_ENV_SUPPORT
 	env_init();
-	env_load();
+	env_load(ctx_uboot);
 	if (env_get_yesno("boot_os") != 1)
 		return 1;
 #endif
@@ -321,7 +321,7 @@ int board_eth_init(bd_t *bis)
 
 #if (defined(CONFIG_DRIVER_TI_CPSW) && !defined(CONFIG_SPL_BUILD))
 || \ (defined(CONFIG_SPL_ETH_SUPPORT) && defined(CONFIG_SPL_BUILD))
-	if (!env_get("ethaddr")) {
+	if (!env_get(ctx_uboot, "ethaddr")) {
 		printf("<ethaddr> not set. Validating first E-fuse
 MAC\n"); 
 		if (is_valid_ethaddr(mac_addr))
@@ -339,7 +339,7 @@ int board_eth_init(bd_t *bis)
 	mac_addr[4] = mac_lo & 0xFF;
 	mac_addr[5] = (mac_lo & 0xFF00) >> 8;
 
-	if (!env_get("eth1addr")) {
+	if (!env_get(ctx_uboot, "eth1addr")) {
 		if (is_valid_ethaddr(mac_addr))
 			eth_env_set_enetaddr("eth1addr", mac_addr);
 	}
(quoted diff) +0 -0

b/board/theobroma-systems/puma_rk3399/puma-rk3399.c index 47259b714961..d0150a127dd6 100644 --- a/board/theobroma-systems/puma_rk3399/puma-rk3399.c +++ b/board/theobroma-systems/puma_rk3399/puma-rk3399.c @@ -58,8 +58,8 @@ static int setup_boottargets(void) }

board/theobroma-systems/puma_rk3399/puma-rk3399.c +4 -4
 	debug("%s: booted from %s\n", __func__, boot_device);
 
-	env_default = env_get_default("boot_targets");
-	env = env_get("boot_targets");
+	env_default = env_get_default(ctx_uboot, "boot_targets");
+	env = env_get(ctx_uboot, "boot_targets");
 	if (!env) {
 		debug("%s: boot_targets does not exist\n", __func__);
 		return -1;
@@ -102,7 +102,7 @@ static int setup_boottargets(void)
 			mmc0[3] = '1';
 			mmc1[3] = '0';
 			debug("%s: set boot_targets to: %s\n",
 __func__, env);
-			env_set("boot_targets", env);
+			env_set(ctx_uboot, "boot_targets", env);
 		}
 	}
@@ -140,7 +140,7 @@ void get_board_serial(struct tag_serialnr
 *serialnr) char *serial_string;
 	u64 serial = 0;
 
-	serial_string = env_get("serial#");
+	serial_string = env_get(ctx_uboot, "serial#");
 
 	if (serial_string)
 		serial = simple_strtoull(serial_string, NULL, 16);
board/ti/am335x/board.c +9 -9
index 7eaa6cd96d60..b1f432332d8c 100644
@@ -251,7 +251,7 @@ int spl_start_uboot(void)
 
 #ifdef CONFIG_SPL_ENV_SUPPORT
[… more lines in the raw message]

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

board/ti/am335x/board.c +0 -0

Lines of this file are not shown. View the raw message.

board/ti/am43xx/board.c +3 -3
index 2e09cc20e8c2..7eb71cd4d8d1 100644

Lines of this file are not shown. View the raw message.

board/ti/am57xx/board.c +7 -7
index f78e6c2e1f6e..222049d541de 100644

Lines of this file are not shown. View the raw message.

board/ti/beagle/beagle.c +7 -7
index 0138fc91fcbe..7ee36aff7c45 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

%s)\n", @@ -411,37 +411,37 @@ int misc_init_r(void)

board/ti/beagle/beagle.c +1 -1

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

%s)\n", expansion_config.revision,

board/ti/beagle/beagle.c +0 -0

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

*/

board/ti/beagle/beagle.c +12 -11

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

board/ti/beagle/beagle.c +2 -2

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

CONFIG_MTDPARTS_DEFAULT); #endif

board/ti/beagle/beagle.c +0 -0

Lines of this file are not shown. View the raw message.

(quoted diff) +0 -0

The rest of this diff is not shown. View the raw message.

b/board/ti/common/board_detect.c index bc89cc57bd78..fe776f2428d2 100644 --- a/board/ti/common/board_detect.c
+++ b/board/ti/common/board_detect.c

board/ti/common/board_detect.c +7 -7

Lines of this file are not shown. View the raw message.

board/ti/dra7xx/evm.c +6 -6
index 74d04bb1e393..63ac5b1988bf 100644

Lines of this file are not shown. View the raw message.

board/ti/evm/evm.c +1 -1
index d0b9bafbd1b6..4053eb7448a6 100644

Lines of this file are not shown. View the raw message.

board/ti/ks2_evm/board.c +5 -5
index e9bc68049b4b..aa447fd886cc 100644

Lines of this file are not shown. View the raw message.

(quoted diff) +0 -0

The rest of this diff is not shown. View the raw message.

b/board/ti/ks2_evm/board_k2g.c index 4ff9a44b3712..49c09b88bd83 100644

board/ti/ks2_evm/board_k2g.c +4 -4

Lines of this file are not shown. View the raw message.

board/ti/panda/panda.c +1 -1
index 20199da390ec..9d42123de9cc 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

(board_id0)); @@ -117,7 +117,7 @@ int get_board_revision(void)

#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
if ((board_id >= 0x3) && (processor_rev ==
OMAP4430_ES2_3))

board/ti/panda/panda.c +1 -1

Lines of this file are not shown. View the raw message.

(quoted diff) +0 -0

The rest of this diff is not shown. View the raw message.

b/board/toradex/apalis-imx8/apalis-imx8.c index af48b560952e..7e0f01534a9e 100644 --- a/board/toradex/apalis-imx8/apalis-imx8.c +++ b/board/toradex/apalis-imx8/apalis-imx8.c @@ -117,8 +117,8 @@ int board_late_init(void) {
#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
/* TODO move to common */

board/toradex/apalis-imx8/apalis-imx8.c +2 -2

Lines of this file are not shown. View the raw message.

(quoted diff) +0 -0

The rest of this diff is not shown. View the raw message.

b/board/toradex/apalis_imx6/apalis_imx6.c index 6421a22c25a7..c40ccedc4c9d 100644 --- a/board/toradex/apalis_imx6/apalis_imx6.c +++ b/board/toradex/apalis_imx6/apalis_imx6.c @@ -701,7 +701,7 @@ int board_late_init(void)

board/toradex/apalis_imx6/apalis_imx6.c +1 -1

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

V1.0 HW */

board/toradex/apalis_imx6/apalis_imx6.c +1 -1

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

== 0)) {

(quoted diff) +1 -1

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

FDT_FILE_V1_0); printf("patching fdt_file to " FDT_FILE_V1_0 "\n");
#ifndef CONFIG_ENV_IS_NOWHERE

board/toradex/apalis_imx6/apalis_imx6.c +3 -3

Lines of this file are not shown. View the raw message.

(quoted diff) +0 -0

The rest of this diff is not shown. View the raw message.

b/board/toradex/colibri-imx6ull/colibri-imx6ull.c index d1ae463941ae..160b79ba0b27 100644 --- a/board/toradex/colibri-imx6ull/colibri-imx6ull.c +++ b/board/toradex/colibri-imx6ull/colibri-imx6ull.c @@ -178,7 +178,7 @@ int board_late_init(void) */

board/toradex/colibri-imx6ull/colibri-imx6ull.c +3 -3

Lines of this file are not shown. View the raw message.

(quoted diff) +0 -0

The rest of this diff is not shown. View the raw message.

b/board/toradex/colibri-imx8x/colibri-imx8x.c index eae3c591a164..ef52f95dc93e 100644 --- a/board/toradex/colibri-imx8x/colibri-imx8x.c +++ b/board/toradex/colibri-imx8x/colibri-imx8x.c @@ -129,8 +129,8 @@ int board_late_init(void) {
#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
/* TODO move to common */

board/toradex/colibri-imx8x/colibri-imx8x.c +2 -2

Lines of this file are not shown. View the raw message.

(quoted diff) +0 -0

The rest of this diff is not shown. View the raw message.

b/board/toradex/colibri_imx6/colibri_imx6.c index ad40b589c1ed..1c1c1577eb1f 100644 --- a/board/toradex/colibri_imx6/colibri_imx6.c +++ b/board/toradex/colibri_imx6/colibri_imx6.c @@ -661,14 +661,14 @@ int board_late_init(void)

board/toradex/colibri_imx6/colibri_imx6.c +1 -1

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

command\n");

board/toradex/apalis_imx6/apalis_imx6.c +3 -3

Lines of this file are not shown. View the raw message.

(quoted diff) +0 -0

The rest of this diff is not shown. View the raw message.

b/board/toradex/colibri_vf/colibri_vf.c index 04d8ffd1e666..e466d8aad6e1 100644 --- a/board/toradex/colibri_vf/colibri_vf.c +++ b/board/toradex/colibri_vf/colibri_vf.c @@ -392,7 +392,7 @@ int board_late_init(void) if (((src->sbmr2 & SRC_SBMR2_BMOD_MASK) >> SRC_SBMR2_BMOD_SHIFT) == SRC_SBMR2_BMOD_SERIAL) {
printf("Serial Downloader recovery mode, disable
autoboot\n");

board/toradex/colibri_vf/colibri_vf.c +1 -1

Lines of this file are not shown. View the raw message.

(quoted diff) +0 -0

The rest of this diff is not shown. View the raw message.

b/board/toradex/common/tdx-cfg-block.c index 9c86230595b9..6897ced0f7fe 100644 --- a/board/toradex/common/tdx-cfg-block.c +++ b/board/toradex/common/tdx-cfg-block.c @@ -314,7 +314,7 @@ static int get_cfgblock_interactive(void) wb = console_buffer[0];
#endif

board/toradex/common/tdx-cfg-block.c +1 -1

Lines of this file are not shown. View the raw message.

(quoted diff) +0 -0

The rest of this diff is not shown. View the raw message.

b/board/toradex/common/tdx-common.c index e9441a7979d2..a51749dd78c2 100644 --- a/board/toradex/common/tdx-common.c
+++ b/board/toradex/common/tdx-common.c

board/toradex/common/tdx-common.c +1 -1

Lines of this file are not shown. View the raw message.

board/tqc/tqma6/tqma6.c +1 -1
index 5b20afd48814..f13126c2ee59 100644

Lines of this file are not shown. View the raw message.

board/udoo/neo/neo.c +1 -1
index 5c468a6a973e..2a61dc29ef92 100644

Lines of this file are not shown. View the raw message.

board/udoo/udoo.c +2 -2
index f2c2bf47b0fd..88bc24b2b475 100644

Lines of this file are not shown. View the raw message.

(quoted diff) +0 -0

The rest of this diff is not shown. View the raw message.

b/board/varisys/common/sys_eeprom.c index 77772a6923e4..5b248f8b0f44 100644 --- a/board/varisys/common/sys_eeprom.c
+++ b/board/varisys/common/sys_eeprom.c

board/varisys/common/sys_eeprom.c +1 -1

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

that are blank

board/freescale/common/sys_eeprom.c +2 -2

Lines of this file are not shown. View the raw message.

board/vscom/baltos/board.c +3 -3
index 1ba58d0f11dd..5e799d546786 100644

Lines of this file are not shown. View the raw message.

board/wandboard/wandboard.c +6 -6
index 69cdf3e9c96b..4ba472cae9b8 100644

Lines of this file are not shown. View the raw message.

board/warp7/warp7.c +1 -1
index 39ae98225738..549d65b3469d 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

imx_hab_is_enabled()); #else

board/warp7/warp7.c +2 -2

Lines of this file are not shown. View the raw message.

(quoted diff) +0 -0

The rest of this diff is not shown. View the raw message.

b/board/work-microwave/work_92105/work_92105_display.c index db04dcabc7bc..e673921b7bbc 100644 --- a/board/work-microwave/work_92105/work_92105_display.c +++ b/board/work-microwave/work_92105/work_92105_display.c @@ -228,7 +228,7 @@ void work_92105_display_init(void) i2c_write(0x2c, 0x01, 1, &enable_backlight, 1);

board/work-microwave/work_92105/work_92105_display.c +1 -1

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

"fwopt_dispcontrast"); if (display_contrast_str)
display_contrast =
simple_strtoul(display_contrast_str, NULL, 10);

board/xes/common/board.c +3 -3
index 43575bc302d6..b5cc9a69508a 100644

Lines of this file are not shown. View the raw message.

board/xilinx/zynq/board.c +8 -8
index 35191b2f813b..509834c679ab 100644

Lines of this file are not shown. View the raw message.

board/xilinx/zynqmp/cmds.c +1 -1
index ed7ba58c6475..e5c1dab091ca 100644

Lines of this file are not shown. View the raw message.

(quoted diff) +0 -0

The rest of this diff is not shown. View the raw message.

b/board/xilinx/zynqmp/zynqmp.c index d649daba96d4..31e26fb097a4 100644

board/xilinx/zynqmp/zynqmp.c +2 -2

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

"compatible", NULL); @@ -511,7 +511,7 @@ static int set_fdtfile(void)

sprintf(fdtfile, "%s%s%s", vendor, compatible,
suffix);

board/xilinx/zynqmp/zynqmp.c +10 -10

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190905/8c82f8d8/attachment-0001.sig>

Part of the diff is not shown here. View the raw message.