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.
36 * Clean the remainder of this routine to the PoC
37 * so that we can safely disable the MMU and caches.
43 /* Turn off Dcache and MMU */
45 cmp x0, #CurrentEL_EL2
48 bic x0, x0, #1 << 0 // clear SCTLR.M
49 bic x0, x0, #1 << 2 // clear SCTLR.C
50 pre_disable_mmu_workaround
56 bic x0, x0, #1 << 0 // clear SCTLR.M
57 bic x0, x0, #1 << 2 // clear SCTLR.C
58 pre_disable_mmu_workaround
62 /* Jump to kernel entry point */
69 SYM_CODE_END(efi_enter_kernel)