aboutsummaryrefslogtreecommitdiff
path: root/env
diff options
context:
space:
mode:
Diffstat (limited to 'env')
-rw-r--r--env/Kconfig26
-rw-r--r--env/Makefile1
-rw-r--r--env/eeprom.c59
-rw-r--r--env/embedded.c2
-rw-r--r--env/nvram.c42
5 files changed, 30 insertions, 100 deletions
diff --git a/env/Kconfig b/env/Kconfig
index 4e506ae262..7ca992aa1d 100644
--- a/env/Kconfig
+++ b/env/Kconfig
@@ -30,6 +30,15 @@ config ENV_OVERWRITE
Use this to permit overriding of certain environmental variables
like Ethernet and Serial
+config OVERWRITE_ETHADDR_ONCE
+ bool "Enable overwriting ethaddr environment variables once"
+ depends on !ENV_OVERWRITE
+ help
+ Enable this to allow for the ethaddr environment variables to be
+ overwritten one time per boot, only. This allows for a default
+ to be installed in the environment, which can be changed exactly ONCE
+ by the user.
+
config ENV_MIN_ENTRIES
int "Minimum number of entries in the environment hashtable"
default 64
@@ -78,13 +87,6 @@ config ENV_IS_IN_EEPROM
still be one byte because the extra address bits are hidden
in the chip address.
- - CONFIG_I2C_ENV_EEPROM_BUS
- if you have an Environment on an EEPROM reached over
- I2C muxes, you can define here, how to reach this
- EEPROM. For example:
-
- #define CONFIG_I2C_ENV_EEPROM_BUS 1
-
EEPROM which holds the environment, is reached over
a pca9547 i2c mux with address 0x70, channel 3.
@@ -866,6 +868,16 @@ config ETHPRIME
help
The value to set the "ethprime" variable to.
+config USE_HOSTNAME
+ bool "Set a default 'hostname' value in the environment"
+ default y if X86
+
+config HOSTNAME
+ string "Value of the default 'hostname' value in the environment"
+ depends on USE_HOSTNAME
+ default "x86" if X86
+ default "unknown"
+
config VERSION_VARIABLE
bool "Add a 'ver' environment variable with the U-Boot version"
help
diff --git a/env/Makefile b/env/Makefile
index c4ad654328..bb6e24b396 100644
--- a/env/Makefile
+++ b/env/Makefile
@@ -11,7 +11,6 @@ obj-$(CONFIG_$(SPL_TPL_)ENV_SUPPORT) += flags.o
ifndef CONFIG_SPL_BUILD
obj-y += callback.o
obj-$(CONFIG_ENV_IS_IN_EEPROM) += eeprom.o
-extra-$(CONFIG_ENV_IS_EMBEDDED) += embedded.o
obj-$(CONFIG_ENV_IS_IN_EEPROM) += embedded.o
extra-$(CONFIG_ENV_IS_IN_FLASH) += embedded.o
obj-$(CONFIG_ENV_IS_IN_NVRAM) += embedded.o
diff --git a/env/eeprom.c b/env/eeprom.c
index f8556a4721..7ce7e9972b 100644
--- a/env/eeprom.c
+++ b/env/eeprom.c
@@ -15,55 +15,12 @@
#include <asm/global_data.h>
#include <linux/stddef.h>
#include <u-boot/crc.h>
-#if defined(CONFIG_I2C_ENV_EEPROM_BUS)
-#include <i2c.h>
-#endif
#include <search.h>
#include <errno.h>
#include <linux/compiler.h> /* for BUG_ON */
DECLARE_GLOBAL_DATA_PTR;
-static int eeprom_bus_read(unsigned dev_addr, unsigned offset,
- uchar *buffer, unsigned cnt)
-{
- int rcode;
-#if defined(CONFIG_I2C_ENV_EEPROM_BUS)
- int old_bus = i2c_get_bus_num();
-
- if (old_bus != CONFIG_I2C_ENV_EEPROM_BUS)
- i2c_set_bus_num(CONFIG_I2C_ENV_EEPROM_BUS);
-#endif
-
- rcode = eeprom_read(dev_addr, offset, buffer, cnt);
-
-#if defined(CONFIG_I2C_ENV_EEPROM_BUS)
- i2c_set_bus_num(old_bus);
-#endif
-
- return rcode;
-}
-
-static int eeprom_bus_write(unsigned dev_addr, unsigned offset,
- uchar *buffer, unsigned cnt)
-{
- int rcode;
-#if defined(CONFIG_I2C_ENV_EEPROM_BUS)
- int old_bus = i2c_get_bus_num();
-
- if (old_bus != CONFIG_I2C_ENV_EEPROM_BUS)
- i2c_set_bus_num(CONFIG_I2C_ENV_EEPROM_BUS);
-#endif
-
- rcode = eeprom_write(dev_addr, offset, buffer, cnt);
-
-#if defined(CONFIG_I2C_ENV_EEPROM_BUS)
- i2c_set_bus_num(old_bus);
-#endif
-
- return rcode;
-}
-
static int env_eeprom_load(void)
{
char buf_env[CONFIG_ENV_SIZE];
@@ -82,11 +39,11 @@ static int env_eeprom_load(void)
for (i = 0; i < 2; i++) {
/* read CRC */
- eeprom_bus_read(CONFIG_SYS_I2C_EEPROM_ADDR,
+ eeprom_read(CONFIG_SYS_I2C_EEPROM_ADDR,
off_env[i] + offsetof(env_t, crc),
(uchar *)&crc[i], sizeof(ulong));
/* read FLAGS */
- eeprom_bus_read(CONFIG_SYS_I2C_EEPROM_ADDR,
+ eeprom_read(CONFIG_SYS_I2C_EEPROM_ADDR,
off_env[i] + offsetof(env_t, flags),
(uchar *)&flags[i], sizeof(uchar));
@@ -96,7 +53,7 @@ static int env_eeprom_load(void)
while (len > 0) {
int n = (len > sizeof(rdbuf)) ? sizeof(rdbuf) : len;
- eeprom_bus_read(CONFIG_SYS_I2C_EEPROM_ADDR, off,
+ eeprom_read(CONFIG_SYS_I2C_EEPROM_ADDR, off,
rdbuf, n);
crc_tmp = crc32(crc_tmp, rdbuf, n);
@@ -138,7 +95,7 @@ static int env_eeprom_load(void)
eeprom_init(-1); /* prepare for EEPROM read/write */
/* read old CRC */
- eeprom_bus_read(CONFIG_SYS_I2C_EEPROM_ADDR,
+ eeprom_read(CONFIG_SYS_I2C_EEPROM_ADDR,
CONFIG_ENV_OFFSET + offsetof(env_t, crc),
(uchar *)&crc, sizeof(ulong));
@@ -148,7 +105,7 @@ static int env_eeprom_load(void)
while (len > 0) {
int n = (len > sizeof(rdbuf)) ? sizeof(rdbuf) : len;
- eeprom_bus_read(CONFIG_SYS_I2C_EEPROM_ADDR,
+ eeprom_read(CONFIG_SYS_I2C_EEPROM_ADDR,
CONFIG_ENV_OFFSET + off, rdbuf, n);
new = crc32(new, rdbuf, n);
len -= n;
@@ -168,7 +125,7 @@ static int env_eeprom_load(void)
off = CONFIG_ENV_OFFSET_REDUND;
#endif
- eeprom_bus_read(CONFIG_SYS_I2C_EEPROM_ADDR,
+ eeprom_read(CONFIG_SYS_I2C_EEPROM_ADDR,
off, (uchar *)buf_env, CONFIG_ENV_SIZE);
return env_import(buf_env, 1, H_EXTERNAL);
@@ -197,12 +154,12 @@ static int env_eeprom_save(void)
env_new.flags = ENV_REDUND_ACTIVE;
#endif
- rc = eeprom_bus_write(CONFIG_SYS_I2C_EEPROM_ADDR,
+ rc = eeprom_write(CONFIG_SYS_I2C_EEPROM_ADDR,
off, (uchar *)&env_new, CONFIG_ENV_SIZE);
#ifdef CONFIG_ENV_OFFSET_REDUND
if (rc == 0) {
- eeprom_bus_write(CONFIG_SYS_I2C_EEPROM_ADDR,
+ eeprom_write(CONFIG_SYS_I2C_EEPROM_ADDR,
off_red + offsetof(env_t, flags),
(uchar *)&flag_obsolete, 1);
diff --git a/env/embedded.c b/env/embedded.c
index 27fb45bf8c..7cbe54c56e 100644
--- a/env/embedded.c
+++ b/env/embedded.c
@@ -27,7 +27,7 @@
* Generate embedded environment table
* inside U-Boot image, if needed.
*/
-#if defined(ENV_IS_EMBEDDED) || defined(CONFIG_BUILD_ENVCRC)
+#if defined(ENV_IS_EMBEDDED)
/*
* Put the environment in the .text section when we are building
* U-Boot proper. The host based program "tools/envcrc" does not need
diff --git a/env/nvram.c b/env/nvram.c
index fb265235af..229c34f536 100644
--- a/env/nvram.c
+++ b/env/nvram.c
@@ -7,22 +7,6 @@
* Andreas Heppel <aheppel@sysgo.de>
*/
-/*
- * 09-18-2001 Andreas Heppel, Sysgo RTS GmbH <aheppel@sysgo.de>
- *
- * It might not be possible in all cases to use 'memcpy()' to copy
- * the environment to NVRAM, as the NVRAM might not be mapped into
- * the memory space. (I.e. this is the case for the BAB750). In those
- * cases it might be possible to access the NVRAM using a different
- * method. For example, the RTC on the BAB750 is accessible in IO
- * space using its address and data registers. To enable usage of
- * NVRAM in those cases I invented the functions 'nvram_read()' and
- * 'nvram_write()', which will be activated upon the configuration
- * #define CONFIG_SYS_NVRAM_ACCESS_ROUTINE. Note, that those functions are
- * strongly dependent on the used HW, and must be redefined for each
- * board that wants to use them.
- */
-
#include <common.h>
#include <command.h>
#include <env.h>
@@ -35,22 +19,14 @@
DECLARE_GLOBAL_DATA_PTR;
-#ifdef CONFIG_SYS_NVRAM_ACCESS_ROUTINE
-extern void *nvram_read(void *dest, const long src, size_t count);
-extern void nvram_write(long dest, const void *src, size_t count);
-#else
static env_t *env_ptr = (env_t *)CONFIG_ENV_ADDR;
-#endif
static int env_nvram_load(void)
{
char buf[CONFIG_ENV_SIZE];
-#if defined(CONFIG_SYS_NVRAM_ACCESS_ROUTINE)
- nvram_read(buf, CONFIG_ENV_ADDR, CONFIG_ENV_SIZE);
-#else
memcpy(buf, (void *)CONFIG_ENV_ADDR, CONFIG_ENV_SIZE);
-#endif
+
return env_import(buf, 1, H_EXTERNAL);
}
@@ -63,12 +39,9 @@ static int env_nvram_save(void)
if (rcode)
return rcode;
-#ifdef CONFIG_SYS_NVRAM_ACCESS_ROUTINE
- nvram_write(CONFIG_ENV_ADDR, &env_new, CONFIG_ENV_SIZE);
-#else
if (memcpy((char *)CONFIG_ENV_ADDR, &env_new, CONFIG_ENV_SIZE) == NULL)
rcode = 1;
-#endif
+
return rcode;
}
@@ -79,19 +52,8 @@ static int env_nvram_save(void)
*/
static int env_nvram_init(void)
{
-#if defined(CONFIG_SYS_NVRAM_ACCESS_ROUTINE)
- ulong crc;
- uchar data[ENV_SIZE];
-
- nvram_read(&crc, CONFIG_ENV_ADDR, sizeof(ulong));
- nvram_read(data, CONFIG_ENV_ADDR + sizeof(ulong), ENV_SIZE);
-
- if (crc32(0, data, ENV_SIZE) == crc) {
- gd->env_addr = (ulong)CONFIG_ENV_ADDR + sizeof(long);
-#else
if (crc32(0, env_ptr->data, ENV_SIZE) == env_ptr->crc) {
gd->env_addr = (ulong)&env_ptr->data;
-#endif
gd->env_valid = ENV_VALID;
} else {
gd->env_valid = ENV_INVALID;