]> git.sur5r.net Git - u-boot/commitdiff
ppc: Add CFG_MEM_TOP_HIDE option to hide memory area that doesn't get "touched"
authorStefan Roese <sr@denx.de>
Wed, 26 Mar 2008 09:14:11 +0000 (10:14 +0100)
committerStefan Roese <sr@denx.de>
Thu, 27 Mar 2008 09:12:07 +0000 (10:12 +0100)
If CFG_MEM_TOP_HIDE is defined in the board config header, this specified
memory area will get subtracted from the top (end) of ram and won't get
"touched" at all by U-Boot. By fixing up gd->ram_size the Linux kernel
should gets passed the now "corrected" memory size and won't touch it
either. This should work for arch/ppc and arch/powerpc. Only Linux board
ports in arch/powerpc with bootwrapper support, which recalculate the
memory size from the SDRAM controller setup, will have to get fixed
in Linux additionally.

This patch enables this config option on some PPC440EPx boards as a workaround
for the CHIP 11 errata. Here the description from the AMCC documentation:

CHIP_11: End of memory range area restricted access.
Category: 3

Overview:
The 440EPx DDR controller does not acknowledge any
transaction which is determined to be crossing over the
end-of-memory-range boundary, even if the starting address is
within valid memory space. Any such transaction from any PLB4
master will result in a PLB time-out on PLB4 bus.

Impact:
In case of such misaligned bursts, PLB4 masters will not
retrieve any data at all, just the available data up to the
end of memory, especially the 440 CPU. For example, if a CPU
instruction required an operand located in memory within the
last 7 words of memory, the DCU master would burst read 8
words to update the data cache and cross over the
end-of-memory-range boundary. Such a DCU read would not be
answered by the DDR controller, resulting in a PLB4 time-out
and ultimately in a Machine Check interrupt. The data would
be inaccessible to the CPU.

Workaround:
Forbid any application to access the last 256 bytes of DDR
memory. For example, make your operating system believe that
the last 256 bytes of DDR memory are absent. AMCC has a patch
that does this, available for Linux.

This patch sets CFG_MEM_TOP_HIDE for the following 440EPx boards:
lwmon5, korat, sequoia

The other remaining 440EPx board were intentionally not included
since it is not clear to me, if they use the end of ram for some
other purpose. This is unclear, since these boards have CONFIG_PRAM
defined and even comments like this:

PMC440.h:
/* esd expects pram at end of physical memory.
 * So no logbuffer at the moment.
 */

It is strongly recommended to not use the last 256 bytes on those
boards too. Patches from the board maintainers are welcome.

Signed-off-by: Stefan Roese <sr@denx.de>
README
include/configs/korat.h
include/configs/lwmon5.h
include/configs/sequoia.h
lib_ppc/board.c

diff --git a/README b/README
index 5cbe7c1e80daabeee8c43247db7041b999919025..46e6a33bc122da646e435e3ebd9bc1047468ab28 100644 (file)
--- a/README
+++ b/README
@@ -1929,6 +1929,27 @@ Configuration Settings:
                Scratch address used by the alternate memory test
                You only need to set this if address zero isn't writeable
 
+- CFG_MEM_TOP_HIDE (PPC only):
+               If CFG_MEM_TOP_HIDE is defined in the board config header,
+               this specified memory area will get subtracted from the top
+               (end) of ram and won't get "touched" at all by U-Boot. By
+               fixing up gd->ram_size the Linux kernel should gets passed
+               the now "corrected" memory size and won't touch it either.
+               This should work for arch/ppc and arch/powerpc. Only Linux
+               board ports in arch/powerpc with bootwrapper support, that
+               recalculate the memory size from the SDRAM controller setup
+               will have to get fixed.
+
+               This option can be used as a workaround for the 440EPx/GRx
+               CHIP 11 errata where the last 256 bytes in SDRAM shouldn't
+               be touched.
+
+               WARNING: Please make sure that this value is a multiple of
+               the Linux page size (normally 4k). If this is not the case,
+               then the end address of the Linux memory will be located at a
+               non page size aligned address and this could cause major
+               problems.
+
 - CFG_TFTP_LOADADDR:
                Default load address for network file downloads
 
index dcec9b039d865b3f6e3276e7b613327547c1b2a8..de672ea844fe7c6be6fca76f9b8a9f90dfdb8b0d 100644 (file)
 #define SPD_EEPROM_ADDRESS     {0x50}
 #define CONFIG_PROG_SDRAM_TLB
 #define CFG_DRAM_TEST
+#define CFG_MEM_TOP_HIDE       (4 << 10) /* don't use last 4kbytes     */
+                                       /* 440EPx errata CHIP 11        */
 
 /*
  * I2C
index ced7ba6f05cf3bf05e3fb09d09685811ba562068..3056cb0b4496aab6e57bcfa0a0829e318161e283 100644 (file)
@@ -86,6 +86,8 @@
 #define CFG_INIT_SP_OFFSET     CFG_GBL_DATA_OFFSET
 #define CFG_POST_ALT_WORD_ADDR (CFG_PERIPHERAL_BASE + GPT0_COMP6)
                                                /* unused GPT0 COMP reg */
+#define CFG_MEM_TOP_HIDE       (4 << 10) /* don't use last 4kbytes     */
+                                       /* 440EPx errata CHIP 11        */
 
 /* Additional registers for watchdog timer post test */
 
index dfa8779bccc31c8f7118cb73c1dc55e4c2177ddd..555316ff63811598d64e6f365cd8c7330fd564d9 100644 (file)
 #if !defined(CONFIG_NAND_U_BOOT) && !defined(CONFIG_NAND_SPL)
 #define CONFIG_DDR_DATA_EYE            /* use DDR2 optimization        */
 #endif
+#define CFG_MEM_TOP_HIDE       (4 << 10) /* don't use last 4kbytes     */
+                                       /* 440EPx errata CHIP 11        */
 
 /*
  * I2C
                "ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}"      \
                ":${hostname}:${netdev}:off panic=1\0"                  \
        "addtty=setenv bootargs ${bootargs} console=ttyS0,${baudrate}\0"\
-       "addmisc=setenv bootargs ${bootargs} mem=${mem}\0"              \
+       "addmisc=setenv bootargs ${bootargs}\0"                         \
        "flash_nfs=run nfsargs addip addtty addmisc;"                   \
                "bootm ${kernel_addr}\0"                                \
        "flash_self=run ramargs addip addtty addmisc;"                  \
index 30383027c78d33d310c9468340ec635d7c4aed4a..5e6e1e6a31b581fd2d204d5b2847c5030c8c87ee 100644 (file)
@@ -428,6 +428,7 @@ void board_init_f (ulong bootflag)
         * relocate the code and continue running from DRAM.
         *
         * Reserve memory at end of RAM for (top down in that order):
+        *  - area that won't get touched by U-Boot and Linux (optional)
         *  - kernel log buffer
         *  - protected RAM
         *  - LCD framebuffer
@@ -436,6 +437,18 @@ void board_init_f (ulong bootflag)
         */
        len = (ulong)&_end - CFG_MONITOR_BASE;
 
+       /*
+        * Subtract specified amount of memory to hide so that it won't
+        * get "touched" at all by U-Boot. By fixing up gd->ram_size
+        * the Linux kernel should now get passed the now "corrected"
+        * memory size and won't touch it either. This should work
+        * for arch/ppc and arch/powerpc. Only Linux board ports in
+        * arch/powerpc with bootwrapper support, that recalculate the
+        * memory size from the SDRAM controller setup will have to
+        * get fixed.
+        */
+       gd->ram_size -= CFG_MEM_TOP_HIDE;
+
 #ifndef CONFIG_MAX_MEM_MAPPED
 #define CONFIG_MAX_MEM_MAPPED (256 << 20)
 #endif