mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-22 07:01:39 +00:00
The first functions of the UEFI sub-system are invoked before reaching the U-Boot shell, e.g. efi_set_bootdev(), efi_dp_from_name(), efi_dp_from_file(). We should be able to print out device paths for debugging purposes here. When printing device paths via printf("%pD\n", dp) this invokes functions defined as EFIAPI. So efi_save_gd() must be called beforehand. So let's move the efi_save_gd() call to function initr_reloc_global_data(() in board_r.c. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
106 lines
2.3 KiB
C
106 lines
2.3 KiB
C
// SPDX-License-Identifier: GPL-2.0+
|
|
/*
|
|
* EFI setup code
|
|
*
|
|
* Copyright (c) 2016-2018 Alexander Graf et al.
|
|
*/
|
|
|
|
#include <common.h>
|
|
#include <efi_loader.h>
|
|
|
|
#define OBJ_LIST_NOT_INITIALIZED 1
|
|
|
|
/* Language code for American English according to RFC 4646 */
|
|
#define EN_US L"en-US"
|
|
|
|
static efi_status_t efi_obj_list_initialized = OBJ_LIST_NOT_INITIALIZED;
|
|
|
|
/* Initialize and populate EFI object list */
|
|
efi_status_t efi_init_obj_list(void)
|
|
{
|
|
efi_status_t ret = EFI_SUCCESS;
|
|
|
|
/*
|
|
* Variable PlatformLang defines the language that the machine has been
|
|
* configured for.
|
|
*/
|
|
ret = EFI_CALL(efi_set_variable(L"PlatformLang",
|
|
&efi_global_variable_guid,
|
|
EFI_VARIABLE_BOOTSERVICE_ACCESS |
|
|
EFI_VARIABLE_RUNTIME_ACCESS,
|
|
sizeof(EN_US), EN_US));
|
|
if (ret != EFI_SUCCESS)
|
|
goto out;
|
|
|
|
/*
|
|
* Variable PlatformLangCodes defines the language codes that the
|
|
* machine can support.
|
|
*/
|
|
ret = EFI_CALL(efi_set_variable(L"PlatformLangCodes",
|
|
&efi_global_variable_guid,
|
|
EFI_VARIABLE_BOOTSERVICE_ACCESS |
|
|
EFI_VARIABLE_RUNTIME_ACCESS,
|
|
sizeof(EN_US), EN_US));
|
|
if (ret != EFI_SUCCESS)
|
|
goto out;
|
|
|
|
/* Initialize once only */
|
|
if (efi_obj_list_initialized != OBJ_LIST_NOT_INITIALIZED)
|
|
return efi_obj_list_initialized;
|
|
|
|
/* Initialize system table */
|
|
ret = efi_initialize_system_table();
|
|
if (ret != EFI_SUCCESS)
|
|
goto out;
|
|
|
|
/* Initialize root node */
|
|
ret = efi_root_node_register();
|
|
if (ret != EFI_SUCCESS)
|
|
goto out;
|
|
|
|
/* Initialize EFI driver uclass */
|
|
ret = efi_driver_init();
|
|
if (ret != EFI_SUCCESS)
|
|
goto out;
|
|
|
|
ret = efi_console_register();
|
|
if (ret != EFI_SUCCESS)
|
|
goto out;
|
|
#ifdef CONFIG_PARTITIONS
|
|
ret = efi_disk_register();
|
|
if (ret != EFI_SUCCESS)
|
|
goto out;
|
|
#endif
|
|
#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;
|
|
|
|
/* Initialize EFI runtime services */
|
|
ret = efi_reset_system_init();
|
|
if (ret != EFI_SUCCESS)
|
|
goto out;
|
|
|
|
out:
|
|
efi_obj_list_initialized = ret;
|
|
return ret;
|
|
}
|