1 // SPDX-License-Identifier: GPL-2.0+
3 * (C) Copyright 2014, Cavium Inc.
4 * (C) Copyright 2017, Xilinx Inc.
8 #include <asm-offsets.h>
11 #include <asm/cache.h>
12 #include <asm/macro.h>
14 #include <asm/ptrace.h>
15 #include <asm/system.h>
18 * Issue the hypervisor call
20 * x0~x7: input arguments
21 * x0~x3: output arguments
23 static void hvc_call(struct pt_regs *args)
38 : "+m" (args->regs[0]), "+m" (args->regs[1]),
39 "+m" (args->regs[2]), "+m" (args->regs[3])
40 : "m" (args->regs[4]), "m" (args->regs[5]),
42 : "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7",
43 "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15",
48 * void smc_call(arg0, arg1...arg7)
50 * issue the secure monitor call
52 * x0~x7: input arguments
53 * x0~x3: output arguments
56 void smc_call(struct pt_regs *args)
71 : "+m" (args->regs[0]), "+m" (args->regs[1]),
72 "+m" (args->regs[2]), "+m" (args->regs[3])
73 : "m" (args->regs[4]), "m" (args->regs[5]),
75 : "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7",
76 "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15",
81 * For now, all systems we support run at least in EL2 and thus
82 * trigger PSCI calls to EL3 using SMC. If anyone ever wants to
83 * use PSCI on U-Boot running below a hypervisor, please detect
84 * this and set the flag accordingly.
86 static const bool use_smc_for_psci = true;
88 void __noreturn psci_system_reset(void)
92 regs.regs[0] = ARM_PSCI_0_2_FN_SYSTEM_RESET;
103 void __noreturn psci_system_reset2(u32 reset_level, u32 cookie)
107 regs.regs[0] = ARM_PSCI_0_2_FN64_SYSTEM_RESET2;
108 regs.regs[1] = PSCI_RESET2_TYPE_VENDOR | reset_level;
109 regs.regs[2] = cookie;
110 if (use_smc_for_psci)
119 void __noreturn psci_system_off(void)
123 regs.regs[0] = ARM_PSCI_0_2_FN_SYSTEM_OFF;
125 if (use_smc_for_psci)