From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marek Vasut Date: Sun, 8 Jul 2012 05:08:14 +0200 Subject: [U-Boot] [PATCH 1/2] common.h: Introduce DEFINE_CACHE_ALIGN_BUFFER Message-ID: <1341716895-31089-1-git-send-email-marex@denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de This is the out-of-function-scope counterpart of ALLOC_CACHE_ALIGN_BUFFER. Signed-off-by: Marek Vasut Cc: Tom Rini Cc: Ilya Yanok --- include/common.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/include/common.h b/include/common.h index 17c64b0..06d278f 100644 --- a/include/common.h +++ b/include/common.h @@ -965,6 +965,17 @@ int cpu_release(int nr, int argc, char * const argv[]); \ type *name = (type *) ALIGN((uintptr_t)__##name, ARCH_DMA_MINALIGN) +/* + * DEFINE_CACHE_ALIGN_BUFFER() is similar to ALLOC_CACHE_ALIGN_BUFFER, but it's + * purpose is to allow allocating aligned buffers outside of function scope. + * Usage of this macro shall be avoided or used with extreme care! + */ +#define DEFINE_CACHE_ALIGN_BUFFER(type, name, size) \ + static char __##name[roundup(size * sizeof(type), ARCH_DMA_MINALIGN)] \ + __aligned(ARCH_DMA_MINALIGN); \ + \ + static type *name = (type *)__##name; + /* Pull in stuff for the build system */ #ifdef DO_DEPS_ONLY # include -- 1.7.10.4