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_POWER GPIO(0, A, 5)
11 #define GPIO_RECOVERY_SERVO GPIO(0, B, 1)
12 #define GPIO_RECOVERY_PUSHKEY GPIO(7, B, 1)
13 
15 {
20 }
21 
22 void fill_lb_gpios(struct lb_gpios *gpios)
23 {
24  struct lb_gpio chromeos_gpios[] = {
25  /* Note for early development, we want to support both servo
26  * and pushkey recovery buttons in firmware boot stages. */
28  !get_recovery_mode_switch(), "presence"},
29  {GPIO_POWER.raw, ACTIVE_LOW, -1, "power"},
30  {GPIO_RESET.raw, ACTIVE_HIGH, -1, "reset"},
31  };
32  lb_add_gpios(gpios, chromeos_gpios, ARRAY_SIZE(chromeos_gpios));
33 }
34 
36 {
37  // Both RECOVERY_SERVO and RECOVERY_PUSHKEY are low active.
38  return !(gpio_get(GPIO_RECOVERY_SERVO) &&
40 }
41 
43 {
44  return !gpio_get(GPIO_WP);
45 }
46 
48 {
49  /* Do not have a Chrome EC involved in entering recovery mode;
50  Always return trusted. */
51  return 1;
52 }
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_POWER
Definition: chromeos.c:10
#define GPIO_RECOVERY_SERVO
Definition: chromeos.c:11
#define GPIO_RECOVERY_PUSHKEY
Definition: chromeos.c:12
#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