All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/2] common.h: Introduce DEFINE_CACHE_ALIGN_BUFFER
@ 2012-07-08  3:08 Marek Vasut
  2012-07-08  3:08 ` [U-Boot] [PATCH 2/2] ehci-hcd.c, musb_core, usb.h: Add USB_DMA_MINALIGN define for cache alignment Marek Vasut
                   ` (2 more replies)
  0 siblings, 3 replies; 21+ messages in thread
From: Marek Vasut @ 2012-07-08  3:08 UTC (permalink / raw)
  To: u-boot

This is the out-of-function-scope counterpart of
ALLOC_CACHE_ALIGN_BUFFER.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Tom Rini <trini@ti.com>
Cc: Ilya Yanok <ilya.yanok@cogentembedded.com>
---
 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 <environment.h>
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2012-07-23 15:24 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-08  3:08 [U-Boot] [PATCH 1/2] common.h: Introduce DEFINE_CACHE_ALIGN_BUFFER Marek Vasut
2012-07-08  3:08 ` [U-Boot] [PATCH 2/2] ehci-hcd.c, musb_core, usb.h: Add USB_DMA_MINALIGN define for cache alignment Marek Vasut
2012-07-08 10:04   ` Ilya Yanok
2012-07-08 18:51     ` Marek Vasut
2012-07-08 20:52       ` Tom Rini
2012-07-08 21:36         ` Marek Vasut
2012-07-09 18:37   ` Ilya Yanok
2012-07-10  1:55     ` Marek Vasut
2012-07-14 22:11       ` Ilya Yanok
2012-07-14 22:08   ` Ilya Yanok
2012-07-15  8:07     ` Marek Vasut
2012-07-15  8:55       ` Ilya Yanok
2012-07-15  9:42         ` Marek Vasut
2012-07-08 12:23 ` [U-Boot] [PATCH 1/2] common.h: Introduce DEFINE_CACHE_ALIGN_BUFFER Ilya Yanok
2012-07-08 18:55   ` Marek Vasut
2012-07-20  4:01 ` Mike Frysinger
2012-07-20 11:31   ` Marek Vasut
2012-07-20 21:47     ` Mike Frysinger
2012-07-20 21:50       ` Tom Rini
2012-07-21 17:22         ` Mike Frysinger
2012-07-23 15:24           ` Tom Rini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.