[U-Boot] [PATCH] mmc:dcache: Cache line size aligned internal MMC buffers

Mike Frysinger vapier at gentoo.org
Wed Aug 24 18:16:55 CEST 2011


On Tuesday, August 23, 2011 17:48:50 Anton Staaf wrote:
> I wasn't going to say it.  :)  How about something like this, which is
> very similar to what you had Mike, but doesn't define the array in the
> macro.  It's a bit clearer what is going on, but also requires a bit
> more work at each use.
> 
> #define DCACHE_RESIZE(size) ((size) + get_dcache_line_size() - 1)
> #define DCACHE_ALIGN(buffer) ((buffer) + get_dcache_line_size() - 1) &
> ~(get_dcache_line_size() - 1)
> 
> char buffer[DCACHE_RESIZE(100)];

as long as people always use a byte-sized type (i.e. char), this should work.  
obviously using "u32 buffer[...]" will be bad.

> It would be awesome if the idea below worked, but it can't because the
> array is popped when the ({...}) scope is exited I believe.

yes, i believe you are correct.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20110824/a5eba50c/attachment.pgp 


More information about the U-Boot mailing list