summaryrefslogtreecommitdiff
path: root/env
diff options
context:
space:
mode:
Diffstat (limited to 'env')
-rw-r--r--env/Kconfig31
-rw-r--r--env/eeprom.c2
-rw-r--r--env/nvram.c2
-rw-r--r--env/onenand.c2
-rw-r--r--env/remote.c13
-rw-r--r--env/scsi.c32
-rw-r--r--env/ubi.c4
7 files changed, 59 insertions, 27 deletions
diff --git a/env/Kconfig b/env/Kconfig
index 5979f7faa99..7abd82ab6f3 100644
--- a/env/Kconfig
+++ b/env/Kconfig
@@ -294,6 +294,23 @@ config ENV_IS_IN_SCSI
Define this if you have an SCSI device which you want to use for the
environment.
+ - CONFIG_ENV_SIZE:
+
+ The size of the partition where the environment is stored in bytes. Must
+ be a multiple of the partition block size.
+
+ - CONFIG_ENV_SCSI_HW_PARTITION:
+
+ Specifies which SCSI partition the environment is stored in. If not
+ set, defaults to partition 0, the user area. Common values might be
+ 1 (first SCSI boot partition), 2 (second SCSI boot partition). Ignored
+ if CONFIG_ENV_SCSI_PART_UUID is set to non-empty string.
+
+ - CONFIG_ENV_SCSI_PART_UUID:
+
+ UUID of the SCSI partition where the environment is stored.
+
+
config ENV_RANGE
hex "Length of the region in which the environment can be written"
depends on ENV_IS_IN_NAND
@@ -763,7 +780,18 @@ config ENV_MMC_USE_DT
The 2 defines CONFIG_ENV_OFFSET, CONFIG_ENV_OFFSET_REDUND
are not used as fallback.
-config SCSI_ENV_PART_UUID
+config ENV_SCSI_HW_PARTITION
+ string "SCSI hardware partition number"
+ depends on ENV_IS_IN_SCSI
+ default 0
+ help
+ SCSI hardware partition device number on the platform where the
+ environment is stored. Note that this is not related to any software
+ defined partition table but instead if we are in the user area, which is
+ partition 0 or the first boot partition, which is 1 or some other defined
+ partition.
+
+config ENV_SCSI_PART_UUID
string "SCSI partition UUID for saving environment"
depends on ENV_IS_IN_SCSI
help
@@ -847,6 +875,7 @@ config SPL_ENV_IS_IN_MMC
bool "SPL Environment in an MMC device"
depends on !SPL_ENV_IS_NOWHERE
depends on !SPL_OS_BOOT_SECURE
+ depends on SPL_MMC
depends on ENV_IS_IN_MMC
default y
help
diff --git a/env/eeprom.c b/env/eeprom.c
index b290b1013e1..f4cc2909376 100644
--- a/env/eeprom.c
+++ b/env/eeprom.c
@@ -175,5 +175,5 @@ U_BOOT_ENV_LOCATION(eeprom) = {
.location = ENVL_EEPROM,
ENV_NAME("EEPROM")
.load = env_eeprom_load,
- .save = env_save_ptr(env_eeprom_save),
+ .save = ENV_SAVE_PTR(env_eeprom_save),
};
diff --git a/env/nvram.c b/env/nvram.c
index d49cd0f337a..18f0a0aa1fb 100644
--- a/env/nvram.c
+++ b/env/nvram.c
@@ -65,6 +65,6 @@ U_BOOT_ENV_LOCATION(nvram) = {
.location = ENVL_NVRAM,
ENV_NAME("NVRAM")
.load = env_nvram_load,
- .save = env_save_ptr(env_nvram_save),
+ .save = ENV_SAVE_PTR(env_nvram_save),
.init = env_nvram_init,
};
diff --git a/env/onenand.c b/env/onenand.c
index 8c349ef5ce6..59b523e06c6 100644
--- a/env/onenand.c
+++ b/env/onenand.c
@@ -107,5 +107,5 @@ U_BOOT_ENV_LOCATION(onenand) = {
.location = ENVL_ONENAND,
ENV_NAME("OneNAND")
.load = env_onenand_load,
- .save = env_save_ptr(env_onenand_save),
+ .save = ENV_SAVE_PTR(env_onenand_save),
};
diff --git a/env/remote.c b/env/remote.c
index 0cc383c2360..5dd929155a4 100644
--- a/env/remote.c
+++ b/env/remote.c
@@ -31,18 +31,6 @@ static int env_remote_init(void)
return -ENOENT;
}
-#ifdef CONFIG_CMD_SAVEENV
-static int env_remote_save(void)
-{
-#ifdef CONFIG_SRIO_PCIE_BOOT_SLAVE
- printf("Can not support the 'saveenv' when boot from SRIO or PCIE!\n");
- return 1;
-#else
- return 0;
-#endif
-}
-#endif /* CONFIG_CMD_SAVEENV */
-
static int env_remote_load(void)
{
#ifndef ENV_IS_EMBEDDED
@@ -56,6 +44,5 @@ U_BOOT_ENV_LOCATION(remote) = {
.location = ENVL_REMOTE,
ENV_NAME("Remote")
.load = env_remote_load,
- .save = env_save_ptr(env_remote_save),
.init = env_remote_init,
};
diff --git a/env/scsi.c b/env/scsi.c
index 207717e17b1..91a6c430302 100644
--- a/env/scsi.c
+++ b/env/scsi.c
@@ -33,10 +33,22 @@ static struct env_scsi_info env_part;
static inline struct env_scsi_info *env_scsi_get_part(void)
{
+ static bool is_scsi_scanned;
struct env_scsi_info *ep = &env_part;
- if (scsi_get_blk_by_uuid(CONFIG_SCSI_ENV_PART_UUID, &ep->blk, &ep->part))
- return NULL;
+ if (!is_scsi_scanned) {
+ scsi_scan(false /* no verbose */);
+ is_scsi_scanned = true;
+ }
+
+ if (CONFIG_ENV_SCSI_PART_UUID[0] == '\0') {
+ if (blk_get_device_part_str("scsi", CONFIG_ENV_SCSI_HW_PARTITION,
+ &ep->blk, &ep->part, true))
+ return NULL;
+ } else {
+ if (scsi_get_blk_by_uuid(CONFIG_ENV_SCSI_PART_UUID, &ep->blk, &ep->part))
+ return NULL;
+ }
ep->count = CONFIG_ENV_SIZE / ep->part.blksz;
@@ -83,12 +95,20 @@ static int env_scsi_load(void)
int ret;
if (!ep) {
- env_set_default(CONFIG_SCSI_ENV_PART_UUID " partition not found", 0);
+ if (CONFIG_ENV_SCSI_PART_UUID[0] == '\0')
+ env_set_default("SCSI partition " CONFIG_ENV_SCSI_HW_PARTITION " not found", 0);
+ else
+ env_set_default(CONFIG_ENV_SCSI_PART_UUID " partition not found", 0);
+
return -ENOENT;
}
if (blk_dread(ep->blk, ep->part.start, ep->count, &envbuf) != ep->count) {
- env_set_default(CONFIG_SCSI_ENV_PART_UUID " partition read failed", 0);
+ if (CONFIG_ENV_SCSI_PART_UUID[0] == '\0')
+ env_set_default("SCSI partition " CONFIG_ENV_SCSI_HW_PARTITION " read failed", 0);
+ else
+ env_set_default(CONFIG_ENV_SCSI_PART_UUID " partition read failed", 0);
+
return -EIO;
}
@@ -108,8 +128,6 @@ U_BOOT_ENV_LOCATION(scsi) = {
.location = ENVL_SCSI,
ENV_NAME("SCSI")
.load = env_scsi_load,
-#if defined(CONFIG_CMD_SAVEENV) && !defined(CONFIG_XPL_BUILD)
- .save = env_save_ptr(env_scsi_save),
+ .save = ENV_SAVE_PTR(env_scsi_save),
.erase = ENV_ERASE_PTR(env_scsi_erase),
-#endif
};
diff --git a/env/ubi.c b/env/ubi.c
index 59bd96feb48..e9865b45ebc 100644
--- a/env/ubi.c
+++ b/env/ubi.c
@@ -33,7 +33,6 @@ DECLARE_GLOBAL_DATA_PTR;
#define ENV_UBI_VOLUME_REDUND "invalid"
#endif
-#ifdef CONFIG_CMD_SAVEENV
#ifdef CONFIG_ENV_REDUNDANT
static int env_ubi_save(void)
{
@@ -103,7 +102,6 @@ static int env_ubi_save(void)
return 0;
}
#endif /* CONFIG_ENV_REDUNDANT */
-#endif /* CONFIG_CMD_SAVEENV */
#ifdef CONFIG_ENV_REDUNDANT
static int env_ubi_load(void)
@@ -219,6 +217,6 @@ U_BOOT_ENV_LOCATION(ubi) = {
.location = ENVL_UBI,
ENV_NAME("UBI")
.load = env_ubi_load,
- .save = env_save_ptr(env_ubi_save),
+ .save = ENV_SAVE_PTR(env_ubi_save),
.erase = ENV_ERASE_PTR(env_ubi_erase),
};