projects
/
oweals
/
u-boot.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
pantheon: define CONFIG_SYS_CACHELINE_SIZE
[oweals/u-boot.git]
/
common
/
env_mgdisk.c
diff --git
a/common/env_mgdisk.c
b/common/env_mgdisk.c
index 363ee68c27e83d3ac397f1120f69483ea8f027e4..a69923b700f69a35be87ed3c3d5b3baf227cb559 100644
(file)
--- a/
common/env_mgdisk.c
+++ b/
common/env_mgdisk.c
@@
-29,9
+29,8
@@
/* references to names in env_common.c */
extern uchar default_environment[];
/* references to names in env_common.c */
extern uchar default_environment[];
-extern int default_environment_size;
-char *
env_name_spec = "MG_DISK";
+char *env_name_spec = "MG_DISK";
env_t *env_ptr = 0;
env_t *env_ptr = 0;
@@
-39,34
+38,27
@@
DECLARE_GLOBAL_DATA_PTR;
uchar env_get_char_spec(int index)
{
uchar env_get_char_spec(int index)
{
- return (*((uchar *)
(gd->env_addr + index)));
+ return (*((uchar *)(gd->env_addr + index)));
}
void env_relocate_spec(void)
{
}
void env_relocate_spec(void)
{
- unsigned int err;
+ char buf[CONFIG_ENV_SIZE];
+ unsigned int err, rc;
err = mg_disk_init();
if (err) {
err = mg_disk_init();
if (err) {
- puts ("*** Warning - mg_disk_init error");
- goto OUT;
- }
- err = mg_disk_read(CONFIG_ENV_ADDR, (u_char *)env_ptr, CONFIG_ENV_SIZE);
- if (err) {
- puts ("*** Warning - mg_disk_read error");
- goto OUT;
+ set_default_env("!mg_disk_init error");
+ return;
}
}
- if (crc32(0, env_ptr->data, ENV_SIZE) != env_ptr->crc) {
- puts ("*** Warning - CRC error");
- goto OUT;
+ err = mg_disk_read(CONFIG_ENV_ADDR, buf, CONFIG_ENV_SIZE);
+ if (err) {
+ set_default_env("!mg_disk_read error");
+ return;
}
}
- return;
-
-OUT:
- printf (", using default environment\n\n");
- set_default_env();
+ env_import(buf, 1);
}
int saveenv(void)
}
int saveenv(void)
@@
-77,7
+69,7
@@
int saveenv(void)
err = mg_disk_write(CONFIG_ENV_ADDR, (u_char *)env_ptr,
CONFIG_ENV_SIZE);
if (err)
err = mg_disk_write(CONFIG_ENV_ADDR, (u_char *)env_ptr,
CONFIG_ENV_SIZE);
if (err)
- puts
("*** Warning - mg_disk_write error\n\n");
+ puts("*** Warning - mg_disk_write error\n\n");
return err;
}
return err;
}
@@
-85,7
+77,7
@@
int saveenv(void)
int env_init(void)
{
/* use default */
int env_init(void)
{
/* use default */
- gd->env_addr = (ulong)
&
default_environment[0];
+ gd->env_addr = (ulong)
&
default_environment[0];
gd->env_valid = 1;
return 0;
gd->env_valid = 1;
return 0;