software/bios/sdram: flush dcache and l2 in memtest (otherwise we are partially testi...
authorFlorent Kermarrec <florent@enjoy-digital.fr>
Tue, 23 Jun 2015 07:01:34 +0000 (09:01 +0200)
committerFlorent Kermarrec <florent@enjoy-digital.fr>
Tue, 23 Jun 2015 07:01:34 +0000 (09:01 +0200)
software/bios/sdram.c

index b8c7262eac7ed8a520d9f242737d4f7731387a88..08f0162c0dbab8217c80468af0808c5ed49793d1 100644 (file)
@@ -7,6 +7,7 @@
 #include <generated/sdram_phy.h>
 #include <generated/mem.h>
 #include <hw/flags.h>
+#include <system.h>
 
 #include "sdram.h"
 
@@ -460,6 +461,8 @@ int memtest_silent(void)
                array[i] = ONEZERO;
        }
        error_cnt = 0;
+       flush_cpu_dcache();
+       flush_l2_cache();
        for(i=0;i<128;i++) {
                if(array[i] != ONEZERO)
                        error_cnt++;
@@ -469,6 +472,8 @@ int memtest_silent(void)
                array[i] = ZEROONE;
        }
        error_cnt = 0;
+       flush_cpu_dcache();
+       flush_l2_cache();
        for(i=0;i<128;i++) {
                if(array[i] != ZEROONE)
                        error_cnt++;
@@ -483,6 +488,8 @@ int memtest_silent(void)
 
        seed_32 = 0;
        error_cnt = 0;
+       flush_cpu_dcache();
+       flush_l2_cache();
        for(i=0;i<TEST_DATA_SIZE/4;i++) {
                seed_32 = seed_to_data_32(seed_32, TEST_DATA_RANDOM);
                if(array[i] != seed_32)
@@ -498,6 +505,8 @@ int memtest_silent(void)
 
        seed_16 = 0;
        error_cnt = 0;
+       flush_cpu_dcache();
+       flush_l2_cache();
        for(i=0;i<TEST_ADDR_SIZE/4;i++) {
                seed_16 = seed_to_data_16(seed_16, TEST_ADDR_RANDOM);
                if(array[(unsigned int) seed_16] != i)