mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] EFI: add poweroff support
@ 2017-10-26 10:05 Jean-Christophe PLAGNIOL-VILLARD
  2017-10-27  8:55 ` Sascha Hauer
  2017-12-26 12:17 ` Antony Pavlov
  0 siblings, 2 replies; 3+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2017-10-26 10:05 UTC (permalink / raw)
  To: barebox

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 arch/x86/configs/efi_defconfig |  1 +
 common/efi/efi.c               | 10 ++++++++++
 drivers/efi/Kconfig            |  1 +
 3 files changed, 12 insertions(+)

diff --git a/arch/x86/configs/efi_defconfig b/arch/x86/configs/efi_defconfig
index 3e83fd92d..fdf092e9b 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 4b42f5d67..561ce4c08 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 2cd9dd504..5c988d2e1 100644
--- a/drivers/efi/Kconfig
+++ b/drivers/efi/Kconfig
@@ -1,2 +1,3 @@
 config EFI_BOOTUP
 	bool
+	select HAS_POWEROFF
-- 
2.11.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] EFI: add poweroff support
  2017-10-26 10:05 [PATCH] EFI: add poweroff support Jean-Christophe PLAGNIOL-VILLARD
@ 2017-10-27  8:55 ` Sascha Hauer
  2017-12-26 12:17 ` Antony Pavlov
  1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2017-10-27  8:55 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox

On Thu, Oct 26, 2017 at 12:05:50PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> ---
>  arch/x86/configs/efi_defconfig |  1 +
>  common/efi/efi.c               | 10 ++++++++++
>  drivers/efi/Kconfig            |  1 +
>  3 files changed, 12 insertions(+)
> 
> diff --git a/arch/x86/configs/efi_defconfig b/arch/x86/configs/efi_defconfig
> index 3e83fd92d..fdf092e9b 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 4b42f5d67..561ce4c08 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 2cd9dd504..5c988d2e1 100644
> --- a/drivers/efi/Kconfig
> +++ b/drivers/efi/Kconfig
> @@ -1,2 +1,3 @@
>  config EFI_BOOTUP
>  	bool
> +	select HAS_POWEROFF

Dropped this hunk since while applying since HAS_POWEROFF is not used
anywhere in the tree.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] EFI: add poweroff support
  2017-10-26 10:05 [PATCH] EFI: add poweroff support Jean-Christophe PLAGNIOL-VILLARD
  2017-10-27  8:55 ` Sascha Hauer
@ 2017-12-26 12:17 ` Antony Pavlov
  1 sibling, 0 replies; 3+ messages in thread
From: Antony Pavlov @ 2017-12-26 12:17 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox

On Thu, 26 Oct 2017 12:05:50 +0200
Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> wrote:

> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> ---
>  arch/x86/configs/efi_defconfig |  1 +
>  common/efi/efi.c               | 10 ++++++++++
>  drivers/efi/Kconfig            |  1 +
>  3 files changed, 12 insertions(+)
> 
> diff --git a/arch/x86/configs/efi_defconfig b/arch/x86/configs/efi_defconfig
> index 3e83fd92d..fdf092e9b 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 4b42f5d67..561ce4c08 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 2cd9dd504..5c988d2e1 100644
> --- a/drivers/efi/Kconfig
> +++ b/drivers/efi/Kconfig
> @@ -1,2 +1,3 @@
>  config EFI_BOOTUP
>  	bool
> +	select HAS_POWEROFF

Hmmm. It looks like current barebox master and next branches know nothing about HAS_POWEROFF.


-- 
Best regards,
  Antony Pavlov

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-12-26 12:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-26 10:05 [PATCH] EFI: add poweroff support Jean-Christophe PLAGNIOL-VILLARD
2017-10-27  8:55 ` Sascha Hauer
2017-12-26 12:17 ` Antony Pavlov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox