Angel Pons | 163030b | 2020-04-05 13:22:07 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Gabe Black | d40be11 | 2013-10-09 23:45:07 -0700 | [diff] [blame] | 2 | |
| 3 | #include <boot/coreboot_tables.h> |
Julius Werner | f0d21ff3 | 2014-10-20 13:24:14 -0700 | [diff] [blame] | 4 | #include <bootmode.h> |
Julius Werner | eaa9c45 | 2014-09-24 15:40:49 -0700 | [diff] [blame] | 5 | #include <gpio.h> |
Gabe Black | d40be11 | 2013-10-09 23:45:07 -0700 | [diff] [blame] | 6 | |
| 7 | void fill_lb_gpios(struct lb_gpios *gpios) |
| 8 | { |
Julius Werner | c445b4f | 2016-03-31 17:27:05 -0700 | [diff] [blame] | 9 | struct lb_gpio chromeos_gpios[] = { |
Julius Werner | c445b4f | 2016-03-31 17:27:05 -0700 | [diff] [blame] | 10 | {GPIO(R4), ACTIVE_HIGH, -1, "lid"}, |
| 11 | {GPIO(Q0), ACTIVE_LOW, -1, "power"}, |
Julius Werner | c445b4f | 2016-03-31 17:27:05 -0700 | [diff] [blame] | 12 | {GPIO(U4), ACTIVE_HIGH, -1, "EC in RW"}, |
| 13 | {GPIO(I5), ACTIVE_LOW, -1, "reset"}, |
| 14 | }; |
| 15 | lb_add_gpios(gpios, chromeos_gpios, ARRAY_SIZE(chromeos_gpios)); |
Gabe Black | d40be11 | 2013-10-09 23:45:07 -0700 | [diff] [blame] | 16 | } |
| 17 | |
Gabe Black | d40be11 | 2013-10-09 23:45:07 -0700 | [diff] [blame] | 18 | int get_write_protect_state(void) |
| 19 | { |
Julius Werner | eaa9c45 | 2014-09-24 15:40:49 -0700 | [diff] [blame] | 20 | return !gpio_get(GPIO(R1)); |
Gabe Black | d40be11 | 2013-10-09 23:45:07 -0700 | [diff] [blame] | 21 | } |
Hsuan-ting Chen | 642508a | 2021-10-27 10:59:41 +0000 | [diff] [blame] | 22 | |
| 23 | int get_ec_is_trusted(void) |
| 24 | { |
| 25 | /* EC is trusted if not in RW. */ |
| 26 | return !gpio_get(GPIO(U4)); |
| 27 | } |