blob: f6d7e24871b1afdf46a61fad0ba522082a57d267 [file] [log] [blame]
Jacky Bai4d93d1d2020-07-02 14:39:58 +08001/*
2 * Copyright 2023-2024 NXP
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#include <imx_plat_common.h>
8
9uint32_t plat_get_spsr_for_bl33_entry(void)
10{
11 unsigned long el_status;
12 unsigned long mode;
13 uint32_t spsr;
14
15 /* figure out what mode we enter the non-secure world */
16 el_status = read_id_aa64pfr0_el1() >> ID_AA64PFR0_EL2_SHIFT;
17 el_status &= ID_AA64PFR0_ELX_MASK;
18
19 mode = (el_status) ? MODE_EL2 : MODE_EL1;
20
21 spsr = SPSR_64(mode, MODE_SP_ELX, DISABLE_ALL_EXCEPTIONS);
22 return spsr;
23}