blob: 08d96921cf6189215c05db919a103eaa12c2bec8 [file] [log] [blame]
Daisuke Nojiriefddcfb2014-09-04 09:55:34 -07001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2011 The ChromiumOS Authors. All rights reserved.
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.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19
20#include <stddef.h>
21#include <string.h>
22#include "chromeos.h"
Daisuke Nojiriefddcfb2014-09-04 09:55:34 -070023#include <boot/coreboot_tables.h>
24#include <cbfs.h>
25#include <cbmem.h>
26#include <console/console.h>
Daisuke Nojiri24d4dae2015-02-03 14:44:55 -080027#include "vboot_handoff.h"
Daisuke Nojiriefddcfb2014-09-04 09:55:34 -070028
Daisuke Nojiriefddcfb2014-09-04 09:55:34 -070029static int vboot_enable_developer(void)
30{
31 struct vboot_handoff *vbho;
32
33 vbho = cbmem_find(CBMEM_ID_VBOOT_HANDOFF);
34
35 if (vbho == NULL) {
36 printk(BIOS_ERR, "%s: Couldn't find vboot_handoff structure!\n",
37 __func__);
38 return 0;
39 }
40
41 return !!(vbho->init_params.out_flags & VB_INIT_OUT_ENABLE_DEVELOPER);
42}
43
44static int vboot_enable_recovery(void)
45{
46 struct vboot_handoff *vbho;
47
48 vbho = cbmem_find(CBMEM_ID_VBOOT_HANDOFF);
49
50 if (vbho == NULL)
51 return 0;
52
53 return !!(vbho->init_params.out_flags & VB_INIT_OUT_ENABLE_RECOVERY);
54}
Daisuke Nojiri742fc8d2014-10-10 10:51:06 -070055
56int vboot_skip_display_init(void)
57{
58 struct vboot_handoff *vbho;
59
60 vbho = cbmem_find(CBMEM_ID_VBOOT_HANDOFF);
61
62 if (vbho == NULL)
63 return 0;
64
65 return !(vbho->init_params.out_flags & VB_INIT_OUT_ENABLE_DISPLAY);
66}
Daisuke Nojiriefddcfb2014-09-04 09:55:34 -070067
Daisuke Nojiriefddcfb2014-09-04 09:55:34 -070068int __attribute__((weak)) clear_recovery_mode_switch(void)
69{
70 // Can be implemented by a mainboard
71 return 0;
72}
73
Julius Werner015f0ae2014-09-15 22:10:33 -070074#ifdef __ROMSTAGE__
Daisuke Nojiriefddcfb2014-09-04 09:55:34 -070075void __attribute__((weak)) save_chromeos_gpios(void)
76{
77 // Can be implemented by a mainboard
78}
79
80int __attribute((weak)) vboot_get_sw_write_protect(void)
81{
82 // Can be implemented by a platform / mainboard
83 return 0;
84}
85#endif