From a3dc53f2a629fa4168f4e24cef758efde1e5b686 Mon Sep 17 00:00:00 2001 From: Ramesh Thomas Date: Wed, 9 Nov 2016 23:16:27 -0800 Subject: [PATCH] power_mgmt: Do not notify deep sleep if bootloader does context restore Some bootloaders have power management support to restoer context upon resume from deep sleep. In such cases, the OS startup code should call the notification hook. Create Kconfig flags to configure this option. Jira: 1257 Change-Id: I9f40c5fa077c2f17dc8e9f11604c3ed17e549ed5 Signed-off-by: Ramesh Thomas --- arch/Kconfig | 9 +++++++++ arch/x86/core/crt0.S | 3 ++- arch/x86/soc/intel_quark/quark_se/Kconfig.series | 1 + misc/Kconfig | 10 ++++++++++ 4 files changed, 22 insertions(+), 1 deletion(-) diff --git a/arch/Kconfig b/arch/Kconfig index 27dfe9344c4..c574947b2ca 100644 --- a/arch/Kconfig +++ b/arch/Kconfig @@ -58,6 +58,15 @@ config SYS_POWER_DEEP_SLEEP_SUPPORTED help This option signifies that the target supports the SYS_POWER_DEEP_SLEEP configuration option. + +config BOOTLOADER_CONTEXT_RESTORE_SUPPORTED + # Hidden + bool + default n + help + This option signifies that the target has options of bootloaders + that support context restore upon resume from deep sleep + # # End hidden PM feature configs # diff --git a/arch/x86/core/crt0.S b/arch/x86/core/crt0.S index d651225abf2..28d04c77429 100644 --- a/arch/x86/core/crt0.S +++ b/arch/x86/core/crt0.S @@ -200,7 +200,8 @@ __csSet: movl $_interrupt_stack, %esp addl $CONFIG_ISR_STACK_SIZE, %esp -#ifdef CONFIG_SYS_POWER_DEEP_SLEEP +#if defined(CONFIG_SYS_POWER_DEEP_SLEEP) && \ + !defined(CONFIG_BOOTLOADER_CONTEXT_RESTORE) /* * Invoke _sys_soc_resume_from_deep_sleep() hook to handle resume from * deep sleep. It should first check whether system is recovering from diff --git a/arch/x86/soc/intel_quark/quark_se/Kconfig.series b/arch/x86/soc/intel_quark/quark_se/Kconfig.series index feaa6670d39..ee574f4daef 100644 --- a/arch/x86/soc/intel_quark/quark_se/Kconfig.series +++ b/arch/x86/soc/intel_quark/quark_se/Kconfig.series @@ -23,6 +23,7 @@ config SOC_SERIES_QUARK_SE select XIP select SYS_POWER_LOW_POWER_STATE_SUPPORTED select SYS_POWER_DEEP_SLEEP_SUPPORTED + select BOOTLOADER_CONTEXT_RESTORE_SUPPORTED select HAS_QMSI help Enable support for Quark SE diff --git a/misc/Kconfig b/misc/Kconfig index 320fb7e6b2a..9342303284e 100644 --- a/misc/Kconfig +++ b/misc/Kconfig @@ -397,6 +397,16 @@ config BOOTLOADER_UNKNOWN at build time which method is to be used. When this option is enabled the board may have to do extra work to ensure a proper startup. +config BOOTLOADER_CONTEXT_RESTORE + bool + prompt "Boot loader has context restore support" + default y + depends on SYS_POWER_DEEP_SLEEP && BOOTLOADER_CONTEXT_RESTORE_SUPPORTED + help + This option signifies that the target has a bootloader + that restores CPU context upon resuming from deep sleep + power state. + config REBOOT bool "Reboot functionality" default n