diff options
author | Simon Glass <sjg@chromium.org> | 2025-05-28 10:03:14 -0600 |
---|---|---|
committer | Heinrich Schuchardt <heinrich.schuchardt@canonical.com> | 2025-07-26 07:29:31 +0200 |
commit | 2ea957952362fe9238cbf3996c001f8bf3f04701 (patch) | |
tree | 7dc4fc5e9604ffca81873200ca217d60a285b57d /lib/efi_client/efi_info.c | |
parent | 088d24eb96fb8ba64e3afee310a9f32ee36c22b0 (diff) |
efi: Rename the lib/efi directory
This directory was created when U-Boot gained the ability to run as an
EFI app in 2015. Since then the EFI-loader feature has been added.
The code in lib/efi is not actually used by the loader, so the name is
confusing.
Rename the directory to efi_client to indicate that it includes files
just for U-Boot being a client of EFI, i.e. the EFI app and stub.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'lib/efi_client/efi_info.c')
-rw-r--r-- | lib/efi_client/efi_info.c | 46 |
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; +} |