[U-Boot] [PATCH 10/11] env: introducing env_info struct for storing info per env

Quentin Schulz quentin.schulz at free-electrons.com
Fri Dec 22 21:13:44 UTC 2017


To introduce the ability to use multiple environments at the same time,
it is required to store a few information about each of the environment.

Each environment has a different env_addr, "validity" (redund or main)
and status of init (failed or succeeded).

This structure is meant to be used in include/asm-generic/global_data.h
and thus needs to be put out of the #ifndef DO_DEPS_ONLY.

Signed-off-by: Quentin Schulz <quentin.schulz at free-electrons.com>
---
 include/environment.h | 34 ++++++++++++++++++++--------------
 1 file changed, 20 insertions(+), 14 deletions(-)

diff --git a/include/environment.h b/include/environment.h
index dd6450c..14df43f 100644
--- a/include/environment.h
+++ b/include/environment.h
@@ -183,20 +183,6 @@ extern uint mmc_get_env_part(struct mmc *mmc);
 # endif
 #endif
 
-#ifndef DO_DEPS_ONLY
-
-#include <env_attr.h>
-#include <env_callback.h>
-#include <env_flags.h>
-#include <search.h>
-
-/* Value for environment validity */
-enum env_valid {
-	ENV_INVALID,	/* No valid environment */
-	ENV_VALID,	/* First or only environment is valid */
-	ENV_REDUND,	/* Redundant environment is valid */
-};
-
 enum env_location {
 	ENVL_EEPROM,
 	ENVL_EXT4,
@@ -215,6 +201,26 @@ enum env_location {
 	ENVL_UNKNOWN,
 };
 
+/* Value for environment validity */
+enum env_valid {
+	ENV_INVALID,	/* No valid environment */
+	ENV_VALID,	/* First or only environment is valid */
+	ENV_REDUND,	/* Redundant environment is valid */
+};
+
+struct env_info {
+	unsigned long	env_addr;
+	enum env_valid	env_valid;
+	bool		has_init;
+};
+
+#ifndef DO_DEPS_ONLY
+
+#include <env_attr.h>
+#include <env_callback.h>
+#include <env_flags.h>
+#include <search.h>
+
 extern enum env_location env_locations[];
 
 enum env_operation {
-- 
git-series 0.9.1


More information about the U-Boot mailing list