@@ -28,86 +28,9 @@
DECLARE_GLOBAL_DATA_PTR;
-#define OBJ_LIST_NOT_INITIALIZED 1
-
-static efi_status_t efi_obj_list_initialized = OBJ_LIST_NOT_INITIALIZED;
-
static struct efi_device_path *bootefi_image_path;
static struct efi_device_path *bootefi_device_path;
-/* 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;
-}
-
/*
* Allow unaligned memory access.
*
@@ -244,6 +244,8 @@ extern struct list_head efi_obj_list;
/* List of all events */
extern struct list_head efi_events;
+/* Initialize efi execution environment */
+efi_status_t efi_init_obj_list(void);
/* Called by bootefi to initialize root node */
efi_status_t efi_root_node_register(void);
/* Called by bootefi to initialize runtime */
@@ -28,6 +28,7 @@ obj-y += efi_image_loader.o
obj-y += efi_memory.o
obj-y += efi_root_node.o
obj-y += efi_runtime.o
+obj-y += efi_setup.o
obj-y += efi_unicode_collation.o
obj-y += efi_variable.o
obj-y += efi_watchdog.o
new file mode 100644
@@ -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;
+}