From fb05fbc5cc5fce72ef55616dca13848544ea0a5e Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Mon, 7 Dec 2020 13:45:05 +0100 Subject: [PATCH] software: always provide flush_l2_cache implementation (even if empty) to avoid #ifdefs CONFIG_L2_SIZE. --- litex/soc/software/bios/boot.c | 2 -- litex/soc/software/libbase/memtest.c | 16 +++------------- litex/soc/software/libbase/system.c | 4 ++-- litex/soc/software/liblitesata/sata.c | 4 +--- litex/soc/software/liblitesdcard/sdcard.c | 4 +--- 5 files changed, 7 insertions(+), 23 deletions(-) diff --git a/litex/soc/software/bios/boot.c b/litex/soc/software/bios/boot.c index 6480e4773..64e0ffae5 100644 --- a/litex/soc/software/bios/boot.c +++ b/litex/soc/software/bios/boot.c @@ -60,9 +60,7 @@ static void __attribute__((noreturn)) boot(unsigned long r1, unsigned long r2, u #endif flush_cpu_icache(); flush_cpu_dcache(); -#ifdef CONFIG_L2_SIZE flush_l2_cache(); -#endif #if defined(CONFIG_CPU_TYPE_MOR1KX) && defined(CONFIG_CPU_VARIANT_LINUX) /* Mainline Linux expects to have exception vector base address set to the diff --git a/litex/soc/software/libbase/memtest.c b/litex/soc/software/libbase/memtest.c index 09e15bf53..779858a3c 100644 --- a/litex/soc/software/libbase/memtest.c +++ b/litex/soc/software/libbase/memtest.c @@ -7,9 +7,9 @@ #include #include -// #define MEMTEST_BUS_DEBUG -// #define MEMTEST_DATA_DEBUG -// #define MEMTEST_ADDR_DEBUG +//#define MEMTEST_BUS_DEBUG +//#define MEMTEST_DATA_DEBUG +//#define MEMTEST_ADDR_DEBUG #define KIB 1024 #define MIB (KIB*1024) @@ -54,9 +54,7 @@ int memtest_bus(unsigned int *addr, unsigned long size) /* Flush caches */ flush_cpu_dcache(); -#ifdef CONFIG_L2_SIZE flush_l2_cache(); -#endif /* Read/Verify One/Zero pattern */ for(i=0; i #include -#ifdef CONFIG_L2_SIZE void flush_l2_cache(void) { +#ifdef CONFIG_L2_SIZE unsigned int i; for(i=0;i<2*CONFIG_L2_SIZE/4;i++) { ((volatile unsigned int *) MAIN_RAM_BASE)[i]; } -} #endif +} void busy_wait(unsigned int ms) { diff --git a/litex/soc/software/liblitesata/sata.c b/litex/soc/software/liblitesata/sata.c index e70a613bf..3e8250373 100644 --- a/litex/soc/software/liblitesata/sata.c +++ b/litex/soc/software/liblitesata/sata.c @@ -62,12 +62,10 @@ void sata_read(uint32_t sector, uint32_t count, uint8_t* buf) } #ifndef CONFIG_CPU_HAS_DMA_BUS - /* Flush CPU caches */ + /* Flush caches */ flush_cpu_dcache(); -#ifdef CONFIG_L2_SIZE flush_l2_cache(); #endif -#endif } #endif diff --git a/litex/soc/software/liblitesdcard/sdcard.c b/litex/soc/software/liblitesdcard/sdcard.c index 467ee4dc7..78481553e 100644 --- a/litex/soc/software/liblitesdcard/sdcard.c +++ b/litex/soc/software/liblitesdcard/sdcard.c @@ -488,12 +488,10 @@ void sdcard_read(uint32_t block, uint32_t count, uint8_t* buf) sdcard_stop_transmission(); #ifndef CONFIG_CPU_HAS_DMA_BUS - /* Flush CPU caches */ + /* Flush caches */ flush_cpu_dcache(); -#ifdef CONFIG_L2_SIZE flush_l2_cache(); #endif -#endif } #endif