From: wdenk Date: Tue, 10 Sep 2002 20:10:35 +0000 (+0000) Subject: Get (preliminary) version of environment support running X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=0e34a8d3e1a44bb87c6613d9f937e316be669aba;p=users%2Frw%2Fppcboot.git Get (preliminary) version of environment support running for ARM, too. --- diff --git a/board/cradle/Makefile b/board/cradle/Makefile index 2870ddc..b694e10 100644 --- a/board/cradle/Makefile +++ b/board/cradle/Makefile @@ -25,7 +25,7 @@ include $(TOPDIR)/config.mk LIB = lib$(BOARD).a -OBJS := cradle.o flash.o env.o +OBJS := cradle.o flash.o SOBJS := memsetup.o $(LIB): $(OBJS) $(SOBJS) diff --git a/board/cradle/env.c b/board/cradle/env.c deleted file mode 100644 index c6b6190..0000000 --- a/board/cradle/env.c +++ /dev/null @@ -1,135 +0,0 @@ -/* - * (C) Copyright 2002 - * Sysgo Real-Time Solutions, GmbH - * Marius Groeger - * - * See file CREDITS for list of people who contributed to this - * project. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - */ - -#include - -static int check_crc(bd_t *bd) -{ - /* need to calculate crc? */ - if (bd->bi_ext.env_crc_valid == 0) - { - env_t *env = (env_t *)CFG_ENV_ADDR; - - if (crc32(0, env->data, sizeof(env->data)) == env->crc) - bd->bi_ext.env_crc_valid = 1; - else - bd->bi_ext.env_crc_valid = -1; - } - return bd->bi_ext.env_crc_valid > 0; -} - - -/* - * save environment buffer back to flash - * returns -1 on error, 0 if ok - */ -int board_env_save(bd_t *bd, env_t *env, int size) -{ - int rc; - ulong start_addr, end_addr; - -#if CFG_ENV_SIZE <= CFG_ENV_SECT_SIZE -#error Make sure that CFG_ENV_SIZE <= CFG_ENV_SECT_SIZE -#endif - - start_addr = CFG_ENV_ADDR; - end_addr = start_addr + CFG_ENV_SIZE - 1; - - rc = flash_sect_protect(0, CFG_ENV_ADDR, end_addr); - if (rc < 0) - return rc; - - rc = flash_sect_erase(start_addr, end_addr); - if (rc < 0) - { - flash_sect_protect(1, start_addr, end_addr); - flash_perror(rc); - return rc; - } - - printf("Saving Environment to Flash..."); - rc = flash_write((uchar*)env, start_addr, size); - if (rc < 0) - flash_perror(rc); - else - printf("done.\n"); - - (void)flash_sect_protect(1, start_addr, end_addr); - - return 0; -} - -/* - * copy environment to memory - * returns -1 on error, 0 if ok - */ -int board_env_copy(bd_t *bd, env_t *data, int size) -{ - env_t *env = (env_t *)CFG_ENV_ADDR; - - if (check_crc(bd)) - { - memcpy(data, env, sizeof(env_t)); - return 0; - } - - return -1; -} - -/* - * try to read env character at offset #index - * - * called before the environment is copied to ram - * returns -1 on error, 0 if ok - */ -int board_env_getchar(bd_t * bd, int index, uchar *c) -{ - env_t *env = (env_t *)CFG_ENV_ADDR; - - /* check environment crc */ - if (index < sizeof(env->data) && check_crc(bd)) - { - *c = env->data[index]; - return 0; - } - - return -1; -} - -/* - * try to read env character at offset #index - * - * called before the environment is copied to ram - * returns -1 on error, 0 if ok - */ -uchar *board_env_getaddr(bd_t * bd, int index) -{ - env_t *env = (env_t *)CFG_ENV_ADDR; - - /* check environment crc */ - if (index < sizeof(env->data) && check_crc(bd)) - return &env->data[index]; - - return 0; -} diff --git a/board/dnp1110/Makefile b/board/dnp1110/Makefile index 67bbfbf..2437b22 100644 --- a/board/dnp1110/Makefile +++ b/board/dnp1110/Makefile @@ -25,7 +25,7 @@ include $(TOPDIR)/config.mk LIB = lib$(BOARD).a -OBJS := dnp1110.o flash.o env.o +OBJS := dnp1110.o flash.o SOBJS := memsetup.o $(LIB): $(OBJS) $(SOBJS) diff --git a/board/dnp1110/env.c b/board/dnp1110/env.c deleted file mode 100644 index 9eef7f2..0000000 --- a/board/dnp1110/env.c +++ /dev/null @@ -1,136 +0,0 @@ -/* - * (C) Copyright 2002 - * Sysgo Real-Time Solutions, GmbH - * Marius Groeger - * - * See file CREDITS for list of people who contributed to this - * project. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - */ - -#include -#include - -static int check_crc(bd_t *bd) -{ - /* need to calculate crc? */ - if (bd->bi_ext.env_crc_valid == 0) - { - env_t *env = (env_t *)CFG_ENV_ADDR; - - if (crc32(0, env->data, sizeof(env->data)) == env->crc) - bd->bi_ext.env_crc_valid = 1; - else - bd->bi_ext.env_crc_valid = -1; - } - return bd->bi_ext.env_crc_valid > 0; -} - - -/* - * save environment buffer back to flash - * returns -1 on error, 0 if ok - */ -int board_env_save(bd_t *bd, env_t *env, int size) -{ - int rc; - ulong start_addr, end_addr; - -#if CFG_ENV_SIZE <= CFG_ENV_SECT_SIZE -#error Make sure that CFG_ENV_SIZE <= CFG_ENV_SECT_SIZE -#endif - - start_addr = CFG_ENV_ADDR; - end_addr = start_addr + CFG_ENV_SIZE - 1; - - rc = flash_sect_protect(0, CFG_ENV_ADDR, end_addr); - if (rc < 0) - return rc; - - rc = flash_sect_erase(start_addr, end_addr); - if (rc < 0) - { - flash_sect_protect(1, start_addr, end_addr); - flash_perror(rc); - return rc; - } - - printf("Saving Environment to Flash..."); - rc = flash_write((uchar*)env, start_addr, size); - if (rc < 0) - flash_perror(rc); - else - printf("done.\n"); - - (void)flash_sect_protect(1, start_addr, end_addr); - - return 0; -} - -/* - * copy environment to memory - * returns -1 on error, 0 if ok - */ -int board_env_copy(bd_t *bd, env_t *data, int size) -{ - env_t *env = (env_t *)CFG_ENV_ADDR; - - if (check_crc(bd)) - { - memcpy(data, env, sizeof(env_t)); - return 0; - } - - return -1; -} - -/* - * try to read env character at offset #index - * - * called before the environment is copied to ram - * returns -1 on error, 0 if ok - */ -int board_env_getchar(bd_t * bd, int index, uchar *c) -{ - env_t *env = (env_t *)CFG_ENV_ADDR; - - /* check environment crc */ - if (index < sizeof(env->data) && check_crc(bd)) - { - *c = env->data[index]; - return 0; - } - - return -1; -} - -/* - * try to read env character at offset #index - * - * called before the environment is copied to ram - * returns -1 on error, 0 if ok - */ -uchar *board_env_getaddr(bd_t * bd, int index) -{ - env_t *env = (env_t *)CFG_ENV_ADDR; - - /* check environment crc */ - if (index < sizeof(env->data) && check_crc(bd)) - return &env->data[index]; - - return 0; -} diff --git a/board/ep7312/Makefile b/board/ep7312/Makefile index 25fd62c..60b3363 100644 --- a/board/ep7312/Makefile +++ b/board/ep7312/Makefile @@ -26,7 +26,7 @@ include $(TOPDIR)/config.mk LIB = lib$(BOARD).a -OBJS := ep7312.o flash.o env.o +OBJS := ep7312.o flash.o SOBJS := memsetup.o $(LIB): $(OBJS) $(SOBJS) diff --git a/board/ep7312/env.c b/board/ep7312/env.c deleted file mode 100644 index 9eef7f2..0000000 --- a/board/ep7312/env.c +++ /dev/null @@ -1,136 +0,0 @@ -/* - * (C) Copyright 2002 - * Sysgo Real-Time Solutions, GmbH - * Marius Groeger - * - * See file CREDITS for list of people who contributed to this - * project. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - */ - -#include -#include - -static int check_crc(bd_t *bd) -{ - /* need to calculate crc? */ - if (bd->bi_ext.env_crc_valid == 0) - { - env_t *env = (env_t *)CFG_ENV_ADDR; - - if (crc32(0, env->data, sizeof(env->data)) == env->crc) - bd->bi_ext.env_crc_valid = 1; - else - bd->bi_ext.env_crc_valid = -1; - } - return bd->bi_ext.env_crc_valid > 0; -} - - -/* - * save environment buffer back to flash - * returns -1 on error, 0 if ok - */ -int board_env_save(bd_t *bd, env_t *env, int size) -{ - int rc; - ulong start_addr, end_addr; - -#if CFG_ENV_SIZE <= CFG_ENV_SECT_SIZE -#error Make sure that CFG_ENV_SIZE <= CFG_ENV_SECT_SIZE -#endif - - start_addr = CFG_ENV_ADDR; - end_addr = start_addr + CFG_ENV_SIZE - 1; - - rc = flash_sect_protect(0, CFG_ENV_ADDR, end_addr); - if (rc < 0) - return rc; - - rc = flash_sect_erase(start_addr, end_addr); - if (rc < 0) - { - flash_sect_protect(1, start_addr, end_addr); - flash_perror(rc); - return rc; - } - - printf("Saving Environment to Flash..."); - rc = flash_write((uchar*)env, start_addr, size); - if (rc < 0) - flash_perror(rc); - else - printf("done.\n"); - - (void)flash_sect_protect(1, start_addr, end_addr); - - return 0; -} - -/* - * copy environment to memory - * returns -1 on error, 0 if ok - */ -int board_env_copy(bd_t *bd, env_t *data, int size) -{ - env_t *env = (env_t *)CFG_ENV_ADDR; - - if (check_crc(bd)) - { - memcpy(data, env, sizeof(env_t)); - return 0; - } - - return -1; -} - -/* - * try to read env character at offset #index - * - * called before the environment is copied to ram - * returns -1 on error, 0 if ok - */ -int board_env_getchar(bd_t * bd, int index, uchar *c) -{ - env_t *env = (env_t *)CFG_ENV_ADDR; - - /* check environment crc */ - if (index < sizeof(env->data) && check_crc(bd)) - { - *c = env->data[index]; - return 0; - } - - return -1; -} - -/* - * try to read env character at offset #index - * - * called before the environment is copied to ram - * returns -1 on error, 0 if ok - */ -uchar *board_env_getaddr(bd_t * bd, int index) -{ - env_t *env = (env_t *)CFG_ENV_ADDR; - - /* check environment crc */ - if (index < sizeof(env->data) && check_crc(bd)) - return &env->data[index]; - - return 0; -} diff --git a/board/impa7/Makefile b/board/impa7/Makefile index 5afba8f..d936308 100644 --- a/board/impa7/Makefile +++ b/board/impa7/Makefile @@ -25,7 +25,7 @@ include $(TOPDIR)/config.mk LIB = lib$(BOARD).a -OBJS := impa7.o flash.o env.o +OBJS := impa7.o flash.o SOBJS := memsetup.o $(LIB): $(OBJS) $(SOBJS) diff --git a/board/impa7/env.c b/board/impa7/env.c deleted file mode 100644 index 9eef7f2..0000000 --- a/board/impa7/env.c +++ /dev/null @@ -1,136 +0,0 @@ -/* - * (C) Copyright 2002 - * Sysgo Real-Time Solutions, GmbH - * Marius Groeger - * - * See file CREDITS for list of people who contributed to this - * project. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - */ - -#include -#include - -static int check_crc(bd_t *bd) -{ - /* need to calculate crc? */ - if (bd->bi_ext.env_crc_valid == 0) - { - env_t *env = (env_t *)CFG_ENV_ADDR; - - if (crc32(0, env->data, sizeof(env->data)) == env->crc) - bd->bi_ext.env_crc_valid = 1; - else - bd->bi_ext.env_crc_valid = -1; - } - return bd->bi_ext.env_crc_valid > 0; -} - - -/* - * save environment buffer back to flash - * returns -1 on error, 0 if ok - */ -int board_env_save(bd_t *bd, env_t *env, int size) -{ - int rc; - ulong start_addr, end_addr; - -#if CFG_ENV_SIZE <= CFG_ENV_SECT_SIZE -#error Make sure that CFG_ENV_SIZE <= CFG_ENV_SECT_SIZE -#endif - - start_addr = CFG_ENV_ADDR; - end_addr = start_addr + CFG_ENV_SIZE - 1; - - rc = flash_sect_protect(0, CFG_ENV_ADDR, end_addr); - if (rc < 0) - return rc; - - rc = flash_sect_erase(start_addr, end_addr); - if (rc < 0) - { - flash_sect_protect(1, start_addr, end_addr); - flash_perror(rc); - return rc; - } - - printf("Saving Environment to Flash..."); - rc = flash_write((uchar*)env, start_addr, size); - if (rc < 0) - flash_perror(rc); - else - printf("done.\n"); - - (void)flash_sect_protect(1, start_addr, end_addr); - - return 0; -} - -/* - * copy environment to memory - * returns -1 on error, 0 if ok - */ -int board_env_copy(bd_t *bd, env_t *data, int size) -{ - env_t *env = (env_t *)CFG_ENV_ADDR; - - if (check_crc(bd)) - { - memcpy(data, env, sizeof(env_t)); - return 0; - } - - return -1; -} - -/* - * try to read env character at offset #index - * - * called before the environment is copied to ram - * returns -1 on error, 0 if ok - */ -int board_env_getchar(bd_t * bd, int index, uchar *c) -{ - env_t *env = (env_t *)CFG_ENV_ADDR; - - /* check environment crc */ - if (index < sizeof(env->data) && check_crc(bd)) - { - *c = env->data[index]; - return 0; - } - - return -1; -} - -/* - * try to read env character at offset #index - * - * called before the environment is copied to ram - * returns -1 on error, 0 if ok - */ -uchar *board_env_getaddr(bd_t * bd, int index) -{ - env_t *env = (env_t *)CFG_ENV_ADDR; - - /* check environment crc */ - if (index < sizeof(env->data) && check_crc(bd)) - return &env->data[index]; - - return 0; -} diff --git a/board/lart/Makefile b/board/lart/Makefile index da83505..12a0367 100644 --- a/board/lart/Makefile +++ b/board/lart/Makefile @@ -25,7 +25,7 @@ include $(TOPDIR)/config.mk LIB = lib$(BOARD).a -OBJS := lart.o flash.o env.o +OBJS := lart.o flash.o SOBJS := flashasm.o memsetup.o $(LIB): $(OBJS) $(SOBJS) diff --git a/board/lart/env.c b/board/lart/env.c deleted file mode 100644 index 9eef7f2..0000000 --- a/board/lart/env.c +++ /dev/null @@ -1,136 +0,0 @@ -/* - * (C) Copyright 2002 - * Sysgo Real-Time Solutions, GmbH - * Marius Groeger - * - * See file CREDITS for list of people who contributed to this - * project. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - */ - -#include -#include - -static int check_crc(bd_t *bd) -{ - /* need to calculate crc? */ - if (bd->bi_ext.env_crc_valid == 0) - { - env_t *env = (env_t *)CFG_ENV_ADDR; - - if (crc32(0, env->data, sizeof(env->data)) == env->crc) - bd->bi_ext.env_crc_valid = 1; - else - bd->bi_ext.env_crc_valid = -1; - } - return bd->bi_ext.env_crc_valid > 0; -} - - -/* - * save environment buffer back to flash - * returns -1 on error, 0 if ok - */ -int board_env_save(bd_t *bd, env_t *env, int size) -{ - int rc; - ulong start_addr, end_addr; - -#if CFG_ENV_SIZE <= CFG_ENV_SECT_SIZE -#error Make sure that CFG_ENV_SIZE <= CFG_ENV_SECT_SIZE -#endif - - start_addr = CFG_ENV_ADDR; - end_addr = start_addr + CFG_ENV_SIZE - 1; - - rc = flash_sect_protect(0, CFG_ENV_ADDR, end_addr); - if (rc < 0) - return rc; - - rc = flash_sect_erase(start_addr, end_addr); - if (rc < 0) - { - flash_sect_protect(1, start_addr, end_addr); - flash_perror(rc); - return rc; - } - - printf("Saving Environment to Flash..."); - rc = flash_write((uchar*)env, start_addr, size); - if (rc < 0) - flash_perror(rc); - else - printf("done.\n"); - - (void)flash_sect_protect(1, start_addr, end_addr); - - return 0; -} - -/* - * copy environment to memory - * returns -1 on error, 0 if ok - */ -int board_env_copy(bd_t *bd, env_t *data, int size) -{ - env_t *env = (env_t *)CFG_ENV_ADDR; - - if (check_crc(bd)) - { - memcpy(data, env, sizeof(env_t)); - return 0; - } - - return -1; -} - -/* - * try to read env character at offset #index - * - * called before the environment is copied to ram - * returns -1 on error, 0 if ok - */ -int board_env_getchar(bd_t * bd, int index, uchar *c) -{ - env_t *env = (env_t *)CFG_ENV_ADDR; - - /* check environment crc */ - if (index < sizeof(env->data) && check_crc(bd)) - { - *c = env->data[index]; - return 0; - } - - return -1; -} - -/* - * try to read env character at offset #index - * - * called before the environment is copied to ram - * returns -1 on error, 0 if ok - */ -uchar *board_env_getaddr(bd_t * bd, int index) -{ - env_t *env = (env_t *)CFG_ENV_ADDR; - - /* check environment crc */ - if (index < sizeof(env->data) && check_crc(bd)) - return &env->data[index]; - - return 0; -} diff --git a/board/lubbock/Makefile b/board/lubbock/Makefile index 2655d55..6ddd72e 100644 --- a/board/lubbock/Makefile +++ b/board/lubbock/Makefile @@ -25,7 +25,7 @@ include $(TOPDIR)/config.mk LIB = lib$(BOARD).a -OBJS := lubbock.o flash.o env.o +OBJS := lubbock.o flash.o SOBJS := memsetup.o $(LIB): $(OBJS) $(SOBJS) diff --git a/board/lubbock/env.c b/board/lubbock/env.c deleted file mode 100644 index c6b6190..0000000 --- a/board/lubbock/env.c +++ /dev/null @@ -1,135 +0,0 @@ -/* - * (C) Copyright 2002 - * Sysgo Real-Time Solutions, GmbH - * Marius Groeger - * - * See file CREDITS for list of people who contributed to this - * project. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - */ - -#include - -static int check_crc(bd_t *bd) -{ - /* need to calculate crc? */ - if (bd->bi_ext.env_crc_valid == 0) - { - env_t *env = (env_t *)CFG_ENV_ADDR; - - if (crc32(0, env->data, sizeof(env->data)) == env->crc) - bd->bi_ext.env_crc_valid = 1; - else - bd->bi_ext.env_crc_valid = -1; - } - return bd->bi_ext.env_crc_valid > 0; -} - - -/* - * save environment buffer back to flash - * returns -1 on error, 0 if ok - */ -int board_env_save(bd_t *bd, env_t *env, int size) -{ - int rc; - ulong start_addr, end_addr; - -#if CFG_ENV_SIZE <= CFG_ENV_SECT_SIZE -#error Make sure that CFG_ENV_SIZE <= CFG_ENV_SECT_SIZE -#endif - - start_addr = CFG_ENV_ADDR; - end_addr = start_addr + CFG_ENV_SIZE - 1; - - rc = flash_sect_protect(0, CFG_ENV_ADDR, end_addr); - if (rc < 0) - return rc; - - rc = flash_sect_erase(start_addr, end_addr); - if (rc < 0) - { - flash_sect_protect(1, start_addr, end_addr); - flash_perror(rc); - return rc; - } - - printf("Saving Environment to Flash..."); - rc = flash_write((uchar*)env, start_addr, size); - if (rc < 0) - flash_perror(rc); - else - printf("done.\n"); - - (void)flash_sect_protect(1, start_addr, end_addr); - - return 0; -} - -/* - * copy environment to memory - * returns -1 on error, 0 if ok - */ -int board_env_copy(bd_t *bd, env_t *data, int size) -{ - env_t *env = (env_t *)CFG_ENV_ADDR; - - if (check_crc(bd)) - { - memcpy(data, env, sizeof(env_t)); - return 0; - } - - return -1; -} - -/* - * try to read env character at offset #index - * - * called before the environment is copied to ram - * returns -1 on error, 0 if ok - */ -int board_env_getchar(bd_t * bd, int index, uchar *c) -{ - env_t *env = (env_t *)CFG_ENV_ADDR; - - /* check environment crc */ - if (index < sizeof(env->data) && check_crc(bd)) - { - *c = env->data[index]; - return 0; - } - - return -1; -} - -/* - * try to read env character at offset #index - * - * called before the environment is copied to ram - * returns -1 on error, 0 if ok - */ -uchar *board_env_getaddr(bd_t * bd, int index) -{ - env_t *env = (env_t *)CFG_ENV_ADDR; - - /* check environment crc */ - if (index < sizeof(env->data) && check_crc(bd)) - return &env->data[index]; - - return 0; -} diff --git a/board/shannon/Makefile b/board/shannon/Makefile index 56105d3..ac5bf81 100644 --- a/board/shannon/Makefile +++ b/board/shannon/Makefile @@ -25,7 +25,7 @@ include $(TOPDIR)/config.mk LIB = lib$(BOARD).a -OBJS := shannon.o flash.o env.o +OBJS := shannon.o flash.o SOBJS := memsetup.o $(LIB): $(OBJS) $(SOBJS) diff --git a/board/shannon/env.c b/board/shannon/env.c deleted file mode 100644 index 046b4d5..0000000 --- a/board/shannon/env.c +++ /dev/null @@ -1,142 +0,0 @@ -/* - * (C) Copyright 2002 - * Sysgo Real-Time Solutions, GmbH - * Alex Zuepke - * - * See file CREDITS for list of people who contributed to this - * project. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - */ - -#include -#include - -static int check_crc(bd_t *bd) -{ - /* need to calculate crc? */ - if (bd->bi_ext.env_crc_valid == 0) - { - env_t *env = (env_t *)CFG_ENV_ADDR; - - if (crc32(0, env->data, sizeof(env->data)) == env->crc) - bd->bi_ext.env_crc_valid = 1; - else - bd->bi_ext.env_crc_valid = -1; - } - return bd->bi_ext.env_crc_valid > 0; -} - - -/* - * save environment buffer back to flash - * returns -1 on error, 0 if ok - */ -int board_env_save(bd_t *bd, env_t *env, int size) -{ - int rc; - ulong start_addr, end_addr; - -#if CFG_ENV_SIZE <= CFG_ENV_SECT_SIZE -#error Make sure that CFG_ENV_SIZE <= CFG_ENV_SECT_SIZE -#endif - - start_addr = CFG_ENV_ADDR; -#ifdef CONFIG_INFERNO - /* this is the last sector, and the size is hardcoded here */ - /* otherwise we will get stack problems on loading 128 KB environment */ - end_addr = start_addr + 0x20000 - 1; -#else - end_addr = start_addr + CFG_ENV_SIZE - 1; -#endif - - rc = flash_sect_protect(0, start_addr, end_addr); - if (rc < 0) - return rc; - - rc = flash_sect_erase(start_addr, end_addr); - if (rc < 0) - { - flash_sect_protect(1, start_addr, end_addr); - flash_perror(rc); - return rc; - } - - printf("Saving Environment to Flash... "); - rc = flash_write((uchar*)env, start_addr, size); - if (rc < 0) - flash_perror(rc); - else - printf("done.\n"); - - (void)flash_sect_protect(1, start_addr, end_addr); - - return 0; -} - -/* - * copy environment to memory - * returns -1 on error, 0 if ok - */ -int board_env_copy(bd_t *bd, env_t *data, int size) -{ - env_t *env = (env_t *)CFG_ENV_ADDR; - - if (check_crc(bd)) - { - memcpy(data, env, sizeof(env_t)); - return 0; - } - - return -1; -} - -/* - * try to read env character at offset #index - * - * called before the environment is copied to ram - * returns -1 on error, 0 if ok - */ -int board_env_getchar(bd_t * bd, int index, uchar *c) -{ - env_t *env = (env_t *)CFG_ENV_ADDR; - - /* check environment crc */ - if (index < sizeof(env->data) && check_crc(bd)) - { - *c = env->data[index]; - return 0; - } - - return -1; -} - -/* - * try to read env character at offset #index - * - * called before the environment is copied to ram - * returns -1 on error, 0 if ok - */ -uchar *board_env_getaddr(bd_t * bd, int index) -{ - env_t *env = (env_t *)CFG_ENV_ADDR; - - /* check environment crc */ - if (index < sizeof(env->data) && check_crc(bd)) - return &env->data[index]; - - return 0; -} diff --git a/board/smdk2400/Makefile b/board/smdk2400/Makefile index ca5edab..6dbd4e7 100644 --- a/board/smdk2400/Makefile +++ b/board/smdk2400/Makefile @@ -25,7 +25,7 @@ include $(TOPDIR)/config.mk LIB = lib$(BOARD).a -OBJS := smdk2400.o flash.o env.o +OBJS := smdk2400.o flash.o SOBJS := memsetup.o $(LIB): $(OBJS) $(SOBJS) diff --git a/board/smdk2400/env.c b/board/smdk2400/env.c deleted file mode 100644 index dad968e..0000000 --- a/board/smdk2400/env.c +++ /dev/null @@ -1,139 +0,0 @@ -/* - * (C) Copyright 2002 - * Sysgo Real-Time Solutions, GmbH - * Marius Groeger - * - * (C) Copyright 2002 - * Gary Jennejohn, DENX Software Engineering, - * - * See file CREDITS for list of people who contributed to this - * project. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - */ - -#include -#include - -static int check_crc(bd_t *bd) -{ - /* need to calculate crc? */ - if (bd->bi_ext.env_crc_valid == 0) - { - env_t *env = (env_t *)CFG_ENV_ADDR; - - if (crc32(0, env->data, sizeof(env->data)) == env->crc) - bd->bi_ext.env_crc_valid = 1; - else - bd->bi_ext.env_crc_valid = -1; - } - return bd->bi_ext.env_crc_valid > 0; -} - - -/* - * save environment buffer back to flash - * returns -1 on error, 0 if ok - */ -int board_env_save(bd_t *bd, env_t *env, int size) -{ - int rc; - ulong start_addr, end_addr; - -#if CFG_ENV_SIZE <= CFG_ENV_SECT_SIZE -#error Make sure that CFG_ENV_SIZE <= CFG_ENV_SECT_SIZE -#endif - - start_addr = CFG_ENV_ADDR; - end_addr = start_addr + CFG_ENV_SIZE - 1; - - rc = flash_sect_protect(0, CFG_ENV_ADDR, end_addr); - if (rc < 0) - return rc; - - rc = flash_sect_erase(start_addr, end_addr); - if (rc < 0) - { - flash_sect_protect(1, start_addr, end_addr); - flash_perror(rc); - return rc; - } - - printf("Saving Environment to Flash..."); - rc = flash_write((uchar*)env, start_addr, size); - if (rc < 0) - flash_perror(rc); - else - printf("done.\n"); - - (void)flash_sect_protect(1, start_addr, end_addr); - - return 0; -} - -/* - * copy environment to memory - * returns -1 on error, 0 if ok - */ -int board_env_copy(bd_t *bd, env_t *data, int size) -{ - env_t *env = (env_t *)CFG_ENV_ADDR; - - if (check_crc(bd)) - { - memcpy(data, env, sizeof(env_t)); - return 0; - } - - return -1; -} - -/* - * try to read env character at offset #index - * - * called before the environment is copied to ram - * returns -1 on error, 0 if ok - */ -int board_env_getchar(bd_t * bd, int index, uchar *c) -{ - env_t *env = (env_t *)CFG_ENV_ADDR; - - /* check environment crc */ - if (index < sizeof(env->data) && check_crc(bd)) - { - *c = env->data[index]; - return 0; - } - - return -1; -} - -/* - * try to read env character at offset #index - * - * called before the environment is copied to ram - * returns -1 on error, 0 if ok - */ -uchar *board_env_getaddr(bd_t * bd, int index) -{ - env_t *env = (env_t *)CFG_ENV_ADDR; - - /* check environment crc */ - if (index < sizeof(env->data) && check_crc(bd)) - return &env->data[index]; - - return 0; -} diff --git a/board/smdk2410/Makefile b/board/smdk2410/Makefile index 3c510f3..79ab33a 100644 --- a/board/smdk2410/Makefile +++ b/board/smdk2410/Makefile @@ -25,7 +25,7 @@ include $(TOPDIR)/config.mk LIB = lib$(BOARD).a -OBJS := smdk2410.o flash.o env.o +OBJS := smdk2410.o flash.o SOBJS := memsetup.o $(LIB): $(OBJS) $(SOBJS) diff --git a/board/smdk2410/env.c b/board/smdk2410/env.c deleted file mode 100644 index 5e8d95a..0000000 --- a/board/smdk2410/env.c +++ /dev/null @@ -1,139 +0,0 @@ -/* - * (C) Copyright 2002 - * Sysgo Real-Time Solutions, GmbH - * Marius Groeger - * - * (C) Copyright 2002 - * Gary Jennejohn, DENX Software Engineering, - * - * See file CREDITS for list of people who contributed to this - * project. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - */ - -#include -#include - -static int check_crc(bd_t *bd) -{ - /* need to calculate crc? */ - if (bd->bi_ext.env_crc_valid == 0) - { - env_t *env = (env_t *)CFG_ENV_ADDR; - - if (crc32(0, env->data, sizeof(env->data)) == env->crc) - bd->bi_ext.env_crc_valid = 1; - else - bd->bi_ext.env_crc_valid = -1; - } - return bd->bi_ext.env_crc_valid > 0; -} - - -/* - * save environment buffer back to flash - * returns -1 on error, 0 if ok - */ -int board_env_save(bd_t *bd, env_t *env, int size) -{ - int rc; - ulong start_addr, end_addr; - -#if CFG_ENV_SIZE <= CFG_ENV_SECT_SIZE -#error Make sure that CFG_ENV_SIZE <= CFG_ENV_SECT_SIZE -#endif - - start_addr = CFG_ENV_ADDR; - end_addr = start_addr + CFG_ENV_SIZE - 1; - - rc = flash_sect_protect(0, CFG_ENV_ADDR, end_addr); - if (rc < 0) - return rc; - - rc = flash_sect_erase(start_addr, end_addr); - if (rc < 0) - { - flash_sect_protect(1, start_addr, end_addr); - flash_perror(rc); - return rc; - } - - printf("Saving Environment to Flash..."); - rc = flash_write((uchar*)env, start_addr, size); - if (rc < 0) - flash_perror(rc); - else - printf("done.\n"); - - (void)flash_sect_protect(1, start_addr, end_addr); - - return 0; -} - -/* - * copy environment to memory - * returns -1 on error, 0 if ok - */ -int board_env_copy(bd_t *bd, env_t *data, int size) -{ - env_t *env = (env_t *)CFG_ENV_ADDR; - - if (check_crc(bd)) - { - memcpy(data, env, sizeof(env_t)); - return 0; - } - - return -1; -} - -/* - * try to read env character at offset #index - * - * called before the environment is copied to ram - * returns -1 on error, 0 if ok - */ -int board_env_getchar(bd_t * bd, int index, uchar *c) -{ - env_t *env = (env_t *)CFG_ENV_ADDR; - - /* check environment crc */ - if (index < sizeof(env->data) && check_crc(bd)) - { - *c = env->data[index]; - return 0; - } - - return -1; -} - -/* - * try to read env character at offset #index - * - * called before the environment is copied to ram - * returns -1 on error, 0 if ok - */ -uchar *board_env_getaddr(bd_t * bd, int index) -{ - env_t *env = (env_t *)CFG_ENV_ADDR; - - /* check environment crc */ - if (index < sizeof(env->data) && check_crc(bd)) - return &env->data[index]; - - return 0; -} diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c index d1fa3f7..532be56 100644 --- a/common/cmd_nvedit.c +++ b/common/cmd_nvedit.c @@ -113,7 +113,6 @@ static env_t *env_ptr = NULL; /*--- FLASH ----------------------------------------------------------*/ #elif defined(CFG_ENV_IS_IN_FLASH) /* Environment is in Flash */ - # if defined(ENV_IS_EMBEDDED) /* embedded within PPCBoot */ extern uchar environment[]; @@ -136,12 +135,7 @@ static uchar *flash_addr = (uchar *)CFG_ENV_ADDR; static env_t *env_ptr = NULL; #else -#ifdef CONFIG_ARM /* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */ -#warning ARM version not implemented yet /* XXXXXXXXXXXXXXXXXXXXXXXXXXXX */ - /* nothing XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */ -#else /* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */ # error Define one of CFG_ENV_IS_IN_NVRAM, CFG_ENV_IS_IN_EEPROM, CFG_ENV_IS_IN_FLASH, CFG_ENV_IS_NOWHERE -#endif /* CONFIG_ARM XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */ #endif /* CFG_ENV_IS_IN_FLASH */ /*----------------------------------------------------------------------*/ @@ -258,10 +252,6 @@ static uchar *(*get_env_addr)(int) = get_env_addr_memory; void env_relocate (void) { -#ifdef CONFIG_ARM /* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */ -#warning ARM version not implemented yet /* XXXXXXXXXXXXXXXXXXXXXXXXXXXX */ - return; -#else /* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */ DECLARE_GLOBAL_DATA_PTR; DEBUGF ("%s[%d] offset = 0x%lx\n", __FUNCTION__,__LINE__, @@ -306,6 +296,7 @@ void env_relocate (void) memcpy (env_ptr->data, default_environment, sizeof(default_environment)); + env_ptr->crc = crc32(0, env_ptr->data, ENV_SIZE); gd->env_valid = 1; } #if !defined(ENV_IS_EMBEDDED) @@ -313,24 +304,19 @@ void env_relocate (void) DEBUGF ("%s[%d] ENV is valid\n", __FUNCTION__,__LINE__); # if defined(CFG_ENV_IS_IN_EEPROM) DEBUGF ("%s[%d] read ENV from EEPROM\n", __FUNCTION__,__LINE__); - eeprom_read (CFG_DEF_EEPROM_ADDR, CFG_ENV_OFFSET+offsetof(env_t,data), - env_ptr->data, - ENV_SIZE); + eeprom_read (CFG_DEF_EEPROM_ADDR, CFG_ENV_OFFSET, + env_ptr, + CFG_ENV_SIZE); # elif defined(CFG_ENV_IS_IN_NVRAM) && defined(CFG_NVRAM_ACCESS_ROUTINE) DEBUGF ("%s[%d] read ENV from NVRAM\n", __FUNCTION__,__LINE__); - nvram_read(env_ptr->data, - CFG_ENV_ADDR + sizeof(long), - ENV_SIZE); + nvram_read(env_ptr, CFG_ENV_ADDR, CFG_ENV_SIZE); # elif !defined(CFG_ENV_IS_NOWHERE) DEBUGF ("%s[%d] read ENV from NVRAM/FLASH\n",__FUNCTION__,__LINE__); - memcpy (env_ptr->data, - ((env_t *)CFG_ENV_ADDR)->data, - ENV_SIZE); + memcpy (env_ptr, (void*)CFG_ENV_ADDR, CFG_ENV_SIZE); # endif } #endif gd->env_addr = (ulong)&(env_ptr->data); -#endif /* CONFIG_ARM XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */ } /************************************************************************ ************************************************************************/ @@ -340,10 +326,6 @@ void env_relocate (void) */ static uchar get_env_char_memory (int index) { -#ifdef CONFIG_ARM /* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */ -#warning ARM version not implemented yet /* XXXXXXXXXXXXXXXXXXXXXXXXXXXX */ - return 0; -#else /* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */ DECLARE_GLOBAL_DATA_PTR; if (gd->env_valid) { @@ -351,16 +333,11 @@ static uchar get_env_char_memory (int index) } else { return ( default_environment[index] ); } -#endif /* CONFIG_ARM XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */ } static uchar *get_env_addr_memory(int index) { -#ifdef CONFIG_ARM /* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */ -#warning ARM version not implemented yet /* XXXXXXXXXXXXXXXXXXXXXXXXXXXX */ - return 0; -#else /* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */ DECLARE_GLOBAL_DATA_PTR; if (gd->env_valid) { @@ -368,16 +345,11 @@ static uchar *get_env_addr_memory(int index) } else { return (&default_environment[index]); } -#endif /* CONFIG_ARM XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */ } #if defined(CFG_ENV_IS_IN_NVRAM) && defined(CFG_NVRAM_ACCESS_ROUTINE) static uchar get_env_char_nvram(int index) { -#ifdef CONFIG_ARM /* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */ -#warning ARM version not implemented yet /* XXXXXXXXXXXXXXXXXXXXXXXXXXXX */ - return 0; -#else /* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */ DECLARE_GLOBAL_DATA_PTR; uchar c; @@ -388,7 +360,6 @@ static uchar get_env_char_nvram(int index) c = default_environment[index]; return c; -#endif /* CONFIG_ARM XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */ } #endif @@ -398,10 +369,6 @@ static uchar get_env_char_nvram(int index) */ static uchar get_env_char_eeprom (int index) { -#ifdef CONFIG_ARM /* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */ -#warning ARM version not implemented yet /* XXXXXXXXXXXXXXXXXXXXXXXXXXXX */ - return 0; -#else /* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */ DECLARE_GLOBAL_DATA_PTR; uchar c; @@ -416,7 +383,6 @@ static uchar get_env_char_eeprom (int index) } return (c); -#endif /* CONFIG_ARM XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */ } #endif /* CFG_ENV_IS_IN_EEPROM */ @@ -485,10 +451,6 @@ int do_printenv (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) int _do_setenv (int flag, int argc, char *argv[]) { -#ifdef CONFIG_ARM /* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */ -#warning ARM version not implemented yet /* XXXXXXXXXXXXXXXXXXXXXXXXXXXX */ - return 0; -#else /* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */ DECLARE_GLOBAL_DATA_PTR; int i, len, oldval; @@ -696,7 +658,6 @@ int _do_setenv (int flag, int argc, char *argv[]) } #endif /* CFG_CMD_NET */ return 0; -#endif /* CONFIG_ARM XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */ } void setenv (char *varname, char *varvalue) @@ -902,10 +863,6 @@ int saveenv(void) int saveenv(void) { -#ifdef CONFIG_ARM /* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */ -#warning ARM version not implemented yet /* XXXXXXXXXXXXXXXXXXXXXXXXXXXX */ - return 0; -#else /* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */ int len, rc; ulong end_addr; uchar *flash_sect_addr; @@ -936,7 +893,13 @@ int saveenv(void) len = CFG_ENV_SIZE; #endif /* CFG_ENV_SECT_SIZE */ +#ifndef CONFIG_INFERNO end_addr = (ulong)flash_sect_addr + len - 1; +#else + /* this is the last sector, and the size is hardcoded here */ + /* otherwise we will get stack problems on loading 128 KB environment */ + end_addr = (ulong)flash_sect_addr + 0x20000 - 1; +#endif if (flash_sect_protect (0, (ulong)flash_sect_addr, end_addr)) return 1; @@ -957,7 +920,6 @@ int saveenv(void) /* try to re-protect */ (void) flash_sect_protect (1, (ulong)flash_sect_addr, end_addr); return rcode; -#endif /* CONFIG_ARM XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */ } #endif /* CFG_CMD_ENV + CFG_CMD_FLASH */ @@ -1006,10 +968,6 @@ int env_init(void) #else int env_init(void) { -#ifdef CONFIG_ARM /* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */ -#warning ARM version not implemented yet /* XXXXXXXXXXXXXXXXXXXXXXXXXXXX */ - return 0; -#else /* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */ DECLARE_GLOBAL_DATA_PTR; if (crc32(0, env_ptr->data, ENV_SIZE) == env_ptr->crc) { @@ -1021,7 +979,6 @@ int env_init(void) } return (0); -#endif /* CONFIG_ARM XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */ } #endif /* defined(CFG_ENV_IS_IN_NVRAM) && defined(CFG_NVRAM_ACCESS_ROUTINE) */ diff --git a/include/asm-arm/global_data.h b/include/asm-arm/global_data.h index 5191286..a8daa28 100644 --- a/include/asm-arm/global_data.h +++ b/include/asm-arm/global_data.h @@ -39,13 +39,13 @@ typedef struct global_data { unsigned long baudrate; unsigned long have_console; /* serial_init() was called */ unsigned long reloc_off; /* Relocation Offset */ + unsigned long env_addr; /* Address of Environment struct */ + unsigned long env_valid; /* Checksum of Environment valid? */ #if 0 unsigned long cpu_clk; /* CPU clock in Hz! */ unsigned long bus_clk; unsigned long ram_size; /* RAM size */ unsigned long reset_status; /* reset status register at boot */ - unsigned long env_addr; /* Address of Environment struct */ - unsigned long env_valid; /* Checksum of Environment valid? */ #endif } gd_t; diff --git a/include/asm-arm/ppcboot.h b/include/asm-arm/ppcboot.h index 259f4d7..70af610 100644 --- a/include/asm-arm/ppcboot.h +++ b/include/asm-arm/ppcboot.h @@ -41,7 +41,6 @@ typedef struct bd_info { ulong start; ulong size; } bi_dram[CONFIG_NR_DRAM_BANKS]; - struct bd_info_ext bi_ext; /* board specific extension */ } bd_t; #define bi_env_data bi_env->data diff --git a/include/configs/cradle.h b/include/configs/cradle.h index 3024e84..b12a0c2 100644 --- a/include/configs/cradle.h +++ b/include/configs/cradle.h @@ -103,26 +103,6 @@ /* valid baudrates */ #define CFG_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200 } -#ifndef __ASSEMBLY__ -/* - * Board specific extension for bd_info - * - * This structure is embedded in the global bd_info (bd_t) structure - * and can be used by the board specific code (eg board/...) - */ - -struct bd_info_ext -{ - /* helper variable for board environment handling - * - * env_crc_valid == 0 => uninitialised - * env_crc_valid > 0 => environment crc in flash is valid - * env_crc_valid < 0 => environment crc in flash is invalid - */ - int env_crc_valid; -}; -#endif - /* * Stack sizes * @@ -167,12 +147,6 @@ struct bd_info_ext #define CFG_FLASH_WRITE_TOUT (2*CFG_HZ) /* Timeout for Flash Write */ #define CFG_ENV_IS_IN_FLASH 1 -#undef EMBED -#ifdef EMBED -#define CFG_ENV_SECT_SIZE 0x20000 -#define CFG_ENV_SIZE 0x200 /* FIXME How big when embedded?? */ -#define CFG_ENV_ADDR 0x0004fb00 -#else #define CFG_ENV_ADDR 0x00020000 /* absolute address for now */ #define CFG_ENV_SIZE 0x20000 /* 8K ouch, this may later be */ #endif diff --git a/include/configs/dnp1110.h b/include/configs/dnp1110.h index 7fc6776..673e767 100644 --- a/include/configs/dnp1110.h +++ b/include/configs/dnp1110.h @@ -107,26 +107,6 @@ /* valid baudrates */ #define CFG_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200 } -#ifndef __ASSEMBLY__ -/*----------------------------------------------------------------------- - * Board specific extension for bd_info - * - * This structure is embedded in the global bd_info (bd_t) structure - * and can be used by the board specific code (eg board/...) - */ - -struct bd_info_ext -{ - /* helper variable for board environment handling - * - * env_crc_valid == 0 => uninitialised - * env_crc_valid > 0 => environment crc in flash is valid - * env_crc_valid < 0 => environment crc in flash is invalid - */ - int env_crc_valid; -}; -#endif - /*----------------------------------------------------------------------- * Stack sizes * @@ -161,6 +141,7 @@ struct bd_info_ext #define CFG_FLASH_ERASE_TOUT (2*CFG_HZ) /* Timeout for Flash Erase */ #define CFG_FLASH_WRITE_TOUT (2*CFG_HZ) /* Timeout for Flash Write */ +#define CFG_ENV_IS_IN_FLASH 1 #define CFG_ENV_ADDR (PHYS_FLASH_1 + 0x1C000) /* Addr of Environment Sector */ #define CFG_ENV_SIZE 0x4000 /* Total Size of Environment Sector */ diff --git a/include/configs/ep7312.h b/include/configs/ep7312.h index 30eb49c..6b30ce1 100644 --- a/include/configs/ep7312.h +++ b/include/configs/ep7312.h @@ -110,26 +110,6 @@ /* valid baudrates */ #define CFG_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200 } -#ifndef __ASSEMBLY__ -/*----------------------------------------------------------------------- - * Board specific extension for bd_info - * - * This structure is embedded in the global bd_info (bd_t) structure - * and can be used by the board specific code (eg board/...) - */ - -struct bd_info_ext -{ - /* helper variable for board environment handling - * - * env_crc_valid == 0 => uninitialised - * env_crc_valid > 0 => environment crc in flash is valid - * env_crc_valid < 0 => environment crc in flash is invalid - */ - int env_crc_valid; -}; -#endif - /*----------------------------------------------------------------------- * Stack sizes * @@ -163,6 +143,7 @@ struct bd_info_ext #define CFG_FLASH_ERASE_TOUT (2*CFG_HZ) /* Timeout for Flash Erase */ #define CFG_FLASH_WRITE_TOUT (2*CFG_HZ) /* Timeout for Flash Write */ +#define CFG_ENV_IS_IN_FLASH 1 #define CFG_ENV_ADDR (PHYS_FLASH_1 + 0x20000) /* Addr of Environment Sector */ #define CFG_ENV_SIZE 0x20000 /* Total Size of Environment Sector */ diff --git a/include/configs/impa7.h b/include/configs/impa7.h index eef1e4b..99e0a4b 100644 --- a/include/configs/impa7.h +++ b/include/configs/impa7.h @@ -109,26 +109,6 @@ /* valid baudrates */ #define CFG_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200 } -#ifndef __ASSEMBLY__ -/*----------------------------------------------------------------------- - * Board specific extension for bd_info - * - * This structure is embedded in the global bd_info (bd_t) structure - * and can be used by the board specific code (eg board/...) - */ - -struct bd_info_ext -{ - /* helper variable for board environment handling - * - * env_crc_valid == 0 => uninitialised - * env_crc_valid > 0 => environment crc in flash is valid - * env_crc_valid < 0 => environment crc in flash is invalid - */ - int env_crc_valid; -}; -#endif - /*----------------------------------------------------------------------- * Stack sizes * @@ -165,6 +145,7 @@ struct bd_info_ext #define CFG_FLASH_ERASE_TOUT (2*CFG_HZ) /* Timeout for Flash Erase */ #define CFG_FLASH_WRITE_TOUT (2*CFG_HZ) /* Timeout for Flash Write */ +#define CFG_ENV_IS_IN_FLASH 1 #define CFG_ENV_ADDR (PHYS_FLASH_1 + 0x1C000) /* Addr of Environment Sector */ #define CFG_ENV_SIZE 0x4000 /* Total Size of Environment Sector */ diff --git a/include/configs/lart.h b/include/configs/lart.h index 8e97e77..aa2dfa0 100644 --- a/include/configs/lart.h +++ b/include/configs/lart.h @@ -106,26 +106,6 @@ /* valid baudrates */ #define CFG_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200 } -#ifndef __ASSEMBLY__ -/*----------------------------------------------------------------------- - * Board specific extension for bd_info - * - * This structure is embedded in the global bd_info (bd_t) structure - * and can be used by the board specific code (eg board/...) - */ - -struct bd_info_ext -{ - /* helper variable for board environment handling - * - * env_crc_valid == 0 => uninitialised - * env_crc_valid > 0 => environment crc in flash is valid - * env_crc_valid < 0 => environment crc in flash is invalid - */ - int env_crc_valid; -}; -#endif - /*----------------------------------------------------------------------- * Stack sizes * @@ -166,6 +146,7 @@ struct bd_info_ext #define CFG_FLASH_ERASE_TOUT (2*CFG_HZ) /* Timeout for Flash Erase */ #define CFG_FLASH_WRITE_TOUT (2*CFG_HZ) /* Timeout for Flash Write */ +#define CFG_ENV_IS_IN_FLASH 1 #define CFG_ENV_ADDR (PHYS_FLASH_1 + 0x1C000) /* Addr of Environment Sector */ #define CFG_ENV_SIZE 0x4000 /* Total Size of Environment Sector */ diff --git a/include/configs/lubbock.h b/include/configs/lubbock.h index 45cd074..eb5ed2f 100644 --- a/include/configs/lubbock.h +++ b/include/configs/lubbock.h @@ -105,26 +105,6 @@ /* valid baudrates */ #define CFG_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200 } -#ifndef __ASSEMBLY__ -/* - * Board specific extension for bd_info - * - * This structure is embedded in the global bd_info (bd_t) structure - * and can be used by the board specific code (eg board/...) - */ - -struct bd_info_ext -{ - /* helper variable for board environment handling - * - * env_crc_valid == 0 => uninitialised - * env_crc_valid > 0 => environment crc in flash is valid - * env_crc_valid < 0 => environment crc in flash is invalid - */ - int env_crc_valid; -}; -#endif - /* * Stack sizes * @@ -217,6 +197,7 @@ struct bd_info_ext #define CFG_FLASH_WRITE_TOUT (2*CFG_HZ) /* Timeout for Flash Write */ /* FIXME */ +#define CFG_ENV_IS_IN_FLASH 1 #define CFG_ENV_ADDR (PHYS_FLASH_1 + 0x1C000) /* Addr of Environment Sector */ #define CFG_ENV_SIZE 0x4000 /* Total Size of Environment Sector */ diff --git a/include/configs/shannon.h b/include/configs/shannon.h index db2724d..4ab3d5f 100644 --- a/include/configs/shannon.h +++ b/include/configs/shannon.h @@ -112,26 +112,6 @@ #define CONFIG_DOS_PARTITION 1 /* DOS partitiion support */ -#ifndef __ASSEMBLY__ -/*----------------------------------------------------------------------- - * Board specific extension for bd_info - * - * This structure is embedded in the global bd_info (bd_t) structure - * and can be used by the board specific code (eg board/...) - */ - -struct bd_info_ext -{ - /* helper variable for board environment handling - * - * env_crc_valid == 0 => uninitialised - * env_crc_valid > 0 => environment crc in flash is valid - * env_crc_valid < 0 => environment crc in flash is invalid - */ - int env_crc_valid; -}; -#endif - /*----------------------------------------------------------------------- * Stack sizes * @@ -173,6 +153,7 @@ struct bd_info_ext #define CFG_FLASH_ERASE_TOUT (2*CFG_HZ) /* Timeout for Flash Erase */ #define CFG_FLASH_WRITE_TOUT (2*CFG_HZ) /* Timeout for Flash Write */ +#define CFG_ENV_IS_IN_FLASH 1 #ifdef CONFIG_INFERNO /* we take the last sector, 128 KB in size, but we only use 4 KB of it for stack reasons */ #define CFG_ENV_ADDR (PHYS_FLASH_1 + 0x003E0000) /* Addr of Environment Sector */ diff --git a/include/configs/smdk2400.h b/include/configs/smdk2400.h index ef577b4..5bb64c0 100644 --- a/include/configs/smdk2400.h +++ b/include/configs/smdk2400.h @@ -118,26 +118,6 @@ /* valid baudrates */ #define CFG_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200 } -#ifndef __ASSEMBLY__ -/*----------------------------------------------------------------------- - * Board specific extension for bd_info - * - * This structure is embedded in the global bd_info (bd_t) structure - * and can be used by the board specific code (eg board/...) - */ - -struct bd_info_ext -{ - /* helper variable for board environment handling - * - * env_crc_valid == 0 => uninitialised - * env_crc_valid > 0 => environment crc in flash is valid - * env_crc_valid < 0 => environment crc in flash is invalid - */ - int env_crc_valid; -}; -#endif - /*----------------------------------------------------------------------- * Stack sizes * @@ -171,6 +151,7 @@ struct bd_info_ext #define CFG_FLASH_ERASE_TOUT (5*CFG_HZ) /* Timeout for Flash Erase */ #define CFG_FLASH_WRITE_TOUT (5*CFG_HZ) /* Timeout for Flash Write */ +#define CFG_ENV_IS_IN_FLASH 1 #define CFG_ENV_ADDR (PHYS_FLASH_1 + 0x1C0000) /* Addr of Environment Sector */ #define CFG_ENV_SIZE 0x20000 /* Total Size of Environment Sector */ diff --git a/include/configs/smdk2410.h b/include/configs/smdk2410.h index 070e54b..16b0aec 100644 --- a/include/configs/smdk2410.h +++ b/include/configs/smdk2410.h @@ -116,26 +116,6 @@ /* valid baudrates */ #define CFG_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200 } -#ifndef __ASSEMBLY__ -/*----------------------------------------------------------------------- - * Board specific extension for bd_info - * - * This structure is embedded in the global bd_info (bd_t) structure - * and can be used by the board specific code (eg board/...) - */ - -struct bd_info_ext -{ - /* helper variable for board environment handling - * - * env_crc_valid == 0 => uninitialised - * env_crc_valid > 0 => environment crc in flash is valid - * env_crc_valid < 0 => environment crc in flash is invalid - */ - int env_crc_valid; -}; -#endif - /*----------------------------------------------------------------------- * Stack sizes * @@ -169,6 +149,7 @@ struct bd_info_ext #define CFG_FLASH_ERASE_TOUT (5*CFG_HZ) /* Timeout for Flash Erase */ #define CFG_FLASH_WRITE_TOUT (5*CFG_HZ) /* Timeout for Flash Write */ +#define CFG_ENV_IS_IN_FLASH 1 #define CFG_ENV_ADDR (CFG_FLASH_BASE + 0x0F0000) /* Addr of Environment Sector */ #define CFG_ENV_SIZE 0x10000 /* Total Size of Environment Sector */