]> git.ipfire.org Git - people/ms/u-boot.git/blobdiff - post/drivers/memory.c
Merge 'next' branch
[people/ms/u-boot.git] / post / drivers / memory.c
index a2c088bad8d5f3cf274b4e62085e9b664f96cedd..006236009917e7f912d8ddee0efca2e7c0759573 100644 (file)
  * the whole RAM.
  */
 
-#ifdef CONFIG_POST
-
 #include <post.h>
 #include <watchdog.h>
 
-#if CONFIG_POST & CFG_POST_MEMORY
+#if CONFIG_POST & CONFIG_SYS_POST_MEMORY
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -186,7 +184,7 @@ DECLARE_GLOBAL_DATA_PTR;
  *
  * For other processors, let the compiler generate the best code it can.
  */
-static void move64(unsigned long long *src, unsigned long long *dest)
+static void move64(const unsigned long long *src, unsigned long long *dest)
 {
 #if defined(CONFIG_MPC8260) || defined(CONFIG_MPC824X)
        asm ("lfd  0, 0(3)\n\t" /* fpr0   =  *scr       */
@@ -233,12 +231,12 @@ static int memory_post_dataline(unsigned long long * pmem)
        int ret = 0;
 
        for ( i = 0; i < num_patterns; i++) {
-               move64((unsigned long long *)&(pattern[i]), pmem++);
+               move64(&(pattern[i]), pmem++);
                /*
                 * Put a different pattern on the data lines: otherwise they
                 * may float long enough to read back what we wrote.
                 */
-               move64((unsigned long long *)&otherpattern, pmem--);
+               move64(&otherpattern, pmem--);
                move64(pmem, &temp64);
 
 #ifdef INJECT_DATA_ERRORS
@@ -284,7 +282,7 @@ static int memory_post_addrline(ulong *testaddr, ulong *base, ulong size)
 #endif
                        if(readback == *testaddr) {
                                post_log ("Memory (address line) error at %08x<->%08x, "
-                                       "XOR value %08x !\n",
+                                       "XOR value %08x !\n",
                                        testaddr, target, xor);
                                ret = -1;
                        }
@@ -461,9 +459,12 @@ int memory_post_test (int flags)
        unsigned long memsize = (bd->bi_memsize >= 256 << 20 ?
                                 256 << 20 : bd->bi_memsize) - (1 << 20);
 
+       /* Limit area to be tested with the board info struct */
+       if (CONFIG_SYS_SDRAM_BASE + memsize > (ulong)bd)
+               memsize = (ulong)bd - CONFIG_SYS_SDRAM_BASE;
 
        if (flags & POST_SLOWTEST) {
-               ret = memory_post_tests (CFG_SDRAM_BASE, memsize);
+               ret = memory_post_tests (CONFIG_SYS_SDRAM_BASE, memsize);
        } else {                        /* POST_NORMAL */
 
                unsigned long i;
@@ -479,5 +480,4 @@ int memory_post_test (int flags)
        return ret;
 }
 
-#endif /* CONFIG_POST & CFG_POST_MEMORY */
-#endif /* CONFIG_POST */
+#endif /* CONFIG_POST & CONFIG_SYS_POST_MEMORY */