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 <common.h>
|
|
|
|
#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>
|
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;
|
|
|
|
|
|
|
|
if (IS_ENABLED(CONFIG_EFI_HAVE_CAPSULE_UPDATE)) {
|
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,
|
2022-01-23 19:55:12 +00:00
|
|
|
22, u"CapsuleFFFF", 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
|
|
|
/**
|
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_early() - handle initialization at early stage
|
|
|
|
*
|
|
|
|
* This function is called in efi_init_obj_list() only if
|
|
|
|
* !CONFIG_EFI_SETUP_EARLY.
|
2019-04-11 05:34:24 +00:00
|
|
|
*
|
|
|
|
* Return: status code
|
|
|
|
*/
|
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
|
|
|
static efi_status_t __efi_init_early(void)
|
2019-04-11 05:34:24 +00:00
|
|
|
{
|
2021-11-20 10:53:12 +00:00
|
|
|
efi_status_t ret = EFI_SUCCESS;
|
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-04-19 01:05:12 +00:00
|
|
|
ret = efi_disk_init();
|
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
|
|
|
out:
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* efi_init_early() - handle initialization at early stage
|
|
|
|
*
|
|
|
|
* external version of __efi_init_early(); expected to be called in
|
|
|
|
* board_init_r().
|
|
|
|
*
|
|
|
|
* Return: status code
|
|
|
|
*/
|
|
|
|
int efi_init_early(void)
|
|
|
|
{
|
|
|
|
efi_status_t ret;
|
|
|
|
|
|
|
|
ret = __efi_init_early();
|
|
|
|
if (ret != EFI_SUCCESS) {
|
|
|
|
/* never re-init UEFI subsystem */
|
|
|
|
efi_obj_list_initialized = ret;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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;
|
|
|
|
|
|
|
|
if (!IS_ENABLED(CONFIG_EFI_SETUP_EARLY)) {
|
|
|
|
ret = __efi_init_early();
|
|
|
|
if (ret != EFI_SUCCESS)
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
2022-06-14 06:02:03 +00:00
|
|
|
/* Set up console modes */
|
|
|
|
efi_setup_console_size();
|
|
|
|
|
|
|
|
/* Install EFI_RNG_PROTOCOL */
|
2020-09-25 10:50:19 +00:00
|
|
|
if (IS_ENABLED(CONFIG_EFI_RNG_PROTOCOL)) {
|
|
|
|
ret = efi_rng_register();
|
|
|
|
if (ret != EFI_SUCCESS)
|
|
|
|
goto out;
|
|
|
|
}
|
2020-11-11 09:18:11 +00:00
|
|
|
|
2019-06-20 11:52:16 +00:00
|
|
|
/* Initialize variable services */
|
|
|
|
ret = efi_init_variables();
|
|
|
|
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-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-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;
|
|
|
|
|
|
|
|
/* Initialize EFI driver uclass */
|
|
|
|
ret = efi_driver_init();
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
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 defined(CONFIG_LCD) || defined(CONFIG_DM_VIDEO)
|
|
|
|
ret = efi_gop_register();
|
|
|
|
if (ret != EFI_SUCCESS)
|
|
|
|
goto out;
|
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_NET
|
|
|
|
ret = efi_net_register();
|
|
|
|
if (ret != EFI_SUCCESS)
|
|
|
|
goto out;
|
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_GENERATE_ACPI_TABLE
|
|
|
|
ret = efi_acpi_register();
|
|
|
|
if (ret != EFI_SUCCESS)
|
|
|
|
goto out;
|
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_GENERATE_SMBIOS_TABLE
|
|
|
|
ret = efi_smbios_register();
|
|
|
|
if (ret != EFI_SUCCESS)
|
|
|
|
goto out;
|
|
|
|
#endif
|
|
|
|
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;
|
|
|
|
}
|