2 * (C) Copyright 2014, Cavium Inc.
4 * SPDX-License-Identifier: GPL-2.0+
7 #include <asm-offsets.h>
9 #include <efi_loader.h>
11 #include <asm/macro.h>
13 #include <asm/system.h>
16 * Issue the hypervisor call
18 * x0~x7: input arguments
19 * x0~x3: output arguments
21 static void __efi_runtime hvc_call(struct pt_regs *args)
37 : "+m" (args->regs[0]), "+m" (args->regs[1]),
38 "+m" (args->regs[2]), "+m" (args->regs[3])
39 : "m" (args->regs[4]), "m" (args->regs[5]),
40 "m" (args->regs[6]), "m" (args->regs[7])
41 : "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7",
42 "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15",
47 * void smc_call(arg0, arg1...arg7)
49 * issue the secure monitor call
51 * x0~x7: input arguments
52 * x0~x3: output arguments
55 void __efi_runtime smc_call(struct pt_regs *args)
70 : "+m" (args->regs[0]), "+m" (args->regs[1]),
71 "+m" (args->regs[2]), "+m" (args->regs[3])
72 : "m" (args->regs[4]), "m" (args->regs[5]),
74 : "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7",
75 "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15",
80 * For now, all systems we support run at least in EL2 and thus
81 * trigger PSCI calls to EL3 using SMC. If anyone ever wants to
82 * use PSCI on U-Boot running below a hypervisor, please detect
83 * this and set the flag accordingly.
85 static const __efi_runtime_data bool use_smc_for_psci = true;
87 void __noreturn __efi_runtime psci_system_reset(void)
91 regs.regs[0] = ARM_PSCI_0_2_FN_SYSTEM_RESET;
102 void __noreturn __efi_runtime psci_system_off(void)
106 regs.regs[0] = ARM_PSCI_0_2_FN_SYSTEM_OFF;
108 if (use_smc_for_psci)
117 #ifdef CONFIG_PSCI_RESET
118 void reset_misc(void)
123 #ifdef CONFIG_EFI_LOADER
124 void __efi_runtime EFIAPI efi_reset_system(
125 enum efi_reset_type reset_type,
126 efi_status_t reset_status,
127 unsigned long data_size, void *reset_data)
129 switch (reset_type) {
134 case EFI_RESET_SHUTDOWN:
141 #endif /* CONFIG_EFI_LOADER */
142 #endif /* CONFIG_PSCI_RESET */