TQM8xx[LM]: Fix broken environment alignment.
authorWolfgang Denk <wd@denx.de>
Sun, 16 Sep 2007 15:10:04 +0000 (17:10 +0200)
committerWolfgang Denk <wd@denx.de>
Sun, 16 Sep 2007 15:20:37 +0000 (17:20 +0200)
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>
26 files changed:
board/fads/fads.h
common/environment.c
include/configs/CATcenter.h
include/configs/FADS823.h
include/configs/FADS850SAR.h
include/configs/ICU862.h
include/configs/M5271EVB.h
include/configs/PPChameleonEVB.h
include/configs/R360MPI.h
include/configs/RRvision.h
include/configs/TQM823L.h
include/configs/TQM823M.h
include/configs/TQM850L.h
include/configs/TQM850M.h
include/configs/TQM855L.h
include/configs/TQM855M.h
include/configs/TQM860L.h
include/configs/TQM860M.h
include/configs/TQM862L.h
include/configs/TQM862M.h
include/configs/TQM866M.h
include/configs/cmi_mpc5xx.h
include/configs/hymod.h
include/configs/idmr.h
include/configs/trab.h
include/configs/virtlab2.h

index a7fe2e9..dea8a0d 100644 (file)
 #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
 
index 1d425a7..24257f7 100644 (file)
  * 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")))
index 62a2eaa..0321650 100644 (file)
 #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           */
 
index a562b2f..f810af2 100644 (file)
 #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
index c8ce259..a09c0e0 100644 (file)
 #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
index 27a5bc3..da54cef 100644 (file)
 
 #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
index 0f97050..798ec0c 100644 (file)
  */
 #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
index dd1decd..8a74c4f 100644 (file)
 #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 */
 
 
index 516ec64..a98b4af 100644 (file)
 #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
index 1e6e8c0..32e2285 100644 (file)
 #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
  */
index 384789b..7a38010 100644 (file)
 #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
  */
index 47f416b..e8b6a80 100644 (file)
 #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
  */
index e4b0bd2..beeca63 100644 (file)
 #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
  */
index f26c46e..d5609c1 100644 (file)
 #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
  */
index 330c931..e35b5b2 100644 (file)
 #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
  */
index 77c2f11..cd5212e 100644 (file)
 #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
  */
index a903c2b..d5838db 100644 (file)
 #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
  */
index b905a0a..684b86f 100644 (file)
 #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
  */
index d8ddf37..f09d3d1 100644 (file)
 #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
  */
index 50607f0..039aa3a 100644 (file)
 #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
  */
index ea310c4..0d77891 100644 (file)
 #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
  */
index 85c2b96..a869364 100644 (file)
 #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
 
 /*-----------------------------------------------------------------------
index 2f64ec2..2547afb 100644 (file)
 #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
index 404e88a..3821ebc 100644 (file)
 #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 */
 
index dbccea2..b9088a8 100644 (file)
 #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
 
index 561a8bc..edae6f4 100644 (file)
 #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
  */