diff options
author | Tom Rini <trini@konsulko.com> | 2020-07-31 10:13:07 -0400 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2020-07-31 10:13:07 -0400 |
commit | a2d051e7b6a8f87add1067d936bb0c805a47b0df (patch) | |
tree | 671af1a640f1fbb27f87a82685d8be9e632ee564 /include | |
parent | 719f42190d5f0238cb01ef2ffba8af2285f7bc7a (diff) | |
parent | db82015929aeff6b58982a22d61ab8c5b87752f3 (diff) |
Merge branch '2020-07-31-more-env-updates'
- Fix EFI selftest to not force setting serial# environment (and also
get the U-Boot prompt dynamically).
- Support for append only environment and other related features.
- Improved ext4 environment support
- Fix the case of fw_setenv being used on flash devices that were not
already locked.
Diffstat (limited to 'include')
-rw-r--r-- | include/env.h | 22 | ||||
-rw-r--r-- | include/env_flags.h | 6 | ||||
-rw-r--r-- | include/env_internal.h | 23 | ||||
-rw-r--r-- | include/search.h | 2 |
4 files changed, 47 insertions, 6 deletions
diff --git a/include/env.h b/include/env.h index d6c2d751d6..af405955b0 100644 --- a/include/env.h +++ b/include/env.h @@ -266,6 +266,13 @@ int env_set_default_vars(int nvars, char *const vars[], int flags); int env_load(void); /** + * env_reload() - Re-Load the environment from current storage + * + * @return 0 if OK, -ve on error + */ +int env_reload(void); + +/** * env_save() - Save the environment to storage * * @return 0 if OK, -ve on error @@ -280,6 +287,13 @@ int env_save(void); int env_erase(void); /** + * env_select() - Select the environment storage + * + * @return 0 if OK, -ve on error + */ +int env_select(const char *name); + +/** * env_import() - Import from a binary representation into hash table * * This imports the environment from a buffer. The format for each variable is @@ -288,10 +302,11 @@ int env_erase(void); * @buf: Buffer containing the environment (struct environemnt_s *) * @check: non-zero to check the CRC at the start of the environment, 0 to * ignore it + * @flags: Flags controlling matching (H_... - see search.h) * @return 0 if imported successfully, -ENOMSG if the CRC was bad, -EIO if * something else went wrong */ -int env_import(const char *buf, int check); +int env_import(const char *buf, int check, int flags); /** * env_export() - Export the environment to a buffer @@ -310,10 +325,12 @@ int env_export(struct environment_s *env_out); * @buf1_read_fail: 0 if buf1 is valid, non-zero if invalid * @buf2: Second environment (struct environemnt_s *) * @buf2_read_fail: 0 if buf2 is valid, non-zero if invalid + * @flags: Flags controlling matching (H_... - see search.h) * @return 0 if OK, -EIO if no environment is valid, -ENOMSG if the CRC was bad */ int env_import_redund(const char *buf1, int buf1_read_fail, - const char *buf2, int buf2_read_fail); + const char *buf2, int buf2_read_fail, + int flags); /** * env_get_default() - Look up a variable from the default environment @@ -342,5 +359,4 @@ int env_get_char(int index); * This is used for those unfortunate archs with crappy toolchains */ void env_reloc(void); - #endif diff --git a/include/env_flags.h b/include/env_flags.h index 725841a891..313cb8c49a 100644 --- a/include/env_flags.h +++ b/include/env_flags.h @@ -24,6 +24,9 @@ enum env_flags_varaccess { env_flags_varaccess_readonly, env_flags_varaccess_writeonce, env_flags_varaccess_changedefault, +#ifdef CONFIG_ENV_WRITEABLE_LIST + env_flags_varaccess_writeable, +#endif env_flags_varaccess_end }; @@ -173,6 +176,7 @@ int env_flags_validate(const struct env_entry *item, const char *newval, #define ENV_FLAGS_VARACCESS_PREVENT_CREATE 0x00000010 #define ENV_FLAGS_VARACCESS_PREVENT_OVERWR 0x00000020 #define ENV_FLAGS_VARACCESS_PREVENT_NONDEF_OVERWR 0x00000040 -#define ENV_FLAGS_VARACCESS_BIN_MASK 0x00000078 +#define ENV_FLAGS_VARACCESS_WRITEABLE 0x00000080 +#define ENV_FLAGS_VARACCESS_BIN_MASK 0x000000f8 #endif /* __ENV_FLAGS_H__ */ diff --git a/include/env_internal.h b/include/env_internal.h index 66550434c3..b26dc6239c 100644 --- a/include/env_internal.h +++ b/include/env_internal.h @@ -154,8 +154,7 @@ struct env_driver { /** * load() - Load the environment from storage * - * This method is optional. If not provided, no environment will be - * loaded. + * This method is required for loading environment * * @return 0 if OK, -ve on error */ @@ -212,6 +211,26 @@ struct env_driver { extern struct hsearch_data env_htab; /** + * env_ext4_get_intf() - Provide the interface for env in EXT4 + * + * It is a weak function allowing board to overidde the default interface for + * U-Boot env in EXT4: CONFIG_ENV_EXT4_INTERFACE + * + * @return string of interface, empty if not supported + */ +const char *env_ext4_get_intf(void); + +/** + * env_ext4_get_dev_part() - Provide the device and partition for env in EXT4 + * + * It is a weak function allowing board to overidde the default device and + * partition used for U-Boot env in EXT4: CONFIG_ENV_EXT4_DEVICE_AND_PART + * + * @return string of device and partition + */ +const char *env_ext4_get_dev_part(void); + +/** * env_get_location()- Provide the best location for the U-Boot environment * * It is a weak function allowing board to overidde the environment location diff --git a/include/search.h b/include/search.h index bca36d3abc..e56843c26f 100644 --- a/include/search.h +++ b/include/search.h @@ -112,5 +112,7 @@ int hwalk_r(struct hsearch_data *htab, #define H_MATCH_METHOD (H_MATCH_IDENT | H_MATCH_SUBSTR | H_MATCH_REGEX) #define H_PROGRAMMATIC (1 << 9) /* indicate that an import is from env_set() */ #define H_ORIGIN_FLAGS (H_INTERACTIVE | H_PROGRAMMATIC) +#define H_DEFAULT (1 << 10) /* indicate that an import is default env */ +#define H_EXTERNAL (1 << 11) /* indicate that an import is external env */ #endif /* _SEARCH_H_ */ |