提交 34dd853c 编写于 作者: N Neil Armstrong 提交者: Tom Rini

fat: Use cache aligned buffers for fat_opendir

Before this patch one could receive following errors when executing "fatls"
command on machine with cache enabled (ex i.MX6Q) :

=> fatls mmc 0:1
CACHE: Misaligned operation at range [4f59dfc8, 4f59e7c8]
CACHE: Misaligned operation at range [4f59dfc8, 4f59e7c8]
ERROR: v7_outer_cache_inval_range - start address is not aligned - 0x4f59dfc8
ERROR: v7_outer_cache_inval_range - stop address is not aligned - 0x4f59e7c8
CACHE: Misaligned operation at range [4f59dfc8, 4f59e7c8]
CACHE: Misaligned operation at range [4f59dfc8, 4f59e7c8]
ERROR: v7_outer_cache_inval_range - start address is not aligned - 0x4f59dfc8
ERROR: v7_outer_cache_inval_range - stop address is not aligned - 0x4f59e7c8

To alleviate this problem - the calloc()s have been replaced with
malloc_cache_aligned() and memset().

After those changes the buffers are properly aligned (with both start
address and size) to SoC cache line.

Fixes: 09fa964b ("fs/fat: Fix 'CACHE: Misaligned operation at range' warnings")
Suggested-by: NLukasz Majewski <lukma@denx.de>
Signed-off-by: NNeil Armstrong <narmstrong@baylibre.com>
Reviewed-by: NLukasz Majewski <lukma@denx.de>
Reviewed-by: NFabio Estevam <fabio.estevam@nxp.com>
上级 b2e01ff5
......@@ -1149,11 +1149,13 @@ typedef struct {
int fat_opendir(const char *filename, struct fs_dir_stream **dirsp)
{
fat_dir *dir = calloc(1, sizeof(*dir));
fat_dir *dir;
int ret;
dir = malloc_cache_aligned(sizeof(*dir));
if (!dir)
return -ENOMEM;
memset(dir, 0, sizeof(*dir));
ret = fat_itr_root(&dir->itr, &dir->fsdata);
if (ret)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册