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 <bootmode.h>
4 #include <boot/coreboot_tables.h>
5 #include <gpio.h>
6 
7 #include "board.h"
8 
9 #define GPIO_WP GPIO(7, A, 6)
10 #define GPIO_RECOVERY GPIO(0, B, 1)
11 
13 {
16 }
17 
18 void fill_lb_gpios(struct lb_gpios *gpios)
19 {
20  struct lb_gpio chromeos_gpios[] = {
22  !get_recovery_mode_switch(), "presence"},
23  {GPIO_RESET.raw, ACTIVE_HIGH, -1, "reset"},
24  };
25  lb_add_gpios(gpios, chromeos_gpios, ARRAY_SIZE(chromeos_gpios));
26 }
27 
29 {
30  return !gpio_get(GPIO_RECOVERY);
31 }
32 
34 {
35  return !gpio_get(GPIO_WP);
36 }
37 
39 {
40  /* Do not have a Chrome EC involved in entering recovery mode;
41  Always return trusted. */
42  return 1;
43 }
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
int get_ec_is_trusted(void)
Definition: chromeos.c:25
void setup_chromeos_gpios(void)
Definition: chromeos.c:10
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
#define GPIO_RECOVERY
Definition: chromeos.c:10
#define GPIO_WP
Definition: chromeos.c:9
void lb_add_gpios(struct lb_gpios *gpios, const struct lb_gpio *gpio_table, size_t count)
int gpio_get(gpio_t gpio)
Definition: gpio.c:166
void gpio_input(gpio_t gpio)
Definition: gpio.c:189
void gpio_input_pullup(gpio_t gpio)
Definition: gpio.c:184
#define GPIO_RESET
Definition: gpio.h:16