From 08dd4564b1f5c3258caf6bfc4bdc77ead1b042d6 Mon Sep 17 00:00:00 2001 From: Iru Cai Date: Wed, 30 Oct 2019 15:38:10 +0800 Subject: fix ARCH_DMA_MINALIGN mess --- arch/arm/include/asm/cache.h | 4 ++++ ext4_common.h | 3 +-- include/memalign.h | 24 ------------------------ 3 files changed, 5 insertions(+), 26 deletions(-) diff --git a/arch/arm/include/asm/cache.h b/arch/arm/include/asm/cache.h index 950ec1e..57e2149 100644 --- a/arch/arm/include/asm/cache.h +++ b/arch/arm/include/asm/cache.h @@ -47,6 +47,10 @@ void dram_bank_mmu_setup(int bank); * value than found in the L1 cache but this is OK to use in terms of * alignment. */ +#ifdef CONFIG_SYS_CACHELINE_SIZE #define ARCH_DMA_MINALIGN CONFIG_SYS_CACHELINE_SIZE +#else +#define ARCH_DMA_MINALIGN 64 /* should be enough */ +#endif #endif /* _ASM_CACHE_H */ diff --git a/ext4_common.h b/ext4_common.h index 238ff63..a3ac298 100644 --- a/ext4_common.h +++ b/ext4_common.h @@ -24,6 +24,7 @@ #include #include #include +#include #if defined(CONFIG_EXT4_WRITE) #include "ext4_journal.h" #include "crc16.h" @@ -40,8 +41,6 @@ #define SUPERBLOCK_SIZE 1024 #define F_FILE 1 -#define ARCH_DMA_MINALIGN 64 /* should be ok for all architectures */ - #ifdef DEBUG_PRINTF #define dbg_printf printf #else diff --git a/include/memalign.h b/include/memalign.h index 24d9da7..2f8a02b 100644 --- a/include/memalign.h +++ b/include/memalign.h @@ -93,30 +93,6 @@ #define DEFINE_CACHE_ALIGN_BUFFER(type, name, size) \ DEFINE_ALIGN_BUFFER(type, name, size, ARCH_DMA_MINALIGN) -/** - * malloc_cache_aligned() - allocate a memory region aligned to cache line size - * - * This allocates memory at a cache-line boundary. The amount allocated may - * be larger than requested as it is rounded up to the nearest multiple of the - * cache-line size. This ensured that subsequent cache operations on this - * memory (flush, invalidate) will not affect subsequently allocated regions. - * - * @size: Minimum number of bytes to allocate - * - * @return pointer to new memory region, or NULL if there is no more memory - * available. - */ - -/* set ARCH_DMA_MINALIGN to 64, good for all architectures */ -#ifdef ARCH_DMA_MINALIGN -#undef ARCH_DMA_MINALIGN -#endif -#define ARCH_DMA_MINALIGN 64 - -static inline void *malloc_cache_aligned(size_t size) -{ - return memalign(ARCH_DMA_MINALIGN, ALIGN(size, ARCH_DMA_MINALIGN)); -} #endif #endif /* __ALIGNMEM_H */ -- cgit v1.2.3