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 2 of 2

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

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

In reply to Lukasz Majewski
Quoted 11 lines · Lukasz Majewski
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?

I hope that the following cover letter explains enough:
https://lists.denx.de/pipermail/u-boot/2019-September/382854.html

Thanks,
-Takahiro Akashi

Quoted 5,333 lines

board/xilinx/zynqmp/zynqmp.c

Quoted 5,321 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

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

#14 lore raw

PATCH v5 10/19 cmd: converted with new env interfaces

In reply to AKASHI Takahiro

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

---
 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/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 +-
 39 files changed, 176 insertions(+), 166 deletions(-)
cmd/ab_select.c +1 -1
index 7c8f2ee8eb3a..ff7408d7640e 100644
@@ -32,7 +32,7 @@ static int do_ab_select(cmd_tbl_t *cmdtp, int flag, int argc,
 	/* Android standard slot names are 'a', 'b', ... */
 	slot[0] = BOOT_SLOT_NAME(ret);
 	slot[1] = '\0';
-	env_set(argv[1], slot);
+	env_set(ctx_uboot, argv[1], slot);
 	printf("ANDROID: Booting slot: %s\n", slot);
 	return CMD_RET_SUCCESS;
 }
cmd/avb.c +1 -1
index 5bc158252b30..3cb49edbeca0 100644
@@ -283,7 +283,7 @@ int do_avb_verify_part(cmd_tbl_t *cmdtp, int flag,
 		else
 			cmdline = out_data->cmdline;
 
-		env_set(AVB_BOOTARGS, cmdline);
+		env_set(ctx_uboot, AVB_BOOTARGS, cmdline);
 
 		res = CMD_RET_SUCCESS;
 		break;
cmd/bdinfo.c +3 -3
index ae6006f85ffa..2a4e5546a29a 100644
@@ -28,7 +28,7 @@ static void print_eth(int idx)
 		sprintf(name, "eth%iaddr", idx);
 	else
 		strcpy(name, "ethaddr");
-	val = env_get(name);
+	val = env_get(ctx_uboot, name);
 	if (!val)
 		val = "(not set)";
 	printf("%-12s= %s\n", name, val);
@@ -51,7 +51,7 @@ static void print_eths(void)
 	} while (dev);
 
 	printf("current eth = %s\n", eth_get_name());
-	printf("ip_addr     = %s\n", env_get("ipaddr"));
+	printf("ip_addr     = %s\n", env_get(ctx_uboot, "ipaddr"));
 }
 #endif
 
@@ -141,7 +141,7 @@ static inline void print_eth_ip_addr(void)
 #if defined(CONFIG_HAS_ETH5)
 	print_eth(5);
 #endif
-	printf("IP addr     = %s\n", env_get("ipaddr"));
+	printf("IP addr     = %s\n", env_get(ctx_uboot, "ipaddr"));
 #endif
 }
 
cmd/binop.c +2 -2
index 6d2df5f3dd4f..16dbb3f50649 100644
@@ -28,7 +28,7 @@ void write_to_env_var(char *varname, u8 *result, ulong len)
 		str_ptr += 2;
 	}
 	*str_ptr = '\0';
-	env_set(varname, str_output);
+	env_set(ctx_uboot, varname, str_output);
 
 	free(str_output);
 }
@@ -37,7 +37,7 @@ void read_from_env_var(char *varname, u8 *result)
 {
 	char *str_value;
 
-	str_value = env_get(varname);
+	str_value = env_get(ctx_uboot, varname);
 	if (str_value)
 		hex2bin(result, str_value, strlen(str_value) / 2);
 	else
cmd/bootefi.c +4 -4
index f613cce7e262..f014c234b380 100644
@@ -36,7 +36,7 @@ static efi_status_t set_load_options(efi_handle_t handle, const char *env_var)
 {
 	struct efi_loaded_image *loaded_image_info;
 	size_t size;
-	const char *env = env_get(env_var);
+	const char *env = env_get(ctx_uboot, env_var);
 	u16 *pos;
 	efi_status_t ret;
 
@@ -234,7 +234,7 @@ static efi_status_t efi_install_fdt(const char *fdt_opt)
 		if (get_config_table(&efi_guid_fdt))
 			return EFI_SUCCESS;
 		/* Use our own device tree as default */
-		fdt_opt = env_get("fdtcontroladdr");
+		fdt_opt = env_get(ctx_uboot, "fdtcontroladdr");
 		if (!fdt_opt) {
 			printf("ERROR: need device tree\n");
 			return EFI_NOT_FOUND;
@@ -366,7 +366,7 @@ static int do_bootefi_image(const char *image_opt)
 	if (!strcmp(image_opt, "hello")) {
 		char *saddr;
 
-		saddr = env_get("loadaddr");
+		saddr = env_get(ctx_uboot, "loadaddr");
 		size = __efi_helloworld_end - __efi_helloworld_begin;
 
 		if (saddr)
@@ -382,7 +382,7 @@ static int do_bootefi_image(const char *image_opt)
 	} else
 #endif
 	{
-		size_str = env_get("filesize");
+		size_str = env_get(ctx_uboot, "filesize");
 		if (size_str)
 			size = simple_strtoul(size_str, NULL, 16);
 		else
cmd/bootm.c +2 -2
index 8279f2b7cc63..46ee8ddbcb95 100644
@@ -137,7 +137,7 @@ int do_bootm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 
 int bootm_maybe_autostart(cmd_tbl_t *cmdtp, const char *cmd)
 {
-	const char *ep = env_get("autostart");
+	const char *ep = env_get(ctx_uboot, "autostart");
 
 	if (ep && !strcmp(ep, "yes")) {
 		char *local_args[2];
@@ -201,7 +201,7 @@ U_BOOT_CMD(
 #if defined(CONFIG_CMD_BOOTD)
 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);
 }
 
 U_BOOT_CMD(
cmd/bootmenu.c +3 -3
index 3dc2c854aca5..cc5368f090f0 100644
@@ -53,7 +53,7 @@ static char *bootmenu_getoption(unsigned short int n)
 		return NULL;
 
 	sprintf(name, "bootmenu_%d", n);
-	return env_get(name);
+	return env_get(ctx_uboot, name);
 }
 
 static void bootmenu_print_entry(void *data)
@@ -265,7 +265,7 @@ static struct bootmenu_data *bootmenu_create(int delay)
 	menu->active = 0;
 	menu->first = NULL;
 
-	default_str = env_get("bootmenu_default");
+	default_str = env_get(ctx_uboot, "bootmenu_default");
 	if (default_str)
 		menu->active = (int)simple_strtol(default_str, NULL, 10);
 
@@ -494,7 +494,7 @@ int do_bootmenu(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
 		delay_str = argv[1];
 
 	if (!delay_str)
-		delay_str = env_get("bootmenu_delay");
+		delay_str = env_get(ctx_uboot, "bootmenu_delay");
 
 	if (delay_str)
 		delay = (int)simple_strtol(delay_str, NULL, 10);
cmd/cbfs.c +1 -1
index 98e652a4e7bf..9969284ee95f 100644
@@ -80,7 +80,7 @@ static int do_cbfs_fsload(cmd_tbl_t *cmdtp, int flag, int argc,
 
 	printf("\n%ld bytes read\n", size);
 
-	env_set_hex("filesize", size);
+	env_set_hex(ctx_uboot, "filesize", size);
 
 	return 0;
 }
cmd/cramfs.c +4 -4
index 2188910b2a77..b7cb1d72ee8a 100644
@@ -105,7 +105,7 @@ int do_cramfs_load(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	struct mtdids id;
 
 	ulong addr;
-	addr = simple_strtoul(env_get("cramfsaddr"), NULL, 16);
+	addr = simple_strtoul(env_get(ctx_uboot, "cramfsaddr"), NULL, 16);
 
 	/* hack! */
 	/* cramfs_* only supports NOR flash chips */
@@ -118,7 +118,7 @@ int do_cramfs_load(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	part.offset = (u64)(uintptr_t) map_sysmem(addr - OFFSET_ADJUSTMENT, 0);
 
 	/* pre-set Boot file name */
-	filename = env_get("bootfile");
+	filename = env_get(ctx_uboot, "bootfile");
 	if (!filename)
 		filename = "uImage";
 
@@ -139,7 +139,7 @@ int do_cramfs_load(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	if (size > 0) {
 		printf("### CRAMFS load complete: %d bytes loaded to 0x%lx\n",
 			size, offset);
-		env_set_hex("filesize", size);
+		env_set_hex(ctx_uboot, "filesize", size);
 	} else {
 		printf("### CRAMFS LOAD ERROR<%x> for %s!\n", size, filename);
 	}
@@ -170,7 +170,7 @@ int do_cramfs_ls(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	struct mtdids id;
 
 	ulong addr;
-	addr = simple_strtoul(env_get("cramfsaddr"), NULL, 16);
+	addr = simple_strtoul(env_get(ctx_uboot, "cramfsaddr"), NULL, 16);
 
 	/* hack! */
 	/* cramfs_* only supports NOR flash chips */
cmd/dtimg.c +1 -1
index 6c5d53cc6808..7f990368608e 100644
@@ -82,7 +82,7 @@ static int dtimg_get_fdt(int argc, char * const argv[], enum cmd_dtimg_info cmd)
 		return CMD_RET_FAILURE;
 	}
 
-	env_set(argv[3], buf);
+	env_set(ctx_uboot, argv[3], buf);
 
 	return CMD_RET_SUCCESS;
 }
cmd/elf.c +16 -13
index 538562fda581..aa3ca401fa21 100644
@@ -275,7 +275,7 @@ int do_bootelf(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	unsigned long addr; /* Address of the ELF image */
 	unsigned long rc; /* Return value from user code */
 	char *sload = NULL;
-	const char *ep = env_get("autostart");
+	const char *ep = env_get(ctx_uboot, "autostart");
 	int rcode = 0;
 
 	/* Consume 'bootelf' */
@@ -383,7 +383,8 @@ int do_bootvx(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	 * Get VxWorks's physical memory base address from environment,
 	 * if we don't specify it in the environment, use a default one.
 	 */
-	base = env_get_hex("vx_phys_mem_base", VXWORKS_PHYS_MEM_BASE);
+	base = env_get_hex(ctx_uboot, "vx_phys_mem_base",
+			   VXWORKS_PHYS_MEM_BASE);
 	data = (struct e820_entry *)(base + E820_DATA_OFFSET);
 	info = (struct e820_info *)(base + E820_INFO_OFFSET);
 
@@ -423,7 +424,7 @@ int do_bootvx(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	 * (LOCAL_MEM_LOCAL_ADRS + BOOT_LINE_OFFSET) as defined by
 	 * VxWorks BSP. For example, on PowerPC it defaults to 0x4200.
 	 */
-	tmp = env_get("bootaddr");
+	tmp = env_get(ctx_uboot, "bootaddr");
 	if (!tmp) {
 #ifdef CONFIG_X86
 		bootaddr = base + X86_BOOT_LINE_OFFSET;
@@ -440,9 +441,9 @@ int do_bootvx(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	 * Check to see if the bootline is defined in the 'bootargs' parameter.
 	 * If it is not defined, we may be able to construct the info.
 	 */
-	bootline = env_get("bootargs");
+	bootline = env_get(ctx_uboot, "bootargs");
 	if (!bootline) {
-		tmp = env_get("bootdev");
+		tmp = env_get(ctx_uboot, "bootdev");
 		if (tmp) {
 			strcpy(build_buf, tmp);
 			ptr = strlen(tmp);
@@ -450,7 +451,7 @@ int do_bootvx(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 			printf("## VxWorks boot device not specified\n");
 		}
 
-		tmp = env_get("bootfile");
+		tmp = env_get(ctx_uboot, "bootfile");
 		if (tmp)
 			ptr += sprintf(build_buf + ptr, "host:%s ", tmp);
 		else
@@ -460,12 +461,14 @@ int do_bootvx(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 		 * The following parameters are only needed if 'bootdev'
 		 * is an ethernet device, otherwise they are optional.
 		 */
-		tmp = env_get("ipaddr");
+		tmp = env_get(ctx_uboot, "ipaddr");
 		if (tmp) {
 			ptr += sprintf(build_buf + ptr, "e=%s", tmp);
-			tmp = env_get("netmask");
+			tmp = env_get(ctx_uboot, "netmask");
 			if (tmp) {
-				u32 mask = env_get_ip("netmask").s_addr;
+				u32 mask;
+
+				mask = env_get_ip(ctx_uboot, "netmask").s_addr;
 				ptr += sprintf(build_buf + ptr,
 					       ":%08x ", ntohl(mask));
 			} else {
@@ -473,19 +476,19 @@ int do_bootvx(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 			}
 		}
 
-		tmp = env_get("serverip");
+		tmp = env_get(ctx_uboot, "serverip");
 		if (tmp)
 			ptr += sprintf(build_buf + ptr, "h=%s ", tmp);
 
-		tmp = env_get("gatewayip");
+		tmp = env_get(ctx_uboot, "gatewayip");
 		if (tmp)
 			ptr += sprintf(build_buf + ptr, "g=%s ", tmp);
 
-		tmp = env_get("hostname");
+		tmp = env_get(ctx_uboot, "hostname");
 		if (tmp)
 			ptr += sprintf(build_buf + ptr, "tn=%s ", tmp);
 
-		tmp = env_get("othbootargs");
+		tmp = env_get(ctx_uboot, "othbootargs");
 		if (tmp) {
 			strcpy(build_buf + ptr, tmp);
 			ptr += strlen(tmp);
cmd/fdt.c +11 -11
index 25a6ed40d203..6a4dd6d664a0 100644
@@ -43,7 +43,7 @@ void set_working_fdt_addr(ulong addr)
 
 	buf = map_sysmem(addr, 0);
 	working_fdt = buf;
-	env_set_hex("fdtaddr", addr);
+	env_set_hex(ctx_uboot, "fdtaddr", addr);
 }
 
 /*
@@ -52,12 +52,12 @@ void set_working_fdt_addr(ulong addr)
 static int fdt_value_env_set(const void *nodep, int len, const char *var)
 {
 	if (is_printable_string(nodep, len))
-		env_set(var, (void *)nodep);
+		env_set(ctx_uboot, var, (void *)nodep);
 	else if (len == 4) {
 		char buf[11];
 
 		sprintf(buf, "0x%08X", fdt32_to_cpu(*(fdt32_t *)nodep));
-		env_set(var, buf);
+		env_set(ctx_uboot, var, buf);
 	} else if (len%4 == 0 && len <= 20) {
 		/* Needed to print things like sha1 hashes. */
 		char buf[41];
@@ -66,7 +66,7 @@ static int fdt_value_env_set(const void *nodep, int len, const char *var)
 		for (i = 0; i < len; i += sizeof(unsigned int))
 			sprintf(buf + (i * 2), "%08x",
 				*(unsigned int *)(nodep + i));
-		env_set(var, buf);
+		env_set(ctx_uboot, var, buf);
 	} else {
 		printf("error: unprintable value\n");
 		return 1;
@@ -101,7 +101,7 @@ static int fdt_get_header_value(int argc, char * const argv[])
 			continue;
 
 		val = fdt32_to_cpu(fdtp[i]);
-		env_set_hex(argv[3], val);
+		env_set_hex(ctx_uboot, argv[3], val);
 		return CMD_RET_SUCCESS;
 	}
 
@@ -145,7 +145,7 @@ static int do_fdt(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 				return 1;
 			printf("The address of the fdt is %#08lx\n",
 			       control ? (ulong)map_to_sysmem(blob) :
-					env_get_hex("fdtaddr", 0));
+					env_get_hex(ctx_uboot, "fdtaddr", 0));
 			return 0;
 		}
 
@@ -395,7 +395,7 @@ static int do_fdt(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 					node_name = fdt_get_name(working_fdt,
 								 nextNodeOffset,
 								 NULL);
-					env_set(var, node_name);
+					env_set(ctx_uboot, var, node_name);
 					return 0;
 				}
 				nextNodeOffset = fdt_next_node(
@@ -405,7 +405,7 @@ static int do_fdt(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 			}
 			if (subcmd[0] == 's') {
 				/* get the num nodes@this level */
-				env_set_ulong(var, curIndex + 1);
+				env_set_ulong(ctx_uboot, var, curIndex + 1);
 			} else {
 				/* node index not found */
 				printf("libfdt node not found\n");
@@ -416,7 +416,7 @@ static int do_fdt(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 				working_fdt, nodeoffset, prop, &len);
 			if (len == 0) {
 				/* no property value */
-				env_set(var, "");
+				env_set(ctx_uboot, var, "");
 				return 0;
 			} else if (nodep && len > 0) {
 				if (subcmd[0] == 'v') {
@@ -431,13 +431,13 @@ static int do_fdt(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 					char buf[11];
 
 					sprintf(buf, "0x%p", nodep);
-					env_set(var, buf);
+					env_set(ctx_uboot, var, buf);
 				} else if (subcmd[0] == 's') {
 					/* Get size */
 					char buf[11];
 
 					sprintf(buf, "0x%08X", len);
-					env_set(var, buf);
+					env_set(ctx_uboot, var, buf);
 				} else
 					return CMD_RET_USAGE;
 				return 0;
cmd/fpga.c +2 -2
index b1c7b5453b3b..caa86dfdb298 100644
@@ -18,7 +18,7 @@
 static long do_fpga_get_device(char *arg)
 {
 	long dev = FPGA_INVALID_DEVICE;
-	char *devstr = env_get("fpga");
+	char *devstr = env_get(ctx_uboot, "fpga");
 
 	if (devstr)
 		/* Should be strtol to handle -1 cases */
@@ -239,7 +239,7 @@ static int do_fpga_loadmk(cmd_tbl_t *cmdtp, int flag, int argc,
 	ulong fit_addr;
 #endif
 	ulong dev = do_fpga_get_device(argv[0]);
-	char *datastr = env_get("fpgadata");
+	char *datastr = env_get(ctx_uboot, "fpgadata");
 
 	debug("fpga: argc %x, dev %lx, datastr %s\n", argc, dev, datastr);
 
cmd/gpt.c +4 -4
index 0c4349f4b249..c8c5a32e87a5 100644
@@ -55,14 +55,14 @@ static int extract_env(const char *str, char **env)
 	memset(s + strlen(s) - 1, '\0', 1);
 	memmove(s, s + 2, strlen(s) - 1);
 
-	e = env_get(s);
+	e = env_get(ctx_uboot, s);
 	if (e == NULL) {
 #ifdef CONFIG_RANDOM_UUID
 		debug("%s unset. ", str);
 		gen_rand_uuid_str(uuid_str, UUID_STR_FORMAT_GUID);
-		env_set(s, uuid_str);
+		env_set(ctx_uboot, s, uuid_str);
 
-		e = env_get(s);
+		e = env_get(ctx_uboot, s);
 		if (e) {
 			debug("Set to random.\n");
 			ret = 0;
@@ -625,7 +625,7 @@ static int do_disk_guid(struct blk_desc *dev_desc, char * const namestr)
 		return CMD_RET_FAILURE;
 
 	if (namestr)
-		env_set(namestr, disk_guid);
+		env_set(ctx_uboot, namestr, disk_guid);
 	else
 		printf("%s\n", disk_guid);
 
cmd/ini.c +3 -3
index 0c425262d0e7..4cecaca09560 100644
@@ -218,7 +218,7 @@ static int ini_handler(void *user, char *section, char *name, char *value)
 		for (i = 0; i < strlen(value); i++)
 			value[i] = tolower(value[i]);
 #endif
-		env_set(name, value);
+		env_set(ctx_uboot, name, value);
 		printf("ini: Imported %s as %s\n", name, value);
 	}
 
@@ -237,9 +237,9 @@ static int do_ini(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 
 	section = argv[1];
 	file_address = (char *)simple_strtoul(
-		argc < 3 ? env_get("loadaddr") : argv[2], NULL, 16);
+		argc < 3 ? env_get(ctx_uboot, "loadaddr") : argv[2], NULL, 16);
 	file_size = (size_t)simple_strtoul(
-		argc < 4 ? env_get("filesize") : argv[3], NULL, 16);
+		argc < 4 ? env_get(ctx_uboot, "filesize") : argv[3], NULL, 16);
 
 	return ini_parse(file_address, file_size, ini_handler, (void *)section);
 }
cmd/itest.c +1 -1
index 8b630d71e62d..7ffeea01ba79 100644
@@ -101,7 +101,7 @@ static char * evalstr(char *s)
 			i++;
 		}
 		s[i] = 0;
-		return  env_get((const char *)&s[2]);
+		return  env_get(ctx_uboot, (const char *)&s[2]);
 	} else {
 		return s;
 	}
cmd/jffs2.c +2 -2
index b47cd3d98930..af9af57d4c12 100644
@@ -479,7 +479,7 @@ int do_jffs2_fsload(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	ulong offset = load_addr;
 
 	/* pre-set Boot file name */
-	filename = env_get("bootfile");
+	filename = env_get(ctx_uboot, "bootfile");
 	if (!filename)
 		filename = "uImage";
 
@@ -512,7 +512,7 @@ int do_jffs2_fsload(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 		if (size > 0) {
 			printf("### %s load complete: %d bytes loaded to 0x%lx\n",
 				fsname, size, offset);
-			env_set_hex("filesize", size);
+			env_set_hex(ctx_uboot, "filesize", size);
 		} else {
 			printf("### %s LOAD ERROR<%x> for %s!\n", fsname, size, filename);
 		}
cmd/load.c +5 -5
index 713fe56b5557..7770311d314f 100644
@@ -50,7 +50,7 @@ static int do_load_serial(cmd_tbl_t *cmdtp, int flag, int argc,
 	load_baudrate = current_baudrate = gd->baudrate;
 #endif
 
-	env_echo = env_get("loads_echo");
+	env_echo = env_get(ctx_uboot, "loads_echo");
 	if (env_echo && *env_echo == '1')
 		do_echo = 1;
 	else
@@ -182,7 +182,7 @@ static ulong load_serial(long offset)
 			    start_addr, end_addr, size, size
 		    );
 		    flush_cache(start_addr, size);
-		    env_set_hex("filesize", size);
+		    env_set_hex(ctx_uboot, "filesize", size);
 		    return (addr);
 		case SREC_START:
 		    break;
@@ -427,7 +427,7 @@ static int do_load_serial_bin(cmd_tbl_t *cmdtp, int flag, int argc,
 	offset = CONFIG_SYS_LOAD_ADDR;
 
 	/* pre-set offset from $loadaddr */
-	s = env_get("loadaddr");
+	s = env_get(ctx_uboot, "loadaddr");
 	if (s)
 		offset = simple_strtoul(s, NULL, 16);
 
@@ -529,7 +529,7 @@ static ulong load_serial_bin(ulong offset)
 	flush_cache(offset, size);
 
 	printf("## Total Size      = 0x%08x = %d Bytes\n", size, size);
-	env_set_hex("filesize", size);
+	env_set_hex(ctx_uboot, "filesize", size);
 
 	return offset;
 }
@@ -1000,7 +1000,7 @@ static ulong load_serial_ymodem(ulong offset, int mode)
 	flush_cache(offset, ALIGN(size, ARCH_DMA_MINALIGN));
 
 	printf("## Total Size      = 0x%08x = %d Bytes\n", size, size);
-	env_set_hex("filesize", size);
+	env_set_hex(ctx_uboot, "filesize", size);
 
 	return offset;
 }
cmd/lzmadec.c +1 -1
index e3b9cc75ac2b..2c9c2fe52d33 100644
@@ -42,7 +42,7 @@ static int do_lzmadec(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
 		return 1;
 	printf("Uncompressed size: %ld = %#lX\n", (ulong)src_len,
 	       (ulong)src_len);
-	env_set_hex("filesize", src_len);
+	env_set_hex(ctx_uboot, "filesize", src_len);
 
 	return 0;
 }
cmd/md5sum.c +2 -2
index 63cbae0364c1..b1ffb298de55 100644
@@ -35,7 +35,7 @@ static void store_result(const u8 *sum, const char *dest)
 			sprintf(str_ptr, "%02x", sum[i]);
 			str_ptr += 2;
 		}
-		env_set(dest, str_output);
+		env_set(ctx_uboot, dest, str_output);
 	}
 }
 
@@ -54,7 +54,7 @@ static int parse_verify_sum(char *verify_str, u8 *vsum)
 		if (strlen(verify_str) == 32)
 			vsum_str = verify_str;
 		else {
-			vsum_str = env_get(verify_str);
+			vsum_str = env_get(ctx_uboot, verify_str);
 			if (vsum_str == NULL || strlen(vsum_str) != 32)
 				return 1;
 		}
cmd/mtdparts.c +21 -20

120 lines not on this page · raw message

cmd/mvebu/bubt.c +1 -1
index 84d2d531f0d4..c7fc3a7ef4e4 100644
@@ -98,7 +98,7 @@ static ulong get_load_addr(void)
 	const char *addr_str;
 	unsigned long addr;
 
-	addr_str = env_get("loadaddr");
+	addr_str = env_get(ctx_uboot, "loadaddr");
 	if (addr_str)
 		addr = simple_strtoul(addr_str, NULL, 16);
 	else
cmd/nand.c +6 -6
index 27efef20bc95..ba9c1071f5b5 100644
@@ -306,9 +306,9 @@ static void nand_print_and_set_info(int idx)
 	printf("  bbt options 0x%08x\n", chip->bbt_options);
 
 	/* Set geometry info */
-	env_set_hex("nand_writesize", mtd->writesize);
-	env_set_hex("nand_oobsize", mtd->oobsize);
-	env_set_hex("nand_erasesize", mtd->erasesize);
+	env_set_hex(ctx_uboot, "nand_writesize", mtd->writesize);
+	env_set_hex(ctx_uboot, "nand_oobsize", mtd->oobsize);
+	env_set_hex(ctx_uboot, "nand_erasesize", mtd->erasesize);
 }
 
 static int raw_access(struct mtd_info *mtd, ulong addr, loff_t off,
@@ -384,7 +384,7 @@ static int do_nand(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 #else
 	int quiet = 0;
 #endif
-	const char *quiet_str = env_get("quiet");
+	const char *quiet_str = env_get(ctx_uboot, "quiet");
 	int dev = nand_curr_device;
 	int repeat = flag & CMD_FLAG_REPEAT;
 
@@ -967,11 +967,11 @@ static int do_nandboot(cmd_tbl_t *cmdtp, int flag, int argc,
 	switch (argc) {
 	case 1:
 		addr = CONFIG_SYS_LOAD_ADDR;
-		boot_device = env_get("bootdevice");
+		boot_device = env_get(ctx_uboot, "bootdevice");
 		break;
 	case 2:
 		addr = simple_strtoul(argv[1], NULL, 16);
-		boot_device = env_get("bootdevice");
+		boot_device = env_get(ctx_uboot, "bootdevice");
 		break;
 	case 3:
 		addr = simple_strtoul(argv[1], NULL, 16);
cmd/net.c +24 -22

142 lines not on this page · raw message

cmd/part.c +3 -3
index 6cfb67b27959..eb1b782901bf 100644
@@ -44,7 +44,7 @@ static int do_part_uuid(int argc, char * const argv[])
 		return 1;
 
 	if (argc > 2)
-		env_set(argv[2], info.uuid);
+		env_set(ctx_uboot, argv[2], info.uuid);
 	else
 		printf("%s\n", info.uuid);
 
@@ -105,7 +105,7 @@ static int do_part_list(int argc, char * const argv[])
 			sprintf(t, "%s%x", str[0] ? " " : "", p);
 			strcat(str, t);
 		}
-		env_set(var, str);
+		env_set(ctx_uboot, var, str);
 		return 0;
 	}
 
@@ -160,7 +160,7 @@ static int do_part_info(int argc, char * const argv[], enum cmd_part_info param)
 	}
 
 	if (argc > 3)
-		env_set(argv[3], buf);
+		env_set(ctx_uboot, argv[3], buf);
 	else
 		printf("%s\n", buf);
 
cmd/pxe.c +18 -15
index 205997544623..e26162d01dc8 100644
@@ -46,7 +46,7 @@ static char *from_env(const char *envvar)
 {
 	char *ret;
 
-	ret = env_get(envvar);
+	ret = env_get(ctx_uboot, envvar);
 
 	if (!ret)
 		printf("missing environment variable: %s\n", envvar);
@@ -601,7 +601,7 @@ static int label_localboot(struct pxe_label *label)
 		char bootargs[CONFIG_SYS_CBSIZE];
 
 		cli_simple_process_macros(label->append, bootargs);
-		env_set("bootargs", bootargs);
+		env_set(ctx_uboot, "bootargs", bootargs);
 	}
 
 	debug("running: %s\n", localcmd);
@@ -660,9 +660,10 @@ static int label_boot(cmd_tbl_t *cmdtp, struct pxe_label *label)
 		}
 
 		bootm_argv[2] = initrd_str;
-		strncpy(bootm_argv[2], env_get("ramdisk_addr_r"), 18);
+		strncpy(bootm_argv[2], env_get(ctx_uboot, "ramdisk_addr_r"),
+			18);
 		strcat(bootm_argv[2], ":");
-		strncat(bootm_argv[2], env_get("filesize"), 9);
+		strncat(bootm_argv[2], env_get(ctx_uboot, "filesize"), 9);
 	}
 
 	if (get_relfile_envaddr(cmdtp, label->kernel, "kernel_addr_r") < 0) {
@@ -673,8 +674,10 @@ static int label_boot(cmd_tbl_t *cmdtp, struct pxe_label *label)
 
 	if (label->ipappend & 0x1) {
 		sprintf(ip_str, " ip=%s:%s:%s:%s",
-			env_get("ipaddr"), env_get("serverip"),
-			env_get("gatewayip"), env_get("netmask"));
+			env_get(ctx_uboot, "ipaddr"),
+			env_get(ctx_uboot, "serverip"),
+			env_get(ctx_uboot, "gatewayip"),
+			env_get(ctx_uboot, "netmask"));
 	}
 
 #ifdef CONFIG_CMD_NET
@@ -706,12 +709,12 @@ static int label_boot(cmd_tbl_t *cmdtp, struct pxe_label *label)
 			strcat(bootargs, mac_str);
 
 			cli_simple_process_macros(bootargs, finalbootargs);
-			env_set("bootargs", finalbootargs);
+			env_set(ctx_uboot, "bootargs", finalbootargs);
 			printf("append: %s\n", finalbootargs);
 		}
 	}
 
-	bootm_argv[1] = env_get("kernel_addr_r");
+	bootm_argv[1] = env_get(ctx_uboot, "kernel_addr_r");
 	/* for FIT, append the configuration identifier */
 	if (label->config) {
 		int len = strlen(bootm_argv[1]) + strlen(label->config) + 1;
@@ -738,7 +741,7 @@ static int label_boot(cmd_tbl_t *cmdtp, struct pxe_label *label)
 	 *
 	 * Scenario 3: fdt blob is not available.
 	 */
-	bootm_argv[3] = env_get("fdt_addr_r");
+	bootm_argv[3] = env_get(ctx_uboot, "fdt_addr_r");
 
 	/* if fdt label is defined then get fdt from server */
 	if (bootm_argv[3]) {
@@ -750,7 +753,7 @@ static int label_boot(cmd_tbl_t *cmdtp, struct pxe_label *label)
 		} else if (label->fdtdir) {
 			char *f1, *f2, *f3, *f4, *slash;
 
-			f1 = env_get("fdtfile");
+			f1 = env_get(ctx_uboot, "fdtfile");
 			if (f1) {
 				f2 = "";
 				f3 = "";
@@ -763,9 +766,9 @@ static int label_boot(cmd_tbl_t *cmdtp, struct pxe_label *label)
 				 * or the boot scripts should set $fdtfile
 				 * before invoking "pxe" or "sysboot".
 				 */
-				f1 = env_get("soc");
+				f1 = env_get(ctx_uboot, "soc");
 				f2 = "-";
-				f3 = env_get("board");
+				f3 = env_get(ctx_uboot, "board");
 				f4 = ".dtb";
 			}
 
@@ -805,7 +808,7 @@ static int label_boot(cmd_tbl_t *cmdtp, struct pxe_label *label)
 	}
 
 	if (!bootm_argv[3])
-		bootm_argv[3] = env_get("fdt_addr");
+		bootm_argv[3] = env_get(ctx_uboot, "fdt_addr");
 
 	if (bootm_argv[3]) {
 		if (!bootm_argv[2])
@@ -1746,10 +1749,10 @@ static int do_sysboot(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	}
 
 	if (argc < 6)
-		filename = env_get("bootfile");
+		filename = env_get(ctx_uboot, "bootfile");
 	else {
 		filename = argv[5];
-		env_set("bootfile", filename);
+		env_set(ctx_uboot, "bootfile", filename);
 	}
 
 	if (strstr(argv[3], "ext2"))
cmd/qfw.c +3 -3
index af826627a217..0063590fe496 100644
@@ -55,7 +55,7 @@ static int qemu_fwcfg_setup_kernel(void *load_addr, void *initrd_addr)
 		 * when invoking qemu), do not update bootargs
 		 */
 		if (*data_addr != '\0') {
-			if (env_set("bootargs", data_addr) < 0)
+			if (env_set(ctx_uboot, "bootargs", data_addr) < 0)
 				printf("warning: unable to change bootargs\n");
 		}
 	}
@@ -123,7 +123,7 @@ static int qemu_fwcfg_do_load(cmd_tbl_t *cmdtp, int flag,
 	void *load_addr;
 	void *initrd_addr;
 
-	env = env_get("loadaddr");
+	env = env_get(ctx_uboot, "loadaddr");
 	load_addr = env ?
 		(void *)simple_strtoul(env, NULL, 16) :
 #ifdef CONFIG_LOADADDR
@@ -132,7 +132,7 @@ static int qemu_fwcfg_do_load(cmd_tbl_t *cmdtp, int flag,
 		NULL;
 #endif
 
-	env = env_get("ramdiskaddr");
+	env = env_get(ctx_uboot, "ramdiskaddr");
 	initrd_addr = env ?
 		(void *)simple_strtoul(env, NULL, 16) :
 #ifdef CONFIG_RAMDISK_ADDR
cmd/reiser.c +4 -4
index 7f51b927a475..af2100558982 100644
@@ -88,18 +88,18 @@ int do_reiserload (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 
 	switch (argc) {
 	case 3:
-		addr_str = env_get("loadaddr");
+		addr_str = env_get(ctx_uboot, "loadaddr");
 		if (addr_str != NULL) {
 			addr = simple_strtoul (addr_str, NULL, 16);
 		} else {
 			addr = CONFIG_SYS_LOAD_ADDR;
 		}
-		filename = env_get("bootfile");
+		filename = env_get(ctx_uboot, "bootfile");
 		count = 0;
 		break;
 	case 4:
 		addr = simple_strtoul (argv[3], NULL, 16);
-		filename = env_get("bootfile");
+		filename = env_get(ctx_uboot, "bootfile");
 		count = 0;
 		break;
 	case 5:
@@ -157,7 +157,7 @@ int do_reiserload (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	load_addr = addr;
 
 	printf ("\n%ld bytes read\n", filelen);
-	env_set_hex("filesize", filelen);
+	env_set_hex(ctx_uboot, "filesize", filelen);
 
 	return filelen;
 }
cmd/setexpr.c +4 -4
index 0182f1993846..206de37b6f96 100644
@@ -145,7 +145,7 @@ static int regex_sub(const char *name,
 	}
 
 	if (t == NULL) {
-		value = env_get(name);
+		value = env_get(ctx_uboot, name);
 
 		if (value == NULL) {
 			printf("## Error: variable \"%s\" not defined\n", name);
@@ -286,7 +286,7 @@ static int regex_sub(const char *name,
 
 	printf("%s=%s\n", name, data);
 
-	return env_set(name, data);
+	return env_set(ctx_uboot, name, data);
 }
 #endif
 
@@ -314,7 +314,7 @@ static int do_setexpr(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 
 	/* plain assignment: "setexpr name value" */
 	if (argc == 3) {
-		env_set_hex(argv[1], a);
+		env_set_hex(ctx_uboot, argv[1], a);
 		return 0;
 	}
 
@@ -370,7 +370,7 @@ static int do_setexpr(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 		return 1;
 	}
 
-	env_set_hex(argv[1], value);
+	env_set_hex(ctx_uboot, argv[1], value);
 
 	return 0;
 }
cmd/spl.c +3 -2
index 56051b8a4be9..a2008b3d0f37 100644
@@ -119,8 +119,9 @@ static int spl_export(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 		case SPL_EXPORT_FDT:
 			printf("Argument image is now in RAM: 0x%p\n",
 				(void *)images.ft_addr);
-			env_set_addr("fdtargsaddr", images.ft_addr);
-			env_set_hex("fdtargslen", fdt_totalsize(images.ft_addr));
+			env_set_addr(ctx_uboot, "fdtargsaddr", images.ft_addr);
+			env_set_hex(ctx_uboot, "fdtargslen",
+				    fdt_totalsize(images.ft_addr));
 #ifdef CONFIG_CMD_SPL_WRITE_SIZE
 			if (fdt_totalsize(images.ft_addr) >
 			    CONFIG_CMD_SPL_WRITE_SIZE)
cmd/ti/ddr3.c +1 -1
index b82cbe152dc9..6124e4dc8c53 100644
@@ -164,7 +164,7 @@ static void ddr_check_ecc_status(void)
 	int ecc_test = 0;
 	char *env;
 
-	env = env_get("ecc_test");
+	env = env_get(ctx_uboot, "ecc_test");
 	if (env)
 		ecc_test = simple_strtol(env, NULL, 0);
 
cmd/tpm-common.c +1 -1
index 38900fb1590b..1ddf77a6a07b 100644
@@ -224,7 +224,7 @@ int type_string_write_vars(const char *type_str, u8 *data,
 		default:
 			return -1;
 		}
-		if (env_set_ulong(*vars, value))
+		if (env_set_ulong(ctx_uboot, *vars, value))
 			return -1;
 	}
 
cmd/tpm-v1.c +1 -1
index 2807331524aa..5cb50c58f8c9 100644
@@ -430,7 +430,7 @@ static int do_tpm_load_key_by_sha1(cmd_tbl_t *cmdtp, int flag, int argc, char *
 				 &key_handle);
 	if (!err) {
 		printf("Key handle is 0x%x\n", key_handle);
-		env_set_hex("key_handle", key_handle);
+		env_set_hex(ctx_uboot, "key_handle", key_handle);
 	}
 
 	return report_return_code(err);
cmd/trace.c +9 -9
index 392b12953617..e7b982a370ef 100644
@@ -16,10 +16,10 @@ static int get_args(int argc, char * const argv[], char **buff,
 	if (argc < 2)
 		return -1;
 	if (argc < 4) {
-		*buff_size = env_get_ulong("profsize", 16, 0);
-		*buff = map_sysmem(env_get_ulong("profbase", 16, 0),
+		*buff_size = env_get_ulong(ctx_uboot, "profsize", 16, 0);
+		*buff = map_sysmem(env_get_ulong(ctx_uboot, "profbase", 16, 0),
 				   *buff_size);
-		*buff_ptr = env_get_ulong("profoffset", 16, 0);
+		*buff_ptr = env_get_ulong(ctx_uboot, "profoffset", 16, 0);
 	} else {
 		*buff_size = simple_strtoul(argv[3], NULL, 16);
 		*buff = map_sysmem(simple_strtoul(argv[2], NULL, 16),
@@ -45,9 +45,9 @@ static int create_func_list(int argc, char * const argv[])
 	used = min(avail, (size_t)needed);
 	printf("Function trace dumped to %08lx, size %#zx\n",
 	       (ulong)map_to_sysmem(buff + buff_ptr), used);
-	env_set_hex("profbase", map_to_sysmem(buff));
-	env_set_hex("profsize", buff_size);
-	env_set_hex("profoffset", buff_ptr + used);
+	env_set_hex(ctx_uboot, "profbase", map_to_sysmem(buff));
+	env_set_hex(ctx_uboot, "profsize", buff_size);
+	env_set_hex(ctx_uboot, "profoffset", buff_ptr + used);
 
 	return 0;
 }
@@ -69,9 +69,9 @@ static int create_call_list(int argc, char * const argv[])
 	printf("Call list dumped to %08lx, size %#zx\n",
 	       (ulong)map_to_sysmem(buff + buff_ptr), used);
 
-	env_set_hex("profbase", map_to_sysmem(buff));
-	env_set_hex("profsize", buff_size);
-	env_set_hex("profoffset", buff_ptr + used);
+	env_set_hex(ctx_uboot, "profbase", map_to_sysmem(buff));
+	env_set_hex(ctx_uboot, "profsize", buff_size);
+	env_set_hex(ctx_uboot, "profoffset", buff_ptr + used);
 
 	return 0;
 }
cmd/ubi.c +1 -1
index ca5dc9021b12..28d2c6b93af0 100644
@@ -387,7 +387,7 @@ int ubi_volume_read(char *volume, char *buf, size_t size)
 	} while (size);
 
 	if (!size)
-		env_set_hex("filesize", len_read);
+		env_set_hex(ctx_uboot, "filesize", len_read);
 
 	free(tbuf);
 	return err;
cmd/unzip.c +1 -1
index afd58e7cdb12..34347f111dc1 100644
@@ -30,7 +30,7 @@ static int do_unzip(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 		return 1;
 
 	printf("Uncompressed size: %lu = 0x%lX\n", src_len, src_len);
-	env_set_hex("filesize", src_len);
+	env_set_hex(ctx_uboot, "filesize", src_len);
 
 	return 0;
 }
cmd/ximg.c +2 -2
index a9481004f036..1726a3978e4d 100644
@@ -252,8 +252,8 @@ do_imgextract(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
 
 	flush_cache(dest, ALIGN(len, ARCH_DMA_MINALIGN));
 
-	env_set_hex("fileaddr", data);
-	env_set_hex("filesize", len);
+	env_set_hex(ctx_uboot, "fileaddr", data);
+	env_set_hex(ctx_uboot, "filesize", len);
 
 	return 0;
 }
cmd/zfs.c +3 -3
index ed5402bb139e..2dc71bb93b44 100644
@@ -51,10 +51,10 @@ static int do_zfs_load(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]
 
 	count = 0;
 	addr = simple_strtoul(argv[3], NULL, 16);
-	filename = env_get("bootfile");
+	filename = env_get(ctx_uboot, "bootfile");
 	switch (argc) {
 	case 3:
-		addr_str = env_get("loadaddr");
+		addr_str = env_get(ctx_uboot, "loadaddr");
 		if (addr_str != NULL)
 			addr = simple_strtoul(addr_str, NULL, 16);
 		else
@@ -115,7 +115,7 @@ static int do_zfs_load(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]
 	load_addr = addr;
 
 	printf("%llu bytes read\n", zfile.size);
-	env_set_hex("filesize", zfile.size);
+	env_set_hex(ctx_uboot, "filesize", zfile.size);
 
 	return 0;
 }
cmd/zip.c +1 -1
index 8ef46e9815f7..73fed730703c 100644
@@ -30,7 +30,7 @@ static int do_zip(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 		return 1;
 
 	printf("Compressed size: %lu = 0x%lX\n", dst_len, dst_len);
-	env_set_hex("filesize", dst_len);
+	env_set_hex(ctx_uboot, "filesize", dst_len);
 
 	return 0;
 }
Signature · 1 line
2.21.0
#15 lore raw

PATCH v5 11/19 common: converted with new env interfaces

In reply to AKASHI Takahiro

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

---
 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 +++---
 27 files changed, 97 insertions(+), 89 deletions(-)
common/autoboot.c +12 -10
index b28bd6823d82..d28ea5f97a62 100644
@@ -71,7 +71,7 @@ static int slow_equals(u8 *a, u8 *b, int len)
  */
 static int passwd_abort_sha256(uint64_t etime)
 {
-	const char *sha_env_str = env_get("bootstopkeysha256");
+	const char *sha_env_str = env_get(ctx_uboot, "bootstopkeysha256");
 	u8 sha_env[SHA256_SUM_LEN];
 	u8 *sha;
 	char *presskey;
@@ -146,8 +146,8 @@ static int passwd_abort_key(uint64_t etime)
 		int retry;
 	}
 	delaykey[] = {
-		{ .str = env_get("bootdelaykey"),  .retry = 1 },
-		{ .str = env_get("bootstopkey"),   .retry = 0 },
+		{ .str = env_get(ctx_uboot, "bootdelaykey"),  .retry = 1 },
+		{ .str = env_get(ctx_uboot, "bootstopkey"),   .retry = 0 },
 	};
 
 	char presskey[MAX_DELAY_STOP_STR];
@@ -308,12 +308,14 @@ static void process_fdt_options(const void *blob)
 	/* Add an env variable to point to a kernel payload, if available */
 	addr = fdtdec_get_config_int(gd->fdt_blob, "kernel-offset", 0);
 	if (addr)
-		env_set_addr("kernaddr", (void *)(CONFIG_SYS_TEXT_BASE + addr));
+		env_set_addr(ctx_uboot, "kernaddr",
+			     (void *)(CONFIG_SYS_TEXT_BASE + addr));
 
 	/* Add an env variable to point to a root disk, if available */
 	addr = fdtdec_get_config_int(gd->fdt_blob, "rootdisk-offset", 0);
 	if (addr)
-		env_set_addr("rootaddr", (void *)(CONFIG_SYS_TEXT_BASE + addr));
+		env_set_addr(ctx_uboot, "rootaddr",
+			     (void *)(CONFIG_SYS_TEXT_BASE + addr));
 #endif /* CONFIG_SYS_TEXT_BASE */
 }
 
@@ -324,7 +326,7 @@ const char *bootdelay_process(void)
 
 	bootcount_inc();
 
-	s = env_get("bootdelay");
+	s = env_get(ctx_uboot, "bootdelay");
 	bootdelay = s ? (int)simple_strtol(s, NULL, 10) : CONFIG_BOOTDELAY;
 
 	if (IS_ENABLED(CONFIG_OF_CONTROL))
@@ -339,13 +341,13 @@ const char *bootdelay_process(void)
 
 #ifdef CONFIG_POST
 	if (gd->flags & GD_FLG_POSTFAIL) {
-		s = env_get("failbootcmd");
+		s = env_get(ctx_uboot, "failbootcmd");
 	} else
 #endif /* CONFIG_POST */
 	if (bootcount_error())
-		s = env_get("altbootcmd");
+		s = env_get(ctx_uboot, "altbootcmd");
 	else
-		s = env_get("bootcmd");
+		s = env_get(ctx_uboot, "bootcmd");
 
 	if (IS_ENABLED(CONFIG_OF_CONTROL))
 		process_fdt_options(gd->fdt_blob);
@@ -375,7 +377,7 @@ void autoboot_command(const char *s)
 
 	if (IS_ENABLED(CONFIG_USE_AUTOBOOT_MENUKEY) &&
 	    menukey == AUTOBOOT_MENUKEY) {
-		s = env_get("menucmd");
+		s = env_get(ctx_uboot, "menucmd");
 		if (s)
 			run_command_list(s, -1, 0);
 	}
common/board_f.c +2 -1
index 6867abc8e679..cb0ccdd80cab 100644
@@ -122,7 +122,8 @@ __weak void board_add_ram_info(int use_default)
 
 static int init_baud_rate(void)
 {
-	gd->baudrate = env_get_ulong("baudrate", 10, CONFIG_BAUDRATE);
+	gd->baudrate = env_get_ulong(ctx_uboot, "baudrate", 10,
+				     CONFIG_BAUDRATE);
 	return 0;
 }
 
common/board_r.c +5 -5
index b7f68bba4a7e..b2941c58599d 100644
@@ -448,14 +448,14 @@ static int initr_env(void)
 	if (should_load_env())
 		env_relocate();
 	else
-		env_set_default(NULL, 0);
+		env_set_default(ctx_uboot, NULL, 0);
 #ifdef CONFIG_OF_CONTROL
-	env_set_hex("fdtcontroladdr",
+	env_set_hex(ctx_uboot, "fdtcontroladdr",
 		    (unsigned long)map_to_sysmem(gd->fdt_blob));
 #endif
 
 	/* Initialize from environment */
-	load_addr = env_get_ulong("loadaddr", 16, load_addr);
+	load_addr = env_get_ulong(ctx_uboot, "loadaddr", 16, load_addr);
 
 	return 0;
 }
@@ -607,9 +607,9 @@ int initr_mem(void)
 	ulong pram = 0;
 	char memsz[32];
 
-	pram = env_get_ulong("pram", 10, CONFIG_PRAM);
+	pram = env_get_ulong(ctx_uboot, "pram", 10, CONFIG_PRAM);
 	sprintf(memsz, "%ldk", (long int)((gd->ram_size / 1024) - pram));
-	env_set("mem", memsz);
+	env_set(ctx_uboot, "mem", memsz);
 
 	return 0;
 }
common/bootm.c +7 -5
index 02295daf79f1..c367b409f29d 100644
@@ -440,7 +440,7 @@ static void fixup_silent_linux(void)
 {
 	char *buf;
 	const char *env_val;
-	char *cmdline = env_get("bootargs");
+	char *cmdline = env_get(ctx_uboot, "bootargs");
 	int want_silent;
 
 	/*
@@ -485,7 +485,7 @@ static void fixup_silent_linux(void)
 		env_val = CONSOLE_ARG;
 	}
 
-	env_set("bootargs", env_val);
+	env_set(ctx_uboot, "bootargs", env_val);
 	debug("after silent fix-up: %s\n", env_val);
 	free(buf);
 }
@@ -556,8 +556,10 @@ int do_bootm_states(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[],
 		ret = boot_ramdisk_high(&images->lmb, images->rd_start,
 			rd_len, &images->initrd_start, &images->initrd_end);
 		if (!ret) {
-			env_set_hex("initrd_start", images->initrd_start);
-			env_set_hex("initrd_end", images->initrd_end);
+			env_set_hex(ctx_uboot, "initrd_start",
+				    images->initrd_start);
+			env_set_hex(ctx_uboot, "initrd_end",
+				    images->initrd_end);
 		}
 	}
 #endif
@@ -602,7 +604,7 @@ int do_bootm_states(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[],
 #ifdef CONFIG_TRACE
 	/* Pretend to run the OS, then run a user command */
 	if (!ret && (states & BOOTM_STATE_OS_FAKE_GO)) {
-		char *cmd_list = env_get("fakegocmd");
+		char *cmd_list = env_get(ctx_uboot, "fakegocmd");
 
 		ret = boot_selected_os(argc, argv, BOOTM_STATE_OS_FAKE_GO,
 				images, boot_fn);
common/bootm_os.c +6 -6
index 6fb7d658da69..19b728d2cc7c 100644
@@ -22,9 +22,9 @@ static int do_bootm_standalone(int flag, int argc, char * const argv[],
 	int (*appl)(int, char *const[]);
 
 	/* Don't start if "autostart" is set to "no" */
-	s = env_get("autostart");
+	s = env_get(ctx_uboot, "autostart");
 	if ((s != NULL) && !strcmp(s, "no")) {
-		env_set_hex("filesize", images->os.image_len);
+		env_set_hex(ctx_uboot, "filesize", images->os.image_len);
 		return 0;
 	}
 	appl = (int (*)(int, char * const []))images->ep;
@@ -97,7 +97,7 @@ static int do_bootm_netbsd(int flag, int argc, char * const argv[],
 		cmdline = malloc(len);
 		copy_args(cmdline, argc, argv, ' ');
 	} else {
-		cmdline = env_get("bootargs");
+		cmdline = env_get(ctx_uboot, "bootargs");
 		if (cmdline == NULL)
 			cmdline = "";
 	}
@@ -228,14 +228,14 @@ static int do_bootm_plan9(int flag, int argc, char * const argv[],
 #endif
 
 	/* See README.plan9 */
-	s = env_get("confaddr");
+	s = env_get(ctx_uboot, "confaddr");
 	if (s != NULL) {
 		char *confaddr = (char *)simple_strtoul(s, NULL, 16);
 
 		if (argc > 0) {
 			copy_args(confaddr, argc, argv, '\n');
 		} else {
-			s = env_get("bootargs");
+			s = env_get(ctx_uboot, "bootargs");
 			if (s != NULL)
 				strcpy(confaddr, s);
 		}
@@ -282,7 +282,7 @@ static void do_bootvx_fdt(bootm_headers_t *images)
 
 		ret = fdt_add_subnode(*of_flat_tree, 0, "chosen");
 		if ((ret >= 0 || ret == -FDT_ERR_EXISTS)) {
-			bootline = env_get("bootargs");
+			bootline = env_get(ctx_uboot, "bootargs");
 			if (bootline) {
 				ret = fdt_find_and_setprop(*of_flat_tree,
 						"/chosen", "bootargs",
common/bootretry.c +1 -1
index 47aaaa82201e..ede7613fb9ce 100644
@@ -23,7 +23,7 @@ static int      retry_time = -1; /* -1 so can call readline before main_loop */
  */
 void bootretry_init_cmd_timeout(void)
 {
-	char *s = env_get("bootretry");
+	char *s = env_get(ctx_uboot, "bootretry");
 
 	if (s != NULL)
 		retry_time = (int)simple_strtol(s, NULL, 10);
common/cli.c +1 -1
index 49b910666b9f..4c588f862b5d 100644
@@ -129,7 +129,7 @@ int do_run(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	for (i = 1; i < argc; ++i) {
 		char *arg;
 
-		arg = env_get(argv[i]);
+		arg = env_get(ctx_uboot, argv[i]);
 		if (arg == NULL) {
 			printf("## Error: \"%s\" not defined\n", argv[i]);
 			return 1;
common/cli_hush.c +7 -7
index 8f86e4aa4a49..cf2306b76e66 100644
@@ -560,7 +560,7 @@ static int builtin_cd(struct child_prog *child)
 {
 	char *newdir;
 	if (child->argv[1] == NULL)
-		newdir = env_get("HOME");
+		newdir = env_get(ctx_uboot, "HOME");
 	else
 		newdir = child->argv[1];
 	if (chdir(newdir)) {
@@ -948,7 +948,7 @@ static inline void cmdedit_set_initial_prompt(void)
 #ifndef CONFIG_FEATURE_SH_FANCY_PROMPT
 	PS1 = NULL;
 #else
-	PS1 = env_get("PS1");
+	PS1 = env_get(ctx_uboot, "PS1");
 	if(PS1==0)
 		PS1 = "\\w \\$ ";
 #endif
@@ -987,9 +987,9 @@ static int uboot_cli_readline(struct in_str *i)
 
 #ifdef CONFIG_CMDLINE_PS_SUPPORT
 	if (i->promptmode == 1)
-		ps_prompt = env_get("PS1");
+		ps_prompt = env_get(ctx_uboot, "PS1");
 	else
-		ps_prompt = env_get("PS2");
+		ps_prompt = env_get(ctx_uboot, "PS2");
 	if (ps_prompt)
 		prompt = ps_prompt;
 #endif
@@ -2172,7 +2172,7 @@ int set_local_var(const char *s, int flg_export)
 	name=strdup(s);
 
 #ifdef __U_BOOT__
-	if (env_get(name) != NULL) {
+	if (env_get(ctx_uboot, name)) {
 		printf ("ERROR: "
 				"There is a global environment variable with the same name.\n");
 		free(name);
@@ -2793,7 +2793,7 @@ static char *lookup_param(char *src)
 		}
 	}
 
-	p = env_get(src);
+	p = env_get(ctx_uboot, src);
 	if (!p)
 		p = get_local_var(src);
 
@@ -3157,7 +3157,7 @@ static void mapset(const unsigned char *set, int code)
 static void update_ifs_map(void)
 {
 	/* char *ifs and char map[256] are both globals. */
-	ifs = (uchar *)env_get("IFS");
+	ifs = (uchar *)env_get(ctx_uboot, "IFS");
 	if (ifs == NULL) ifs=(uchar *)" \t\n";
 	/* Precompute a list of 'flow through' behavior so it can be treated
 	 * quickly up front.  Computation is necessary because of IFS.
common/cli_simple.c +1 -1
index 6c881c133c61..4c04667faa6e 100644
@@ -131,7 +131,7 @@ void cli_simple_process_macros(const char *input, char *output)
 				envname[i] = 0;
 
 				/* Get its value */
-				envval = env_get(envname);
+				envval = env_get(ctx_uboot, envname);
 
 				/* Copy into the line if it exists */
 				if (envval != NULL)
common/command.c +1 -1
index 4b887a267fb6..736bedfbdeac 100644
@@ -583,7 +583,7 @@ enum command_ret_t cmd_process(int flag, int argc, char * const argv[],
 #if defined(CONFIG_SYS_XTRACE)
 	char *xtrace;
 
-	xtrace = env_get("xtrace");
+	xtrace = env_get(ctx_uboot, "xtrace");
 	if (xtrace) {
 		puts("+");
 		for (int i = 0; i < argc; i++) {
common/console.c +7 -7
index 89b1e9590cad..5888a6aade08 100644
@@ -736,7 +736,7 @@ int console_assign(int file, const char *devname)
 static bool console_update_silent(void)
 {
 #ifdef CONFIG_SILENT_CONSOLE
-	if (env_get("silent")) {
+	if (env_get(ctx_uboot, "silent")) {
 		gd->flags |= GD_FLG_SILENT;
 	} else {
 		unsigned long flags = gd->flags;
@@ -829,9 +829,9 @@ int console_init_r(void)
 
 	/* stdin stdout and stderr are in environment */
 	/* scan for it */
-	stdinname  = env_get("stdin");
-	stdoutname = env_get("stdout");
-	stderrname = env_get("stderr");
+	stdinname  = env_get(ctx_uboot, "stdin");
+	stdoutname = env_get(ctx_uboot, "stdout");
+	stderrname = env_get(ctx_uboot, "stderr");
 
 	if (OVERWRITE_CONSOLE == 0) {	/* if not overwritten by config switch */
 		inputdev  = search_device(DEV_FLAGS_INPUT,  stdinname);
@@ -885,7 +885,7 @@ done:
 #ifdef CONFIG_SYS_CONSOLE_ENV_OVERWRITE
 	/* set the environment variables (will overwrite previous env settings) */
 	for (i = 0; i < MAX_FILES; i++) {
-		env_set(stdio_names[i], stdio_devices[i]->name);
+		env_set(ctx_uboot, stdio_names[i], stdio_devices[i]->name);
 	}
 #endif /* CONFIG_SYS_CONSOLE_ENV_OVERWRITE */
 
@@ -925,7 +925,7 @@ int console_init_r(void)
 	 * console to serial console in this case or suppress it if
 	 * "silent" mode was requested.
 	 */
-	if (env_get("splashimage") != NULL) {
+	if (env_get(ctx_uboot, "splashimage")) {
 		if (!(gd->flags & GD_FLG_SILENT))
 			outputdev = search_device (DEV_FLAGS_OUTPUT, "serial");
 	}
@@ -969,7 +969,7 @@ int console_init_r(void)
 
 	/* Setting environment variables */
 	for (i = 0; i < MAX_FILES; i++) {
-		env_set(stdio_names[i], stdio_devices[i]->name);
+		env_set(ctx_uboot, stdio_names[i], stdio_devices[i]->name);
 	}
 
 	gd->flags |= GD_FLG_DEVINIT;	/* device initialization completed */
common/fdt_support.c +3 -3
index baf7924ff612..023e2acb5b71 100644
@@ -197,7 +197,7 @@ int fdt_root(void *fdt)
 		return err;
 	}
 
-	serial = env_get("serial#");
+	serial = env_get(ctx_uboot, "serial#");
 	if (serial) {
 		err = fdt_setprop(fdt, 0, "serial-number", serial,
 				  strlen(serial) + 1);
@@ -289,7 +289,7 @@ int fdt_chosen(void *fdt)
 	if (nodeoffset < 0)
 		return nodeoffset;
 
-	str = env_get("bootargs");
+	str = env_get(ctx_uboot, "bootargs");
 	if (str) {
 		err = fdt_setprop(fdt, nodeoffset, "bootargs", str,
 				  strlen(str) + 1);
@@ -533,7 +533,7 @@ void fdt_fixup_ethernet(void *fdt)
 				continue;
 			i++;
 #endif
-			tmp = env_get(mac);
+			tmp = env_get(ctx_uboot, mac);
 			if (!tmp)
 				continue;
 
common/hash.c +2 -2
index d33e329897e1..b87402ac1e4f 100644
@@ -331,7 +331,7 @@ static void store_result(struct hash_algo *algo, const uint8_t *sum,
 			str_ptr += 2;
 		}
 		*str_ptr = '\0';
-		env_set(dest, str_output);
+		env_set(ctx_uboot, dest, str_output);
 	} else {
 		ulong addr;
 		void *buf;
@@ -391,7 +391,7 @@ static int parse_verify_sum(struct hash_algo *algo, char *verify_str,
 		if (strlen(verify_str) == digits)
 			vsum_str = verify_str;
 		else {
-			vsum_str = env_get(verify_str);
+			vsum_str = env_get(ctx_uboot, verify_str);
 			if (vsum_str == NULL || strlen(vsum_str) != digits) {
 				printf("Expected %d hex digits in env var\n",
 				       digits);
common/hwconfig.c +3 -2
index 72f3c4e0faa6..5d2fdea9c91f 100644
@@ -81,7 +81,7 @@ static const char *__hwconfig(const char *opt, size_t *arglen,
 					"and before environment is ready\n");
 			return NULL;
 		}
-		env_hwconfig = env_get("hwconfig");
+		env_hwconfig = env_get(ctx_uboot, "hwconfig");
 	}
 
 	if (env_hwconfig) {
@@ -243,7 +243,8 @@ int main()
 	const char *ret;
 	size_t len;
 
-	env_set("hwconfig", "key1:subkey1=value1,subkey2=value2;key2:value3;;;;"
+	env_set(ctx_uboot, "hwconfig",
+		"key1:subkey1=value1,subkey2=value2;key2:value3;;;;"
 			   "key3;:,:=;key4", 1);
 
 	ret = hwconfig_arg("key1", &len);
common/image-android.c +2 -2
index 264bf90007e9..5d47c955df76 100644
@@ -75,7 +75,7 @@ int android_image_get_kernel(const struct andr_img_hdr *hdr, int verify,
 		len += strlen(hdr->cmdline);
 	}
 
-	char *bootargs = env_get("bootargs");
+	char *bootargs = env_get(ctx_uboot, "bootargs");
 	if (bootargs)
 		len += strlen(bootargs);
 
@@ -93,7 +93,7 @@ int android_image_get_kernel(const struct andr_img_hdr *hdr, int verify,
 	if (*hdr->cmdline)
 		strcat(newbootargs, hdr->cmdline);
 
-	env_set("bootargs", newbootargs);
+	env_set(ctx_uboot, "bootargs", newbootargs);
 
 	if (os_data) {
 		if (image_get_magic(ihdr) == IH_MAGIC) {
common/image-fdt.c +2 -2
index 4247dcee0c4f..f735b3a02ff0 100644
@@ -172,7 +172,7 @@ int boot_relocate_fdt(struct lmb *lmb, char **of_flat_tree, ulong *of_size)
 	of_len = *of_size + CONFIG_SYS_FDT_PAD;
 
 	/* If fdt_high is set use it to select the relocation address */
-	fdt_high = env_get("fdt_high");
+	fdt_high = env_get(ctx_uboot, "fdt_high");
 	if (fdt_high) {
 		void *desired_addr = (void *)simple_strtoul(fdt_high, NULL, 16);
 
@@ -470,7 +470,7 @@ int boot_get_fdt(int flag, int argc, char * const argv[], uint8_t arch,
 
 			debug("## Using FDT in Android image second area\n");
 		} else {
-			fdt_addr = env_get_hex("fdtaddr", 0);
+			fdt_addr = env_get_hex(ctx_uboot, "fdtaddr", 0);
 			if (!fdt_addr)
 				goto no_fdt;
 
common/image.c +8 -7
index 645584b5ba22..fca910ac5019 100644
@@ -573,7 +573,7 @@ U_BOOT_ENV_CALLBACK(loadaddr, on_loadaddr);
 
 ulong env_get_bootm_low(void)
 {
-	char *s = env_get("bootm_low");
+	char *s = env_get(ctx_uboot, "bootm_low");
 	if (s) {
 		ulong tmp = simple_strtoul(s, NULL, 16);
 		return tmp;
@@ -592,7 +592,7 @@ phys_size_t env_get_bootm_size(void)
 {
 	phys_size_t tmp, size;
 	phys_addr_t start;
-	char *s = env_get("bootm_size");
+	char *s = env_get(ctx_uboot, "bootm_size");
 	if (s) {
 		tmp = (phys_size_t)simple_strtoull(s, NULL, 16);
 		return tmp;
@@ -606,7 +606,7 @@ phys_size_t env_get_bootm_size(void)
 	size = gd->bd->bi_memsize;
 #endif
 
-	s = env_get("bootm_low");
+	s = env_get(ctx_uboot, "bootm_low");
 	if (s)
 		tmp = (phys_size_t)simple_strtoull(s, NULL, 16);
 	else
@@ -618,7 +618,7 @@ phys_size_t env_get_bootm_size(void)
 phys_size_t env_get_bootm_mapsize(void)
 {
 	phys_size_t tmp;
-	char *s = env_get("bootm_mapsize");
+	char *s = env_get(ctx_uboot, "bootm_mapsize");
 	if (s) {
 		tmp = (phys_size_t)simple_strtoull(s, NULL, 16);
 		return tmp;
@@ -1070,7 +1070,8 @@ int boot_get_ramdisk(int argc, char * const argv[], bootm_headers_t *images,
 	 */
 	buf = map_sysmem(images->os.start, 0);
 	if (buf && genimg_get_format(buf) == IMAGE_FORMAT_ANDROID)
-		select = (argc == 0) ? env_get("loadaddr") : argv[0];
+		select = (argc == 0) ? env_get(ctx_uboot, "loadaddr")
+					: argv[0];
 #endif
 
 	if (argc >= 2)
@@ -1257,7 +1258,7 @@ int boot_ramdisk_high(struct lmb *lmb, ulong rd_data, ulong rd_len,
 	ulong	initrd_high;
 	int	initrd_copy_to_ram = 1;
 
-	s = env_get("initrd_high");
+	s = env_get(ctx_uboot, "initrd_high");
 	if (s) {
 		/* a value of "no" or a similar string will act like 0,
 		 * turning the "load high" feature off. This is intentional.
@@ -1548,7 +1549,7 @@ int boot_get_cmdline(struct lmb *lmb, ulong *cmd_start, ulong *cmd_end)
 	if (cmdline == NULL)
 		return -1;
 
-	s = env_get("bootargs");
+	s = env_get(ctx_uboot, "bootargs");
 	if (!s)
 		s = "";
 
common/main.c +3 -2
index 3a657c3d9a39..cb9bd8256413 100644
@@ -22,7 +22,7 @@ static void run_preboot_environment_command(void)
 {
 	char *p;
 
-	p = env_get("preboot");
+	p = env_get(ctx_uboot, "preboot");
 	if (p != NULL) {
 		int prev = 0;
 
@@ -44,7 +44,8 @@ void main_loop(void)
 	bootstage_mark_name(BOOTSTAGE_ID_MAIN_LOOP, "main_loop");
 
 	if (IS_ENABLED(CONFIG_VERSION_VARIABLE))
-		env_set("ver", version_string);  /* set version variable */
+		/* set version variable */
+		env_set(ctx_uboot, "ver", version_string);
 
 	cli_init();
 
common/spl/spl_dfu.c +3 -3
index 5728d43ad3f2..4febdb54482f 100644
@@ -38,14 +38,14 @@ int spl_dfu_cmd(int usbctrl, char *dfu_alt_info, char *interface, char *devstr)
 	int ret;
 
 	/* set default environment */
-	env_set_default(NULL, 0);
-	str_env = env_get(dfu_alt_info);
+	env_set_default(ctx_uboot, NULL, 0);
+	str_env = env_get(ctx_uboot, dfu_alt_info);
 	if (!str_env) {
 		pr_err("\"%s\" env variable not defined!\n", dfu_alt_info);
 		return -EINVAL;
 	}
 
-	ret = env_set("dfu_alt_info", str_env);
+	ret = env_set(ctx_uboot, "dfu_alt_info", str_env);
 	if (ret) {
 		pr_err("unable to set env variable \"dfu_alt_info\"!\n");
 		return -EINVAL;
common/spl/spl_ext.c +2 -2
index 2a6252229ca1..a2f0fcb89eb8 100644
@@ -87,7 +87,7 @@ int spl_load_image_ext_os(struct spl_image_info *spl_image,
 		return -1;
 	}
 #if defined(CONFIG_SPL_ENV_SUPPORT)
-	file = env_get("falcon_args_file");
+	file = env_get(ctx_uboot, "falcon_args_file");
 	if (file) {
 		err = ext4fs_open(file, &filelen);
 		if (err < 0) {
@@ -100,7 +100,7 @@ int spl_load_image_ext_os(struct spl_image_info *spl_image,
 			       file, err);
 			goto defaults;
 		}
-		file = env_get("falcon_image_file");
+		file = env_get(ctx_uboot, "falcon_image_file");
 		if (file) {
 			err = spl_load_image_ext(spl_image, block_dev,
 						 partition, file);
common/spl/spl_fat.c +2 -2
index aa371ab52c56..10c1d02e02fe 100644
@@ -123,7 +123,7 @@ int spl_load_image_fat_os(struct spl_image_info *spl_image,
 		return err;
 
 #if defined(CONFIG_SPL_ENV_SUPPORT) && defined(CONFIG_SPL_OS_BOOT)
-	file = env_get("falcon_args_file");
+	file = env_get(ctx_uboot, "falcon_args_file");
 	if (file) {
 		err = file_fat_read(file, (void *)CONFIG_SYS_SPL_ARGS_ADDR, 0);
 		if (err <= 0) {
@@ -131,7 +131,7 @@ int spl_load_image_fat_os(struct spl_image_info *spl_image,
 			       file, err);
 			goto defaults;
 		}
-		file = env_get("falcon_image_file");
+		file = env_get(ctx_uboot, "falcon_image_file");
 		if (file) {
 			err = spl_load_image_fat(spl_image, block_dev,
 						 partition, file);
common/spl/spl_net.c +2 -2
index 803303249c72..141014506a0a 100644
@@ -31,14 +31,14 @@ static int spl_net_load_image(struct spl_image_info *spl_image,
 
 	env_init();
 	env_relocate();
-	env_set("autoload", "yes");
+	env_set(ctx_uboot, "autoload", "yes");
 	rv = eth_initialize();
 	if (rv == 0) {
 		printf("No Ethernet devices found\n");
 		return -ENODEV;
 	}
 	if (bootdev->boot_device_name)
-		env_set("ethact", bootdev->boot_device_name);
+		env_set(ctx_uboot, "ethact", bootdev->boot_device_name);
 	rv = net_loop(BOOTP);
 	if (rv < 0) {
 		printf("Problem booting with BOOTP\n");
common/splash.c +2 -2
index e15cc847b68c..439667a40f64 100644
@@ -61,7 +61,7 @@ __weak int splash_screen_prepare(void)
 #ifdef CONFIG_SPLASH_SCREEN_ALIGN
 void splash_get_pos(int *x, int *y)
 {
-	char *s = env_get("splashpos");
+	char *s = env_get(ctx_uboot, "splashpos");
 
 	if (!s)
 		return;
@@ -93,7 +93,7 @@ int splash_display(void)
 	char *s;
 	int x = 0, y = 0, ret;
 
-	s = env_get("splashimage");
+	s = env_get(ctx_uboot, "splashimage");
 	if (!s)
 		return -EINVAL;
 
common/splash_source.c +4 -4
index d37b4b304c2c..a99519a1f80c 100644
@@ -220,7 +220,7 @@ static int splash_load_fs(struct splash_location *location, u32 bmp_load_addr)
 	loff_t actread;
 	char *splash_file;
 
-	splash_file = env_get("splashfile");
+	splash_file = env_get(ctx_uboot, "splashfile");
 	if (!splash_file)
 		splash_file = SPLASH_SOURCE_DEFAULT_FILE_NAME;
 
@@ -286,7 +286,7 @@ static struct splash_location *select_splash_location(
 	if (!locations || size == 0)
 		return NULL;
 
-	env_splashsource = env_get("splashsource");
+	env_splashsource = env_get(ctx_uboot, "splashsource");
 	if (env_splashsource == NULL)
 		return &locations[0];
 
@@ -341,7 +341,7 @@ static int splash_load_fit(struct splash_location *location, u32 bmp_load_addr)
 	}
 
 	/* Get the splash image node */
-	splash_file = env_get("splashfile");
+	splash_file = env_get(ctx_uboot, "splashfile");
 	if (!splash_file)
 		splash_file = SPLASH_SOURCE_DEFAULT_FILE_NAME;
 
@@ -407,7 +407,7 @@ int splash_source_load(struct splash_location *locations, uint size)
 	char *env_splashimage_value;
 	u32 bmp_load_addr;
 
-	env_splashimage_value = env_get("splashimage");
+	env_splashimage_value = env_get(ctx_uboot, "splashimage");
 	if (env_splashimage_value == NULL)
 		return -ENOENT;
 
common/update.c +5 -5
index 457b29f42aa3..8ba5f70401b8 100644
@@ -60,7 +60,7 @@ static int update_load(char *filename, ulong msec_max, int cnt_max, ulong addr)
 	/* save used globals and env variable */
 	saved_timeout_msecs = tftp_timeout_ms;
 	saved_timeout_count = tftp_timeout_count_max;
-	saved_netretry = strdup(env_get("netretry"));
+	saved_netretry = strdup(env_get(ctx_uboot, "netretry"));
 	saved_bootfile = strdup(net_boot_file_name);
 
 	/* set timeouts for auto-update */
@@ -68,7 +68,7 @@ static int update_load(char *filename, ulong msec_max, int cnt_max, ulong addr)
 	tftp_timeout_count_max = cnt_max;
 
 	/* we don't want to retry the connection if errors occur */
-	env_set("netretry", "no");
+	env_set(ctx_uboot, "netretry", "no");
 
 	/* download the update file */
 	load_addr = addr;
@@ -84,7 +84,7 @@ static int update_load(char *filename, ulong msec_max, int cnt_max, ulong addr)
 	tftp_timeout_ms = saved_timeout_msecs;
 	tftp_timeout_count_max = saved_timeout_count;
 
-	env_set("netretry", saved_netretry);
+	env_set(ctx_uboot, "netretry", saved_netretry);
 	if (saved_netretry != NULL)
 		free(saved_netretry);
 
@@ -255,7 +255,7 @@ int update_tftp(ulong addr, char *interface, char *devstring)
 	printf("Auto-update from TFTP: ");
 
 	/* get the file name of the update file */
-	filename = env_get(UPDATE_FILE_ENV);
+	filename = env_get(ctx_uboot, UPDATE_FILE_ENV);
 	if (filename == NULL) {
 		printf("failed, env. variable '%s' not found\n",
 							UPDATE_FILE_ENV);
@@ -265,7 +265,7 @@ int update_tftp(ulong addr, char *interface, char *devstring)
 	printf("trying update file '%s'\n", filename);
 
 	/* get load address of downloaded update file */
-	env_addr = env_get("loadaddr");
+	env_addr = env_get(ctx_uboot, "loadaddr");
 	if (env_addr)
 		addr = simple_strtoul(env_addr, NULL, 16);
 	else
common/usb_hub.c +1 -1
index 25c2ac43450d..82fe6149429f 100644
@@ -187,7 +187,7 @@ static void usb_hub_power_on(struct usb_hub_device *hub)
 	 * but allow this time to be increased via env variable as some
 	 * devices break the spec and require longer warm-up times
 	 */
-	env = env_get("usb_pgood_delay");
+	env = env_get(ctx_uboot, "usb_pgood_delay");
 	if (env)
 		pgood_delay = max(pgood_delay,
 			          (unsigned)simple_strtol(env, NULL, 0));
common/usb_kbd.c +3 -3
index 387373746147..8bba3897e239 100644
@@ -540,7 +540,7 @@ static int probe_usb_keyboard(struct usb_device *dev)
 	if (error)
 		return error;
 
-	stdinname = env_get("stdin");
+	stdinname = env_get(ctx_uboot, "stdin");
 #if CONFIG_IS_ENABLED(CONSOLE_MUX)
 	error = iomux_doenv(stdin, stdinname);
 	if (error)
@@ -607,7 +607,7 @@ int usb_kbd_deregister(int force)
 		if (stdio_deregister_dev(dev, force) != 0)
 			return 1;
 #if CONFIG_IS_ENABLED(CONSOLE_MUX)
-		if (iomux_doenv(stdin, env_get("stdin")) != 0)
+		if (iomux_doenv(stdin, env_get(ctx_uboot, "stdin")) != 0)
 			return 1;
 #endif
 #ifdef CONFIG_SYS_USB_EVENT_POLL_VIA_INT_QUEUE
@@ -652,7 +652,7 @@ static int usb_kbd_remove(struct udevice *dev)
 		goto err;
 	}
 #if CONFIG_IS_ENABLED(CONSOLE_MUX)
-	if (iomux_doenv(stdin, env_get("stdin"))) {
+	if (iomux_doenv(stdin, env_get(ctx_uboot, "stdin"))) {
 		ret = -ENOLINK;
 		goto err;
 	}
Signature · 1 line
2.21.0
#16 lore raw

PATCH v5 12/19 disk: converted with new env interfaces

In reply to AKASHI Takahiro

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

---
 disk/part.c       | 2 +-
 disk/part_amiga.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
disk/part.c +1 -1
index 8982ef3baed1..6bbb40c62182 100644
@@ -491,7 +491,7 @@ int blk_get_device_part_str(const char *ifname, const char *dev_part_str,
 	/* If no dev_part_str, use bootdevice environment variable */
 	if (!dev_part_str || !strlen(dev_part_str) ||
 	    !strcmp(dev_part_str, "-"))
-		dev_part_str = env_get("bootdevice");
+		dev_part_str = env_get(ctx_uboot, "bootdevice");
 
 	/* If still no dev_part_str, it's an error */
 	if (!dev_part_str) {
disk/part_amiga.c +2 -2
index 5a2bb718b597..c40baaeb9caf 100644
@@ -132,7 +132,7 @@ struct rigid_disk_block *get_rdisk(struct blk_desc *dev_desc)
     int limit;
     char *s;
 
-    s = env_get("amiga_scanlimit");
+    s = env_get(ctx_uboot, "amiga_scanlimit");
     if (s)
 	limit = simple_strtoul(s, NULL, 10);
     else
@@ -172,7 +172,7 @@ struct bootcode_block *get_bootcode(struct blk_desc *dev_desc)
     int limit;
     char *s;
 
-    s = env_get("amiga_scanlimit");
+    s = env_get(ctx_uboot, "amiga_scanlimit");
     if (s)
 	limit = simple_strtoul(s, NULL, 10);
     else
Signature · 1 line
2.21.0
#17 lore raw

PATCH v5 13/19 drivers: converted with new env interfaces

In reply to AKASHI Takahiro

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

---
 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 ++--
 41 files changed, 86 insertions(+), 79 deletions(-)
drivers/bootcount/bootcount_env.c +7 -5
index b75c9002b2c0..3f4ba6d8586c 100644
@@ -9,21 +9,23 @@
 
 void bootcount_store(ulong a)
 {
-	int upgrade_available = env_get_ulong("upgrade_available", 10, 0);
+	int upgrade_available = env_get_ulong(ctx_uboot, "upgrade_available",
+					      10, 0);
 
 	if (upgrade_available) {
-		env_set_ulong("bootcount", a);
-		env_save();
+		env_set_ulong(ctx_uboot, "bootcount", a);
+		env_save(ctx_uboot);
 	}
 }
 
 ulong bootcount_load(void)
 {
-	int upgrade_available = env_get_ulong("upgrade_available", 10, 0);
+	int upgrade_available = env_get_ulong(ctx_uboot, "upgrade_available",
+					      10, 0);
 	ulong val = 0;
 
 	if (upgrade_available)
-		val = env_get_ulong("bootcount", 10, 0);
+		val = env_get_ulong(ctx_uboot, "bootcount", 10, 0);
 
 	return val;
 }
drivers/ddr/fsl/fsl_ddr_gen4.c +1 -1
index 17a4a8282b73..3e373607eb16 100644
@@ -509,7 +509,7 @@ step2:
 #define BIST_CR_STAT	0x00000001
 	/* Perform build-in test on memory. Three-way interleaving is not yet
 	 * supported by this code. */
-	if (env_get_f("ddr_bist", buffer, CONFIG_SYS_CBSIZE) >= 0) {
+	if (env_get_f(ctx_uboot, "ddr_bist", buffer, CONFIG_SYS_CBSIZE) >= 0) {
 		puts("Running BIST test. This will take a while...");
 		cs0_config = ddr_in32(&ddr->cs0_config);
 		cs0_bnds = ddr_in32(&ddr->cs0_bnds);
drivers/ddr/fsl/interactive.c +3 -2
index 8e171e67fec2..2c5829cd394b 100644
@@ -1876,7 +1876,8 @@ int fsl_ddr_interactive_env_var_exists(void)
 {
 	char buffer[CONFIG_SYS_CBSIZE];
 
-	if (env_get_f("ddr_interactive", buffer, CONFIG_SYS_CBSIZE) >= 0)
+	if (env_get_f(ctx_uboot, "ddr_interactive", buffer,
+		      CONFIG_SYS_CBSIZE) >= 0)
 		return 1;
 
 	return 0;
@@ -1906,7 +1907,7 @@ unsigned long long fsl_ddr_interactive(fsl_ddr_info_t *pinfo, int var_is_set)
 	};
 
 	if (var_is_set) {
-		if (env_get_f("ddr_interactive", buffer2,
+		if (env_get_f(ctx_uboot, "ddr_interactive", buffer2,
 			      CONFIG_SYS_CBSIZE) > 0)
 			p = buffer2;
 		else
drivers/ddr/fsl/options.c +2 -2
index b9179315f252..51d27096e8f6 100644
@@ -760,7 +760,7 @@ unsigned int populate_memctl_options(const common_timing_params_t *common_dimm,
 	 * Extract hwconfig from environment since we have not properly setup
 	 * the environment but need it for ddr config params
 	 */
-	if (env_get_f("hwconfig", buf, sizeof(buf)) < 0)
+	if (env_get_f(ctx_uboot, "hwconfig", buf, sizeof(buf)) < 0)
 		buf[0] = '\0';
 
 #if defined(CONFIG_SYS_FSL_DDR3) || \
@@ -1407,7 +1407,7 @@ int fsl_use_spd(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", buf, sizeof(buf)) < 0)
+	if (env_get_f(ctx_uboot, "hwconfig", buf, sizeof(buf)) < 0)
 		buf[0] = '\0';
 
 	/* if hwconfig is not enabled, or "sdram" is not defined, use spd */
drivers/dfu/dfu.c +3 -3
index d2b67b18cf02..9171c1932014 100644
@@ -62,7 +62,7 @@ int dfu_init_env_entities(char *interface, char *devstr)
 #ifdef CONFIG_SET_DFU_ALT_INFO
 	set_dfu_alt_info(interface, devstr);
 #endif
-	str_env = env_get("dfu_alt_info");
+	str_env = env_get(ctx_uboot, "dfu_alt_info");
 	if (!str_env) {
 		pr_err("\"dfu_alt_info\" env variable not defined!\n");
 		return -EINVAL;
@@ -103,7 +103,7 @@ unsigned char *dfu_get_buf(struct dfu_entity *dfu)
 	if (dfu_buf != NULL)
 		return dfu_buf;
 
-	s = env_get("dfu_bufsiz");
+	s = env_get(ctx_uboot, "dfu_bufsiz");
 	if (s)
 		dfu_buf_size = (unsigned long)simple_strtol(s, NULL, 0);
 
@@ -125,7 +125,7 @@ static char *dfu_get_hash_algo(void)
 {
 	char *s;
 
-	s = env_get("dfu_hash_algo");
+	s = env_get(ctx_uboot, "dfu_hash_algo");
 	if (!s)
 		return NULL;
 
drivers/fastboot/fb_command.c +2 -2
index 4864344853c2..daa8092383d9 100644
@@ -250,7 +250,7 @@ void fastboot_data_complete(char *response)
 	fastboot_okay(NULL, response);
 	printf("\ndownloading of %d bytes finished\n", fastboot_bytes_received);
 	image_size = fastboot_bytes_received;
-	env_set_hex("filesize", image_size);
+	env_set_hex(ctx_uboot, "filesize", image_size);
 	fastboot_bytes_expected = 0;
 	fastboot_bytes_received = 0;
 }
@@ -322,7 +322,7 @@ static void oem_format(char *cmd_parameter, char *response)
 {
 	char cmdbuf[32];
 
-	if (!env_get("partitions")) {
+	if (!env_get(ctx_uboot, "partitions")) {
 		fastboot_fail("partitions not set", response);
 	} else {
 		sprintf(cmdbuf, "gpt write mmc %x $partitions",
drivers/fastboot/fb_common.c +1 -1
index e76af8ecc320..f0618c983317 100644
@@ -116,7 +116,7 @@ void fastboot_boot(void)
 {
 	char *s;
 
-	s = env_get("fastboot_bootcmd");
+	s = env_get(ctx_uboot, "fastboot_bootcmd");
 	if (s) {
 		run_command(s, CMD_FLAG_ENV);
 	} else {
drivers/fastboot/fb_getvar.c +4 -4
index 95cb4341895f..a57a1c4b5ed5 100644
@@ -141,7 +141,7 @@ static void getvar_downloadsize(char *var_parameter, char *response)
 
 static void getvar_serialno(char *var_parameter, char *response)
 {
-	const char *tmp = env_get("serial#");
+	const char *tmp = env_get(ctx_uboot, "serial#");
 
 	if (tmp)
 		fastboot_okay(tmp, response);
@@ -156,7 +156,7 @@ static void getvar_version_baseband(char *var_parameter, char *response)
 
 static void getvar_product(char *var_parameter, char *response)
 {
-	const char *board = env_get("board");
+	const char *board = env_get(ctx_uboot, "board");
 
 	if (board)
 		fastboot_okay(board, response);
@@ -166,7 +166,7 @@ static void getvar_product(char *var_parameter, char *response)
 
 static void getvar_platform(char *var_parameter, char *response)
 {
-	const char *p = env_get("platform");
+	const char *p = env_get(ctx_uboot, "platform");
 
 	if (p)
 		fastboot_okay(p, response);
@@ -276,7 +276,7 @@ void fastboot_getvar(char *cmd_parameter, char *response)
 
 		snprintf(envstr, sizeof(envstr) - 1,
 			 FASTBOOT_ENV_PREFIX "%s", cmd_parameter);
-		s = env_get(envstr);
+		s = env_get(ctx_uboot, envstr);
 		if (s) {
 			fastboot_response("OKAY", response, "%s", s);
 			return;
drivers/fastboot/fb_mmc.c +1 -1
index b0b19c576252..02d45b20087c 100644
@@ -39,7 +39,7 @@ static int part_get_info_by_name_or_alias(struct blk_desc *dev_desc,
 		/* check for alias */
 		strcpy(env_alias_name, "fastboot_partition_alias_");
 		strncat(env_alias_name, name, PART_NAME_LEN);
-		aliased_part_name = env_get(env_alias_name);
+		aliased_part_name = env_get(ctx_uboot, env_alias_name);
 		if (aliased_part_name != NULL)
 			ret = part_get_info_by_name(dev_desc,
 					aliased_part_name, info);
drivers/input/i8042.c +1 -1
index 98015899f21d..3cdeda42c11a 100644
@@ -269,7 +269,7 @@ static int i8042_start(struct udevice *dev)
 
 	/* Init keyboard device (default US layout) */
 	keymap = KBD_US;
-	penv = env_get("keymap");
+	penv = env_get(ctx_uboot, "keymap");
 	if (penv != NULL) {
 		if (strncmp(penv, "de", 3) == 0)
 			keymap = KBD_GER;
drivers/input/input.c +1 -1
index 6ab378b979bd..6e0c4cd9bf88 100644
@@ -655,7 +655,7 @@ int input_stdio_register(struct stdio_dev *dev)
 	error = stdio_register(dev);
 #if !defined(CONFIG_SPL_BUILD) || CONFIG_IS_ENABLED(ENV_SUPPORT)
 	/* check if this is the standard input device */
-	if (!error && strcmp(env_get("stdin"), dev->name) == 0) {
+	if (!error && strcmp(env_get(ctx_uboot, "stdin"), dev->name) == 0) {
 		/* reassign the console */
 		if (OVERWRITE_CONSOLE ||
 				console_assign(stdin, dev->name))
drivers/misc/fs_loader.c +4 -4
index 88e486e9d570..3959433dc419 100644
@@ -142,10 +142,10 @@ static int fw_get_filesystem_firmware(struct udevice *dev)
 	char *storage_interface, *dev_part, *ubi_mtdpart, *ubi_volume;
 	int ret;
 
-	storage_interface = env_get("storage_interface");
-	dev_part = env_get("fw_dev_part");
-	ubi_mtdpart = env_get("fw_ubi_mtdpart");
-	ubi_volume = env_get("fw_ubi_volume");
+	storage_interface = env_get(ctx_uboot, "storage_interface");
+	dev_part = env_get(ctx_uboot, "fw_dev_part");
+	ubi_mtdpart = env_get(ctx_uboot, "fw_ubi_mtdpart");
+	ubi_volume = env_get(ctx_uboot, "fw_ubi_volume");
 
 	if (storage_interface && dev_part) {
 		ret = fs_set_blk_dev(storage_interface, dev_part, FS_TYPE_ANY);
drivers/mtd/cfi_flash.c +1 -1
index c59254c76e3e..a3e9d820e883 100644
@@ -2374,7 +2374,7 @@ unsigned long flash_init(void)
 	/* read environment from EEPROM */
 	char s[64];
 
-	env_get_f("unlock", s, sizeof(s));
+	env_get_f(ctx_uboot, "unlock", s, sizeof(s));
 #endif
 
 #ifdef CONFIG_CFI_FLASH /* for driver model */
drivers/mtd/mtd_uboot.c +6 -5
index 557422759831..2c178ac96cd6 100644
@@ -19,7 +19,7 @@ void board_mtdparts_default(const char **mtdids, const char **mtdparts);
 static const char *get_mtdids(void)
 {
 	__maybe_unused const char *mtdparts = NULL;
-	const char *mtdids = env_get("mtdids");
+	const char *mtdids = env_get(ctx_uboot, "mtdids");
 
 	if (mtdids)
 		return mtdids;
@@ -33,7 +33,7 @@ static const char *get_mtdids(void)
 #endif
 
 	if (mtdids)
-		env_set("mtdids", mtdids);
+		env_set(ctx_uboot, "mtdids", mtdids);
 
 	return mtdids;
 }
@@ -126,8 +126,9 @@ static const char *get_mtdparts(void)
 	const char *mtdparts = NULL;
 
 	if (gd->flags & GD_FLG_ENV_READY)
-		mtdparts = env_get("mtdparts");
-	else if (env_get_f("mtdparts", tmp_parts, sizeof(tmp_parts)) != -1)
+		mtdparts = env_get(ctx_uboot, "mtdparts");
+	else if (env_get_f(ctx_uboot, "mtdparts", tmp_parts,
+			   sizeof(tmp_parts)) != -1)
 		mtdparts = tmp_parts;
 
 	if (mtdparts)
@@ -142,7 +143,7 @@ static const char *get_mtdparts(void)
 #endif
 
 	if (mtdparts)
-		env_set("mtdparts", mtdparts);
+		env_set(ctx_uboot, "mtdparts", mtdparts);
 
 	return mtdparts;
 }
drivers/net/fec_mxc.c +1 -1
index 080dbcf7db44..e6c63e60a2e7 100644
@@ -1162,7 +1162,7 @@ static int fec_probe(bd_t *bd, int dev_id, uint32_t base_addr,
 			sprintf(mac, "eth%daddr", fec->dev_id);
 		else
 			strcpy(mac, "ethaddr");
-		if (!env_get(mac))
+		if (!env_get(ctx_uboot, mac))
 			eth_env_set_enetaddr(mac, ethaddr);
 	}
 	return ret;
drivers/net/fm/b4860.c +2 -1
index 5be0ad2ab3db..b67ce9d56fad 100644
@@ -97,7 +97,8 @@ phy_interface_t fman_port_enet_if(enum fm_port port)
 			 * Extract hwconfig from environment since environment
 			 * is not setup yet
 			 */
-			env_get_f("hwconfig", buffer, sizeof(buffer));
+			env_get_f(ctx_uboot, "hwconfig", buffer,
+				  sizeof(buffer));
 			buf = buffer;
 
 			/* check if XFI interface enable in hwconfig for 10g */
drivers/net/fm/fdt.c +1 -1
index 72d129475145..7d891b925082 100644
@@ -36,7 +36,7 @@ void fdt_fixup_fman_firmware(void *blob)
 		return;
 
 	/* If the environment variable is not set, then exit silently */
-	p = env_get("fman_ucode");
+	p = env_get(ctx_uboot, "fman_ucode");
 	if (!p)
 		return;
 
drivers/net/fm/fm.c +2 -2
index 4c9dce8dc57b..6d946eb78b0b 100644
@@ -428,7 +428,7 @@ int fm_init_common(int index, struct ccsr_fman *reg)
 	rc = fman_upload_firmware(index, &reg->fm_imem, addr);
 	if (rc)
 		return rc;
-	env_set_addr("fman_ucode", addr);
+	env_set_addr(ctx_uboot, "fman_ucode", addr);
 
 	fm_init_muram(index, &reg->muram);
 	fm_init_qmi(&reg->fm_qmi_common);
@@ -511,7 +511,7 @@ int fm_init_common(int index, struct ccsr_fman *reg)
 	rc = fman_upload_firmware(index, &reg->fm_imem, addr);
 	if (rc)
 		return rc;
-	env_set_addr("fman_ucode", addr);
+	env_set_addr(ctx_uboot, "fman_ucode", addr);
 
 	fm_init_muram(index, &reg->muram);
 	fm_init_qmi(&reg->fm_qmi_common);
drivers/net/fsl-mc/mc.c +4 -3
index c980ba4edb98..b88d8e6627ee 100644
@@ -578,7 +578,7 @@ static unsigned long get_mc_boot_timeout_ms(void)
 {
 	unsigned long timeout_ms = CONFIG_SYS_LS_MC_BOOT_TIMEOUT_MS;
 
-	char *timeout_ms_env_var = env_get(MC_BOOT_TIMEOUT_ENV_VAR);
+	char *timeout_ms_env_var = env_get(ctx_uboot, MC_BOOT_TIMEOUT_ENV_VAR);
 
 	if (timeout_ms_env_var) {
 		timeout_ms = simple_strtoul(timeout_ms_env_var, NULL, 10);
@@ -893,7 +893,8 @@ unsigned long mc_get_dram_block_size(void)
 {
 	unsigned long dram_block_size = CONFIG_SYS_LS_MC_DRAM_BLOCK_MIN_SIZE;
 
-	char *dram_block_size_env_var = env_get(MC_MEM_SIZE_ENV_VAR);
+	char *dram_block_size_env_var = env_get(ctx_uboot,
+						MC_MEM_SIZE_ENV_VAR);
 
 	if (dram_block_size_env_var) {
 		dram_block_size = simple_strtoul(dram_block_size_env_var, NULL,
@@ -1668,7 +1669,7 @@ void mc_env_boot(void)
 	 * address info properly. Without MAC addresses, the MC code
 	 * can not properly initialize the DPC.
 	 */
-	mc_boot_env_var = env_get(MC_BOOT_ENV_VAR);
+	mc_boot_env_var = env_get(ctx_uboot, MC_BOOT_ENV_VAR);
 	if (mc_boot_env_var)
 		run_command_list(mc_boot_env_var, -1, 0);
 #endif /* CONFIG_FSL_MC_ENET */
drivers/net/netconsole.c +7 -7
index 73005ff94d9f..3e9855af48fe 100644
@@ -60,8 +60,8 @@ static int is_broadcast(struct in_addr ip)
 
 	/* update only when the environment has changed */
 	if (env_changed_id != env_id) {
-		netmask = env_get_ip("netmask");
-		our_ip = env_get_ip("ipaddr");
+		netmask = env_get_ip(ctx_uboot, "netmask");
+		our_ip = env_get_ip(ctx_uboot, "ipaddr");
 
 		env_changed_id = env_id;
 	}
@@ -80,11 +80,11 @@ static int refresh_settings_from_env(void)
 
 	/* update only when the environment has changed */
 	if (env_changed_id != env_id) {
-		if (env_get("ncip")) {
-			nc_ip = env_get_ip("ncip");
+		if (env_get(ctx_uboot, "ncip")) {
+			nc_ip = env_get_ip(ctx_uboot, "ncip");
 			if (!nc_ip.s_addr)
 				return -1;	/* ncip is 0.0.0.0 */
-			p = strchr(env_get("ncip"), ':');
+			p = strchr(env_get(ctx_uboot, "ncip"), ':');
 			if (p != NULL) {
 				nc_out_port = simple_strtoul(p + 1, NULL, 10);
 				nc_in_port = nc_out_port;
@@ -93,10 +93,10 @@ static int refresh_settings_from_env(void)
 			nc_ip.s_addr = ~0; /* ncip is not set, so broadcast */
 		}
 
-		p = env_get("ncoutport");
+		p = env_get(ctx_uboot, "ncoutport");
 		if (p != NULL)
 			nc_out_port = simple_strtoul(p, NULL, 10);
-		p = env_get("ncinport");
+		p = env_get(ctx_uboot, "ncinport");
 		if (p != NULL)
 			nc_in_port = simple_strtoul(p, NULL, 10);
 
drivers/net/phy/micrel_ksz90x1.c +2 -2
index 0105fc5af1ea..6480786fa2ce 100644
@@ -267,7 +267,7 @@ static int ksz9021_config(struct phy_device *phydev)
 	if (ret)
 		return ret;
 
-	if (env_get("disable_giga"))
+	if (env_get(ctx_uboot, "disable_giga"))
 		features &= ~(SUPPORTED_1000baseT_Half |
 		SUPPORTED_1000baseT_Full);
 	/* force master mode for 1000BaseT due to chip errata */
@@ -353,7 +353,7 @@ static int ksz9031_config(struct phy_device *phydev)
 		return ret;
 
 	/* add an option to disable the gigabit feature of this PHY */
-	if (env_get("disable_giga")) {
+	if (env_get(ctx_uboot, "disable_giga")) {
 		unsigned features;
 		unsigned bmcr;
 
drivers/net/sandbox-raw.c +2 -2
index 3707ee35eb5c..aa09fcb0ffc1 100644
@@ -28,8 +28,8 @@ static int sb_eth_raw_start(struct udevice *dev)
 
 	ret = sandbox_eth_raw_os_start(priv, pdata->enetaddr);
 	if (priv->local) {
-		env_set("ipaddr", "127.0.0.1");
-		env_set("serverip", "127.0.0.1");
+		env_set(ctx_uboot, "ipaddr", "127.0.0.1");
+		env_set(ctx_uboot, "serverip", "127.0.0.1");
 		net_ip = string_to_ip("127.0.0.1");
 		net_server_ip = net_ip;
 	}
drivers/pci/pci.c +2 -2
index 5db24f1c51d5..862452204c07 100644
@@ -424,7 +424,7 @@ int pci_hose_scan(struct pci_controller *hose)
 
 	if (!gd->pcidelay_done) {
 		/* wait "pcidelay" ms (if defined)... */
-		s = env_get("pcidelay");
+		s = env_get(ctx_uboot, "pcidelay");
 		if (s) {
 			int val = simple_strtoul(s, NULL, 10);
 			for (i = 0; i < val; i++)
@@ -456,7 +456,7 @@ void pci_init(void)
 	hose_head = NULL;
 
 	/* allow env to disable pci init/enum */
-	if (env_get("pcidisable") != NULL)
+	if (env_get(ctx_uboot, "pcidisable"))
 		return;
 
 	/* now call board specific pci_init()... */
drivers/pci/pci_common.c +1 -1
index 5231b69dc9ad..007580066ca6 100644
@@ -89,7 +89,7 @@ __weak int pci_skip_dev(struct pci_controller *hose, pci_dev_t dev)
 		/*
 		 * Only skip configuration if "pciconfighost" is not set
 		 */
-		if (env_get("pciconfighost") == NULL)
+		if (!env_get(ctx_uboot, "pciconfighost"))
 			return 1;
 #else
 		return 1;
drivers/reset/reset-socfpga.c +1 -1
index 93ec9cfdb64a..6fb7ecb97ac0 100644
@@ -48,7 +48,7 @@ static bool socfpga_reset_keep_enabled(void)
 	const char *env_str;
 	long val;
 
-	env_str = env_get("socfpga_legacy_reset_compat");
+	env_str = env_get(ctx_uboot, "socfpga_legacy_reset_compat");
 	if (env_str) {
 		val = simple_strtol(env_str, NULL, 0);
 		if (val == 1)
drivers/rtc/m41t60.c +1 -1
index 532d2105e12c..8829d2a3c2d2 100644
@@ -198,7 +198,7 @@ int rtc_set(struct rtc_time *tmp)
 void rtc_reset(void)
 {
 	uchar *const data = rtc_validate();
-	char const *const s = env_get("rtccal");
+	char const *const s = env_get(ctx_uboot, "rtccal");
 
 	if (!data)
 		return;
drivers/scsi/scsi.c +1 -1
index 48cb2a2818bc..c6ca3447af19 100644
@@ -681,7 +681,7 @@ int scsi_scan(bool verbose)
 
 	printf("Found %d device(s).\n", scsi_max_devs);
 #ifndef CONFIG_SPL_BUILD
-	env_set_ulong("scsidevs", scsi_max_devs);
+	env_set_ulong(ctx_uboot, "scsidevs", scsi_max_devs);
 #endif
 	return 0;
 }
drivers/serial/usbtty.c +2 -2
index 76d9c8a3a6df..cf4a37c9bb4a 100644
@@ -526,7 +526,7 @@ int drv_usbtty_init (void)
 	int snlen;
 
 	/* Get serial number */
-	sn = env_get("serial#");
+	sn = env_get(ctx_uboot, "serial#");
 	if (!sn)
 		sn = "000000000000";
 	snlen = strlen(sn);
@@ -540,7 +540,7 @@ int drv_usbtty_init (void)
 
 	/* Decide on which type of UDC device to be.
 	 */
-	tt = env_get("usbtty");
+	tt = env_get(ctx_uboot, "usbtty");
 	if (!tt)
 		tt = "generic";
 	usbtty_init_terminal_type(strcmp(tt,"cdc_acm"));
drivers/usb/gadget/designware_udc.c +1 -1
index 432f312cee4c..cc6bace8f639 100644
@@ -601,7 +601,7 @@ void udc_setup_ep(struct usb_device_instance *device,
 	if ((ep != 0) && (udc_device->device_state < STATE_ADDRESSED))
 		return;
 
-	tt = env_get("usbtty");
+	tt = env_get(ctx_uboot, "usbtty");
 	if (!tt)
 		tt = "generic";
 
drivers/usb/gadget/ether.c +7 -6
index a118283984c2..e5cb96aa7e9d 100644
@@ -2355,12 +2355,12 @@ static int _usb_eth_init(struct ether_priv *priv)
 	strlcpy(host_addr, CONFIG_USBNET_HOST_ADDR, sizeof(host_addr));
 #endif
 	/* Check if the user overruled the MAC addresses */
-	if (env_get("usbnet_devaddr"))
-		strlcpy(dev_addr, env_get("usbnet_devaddr"),
+	if (env_get(ctx_uboot, "usbnet_devaddr"))
+		strlcpy(dev_addr, env_get(ctx_uboot, "usbnet_devaddr"),
 			sizeof(dev_addr));
 
-	if (env_get("usbnet_hostaddr"))
-		strlcpy(host_addr, env_get("usbnet_hostaddr"),
+	if (env_get(ctx_uboot, "usbnet_hostaddr"))
+		strlcpy(host_addr, env_get(ctx_uboot, "usbnet_hostaddr"),
 			sizeof(host_addr));
 
 	if (!is_eth_addr_valid(dev_addr)) {
@@ -2391,8 +2391,9 @@ static int _usb_eth_init(struct ether_priv *priv)
 	gadget = dev->gadget;
 	usb_gadget_connect(gadget);
 
-	if (env_get("cdc_connect_timeout"))
-		timeout = simple_strtoul(env_get("cdc_connect_timeout"),
+	if (env_get(ctx_uboot, "cdc_connect_timeout"))
+		timeout = simple_strtoul(env_get(ctx_uboot,
+						 "cdc_connect_timeout"),
 						NULL, 10) * CONFIG_SYS_HZ;
 	ts = get_timer(0);
 	while (!dev->network_started) {
drivers/usb/gadget/f_dfu.c +1 -1
index 675615513304..ec730087116c 100644
@@ -725,7 +725,7 @@ static int dfu_bind(struct usb_configuration *c, struct usb_function *f)
 
 	cdev->req->context = f_dfu;
 
-	s = env_get("serial#");
+	s = env_get(ctx_uboot, "serial#");
 	if (s)
 		g_dnl_set_serialnumber((char *)s);
 
drivers/usb/gadget/f_fastboot.c +1 -1
index fc27dbe8de49..240b6c8936e5 100644
@@ -185,7 +185,7 @@ static int fastboot_bind(struct usb_configuration *c, struct usb_function *f)
 		f->hs_descriptors = fb_hs_function;
 	}
 
-	s = env_get("serial#");
+	s = env_get(ctx_uboot, "serial#");
 	if (s)
 		g_dnl_set_serialnumber((char *)s);
 
drivers/usb/gadget/f_rockusb.c +1 -1
index 1cfeabcd31ae..364da4c1d9d5 100644
@@ -182,7 +182,7 @@ static int rockusb_bind(struct usb_configuration *c, struct usb_function *f)
 		f->hs_descriptors = rkusb_hs_function;
 	}
 
-	s = env_get("serial#");
+	s = env_get(ctx_uboot, "serial#");
 	if (s)
 		g_dnl_set_serialnumber((char *)s);
 
drivers/usb/gadget/f_sdp.c +1 -1
index bcd1c5d47c10..ceadcc2e65c9 100644
@@ -359,7 +359,7 @@ static void sdp_rx_data_complete(struct usb_ep *ep, struct usb_request *req)
 		return;
 
 #ifndef CONFIG_SPL_BUILD
-	env_set_hex("filesize", sdp->dnl_bytes);
+	env_set_hex(ctx_uboot, "filesize", sdp->dnl_bytes);
 #endif
 	printf("done\n");
 
drivers/usb/host/ehci-fsl.c +1 -1
index ced295ef0fa4..b57d1fd6f667 100644
@@ -240,7 +240,7 @@ static int ehci_fsl_init(int index, struct usb_ehci *ehci,
 				"phy_type", &len);
 #endif
 	else
-		phy_type = env_get("usb_phy_type");
+		phy_type = env_get(ctx_uboot, "usb_phy_type");
 
 	if (!phy_type) {
 #ifdef CONFIG_SYS_FSL_USB_INTERNAL_UTMI_PHY
drivers/video/ati_radeon_fb.c +1 -1
index 6fce03363690..76d8ec4e0b2b 100644
@@ -637,7 +637,7 @@ void *video_hw_init(void)
 
 	videomode = CONFIG_SYS_DEFAULT_VIDEO_MODE;
 	/* get video mode via environment */
-	penv = env_get("videomode");
+	penv = env_get(ctx_uboot, "videomode");
 	if (penv) {
 		/* deceide if it is a string */
 		if (penv[0] <= '9') {
drivers/video/cfb_console.c +1 -1
index e5c077e4f522..c073bd17618e 100644
@@ -1861,7 +1861,7 @@ static void *video_logo(void)
 	splash_get_pos(&video_logo_xpos, &video_logo_ypos);
 
 #ifdef CONFIG_SPLASH_SCREEN
-	s = env_get("splashimage");
+	s = env_get(&ctx_boot, "splashimage");
 	if (s != NULL) {
 		ret = splash_screen_prepare();
 		if (ret < 0)
drivers/video/mb862xx.c +1 -1
index 301c1f0df179..18eeba4ca1ec 100644
@@ -246,7 +246,7 @@ unsigned int card_init (void)
 	tmp = 0;
 	videomode = 0x310;
 	/* get video mode via environment */
-	penv = env_get("videomode");
+	penv = env_get(ctx_uboot, "videomode");
 	if (penv) {
 		/* decide if it is a string */
 		if (penv[0] <= '9') {
drivers/video/mx3fb.c +1 -1
index a984443ef9d7..6eda807b9da3 100644
@@ -814,7 +814,7 @@ void *video_hw_init(void)
 
 	videomode = CONFIG_SYS_DEFAULT_VIDEO_MODE;
 	/* get video mode via environment */
-	penv = env_get("videomode");
+	penv = env_get(ctx_uboot, "videomode");
 	if (penv) {
 		/* decide if it is a string */
 		if (penv[0] <= '9') {
drivers/video/mxsfb.c +1 -1
index 6922a130c61a..5b03cead16cf 100644
@@ -207,7 +207,7 @@ void *video_hw_init(void)
 	puts("Video: ");
 
 	/* Suck display configuration from "videomode" variable */
-	penv = env_get("videomode");
+	penv = env_get(ctx_uboot, "videomode");
 	if (!penv) {
 		puts("MXSFB: 'videomode' variable not set!\n");
 		return NULL;
drivers/video/videomodes.c +2 -2
index ac25b45f8196..67130b992566 100644
@@ -165,7 +165,7 @@ int video_get_params (struct ctfb_res_modes *pPar, char *penv)
 	/* first search for the environment containing the real param string */
 	s = penv;
 
-	p = env_get(s);
+	p = env_get(ctx_uboot, s);
 	if (p)
 		s = p;
 
@@ -235,7 +235,7 @@ int video_get_params (struct ctfb_res_modes *pPar, char *penv)
 int video_get_video_mode(unsigned int *xres, unsigned int *yres,
 	unsigned int *depth, unsigned int *freq, const char **options)
 {
-	char *p = env_get("video-mode");
+	char *p = env_get(ctx_uboot, "video-mode");
 	if (!p)
 		return 0;
 
Signature · 1 line
2.21.0
#18 lore raw

PATCH v5 14/19 fs: converted with new env interfaces

In reply to AKASHI Takahiro

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

---
 fs/fs.c          | 14 +++++++-------
 fs/ubifs/ubifs.c |  2 +-
 2 files changed, 8 insertions(+), 8 deletions(-)
fs/fs.c +7 -7
index d8a4ced4698e..b26c94f89764 100644
@@ -647,7 +647,7 @@ int do_size(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[],
 	if (fs_size(argv[3], &size) < 0)
 		return CMD_RET_FAILURE;
 
-	env_set_hex("filesize", size);
+	env_set_hex(ctx_uboot, "filesize", size);
 
 	return 0;
 }
@@ -678,7 +678,7 @@ int do_load(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[],
 		if (ep == argv[3] || *ep != '\0')
 			return CMD_RET_USAGE;
 	} else {
-		addr_str = env_get("loadaddr");
+		addr_str = env_get(ctx_uboot, "loadaddr");
 		if (addr_str != NULL)
 			addr = simple_strtoul(addr_str, NULL, 16);
 		else
@@ -687,7 +687,7 @@ int do_load(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[],
 	if (argc >= 5) {
 		filename = argv[4];
 	} else {
-		filename = env_get("bootfile");
+		filename = env_get(ctx_uboot, "bootfile");
 		if (!filename) {
 			puts("** No boot file defined **\n");
 			return 1;
@@ -720,8 +720,8 @@ int do_load(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[],
 	}
 	puts("\n");
 
-	env_set_hex("fileaddr", addr);
-	env_set_hex("filesize", len_read);
+	env_set_hex(ctx_uboot, "fileaddr", addr);
+	env_set_hex(ctx_uboot, "filesize", len_read);
 
 	return 0;
 }
@@ -812,7 +812,7 @@ int do_fs_uuid(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[],
 		return CMD_RET_FAILURE;
 
 	if (argc == 4)
-		env_set(argv[3], uuid);
+		env_set(ctx_uboot, argv[3], uuid);
 	else
 		printf("%s\n", uuid);
 
@@ -832,7 +832,7 @@ int do_fs_type(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	info = fs_get_info(fs_type);
 
 	if (argc == 4)
-		env_set(argv[3], info->name);
+		env_set(ctx_uboot, argv[3], info->name);
 	else
 		printf("%s\n", info->name);
 
fs/ubifs/ubifs.c +1 -1
index 67a0e8caae70..7b16b16e068f 100644
@@ -944,7 +944,7 @@ int ubifs_load(char *filename, u32 addr, u32 size)
 
 	err = ubifs_read(filename, (void *)(uintptr_t)addr, 0, size, &actread);
 	if (err == 0) {
-		env_set_hex("filesize", actread);
+		env_set_hex(ctx_uboot, "filesize", actread);
 		printf("Done\n");
 	}
 
Signature · 1 line
2.21.0
#19 lore raw

PATCH v5 15/19 lib: converted with new env interfaces (except efi_loader)

In reply to AKASHI Takahiro

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

---
 lib/efi_loader/efi_console.c | 2 +-
 lib/fdtdec.c                 | 2 +-
 lib/smbios.c                 | 2 +-
 lib/uuid.c                   | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)
lib/efi_loader/efi_console.c +1 -1
index d4765afb9849..902938c9b7f0 100644
@@ -260,7 +260,7 @@ out:
  */
 static void query_console_size(void)
 {
-	const char *stdout_name = env_get("stdout");
+	const char *stdout_name = env_get(ctx_uboot, "stdout");
 	int rows = 25, cols = 80;
 
 	if (stdout_name && !strcmp(stdout_name, "vidconsole") &&
lib/fdtdec.c +1 -1
index 74525c84e7bd..f0642ea61f85 100644
@@ -1541,7 +1541,7 @@ int fdtdec_setup(void)
 # ifndef CONFIG_SPL_BUILD
 	/* Allow the early environment to override the fdt address */
 	gd->fdt_blob = map_sysmem
-		(env_get_ulong("fdtcontroladdr", 16,
+		(env_get_ulong(ctx_uboot, "fdtcontroladdr", 16,
 			       (unsigned long)map_to_sysmem(gd->fdt_blob)), 0);
 # endif
 
lib/smbios.c +1 -1
index 7b74971f6878..41a000cbd932 100644
@@ -113,7 +113,7 @@ static int smbios_write_type1(ulong *current, int handle)
 {
 	struct smbios_type1 *t;
 	int len = sizeof(struct smbios_type1);
-	char *serial_str = env_get("serial#");
+	char *serial_str = env_get(ctx_uboot, "serial#");
 
 	t = map_sysmem(*current, len);
 	memset(t, 0, sizeof(struct smbios_type1));
lib/uuid.c +1 -1
index a48e19c06eaf..6498e8d6ac0e 100644
@@ -299,7 +299,7 @@ int do_uuid(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	if (argc == 1)
 		printf("%s\n", uuid);
 	else
-		env_set(argv[1], uuid);
+		env_set(ctx_uboot, argv[1], uuid);
 
 	return CMD_RET_SUCCESS;
 }
Signature · 1 line
2.21.0
#20 lore raw

PATCH v5 16/19 net: converted with new env interfaces

In reply to AKASHI Takahiro

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

---
 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 +-
 9 files changed, 36 insertions(+), 34 deletions(-)
net/bootp.c +9 -8
index 505489140e8a..3a9ca24e649f 100644
@@ -176,7 +176,7 @@ static void store_net_params(struct bootp_hdr *bp)
 	 * not contain a new value
 	 */
 	if (*net_boot_file_name)
-		env_set("bootfile", net_boot_file_name);
+		env_set(ctx_uboot, "bootfile", net_boot_file_name);
 #endif
 	net_copy_ip(&net_ip, &bp->bp_yiaddr);
 }
@@ -395,7 +395,7 @@ static void bootp_timeout_handler(void)
 #ifdef CONFIG_BOOTP_MAY_FAIL
 		char *ethrotate;
 
-		ethrotate = env_get("ethrotate");
+		ethrotate = env_get(ctx_uboot, "ethrotate");
 		if ((ethrotate && strcmp(ethrotate, "no") == 0) ||
 		    net_restart_wrap) {
 			puts("\nRetry time exceeded\n");
@@ -427,7 +427,7 @@ static void bootp_timeout_handler(void)
 static u8 *add_vci(u8 *e)
 {
 	char *vci = NULL;
-	char *env_vci = env_get("bootp_vci");
+	char *env_vci = env_get(ctx_uboot, "bootp_vci");
 
 #if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_NET_VCI_STRING)
 	vci = CONFIG_SPL_NET_VCI_STRING;
@@ -501,7 +501,7 @@ static int dhcp_extended(u8 *e, int message_type, struct in_addr server_ip,
 		*e++ = tmp & 0xff;
 	}
 #if defined(CONFIG_BOOTP_SEND_HOSTNAME)
-	hostname = env_get("hostname");
+	hostname = env_get(ctx_uboot, "hostname");
 	if (hostname) {
 		int hostnamelen = strlen(hostname);
 
@@ -516,8 +516,9 @@ static int dhcp_extended(u8 *e, int message_type, struct in_addr server_ip,
 	clientarch = CONFIG_BOOTP_PXE_CLIENTARCH;
 #endif
 
-	if (env_get("bootp_arch"))
-		clientarch = env_get_ulong("bootp_arch", 16, clientarch);
+	if (env_get(ctx_uboot, "bootp_arch"))
+		clientarch = env_get_ulong(ctx_uboot, "bootp_arch", 16,
+					   clientarch);
 
 	if (clientarch > 0) {
 		*e++ = 93;	/* Client System Architecture */
@@ -533,7 +534,7 @@ static int dhcp_extended(u8 *e, int message_type, struct in_addr server_ip,
 	*e++ = 0;	/* minor revision */
 
 #ifdef CONFIG_LIB_UUID
-	uuid = env_get("pxeuuid");
+	uuid = env_get(ctx_uboot, "pxeuuid");
 
 	if (uuid) {
 		if (uuid_str_valid(uuid)) {
@@ -726,7 +727,7 @@ void bootp_request(void)
 	dhcp_state = INIT;
 #endif
 
-	ep = env_get("bootpretryperiod");
+	ep = env_get(ctx_uboot, "bootpretryperiod");
 	if (ep != NULL)
 		time_taken_max = simple_strtoul(ep, NULL, 10);
 	else
net/dns.c +1 -1
index 67d761d7c0f5..93e338e9cb22 100644
@@ -185,7 +185,7 @@ static void dns_handler(uchar *pkt, unsigned dest, struct in_addr sip,
 			ip_to_string(ip_addr, ip_str);
 			printf("%s\n", ip_str);
 			if (net_dns_env_var)
-				env_set(net_dns_env_var, ip_str);
+				env_set(ctx_uboot, net_dns_env_var, ip_str);
 		} else {
 			puts("server responded with invalid IP number\n");
 		}
net/eth-uclass.c +3 -3
index 1d5d2f03b7d9..d7bec3377e6f 100644
@@ -240,8 +240,8 @@ U_BOOT_ENV_CALLBACK(ethaddr, on_ethaddr);
 
 int eth_init(void)
 {
-	char *ethact = env_get("ethact");
-	char *ethrotate = env_get("ethrotate");
+	char *ethact = env_get(ctx_uboot, "ethact");
+	char *ethrotate = env_get(ctx_uboot, "ethrotate");
 	struct udevice *current = NULL;
 	struct udevice *old_current;
 	int ret = -ENODEV;
@@ -401,7 +401,7 @@ int eth_initialize(void)
 		printf("No ethernet found.\n");
 		bootstage_error(BOOTSTAGE_ID_NET_ETH_START);
 	} else {
-		char *ethprime = env_get("ethprime");
+		char *ethprime = env_get(ctx_uboot, "ethprime");
 		struct udevice *prime_dev = NULL;
 
 		if (ethprime)
net/eth_common.c +9 -9
index ed26b1b69359..f845601a13b0 100644
@@ -46,13 +46,13 @@ int eth_mac_skip(int index)
 	char *skip_state;
 
 	sprintf(enetvar, index ? "eth%dmacskip" : "ethmacskip", index);
-	skip_state = env_get(enetvar);
+	skip_state = env_get(ctx_uboot, enetvar);
 	return skip_state != NULL;
 }
 
 void eth_current_changed(void)
 {
-	char *act = env_get("ethact");
+	char *act = env_get(ctx_uboot, "ethact");
 	char *ethrotate;
 
 	/*
@@ -60,21 +60,21 @@ void eth_current_changed(void)
 	 * ethernet device if uc_priv->current == NULL. This is not what
 	 * we want when 'ethrotate' variable is 'no'.
 	 */
-	ethrotate = env_get("ethrotate");
+	ethrotate = env_get(ctx_uboot, "ethrotate");
 	if ((ethrotate != NULL) && (strcmp(ethrotate, "no") == 0))
 		return;
 
 	/* update current ethernet name */
 	if (eth_get_dev()) {
 		if (act == NULL || strcmp(act, eth_get_name()) != 0)
-			env_set("ethact", eth_get_name());
+			env_set(ctx_uboot, "ethact", eth_get_name());
 	}
 	/*
 	 * remove the variable completely if there is no active
 	 * interface
 	 */
 	else if (act != NULL)
-		env_set("ethact", NULL);
+		env_set(ctx_uboot, "ethact", NULL);
 }
 
 void eth_try_another(int first_restart)
@@ -86,7 +86,7 @@ void eth_try_another(int first_restart)
 	 * Do not rotate between network interfaces when
 	 * 'ethrotate' variable is set to 'no'.
 	 */
-	ethrotate = env_get("ethrotate");
+	ethrotate = env_get(ctx_uboot, "ethrotate");
 	if ((ethrotate != NULL) && (strcmp(ethrotate, "no") == 0))
 		return;
 
@@ -110,14 +110,14 @@ void eth_set_current(void)
 	static int  env_changed_id;
 	int	env_id;
 
-	env_id = env_get_id();
+	env_id = env_get_id(ctx_uboot);
 	if ((act == NULL) || (env_changed_id != env_id)) {
-		act = env_get("ethact");
+		act = env_get(ctx_uboot, "ethact");
 		env_changed_id = env_id;
 	}
 
 	if (act == NULL) {
-		char *ethprime = env_get("ethprime");
+		char *ethprime = env_get(ctx_uboot, "ethprime");
 		void *dev = NULL;
 
 		if (ethprime)
net/eth_legacy.c +1 -1
index 850f362d873e..a166244e18bf 100644
@@ -260,7 +260,7 @@ int eth_initialize(void)
 		bootstage_error(BOOTSTAGE_ID_NET_ETH_START);
 	} else {
 		struct eth_device *dev = eth_devices;
-		char *ethprime = env_get("ethprime");
+		char *ethprime = env_get(ctx_uboot, "ethprime");
 
 		bootstage_mark(BOOTSTAGE_ID_NET_ETH_INIT);
 		do {
net/link_local.c +1 -1
index dd9fcad0874d..c0adc583fb71 100644
@@ -105,7 +105,7 @@ static void configure_wait(void)
 
 void link_local_start(void)
 {
-	ip = env_get_ip("llipaddr");
+	ip = env_get_ip(ctx_uboot, "llipaddr");
 	if (ip.s_addr != 0 &&
 	    (ntohl(ip.s_addr) & IN_CLASSB_NET) != LINKLOCAL_ADDR) {
 		puts("invalid link address");
net/net.c +6 -5
index 40511db645df..92e3c9fa8016 100644
@@ -306,7 +306,7 @@ U_BOOT_ENV_CALLBACK(dnsip, on_dnsip);
 void net_auto_load(void)
 {
 #if defined(CONFIG_CMD_NFS)
-	const char *s = env_get("autoload");
+	const char *s = env_get(ctx_uboot, "autoload");
 
 	if (s != NULL && strcmp(s, "NFS") == 0) {
 		if (net_check_prereq(NFS)) {
@@ -635,8 +635,9 @@ restart:
 			if (net_boot_file_size > 0) {
 				printf("Bytes transferred = %d (%x hex)\n",
 				       net_boot_file_size, net_boot_file_size);
-				env_set_hex("filesize", net_boot_file_size);
-				env_set_hex("fileaddr", load_addr);
+				env_set_hex(ctx_uboot, "filesize",
+					    net_boot_file_size);
+				env_set_hex(ctx_uboot, "fileaddr", load_addr);
 			}
 			if (protocol != NETCONS)
 				eth_halt();
@@ -689,7 +690,7 @@ int net_start_again(void)
 	unsigned long retrycnt = 0;
 	int ret;
 
-	nretry = env_get("netretry");
+	nretry = env_get(ctx_uboot, "netretry");
 	if (nretry) {
 		if (!strcmp(nretry, "yes"))
 			retry_forever = 1;
@@ -1612,7 +1613,7 @@ ushort string_to_vlan(const char *s)
 
 ushort env_get_vlan(char *var)
 {
-	return string_to_vlan(env_get(var));
+	return string_to_vlan(env_get(ctx_uboot, var));
 }
 
 void eth_parse_enetaddr(const char *addr, uint8_t *enetaddr)
net/tftp.c +5 -5
index 5a69bca6413c..452628dd7f8c 100644
@@ -629,11 +629,11 @@ void tftp_start(enum proto_t protocol)
 	 * TFTP protocol has a minimal timeout of 1 second.
 	 */
 
-	ep = env_get("tftpblocksize");
+	ep = env_get(ctx_uboot, "tftpblocksize");
 	if (ep != NULL)
 		tftp_block_size_option = simple_strtol(ep, NULL, 10);
 
-	ep = env_get("tftptimeout");
+	ep = env_get(ctx_uboot, "tftptimeout");
 	if (ep != NULL)
 		timeout_ms = simple_strtol(ep, NULL, 10);
 
@@ -643,7 +643,7 @@ void tftp_start(enum proto_t protocol)
 		timeout_ms = 1000;
 	}
 
-	ep = env_get("tftptimeoutcountmax");
+	ep = env_get(ctx_uboot, "tftptimeoutcountmax");
 	if (ep != NULL)
 		tftp_timeout_count_max = simple_strtol(ep, NULL, 10);
 
@@ -743,10 +743,10 @@ void tftp_start(enum proto_t protocol)
 	tftp_our_port = 1024 + (get_timer(0) % 3072);
 
 #ifdef CONFIG_TFTP_PORT
-	ep = env_get("tftpdstp");
+	ep = env_get(ctx_uboot, "tftpdstp");
 	if (ep != NULL)
 		tftp_remote_port = simple_strtol(ep, NULL, 10);
-	ep = env_get("tftpsrcp");
+	ep = env_get(ctx_uboot, "tftpsrcp");
 	if (ep != NULL)
 		tftp_our_port = simple_strtol(ep, NULL, 10);
 #endif
net/wol.c +1 -1
index 0a625668a992..9afd7149f34c 100644
@@ -56,7 +56,7 @@ void wol_receive(struct ip_udp_hdr *ip, unsigned int len)
 		struct in_addr *ip = (struct in_addr *)(wol->wol_passwd);
 
 		ip_to_string(*ip, buffer);
-		env_set("wolpassword", buffer);
+		env_set(ctx_uboot, "wolpassword", buffer);
 	}
 	net_set_state(NETLOOP_SUCCESS);
 }
Signature · 1 line
2.21.0
#21 lore raw

PATCH v5 17/19 post: converted with new env interfaces

In reply to AKASHI Takahiro

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

---
 post/post.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
post/post.c +1 -1
index fb751d9a83a5..d8a8279123cc 100644
@@ -176,7 +176,7 @@ static void post_get_env_flags(int *test_flags)
 	int i, j;
 
 	for (i = 0; i < varnum; i++) {
-		if (env_get_f(var[i], list, sizeof(list)) <= 0)
+		if (env_get_f(ctx_uboot, var[i], list, sizeof(list)) <= 0)
 			continue;
 
 		for (j = 0; j < post_list_size; j++)
Signature · 1 line
2.21.0
#22 lore raw

PATCH v5 18/19 env, efi_loader: define env context for UEFI variables

In reply to AKASHI Takahiro

We will use two environment contexts for implementing UEFI variables, one (ctx_efi) for non-volatile variables and the other for volatile variables. The latter doesn't have a backing storage.

Those two contexts are currently used only in efi_variable.c and can be moved into there if desired. But I let it under env/ for future use elsewhere.

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       |   1 +
 env/Kconfig.efi   | 152 ++++++++++++++++++++++++++++++++++++++++++++++
 env/Makefile      |   1 +
 env/env_ctx_efi.c | 131 +++++++++++++++++++++++++++++++++++++++
 include/env.h     |   3 +
 5 files changed, 288 insertions(+)
 create mode 100644 env/Kconfig.efi
 create mode 100644 env/env_ctx_efi.c
env/Kconfig +1 -0
index ae96cf75bbaa..0cd3caa67376 100644
@@ -47,5 +47,6 @@ config ENV_DRV_UBI
 	bool
 
 source "env/Kconfig.uboot"
+source "env/Kconfig.efi"
 
 endmenu
env/Kconfig.efi new file +152 -0

152 lines not on this page · raw message

env/Makefile +1 -0
index 0168eb47f00d..b6690c73b17f 100644
@@ -4,6 +4,7 @@
 # Wolfgang Denk, DENX Software Engineering, wd at denx.de.
 
 obj-y += common.o env.o env_ctx_uboot.o
+obj-$(CONFIG_EFI_LOADER) += env_ctx_efi.o
 
 ifndef CONFIG_SPL_BUILD
 obj-y += attr.o
env/env_ctx_efi.c new file +131 -0

131 lines not on this page · raw message

include/env.h +3 -0
index 8045dda9f811..ec241d419a8a 100644
@@ -66,6 +66,9 @@ enum env_redund_flags {
 };
 
 #define ctx_uboot ll_entry_get(struct env_context, uboot, env_contexts)
+#define ctx_efi ll_entry_get(struct env_context, efi, env_contexts)
+#define ctx_efi_volatile ll_entry_get(struct env_context, efi_volatile, \
+				      env_contexts)
 
 /* Accessor functions */
 void env_set_ready(struct env_context *ctx);
Signature · 1 line
2.21.0
#23 lore raw

PATCH v5 18/19 env, efi_loader: define env context for UEFI variables

Quoted 40 lines · AKASHI Takahiro

We will use two environment contexts for implementing UEFI variables, one (ctx_efi) for non-volatile variables and the other for volatile variables. The latter doesn't have a backing storage.

Those two contexts are currently used only in efi_variable.c and can be moved into there if desired. But I let it under env/ for future use elsewhere.

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       |   1 +
  env/Kconfig.efi   | 152 ++++++++++++++++++++++++++++++++++++++++++++++
  env/Makefile      |   1 +
  env/env_ctx_efi.c | 131 +++++++++++++++++++++++++++++++++++++++
  include/env.h     |   3 +
  5 files changed, 288 insertions(+)

create mode 100644 env/Kconfig.efi
create mode 100644 env/env_ctx_efi.c

env/Kconfig +1 -0
index ae96cf75bbaa..0cd3caa67376 100644
@@ -47,5 +47,6 @@ config ENV_DRV_UBI
  	bool
 
  source "env/Kconfig.uboot"
+source "env/Kconfig.efi"
 
  endmenu
env/Kconfig.efi new file +0 -0
new file mode 100644
index 000000000000..cd4e78989df6

env/Kconfig.efi line 4

Quoted 4 lines
env/Kconfig.efi new file +4 -0
@@ -0,0 +1,152 @@
+if EFI_LOADER
+
+menu "Configure UEFI context"
+

Essentially the 3 variable below exclude each other.

Please, use a 'choice' statement. drivers/video/Kconfig has an example.

Quoted 10 lines
env/Kconfig.efi new file +10 -0
+config ENV_EFI_IS_NOWHERE
+	bool
+	default y if !ENV_EFI_IS_INFLASH && !ENV_EFI_IS_IN_FAT
+
+config ENV_EFI_IS_IN_FAT
+	bool "EFI Environment is in a FAT filesystem"
+	select ENV_DRV_FAT
+	help
+	  Define this if you want to use the FAT file system for
+	  the environment.

env/Kconfig.efi line 24

Quoted 10 lines
env/Kconfig.efi new file +10 -0
+
+config ENV_EFI_IS_IN_FLASH
+	bool "EFI Environment in flash memory"
+	select ENV_DRV_FLASH
+	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

Are we really limited to exactly one sector. Or is this the minimum size?

Quoted 86 lines
env/Kconfig.efi new file +86 -0
+	   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_EFI_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_EFI_OFFSET is used relative to CONFIG_SYS_FLASH_BASE.
+
+	  CONFIG_ENV_EFI_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_EFI_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_EFI_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_EFI_ADDR_REDUND
+	  CONFIG_ENV_EFI_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_EFI_FAT_INTERFACE
+	string "Name of the block device for the environment"
+	depends on ENV_EFI_IS_IN_FAT
+	help
+	  Define this to a string that is the name of the block device.
+
+config ENV_EFI_FAT_DEVICE_AND_PART
+	string "Device and partition for where to store the environment in FAT"
+	depends on ENV_EFI_IS_IN_FAT
+	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.

env/Kconfig.efi line 120

Quoted 10 lines
env/Kconfig.efi new file +10 -0
+
+config ENV_EFI_FAT_FILE
+	string "Name of the FAT file to use for the environment"
+	depends on ENV_EFI_IS_IN_FAT
+	default "uboot_efi.env"
+	help
+	  It's a string of the FAT file name. This file use to store the
+	  environment.
+
+config ENV_EFI_ADDR

'depends on' is missing for this variable and all below.

Quoted 84 lines
env/Kconfig.efi new file +32 -0
+	hex "EFI Environment Address"
+	help
+	  Start address of the device (or partition)
+
+config ENV_EFI_OFFSET
+	hex "EFI Environment Offset"
+	help
+	  Offset from the start of the device (or partition)
+
+config ENV_EFI_SIZE
+	hex "EFI Environment Size"
+	help
+	  Size of the environment storage area
+
+config ENV_EFI_SECT_SIZE
+	hex "EFI Environment Sector-Size"
+	help
+	  Size of the sector containing the environment.
+
+config ENV_EFI_ADDR_REDUND
+	hex "EFI Environment Address for second area"
+	help
+	  Start address of the device (or partition)
+
+config ENV_EFI_SIZE_REDUND
+	hex "EFI Environment Size for second area"
+	help
+	  Size of the environment second storage area
+
+endmenu
+
+endif
env/Makefile +1 -0
index 0168eb47f00d..b6690c73b17f 100644
@@ -4,6 +4,7 @@
  # Wolfgang Denk, DENX Software Engineering, wd at denx.de.
 
  obj-y += common.o env.o env_ctx_uboot.o
+obj-$(CONFIG_EFI_LOADER) += env_ctx_efi.o
 
  ifndef CONFIG_SPL_BUILD
  obj-y += attr.o
env/env_ctx_efi.c new file +34 -0
new file mode 100644
index 000000000000..9b5b2f392179
@@ -0,0 +1,131 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2019 Linaro Limited
+ *		Author: AKASHI Takahiro
+ */
+
+#include <common.h>
+#include <env_flags.h>
+#include <env_internal.h>
+#include <search.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+struct hsearch_data efi_htab = {
+#if CONFIG_IS_ENABLED(ENV_SUPPORT)
+	/* defined in flags.c, only compile with ENV_SUPPORT */
+	.change_ok = env_flags_validate,
+#endif
+};
+
+struct hsearch_data efi_volatile_htab = {
+#if CONFIG_IS_ENABLED(ENV_SUPPORT)
+	/* defined in flags.c, only compile with ENV_SUPPORT */
+	.change_ok = env_flags_validate,
+#endif
+};
+
+static int env_drv_init_efi(struct env_context *ctx, enum env_location loc)
+{
+	__maybe_unused int ret;
+
+	switch (loc) {
+#ifdef CONFIG_ENV_EFI_IS_IN_FLASH
+	case ENVL_FLASH: {

env/env_ctx_efi.c line 44

Quoted 10 lines
env/env_ctx_efi.c new file +10 -0
+		env_t *env_ptr;
+		env_t *flash_addr;
+		ulong end_addr;
+		env_t *flash_addr_new;
+		ulong end_addr_new;
+
+#if defined(CONFIG_ENV_EFI_ADDR_REDUND) && defined(CMD_SAVEENV) || \
+	!defined(CONFIG_ENV_EFI_ADDR_REDUND) && defined(INITENV)
+#ifdef ENV_IS_EMBEDDED
+		/* FIXME: not allowed */

Is something wrong in Kconfig that an non-allowed situation can occur?

Quoted 16 lines
env/env_ctx_efi.c new file +16 -0
+		env_ptr = NULL;
+#else /* ! ENV_IS_EMBEDDED */
+
+		env_ptr = (env_t *)CONFIG_ENV_EFI_ADDR;
+#endif /* ENV_IS_EMBEDDED */
+#else
+		env_ptr = NULL;
+#endif
+		flash_addr = (env_t *)CONFIG_ENV_EFI_ADDR;
+
+/* CONFIG_ENV_EFI_ADDR is supposed to be on sector boundary */
+		end_addr = CONFIG_ENV_EFI_ADDR + CONFIG_ENV_EFI_SECT_SIZE - 1;
+
+#ifdef CONFIG_ENV_EFI_ADDR_REDUND
+		flash_addr_new = (env_t *)CONFIG_ENV_EFI_ADDR_REDUND;
+/* CONFIG_ENV_EFI_ADDR_REDUND is supposed to be on sector boundary */

env/env_ctx_efi.c line 70

Quoted 10 lines
env/env_ctx_efi.c new file +10 -0
+		end_addr_new = CONFIG_ENV_EFI_ADDR_REDUND
+					+ CONFIG_ENV_EFI_SECT_SIZE - 1;
+#else
+		flash_addr_new = NULL;
+		end_addr_new = 0;
+#endif /* CONFIG_ENV_EFI_ADDR_REDUND */
+
+		ret = env_flash_init_params(ctx, env_ptr, flash_addr, end_addr,
+					    flash_addr_new, end_addr_new,
+					    NULL);

The code above needs some comments.

If one area is the old one and the other the new one, how do you toggle between the two?

Quoted 30 lines
env/env_ctx_efi.c new file +30 -0
+		if (ret)
+			return -ENOENT;
+
+		return 0;
+		}
+#endif
+#ifdef CONFIG_ENV_EFI_IS_IN_FAT
+	case ENVL_FAT: {
+		ret = env_fat_init_params(ctx,
+					  CONFIG_ENV_EFI_FAT_INTERFACE,
+					  CONFIG_ENV_EFI_FAT_DEVICE_AND_PART,
+					  CONFIG_ENV_EFI_FAT_FILE);
+
+		return 0;
+		}
+#endif
+#ifdef CONFIG_ENV_DRV_NONE
+	case ENVL_NOWHERE:
+#ifdef CONFIG_ENV_EFI_IS_NOWHERE
+		/* TODO: what we should do */
+
+		return -ENOENT;
+#else
+		return -ENOENT;
+#endif
+#endif
+	default:
+		return -ENOENT;
+	}
+}

env/env_ctx_efi.c line 110

Quoted 10 lines
env/env_ctx_efi.c new file +10 -0
+
+/*
+ * Env context for UEFI variables
+ */
+U_BOOT_ENV_CONTEXT(efi) = {
+	.name = "efi",
+	.htab = &efi_htab,
+	.env_size = 0x10000, /* TODO: make this configurable */
+	.drv_init = env_drv_init_efi,
+};

From the name of this context it is unclear that this is for the
non-volatile variables. Please, adjust the comment.

Quoted 26 lines
env/env_ctx_efi.c new file +21 -0
+
+static int env_ctx_init_efi_volatile(struct env_context *ctx)
+{
+	/* Dummy table creation, or hcreate_r()? */
+	if (!himport_r(ctx->htab, NULL, 0, 0, 0, 0, 0, NULL)) {
+		debug("%s: Creating entry tables failed (ret=%d)\n", __func__,
+		      errno);
+		return errno;
+	}
+
+	env_set_ready(ctx);
+
+	return 0;
+}
+
+U_BOOT_ENV_CONTEXT(efi_volatile) = {
+	.name = "efi_volatile",
+	.htab = &efi_volatile_htab,
+	.env_size = 0,
+	.init = env_ctx_init_efi_volatile,
+};
include/env.h +0 -0
index 8045dda9f811..ec241d419a8a 100644

include/env.h enum env_redund_flags { · line 71

Quoted 6 lines
include/env.h +3 -0
@@ -66,6 +66,9 @@ enum env_redund_flags {
  };
 
  #define ctx_uboot ll_entry_get(struct env_context, uboot, env_contexts)
+#define ctx_efi ll_entry_get(struct env_context, efi, env_contexts)
+#define ctx_efi_volatile ll_entry_get(struct env_context, efi_volatile, \
+				      env_contexts)

I do not like that ll_entry_get() is called again and again in patch 19/19. Please, call ll_entry_get() once for each context and store the reference in a static variable. Than you do not need any of these 3 defines.

Best regards

Heinrich

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

PATCH v5 18/19 env, efi_loader: define env context for UEFI variables

Quoted 48 lines · Heinrich Schuchardt
Quoted 40 lines · AKASHI Takahiro

We will use two environment contexts for implementing UEFI variables, one (ctx_efi) for non-volatile variables and the other for volatile variables. The latter doesn't have a backing storage.

Those two contexts are currently used only in efi_variable.c and can be moved into there if desired. But I let it under env/ for future use elsewhere.

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       |   1 +
 env/Kconfig.efi   | 152 ++++++++++++++++++++++++++++++++++++++++++++++
 env/Makefile      |   1 +
 env/env_ctx_efi.c | 131 +++++++++++++++++++++++++++++++++++++++
 include/env.h     |   3 +
 5 files changed, 288 insertions(+)
 create mode 100644 env/Kconfig.efi
 create mode 100644 env/env_ctx_efi.c
env/Kconfig +1 -0
index ae96cf75bbaa..0cd3caa67376 100644
@@ -47,5 +47,6 @@ config ENV_DRV_UBI
 	bool
 
 source "env/Kconfig.uboot"
+source "env/Kconfig.efi"
 
 endmenu
env/Kconfig.efi new file +0 -0
new file mode 100644
index 000000000000..cd4e78989df6

env/Kconfig.efi line 4

Quoted 4 lines
env/Kconfig.efi new file +4 -0
@@ -0,0 +1,152 @@
+if EFI_LOADER
+
+menu "Configure UEFI context"
+

Essentially the 3 variable below exclude each other.

Quoted 1 line

Please, use a 'choice' statement. drivers/video/Kconfig has an example.

The same comment as uboot context.

Quoted 14 lines
Quoted 14 lines
env/Kconfig.efi new file +14 -0
+config ENV_EFI_IS_NOWHERE
+	bool
+	default y if !ENV_EFI_IS_INFLASH && !ENV_EFI_IS_IN_FAT
+
+config ENV_EFI_IS_IN_FAT
+	bool "EFI Environment is in a FAT filesystem"
+	select ENV_DRV_FAT
+	help
+	  Define this if you want to use the FAT file system for
+	  the environment.
+
+config ENV_EFI_IS_IN_FLASH
+	bool "EFI Environment in flash memory"
+	select ENV_DRV_FLASH
Quoted 8 lines

env/Kconfig.efi line 24

Quoted 6 lines
env/Kconfig.efi new file +6 -0
+	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

Are we really limited to exactly one sector. Or is this the minimum size?

I have not changed this 'help' text from the original env/Kconfig. So I don't know whether or not you are right.

Quoted 90 lines
Quoted 90 lines
env/Kconfig.efi new file +90 -0
+	   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_EFI_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_EFI_OFFSET is used relative to CONFIG_SYS_FLASH_BASE.
+
+	  CONFIG_ENV_EFI_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_EFI_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_EFI_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_EFI_ADDR_REDUND
+	  CONFIG_ENV_EFI_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_EFI_FAT_INTERFACE
+	string "Name of the block device for the environment"
+	depends on ENV_EFI_IS_IN_FAT
+	help
+	  Define this to a string that is the name of the block device.
+
+config ENV_EFI_FAT_DEVICE_AND_PART
+	string "Device and partition for where to store the environment in FAT"
+	depends on ENV_EFI_IS_IN_FAT
+	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_EFI_FAT_FILE
+	string "Name of the FAT file to use for the environment"
+	depends on ENV_EFI_IS_IN_FAT
Quoted 8 lines

env/Kconfig.efi line 120

Quoted 6 lines
env/Kconfig.efi new file +6 -0
+	default "uboot_efi.env"
+	help
+	  It's a string of the FAT file name. This file use to store the
+	  environment.
+
+config ENV_EFI_ADDR

'depends on' is missing for this variable and all below.

Okay.

Quoted 126 lines
Quoted 84 lines
env/Kconfig.efi new file +32 -0
+	hex "EFI Environment Address"
+	help
+	  Start address of the device (or partition)
+
+config ENV_EFI_OFFSET
+	hex "EFI Environment Offset"
+	help
+	  Offset from the start of the device (or partition)
+
+config ENV_EFI_SIZE
+	hex "EFI Environment Size"
+	help
+	  Size of the environment storage area
+
+config ENV_EFI_SECT_SIZE
+	hex "EFI Environment Sector-Size"
+	help
+	  Size of the sector containing the environment.
+
+config ENV_EFI_ADDR_REDUND
+	hex "EFI Environment Address for second area"
+	help
+	  Start address of the device (or partition)
+
+config ENV_EFI_SIZE_REDUND
+	hex "EFI Environment Size for second area"
+	help
+	  Size of the environment second storage area
+
+endmenu
+
+endif
env/Makefile +1 -0
index 0168eb47f00d..b6690c73b17f 100644
@@ -4,6 +4,7 @@
 # Wolfgang Denk, DENX Software Engineering, wd at denx.de.
 
 obj-y += common.o env.o env_ctx_uboot.o
+obj-$(CONFIG_EFI_LOADER) += env_ctx_efi.o
 
 ifndef CONFIG_SPL_BUILD
 obj-y += attr.o
env/env_ctx_efi.c new file +34 -0
new file mode 100644
index 000000000000..9b5b2f392179
@@ -0,0 +1,131 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2019 Linaro Limited
+ *		Author: AKASHI Takahiro
+ */
+
+#include <common.h>
+#include <env_flags.h>
+#include <env_internal.h>
+#include <search.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+struct hsearch_data efi_htab = {
+#if CONFIG_IS_ENABLED(ENV_SUPPORT)
+	/* defined in flags.c, only compile with ENV_SUPPORT */
+	.change_ok = env_flags_validate,
+#endif
+};
+
+struct hsearch_data efi_volatile_htab = {
+#if CONFIG_IS_ENABLED(ENV_SUPPORT)
+	/* defined in flags.c, only compile with ENV_SUPPORT */
+	.change_ok = env_flags_validate,
+#endif
+};
+
+static int env_drv_init_efi(struct env_context *ctx, enum env_location loc)
+{
+	__maybe_unused int ret;
+
+	switch (loc) {
+#ifdef CONFIG_ENV_EFI_IS_IN_FLASH
+	case ENVL_FLASH: {

env/env_ctx_efi.c line 44

Quoted 10 lines
env/env_ctx_efi.c new file +10 -0
+		env_t *env_ptr;
+		env_t *flash_addr;
+		ulong end_addr;
+		env_t *flash_addr_new;
+		ulong end_addr_new;
+
+#if defined(CONFIG_ENV_EFI_ADDR_REDUND) && defined(CMD_SAVEENV) || \
+	!defined(CONFIG_ENV_EFI_ADDR_REDUND) && defined(INITENV)
+#ifdef ENV_IS_EMBEDDED
+		/* FIXME: not allowed */

Is something wrong in Kconfig that an non-allowed situation can occur?

Quoted 16 lines
env/env_ctx_efi.c new file +16 -0
+		env_ptr = NULL;
+#else /* ! ENV_IS_EMBEDDED */
+
+		env_ptr = (env_t *)CONFIG_ENV_EFI_ADDR;
+#endif /* ENV_IS_EMBEDDED */
+#else
+		env_ptr = NULL;
+#endif
+		flash_addr = (env_t *)CONFIG_ENV_EFI_ADDR;
+
+/* CONFIG_ENV_EFI_ADDR is supposed to be on sector boundary */
+		end_addr = CONFIG_ENV_EFI_ADDR + CONFIG_ENV_EFI_SECT_SIZE - 1;
+
+#ifdef CONFIG_ENV_EFI_ADDR_REDUND
+		flash_addr_new = (env_t *)CONFIG_ENV_EFI_ADDR_REDUND;
+/* CONFIG_ENV_EFI_ADDR_REDUND is supposed to be on sector boundary */

env/env_ctx_efi.c line 70

Quoted 10 lines
env/env_ctx_efi.c new file +10 -0
+		end_addr_new = CONFIG_ENV_EFI_ADDR_REDUND
+					+ CONFIG_ENV_EFI_SECT_SIZE - 1;
+#else
+		flash_addr_new = NULL;
+		end_addr_new = 0;
+#endif /* CONFIG_ENV_EFI_ADDR_REDUND */
+
+		ret = env_flash_init_params(ctx, env_ptr, flash_addr, end_addr,
+					    flash_addr_new, end_addr_new,
+					    NULL);

The code above needs some comments.

Quoted 2 lines

If one area is the old one and the other the new one, how do you toggle between the two?

Again, I just mimicked the original init code in env/flash.c. AFAIK, this is not old-or-new stuff, but *redundant* or original-and-copy storages for robustness.
The logic exists in env/flash.c.

Quoted 35 lines
Quoted 35 lines
env/env_ctx_efi.c new file +35 -0
+		if (ret)
+			return -ENOENT;
+
+		return 0;
+		}
+#endif
+#ifdef CONFIG_ENV_EFI_IS_IN_FAT
+	case ENVL_FAT: {
+		ret = env_fat_init_params(ctx,
+					  CONFIG_ENV_EFI_FAT_INTERFACE,
+					  CONFIG_ENV_EFI_FAT_DEVICE_AND_PART,
+					  CONFIG_ENV_EFI_FAT_FILE);
+
+		return 0;
+		}
+#endif
+#ifdef CONFIG_ENV_DRV_NONE
+	case ENVL_NOWHERE:
+#ifdef CONFIG_ENV_EFI_IS_NOWHERE
+		/* TODO: what we should do */
+
+		return -ENOENT;
+#else
+		return -ENOENT;
+#endif
+#endif
+	default:
+		return -ENOENT;
+	}
+}
+
+/*
+ * Env context for UEFI variables
+ */
+U_BOOT_ENV_CONTEXT(efi) = {
Quoted 8 lines

env/env_ctx_efi.c line 110

Quoted 5 lines
env/env_ctx_efi.c new file +5 -0
+	.name = "efi",
+	.htab = &efi_htab,
+	.env_size = 0x10000, /* TODO: make this configurable */
+	.drv_init = env_drv_init_efi,
+};

From the name of this context it is unclear that this is for the non-volatile variables. Please, adjust the comment.

Okay.

Quoted 28 lines
Quoted 28 lines
env/env_ctx_efi.c new file +21 -0
+
+static int env_ctx_init_efi_volatile(struct env_context *ctx)
+{
+	/* Dummy table creation, or hcreate_r()? */
+	if (!himport_r(ctx->htab, NULL, 0, 0, 0, 0, 0, NULL)) {
+		debug("%s: Creating entry tables failed (ret=%d)\n", __func__,
+		      errno);
+		return errno;
+	}
+
+	env_set_ready(ctx);
+
+	return 0;
+}
+
+U_BOOT_ENV_CONTEXT(efi_volatile) = {
+	.name = "efi_volatile",
+	.htab = &efi_volatile_htab,
+	.env_size = 0,
+	.init = env_ctx_init_efi_volatile,
+};
include/env.h +0 -0
index 8045dda9f811..ec241d419a8a 100644
@@ -66,6 +66,9 @@ enum env_redund_flags {
 };
 
Quoted 8 lines

include/env.h enum env_redund_flags { · line 71

Quoted 4 lines
include/env.h +3 -0
 #define ctx_uboot ll_entry_get(struct env_context, uboot, env_contexts)
+#define ctx_efi ll_entry_get(struct env_context, efi, env_contexts)
+#define ctx_efi_volatile ll_entry_get(struct env_context, efi_volatile, \
+				      env_contexts)

I do not like that ll_entry_get() is called again and again in patch 19/19. Please, call ll_entry_get() once for each context and store the reference in a static variable. Than you do not need any of these 3 defines.

Okay.

Thank you for your review,
-Takahiro Akashi

Quoted 9 lines

Best regards

Heinrich

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

PATCH v5 19/19 efi_loader: variable: rework with new env interfaces

In reply to AKASHI Takahiro

In the previous commit, two efi-related contexts were introduced.

With this patch, EFI variables implementation will be modified to support volatile/non-volatile attribute properly in such away as UEFI specification expects; If a variable is non-volatile and modified, its value will be updated in backing storage immediately and preserved across reboot. If volatile, it will be lost after reboot.

---
 lib/efi_loader/efi_variable.c | 91 ++++++++++++++++++++++++++++++++---
 1 file changed, 83 insertions(+), 8 deletions(-)
lib/efi_loader/efi_variable.c +83 -8
index 6687b69a400d..18b9e9e5d9f5 100644
@@ -185,7 +185,9 @@ efi_status_t EFIAPI efi_get_variable(u16 *variable_name,
 
 	EFI_PRINT("get '%s'\n", native_name);
 
-	val = env_get(native_name);
+	val = env_get(ctx_efi, native_name);
+	if (!val)
+		val = env_get(ctx_efi_volatile, native_name);
 	free(native_name);
 	if (!val)
 		return EFI_EXIT(EFI_NOT_FOUND);
@@ -388,12 +390,48 @@ efi_status_t EFIAPI efi_get_next_variable_name(efi_uintn_t *variable_name_size,
 		efi_cur_variable = NULL;
 
 		snprintf(regex, 256, "efi_.*-.*-.*-.*-.*_.*");
-		list_len = hexport_r(&env_htab, '\n',
+		list_len = hexport_r(ctx_efi->htab, '\n',
 				     H_MATCH_REGEX | H_MATCH_KEY,
 				     &efi_variables_list, 0, 1, regexlist);
 		/* 1 indicates that no match was found */
-		if (list_len <= 1)
-			return EFI_EXIT(EFI_NOT_FOUND);
+		if (list_len <= 1) {
+			list_len = hexport_r(ctx_efi_volatile->htab, '\n',
+					     H_MATCH_REGEX | H_MATCH_KEY,
+					     &efi_variables_list, 0, 1,
+					     regexlist);
+
+			if (list_len <= 1)
+				return EFI_EXIT(EFI_NOT_FOUND);
+		} else {
+			char *list_volatile, *list_tmp;
+			size_t total_len;
+
+			list_volatile = NULL;
+			total_len = list_len;
+			list_len = hexport_r(ctx_efi_volatile->htab, '\n',
+					     H_MATCH_REGEX | H_MATCH_KEY,
+					     &list_volatile, 0, 1,
+					     regexlist);
+
+			/* concatenate two lists */
+			if (list_len > 1) {
+				total_len += list_len - 1;
+				list_tmp = efi_variables_list;
+
+				efi_variables_list = malloc(total_len);
+				if (efi_variables_list) {
+					strcpy(efi_variables_list, list_tmp);
+					strcat(efi_variables_list,
+					       list_volatile);
+				}
+
+				free(list_tmp);
+				free(list_volatile);
+
+				if (!efi_variables_list)
+					return EFI_EXIT(EFI_OUT_OF_RESOURCES);
+			}
+		}
 
 		variable = efi_variables_list;
 	}
@@ -424,8 +462,9 @@ efi_status_t EFIAPI efi_set_variable(u16 *variable_name,
 				     efi_uintn_t data_size, const void *data)
 {
 	char *native_name = NULL, *val = NULL, *s;
+	struct env_context *ctx;
+	u32 attr, non_volatile;
 	efi_status_t ret = EFI_SUCCESS;
-	u32 attr;
 
 	EFI_ENTRY("\"%ls\" %pUl %x %zu %p", variable_name, vendor, attributes,
 		  data_size, data);
@@ -447,12 +486,17 @@ efi_status_t EFIAPI efi_set_variable(u16 *variable_name,
 
 	if ((data_size == 0) || !(attributes & ACCESS_ATTR)) {
 		/* delete the variable: */
-		env_set(native_name, NULL);
+		env_set(ctx_efi, native_name, NULL);
 		ret = EFI_SUCCESS;
 		goto out;
 	}
 
-	val = env_get(native_name);
+	if (attributes & EFI_VARIABLE_NON_VOLATILE)
+		ctx = ctx_efi;
+	else
+		ctx = ctx_efi_volatile;
+
+	val = env_get(ctx, native_name);
 	if (val) {
 		parse_attr(val, &attr);
 
@@ -485,6 +529,7 @@ efi_status_t EFIAPI efi_set_variable(u16 *variable_name,
 	 * store attributes
 	 * TODO: several attributes are not supported
 	 */
+	non_volatile = (attributes & EFI_VARIABLE_NON_VOLATILE);
 	attributes &= (EFI_VARIABLE_NON_VOLATILE |
 		       EFI_VARIABLE_BOOTSERVICE_ACCESS |
 		       EFI_VARIABLE_RUNTIME_ACCESS);
@@ -512,7 +557,9 @@ efi_status_t EFIAPI efi_set_variable(u16 *variable_name,
 
 	EFI_PRINT("setting: %s=%s\n", native_name, val);
 
-	if (env_set(native_name, val))
+	if (env_set(ctx, native_name, val))
+		ret = EFI_DEVICE_ERROR;
+	else if (non_volatile && env_save(ctx))
 		ret = EFI_DEVICE_ERROR;
 
 out:
@@ -619,5 +666,33 @@ void efi_variables_boot_exit_notify(void)
  */
 efi_status_t efi_init_variables(void)
 {
+	int ret;
+
+	/*
+	 * Volatile variables:
+	 * Context for volatile variables has no backing storage
+	 */
+	ret = env_ctx_init(ctx_efi_volatile);
+	if (ret) {
+		printf("Initializing efi variables(volatile) failed\n");
+
+		return EFI_DEVICE_ERROR;
+	}
+
+	/* Non-Volatile variables */
+	ret = env_ctx_init(ctx_efi);
+	if (ret) {
+		printf("Initializing efi variables failed\n");
+
+		return EFI_DEVICE_ERROR;
+	}
+
+	ret = env_load(ctx_efi);
+	if (ret && ret != -ENODEV) {
+		printf("Loading efi variables failed\n");
+
+		return EFI_DEVICE_ERROR;
+	}
+
 	return EFI_SUCCESS;
 }
Signature · 1 line
2.21.0
#26 lore raw

v5 cover efi_loader: non-volatile variables support

In reply to AKASHI Takahiro

One more issue:
* Currently, Travis CI fails in lots of builds. I will try to fix them in the succeeding versions.

-Takahiro Akashi

Quoted 551 lines · AKASHI Takahiro

# 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
#27 lore raw

v5 cover efi_loader: non-volatile variables support

In reply to AKASHI Takahiro

Wolfgang,

I haven't seen any comments from you in the last one month. Could you please take time to review this patch? I'd like to confirm whether you can agree to my approach here or not in order to take the next step.

Thanks,
-Takahiro Akashi

Quoted 551 lines · AKASHI Takahiro

# 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
#28 lore raw

v5 cover efi_loader: non-volatile variables support

Wolfgang,

This is my second ping.
Could you please take time to review this patch?

-Takahiro Akashi

Quoted 562 lines · AKASHI Takahiro

Wolfgang,

I haven't seen any comments from you in the last one month. Could you please take time to review this patch? I'd like to confirm whether you can agree to my approach here or not in order to take the next step.

Thanks,
-Takahiro Akashi

Quoted 551 lines · AKASHI Takahiro

# 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
#29 lore raw

v5 cover efi_loader: non-volatile variables support

Dear Takahiro,

Quoted 3 lines · In message <[email protected]> you wrote:

This is my second ping.
Could you please take time to review this patch?

Sorry, I'm afraid I will not find the time to review any such monster patch series any time soon. I hope Joe (added to Cc:) has more resources available.

Only a few comments below...

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

# 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,
371 files changed, 3690 insertions(+), 2337 deletions(-)

I don't know what your scales are, but for me such a patch is extremely invasive. It affects a zillion of files in common code plus a ton of board specific files.

I did not find any information about the size impact or if the modified code continues to build for all boards - I remember we have a number of board with tight resources here and there.

You should at least provide some information how much bigger the new code gets.

From a quick glance I think the patches are not cleanly separated - you cannot change interfaces for the implementation in one step and for the callers in another, as this breaks bisectability.

My biggest concern is that such a highly invasive change cannot be simply rubberstamped in a code review - I think this also needs runtime testing on at least a significant number of the affected boards. We should try to get help from at least some board maintainers - maybe you should ask for help for such testing n the board maintainers mailing list?

Please do not misunderstand me - I am not trying to block any of this - I understand and appreciate the huge amount of efforts you have put into this. But I feel this needs not only careful review, but also actual testing on as many of the effected boards as possible, and I simply don't have time for that.

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

* 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*.)

I wonder if we really need to change all interfaces. I fear the size impact might bite us. I only had a glimpse at the actual code, but it seemed to me as if we were just pssing the same information around everywhere. Could we not use GD nstead, for example?

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

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

I don't understand what this means, or why such a decision was made. Which sub-systems do you have in mind here?
What prevented you from implementing a solution to works for all of us?

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

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.

I think we still have a different opinion here, but I'm lacking time for a thorough readding of the new code, so I hold back. I hope that Joe can have a closer look...

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

* 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.

If I see this correctly, there is a fundamental change in the implementation before: Up to now, the environment seize on external storage has been a compile time constant (CONFIG_ENV_SIZE).

Now this value gets computed, and I'm not even sure if this is a contant at run time.

This scares me. Does this not break compatibility? How do you upgrade a system from an older version of U-Boot to one with your patches?

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

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.)

OK, so you are aware of this problem.

I must admit that I really hate this. If you could avoid all the API changes, this would solve this problem, wouldn't it?

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

* 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.

Argh. This is a killing point, isn't it?

You don't seriously expect to have patches which cause "incomprehensible memory corruption" to be included into mainline?

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

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

This is only true for UEFI variables, right?

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

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

    -> This is not UEFI specific though.

Is this a new problem, or do you just mention this here for completeness? We always had this issue, didn't we?

Quoted 1 line
Quoted 1 line
Quoted 1 line

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

Sure, so please seek help from the board maintainers.

And please provide size statistics.

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

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

How much testing can be done on boards that don't use FAT to store the environment?

Sorry that I can't be of any better help here...

Best regards,

Wolfgang Denk

Signature · 9 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
'What shall we do?' said Twoflower.  'Panic?'  said  Rincewind  hope-
fully. He always held that panic was the best means of survival; back
in  the  olden days, his theory went, people faced with hungry sabre-
toothed tigers could be divided very simply in those who panicked and
those who stood there saying 'What a magnificent  brute!'  or  'Here,
pussy.'                      - Terry Pratchett, _The Light Fantastic_
#30 lore raw

v5 cover efi_loader: non-volatile variables support

Hi Wolfgang,

Quoted 4 lines · Wolfgang Denk

Dear Takahiro,

Quoted 1 line · In message <[email protected]> you wrote:
Quoted 8 lines
Quoted 2 lines

This is my second ping.
Could you please take time to review this patch?

Sorry, I'm afraid I will not find the time to review any such monster patch series any time soon. I hope Joe (added to Cc:) has more resources available.

Only a few comments below...

I won't and cannot make replies on every comment that you gave me below because we are very different at some basic points and other comments are just details.

Quoted 15 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

# 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,
371 files changed, 3690 insertions(+), 2337 deletions(-)

I don't know what your scales are, but for me such a patch is extremely invasive. It affects a zillion of files in common code plus a ton of board specific files.

I did not find any information about the size impact or if the modified code continues to build for all boards - I remember we have a number of board with tight resources here and there.

Quoted 6 lines

You should at least provide some information how much bigger the new code gets.

From a quick glance I think the patches are not cleanly separated - you cannot change interfaces for the implementation in one step and for the callers in another, as this breaks bisectability.

As you noticed below, I'm aware of that.
So first I wanted to know if you agree to my *basic* approach or not, not details, in order to go further, but still don't see yes or no below.

Quoted 9 lines

My biggest concern is that such a highly invasive change cannot be simply rubberstamped in a code review - I think this also needs runtime testing on at least a significant number of the affected boards. We should try to get help from at least some board maintainers - maybe you should ask for help for such testing n the board maintainers mailing list?

Quoted 5 lines

Please do not misunderstand me - I am not trying to block any of this - I understand and appreciate the huge amount of efforts you have put into this. But I feel this needs not only careful review, but also actual testing on as many of the effected boards as possible, and I simply don't have time for that.

Okay.

Quoted 11 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

* 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*.)

I wonder if we really need to change all interfaces. I fear the size impact might bite us. I only had a glimpse at the actual code, but it seemed to me as if we were just pssing the same information around everywhere. Could we not use GD nstead, for example?

Quoted 5 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

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

I don't understand what this means, or why such a decision was made. Which sub-systems do you have in mind here?

UEFI sub-system/library.

Quoted 10 lines

What prevented you from implementing a solution to works for all of us?

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

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.

Quoted 3 lines

I think we still have a different opinion here, but I'm lacking time for a thorough readding of the new code, so I hold back. I hope that Joe can have a closer look...

You don't have to worry about my previous versions. Just focus on the current v5.

Quoted 8 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

* 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.

Quoted 6 lines

If I see this correctly, there is a fundamental change in the implementation before: Up to now, the environment seize on external storage has been a compile time constant (CONFIG_ENV_SIZE).

Now this value gets computed, and I'm not even sure if this is a contant at run time.

Yes, it's constant for "U-Boot environment" (== U-Boot variables) context. But for other sus-systems, in my case UEFI, the total size of storage for (UEFI) variables may be different, but still constant.

Quoted 10 lines

This scares me. Does this not break compatibility? How do you upgrade a system from an older version of U-Boot to one with your patches?

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

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.)

Quoted 4 lines

OK, so you are aware of this problem.

I must admit that I really hate this. If you could avoid all the API changes, this would solve this problem, wouldn't it?

"Avoid all the API changes" is an approach that I took in all my previous versions, but you *denied* it.

That is: I proposed an approach in which the existing interfaces, env_get/set(), were maintained for existing users/sub-systems. Only new users who want to enjoy merits from new "context" feature may use new *extended* interfaces, env_[get|set]_ext(), in my case UEFI. As you *denied* it, this version (v5) is an inevitable result.

Don't take me wrong, but I think that you made inconsistent comments.

Quoted 8 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

* 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.

Argh. This is a killing point, isn't it?

You don't seriously expect to have patches which cause "incomprehensible memory corruption" to be included into mainline?

It will be just a matter of time for debugging.

Quoted 4 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

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

This is only true for UEFI variables, right?

Yes.

Quoted 6 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

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

    -> This is not UEFI specific though.

Is this a new problem, or do you just mention this here for completeness? We always had this issue, didn't we?

As I said, "this is not UEFI specific."

Quoted 13 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line

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

Sure, so please seek help from the board maintainers.

And please provide size statistics.

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

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

Quoted 2 lines

How much testing can be done on boards that don't use FAT to store the environment?

As I said,

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

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

If you don't think my patch is not qualified for a "PATCH" for some reason, I will sent one as "RFC" from the next version. I don't care.

Thanks,
-Takahiro Akashi

Quoted 17 lines

Sorry that I can't be of any better help here...

Best regards,

Wolfgang Denk

Signature · 9 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
'What shall we do?' said Twoflower.  'Panic?'  said  Rincewind  hope-
fully. He always held that panic was the best means of survival; back
in  the  olden days, his theory went, people faced with hungry sabre-
toothed tigers could be divided very simply in those who panicked and
those who stood there saying 'What a magnificent  brute!'  or  'Here,
pussy.'                      - Terry Pratchett, _The Light Fantastic_
#31 lore raw

v5 cover efi_loader: non-volatile variables support

Dear Takahiro,

Quoted 4 lines · In message <[email protected]> you wrote:

I won't and cannot make replies on every comment that you gave me below because we are very different at some basic points and other comments are just details.

Can you please at least comment on the size impact? How much does the code size grow on everage, especially for SPL?

Quoted 3 lines

So first I wanted to know if you agree to my *basic* approach or not, not details, in order to go further, but still don't see yes or no below.

To be honest: when I saw your monster patch series which basically touches every piece of code in U-Boot, I felt a strong temptation to just send a NAK and be done with it. But I know this would not be fair. But to be able to say yes I would need days to review the code and probably run some tests myself, and I don;t have that time.

So I can neither say yes or no, sorry.

Quoted 6 lines
Quoted 6 lines

My biggest concern is that such a highly invasive change cannot be simply rubberstamped in a code review - I think this also needs runtime testing on at least a significant number of the affected boards. We should try to get help from at least some board maintainers - maybe you should ask for help for such testing n the board maintainers mailing list?

This is a point which is important to me. We need at least a few "Tested-by" credits...

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

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

I don't understand what this means, or why such a decision was made. Which sub-systems do you have in mind here?

UEFI sub-system/library.

What needs to be done to have this - say - for U-Boot context?

Quoted 2 lines
Quoted 2 lines

What prevented you from implementing a solution to works for all of us?

?

Quoted 14 lines
Quoted 10 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

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.)

OK, so you are aware of this problem.

I must admit that I really hate this. If you could avoid all the API changes, this would solve this problem, wouldn't it?

"Avoid all the API changes" is an approach that I took in all my previous versions, but you *denied* it.

Quoted 7 lines

That is: I proposed an approach in which the existing interfaces, env_get/set(), were maintained for existing users/sub-systems. Only new users who want to enjoy merits from new "context" feature may use new *extended* interfaces, env_[get|set]_ext(), in my case UEFI. As you *denied* it, this version (v5) is an inevitable result.

Don't take me wrong, but I think that you made inconsistent comments.

I think you misunderstand. If we just need the same pointer in all functions dealing with the environment, there are at least two ways to implement this: we can add it as an argument to each and every function call; this will blow up code size and also impact execution speed. Or we can add it to some (private or public) data structure that is visible everywhere. In the simplest case we could add such a pointer to the global data (GD) structure as I suggested in my previous mail. this would allow you to use basically the same code as now, but without needing to change all the argument lists. In the result, you could drop your modifications of all common and board specififc files. The code changes would be concentrated on the environment code, and it should be anle to submit bisectable patches again.

Yes, global variables have disadvantages, too, but does it not make sense here? I think we will have only one active environment context at any time in U-Boot, so this seems to be at least a lesser evil than the zillion of changes of all call arguments.

Quoted 10 lines
Quoted 8 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

* 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.

Argh. This is a killing point, isn't it?

You don't seriously expect to have patches which cause "incomprehensible memory corruption" to be included into mainline?

It will be just a matter of time for debugging.

It might be difficult to find willing testers under such circumstances. I would not want to run code with serious known bugs.

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

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

    -> This is not UEFI specific though.

Is this a new problem, or do you just mention this here for completeness? We always had this issue, didn't we?

As I said, "this is not UEFI specific."

This does not answer my question. Are you just refering to the general problem that a write to the persistent storage area might fail, which has ever been present and which is inherently unfixxable, or does your new code add any additional problems of this kind?

Quoted 9 lines
Quoted 2 lines

How much testing can be done on boards that don't use FAT to store the environment?

As I said,

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

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

If you don't think my patch is not qualified for a "PATCH" for some reason, I will sent one as "RFC" from the next version. I don't care.

I think this is a new feature that needs to be tested. You focus on UEFI + FAT and I don't know if UEFI + non-FAT makes sense, but at least (1) non-UEFI + FAT and (2) non-UEFI + non-FAT are configurations which must be tested - absolute minimum is at least one example implementation. My suggestion would be to use something that is not file system based, but using plain storage, say a board which has the environment in SPI NOR flash.

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Our OS who art in CPU, UNIX be thy name.
Thy programs run, thy syscalls done,
In kernel as it is in user!
#32 lore raw

v5 cover efi_loader: non-volatile variables support

Wolfgang,

Quoted 10 lines · Wolfgang Denk

Dear Takahiro,

Quoted 4 lines · In message <[email protected]> you wrote:

I won't and cannot make replies on every comment that you gave me below because we are very different at some basic points and other comments are just details.

Can you please at least comment on the size impact? How much does the code size grow on everage, especially for SPL?

Well, from the next version as I will make a drastic change as far as I follow your suggestion below.

Quoted 10 lines
Quoted 4 lines

So first I wanted to know if you agree to my *basic* approach or not, not details, in order to go further, but still don't see yes or no below.

To be honest: when I saw your monster patch series which basically touches every piece of code in U-Boot, I felt a strong temptation to just send a NAK and be done with it. But I know this would not be fair. But to be able to say yes I would need days to review the code and probably run some tests myself, and I don;t have that time.

Okay, I see but I hope that you should have said so much earlier. My patch (v5) has been stranded almost two months without any comments.

Quoted 18 lines

So I can neither say yes or no, sorry.

Quoted 6 lines
Quoted 6 lines

My biggest concern is that such a highly invasive change cannot be simply rubberstamped in a code review - I think this also needs runtime testing on at least a significant number of the affected boards. We should try to get help from at least some board maintainers - maybe you should ask for help for such testing n the board maintainers mailing list?

This is a point which is important to me. We need at least a few "Tested-by" credits...

Quoted 6 lines
Quoted 5 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

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

I don't understand what this means, or why such a decision was made. Which sub-systems do you have in mind here?

Quoted 8 lines
Quoted 1 line

UEFI sub-system/library.

What needs to be done to have this - say - for U-Boot context?

Quoted 2 lines
Quoted 2 lines

What prevented you from implementing a solution to works for all of us?

?

At least for me or UEFI, nothing more, other than a *context*, is needed to meet the requirement.
If some one really want to have such(?) a feature, he or she can on top of my patch.
I believe that my attitude here is fair enough.

Quoted 37 lines
Quoted 15 lines
Quoted 11 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

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.)

OK, so you are aware of this problem.

I must admit that I really hate this. If you could avoid all the API changes, this would solve this problem, wouldn't it?

"Avoid all the API changes" is an approach that I took in all my previous versions, but you *denied* it.

Quoted 7 lines

That is: I proposed an approach in which the existing interfaces, env_get/set(), were maintained for existing users/sub-systems. Only new users who want to enjoy merits from new "context" feature may use new *extended* interfaces, env_[get|set]_ext(), in my case UEFI. As you *denied* it, this version (v5) is an inevitable result.

Don't take me wrong, but I think that you made inconsistent comments.

I think you misunderstand. If we just need the same pointer in all functions dealing with the environment, there are at least two ways to implement this: we can add it as an argument to each and every function call; this will blow up code size and also impact execution speed. Or we can add it to some (private or public) data structure that is visible everywhere. In the simplest case we could add such a pointer to the global data (GD) structure as I suggested in my previous mail. this would allow you to use basically the same code as now, but without needing to change all the argument lists. In the result, you could drop your modifications of all common and board specififc files. The code changes would be concentrated on the environment code, and it should be anle to submit bisectable patches again.

Quoted 4 lines

Yes, global variables have disadvantages, too, but does it not make sense here? I think we will have only one active environment context at any time in U-Boot, so this seems to be at least a lesser evil than the zillion of changes of all call arguments.

I have thought of an idea as you mentioned above before but immediately gave it up as it seems to be an ugly implementation and I simply dislike it. But if you and Tom (or whoever can say ACK to my patch) think that it is the *only* solution that you can accept, I will have to change my mind.

So do you always admit the following coding?
===8<===
(in some UEFI function)
...
old_ctx = env_set_context(ctx_uefi);
env_set(var, value);
env_set_context(old_ctx);
...
===>8===

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

* 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.

Argh. This is a killing point, isn't it?

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

You don't seriously expect to have patches which cause "incomprehensible memory corruption" to be included into mainline?

It will be just a matter of time for debugging.

It might be difficult to find willing testers under such circumstances. I would not want to run code with serious known bugs.

I believe that the issue is independent from the basic approach that we are now discussing.

Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

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

    -> This is not UEFI specific though.

Is this a new problem, or do you just mention this here for completeness? We always had this issue, didn't we?

Quoted 7 lines
Quoted 1 line

As I said, "this is not UEFI specific."

This does not answer my question. Are you just refering to the general problem that a write to the persistent storage area might fail, which has ever been present and which is inherently unfixxable, or does your new code add any additional problems of this kind?

A general problem in your term.

Quoted 10 lines
Quoted 9 lines
Quoted 2 lines

How much testing can be done on boards that don't use FAT to store the environment?

As I said,

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

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

If you don't think my patch is not qualified for a "PATCH" for some reason, I will sent one as "RFC" from the next version. I don't care.

Quoted 7 lines

I think this is a new feature that needs to be tested. You focus on UEFI + FAT and I don't know if UEFI + non-FAT makes sense, but at least (1) non-UEFI + FAT and (2) non-UEFI + non-FAT are configurations which must be tested - absolute minimum is at least one example implementation. My suggestion would be to use something that is not file system based, but using plain storage, say a board which has the environment in SPI NOR flash.

What do you mean by "non-UEFI"? Disabling UEFI, or testing U-Boot environment variables on no-FAT device?
If the latter, I have tested it with flash (on qemu).

Thanks,
-Takahiro Akashi

Quoted 11 lines

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Our OS who art in CPU, UNIX be thy name.
Thy programs run, thy syscalls done,
In kernel as it is in user!
#33 lore raw

v5 cover efi_loader: non-volatile variables support

Dear Takahiro,

Quoted 6 lines · In message <[email protected]> you wrote:
Quoted 3 lines

Can you please at least comment on the size impact? How much does the code size grow on everage, especially for SPL?

Well, from the next version as I will make a drastic change as far as I follow your suggestion below.

OK.

Quoted 2 lines

Okay, I see but I hope that you should have said so much earlier. My patch (v5) has been stranded almost two months without any comments.

I have said so uin lcear and unmistakable words when discussion was to add me as maintainer for environment code. I cannot commit to such a position as I don't have enough time available.

Quoted 13 lines
Quoted 13 lines
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

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

I don't understand what this means, or why such a decision was made. Which sub-systems do you have in mind here?

UEFI sub-system/library.

What needs to be done to have this - say - for U-Boot context?

Quoted 2 lines
Quoted 2 lines

What prevented you from implementing a solution to works for all of us?

Quoted 7 lines
Quoted 1 line

?

At least for me or UEFI, nothing more, other than a *context*, is needed to meet the requirement.
If some one really want to have such(?) a feature, he or she can on top of my patch.
I believe that my attitude here is fair enough.

I would appreciate if you could actually answer my questions. there are two of them:

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

Q1: Why did you not implement this feature in a generic way, so it
is automatically available to all sub-systems that support contexts?

Q2: What exactly needs to be done, which code needs to be writtenm,
to implement this feature - say - for U-Boot context?

Quoted 9 lines

So do you always admit the following coding?
===8<===
(in some UEFI function)
...
old_ctx = env_set_context(ctx_uefi);
env_set(var, value);
env_set_context(old_ctx);
...
===>8===

This is even worse, as instead of adding a single argument to a function call you are adding two full fucntion calls.

But why would that be needed?

U-Boot is strictly single tasking. You always know what the current context is, and nobody will change it behind your back.

And UEFI functions are not being called in random places, they are limited to a small set of UEFI commands, right? So why do you not just enter UEFI context when you start executing UEFI code, and restore the rpevious state when returning to non-UEFI U-Boot?

Or am I missing something?

Quoted 11 lines
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

You don't seriously expect to have patches which cause "incomprehensible memory corruption" to be included into mainline?

It will be just a matter of time for debugging.

It might be difficult to find willing testers under such circumstances. I would not want to run code with serious known bugs.

I believe that the issue is independent from the basic approach that we are now discussing.

The reason of this problem must be understood and the bug fixed before it can go into mainline.

Quoted 11 lines
Quoted 7 lines

I think this is a new feature that needs to be tested. You focus on UEFI + FAT and I don't know if UEFI + non-FAT makes sense, but at least (1) non-UEFI + FAT and (2) non-UEFI + non-FAT are configurations which must be tested - absolute minimum is at least one example implementation. My suggestion would be to use something that is not file system based, but using plain storage, say a board which has the environment in SPI NOR flash.

What do you mean by "non-UEFI"? Disabling UEFI, or testing U-Boot environment variables on no-FAT device?
If the latter, I have tested it with flash (on qemu).

We need to test if the new context code works (and does not cause problems) on systems where UEFI is not enabled.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Don't you know anything? I should have thought anyone knows that  who
knows anything about anything...      - Terry Pratchett, _Soul Music_
#34 lore raw

v5 cover efi_loader: non-volatile variables support

Wolfgang,

I would like to focus on the critical and most arguable point in this email.

Quoted 69 lines · Wolfgang Denk

Dear Takahiro,

Quoted 6 lines · In message <[email protected]> you wrote:
Quoted 3 lines

Can you please at least comment on the size impact? How much does the code size grow on everage, especially for SPL?

Well, from the next version as I will make a drastic change as far as I follow your suggestion below.

OK.

Quoted 2 lines

Okay, I see but I hope that you should have said so much earlier. My patch (v5) has been stranded almost two months without any comments.

I have said so uin lcear and unmistakable words when discussion was to add me as maintainer for environment code. I cannot commit to such a position as I don't have enough time available.

Quoted 13 lines
Quoted 13 lines
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

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

I don't understand what this means, or why such a decision was made. Which sub-systems do you have in mind here?

UEFI sub-system/library.

What needs to be done to have this - say - for U-Boot context?

Quoted 2 lines
Quoted 2 lines

What prevented you from implementing a solution to works for all of us?

Quoted 7 lines
Quoted 1 line

?

At least for me or UEFI, nothing more, other than a *context*, is needed to meet the requirement.
If some one really want to have such(?) a feature, he or she can on top of my patch.
I believe that my attitude here is fair enough.

I would appreciate if you could actually answer my questions. there are two of them:

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

Q1: Why did you not implement this feature in a generic way, so it
is automatically available to all sub-systems that support contexts?

Q2: What exactly needs to be done, which code needs to be writtenm,
to implement this feature - say - for U-Boot context?

Quoted 9 lines

So do you always admit the following coding?
===8<===
(in some UEFI function)
...
old_ctx = env_set_context(ctx_uefi);
env_set(var, value);
env_set_context(old_ctx);
...
===>8===

This is even worse, as instead of adding a single argument to a function call you are adding two full fucntion calls.

But why would that be needed?

Quoted 7 lines

U-Boot is strictly single tasking. You always know what the current context is, and nobody will change it behind your back.

And UEFI functions are not being called in random places, they are limited to a small set of UEFI commands, right? So why do you not just enter UEFI context when you start executing UEFI code, and restore the rpevious state when returning to non-UEFI U-Boot?

Can you elaborate What you mean by "entering UEFI context"?

What I'm thinking of here is that we would add one more member field, which is a pointer to my "env_context," in GD and change it in env_set_context(). This can be defined even as an inline function.
(My other patches, at least patch#1 to #6, can be used almost as they are.)

I don't see why you deny such a simple solution with lots of flexibility.

-Takahiro Akashi

Quoted 42 lines

Or am I missing something?

Quoted 11 lines
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

You don't seriously expect to have patches which cause "incomprehensible memory corruption" to be included into mainline?

It will be just a matter of time for debugging.

It might be difficult to find willing testers under such circumstances. I would not want to run code with serious known bugs.

I believe that the issue is independent from the basic approach that we are now discussing.

The reason of this problem must be understood and the bug fixed before it can go into mainline.

Quoted 11 lines
Quoted 7 lines

I think this is a new feature that needs to be tested. You focus on UEFI + FAT and I don't know if UEFI + non-FAT makes sense, but at least (1) non-UEFI + FAT and (2) non-UEFI + non-FAT are configurations which must be tested - absolute minimum is at least one example implementation. My suggestion would be to use something that is not file system based, but using plain storage, say a board which has the environment in SPI NOR flash.

What do you mean by "non-UEFI"? Disabling UEFI, or testing U-Boot environment variables on no-FAT device?
If the latter, I have tested it with flash (on qemu).

We need to test if the new context code works (and does not cause problems) on systems where UEFI is not enabled.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Don't you know anything? I should have thought anyone knows that  who
knows anything about anything...      - Terry Pratchett, _Soul Music_
#35 lore raw

v5 cover efi_loader: non-volatile variables support

Dear Takahiro,

Quoted 9 lines · In message <[email protected]> you wrote:
Quoted 9 lines

This is even worse, as instead of adding a single argument to a function call you are adding two full fucntion calls.

But why would that be needed?

U-Boot is strictly single tasking. You always know what the current context is, and nobody will change it behind your back.

Quoted 6 lines
Quoted 4 lines

And UEFI functions are not being called in random places, they are limited to a small set of UEFI commands, right? So why do you not just enter UEFI context when you start executing UEFI code, and restore the rpevious state when returning to non-UEFI U-Boot?

Can you elaborate What you mean by "entering UEFI context"?

You wrote:

| So do you always admit the following coding?
| ===8<===
|   (in some UEFI function)
|   ...
|   old_ctx = env_set_context(ctx_uefi);
|   env_set(var, value);
|   env_set_context(old_ctx);
|   ...
| ===>8===

In this code, the function call ``env_set_context(ctx_uefi)'' would enter the UEFI context, right? This is what I mean.

Quoted 3 lines

What I'm thinking of here is that we would add one more member field, which is a pointer to my "env_context," in GD and change it in env_set_context(). This can be defined even as an inline function.

Yes, this is OK - I think I understood this already.

What I mean is that such a call of env_set_context() is not needed for each and every call of other env_*() functions.

If I understand correctly, only the UEFI specific commands will actually care about UEFI contexts - most likely no code outside cmd/nvedit_efi.c ?

So you have pretty clear entry and exit points into and from the UEFI world, and it should be sufficient to set and restore this context only then.

Quoted 1 line

I don't see why you deny such a simple solution with lots of flexibility.

I am concerned about code size and execution speed. So far, you did not provide any such numbers, even though I repeatedly asked for the size impact, especially for non-UEFI systems.

Please keep in mind that there are many cases where we need access to the environment already in SPL, and on all systems where security plays any role we must have the same set of features enabled for the environment code in SPL and TPL (if these need access to the envronment) as in U-Boot proper, and memory is a precious resource there.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
You may call me by my name, Wirth, or by my value, Worth.
- Nicklaus Wirth
#36 lore raw

v5 cover efi_loader: non-volatile variables support

Quoted 57 lines · Wolfgang Denk

Dear Takahiro,

Quoted 9 lines · In message <[email protected]> you wrote:
Quoted 9 lines

This is even worse, as instead of adding a single argument to a function call you are adding two full fucntion calls.

But why would that be needed?

U-Boot is strictly single tasking. You always know what the current context is, and nobody will change it behind your back.

Quoted 6 lines
Quoted 4 lines

And UEFI functions are not being called in random places, they are limited to a small set of UEFI commands, right? So why do you not just enter UEFI context when you start executing UEFI code, and restore the rpevious state when returning to non-UEFI U-Boot?

Can you elaborate What you mean by "entering UEFI context"?

You wrote:

| So do you always admit the following coding?
| ===8<===
|   (in some UEFI function)
|   ...
|   old_ctx = env_set_context(ctx_uefi);
|   env_set(var, value);
|   env_set_context(old_ctx);
|   ...
| ===>8===

In this code, the function call ``env_set_context(ctx_uefi)'' would enter the UEFI context, right? This is what I mean.

Quoted 3 lines

What I'm thinking of here is that we would add one more member field, which is a pointer to my "env_context," in GD and change it in env_set_context(). This can be defined even as an inline function.

Yes, this is OK - I think I understood this already.

What I mean is that such a call of env_set_context() is not needed for each and every call of other env_*() functions.

If I understand correctly, only the UEFI specific commands will actually care about UEFI contexts - most likely no code outside cmd/nvedit_efi.c ?

So you have pretty clear entry and exit points into and from the UEFI world, and it should be sufficient to set and restore this context only then.

Quoted 1 line

I don't see why you deny such a simple solution with lots of flexibility.

I am concerned about code size and execution speed. So far, you did not provide any such numbers, even though I repeatedly asked for the size impact, especially for non-UEFI systems.

Quoted 6 lines

Please keep in mind that there are many cases where we need access to the environment already in SPL, and on all systems where security plays any role we must have the same set of features enabled for the environment code in SPL and TPL (if these need access to the envronment) as in U-Boot proper, and memory is a precious resource there.

I too am very concerned that whatever we come up with here needs to have between zero and near-zero impact on the rest of the U-Boot world. We've once again hit the case where some boards don't build due to bugfixes increasing their binary size. And they aren't "no one uses these, we can drop them" boards either.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20191104/23848b1b/attachment.sig>
#37 lore raw

v5 cover efi_loader: non-volatile variables support

In reply to Wolfgang Denk

Wolfgang,

Quoted 31 lines · Wolfgang Denk

Dear Takahiro,

Quoted 9 lines · In message <[email protected]> you wrote:
Quoted 9 lines

This is even worse, as instead of adding a single argument to a function call you are adding two full fucntion calls.

But why would that be needed?

U-Boot is strictly single tasking. You always know what the current context is, and nobody will change it behind your back.

Quoted 6 lines
Quoted 4 lines

And UEFI functions are not being called in random places, they are limited to a small set of UEFI commands, right? So why do you not just enter UEFI context when you start executing UEFI code, and restore the rpevious state when returning to non-UEFI U-Boot?

Can you elaborate What you mean by "entering UEFI context"?

You wrote:

| So do you always admit the following coding?
| ===8<===
|   (in some UEFI function)
|   ...
|   old_ctx = env_set_context(ctx_uefi);
|   env_set(var, value);
|   env_set_context(old_ctx);
|   ...
| ===>8===
Quoted 2 lines

In this code, the function call ``env_set_context(ctx_uefi)'' would enter the UEFI context, right? This is what I mean.

My point is not there. See below.

Quoted 5 lines
Quoted 3 lines

What I'm thinking of here is that we would add one more member field, which is a pointer to my "env_context," in GD and change it in env_set_context(). This can be defined even as an inline function.

Yes, this is OK - I think I understood this already.

So we get one step closer.

Quoted 6 lines

What I mean is that such a call of env_set_context() is not needed for each and every call of other env_*() functions.

If I understand correctly, only the UEFI specific commands will actually care about UEFI contexts - most likely no code outside cmd/nvedit_efi.c ?

No. There are a couple of reasons:
1) Other commands include cmd/bootefi.c (and cmd/efidebug.c).
2) Any EFI application, once kicked off, can directly call EFI APIs.
3) Bunch of EFI features (either services or protocols) fundamentally reply on U-Boot native functionality, including devices (disk, network, console, ...), file systems and so on.

So calling such UEFI interfaces may eventually end up with invoking env_*() *indirectly*. I don't come up with good examples (probably, network is a candidate) now but such a situation will be quite likely and we should not exclude such a possibility in the future.

Quoted 3 lines

So you have pretty clear entry and exit points into and from the UEFI world, and it should be sufficient to set and restore this context only then.

My point is what entry or exit points are.
They cannot be at each command, but *each* API.
So, let me repeat this example:
===8<===
(in some UEFI function)
...
old_ctx = env_set_context(ctx_uefi);
env_set(var, value);
env_set_context(old_ctx);
...
===>8===

This can be at most relaxed to:
===8<===
some_efi_api(...)
{
old_ctx = env_set_context(ctx_uefi);
...
(env_get(var1);)
...
env_set(var2, value);
...
env_set_context(old_ctx);

return;
}
===>8===
It is merely a matter of optimization.
This is the reason that I want to introduce env_set_context().

Thanks,
-Takahiro Akashi

Quoted 23 lines
Quoted 1 line

I don't see why you deny such a simple solution with lots of flexibility.

I am concerned about code size and execution speed. So far, you did not provide any such numbers, even though I repeatedly asked for the size impact, especially for non-UEFI systems.

Please keep in mind that there are many cases where we need access to the environment already in SPL, and on all systems where security plays any role we must have the same set of features enabled for the environment code in SPL and TPL (if these need access to the envronment) as in U-Boot proper, and memory is a precious resource there.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
You may call me by my name, Wirth, or by my value, Worth.
- Nicklaus Wirth