blob: feee0cbc324204eeb557e20364ffa1470f25336b [file] [log] [blame]
Duncan Laurieafad0562013-01-14 08:50:03 -08001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2012 Google Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
Duncan Laurieafad0562013-01-14 08:50:03 -080014 */
15
16#include <string.h>
Kyösti Mälkki16455892014-04-28 23:41:06 +030017#include <bootmode.h>
Duncan Laurieafad0562013-01-14 08:50:03 -080018#include <arch/io.h>
Duncan Laurieafad0562013-01-14 08:50:03 -080019#include <device/device.h>
20#include <device/pci.h>
Julius Werner4ee4bd52014-10-20 13:46:39 -070021#include <soc/gpio.h>
Duncan Laurieafad0562013-01-14 08:50:03 -080022
Aaron Durbin93a66652013-03-19 15:25:46 -050023/* Compile-time settings for developer and recovery mode. */
24#define DEV_MODE_SETTING 1
25#define REC_MODE_SETTING 0
26
Duncan Laurieafad0562013-01-14 08:50:03 -080027#ifndef __PRE_RAM__
28#include <boot/coreboot_tables.h>
Duncan Laurieafad0562013-01-14 08:50:03 -080029
Duncan Laurieafad0562013-01-14 08:50:03 -080030void fill_lb_gpios(struct lb_gpios *gpios)
31{
Julius Wernerc445b4f2016-03-31 17:27:05 -070032 struct lb_gpio chromeos_gpios[] = {
33 {-1, ACTIVE_HIGH, 0, "write protect"},
34 {-1, ACTIVE_HIGH, REC_MODE_SETTING, "recovery"},
35 {-1, ACTIVE_HIGH, DEV_MODE_SETTING, "developer"},
36 {-1, ACTIVE_HIGH, 1, "lid"}, // force open
37 {-1, ACTIVE_HIGH, 0, "power"},
38 {-1, ACTIVE_HIGH, gfx_get_init_done(), "oprom"},
39 };
40 lb_add_gpios(gpios, chromeos_gpios, ARRAY_SIZE(chromeos_gpios));
Duncan Laurieafad0562013-01-14 08:50:03 -080041}
42#endif
43
44int get_developer_mode_switch(void)
45{
Aaron Durbin93a66652013-03-19 15:25:46 -050046 return DEV_MODE_SETTING;
Duncan Laurieafad0562013-01-14 08:50:03 -080047}
48
49int get_recovery_mode_switch(void)
50{
Aaron Durbin93a66652013-03-19 15:25:46 -050051 return REC_MODE_SETTING;
Duncan Laurieafad0562013-01-14 08:50:03 -080052}
Aaron Durbin0df4de92013-03-01 17:38:59 -060053
54int get_write_protect_state(void)
55{
56 return 0;
57}