efi: Move more common stub code into the common file

Pull in several functions which are identical in the ARM and x86 files.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass
2025-06-12 07:53:16 -06:00
parent d43aab19fb
commit baee46f95b
4 changed files with 111 additions and 181 deletions

View File

@@ -10,6 +10,8 @@
#include <linux/types.h>
struct efi_priv;
enum efi_entry_t {
EFIET_END, /* Signals this is the last (empty) entry */
EFIET_MEMORY_MAP,
@@ -64,4 +66,38 @@ int dram_init_banksize_from_efi(void);
*/
void efi_add_known_memory_from_efi(void);
/**
* setup_info_table() - sets up a table containing information from EFI
*
* We must call exit_boot_services() before jumping out of the stub into U-Boot
* proper, so that U-Boot has full control of peripherals, memory, etc.
*
* Once we do this, we cannot call any boot-services functions so we must find
* out everything we need to before doing that.
*
* Set up a struct efi_info_hdr table which can hold various records (e.g.
* struct efi_entry_memmap) with information obtained from EFI.
*
* @priv: Pointer to our private information which contains the list
* @size: Size of the table to allocate
* Return: 0 if OK, non-zero on error
*/
int setup_info_table(struct efi_priv *priv, int size);
/**
* add_entry_addr() - Add a new entry to the efi_info list
*
* This adds an entry, consisting of a tag and two lots of data. This avoids the
* caller having to coalesce the data first
*
* @priv: Pointer to our private information which contains the list
* @type: Type of the entry to add
* @ptr1: Pointer to first data block to add
* @size1: Size of first data block in bytes (can be 0)
* @ptr2: Pointer to second data block to add
* @size2: Size of second data block in bytes (can be 0)
*/
void add_entry_addr(struct efi_priv *priv, enum efi_entry_t type, void *ptr1,
int size1, void *ptr2, int size2);
#endif /* _EFI_STUB_H */