File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1717#include <security/vboot/vboot_common.h>
1818#include <stdlib.h>
1919#include <timer.h>
20+ #include <bootblock_common.h>
2021
2122#include "ec.h"
2223
@@ -1441,6 +1442,23 @@ int google_chromeec_get_pd_port_caps(int port,
14411442 return 0 ;
14421443}
14431444
1445+ static void google_chromeec_check_lid (void )
1446+ {
1447+ /* Check lid state - this should be called at the end of bootblock */
1448+ if (!acpi_is_wakeup_s3 () && !(google_chromeec_get_switches () & EC_SWITCH_LID_OPEN )) {
1449+ /* On cold boot with lid closed, power off */
1450+ printk (BIOS_INFO , "EC: Lid is closed, powering off\n" );
1451+ poweroff ();
1452+ }
1453+ }
1454+
1455+
1456+ void bootblock_ec_init (void )
1457+ {
1458+ google_chromeec_check_lid ();
1459+
1460+ }
1461+
14441462void google_chromeec_init (void )
14451463{
14461464 google_chromeec_log_uptimeinfo ();
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ void bootblock_mainboard_early_init(void);
1818void bootblock_mainboard_init (void );
1919void bootblock_soc_early_init (void );
2020void bootblock_soc_init (void );
21+ void bootblock_ec_init (void );
2122
2223/*
2324 * C code entry point for the boot block.
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ __weak void bootblock_mainboard_early_init(void) { /* no-op */ }
1717__weak void bootblock_soc_early_init (void ) { /* do nothing */ }
1818__weak void bootblock_soc_init (void ) { /* do nothing */ }
1919__weak void bootblock_mainboard_init (void ) { /* do nothing */ }
20+ __weak void bootblock_ec_init (void ) { /* do nothing */ }
2021
2122/*
2223 * This is a the same as the bootblock main(), with the difference that it does
@@ -58,6 +59,9 @@ void bootblock_main_with_timestamp(uint64_t base_timestamp,
5859 bootblock_soc_init ();
5960 bootblock_mainboard_init ();
6061
62+ /* Call EC initialization hook (weak function, can be overridden by mainboard) */
63+ bootblock_ec_init ();
64+
6165 if (CONFIG (TPM_MEASURED_BOOT_INIT_BOOTBLOCK )) {
6266 bool s3resume = acpi_is_wakeup_s3 ();
6367 tpm_setup (s3resume );
You can’t perform that action at this time.
0 commit comments