coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
chromeos.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #include <boot/coreboot_tables.h>
6 #include <soc/cpu.h>
7 #include <soc/gpio.h>
8 #include <types.h>
9 #include <vendorcode/google/chromeos/chromeos.h>
10 #include <bootmode.h>
11 
12 void fill_lb_gpios(struct lb_gpios *gpios)
13 {
14  struct lb_gpio chromeos_gpios[] = {
15  /* Lid: active high (LID_GPIO) */
17 
18  /* Power: virtual GPIO active low (POWER_GPIO) */
20  };
21  lb_add_gpios(gpios, chromeos_gpios, ARRAY_SIZE(chromeos_gpios));
22 }
23 
25 {
26  uint64_t ec_events;
27 
28  /* The GPIO is active low. */
29  if (!gpio_get_value(GPIO_Y10)) // RECMODE_GPIO
30  return 1;
31 
32  ec_events = google_chromeec_get_events_b();
33  return !!(ec_events &
35 }
36 
38 {
39  return !gpio_get_value(GPIO_D16);
40 }
41 
43 {
44  /* EC is trusted if not in RW. */
45  return !gpio_get_value(GPIO_D17);
46 }
void fill_lb_gpios(struct lb_gpios *gpios)
Definition: chromeos.c:9
int get_write_protect_state(void)
Only used if CONFIG(CHROMEOS) is set.
Definition: chromeos.c:15
#define ARRAY_SIZE(a)
Definition: helpers.h:12
uint64_t google_chromeec_get_events_b(void)
Definition: ec.c:272
@ EC_HOST_EVENT_KEYBOARD_RECOVERY
Definition: ec_commands.h:676
#define EC_HOST_EVENT_MASK(event_code)
Definition: ec_commands.h:738
int get_ec_is_trusted(void)
Definition: chromeos.c:25
int get_recovery_mode_switch(void)
HACK: Use Fn-Key as recovery mode switch.
Definition: chromeos.c:29
#define ACTIVE_HIGH
Definition: chromeos.c:18
#define ACTIVE_LOW
Definition: chromeos.c:17
void lb_add_gpios(struct lb_gpios *gpios, const struct lb_gpio *gpio_table, size_t count)
int gpio_get_value(unsigned int gpio)
Get a GPIO's value.
Definition: gpio.c:167
@ GPIO_X35
Definition: gpio.h:296
@ GPIO_D17
Definition: gpio.h:207
@ GPIO_X13
Definition: gpio.h:278
@ GPIO_Y10
Definition: gpio.h:216
@ GPIO_D16
Definition: gpio.h:206
@ EXYNOS5_GPX3
Definition: gpio.h:71
@ EXYNOS5_GPX1
Definition: gpio.h:69
unsigned long long uint64_t
Definition: stdint.h:17