diff options
author | Tom Rini <trini@konsulko.com> | 2019-02-13 07:12:29 -0500 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2019-02-13 07:12:29 -0500 |
commit | 63f7e3fca391a50a499fed828fe16325fdee45f3 (patch) | |
tree | 6214d5fe9a24d21b9a729a1bda3fdd22e442d298 /lib/efi_loader/efi_setup.c | |
parent | b1b1bab7f92b838a252ab977f56d9c3584c14fb7 (diff) | |
parent | 823c233b7ab95169ea4428b2821b72b8887b47b0 (diff) |
Merge tag 'signed-efi-next' of git://github.com/agraf/u-boot
Patch queue for efi - 2019-02-13
Goodness this time around:
- HII protocol, finally allows us to run the UEFI Shell!
(experimantal, disabled by default)
- efi selftest now available on Cortex-M
- NVMe support for distro boot
- Lots of code cleanup
Diffstat (limited to 'lib/efi_loader/efi_setup.c')
-rw-r--r-- | lib/efi_loader/efi_setup.c | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/lib/efi_loader/efi_setup.c b/lib/efi_loader/efi_setup.c new file mode 100644 index 0000000000..8266d06c2e --- /dev/null +++ b/lib/efi_loader/efi_setup.c @@ -0,0 +1,86 @@ +// 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 + +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; + + /* + * On the ARM architecture gd is mapped to a fixed register (r9 or x18). + * As this register may be overwritten by an EFI payload we save it here + * and restore it on every callback entered. + */ + efi_save_gd(); + + /* 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; +} |