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 <boardid.h>
4 #include <bootmode.h>
5 #include <boot/coreboot_tables.h>
6 #include <gpio.h>
7 
8 #include "gpio.h"
9 
11 {
15  gpio_input(LID);
17  if (board_id() + CONFIG_BOARD_ID_ADJUSTMENT < 5)
19 }
20 
21 void fill_lb_gpios(struct lb_gpios *gpios)
22 {
23  struct lb_gpio chromeos_gpios[] = {
24  {LID.id, ACTIVE_HIGH, -1, "lid"},
25  {POWER_BUTTON.id, ACTIVE_HIGH, -1, "power"},
26  {EC_IN_RW.id, ACTIVE_HIGH, -1, "EC in RW"},
27  {EC_IRQ.id, ACTIVE_LOW, -1, "EC interrupt"},
28  {CR50_IRQ.id, ACTIVE_HIGH, -1, "TPM interrupt"},
29  };
30  lb_add_gpios(gpios, chromeos_gpios, ARRAY_SIZE(chromeos_gpios));
31 }
32 
34 {
35  return !gpio_get(WRITE_PROTECT);
36 }
37 
39 {
40  /* EC is trusted if not in RW. */
41  return !gpio_get(EC_IN_RW);
42 }
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
uint32_t board_id(void)
board_id() - Get the board version
Definition: ec_boardid.c:6
int get_ec_is_trusted(void)
Definition: chromeos.c:25
void setup_chromeos_gpios(void)
Definition: chromeos.c:10
#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(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 CR50_IRQ
Definition: gpio.h:11
#define EC_IRQ
Definition: gpio.h:9
#define EC_SUSPEND_L
Definition: gpio.h:28
#define LID
Definition: gpio.h:7
@ EC_IN_RW
Definition: gpio.h:46
@ POWER_BUTTON
Definition: gpio.h:43
@ WRITE_PROTECT
Definition: spi-generic.h:108