From patchwork Thu Sep 1 10:30:18 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [U-Boot,v4] dcache: Dcache line size aligned stack buffer allocation Date: Thu, 01 Sep 2011 00:30:18 -0000 From: =?utf-8?q?=C5=81ukasz_Majewski?= X-Patchwork-Id: 112855 Message-Id: <1314873018-20946-1-git-send-email-l.majewski@samsung.com> To: u-boot@lists.denx.de Cc: Anton Staaf , Kyungmin Park , m.szyprowski@samsung.com ALLOC_CACHE_ALIGN_BUFFER shall be used in functions, which are using stack allocated buffers for DMA transfers. Signed-off-by: Lukasz Majewski Signed-off-by: Kyungmin Park CC: Albert ARIBAUD --- Changes for v2: - ./include/cache.h has been removed and replaced with simpler macro added to ./include/common.h Changes for v3: - change char * to char - defined table size definition Changes for v4: - (type*) added for compiler warning fix Signed-off-by: Lukasz Majewski Signed-off-by: Kyungmin Park --- include/common.h | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/include/common.h b/include/common.h index 12a1074..a74c6e8 100644 --- a/include/common.h +++ b/include/common.h @@ -767,6 +767,11 @@ int cpu_release(int nr, int argc, char * const argv[]); #define ALIGN(x,a) __ALIGN_MASK((x),(typeof(x))(a)-1) #define __ALIGN_MASK(x,mask) (((x)+(mask))&~(mask)) +#define ALLOC_CACHE_ALIGN_BUFFER(type, name, size) \ + char __##name[size + CONFIG_SYS_CACHELINE_SIZE - 1]; \ + type *name = (type *) ALIGN(((typeof(CONFIG_SYS_CACHELINE_SIZE))\ + (__##name)), (CONFIG_SYS_CACHELINE_SIZE)); + /* Pull in stuff for the build system */ #ifdef DO_DEPS_ONLY # include