mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-30 00:21:06 +00:00
401d1c4f5d
Move this out of the common header and include it only where needed. In a number of cases this requires adding "struct udevice;" to avoid adding another large header or in other cases replacing / adding missing header files that had been pulled in, very indirectly. Finally, we have a few cases where we did not need to include <asm/global_data.h> at all, so remove that include. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Rini <trini@konsulko.com>
47 lines
931 B
C
47 lines
931 B
C
// SPDX-License-Identifier: GPL-2.0+
|
|
/*
|
|
* Copyright (c) 2015 Google, Inc
|
|
*
|
|
* Access to the EFI information table
|
|
*/
|
|
|
|
#include <common.h>
|
|
#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;
|
|
}
|