summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>2017-10-26 12:05:50 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2017-10-27 10:56:46 +0200
commit934fbad33f2ec3f583ebc80f36c0da0903d9dadf (patch)
tree835c1d46304d76c851464521dcb79dfb0fa3a89c
parented5d71ab06bf45e585f9d03049f4730109979aff (diff)
downloadbarebox-934fbad33f2ec3f583ebc80f36c0da0903d9dadf.tar.gz
barebox-934fbad33f2ec3f583ebc80f36c0da0903d9dadf.tar.xz
EFI: add poweroff support
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--arch/x86/configs/efi_defconfig1
-rw-r--r--common/efi/efi.c10
-rw-r--r--drivers/efi/Kconfig1
3 files changed, 12 insertions, 0 deletions
diff --git a/arch/x86/configs/efi_defconfig b/arch/x86/configs/efi_defconfig
index 3e83fd92d9..fdf092e9ba 100644
--- a/arch/x86/configs/efi_defconfig
+++ b/arch/x86/configs/efi_defconfig
@@ -55,6 +55,7 @@ CONFIG_CMD_CRC_CMP=y
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 4b42f5d676..561ce4c081 100644
--- a/common/efi/efi.c
+++ b/common/efi/efi.c
@@ -25,6 +25,7 @@
#include <magicvar.h>
#include <init.h>
#include <restart.h>
+#include <poweroff.h>
#include <driver.h>
#include <platform_data/serial-ns16550.h>
#include <io.h>
@@ -283,9 +284,18 @@ static void __noreturn efi_restart_system(struct restart_handler *rst)
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 cca1a2e1d6..d6beeb07ce 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