coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
switches.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #include <bootmode.h>
5 #include <elog.h>
6 
7 #if CONFIG(EC_GOOGLE_CHROMEEC_LPC)
8 int get_lid_switch(void)
9 {
10  if (!CONFIG(VBOOT_LID_SWITCH))
11  return -1;
12 
14 }
15 #endif
16 
18 {
19  /* Check for dedicated recovery switch first. */
20  if (CONFIG(EC_GOOGLE_CHROMEEC_LPC) &&
22  return 1;
23 
24  /* Check if the EC has posted the keyboard recovery event. */
25  return !!(google_chromeec_get_events_b() &
27 }
28 
30 {
31  /*
32  * Check if the EC has posted the keyboard recovery event with memory
33  * retrain.
34  */
35  return !!(google_chromeec_get_events_b() &
37 }
38 
40 {
43 
45  return;
46 
49 
51 }
52 
54 {
55  /* Log elog event before clearing */
57 
58  /* Clear all host event bits requesting recovery mode. */
62 }
int get_lid_switch(void)
Definition: chromeos.c:37
#define ELOG_TYPE_EC_EVENT
Definition: elog.h:90
int elog_add_event_byte(u8 event_type, u8 data)
Definition: elog.c:868
@ CONFIG
Definition: dsi_common.h:201
int google_chromeec_clear_events_b(uint64_t mask)
Definition: ec.c:277
uint64_t google_chromeec_get_events_b(void)
Definition: ec.c:272
uint8_t google_chromeec_get_switches(void)
Definition: ec_lpc.c:359
#define EC_SWITCH_LID_OPEN
Definition: ec_commands.h:227
@ EC_HOST_EVENT_KEYBOARD_RECOVERY
Definition: ec_commands.h:676
@ EC_HOST_EVENT_KEYBOARD_RECOVERY_HW_REINIT
Definition: ec_commands.h:723
#define EC_HOST_EVENT_MASK(event_code)
Definition: ec_commands.h:738
#define EC_SWITCH_DEDICATED_RECOVERY
Definition: ec_commands.h:233
unsigned long long uint64_t
Definition: stdint.h:17
unsigned char uint8_t
Definition: stdint.h:8
int clear_recovery_mode_switch(void)
Definition: switches.c:53
int get_recovery_mode_retrain_switch(void)
Definition: switches.c:29
int get_recovery_mode_switch(void)
Definition: switches.c:17
static void elog_add_recovery_mode_switch_event(void)
Definition: switches.c:39