u-boot/lib/efi_client/efi_info.c
Simon Glass 2ea9579523 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>
2025-07-26 07:29:31 +02:00

47 lines
911 B
C

// 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;
}