soc/software/libbase: limit number of errors printed when using MEMTEST_*_DEBUG

This commit is contained in:
Jędrzej Boczar 2021-05-17 13:47:59 +02:00
parent b90d0bd1f7
commit d610c9da44
1 changed files with 13 additions and 4 deletions

View File

@ -11,6 +11,11 @@
//#define MEMTEST_DATA_DEBUG //#define MEMTEST_DATA_DEBUG
//#define MEMTEST_ADDR_DEBUG //#define MEMTEST_ADDR_DEBUG
// Limits the number of errors printed, so that we can still access bios console
#ifndef MEMTEST_DEBUG_MAX_ERRORS
#define MEMTEST_DEBUG_MAX_ERRORS 400
#endif
#define KIB 1024 #define KIB 1024
#define MIB (KIB*1024) #define MIB (KIB*1024)
#define GIB (MIB*1024) #define GIB (MIB*1024)
@ -85,7 +90,8 @@ int memtest_bus(unsigned int *addr, unsigned long size)
if(rdata != ONEZERO) { if(rdata != ONEZERO) {
errors++; errors++;
#ifdef MEMTEST_BUS_DEBUG #ifdef MEMTEST_BUS_DEBUG
printf("memtest_bus error @ %p: 0x%08x vs 0x%08x\n", addr + i, rdata, ONEZERO); if (MEMTEST_DEBUG_MAX_ERRORS < 0 || errors <= MEMTEST_DEBUG_MAX_ERRORS)
printf("memtest_bus error @ %p: 0x%08x vs 0x%08x\n", addr + i, rdata, ONEZERO);
#endif #endif
} }
} }
@ -105,7 +111,8 @@ int memtest_bus(unsigned int *addr, unsigned long size)
if(rdata != ZEROONE) { if(rdata != ZEROONE) {
errors++; errors++;
#ifdef MEMTEST_BUS_DEBUG #ifdef MEMTEST_BUS_DEBUG
printf("memtest_bus error @ %p:: 0x%08x vs 0x%08x\n", addr + i, rdata, ZEROONE); if (MEMTEST_DEBUG_MAX_ERRORS < 0 || errors <= MEMTEST_DEBUG_MAX_ERRORS)
printf("memtest_bus error @ %p:: 0x%08x vs 0x%08x\n", addr + i, rdata, ZEROONE);
#endif #endif
} }
} }
@ -141,7 +148,8 @@ int memtest_addr(unsigned int *addr, unsigned long size, int random)
if(rdata != i) { if(rdata != i) {
errors++; errors++;
#ifdef MEMTEST_ADDR_DEBUG #ifdef MEMTEST_ADDR_DEBUG
printf("memtest_addr error @ %p: 0x%08x vs 0x%08x\n", addr + i, rdata, i); if (MEMTEST_DEBUG_MAX_ERRORS < 0 || errors <= MEMTEST_DEBUG_MAX_ERRORS)
printf("memtest_addr error @ %p: 0x%08x vs 0x%08x\n", addr + i, rdata, i);
#endif #endif
} }
} }
@ -213,7 +221,8 @@ int memtest_data(unsigned int *addr, unsigned long size, int random, struct memt
return errors; return errors;
} }
#ifdef MEMTEST_DATA_DEBUG #ifdef MEMTEST_DATA_DEBUG
printf("memtest_data error @ %p: 0x%08x vs 0x%08x\n", addr + i, rdata, seed_32); if (MEMTEST_DEBUG_MAX_ERRORS < 0 || errors <= MEMTEST_DEBUG_MAX_ERRORS)
printf("memtest_data error @ %p: 0x%08x vs 0x%08x\n", addr + i, rdata, seed_32);
#endif #endif
} }
if (i%0x8000 == 0 && progress) if (i%0x8000 == 0 && progress)