@@ -6,8 +6,9 @@
#include <cpu_func.h>
#include <efi.h>
#include <efi_api.h>
+#include <efi_stub.h>
#include <errno.h>
#include <event.h>
#include <init.h>
#include <log.h>
@@ -6,8 +6,9 @@
#include <command.h>
#include <efi.h>
#include <efi_api.h>
+#include <efi_stub.h>
#include <errno.h>
#include <log.h>
#include <malloc.h>
#include <sort.h>
@@ -8,8 +8,9 @@
#define LOG_CATEGORY LOGC_EFI
#include <dm.h>
#include <efi_api.h>
+#include <efi_stub.h>
#include <log.h>
#include <vesa.h>
#include <video.h>
@@ -321,18 +321,8 @@ struct efi_open_protocol_info_entry {
u32 attributes;
u32 open_count;
};
-enum efi_entry_t {
- EFIET_END, /* Signals this is the last (empty) entry */
- EFIET_MEMORY_MAP,
- EFIET_GOP_MODE,
- EFIET_SYS_TABLE,
-
- /* Number of entries */
- EFIET_MEMORY_COUNT,
-};
-
#define EFI_TABLE_VERSION 1
/**
* struct efi_info_hdr - Header for the EFI info table
@@ -609,23 +599,8 @@ void efi_puts(struct efi_priv *priv, const char *str);
* @ch: Character to write (note this is not unicode)
*/
void efi_putc(struct efi_priv *priv, const char ch);
-/**
- * efi_info_get() - get an entry from an EFI table
- *
- * This function is called from U-Boot proper to read information set up by the
- * EFI stub. It can only be used when running from the EFI stub, not when U-Boot
- * is running as an app.
- *
- * @type: Entry type to search for
- * @datap: Returns pointer to entry data
- * @sizep: Returns entry size
- * Return: 0 if OK, -ENODATA if there is no table, -ENOENT if there is no entry
- * of the requested type, -EPROTONOSUPPORT if the table has the wrong version
- */
-int efi_info_get(enum efi_entry_t type, void **datap, int *sizep);
-
/**
* efi_store_memory_map() - Collect the memory-map info from EFI
*
* Collect the memory info and store it for later use, e.g. in calling
new file mode 100644
@@ -0,0 +1,38 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Helpers for U-Boot running as an EFI payload.
+ *
+ * Copyright (c) 2024 Linaro, Ltd
+ */
+
+#ifndef _EFI_STUB_H
+#define _EFI_STUB_H
+
+#include <linux/types.h>
+
+enum efi_entry_t {
+ EFIET_END, /* Signals this is the last (empty) entry */
+ EFIET_MEMORY_MAP,
+ EFIET_GOP_MODE,
+ EFIET_SYS_TABLE,
+
+ /* Number of entries */
+ EFIET_MEMORY_COUNT,
+};
+
+/**
+ * efi_info_get() - get an entry from an EFI table
+ *
+ * This function is called from U-Boot proper to read information set up by the
+ * EFI stub. It can only be used when running from the EFI stub, not when U-Boot
+ * is running as an app.
+ *
+ * @type: Entry type to search for
+ * @datap: Returns pointer to entry data
+ * @sizep: Returns entry size
+ * Return: 0 if OK, -ENODATA if there is no table, -ENOENT if there is no entry
+ * of the requested type, -EPROTONOSUPPORT if the table has the wrong version
+ */
+int efi_info_get(enum efi_entry_t type, void **datap, int *sizep);
+
+#endif /* _EFI_STUB_H */
@@ -12,8 +12,9 @@
#include <debug_uart.h>
#include <dm.h>
#include <efi.h>
#include <efi_api.h>
+#include <efi_stub.h>
#include <errno.h>
#include <init.h>
#include <malloc.h>
#include <sysreset.h>
@@ -5,8 +5,9 @@
* Access to the EFI information table
*/
#include <efi.h>
+#include <efi_stub.h>
#include <errno.h>
#include <mapmem.h>
#include <asm/global_data.h>
@@ -11,8 +11,9 @@
#include <debug_uart.h>
#include <efi.h>
#include <efi_api.h>
+#include <efi_stub.h>
#include <malloc.h>
#include <asm/io.h>
#include <linux/err.h>
#include <linux/types.h>
@@ -11,8 +11,9 @@
#include <debug_uart.h>
#include <efi.h>
#include <efi_api.h>
+#include <efi_stub.h>
#include <errno.h>
#include <malloc.h>
#include <ns16550.h>
#include <asm/cpu.h>
Split out the EFI stub specific code to a new efi_stub.h header file. Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org> --- arch/x86/cpu/efi/payload.c | 1 + cmd/efi.c | 1 + drivers/video/efi.c | 1 + include/efi.h | 25 ------------------------- include/efi_stub.h | 38 ++++++++++++++++++++++++++++++++++++++ lib/efi/efi_app.c | 1 + lib/efi/efi_info.c | 1 + lib/efi/efi_stub_arm64.c | 1 + lib/efi/efi_stub_x86.c | 1 + 9 files changed, 45 insertions(+), 25 deletions(-)