mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-19 11:24:42 +00:00
sandbox: implement invalidate_icache_all()
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>
This commit is contained in:
parent
c589132a1d
commit
3286d223fd
3 changed files with 24 additions and 5 deletions
|
@ -5,7 +5,7 @@
|
||||||
# (C) Copyright 2000-2003
|
# (C) Copyright 2000-2003
|
||||||
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||||
|
|
||||||
obj-y := cpu.o state.o
|
obj-y := cache.o cpu.o state.o
|
||||||
extra-y := start.o os.o
|
extra-y := start.o os.o
|
||||||
extra-$(CONFIG_SANDBOX_SDL) += sdl.o
|
extra-$(CONFIG_SANDBOX_SDL) += sdl.o
|
||||||
obj-$(CONFIG_SPL_BUILD) += spl.o
|
obj-$(CONFIG_SPL_BUILD) += spl.o
|
||||||
|
|
23
arch/sandbox/cpu/cache.c
Normal file
23
arch/sandbox/cpu/cache.c
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
// 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));
|
||||||
|
}
|
|
@ -28,10 +28,6 @@ U_BOOT_DEVICE(gpio_sandbox) = {
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void flush_cache(unsigned long start, unsigned long size)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifndef CONFIG_TIMER
|
#ifndef CONFIG_TIMER
|
||||||
/* system timer offset in ms */
|
/* system timer offset in ms */
|
||||||
static unsigned long sandbox_timer_offset;
|
static unsigned long sandbox_timer_offset;
|
||||||
|
|
Loading…
Add table
Reference in a new issue