imx_bl31_common.c 496 B

1234567891011121314151617181920212223
  1. /*
  2. * Copyright 2023-2024 NXP
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #include <imx_plat_common.h>
  7. uint32_t plat_get_spsr_for_bl33_entry(void)
  8. {
  9. unsigned long el_status;
  10. unsigned long mode;
  11. uint32_t spsr;
  12. /* figure out what mode we enter the non-secure world */
  13. el_status = read_id_aa64pfr0_el1() >> ID_AA64PFR0_EL2_SHIFT;
  14. el_status &= ID_AA64PFR0_ELX_MASK;
  15. mode = (el_status) ? MODE_EL2 : MODE_EL1;
  16. spsr = SPSR_64(mode, MODE_SP_ELX, DISABLE_ALL_EXCEPTIONS);
  17. return spsr;
  18. }