xref: /rk3399_ARM-atf/bl31/bl31_traps.c (revision 1ae75529bc2e5a213c3e458898c219c34aa99f65)
1ccd81f1eSAndre Przywara /*
2ccd81f1eSAndre Przywara  * Copyright (c) 2022, ARM Limited. All rights reserved.
3ccd81f1eSAndre Przywara  *
4ccd81f1eSAndre Przywara  * SPDX-License-Identifier: BSD-3-Clause
5ccd81f1eSAndre Przywara  *
6ccd81f1eSAndre Przywara  * Dispatch synchronous system register traps from lower ELs.
7ccd81f1eSAndre Przywara  */
8ccd81f1eSAndre Przywara 
9ccd81f1eSAndre Przywara #include <bl31/sync_handle.h>
10ccd81f1eSAndre Przywara #include <context.h>
11ccd81f1eSAndre Przywara 
12ccd81f1eSAndre Przywara int handle_sysreg_trap(uint64_t esr_el3, cpu_context_t *ctx)
13ccd81f1eSAndre Przywara {
14ccd81f1eSAndre Przywara 	switch (esr_el3 & ISS_SYSREG_OPCODE_MASK) {
15*1ae75529SAndre Przywara #if ENABLE_FEAT_RNG_TRAP
16*1ae75529SAndre Przywara 	case ISS_SYSREG_OPCODE_RNDR:
17*1ae75529SAndre Przywara 	case ISS_SYSREG_OPCODE_RNDRRS:
18*1ae75529SAndre Przywara 		return plat_handle_rng_trap(esr_el3, ctx);
19*1ae75529SAndre Przywara #endif
20ccd81f1eSAndre Przywara 	default:
21ccd81f1eSAndre Przywara 		return TRAP_RET_UNHANDLED;
22ccd81f1eSAndre Przywara 	}
23ccd81f1eSAndre Przywara }
24