From f85a4f004b7fc845de961410f7616b4b7b08b451 Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Fri, 27 Mar 2015 15:49:16 +0100 Subject: [PATCH] software/bios/sdram: add random addressing to memtest testing memories with linear access is not good enough. Adding random addressing allow us to detect more eventual issues on our L2 cache or SDRAM controller. --- software/bios/sdram.c | 52 +++++++++++++++++++++++++++++++++---------- 1 file changed, 40 insertions(+), 12 deletions(-) diff --git a/software/bios/sdram.c b/software/bios/sdram.c index 84114799..939c42a7 100644 --- a/software/bios/sdram.c +++ b/software/bios/sdram.c @@ -422,13 +422,16 @@ int sdrlevel(void) #endif /* CSR_DDRPHY_BASE */ -#define TEST_SIZE (2*1024*1024) +#define TEST_DATA_SIZE (2*1024*1024) #define TEST_RANDOM_DATA 1 +#define TEST_ADDR_SIZE 32*1024 +#define TEST_RANDOM_ADDR 1 + #define ONEZERO 0xAAAAAAAA #define ZEROONE 0x55555555 -static unsigned int seed_to_data(unsigned int seed, int random) +static unsigned int seed_to_data_32(unsigned int seed, int random) { if (random) return 1664525*seed + 1013904223; @@ -436,11 +439,20 @@ static unsigned int seed_to_data(unsigned int seed, int random) return seed + 1; } +static unsigned short seed_to_data_16(unsigned short seed, int random) +{ + if (random) + return 25173*seed + 13849; + else + return seed + 1; +} + int memtest_silent(void) { volatile unsigned int *array = (unsigned int *)MAIN_RAM_BASE; int i; - unsigned int seed; + unsigned int seed_32; + unsigned short seed_16; unsigned int error_cnt; /* test data bus */ @@ -463,19 +475,35 @@ int memtest_silent(void) } /* test counter or random data */ - seed = 0; - for(i=0;i