summaryrefslogtreecommitdiff
path: root/lib/efi_client/efi_info.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2025-07-26 09:21:09 -0600
committerTom Rini <trini@konsulko.com>2025-07-26 09:21:09 -0600
commit4c3b5fcd810081bd7f3c51859fe1b5f0c159803c (patch)
tree33e98ade70c760a0c90c63149d66a61b6ff95f20 /lib/efi_client/efi_info.c
parent1d782a3f229c269d01e5b7a94744bcd7f53e3f47 (diff)
parentafd5426043b3ef6aa57f2a731f94125ae983395c (diff)
Merge tag 'efi-2025-10-rc1' of https://source.denx.de/u-boot/custodians/u-boot-efiHEADmaster
Pull request efi-2025-10-rc1 CI: https://source.denx.de/u-boot/custodians/u-boot-efi/-/pipelines/27176 Documentation: * update FIT signature testing instructions * describe defconfigs for AM69-SK UEFI: * provide unit test for system table pointer * efi_realloc() must check efi_alloc() return value * correct EFI_DEBUG_TABLE_ENTRY_SIZE * avoid NULL dereference in ESRT creation tests * add missing check in FMP.GetImageInfo() * rename lib/efi to lib/efi_client * rename CONFIG_EFI to CONFIG_EFI_CLIENT * create a new CONFIG_EFI * update maintainers for EFI_CLIENT
Diffstat (limited to 'lib/efi_client/efi_info.c')
-rw-r--r--lib/efi_client/efi_info.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/lib/efi_client/efi_info.c b/lib/efi_client/efi_info.c
new file mode 100644
index 00000000000..5b564c5651d
--- /dev/null
+++ b/lib/efi_client/efi_info.c
@@ -0,0 +1,46 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (c) 2015 Google, Inc
+ *
+ * Access to the EFI information table
+ */
+
+#include <efi.h>
+#include <errno.h>
+#include <mapmem.h>
+#include <asm/global_data.h>
+
+int efi_info_get(enum efi_entry_t type, void **datap, int *sizep)
+{
+ struct efi_entry_hdr *entry;
+ struct efi_info_hdr *info;
+ int ret;
+
+ if (!gd->arch.table)
+ return -ENODATA;
+
+ info = map_sysmem(gd->arch.table, 0);
+ if (info->version != EFI_TABLE_VERSION) {
+ ret = -EPROTONOSUPPORT;
+ goto err;
+ }
+
+ entry = (struct efi_entry_hdr *)((ulong)info + info->hdr_size);
+ while (entry->type != EFIET_END) {
+ if (entry->type == type) {
+ if (entry->addr)
+ *datap = map_sysmem(entry->addr, entry->size);
+ else
+ *datap = entry + 1;
+ *sizep = entry->size;
+ return 0;
+ }
+ entry = (struct efi_entry_hdr *)((ulong)entry + entry->link);
+ }
+
+ ret = -ENOENT;
+err:
+ unmap_sysmem(info);
+
+ return ret;
+}