1// © 2021 Qualcomm Innovation Center, Inc. All rights reserved.
2//
3// SPDX-License-Identifier: BSD-3-Clause
4
5#include <hypconstants.h>
6
7#include <asm/asm_defs.inc>
8
9const64 soc_qemu_hyp_arg0
10
11	.section .text.boot
12function __entry_el2, section=nosection
13	// Enable I-cache
14	abs64	x10, 0x30401800
15	msr	SCTLR_EL2, x10
16	adrl	x1, soc_qemu_hyp_arg0
17	str	x0, [x1]
18
19	// Get a 256-bit random seed into x0..x3
20local get_x0:
21	mrs	x0, RNDRRS
22	b.eq	LOCAL(get_x0)
23local get_x1:
24	mrs	x1, RNDR
25	b.eq	LOCAL(get_x1)
26local get_x2:
27	mrs	x2, RNDR
28	b.eq	LOCAL(get_x2)
29local get_x3:
30	mrs	x3, RNDR
31	b.eq	LOCAL(get_x3)
32
33	mrs	x4, MPIDR_EL1
34	ubfx	x4, x4, MPIDR_EL1_AFF0_SHIFT, MPIDR_EL1_AFF0_BITS
35
36	b	aarch64_init
37
38local prng_fail:
39	wfe
40	b	LOCAL(prng_fail)
41function_end __entry_el2
42
43function soc_qemu_entry_cold_secondary
44	mrs	x1, MPIDR_EL1
45	ubfx	x1, x1, MPIDR_EL1_AFF0_SHIFT, MPIDR_EL1_AFF0_BITS
46	b	aarch64_secondary_init
47function_end soc_qemu_entry_cold_secondary
48
49function soc_qemu_entry_warm
50	b	aarch64_warm_init
51function_end soc_qemu_entry_warm
52