1/*
2 * Copyright (c) 2014 Travis Geiselbrecht
3 *
4 * Use of this source code is governed by a MIT-style
5 * license that can be found in the LICENSE file or at
6 * https://opensource.org/licenses/MIT
7 */
8
9#include <lk/asm.h>
10
11.section .text
12
13/* used to call into PSCI firmware (Power State Coordination Firmware) */
14FUNCTION(psci_call)
15#if ARCH_ARM
16    hvc     #0
17    bx      lr
18#else
19    /* If booted at EL2 (bit 3 set of boot EL), we need to use SMC instead of HVC. */
20    adrp    x9, arm64_boot_el
21    ldr     x9, [x9, #:lo12:arm64_boot_el]
22    tbnz    x9, #3, .Lsmc
23    hvc     #0
24    ret
25.Lsmc:
26    smc     #0
27    ret
28#endif
29
30.ltorg
31
32