efi_loader: move efi_init_obj_list() to a new efi_setup.c
The function, efi_init_obj_list(), can be shared in different pseudo efi
applications, like bootefi/bootmgr as well as my efishell. Moreover, it
will be utilized to extend efi initialization, for example, my "removable
disk support" patch and "capsule-on-disk support" patch in the future.
So with this patch, it will be moved to a new file, efi_setup.c, under
lib/efi_loader and exported, making no changes in functionality.
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Remove lines deactivated by #if 1 #else
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
2018-12-30 14:16:55 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0+
|
|
|
|
/*
|
|
|
|
* EFI setup code
|
|
|
|
*
|
|
|
|
* Copyright (c) 2016-2018 Alexander Graf et al.
|
|
|
|
*/
|
|
|
|
|
2021-06-29 11:33:09 +00:00
|
|
|
#define LOG_CATEGORY LOGC_EFI
|
|
|
|
|
efi_loader: move efi_init_obj_list() to a new efi_setup.c
The function, efi_init_obj_list(), can be shared in different pseudo efi
applications, like bootefi/bootmgr as well as my efishell. Moreover, it
will be utilized to extend efi initialization, for example, my "removable
disk support" patch and "capsule-on-disk support" patch in the future.
So with this patch, it will be moved to a new file, efi_setup.c, under
lib/efi_loader and exported, making no changes in functionality.
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Remove lines deactivated by #if 1 #else
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
2018-12-30 14:16:55 +00:00
|
|
|
#include <efi_loader.h>
|
2020-06-24 17:38:29 +00:00
|
|
|
#include <efi_variable.h>
|
2021-06-29 11:33:09 +00:00
|
|
|
#include <log.h>
|
2023-02-10 08:02:56 +00:00
|
|
|
#include <asm-generic/unaligned.h>
|
efi_loader: move efi_init_obj_list() to a new efi_setup.c
The function, efi_init_obj_list(), can be shared in different pseudo efi
applications, like bootefi/bootmgr as well as my efishell. Moreover, it
will be utilized to extend efi initialization, for example, my "removable
disk support" patch and "capsule-on-disk support" patch in the future.
So with this patch, it will be moved to a new file, efi_setup.c, under
lib/efi_loader and exported, making no changes in functionality.
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Remove lines deactivated by #if 1 #else
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
2018-12-30 14:16:55 +00:00
|
|
|
|
|
|
|
#define OBJ_LIST_NOT_INITIALIZED 1
|
|
|
|
|
2020-03-19 18:21:58 +00:00
|
|
|
efi_status_t efi_obj_list_initialized = OBJ_LIST_NOT_INITIALIZED;
|
efi_loader: move efi_init_obj_list() to a new efi_setup.c
The function, efi_init_obj_list(), can be shared in different pseudo efi
applications, like bootefi/bootmgr as well as my efishell. Moreover, it
will be utilized to extend efi initialization, for example, my "removable
disk support" patch and "capsule-on-disk support" patch in the future.
So with this patch, it will be moved to a new file, efi_setup.c, under
lib/efi_loader and exported, making no changes in functionality.
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Remove lines deactivated by #if 1 #else
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
2018-12-30 14:16:55 +00:00
|
|
|
|
2019-05-04 09:47:48 +00:00
|
|
|
/*
|
|
|
|
* Allow unaligned memory access.
|
|
|
|
*
|
|
|
|
* This routine is overridden by architectures providing this feature.
|
|
|
|
*/
|
|
|
|
void __weak allow_unaligned(void)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2019-04-11 05:34:24 +00:00
|
|
|
/**
|
|
|
|
* efi_init_platform_lang() - define supported languages
|
|
|
|
*
|
|
|
|
* Set the PlatformLangCodes and PlatformLang variables.
|
|
|
|
*
|
|
|
|
* Return: status code
|
|
|
|
*/
|
|
|
|
static efi_status_t efi_init_platform_lang(void)
|
efi_loader: move efi_init_obj_list() to a new efi_setup.c
The function, efi_init_obj_list(), can be shared in different pseudo efi
applications, like bootefi/bootmgr as well as my efishell. Moreover, it
will be utilized to extend efi initialization, for example, my "removable
disk support" patch and "capsule-on-disk support" patch in the future.
So with this patch, it will be moved to a new file, efi_setup.c, under
lib/efi_loader and exported, making no changes in functionality.
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Remove lines deactivated by #if 1 #else
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
2018-12-30 14:16:55 +00:00
|
|
|
{
|
2019-04-11 05:34:24 +00:00
|
|
|
efi_status_t ret;
|
|
|
|
efi_uintn_t data_size = 0;
|
|
|
|
char *lang = CONFIG_EFI_PLATFORM_LANG_CODES;
|
|
|
|
char *pos;
|
efi_loader: move efi_init_obj_list() to a new efi_setup.c
The function, efi_init_obj_list(), can be shared in different pseudo efi
applications, like bootefi/bootmgr as well as my efishell. Moreover, it
will be utilized to extend efi initialization, for example, my "removable
disk support" patch and "capsule-on-disk support" patch in the future.
So with this patch, it will be moved to a new file, efi_setup.c, under
lib/efi_loader and exported, making no changes in functionality.
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Remove lines deactivated by #if 1 #else
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
2018-12-30 14:16:55 +00:00
|
|
|
|
2019-04-05 00:45:21 +00:00
|
|
|
/*
|
2019-04-11 05:34:24 +00:00
|
|
|
* Variable PlatformLangCodes defines the language codes that the
|
|
|
|
* machine can support.
|
2019-04-05 00:45:21 +00:00
|
|
|
*/
|
2022-01-23 19:55:12 +00:00
|
|
|
ret = efi_set_variable_int(u"PlatformLangCodes",
|
2020-06-24 17:38:29 +00:00
|
|
|
&efi_global_variable_guid,
|
|
|
|
EFI_VARIABLE_BOOTSERVICE_ACCESS |
|
|
|
|
EFI_VARIABLE_RUNTIME_ACCESS |
|
|
|
|
EFI_VARIABLE_READ_ONLY,
|
|
|
|
sizeof(CONFIG_EFI_PLATFORM_LANG_CODES),
|
|
|
|
CONFIG_EFI_PLATFORM_LANG_CODES, false);
|
2019-04-05 00:45:21 +00:00
|
|
|
if (ret != EFI_SUCCESS)
|
|
|
|
goto out;
|
|
|
|
|
|
|
|
/*
|
2019-04-11 05:34:24 +00:00
|
|
|
* Variable PlatformLang defines the language that the machine has been
|
|
|
|
* configured for.
|
2019-04-05 00:45:21 +00:00
|
|
|
*/
|
2022-01-23 19:55:12 +00:00
|
|
|
ret = efi_get_variable_int(u"PlatformLang",
|
2020-06-24 17:38:29 +00:00
|
|
|
&efi_global_variable_guid,
|
|
|
|
NULL, &data_size, &pos, NULL);
|
2019-04-11 05:34:24 +00:00
|
|
|
if (ret == EFI_BUFFER_TOO_SMALL) {
|
|
|
|
/* The variable is already set. Do not change it. */
|
|
|
|
ret = EFI_SUCCESS;
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The list of supported languages is semicolon separated. Use the first
|
|
|
|
* language to initialize PlatformLang.
|
|
|
|
*/
|
|
|
|
pos = strchr(lang, ';');
|
|
|
|
if (pos)
|
|
|
|
*pos = 0;
|
|
|
|
|
2022-01-23 19:55:12 +00:00
|
|
|
ret = efi_set_variable_int(u"PlatformLang",
|
2020-06-24 17:38:29 +00:00
|
|
|
&efi_global_variable_guid,
|
|
|
|
EFI_VARIABLE_NON_VOLATILE |
|
|
|
|
EFI_VARIABLE_BOOTSERVICE_ACCESS |
|
|
|
|
EFI_VARIABLE_RUNTIME_ACCESS,
|
|
|
|
1 + strlen(lang), lang, false);
|
2019-04-11 05:34:24 +00:00
|
|
|
out:
|
2019-04-05 00:45:21 +00:00
|
|
|
if (ret != EFI_SUCCESS)
|
2019-04-11 05:34:24 +00:00
|
|
|
printf("EFI: cannot initialize platform language settings\n");
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2020-04-14 02:51:45 +00:00
|
|
|
#ifdef CONFIG_EFI_SECURE_BOOT
|
|
|
|
/**
|
|
|
|
* efi_init_secure_boot - initialize secure boot state
|
|
|
|
*
|
2020-05-03 14:29:00 +00:00
|
|
|
* Return: status code
|
2020-04-14 02:51:45 +00:00
|
|
|
*/
|
|
|
|
static efi_status_t efi_init_secure_boot(void)
|
|
|
|
{
|
|
|
|
efi_guid_t signature_types[] = {
|
|
|
|
EFI_CERT_SHA256_GUID,
|
|
|
|
EFI_CERT_X509_GUID,
|
|
|
|
};
|
|
|
|
efi_status_t ret;
|
|
|
|
|
2022-01-23 19:55:12 +00:00
|
|
|
ret = efi_set_variable_int(u"SignatureSupport",
|
2020-06-24 17:38:29 +00:00
|
|
|
&efi_global_variable_guid,
|
2020-11-17 00:27:55 +00:00
|
|
|
EFI_VARIABLE_READ_ONLY |
|
2020-06-24 17:38:29 +00:00
|
|
|
EFI_VARIABLE_BOOTSERVICE_ACCESS |
|
2020-11-17 00:27:55 +00:00
|
|
|
EFI_VARIABLE_RUNTIME_ACCESS,
|
2020-06-24 17:38:29 +00:00
|
|
|
sizeof(signature_types),
|
|
|
|
&signature_types, false);
|
2020-04-14 02:51:45 +00:00
|
|
|
if (ret != EFI_SUCCESS)
|
|
|
|
printf("EFI: cannot initialize SignatureSupport variable\n");
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
static efi_status_t efi_init_secure_boot(void)
|
|
|
|
{
|
|
|
|
return EFI_SUCCESS;
|
|
|
|
}
|
|
|
|
#endif /* CONFIG_EFI_SECURE_BOOT */
|
|
|
|
|
2020-11-17 00:27:55 +00:00
|
|
|
/**
|
|
|
|
* efi_init_capsule - initialize capsule update state
|
|
|
|
*
|
|
|
|
* Return: status code
|
|
|
|
*/
|
|
|
|
static efi_status_t efi_init_capsule(void)
|
|
|
|
{
|
|
|
|
efi_status_t ret = EFI_SUCCESS;
|
|
|
|
|
2023-01-20 11:58:48 +00:00
|
|
|
if (IS_ENABLED(CONFIG_EFI_HAVE_CAPSULE_SUPPORT)) {
|
2023-02-16 17:21:41 +00:00
|
|
|
u16 var_name16[12];
|
|
|
|
|
|
|
|
efi_create_indexed_name(var_name16, sizeof(var_name16),
|
|
|
|
"Capsule", CONFIG_EFI_CAPSULE_MAX);
|
|
|
|
|
2022-01-23 19:55:12 +00:00
|
|
|
ret = efi_set_variable_int(u"CapsuleMax",
|
2020-11-17 00:27:55 +00:00
|
|
|
&efi_guid_capsule_report,
|
|
|
|
EFI_VARIABLE_READ_ONLY |
|
|
|
|
EFI_VARIABLE_BOOTSERVICE_ACCESS |
|
|
|
|
EFI_VARIABLE_RUNTIME_ACCESS,
|
2023-02-16 17:21:41 +00:00
|
|
|
22, var_name16, false);
|
2020-11-17 00:27:55 +00:00
|
|
|
if (ret != EFI_SUCCESS)
|
|
|
|
printf("EFI: cannot initialize CapsuleMax variable\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* efi_init_os_indications() - indicate supported features for OS requests
|
|
|
|
*
|
|
|
|
* Set the OsIndicationsSupported variable.
|
|
|
|
*
|
|
|
|
* Return: status code
|
|
|
|
*/
|
|
|
|
static efi_status_t efi_init_os_indications(void)
|
|
|
|
{
|
|
|
|
u64 os_indications_supported = 0;
|
|
|
|
|
|
|
|
if (IS_ENABLED(CONFIG_EFI_HAVE_CAPSULE_SUPPORT))
|
|
|
|
os_indications_supported |=
|
|
|
|
EFI_OS_INDICATIONS_CAPSULE_RESULT_VAR_SUPPORTED;
|
|
|
|
|
2020-11-17 00:27:56 +00:00
|
|
|
if (IS_ENABLED(CONFIG_EFI_CAPSULE_ON_DISK))
|
|
|
|
os_indications_supported |=
|
|
|
|
EFI_OS_INDICATIONS_FILE_CAPSULE_DELIVERY_SUPPORTED;
|
|
|
|
|
2020-11-30 09:12:11 +00:00
|
|
|
if (IS_ENABLED(CONFIG_EFI_CAPSULE_FIRMWARE_MANAGEMENT))
|
|
|
|
os_indications_supported |=
|
|
|
|
EFI_OS_INDICATIONS_FMP_CAPSULE_SUPPORTED;
|
|
|
|
|
2022-01-23 19:55:12 +00:00
|
|
|
return efi_set_variable_int(u"OsIndicationsSupported",
|
2020-11-17 00:27:55 +00:00
|
|
|
&efi_global_variable_guid,
|
|
|
|
EFI_VARIABLE_BOOTSERVICE_ACCESS |
|
|
|
|
EFI_VARIABLE_RUNTIME_ACCESS |
|
|
|
|
EFI_VARIABLE_READ_ONLY,
|
|
|
|
sizeof(os_indications_supported),
|
|
|
|
&os_indications_supported, false);
|
|
|
|
}
|
|
|
|
|
2019-04-11 05:34:24 +00:00
|
|
|
/**
|
2022-10-21 03:01:57 +00:00
|
|
|
* efi_init_early() - handle initialization at early stage
|
efi_loader: split efi_init_obj_list() into two stages
In the next commit, CONFIG_EFI_SETUP_EARLY will become mandated
in order to support dynamic enumeration of efi_disk objects.
This can, however, be problematic particularly in case of file-based
variable storage (efi_variable.c, default).
Non-volatile variables are to be restored from EFI system partition
by efi_init_variables() in efi_init_obj_list(). When efi_init_obj_list()
is called in board_init_r(), we don't know yet what disk devices
we have since none of device probing commands (say, scsi rescan) has not
been executed at that stage.
So in this commit, a preparatory change is made; efi_init_obj_list() is
broken into the two functions;
* efi_init_early(), and
* new efi_init_obj_list()
Only efi_init_early() will be called in board_init_r(), which allows
us to execute any of device probing commands, either though "preboot"
variable or normal command line, before calling efi_init_obj_list() which
is to be invoked at the first execution of an efi-related command
(or at efi_launch_capsules()) as used to be.
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
2022-04-19 01:05:11 +00:00
|
|
|
*
|
2022-10-21 03:01:57 +00:00
|
|
|
* expected to be called in board_init_r().
|
2019-04-11 05:34:24 +00:00
|
|
|
*
|
|
|
|
* Return: status code
|
|
|
|
*/
|
2022-10-21 03:01:57 +00:00
|
|
|
int efi_init_early(void)
|
2019-04-11 05:34:24 +00:00
|
|
|
{
|
2022-10-21 03:01:57 +00:00
|
|
|
efi_status_t ret;
|
2019-04-05 00:45:21 +00:00
|
|
|
|
2019-05-04 09:47:48 +00:00
|
|
|
/* Allow unaligned memory access */
|
|
|
|
allow_unaligned();
|
|
|
|
|
2020-05-20 19:27:29 +00:00
|
|
|
/* Initialize root node */
|
|
|
|
ret = efi_root_node_register();
|
|
|
|
if (ret != EFI_SUCCESS)
|
|
|
|
goto out;
|
|
|
|
|
2020-06-09 05:09:31 +00:00
|
|
|
ret = efi_console_register();
|
|
|
|
if (ret != EFI_SUCCESS)
|
|
|
|
goto out;
|
|
|
|
|
2022-10-05 09:28:47 +00:00
|
|
|
/* Initialize EFI driver uclass */
|
|
|
|
ret = efi_driver_init();
|
2022-10-21 03:01:57 +00:00
|
|
|
if (ret != EFI_SUCCESS)
|
|
|
|
goto out;
|
efi_loader: split efi_init_obj_list() into two stages
In the next commit, CONFIG_EFI_SETUP_EARLY will become mandated
in order to support dynamic enumeration of efi_disk objects.
This can, however, be problematic particularly in case of file-based
variable storage (efi_variable.c, default).
Non-volatile variables are to be restored from EFI system partition
by efi_init_variables() in efi_init_obj_list(). When efi_init_obj_list()
is called in board_init_r(), we don't know yet what disk devices
we have since none of device probing commands (say, scsi rescan) has not
been executed at that stage.
So in this commit, a preparatory change is made; efi_init_obj_list() is
broken into the two functions;
* efi_init_early(), and
* new efi_init_obj_list()
Only efi_init_early() will be called in board_init_r(), which allows
us to execute any of device probing commands, either though "preboot"
variable or normal command line, before calling efi_init_obj_list() which
is to be invoked at the first execution of an efi-related command
(or at efi_launch_capsules()) as used to be.
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
2022-04-19 01:05:11 +00:00
|
|
|
|
|
|
|
return 0;
|
2022-10-21 03:01:57 +00:00
|
|
|
out:
|
|
|
|
/* never re-init UEFI subsystem */
|
|
|
|
efi_obj_list_initialized = ret;
|
|
|
|
|
|
|
|
return -1;
|
efi_loader: split efi_init_obj_list() into two stages
In the next commit, CONFIG_EFI_SETUP_EARLY will become mandated
in order to support dynamic enumeration of efi_disk objects.
This can, however, be problematic particularly in case of file-based
variable storage (efi_variable.c, default).
Non-volatile variables are to be restored from EFI system partition
by efi_init_variables() in efi_init_obj_list(). When efi_init_obj_list()
is called in board_init_r(), we don't know yet what disk devices
we have since none of device probing commands (say, scsi rescan) has not
been executed at that stage.
So in this commit, a preparatory change is made; efi_init_obj_list() is
broken into the two functions;
* efi_init_early(), and
* new efi_init_obj_list()
Only efi_init_early() will be called in board_init_r(), which allows
us to execute any of device probing commands, either though "preboot"
variable or normal command line, before calling efi_init_obj_list() which
is to be invoked at the first execution of an efi-related command
(or at efi_launch_capsules()) as used to be.
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
2022-04-19 01:05:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* efi_init_obj_list() - Initialize and populate EFI object list
|
|
|
|
*
|
|
|
|
* Return: status code
|
|
|
|
*/
|
|
|
|
efi_status_t efi_init_obj_list(void)
|
|
|
|
{
|
|
|
|
efi_status_t ret = EFI_SUCCESS;
|
|
|
|
|
|
|
|
/* Initialize once only */
|
|
|
|
if (efi_obj_list_initialized != OBJ_LIST_NOT_INITIALIZED)
|
|
|
|
return efi_obj_list_initialized;
|
|
|
|
|
2022-06-14 06:02:03 +00:00
|
|
|
/* Set up console modes */
|
|
|
|
efi_setup_console_size();
|
|
|
|
|
efi_loader: ensure all block devices are probed
Only probed block devices are available in the UEFI sub-system. Multiple
block devices may be involved in the boot process. So we have to make sure
that all block devices are probed. Another reason is that we store UEFI
variables on the ESP which may be on any block device.
On the sandbox before the patch:
=> efidebug devices
No EFI system partition
Device Device Path
================ ====================
000000001b027c70 /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)
000055d078bc1ae0 /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/Uart(0,0,D,D)
000000001b22e0b0 /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/MAC(020011223344,1)
After the patch:
=> efidebug devices
No EFI system partition
Device Device Path
================ ====================
000000001b027c70 /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)
000055bdac8ddae0 /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/Uart(0,0,D,D)
000000001b230920 /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/SD(2)/SD(0)
000000001b233ac0 /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/SD(1)/SD(1)
000000001b233b80 /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/SD(1)/SD(1)/HD(1,GPT,d0a914ee-a71c-fc1e-73f0-7e302b0e6c20,0x30,0x1)
000000001b234110 /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/SD(1)/SD(1)/HD(2,GPT,9330a0ea-8aff-f67a-294c-fa05d60896c3,0x31,0x1)
000000001b22f0e0 /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/SD(0)/SD(2)
000000001b238df0 /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/MAC(020011223344,1)
Fixes: a9bf024b2933 ("efi_loader: disk: a helper function to create efi_disk objects from udevice")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2022-08-31 14:37:35 +00:00
|
|
|
/*
|
|
|
|
* Probe block devices to find the ESP.
|
|
|
|
* efi_disks_register() must be called before efi_init_variables().
|
|
|
|
*/
|
|
|
|
ret = efi_disks_register();
|
|
|
|
if (ret != EFI_SUCCESS)
|
|
|
|
goto out;
|
|
|
|
|
2019-06-20 11:52:16 +00:00
|
|
|
/* Initialize variable services */
|
|
|
|
ret = efi_init_variables();
|
|
|
|
if (ret != EFI_SUCCESS)
|
|
|
|
goto out;
|
|
|
|
|
2023-11-10 04:25:37 +00:00
|
|
|
if (IS_ENABLED(CONFIG_CMD_BOOTEFI_BOOTMGR)) {
|
|
|
|
/* update boot option after variable service initialized */
|
|
|
|
ret = efi_bootmgr_update_media_device_boot_option();
|
|
|
|
if (ret != EFI_SUCCESS)
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
2019-04-11 05:34:24 +00:00
|
|
|
/* Define supported languages */
|
|
|
|
ret = efi_init_platform_lang();
|
|
|
|
if (ret != EFI_SUCCESS)
|
|
|
|
goto out;
|
|
|
|
|
2019-04-24 06:30:38 +00:00
|
|
|
/* Indicate supported features */
|
2020-11-17 00:27:55 +00:00
|
|
|
ret = efi_init_os_indications();
|
2019-04-24 06:30:38 +00:00
|
|
|
if (ret != EFI_SUCCESS)
|
|
|
|
goto out;
|
|
|
|
|
2020-02-19 19:48:49 +00:00
|
|
|
/* Initialize system table */
|
|
|
|
ret = efi_initialize_system_table();
|
2019-06-05 04:21:38 +00:00
|
|
|
if (ret != EFI_SUCCESS)
|
|
|
|
goto out;
|
|
|
|
|
2021-12-23 14:51:07 +00:00
|
|
|
if (IS_ENABLED(CONFIG_EFI_ECPT)) {
|
|
|
|
ret = efi_ecpt_register();
|
|
|
|
if (ret != EFI_SUCCESS)
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
2021-03-02 17:26:38 +00:00
|
|
|
if (IS_ENABLED(CONFIG_EFI_ESRT)) {
|
|
|
|
ret = efi_esrt_register();
|
|
|
|
if (ret != EFI_SUCCESS)
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
2020-11-30 09:47:40 +00:00
|
|
|
if (IS_ENABLED(CONFIG_EFI_TCG2_PROTOCOL)) {
|
|
|
|
ret = efi_tcg2_register();
|
|
|
|
if (ret != EFI_SUCCESS)
|
|
|
|
goto out;
|
2021-12-07 05:15:31 +00:00
|
|
|
|
|
|
|
ret = efi_tcg2_do_initial_measurement();
|
|
|
|
if (ret == EFI_SECURITY_VIOLATION)
|
|
|
|
goto out;
|
2020-11-30 09:47:40 +00:00
|
|
|
}
|
|
|
|
|
2022-07-22 16:02:03 +00:00
|
|
|
/* Install EFI_RNG_PROTOCOL */
|
|
|
|
if (IS_ENABLED(CONFIG_EFI_RNG_PROTOCOL)) {
|
|
|
|
ret = efi_rng_register();
|
|
|
|
if (ret != EFI_SUCCESS)
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
2022-01-28 15:18:44 +00:00
|
|
|
if (IS_ENABLED(CONFIG_EFI_RISCV_BOOT_PROTOCOL)) {
|
|
|
|
ret = efi_riscv_register();
|
|
|
|
if (ret != EFI_SUCCESS)
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
2020-04-14 02:51:45 +00:00
|
|
|
/* Secure boot */
|
|
|
|
ret = efi_init_secure_boot();
|
|
|
|
if (ret != EFI_SUCCESS)
|
|
|
|
goto out;
|
|
|
|
|
2020-02-19 19:48:49 +00:00
|
|
|
/* Indicate supported runtime services */
|
|
|
|
ret = efi_init_runtime_supported();
|
efi_loader: move efi_init_obj_list() to a new efi_setup.c
The function, efi_init_obj_list(), can be shared in different pseudo efi
applications, like bootefi/bootmgr as well as my efishell. Moreover, it
will be utilized to extend efi initialization, for example, my "removable
disk support" patch and "capsule-on-disk support" patch in the future.
So with this patch, it will be moved to a new file, efi_setup.c, under
lib/efi_loader and exported, making no changes in functionality.
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Remove lines deactivated by #if 1 #else
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
2018-12-30 14:16:55 +00:00
|
|
|
if (ret != EFI_SUCCESS)
|
|
|
|
goto out;
|
|
|
|
|
2021-06-22 14:38:53 +00:00
|
|
|
if (IS_ENABLED(CONFIG_EFI_HAVE_CAPSULE_SUPPORT)) {
|
|
|
|
ret = efi_load_capsule_drivers();
|
|
|
|
if (ret != EFI_SUCCESS)
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
2022-10-18 13:46:31 +00:00
|
|
|
if (IS_ENABLED(CONFIG_VIDEO)) {
|
2022-10-16 21:58:34 +00:00
|
|
|
ret = efi_gop_register();
|
|
|
|
if (ret != EFI_SUCCESS)
|
|
|
|
goto out;
|
|
|
|
}
|
2022-10-14 16:10:06 +00:00
|
|
|
#ifdef CONFIG_NETDEVICES
|
efi_loader: move efi_init_obj_list() to a new efi_setup.c
The function, efi_init_obj_list(), can be shared in different pseudo efi
applications, like bootefi/bootmgr as well as my efishell. Moreover, it
will be utilized to extend efi initialization, for example, my "removable
disk support" patch and "capsule-on-disk support" patch in the future.
So with this patch, it will be moved to a new file, efi_setup.c, under
lib/efi_loader and exported, making no changes in functionality.
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Remove lines deactivated by #if 1 #else
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
2018-12-30 14:16:55 +00:00
|
|
|
ret = efi_net_register();
|
|
|
|
if (ret != EFI_SUCCESS)
|
|
|
|
goto out;
|
|
|
|
#endif
|
2023-09-20 03:00:12 +00:00
|
|
|
if (IS_ENABLED(CONFIG_ACPI)) {
|
|
|
|
ret = efi_acpi_register();
|
|
|
|
if (ret != EFI_SUCCESS)
|
|
|
|
goto out;
|
|
|
|
}
|
2023-09-20 13:29:51 +00:00
|
|
|
if (IS_ENABLED(CONFIG_SMBIOS)) {
|
|
|
|
ret = efi_smbios_register();
|
|
|
|
if (ret != EFI_SUCCESS)
|
|
|
|
goto out;
|
|
|
|
}
|
efi_loader: move efi_init_obj_list() to a new efi_setup.c
The function, efi_init_obj_list(), can be shared in different pseudo efi
applications, like bootefi/bootmgr as well as my efishell. Moreover, it
will be utilized to extend efi initialization, for example, my "removable
disk support" patch and "capsule-on-disk support" patch in the future.
So with this patch, it will be moved to a new file, efi_setup.c, under
lib/efi_loader and exported, making no changes in functionality.
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Remove lines deactivated by #if 1 #else
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
2018-12-30 14:16:55 +00:00
|
|
|
ret = efi_watchdog_register();
|
|
|
|
if (ret != EFI_SUCCESS)
|
|
|
|
goto out;
|
|
|
|
|
2020-11-17 00:27:55 +00:00
|
|
|
ret = efi_init_capsule();
|
|
|
|
if (ret != EFI_SUCCESS)
|
|
|
|
goto out;
|
|
|
|
|
efi_loader: move efi_init_obj_list() to a new efi_setup.c
The function, efi_init_obj_list(), can be shared in different pseudo efi
applications, like bootefi/bootmgr as well as my efishell. Moreover, it
will be utilized to extend efi initialization, for example, my "removable
disk support" patch and "capsule-on-disk support" patch in the future.
So with this patch, it will be moved to a new file, efi_setup.c, under
lib/efi_loader and exported, making no changes in functionality.
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Remove lines deactivated by #if 1 #else
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
2018-12-30 14:16:55 +00:00
|
|
|
/* Initialize EFI runtime services */
|
|
|
|
ret = efi_reset_system_init();
|
|
|
|
if (ret != EFI_SUCCESS)
|
|
|
|
goto out;
|
|
|
|
|
2020-11-17 00:27:56 +00:00
|
|
|
/* Execute capsules after reboot */
|
|
|
|
if (IS_ENABLED(CONFIG_EFI_CAPSULE_ON_DISK) &&
|
|
|
|
!IS_ENABLED(CONFIG_EFI_CAPSULE_ON_DISK_EARLY))
|
|
|
|
ret = efi_launch_capsules();
|
efi_loader: move efi_init_obj_list() to a new efi_setup.c
The function, efi_init_obj_list(), can be shared in different pseudo efi
applications, like bootefi/bootmgr as well as my efishell. Moreover, it
will be utilized to extend efi initialization, for example, my "removable
disk support" patch and "capsule-on-disk support" patch in the future.
So with this patch, it will be moved to a new file, efi_setup.c, under
lib/efi_loader and exported, making no changes in functionality.
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Remove lines deactivated by #if 1 #else
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
2018-12-30 14:16:55 +00:00
|
|
|
out:
|
|
|
|
efi_obj_list_initialized = ret;
|
|
|
|
return ret;
|
|
|
|
}
|