blob: 06f6d05e47832ff0f084205f01269d6cfe34ccf7 [file] [log] [blame]
Kyösti Mälkki5687fc92013-11-28 18:11:49 +02001/*
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älkki5687fc92013-11-28 18:11:49 +020014 */
15
Julius Werner6d9c1312019-03-28 13:33:55 -070016#include <assert.h>
Kyösti Mälkki5687fc92013-11-28 18:11:49 +020017#include <bootmode.h>
Elyes HAOUAS83ea46b2019-07-12 22:50:12 +020018#include <security/vboot/misc.h>
Yu-Ping Wu9fc8cf82019-11-13 15:57:45 +080019#include <vb2_api.h>
Kyösti Mälkki5687fc92013-11-28 18:11:49 +020020
Kyösti Mälkkiab56b3b2013-11-28 16:44:51 +020021static int gfx_init_done = -1;
22
23int gfx_get_init_done(void)
24{
25 if (gfx_init_done < 0)
26 return 0;
27 return gfx_init_done;
28}
29
30void gfx_set_init_done(int done)
31{
32 gfx_init_done = done;
33}
Aaron Durbinbc98cc62015-09-02 09:21:36 -050034
35int display_init_required(void)
36{
Yu-Ping Wu9fc8cf82019-11-13 15:57:45 +080037 /* For vboot, always honor VB2_CONTEXT_DISPLAY_INIT. */
Christian Walter90cf4bb2019-07-29 09:54:23 +000038 if (CONFIG(VBOOT)) {
Joel Kitching6672bd82019-04-10 16:06:21 +080039 /* Must always select MUST_REQUEST_DISPLAY when using this
40 function. */
41 if (!CONFIG(VBOOT_MUST_REQUEST_DISPLAY))
Julius Werner6d9c1312019-03-28 13:33:55 -070042 dead_code();
Yu-Ping Wu9fc8cf82019-11-13 15:57:45 +080043 return vboot_get_context()->flags & VB2_CONTEXT_DISPLAY_INIT;
Julius Werner6d9c1312019-03-28 13:33:55 -070044 }
Aaron Durbinbc98cc62015-09-02 09:21:36 -050045
46 /* By default always initialize display. */
47 return 1;
48}