1 /* SPDX-License-Identifier: GPL-2.0-only */
5 * Copyright (C) 2013, 2014 Red Hat, Inc.
6 * Author: Mark Salter <msalter@redhat.com>
8 #include <linux/linkage.h>
9 #include <linux/init.h>
11 #include <asm/assembler.h>
15 SYM_CODE_START(efi_enter_kernel)
17 * efi_pe_entry() will have copied the kernel image if necessary and we
18 * end up here with device tree address in x1 and the kernel entry
19 * point stored in x0. Save those values in registers which are
22 ldr w2, =primary_entry_offset
23 add x19, x0, x2 // relocated Image entrypoint
24 mov x20, x1 // DTB address
27 * Clean the copied Image to the PoC, and ensure it is not shadowed by
28 * stale icache entries from before relocation.
31 bl __clean_dcache_area_poc
35 * Clean the remainder of this routine to the PoC
36 * so that we can safely disable the MMU and caches.
40 bl __clean_dcache_area_poc
42 /* Turn off Dcache and MMU */
44 cmp x0, #CurrentEL_EL2
47 bic x0, x0, #1 << 0 // clear SCTLR.M
48 bic x0, x0, #1 << 2 // clear SCTLR.C
49 pre_disable_mmu_workaround
55 bic x0, x0, #1 << 0 // clear SCTLR.M
56 bic x0, x0, #1 << 2 // clear SCTLR.C
57 pre_disable_mmu_workaround
61 /* Jump to kernel entry point */
67 SYM_CODE_END(efi_enter_kernel)