From ae0adb7c160180652f2234cc631ffb5d88bdb428 Mon Sep 17 00:00:00 2001 From: Subrata Banik Date: Fri, 14 Feb 2025 09:37:09 +0000 Subject: [PATCH] lib: Introduce early power off support Kconfig option This commit introduces the `HAVE_EARLY_POWEROFF_SUPPORT` Kconfig option and the `platform_do_early_poweroff()` API. The Kconfig option enables platform-specific early power off support, which is often required on Intel platforms. The corresponding API allows platforms to implement the necessary hardware operations for early power off, typically before memory initialization. BUG=b:339673254 TEST=Able to build and boot google/brox. Change-Id: I05b9882e100825a4fb733163a65f820c8c943361 Signed-off-by: Subrata Banik Reviewed-on: https://review.coreboot.org/c/coreboot/+/86417 Reviewed-by: Karthik Ramasubramanian Reviewed-by: Julius Werner Tested-by: build bot (Jenkins) --- src/include/reset.h | 15 +++++++++++++++ src/lib/Kconfig | 16 ++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/src/include/reset.h b/src/include/reset.h index 95fe0660ad..a5d5aecf4f 100644 --- a/src/include/reset.h +++ b/src/include/reset.h @@ -41,4 +41,19 @@ __noreturn void board_reset(void); */ void do_board_reset(void); +/* + * Performs platform-specific actions for early power off. + * + * This function handles the necessary steps to initiate an early power off + * sequence. This might involve configuring specific hardware registers, + * sending commands to power management controllers, or performing other + * platform-specific operations. It is crucial that this + * function is implemented correctly to ensure a clean and controlled shutdown. + * + * Note: Issuing power off early before memory initialization is not supported use case on + * Intel chipset, therefore, it might need a special platform specific handing + * to power-off the platform early. + */ +void platform_do_early_poweroff(void); + #endif diff --git a/src/lib/Kconfig b/src/lib/Kconfig index 2c1a93cff1..ad706261b8 100644 --- a/src/lib/Kconfig +++ b/src/lib/Kconfig @@ -159,3 +159,19 @@ config PROBE_RAM config HAVE_CUSTOM_BMP_LOGO def_bool n depends on BMP_LOGO + +config HAVE_EARLY_POWEROFF_SUPPORT + bool + help + Enable platform-specific early power off support. + + This option should be selected if the platform requires special handling + to power off the system before memory initialization. This is often + necessary on Intel platforms, as directly powering off before memory + initialization is typically not supported by the chipset. + + Selecting this option indicates that the platform implements the + `platform_do_early_poweroff()` function, which performs the + necessary hardware operations to initiate an early power off sequence. + This might involve configuring hardware registers, sending commands to + power management controllers, or other platform-specific operations.