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 {
18 }
19 
20 void fill_lb_gpios(struct lb_gpios *gpios)
21 {
22  struct lb_gpio chromeos_gpios[] = {
23  {EC_IN_RW.id, ACTIVE_HIGH, -1, "EC in RW"},
24  {EC_IRQ.id, ACTIVE_LOW, -1, "EC interrupt"},
25  {CR50_IRQ.id, ACTIVE_HIGH, -1, "TPM interrupt"},
26  {GPIO_EN_SPK_AMP.id, ACTIVE_HIGH, -1, CONFIG_SPEAKER_GPIO_NAME},
27  };
28  lb_add_gpios(gpios, chromeos_gpios, ARRAY_SIZE(chromeos_gpios));
29 }
30 
32 {
33  return !gpio_get(GPIO_WP);
34 }
35 
37 {
38  return gpio_eint_poll(CR50_IRQ);
39 }
40 
42 {
43  /* EC is trusted if not in RW. */
44  return !gpio_get(EC_IN_RW);
45 }
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_EN_SPK_AMP
Definition: gpio.h:18
#define GPIO_RESET
Definition: gpio.h:16
#define CR50_IRQ
Definition: gpio.h:11
#define EC_IRQ
Definition: gpio.h:9
@ EC_IN_RW
Definition: gpio.h:46
int gpio_eint_poll(gpio_t gpio)
Definition: gpio.c:126