diff --git a/arch/x86/configs/efi_defconfig b/arch/x86/configs/efi_defconfig index 3e83fd9..fdf092e 100644 --- a/arch/x86/configs/efi_defconfig +++ b/arch/x86/configs/efi_defconfig @@ -55,6 +55,7 @@ CONFIG_CMD_MM=y CONFIG_CMD_DETECT=y CONFIG_CMD_FLASH=y +CONFIG_CMD_POWEROFF=y CONFIG_CMD_2048=y CONFIG_CMD_BAREBOX_UPDATE=y CONFIG_CMD_OF_NODE=y diff --git a/common/efi/efi.c b/common/efi/efi.c index 4b42f5d..561ce4c 100644 --- a/common/efi/efi.c +++ b/common/efi/efi.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -283,9 +284,18 @@ hang(); } +static void __noreturn efi_poweroff_system(struct poweroff_handler *handler) +{ + shutdown_barebox(); + RT->reset_system(EFI_RESET_SHUTDOWN, EFI_SUCCESS, 0, NULL); + + hang(); +} + static int restart_register_feature(void) { restart_handler_register_fn(efi_restart_system); + poweroff_handler_register_fn(efi_poweroff_system); return 0; } diff --git a/drivers/efi/Kconfig b/drivers/efi/Kconfig index cca1a2e..d6beeb0 100644 --- a/drivers/efi/Kconfig +++ b/drivers/efi/Kconfig @@ -1,4 +1,5 @@ config EFI_BOOTUP bool + select HAS_POWEROFF select BLOCK select PARTITION_DISK