Skip to content
Snippets Groups Projects
Commit ee446e15 authored by Heinrich Schuchardt's avatar Heinrich Schuchardt :speech_balloon:
Browse files

efi_driver: provide SBI based runtime system reset


On RISC-V systems system the Supervisory Binary Interface provides system
reset and poweroff. Use it at EFI runtime.

Signed-off-by: default avatarHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
parent c9f368b5
No related branches found
No related tags found
No related merge requests found
...@@ -9,3 +9,4 @@ obj-y += efi_uclass.o ...@@ -9,3 +9,4 @@ obj-y += efi_uclass.o
ifeq ($(CONFIG_PARTITIONS),y) ifeq ($(CONFIG_PARTITIONS),y)
obj-y += efi_block_device.o obj-y += efi_block_device.o
endif endif
obj-$(CONFIG_SYSRESET_SBI) += efi_reset_riscv.o
// SPDX-License-Identifier: GPL-2.0-or-later
#include <efi_loader.h>
#include <asm/sbi.h>
void __efi_runtime EFIAPI efi_reset_system(enum efi_reset_type reset_type,
efi_status_t reset_status,
unsigned long data_size,
void *reset_data)
{
register unsigned long eid asm("a7") = SBI_EXT_SRST;
register unsigned long fid asm("a6") = SBI_EXT_SRST_RESET;
register unsigned long type asm("a0");
register unsigned long reason asm("a1") = SBI_SRST_RESET_REASON_NONE;
switch (reset_type) {
case EFI_RESET_WARM:
type = SBI_SRST_RESET_TYPE_WARM_REBOOT;
break;
case EFI_RESET_SHUTDOWN:
type = SBI_SRST_RESET_TYPE_SHUTDOWN;
break;
default:
type = SBI_SRST_RESET_TYPE_COLD_REBOOT;
break;
}
asm volatile ("ecall\n"
: : "r" (eid), "r" (fid), "r" (type), "r" (reason));
}
...@@ -366,7 +366,7 @@ config EFI_HAVE_RUNTIME_RESET ...@@ -366,7 +366,7 @@ config EFI_HAVE_RUNTIME_RESET
bool bool
default y default y
depends on ARCH_BCM283X || FSL_LAYERSCAPE || PSCI_RESET || \ depends on ARCH_BCM283X || FSL_LAYERSCAPE || PSCI_RESET || \
SANDBOX || SYSRESET_X86 SANDBOX || SYSRESET_SBI || SYSRESET_X86
config EFI_GRUB_ARM32_WORKAROUND config EFI_GRUB_ARM32_WORKAROUND
bool "Workaround for GRUB on 32bit ARM" bool "Workaround for GRUB on 32bit ARM"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment