[U-Boot] [PATCH v2 08/40] env: Move env_init() to env.h

Simon Glass
2019-08-01T15:46:43Z

Move env_init() over to the new header file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
---

Changes in v2: None

arch/arm/cpu/armv8/fsl-layerscape/spl.c | 1 +
arch/mips/lib/bootm.c | 1 +
board/Arcturus/ucp1020/spl.c | 1 +
board/birdland/bav335x/board.c | 1 +
board/freescale/b4860qds/spl.c | 1 +
board/freescale/p1010rdb/spl.c | 1 +
board/freescale/p1022ds/spl.c | 1 +
board/freescale/p1_p2_rdb_pc/spl.c | 1 +
board/gateworks/gw_ventana/gw_ventana_spl.c | 1 +
board/liebherr/display5/spl.c | 1 +
board/tcl/sl50/board.c | 1 +
board/ti/am335x/board.c | 1 +
board/ti/am57xx/board.c | 1 +
board/ti/dra7xx/evm.c | 1 +
common/board_f.c | 1 +
common/spl/spl_net.c | 1 +
env/env.c | 1 +
include/common.h | 1 -
include/env.h | 10 ++++++++++
19 files changed, 27 insertions(+), 1 deletion(-)

diff --git a/arch/arm/cpu/armv8/fsl-layerscape/spl.c b/arch/arm/cpu/armv8/fsl-layerscape/spl.c
index 3e53084b21..8eeeef199b 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/spl.c
+++ b/arch/arm/cpu/armv8/fsl-layerscape/spl.c
@@ -4,6 +4,7 @@
*/

#include <common.h>
+#include <env.h>
#include <spl.h>
#include <asm/io.h>
#include <fsl_ifc.h>
diff --git a/arch/mips/lib/bootm.c b/arch/mips/lib/bootm.c
index 6a462f3e5a..8c0d7672f2 100644
--- a/arch/mips/lib/bootm.c
+++ b/arch/mips/lib/bootm.c
@@ -5,6 +5,7 @@
*/

#include <common.h>
+#include <env.h>
#include <image.h>
#include <fdt_support.h>
#include <asm/addrspace.h>
diff --git a/board/Arcturus/ucp1020/spl.c b/board/Arcturus/ucp1020/spl.c
index 451a9d78bb..f3b7d99878 100644
--- a/board/Arcturus/ucp1020/spl.c
+++ b/board/Arcturus/ucp1020/spl.c
@@ -9,6 +9,7 @@

#include <common.h>
#include <console.h>
+#include <env.h>
#include <environment.h>
#include <ns16550.h>
#include <malloc.h>
diff --git a/board/birdland/bav335x/board.c b/board/birdland/bav335x/board.c
index b95186026f..b0339ad8f0 100644
--- a/board/birdland/bav335x/board.c
+++ b/board/birdland/bav335x/board.c
@@ -8,6 +8,7 @@
*/

#include <common.h>
+#include <env.h>
#include <errno.h>
#include <spl.h>
#include <asm/arch/cpu.h>
diff --git a/board/freescale/b4860qds/spl.c b/board/freescale/b4860qds/spl.c
index 887fa04627..d9aa57f41c 100644
--- a/board/freescale/b4860qds/spl.c
+++ b/board/freescale/b4860qds/spl.c
@@ -4,6 +4,7 @@

#include <common.h>
#include <console.h>
+#include <env.h>
#include <environment.h>
#include <asm/spl.h>
#include <malloc.h>
diff --git a/board/freescale/p1010rdb/spl.c b/board/freescale/p1010rdb/spl.c
index e07640a0ed..95f8b5837d 100644
--- a/board/freescale/p1010rdb/spl.c
+++ b/board/freescale/p1010rdb/spl.c
@@ -4,6 +4,7 @@

#include <common.h>
#include <console.h>
+#include <env.h>
#include <environment.h>
#include <ns16550.h>
#include <malloc.h>
diff --git a/board/freescale/p1022ds/spl.c b/board/freescale/p1022ds/spl.c
index cfdd9fc9c9..92fd199876 100644
--- a/board/freescale/p1022ds/spl.c
+++ b/board/freescale/p1022ds/spl.c
@@ -5,6 +5,7 @@

#include <common.h>
#include <console.h>
+#include <env.h>
#include <environment.h>
#include <ns16550.h>
#include <malloc.h>
diff --git a/board/freescale/p1_p2_rdb_pc/spl.c b/board/freescale/p1_p2_rdb_pc/spl.c
index 48ab271fb2..9d7b5eff6f 100644
--- a/board/freescale/p1_p2_rdb_pc/spl.c
+++ b/board/freescale/p1_p2_rdb_pc/spl.c
@@ -5,6 +5,7 @@

#include <common.h>
#include <console.h>
+#include <env.h>
#include <environment.h>
#include <ns16550.h>
#include <malloc.h>
diff --git a/board/gateworks/gw_ventana/gw_ventana_spl.c b/board/gateworks/gw_ventana/gw_ventana_spl.c
index eaf7aa9eca..740fc57b91 100644
--- a/board/gateworks/gw_ventana/gw_ventana_spl.c
+++ b/board/gateworks/gw_ventana/gw_ventana_spl.c
@@ -13,6 +13,7 @@
#include <asm/mach-imx/boot_mode.h>
#include <asm/mach-imx/iomux-v3.h>
#include <asm/mach-imx/mxc_i2c.h>
+#include <env.h>
#include <environment.h>
#include <i2c.h>
#include <spl.h>
diff --git a/board/liebherr/display5/spl.c b/board/liebherr/display5/spl.c
index 27f843ec45..d92760b487 100644
--- a/board/liebherr/display5/spl.c
+++ b/board/liebherr/display5/spl.c
@@ -5,6 +5,7 @@
*/

#include <common.h>
+#include <env.h>
#include <spl.h>
#include <linux/libfdt.h>
#include <asm/io.h>
diff --git a/board/tcl/sl50/board.c b/board/tcl/sl50/board.c
index 6bb6482dd0..8ddbee5436 100644
--- a/board/tcl/sl50/board.c
+++ b/board/tcl/sl50/board.c
@@ -8,6 +8,7 @@
*/

#include <common.h>
+#include <env.h>
#include <errno.h>
#include <spl.h>
#include <asm/arch/cpu.h>
diff --git a/board/ti/am335x/board.c b/board/ti/am335x/board.c
index 2c32b92d94..58d09f7c20 100644
--- a/board/ti/am335x/board.c
+++ b/board/ti/am335x/board.c
@@ -9,6 +9,7 @@

#include <common.h>
#include <dm.h>
+#include <env.h>
#include <errno.h>
#include <spl.h>
#include <serial.h>
diff --git a/board/ti/am57xx/board.c b/board/ti/am57xx/board.c
index 1a903f13a6..0dacfd4327 100644
--- a/board/ti/am57xx/board.c
+++ b/board/ti/am57xx/board.c
@@ -8,6 +8,7 @@
*/

#include <common.h>
+#include <env.h>
#include <palmas.h>
#include <sata.h>
#include <usb.h>
diff --git a/board/ti/dra7xx/evm.c b/board/ti/dra7xx/evm.c
index 179adc2fff..97eef65d51 100644
--- a/board/ti/dra7xx/evm.c
+++ b/board/ti/dra7xx/evm.c
@@ -10,6 +10,7 @@
* Steve Sakoman <steve@sakoman.com>
*/
#include <common.h>
+#include <env.h>
#include <palmas.h>
#include <sata.h>
#include <linux/string.h>
diff --git a/common/board_f.c b/common/board_f.c
index 7d656fae6a..18937bf6f5 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -14,6 +14,7 @@
#include <console.h>
#include <cpu.h>
#include <dm.h>
+#include <env.h>
#include <environment.h>
#include <fdtdec.h>
#include <fs.h>
diff --git a/common/spl/spl_net.c b/common/spl/spl_net.c
index c91ad2b6dd..803303249c 100644
--- a/common/spl/spl_net.c
+++ b/common/spl/spl_net.c
@@ -7,6 +7,7 @@
* Ilya Yanok <ilya.yanok@gmail.com>
*/
#include <common.h>
+#include <env.h>
#include <errno.h>
#include <spl.h>
#include <net.h>
diff --git a/env/env.c b/env/env.c
index d3cbe2f915..9d421e8125 100644
--- a/env/env.c
+++ b/env/env.c
@@ -5,6 +5,7 @@
*/

#include <common.h>
+#include <env.h>
#include <environment.h>

DECLARE_GLOBAL_DATA_PTR;
diff --git a/include/common.h b/include/common.h
index 2aabd267b9..55cbe1f97d 100644
--- a/include/common.h
+++ b/include/common.h
@@ -146,7 +146,6 @@ int do_fat_fsload(cmd_tbl_t *, int, int, char * const []);
int do_ext2load(cmd_tbl_t *, int, int, char * const []);

/* common/cmd_nvedit.c */
-int env_init (void);
void env_relocate (void);
int envmatch (uchar *, int);

diff --git a/include/env.h b/include/env.h
index 19b559abf1..5d205ef02d 100644
--- a/include/env.h
+++ b/include/env.h
@@ -21,6 +21,16 @@
*/
int env_get_id(void);

+/**
+ * env_init() - Set up the pre-relocation environment
+ *
+ * This locates the environment or uses the default if nothing is available.
+ * This must be called before env_get() will work.
+ *
+ * @return 0 if OK, -ENODEV if no environment drivers are enabled
+ */
+int env_init(void);
+
/**
* env_get_f() - Look up the value of an environment variable (early)
*
--
2.22.0.709.g102302147b-goog