Kyösti Mälkki | 5687fc9 | 2013-11-28 18:11:49 +0200 | [diff] [blame] | 1 | /* |
| 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 | |
Kyösti Mälkki | ab56b3b | 2013-11-28 16:44:51 +0200 | [diff] [blame] | 20 | #include <rules.h> |
Kyösti Mälkki | 5687fc9 | 2013-11-28 18:11:49 +0200 | [diff] [blame] | 21 | #include <bootmode.h> |
| 22 | #if CONFIG_CHROMEOS || CONFIG_VBOOT_VERIFY_FIRMWARE |
| 23 | #include <vendorcode/google/chromeos/chromeos.h> |
| 24 | #endif |
| 25 | |
| 26 | #if CONFIG_BOOTMODE_STRAPS |
| 27 | int developer_mode_enabled(void) |
| 28 | { |
| 29 | if (get_developer_mode_switch()) |
| 30 | return 1; |
| 31 | #if CONFIG_VBOOT_VERIFY_FIRMWARE |
| 32 | if (vboot_enable_developer()) |
| 33 | return 1; |
| 34 | #endif |
| 35 | return 0; |
| 36 | } |
| 37 | |
| 38 | /* |
| 39 | * This is called in multiple places and has to detect |
| 40 | * recovery mode triggered from the EC and via shared |
| 41 | * recovery reason set with crossystem. |
| 42 | * |
| 43 | * If shared recovery reason is set: |
| 44 | * - before VbInit then get_recovery_mode_from_vbnv() is true |
| 45 | * - after VbInit then vboot_enable_recovery() is true |
| 46 | * |
| 47 | * Otherwise the mainboard handler for get_recovery_mode_switch() |
| 48 | * will detect recovery mode initiated by the EC. |
| 49 | */ |
| 50 | int recovery_mode_enabled(void) |
| 51 | { |
| 52 | if (get_recovery_mode_switch()) |
| 53 | return 1; |
| 54 | #if CONFIG_CHROMEOS |
| 55 | if (get_recovery_mode_from_vbnv()) |
| 56 | return 1; |
| 57 | #endif |
| 58 | #if CONFIG_VBOOT_VERIFY_FIRMWARE |
| 59 | if (vboot_enable_recovery()) |
| 60 | return 1; |
| 61 | #endif |
| 62 | return 0; |
| 63 | } |
| 64 | #endif /* CONFIG_BOOTMODE_STRAPS */ |
Kyösti Mälkki | ab56b3b | 2013-11-28 16:44:51 +0200 | [diff] [blame] | 65 | |
| 66 | #if ENV_RAMSTAGE |
| 67 | static int gfx_init_done = -1; |
| 68 | |
| 69 | int gfx_get_init_done(void) |
| 70 | { |
| 71 | if (gfx_init_done < 0) |
| 72 | return 0; |
| 73 | return gfx_init_done; |
| 74 | } |
| 75 | |
| 76 | void gfx_set_init_done(int done) |
| 77 | { |
| 78 | gfx_init_done = done; |
| 79 | } |
| 80 | #endif |