2 * (C) Copyright 2008 Texas Insturments
5 * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
6 * Marius Groeger <mgroeger@sysgo.de>
9 * Gary Jennejohn, DENX Software Engineering, <garyj@denx.de>
11 * SPDX-License-Identifier: GPL-2.0+
16 #include <asm/system.h>
17 #include <asm/secure.h>
18 #include <linux/compiler.h>
20 int cleanup_before_linux(void)
23 * this function is called just before we call linux
24 * it prepares the processor for linux
26 * disable interrupt and turn off caches etc ...
31 * Turn off I-cache and invalidate it
34 invalidate_icache_all();
38 * dcache_disable() in turn flushes the d-cache and disables MMU
41 invalidate_dcache_all();
46 #ifdef CONFIG_ARMV8_PSCI
47 static void relocate_secure_section(void)
49 #ifdef CONFIG_ARMV8_SECURE_BASE
50 size_t sz = __secure_end - __secure_start;
52 memcpy((void *)CONFIG_ARMV8_SECURE_BASE, __secure_start, sz);
53 flush_dcache_range(CONFIG_ARMV8_SECURE_BASE,
54 CONFIG_ARMV8_SECURE_BASE + sz + 1);
55 invalidate_icache_all();
59 void armv8_setup_psci(void)
61 relocate_secure_section();
62 secure_ram_addr(psci_setup_vectors)();
63 secure_ram_addr(psci_arch_init)();