blob: 2d5a7eb0043d8d299d21162656973c9e40ede4b8 [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{
Subrata Banikb3485f32023-05-15 23:42:23 +053024 /* Need display for showing splash screen. */
25 if (CONFIG(BMP_LOGO))
26 return 1;
27
28 /* For vboot, honor VB2_CONTEXT_DISPLAY_INIT. */
Christian Walter90cf4bb2019-07-29 09:54:23 +000029 if (CONFIG(VBOOT)) {
Joel Kitching6672bd82019-04-10 16:06:21 +080030 /* Must always select MUST_REQUEST_DISPLAY when using this
31 function. */
32 if (!CONFIG(VBOOT_MUST_REQUEST_DISPLAY))
Julius Werner6d9c1312019-03-28 13:33:55 -070033 dead_code();
Yu-Ping Wu9fc8cf82019-11-13 15:57:45 +080034 return vboot_get_context()->flags & VB2_CONTEXT_DISPLAY_INIT;
Julius Werner6d9c1312019-03-28 13:33:55 -070035 }
Aaron Durbinbc98cc62015-09-02 09:21:36 -050036
37 /* By default always initialize display. */
38 return 1;
39}