diff options
author | Tom Rini <trini@konsulko.com> | 2024-02-28 15:09:30 -0500 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2024-02-28 15:09:30 -0500 |
commit | 463a3162dd661a53e2eb735fe63582874076f73f (patch) | |
tree | b02753dfc487c17bd76228514e5850e5711c1392 /lib/efi_driver/efi_reset_riscv.c | |
parent | eec4c0664771e8d95d4a162c8651154566afd320 (diff) | |
parent | 97da9aea78ab71e92778649bf9d1071f30e260f0 (diff) |
Merge tag 'efi-next-2024-02-28' of https://source.denx.de/u-boot/custodians/u-boot-efi into next
Pull request efi-next-2024-02-28
* set IMAGE_DLLCHARACTERISTICS_NX_COMPAT in EFI binaries
* provide SBI based runtime system reset
* page align EFI binary section on ARMv7
* separate .data and .text sections of EFI binaries on ARMv7
Diffstat (limited to 'lib/efi_driver/efi_reset_riscv.c')
-rw-r--r-- | lib/efi_driver/efi_reset_riscv.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/lib/efi_driver/efi_reset_riscv.c b/lib/efi_driver/efi_reset_riscv.c new file mode 100644 index 00000000000..89b23522e95 --- /dev/null +++ b/lib/efi_driver/efi_reset_riscv.c @@ -0,0 +1,29 @@ +// 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)); +} |