[U-Boot] [PATCH] FAT: Properly align buffers to allow cache operations

Eric Nelson eric.nelson at boundarydevices.com
Mon Apr 9 15:35:34 CEST 2012


On 04/09/2012 01:26 AM, Marek Vasut wrote:
> Dear Dirk Behme,
>
>> On 09.04.2012 08:45, Marek Vasut wrote:
>>> Align the FAT FS buffers so DMA on various systems can directly pick
>>> them.
>>
>> Just fyi:
>>
>> http://lists.denx.de/pipermail/u-boot/2012-March/119311.html
>>
>> http://lists.denx.de/pipermail/u-boot/2012-March/119309.html
>
> Heh, nice! :-)
>
> I've been so dug up in debugging the USB cache issues I didn't bother to look
> around the list for previous efforts. So obviously, apply Eric's patch! :-)
>
Hi guys,

It looks like I missed this bit though:

diff --git a/fs/fat/fat.c b/fs/fat/fat.c
index 1f95eb4..d709e59 100644
--- a/fs/fat/fat.c
+++ b/fs/fat/fat.c
@@ -709,7 +711,7 @@ read_bootsectandvi (boot_sector *bs, volume_info *volinfo, 
int *fatsize)
  		return -1;
  	}

-	block = malloc(cur_dev->blksz);
+	block = memalign(ARCH_DMA_MINALIGN, cur_dev->blksz);
  	if (block == NULL) {
  		debug("Error: allocating block\n");
  		return -1;


Perhaps I got lucky in my testing!

Regards,


Eric


More information about the U-Boot mailing list