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. |
Kyösti Mälkki | 5687fc9 | 2013-11-28 18:11:49 +0200 | [diff] [blame] | 14 | */ |
| 15 | |
Julius Werner | 6d9c131 | 2019-03-28 13:33:55 -0700 | [diff] [blame] | 16 | #include <assert.h> |
Kyösti Mälkki | 5687fc9 | 2013-11-28 18:11:49 +0200 | [diff] [blame] | 17 | #include <bootmode.h> |
Elyes HAOUAS | 83ea46b | 2019-07-12 22:50:12 +0200 | [diff] [blame] | 18 | #include <security/vboot/misc.h> |
Yu-Ping Wu | 9fc8cf8 | 2019-11-13 15:57:45 +0800 | [diff] [blame] | 19 | #include <vb2_api.h> |
Kyösti Mälkki | 5687fc9 | 2013-11-28 18:11:49 +0200 | [diff] [blame] | 20 | |
Kyösti Mälkki | ab56b3b | 2013-11-28 16:44:51 +0200 | [diff] [blame] | 21 | static int gfx_init_done = -1; |
| 22 | |
| 23 | int gfx_get_init_done(void) |
| 24 | { |
| 25 | if (gfx_init_done < 0) |
| 26 | return 0; |
| 27 | return gfx_init_done; |
| 28 | } |
| 29 | |
| 30 | void gfx_set_init_done(int done) |
| 31 | { |
| 32 | gfx_init_done = done; |
| 33 | } |
Aaron Durbin | bc98cc6 | 2015-09-02 09:21:36 -0500 | [diff] [blame] | 34 | |
| 35 | int display_init_required(void) |
| 36 | { |
Yu-Ping Wu | 9fc8cf8 | 2019-11-13 15:57:45 +0800 | [diff] [blame] | 37 | /* For vboot, always honor VB2_CONTEXT_DISPLAY_INIT. */ |
Christian Walter | 90cf4bb | 2019-07-29 09:54:23 +0000 | [diff] [blame] | 38 | if (CONFIG(VBOOT)) { |
Joel Kitching | 6672bd8 | 2019-04-10 16:06:21 +0800 | [diff] [blame] | 39 | /* Must always select MUST_REQUEST_DISPLAY when using this |
| 40 | function. */ |
| 41 | if (!CONFIG(VBOOT_MUST_REQUEST_DISPLAY)) |
Julius Werner | 6d9c131 | 2019-03-28 13:33:55 -0700 | [diff] [blame] | 42 | dead_code(); |
Yu-Ping Wu | 9fc8cf8 | 2019-11-13 15:57:45 +0800 | [diff] [blame] | 43 | return vboot_get_context()->flags & VB2_CONTEXT_DISPLAY_INIT; |
Julius Werner | 6d9c131 | 2019-03-28 13:33:55 -0700 | [diff] [blame] | 44 | } |
Aaron Durbin | bc98cc6 | 2015-09-02 09:21:36 -0500 | [diff] [blame] | 45 | |
| 46 | /* By default always initialize display. */ |
| 47 | return 1; |
| 48 | } |