drivers/intel/fsp2_0: Add platform callback for critical shutdown
This commit adds the `platform_is_low_battery_shutdown_needed` callback to the FSP API. This allows platforms to integrate low-battery handling logic directly into the FSP silicon initialization process. By checking for critical conditions (e.g., low battery) within this callback after FSP silicon initialization, the platform can initiate a controlled shutdown before proceeding with further boot stages, preventing abrupt shutdowns later in the boot process. BUG=b:339673254 TEST=Able to build and boot google/brox. Change-Id: I2d6677d70dea3d24f5a19d70608fd21229a271a0 Signed-off-by: Subrata Banik <subratabanik@google.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/86226 Reviewed-by: Julius Werner <jwerner@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Karthik Ramasubramanian <kramasub@google.com>
This commit is contained in:
parent
e5cc73cb94
commit
a518709e25
3 changed files with 24 additions and 1 deletions
|
|
@ -50,6 +50,19 @@ void platform_fsp_silicon_init_params_cb(FSPS_UPD *supd);
|
|||
/* Callbacks for SoC/Mainboard specific overrides */
|
||||
void platform_fsp_memory_multi_phase_init_cb(uint32_t phase_index);
|
||||
void platform_fsp_silicon_multi_phase_init_cb(uint32_t phase_index);
|
||||
/*
|
||||
* Platform specific callbacks for power-off handling.
|
||||
*
|
||||
* These callbacks allow the platform to determine if a power-off is
|
||||
* necessary due to various reasons, such as low battery detection.
|
||||
*
|
||||
* Additionally, API to perform platform specific power-off
|
||||
*/
|
||||
#if CONFIG(PLATFORM_HAS_LOW_BATTERY_INDICATOR)
|
||||
bool platform_is_low_battery_shutdown_needed(void);
|
||||
#else
|
||||
static inline bool platform_is_low_battery_shutdown_needed(void) { return false; }
|
||||
#endif
|
||||
/* Check if MultiPhase Si Init is enabled */
|
||||
bool fsp_is_multi_phase_init_enabled(void);
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -259,6 +259,9 @@ void fsp_silicon_init(void)
|
|||
fsps_load();
|
||||
do_silicon_init(&fsps_hdr);
|
||||
|
||||
if (platform_is_low_battery_shutdown_needed())
|
||||
do_low_battery_poweroff();
|
||||
|
||||
if (CONFIG(CACHE_MRC_SETTINGS) && CONFIG(FSP_NVS_DATA_POST_SILICON_INIT))
|
||||
save_memory_training_data();
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
#include <bootsplash.h>
|
||||
#include <cbfs.h>
|
||||
#include <cbmem.h>
|
||||
#include <fsp/api.h>
|
||||
#include <stdint.h>
|
||||
#include <vendorcode/google/chromeos/chromeos.h>
|
||||
|
||||
|
|
@ -19,6 +20,7 @@ const char *bmp_logo_filename(void)
|
|||
void *bmp_load_logo(size_t *logo_size)
|
||||
{
|
||||
void *logo_buffer;
|
||||
const char *logo_name;
|
||||
|
||||
/* CBMEM is locked for S3 resume path. */
|
||||
if (acpi_is_wakeup_s3())
|
||||
|
|
@ -32,7 +34,12 @@ void *bmp_load_logo(size_t *logo_size)
|
|||
if (!logo_buffer)
|
||||
return NULL;
|
||||
|
||||
*logo_size = cbfs_load(bmp_logo_filename(), logo_buffer, 1 * MiB);
|
||||
if (platform_is_low_battery_shutdown_needed())
|
||||
logo_name = "low_battery.bmp";
|
||||
else
|
||||
logo_name = bmp_logo_filename();
|
||||
|
||||
*logo_size = cbfs_load(logo_name, logo_buffer, 1 * MiB);
|
||||
if (*logo_size == 0)
|
||||
return NULL;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue