blob: 56b39271e84f412cbec513293de577e5aed59bfe [file] [log] [blame]
Angel Pons118a9c72020-04-02 23:48:34 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Kyösti Mälkki5687fc92013-11-28 18:11:49 +02002
Julius Werner6d9c1312019-03-28 13:33:55 -07003#include <assert.h>
Kyösti Mälkki5687fc92013-11-28 18:11:49 +02004#include <bootmode.h>
Elyes HAOUAS83ea46b2019-07-12 22:50:12 +02005#include <security/vboot/misc.h>
Yu-Ping Wu9fc8cf82019-11-13 15:57:45 +08006#include <vb2_api.h>
Kyösti Mälkki5687fc92013-11-28 18:11:49 +02007
Kyösti Mälkkiab56b3b2013-11-28 16:44:51 +02008static int gfx_init_done = -1;
9
10int gfx_get_init_done(void)
11{
12 if (gfx_init_done < 0)
13 return 0;
14 return gfx_init_done;
15}
16
17void gfx_set_init_done(int done)
18{
19 gfx_init_done = done;
20}
Aaron Durbinbc98cc62015-09-02 09:21:36 -050021
22int display_init_required(void)
23{
Yu-Ping Wu9fc8cf82019-11-13 15:57:45 +080024 /* For vboot, always honor VB2_CONTEXT_DISPLAY_INIT. */
Christian Walter90cf4bb2019-07-29 09:54:23 +000025 if (CONFIG(VBOOT)) {
Joel Kitching6672bd82019-04-10 16:06:21 +080026 /* Must always select MUST_REQUEST_DISPLAY when using this
27 function. */
28 if (!CONFIG(VBOOT_MUST_REQUEST_DISPLAY))
Julius Werner6d9c1312019-03-28 13:33:55 -070029 dead_code();
Yu-Ping Wu9fc8cf82019-11-13 15:57:45 +080030 return vboot_get_context()->flags & VB2_CONTEXT_DISPLAY_INIT;
Julius Werner6d9c1312019-03-28 13:33:55 -070031 }
Aaron Durbinbc98cc62015-09-02 09:21:36 -050032
33 /* By default always initialize display. */
34 return 1;
35}