mirror of
https://github.com/brain-hackers/u-boot-brain
synced 2024-08-30 22:08:52 +09:00
![Heinrich Schuchardt](/assets/img/avatar_default.png)
Before executing code that we have loaded from a file we need to flush the data cache and invalidate the instruction flash. Implement functions flush_cache() and invalidate_icache_all(). Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
24 lines
588 B
C
24 lines
588 B
C
// SPDX-License-Identifier: GPL-2.0+
|
|
/*
|
|
* Copyright 2020, Heinrich Schuchardt <xypron.glpk@gmx.de>
|
|
*/
|
|
|
|
#include <common.h>
|
|
#include <cpu_func.h>
|
|
#include <asm/state.h>
|
|
|
|
void flush_cache(unsigned long addr, unsigned long size)
|
|
{
|
|
/* Clang uses (char *) parameters, GCC (void *) */
|
|
__builtin___clear_cache((void *)addr, (void *)(addr + size));
|
|
}
|
|
|
|
void invalidate_icache_all(void)
|
|
{
|
|
struct sandbox_state *state = state_get_current();
|
|
|
|
/* Clang uses (char *) parameters, GCC (void *) */
|
|
__builtin___clear_cache((void *)state->ram_buf,
|
|
(void *)(state->ram_buf + state->ram_size));
|
|
}
|