software/bios/libbase: Always do memtest/memspeed when main_ram is present.

- Enable memtest/memspeed on design with HyperRAM.
- Allow comparisons between SDRAM/HyperRAM and integrated RAM.
This commit is contained in:
Florent Kermarrec 2022-02-23 10:19:20 +01:00
parent 4acbafbc19
commit 82daa48e09
3 changed files with 15 additions and 7 deletions

View File

@ -33,6 +33,7 @@
#include <libbase/console.h>
#include <libbase/crc.h>
#include <libbase/memtest.h>
#include <libbase/spiflash.h>
#include <libbase/uart.h>
@ -153,7 +154,7 @@ __attribute__((__used__)) int main(int i, char **c)
sdr_ok = 1;
#if defined(CSR_ETHMAC_BASE) || defined(CSR_SDRAM_BASE) || defined(CSR_SPIFLASH_CORE_BASE)
#if defined(CSR_ETHMAC_BASE) || defined(MAIN_RAM_BASE) || defined(CSR_SPIFLASH_CORE_BASE)
printf("--========== \e[1mInitialization\e[0m ============--\n");
#ifdef CSR_ETHMAC_BASE
eth_init();
@ -161,8 +162,9 @@ __attribute__((__used__)) int main(int i, char **c)
#ifdef CSR_SDRAM_BASE
sdr_ok = sdram_init();
#else
#ifdef MAIN_RAM_TEST
sdr_ok = memtest();
#ifdef MAIN_RAM_BASE
sdr_ok = memtest((unsigned int *) MAIN_RAM_BASE, min(MAIN_RAM_SIZE, MEMTEST_DATA_SIZE));
memspeed((unsigned int *) MAIN_RAM_BASE, min(MAIN_RAM_SIZE, MEMTEST_DATA_SIZE), false, 0);
#endif
#endif
if (sdr_ok != 1)

View File

@ -3,6 +3,16 @@
#include <stdbool.h>
#include <generated/csr.h>
#include <generated/soc.h>
#define max(x, y) (((x) > (y)) ? (x) : (y))
#define min(x, y) (((x) < (y)) ? (x) : (y))
#ifndef MEMTEST_DATA_SIZE
#define MEMTEST_DATA_SIZE (2*1024*1024)
#endif
// Called when an error is encountered. Can return non-zero to stop the memtest.
// `arg` can be used to pass arbitrary data to the callback via `memtest_config.arg`.
typedef int (*on_error_callback)(unsigned int addr, unsigned int rdata, unsigned int refdata, void *arg);

View File

@ -55,10 +55,6 @@ __attribute__((unused)) void cdelay(int i)
/* Constants */
/*-----------------------------------------------------------------------*/
#ifndef MEMTEST_DATA_SIZE
#define MEMTEST_DATA_SIZE (2*1024*1024)
#endif
#define DFII_PIX_DATA_BYTES SDRAM_PHY_DFI_DATABITS/8
int sdram_get_databits(void) {