summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWolfgang Denk <wd@denx.de>2007-09-16 17:10:04 +0200
committerWolfgang Denk <wd@denx.de>2007-09-16 17:20:37 +0200
commit67c31036acaaaa992fc346cc89db0909a7e733c4 (patch)
tree51c721627703ec40a724e1503061554401743f05
parenteb6da8050797c204c9d010548424186c7ce32fc1 (diff)
TQM8xx[LM]: Fix broken environment alignment.
With recent toolchains, the environment sectors were no longer aligned to sector boundaries. The reason was a combination of two bugs: 1) common/environment.c assumed that CONFIG_TQM8xxL would be defined for all TQM8xxL and TQM8xxM boards. But "include/common.h", where this gets defined, is not included here (and cannot be included without causing lots of problems). Added a new #define CFG_USE_PPCENV for all boards which really want to put the environment is a ".ppcenv" section. 2) The linker scripts just include environment.o, silently assuming that the objects in that file are really in the order in which they are coded in the C file, i. e. "environment" first, then "redundand_environment", and "env_size" last. However, current toolchains (GCC-4.x) reorder the objects, causing the environment data not to start on a flash sector boundary: Instead of: we got: 40008000 T environment 40008000 T env_size 4000c000 T redundand_environment 40008004 T redundand_environment 40010000 T env_size 4000c004 T environment Note: this patch fixes just the first part, and cures the alignment problem by making sure that "env_size" gets placed correctly. However, we still have a potential issue because primary and redundant environment sectors are actually swapped, i. e. we have now: 40008000 T redundand_environment 4000c000 T environment 40010000 T env_size This shall be fixed in the next version. Signed-off-by: Wolfgang Denk <wd@denx.de>
-rw-r--r--board/fads/fads.h1
-rw-r--r--common/environment.c13
-rw-r--r--include/configs/CATcenter.h2
-rw-r--r--include/configs/FADS823.h1
-rw-r--r--include/configs/FADS850SAR.h1
-rw-r--r--include/configs/ICU862.h1
-rw-r--r--include/configs/M5271EVB.h5
-rw-r--r--include/configs/PPChameleonEVB.h2
-rw-r--r--include/configs/R360MPI.h1
-rw-r--r--include/configs/RRvision.h2
-rw-r--r--include/configs/TQM823L.h2
-rw-r--r--include/configs/TQM823M.h2
-rw-r--r--include/configs/TQM850L.h2
-rw-r--r--include/configs/TQM850M.h2
-rw-r--r--include/configs/TQM855L.h2
-rw-r--r--include/configs/TQM855M.h2
-rw-r--r--include/configs/TQM860L.h2
-rw-r--r--include/configs/TQM860M.h2
-rw-r--r--include/configs/TQM862L.h2
-rw-r--r--include/configs/TQM862M.h2
-rw-r--r--include/configs/TQM866M.h2
-rw-r--r--include/configs/cmi_mpc5xx.h5
-rw-r--r--include/configs/hymod.h1
-rw-r--r--include/configs/idmr.h2
-rw-r--r--include/configs/trab.h2
-rw-r--r--include/configs/virtlab2.h2
26 files changed, 46 insertions, 17 deletions
diff --git a/board/fads/fads.h b/board/fads/fads.h
index a7fe2e9019c..dea8a0dc100 100644
--- a/board/fads/fads.h
+++ b/board/fads/fads.h
@@ -229,6 +229,7 @@
#define CFG_ENV_SECT_SIZE 0x40000 /* see README - env sector total size */
#define CFG_ENV_OFFSET CFG_ENV_SECT_SIZE
#define CFG_ENV_SIZE 0x4000 /* Total Size of Environment */
+#define CFG_USE_PPCENV /* Environment embedded in sect .ppcenv */
#define CFG_DIRECT_FLASH_TFTP
diff --git a/common/environment.c b/common/environment.c
index 1d425a73097..24257f7c527 100644
--- a/common/environment.c
+++ b/common/environment.c
@@ -51,18 +51,7 @@
* a seperate section. Note that ENV_CRC is only defined when building
* U-Boot itself.
*/
-#if (defined(CONFIG_CMI) || \
- defined(CONFIG_FADS) || \
- defined(CONFIG_HYMOD) || \
- defined(CONFIG_ICU862) || \
- defined(CONFIG_R360MPI) || \
- defined(CONFIG_TQM8xxL) || \
- defined(CONFIG_RRVISION) || \
- defined(CONFIG_TRAB) || \
- defined(CONFIG_PPCHAMELEONEVB) || \
- defined(CONFIG_M5271EVB) || \
- defined(CONFIG_IDMR) || \
- defined(CONFIG_NAND_U_BOOT)) && \
+#if (defined(CFG_USE_PPCENV) || defined(CONFIG_NAND_U_BOOT)) && \
defined(ENV_CRC) /* Environment embedded in U-Boot .ppcenv section */
/* XXX - This only works with GNU C */
# define __PPCENV__ __attribute__ ((section(".ppcenv")))
diff --git a/include/configs/CATcenter.h b/include/configs/CATcenter.h
index 62a2eaa2365..0321650f3d2 100644
--- a/include/configs/CATcenter.h
+++ b/include/configs/CATcenter.h
@@ -399,6 +399,8 @@
#define CFG_ENV_ADDR_REDUND 0xFFFFA000
#define CFG_ENV_SIZE_REDUND 0x2000
+#define CFG_USE_PPCENV /* Environment embedded in sect .ppcenv */
+
#define CFG_NVRAM_BASE_ADDR 0xF0000500 /* NVRAM base address */
#define CFG_NVRAM_SIZE 242 /* NVRAM size */
diff --git a/include/configs/FADS823.h b/include/configs/FADS823.h
index a562b2fa4e8..f810af2ceca 100644
--- a/include/configs/FADS823.h
+++ b/include/configs/FADS823.h
@@ -206,6 +206,7 @@
#define CFG_ENV_IS_IN_FLASH 1
#define CFG_ENV_OFFSET 0x00040000 /* Offset of Environment Sector */
#define CFG_ENV_SIZE 0x40000 /* Total Size of Environment Sector */
+#define CFG_USE_PPCENV /* Environment embedded in sect .ppcenv */
/*-----------------------------------------------------------------------
* Cache Configuration
diff --git a/include/configs/FADS850SAR.h b/include/configs/FADS850SAR.h
index c8ce25957b0..a09c0e0393f 100644
--- a/include/configs/FADS850SAR.h
+++ b/include/configs/FADS850SAR.h
@@ -156,6 +156,7 @@
#define CFG_ENV_IS_IN_FLASH 1
#define CFG_ENV_OFFSET 0x00040000 /* Offset of Environment Sector */
#define CFG_ENV_SIZE 0x40000 /* Total Size of Environment Sector */
+#define CFG_USE_PPCENV /* Environment embedded in sect .ppcenv */
/*-----------------------------------------------------------------------
* Cache Configuration
diff --git a/include/configs/ICU862.h b/include/configs/ICU862.h
index 27a5bc302fc..da54cef534f 100644
--- a/include/configs/ICU862.h
+++ b/include/configs/ICU862.h
@@ -234,6 +234,7 @@
#define CFG_ENV_SECT_SIZE 0x40000 /* Total Size of Environment sector */
#define CFG_ENV_SIZE 0x4000 /* Used Size of Environment Sector */
+#define CFG_USE_PPCENV /* Environment embedded in sect .ppcenv */
/*-----------------------------------------------------------------------
* Cache Configuration
diff --git a/include/configs/M5271EVB.h b/include/configs/M5271EVB.h
index 0f97050f213..798ec0c7a4c 100644
--- a/include/configs/M5271EVB.h
+++ b/include/configs/M5271EVB.h
@@ -54,13 +54,12 @@
*/
#ifndef CONFIG_MONITOR_IS_IN_RAM
#define CFG_ENV_OFFSET 0x4000
-#define CFG_ENV_SECT_SIZE 0x2000
-#define CFG_ENV_IS_IN_FLASH 1
#else
#define CFG_ENV_ADDR 0xffe04000
+#endif
#define CFG_ENV_SECT_SIZE 0x2000
#define CFG_ENV_IS_IN_FLASH 1
-#endif
+#define CFG_USE_PPCENV /* Environment embedded in sect .ppcenv */
/*
* BOOTP options
diff --git a/include/configs/PPChameleonEVB.h b/include/configs/PPChameleonEVB.h
index dd1decdcd94..8a74c4f5c90 100644
--- a/include/configs/PPChameleonEVB.h
+++ b/include/configs/PPChameleonEVB.h
@@ -429,6 +429,8 @@
#define CFG_ENV_ADDR_REDUND 0xFFFFA000
#define CFG_ENV_SIZE_REDUND 0x2000
+#define CFG_USE_PPCENV /* Environment embedded in sect .ppcenv */
+
#endif /* ENVIRONMENT_IN_EEPROM */
diff --git a/include/configs/R360MPI.h b/include/configs/R360MPI.h
index 516ec643d65..a98b4af29e3 100644
--- a/include/configs/R360MPI.h
+++ b/include/configs/R360MPI.h
@@ -233,6 +233,7 @@
#define CFG_ENV_OFFSET 0x40000 /* Offset of Environment */
#define CFG_ENV_SECT_SIZE 0x20000 /* Total Size of Environment sector */
#define CFG_ENV_SIZE 0x4000 /* Used Size of Environment sector */
+#define CFG_USE_PPCENV /* Environment embedded in sect .ppcenv */
/*-----------------------------------------------------------------------
* Cache Configuration
diff --git a/include/configs/RRvision.h b/include/configs/RRvision.h
index 1e6e8c0aa23..32e22854545 100644
--- a/include/configs/RRvision.h
+++ b/include/configs/RRvision.h
@@ -235,6 +235,8 @@
#define CFG_ENV_OFFSET_REDUND (CFG_ENV_OFFSET+CFG_ENV_SIZE)
#define CFG_ENV_SIZE_REDUND (CFG_ENV_SIZE)
+#define CFG_USE_PPCENV /* Environment embedded in sect .ppcenv */
+
/*-----------------------------------------------------------------------
* Cache Configuration
*/
diff --git a/include/configs/TQM823L.h b/include/configs/TQM823L.h
index 384789b1328..7a3801026fb 100644
--- a/include/configs/TQM823L.h
+++ b/include/configs/TQM823L.h
@@ -206,6 +206,8 @@
#define CFG_ENV_OFFSET_REDUND (CFG_ENV_OFFSET+CFG_ENV_SIZE)
#define CFG_ENV_SIZE_REDUND (CFG_ENV_SIZE)
+#define CFG_USE_PPCENV /* Environment embedded in sect .ppcenv */
+
/*-----------------------------------------------------------------------
* Hardware Information Block
*/
diff --git a/include/configs/TQM823M.h b/include/configs/TQM823M.h
index 47f416b49d4..e8b6a80b19e 100644
--- a/include/configs/TQM823M.h
+++ b/include/configs/TQM823M.h
@@ -203,6 +203,8 @@
#define CFG_ENV_OFFSET_REDUND (CFG_ENV_OFFSET+CFG_ENV_SECT_SIZE)
#define CFG_ENV_SIZE_REDUND (CFG_ENV_SIZE)
+#define CFG_USE_PPCENV /* Environment embedded in sect .ppcenv */
+
/*-----------------------------------------------------------------------
* Hardware Information Block
*/
diff --git a/include/configs/TQM850L.h b/include/configs/TQM850L.h
index e4b0bd27960..beeca6343e8 100644
--- a/include/configs/TQM850L.h
+++ b/include/configs/TQM850L.h
@@ -193,6 +193,8 @@
#define CFG_ENV_OFFSET_REDUND (CFG_ENV_OFFSET+CFG_ENV_SIZE)
#define CFG_ENV_SIZE_REDUND (CFG_ENV_SIZE)
+#define CFG_USE_PPCENV /* Environment embedded in sect .ppcenv */
+
/*-----------------------------------------------------------------------
* Hardware Information Block
*/
diff --git a/include/configs/TQM850M.h b/include/configs/TQM850M.h
index f26c46e99a7..d5609c1d485 100644
--- a/include/configs/TQM850M.h
+++ b/include/configs/TQM850M.h
@@ -192,6 +192,8 @@
#define CFG_ENV_OFFSET_REDUND (CFG_ENV_OFFSET+CFG_ENV_SECT_SIZE)
#define CFG_ENV_SIZE_REDUND (CFG_ENV_SIZE)
+#define CFG_USE_PPCENV /* Environment embedded in sect .ppcenv */
+
/*-----------------------------------------------------------------------
* Hardware Information Block
*/
diff --git a/include/configs/TQM855L.h b/include/configs/TQM855L.h
index 330c931cc13..e35b5b2ac1e 100644
--- a/include/configs/TQM855L.h
+++ b/include/configs/TQM855L.h
@@ -197,6 +197,8 @@
#define CFG_ENV_OFFSET_REDUND (CFG_ENV_OFFSET+CFG_ENV_SIZE)
#define CFG_ENV_SIZE_REDUND (CFG_ENV_SIZE)
+#define CFG_USE_PPCENV /* Environment embedded in sect .ppcenv */
+
/*-----------------------------------------------------------------------
* Hardware Information Block
*/
diff --git a/include/configs/TQM855M.h b/include/configs/TQM855M.h
index 77c2f114a2d..cd5212eff8e 100644
--- a/include/configs/TQM855M.h
+++ b/include/configs/TQM855M.h
@@ -232,6 +232,8 @@
#define CFG_ENV_OFFSET_REDUND (CFG_ENV_OFFSET+CFG_ENV_SECT_SIZE)
#define CFG_ENV_SIZE_REDUND (CFG_ENV_SIZE)
+#define CFG_USE_PPCENV /* Environment embedded in sect .ppcenv */
+
/*-----------------------------------------------------------------------
* Hardware Information Block
*/
diff --git a/include/configs/TQM860L.h b/include/configs/TQM860L.h
index a903c2b3421..d5838dbf372 100644
--- a/include/configs/TQM860L.h
+++ b/include/configs/TQM860L.h
@@ -200,6 +200,8 @@
#define CFG_ENV_OFFSET_REDUND (CFG_ENV_OFFSET+CFG_ENV_SIZE)
#define CFG_ENV_SIZE_REDUND (CFG_ENV_SIZE)
+#define CFG_USE_PPCENV /* Environment embedded in sect .ppcenv */
+
/*-----------------------------------------------------------------------
* Hardware Information Block
*/
diff --git a/include/configs/TQM860M.h b/include/configs/TQM860M.h
index b905a0a635a..684b86f2efe 100644
--- a/include/configs/TQM860M.h
+++ b/include/configs/TQM860M.h
@@ -199,6 +199,8 @@
#define CFG_ENV_OFFSET_REDUND (CFG_ENV_OFFSET+CFG_ENV_SECT_SIZE)
#define CFG_ENV_SIZE_REDUND (CFG_ENV_SIZE)
+#define CFG_USE_PPCENV /* Environment embedded in sect .ppcenv */
+
/*-----------------------------------------------------------------------
* Hardware Information Block
*/
diff --git a/include/configs/TQM862L.h b/include/configs/TQM862L.h
index d8ddf37fa94..f09d3d1654f 100644
--- a/include/configs/TQM862L.h
+++ b/include/configs/TQM862L.h
@@ -201,6 +201,8 @@
#define CFG_ENV_OFFSET_REDUND (CFG_ENV_OFFSET+CFG_ENV_SIZE)
#define CFG_ENV_SIZE_REDUND (CFG_ENV_SIZE)
+#define CFG_USE_PPCENV /* Environment embedded in sect .ppcenv */
+
/*-----------------------------------------------------------------------
* Hardware Information Block
*/
diff --git a/include/configs/TQM862M.h b/include/configs/TQM862M.h
index 50607f0e523..039aa3af428 100644
--- a/include/configs/TQM862M.h
+++ b/include/configs/TQM862M.h
@@ -202,6 +202,8 @@
#define CFG_ENV_OFFSET_REDUND (CFG_ENV_OFFSET+CFG_ENV_SECT_SIZE)
#define CFG_ENV_SIZE_REDUND (CFG_ENV_SIZE)
+#define CFG_USE_PPCENV /* Environment embedded in sect .ppcenv */
+
/*-----------------------------------------------------------------------
* Hardware Information Block
*/
diff --git a/include/configs/TQM866M.h b/include/configs/TQM866M.h
index ea310c42350..0d778919a2b 100644
--- a/include/configs/TQM866M.h
+++ b/include/configs/TQM866M.h
@@ -242,6 +242,8 @@
#define CFG_ENV_OFFSET_REDUND (CFG_ENV_OFFSET+CFG_ENV_SECT_SIZE)
#define CFG_ENV_SIZE_REDUND (CFG_ENV_SIZE)
+#define CFG_USE_PPCENV /* Environment embedded in sect .ppcenv */
+
/*-----------------------------------------------------------------------
* Hardware Information Block
*/
diff --git a/include/configs/cmi_mpc5xx.h b/include/configs/cmi_mpc5xx.h
index 85c2b96fec7..a869364c605 100644
--- a/include/configs/cmi_mpc5xx.h
+++ b/include/configs/cmi_mpc5xx.h
@@ -171,8 +171,9 @@
#define CFG_ENV_IS_IN_FLASH 1
#ifdef CFG_ENV_IS_IN_FLASH
-#define CFG_ENV_OFFSET 0x00020000 /* Environment starts at this adress */
-#define CFG_ENV_SIZE 0x00010000 /* Set whole sector as env */
+#define CFG_ENV_OFFSET 0x00020000 /* Environment starts at this adress */
+#define CFG_ENV_SIZE 0x00010000 /* Set whole sector as env */
+#define CFG_USE_PPCENV /* Environment embedded in sect .ppcenv */
#endif
/*-----------------------------------------------------------------------
diff --git a/include/configs/hymod.h b/include/configs/hymod.h
index 2f64ec238c6..2547afb3cf0 100644
--- a/include/configs/hymod.h
+++ b/include/configs/hymod.h
@@ -406,6 +406,7 @@
#define CFG_ENV_SIZE 0x40000 /* Total Size of Environment Sector */
#define CFG_ENV_SECT_SIZE 0x40000 /* see README - env sect real size */
#define CFG_ENV_ADDR (CFG_FLASH_BASE+CFG_MONITOR_LEN-CFG_ENV_SECT_SIZE)
+#define CFG_USE_PPCENV /* Environment embedded in sect .ppcenv */
/*-----------------------------------------------------------------------
* Cache Configuration
diff --git a/include/configs/idmr.h b/include/configs/idmr.h
index 404e88a4fcd..3821ebcf0d1 100644
--- a/include/configs/idmr.h
+++ b/include/configs/idmr.h
@@ -125,6 +125,8 @@
#define CFG_ENV_IS_IN_FLASH
#endif /* !CONFIG_MONITOR_IS_IN_RAM */
+#define CFG_USE_PPCENV /* Environment embedded in sect .ppcenv */
+
#define CFG_PROMPT "=> "
#define CFG_LONGHELP /* undef to save memory */
diff --git a/include/configs/trab.h b/include/configs/trab.h
index dbccea28ad3..b9088a89abd 100644
--- a/include/configs/trab.h
+++ b/include/configs/trab.h
@@ -419,6 +419,8 @@
#define CFG_ENV_OFFSET_REDUND (CFG_ENV_ADDR+CFG_ENV_SECT_SIZE)
#define CFG_ENV_SIZE_REDUND (CFG_ENV_SIZE)
+#define CFG_USE_PPCENV /* Environment embedded in sect .ppcenv */
+
/* Initial value of the on-board touch screen brightness */
#define CFG_BRIGHTNESS 0x20
diff --git a/include/configs/virtlab2.h b/include/configs/virtlab2.h
index 561a8bc47b5..edae6f4b984 100644
--- a/include/configs/virtlab2.h
+++ b/include/configs/virtlab2.h
@@ -207,6 +207,8 @@
#define CFG_ENV_OFFSET_REDUND (CFG_ENV_OFFSET+CFG_ENV_SIZE)
#define CFG_ENV_SIZE_REDUND (CFG_ENV_SIZE)
+#define CFG_USE_PPCENV /* Environment embedded in sect .ppcenv */
+
/*-----------------------------------------------------------------------
* Hardware Information Block
*/