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 #include <security/tpm/tis.h>
7 
8 #include "gpio.h"
9 
11 {
20 }
21 
22 void fill_lb_gpios(struct lb_gpios *gpios)
23 {
24  struct lb_gpio chromeos_gpios[] = {
25  {GPIO_EC_IN_RW.id, ACTIVE_LOW, -1, "EC in RW"},
26  {GPIO_EC_AP_INT.id, ACTIVE_LOW, -1, "EC interrupt"},
27  {GPIO_H1_AP_INT.id, ACTIVE_HIGH, -1, "TPM interrupt"},
28  {GPIO_SD_CD.id, ACTIVE_HIGH, -1, "SD card detect"},
29  {GPIO_EN_SPK_AMP.id, ACTIVE_HIGH, -1, "speaker enable"},
30  };
31  lb_add_gpios(gpios, chromeos_gpios, ARRAY_SIZE(chromeos_gpios));
32 }
33 
35 {
36  return !gpio_get(GPIO_WP);
37 }
38 
40 {
42 }
43 
45 {
46  /* EC is trusted if not in RW. This is active low. */
47  return !!gpio_get(GPIO_EC_IN_RW);
48 }
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
int tis_plat_irq_status(void)
Definition: chromeos.c:39
void setup_chromeos_gpios(void)
Definition: chromeos.c:10
#define ACTIVE_HIGH
Definition: chromeos.c:18
#define ACTIVE_LOW
Definition: chromeos.c:17
#define GPIO_WP
Definition: chromeos.c:11
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_output(gpio_t gpio, int value)
Definition: gpio.c:194
void gpio_input_pullup(gpio_t gpio)
Definition: gpio.c:184
#define GPIO_SD_CD
Definition: gpio.h:14
#define GPIO_EN_SPK_AMP
Definition: gpio.h:18
#define GPIO_H1_AP_INT
Definition: gpio.h:12
#define GPIO_XHCI_DONE
Definition: gpio.h:20
#define GPIO_RESET
Definition: gpio.h:16
#define GPIO_EC_AP_INT
Definition: gpio.h:10
int gpio_eint_poll(gpio_t gpio)
Definition: gpio.c:126