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