summaryrefslogtreecommitdiff
path: root/env/flash.c
diff options
context:
space:
mode:
Diffstat (limited to 'env/flash.c')
-rw-r--r--env/flash.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/env/flash.c b/env/flash.c
index dca6567a09..231a5fdf24 100644
--- a/env/flash.c
+++ b/env/flash.c
@@ -11,7 +11,8 @@
#include <common.h>
#include <command.h>
-#include <environment.h>
+#include <env.h>
+#include <env_internal.h>
#include <linux/stddef.h>
#include <malloc.h>
#include <search.h>
@@ -47,7 +48,7 @@ DECLARE_GLOBAL_DATA_PTR;
#if defined(CONFIG_ENV_ADDR_REDUND) && defined(CMD_SAVEENV) || \
!defined(CONFIG_ENV_ADDR_REDUND) && defined(INITENV)
#ifdef ENV_IS_EMBEDDED
-static env_t *env_ptr = &environment;
+static env_t *env_ptr = &embedded_environment;
#else /* ! ENV_IS_EMBEDDED */
static env_t *env_ptr = (env_t *)CONFIG_ENV_ADDR;
@@ -94,10 +95,12 @@ static int env_flash_init(void)
} else if (!crc1_ok && !crc2_ok) {
gd->env_addr = addr_default;
gd->env_valid = ENV_INVALID;
- } else if (flag1 == ACTIVE_FLAG && flag2 == OBSOLETE_FLAG) {
+ } else if (flag1 == ENV_REDUND_ACTIVE &&
+ flag2 == ENV_REDUND_OBSOLETE) {
gd->env_addr = addr1;
gd->env_valid = ENV_VALID;
- } else if (flag1 == OBSOLETE_FLAG && flag2 == ACTIVE_FLAG) {
+ } else if (flag1 == ENV_REDUND_OBSOLETE &&
+ flag2 == ENV_REDUND_ACTIVE) {
gd->env_addr = addr2;
gd->env_valid = ENV_VALID;
} else if (flag1 == flag2) {
@@ -120,7 +123,7 @@ static int env_flash_save(void)
{
env_t env_new;
char *saved_data = NULL;
- char flag = OBSOLETE_FLAG, new_flag = ACTIVE_FLAG;
+ char flag = ENV_REDUND_OBSOLETE, new_flag = ENV_REDUND_ACTIVE;
int rc = 1;
#if CONFIG_ENV_SECT_SIZE > CONFIG_ENV_SIZE
ulong up_data = 0;
@@ -321,9 +324,9 @@ static int env_flash_load(void)
end_addr_new = ltmp;
}
- if (flash_addr_new->flags != OBSOLETE_FLAG &&
+ if (flash_addr_new->flags != ENV_REDUND_OBSOLETE &&
crc32(0, flash_addr_new->data, ENV_SIZE) == flash_addr_new->crc) {
- char flag = OBSOLETE_FLAG;
+ char flag = ENV_REDUND_OBSOLETE;
gd->env_valid = ENV_REDUND;
flash_sect_protect(0, (ulong)flash_addr_new, end_addr_new);
@@ -333,9 +336,9 @@ static int env_flash_load(void)
flash_sect_protect(1, (ulong)flash_addr_new, end_addr_new);
}
- if (flash_addr->flags != ACTIVE_FLAG &&
- (flash_addr->flags & ACTIVE_FLAG) == ACTIVE_FLAG) {
- char flag = ACTIVE_FLAG;
+ if (flash_addr->flags != ENV_REDUND_ACTIVE &&
+ (flash_addr->flags & ENV_REDUND_ACTIVE) == ENV_REDUND_ACTIVE) {
+ char flag = ENV_REDUND_ACTIVE;
gd->env_valid = ENV_REDUND;
flash_sect_protect(0, (ulong)flash_addr, end_addr);