From: Bin Meng Date: Thu, 23 Aug 2018 08:24:09 -0700 Subject: [U-Boot] [PATCH 2/4] efi: stub: Pass EFI system table address to U-Boot payload In-Reply-To: <1535037851-8798-1-git-send-email-bmeng.cn@gmail.com> References: <1535037851-8798-1-git-send-email-bmeng.cn@gmail.com> Message-ID: <1535037851-8798-2-git-send-email-bmeng.cn@gmail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de This updates the EFI stub codes to pass UEFI BIOS's system table address to U-Boot payload so that U-Boot can utilize it. Signed-off-by: Bin Meng --- include/efi.h | 10 ++++++++++ lib/efi/efi_stub.c | 4 ++++ 2 files changed, 14 insertions(+) diff --git a/include/efi.h b/include/efi.h index 41530a7..1dee606 100644 --- a/include/efi.h +++ b/include/efi.h @@ -248,6 +248,7 @@ 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, @@ -338,6 +339,15 @@ struct efi_entry_gopmode { } info[]; }; +/** + * struct efi_entry_systable - system table passed to U-Boot + * + * @sys_table: EFI system table address + */ +struct efi_entry_systable { + efi_physical_addr_t sys_table; +}; + static inline struct efi_mem_desc *efi_get_next_mem_desc( struct efi_entry_memmap *map, struct efi_mem_desc *desc) { diff --git a/lib/efi/efi_stub.c b/lib/efi/efi_stub.c index 1b495ec..a48d1d7 100644 --- a/lib/efi/efi_stub.c +++ b/lib/efi/efi_stub.c @@ -277,6 +277,7 @@ efi_status_t EFIAPI efi_main(efi_handle_t image, struct efi_entry_memmap map; struct efi_gop *gop; struct efi_entry_gopmode mode; + struct efi_entry_systable table; efi_guid_t efi_gop_guid = EFI_GOP_GUID; efi_uintn_t key, desc_size, size; efi_status_t ret; @@ -335,6 +336,9 @@ efi_status_t EFIAPI efi_main(efi_handle_t image, return ret; } + table.sys_table = (efi_physical_addr_t)sys_table; + add_entry_addr(priv, EFIET_SYS_TABLE, &table, sizeof(table), NULL, 0); + ret = boot->exit_boot_services(image, key); if (ret) { /* -- 2.7.4