summaryrefslogtreecommitdiff
path: root/include/efi.h
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2022-01-04 13:51:10 +0300
committerHeinrich Schuchardt <heinrich.schuchardt@canonical.com>2022-01-15 12:57:22 +0300
commit866e2ac5aa4b8a36db5bb4afd8b4e8302029849a (patch)
treeaef9add80fe56f4144c01e3d13eef5d9bc4501e5 /include/efi.h
parentbf59c46bcb51251442a8366005b31f6f8528a780 (diff)
downloadu-boot-866e2ac5aa4b8a36db5bb4afd8b4e8302029849a.tar.xz
efi: Move exit_boot_services into a function
At present this code is inline in the app and stub. But they do the same thing. The difference is that the stub does it immediately and the app doesn't want to do it until the end (when it boots a kernel) or not at all, if returning to UEFI. Move it into a function so it can be called as needed. Add a comment showing how to store the memory map so that it can be accessed within the app if needed, for debugging purposes only. The map can change without notice. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'include/efi.h')
-rw-r--r--include/efi.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/include/efi.h b/include/efi.h
index 877a2e5a8d..dc9907fa16 100644
--- a/include/efi.h
+++ b/include/efi.h
@@ -407,6 +407,12 @@ static inline struct efi_mem_desc *efi_get_next_mem_desc(
* @sys_table: Pointer to system table
* @boot: Pointer to boot-services table
* @run: Pointer to runtime-services table
+ * @memmap_key: Key returned from get_memory_map()
+ * @memmap_desc: List of memory-map records
+ * @memmap_alloc: Amount of memory allocated for memory map list
+ * @memmap_size Size of memory-map list in bytes
+ * @memmap_desc_size: Size of an individual memory-map record, in bytes
+ * @memmap_version: Memory-map version
*
* @use_pool_for_malloc: true if all allocation should go through the EFI 'pool'
* methods allocate_pool() and free_pool(); false to use 'pages' methods
@@ -424,6 +430,12 @@ struct efi_priv {
struct efi_system_table *sys_table;
struct efi_boot_services *boot;
struct efi_runtime_services *run;
+ efi_uintn_t memmap_key;
+ struct efi_mem_desc *memmap_desc;
+ efi_uintn_t memmap_alloc;
+ efi_uintn_t memmap_size;
+ efi_uintn_t memmap_desc_size;
+ u32 memmap_version;
/* app: */
bool use_pool_for_malloc;
@@ -578,4 +590,24 @@ void efi_putc(struct efi_priv *priv, const char ch);
*/
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
+ * exit_boot_services()
+ *
+ * @priv: Pointer to private EFI structure
+ * @return 0 if OK, non-zero on error
+ */
+int efi_store_memory_map(struct efi_priv *priv);
+
+/**
+ * efi_call_exit_boot_services() - Handle the exit-boot-service procedure
+ *
+ * Tell EFI we don't want their boot services anymore
+ *
+ * Return: 0 if OK, non-zero on error
+ */
+int efi_call_exit_boot_services(void);
+
#endif /* _LINUX_EFI_H */