mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2026-06-02 09:46:37 +03:00
Export the ECPT GUID, to prepare accessing it from more than one location. The C file containing the GUID is compiled only when CONFIG_EFI_ECPT is set; gate the export accordingly. Signed-off-by: Vincent Stehlé <vincent.stehle@arm.com> Cc: Heinrich Schuchardt <xypron.glpk@gmx.de> Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org> Cc: Tom Rini <trini@konsulko.com> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
62 lines
1.3 KiB
C
62 lines
1.3 KiB
C
// SPDX-License-Identifier: GPL-2.0-only
|
|
/*
|
|
* EFI conformance profile table
|
|
*
|
|
* Copyright (C) 2022 Arm Ltd.
|
|
*/
|
|
|
|
#define LOG_CATEGORY LOGC_EFI
|
|
|
|
#include <efi_loader.h>
|
|
#include <log.h>
|
|
#include <efi_api.h>
|
|
#include <malloc.h>
|
|
|
|
const efi_guid_t efi_ecpt_guid = EFI_CONFORMANCE_PROFILES_TABLE_GUID;
|
|
|
|
/**
|
|
* efi_ecpt_register() - Install the ECPT system table.
|
|
*
|
|
* Return: status code
|
|
*/
|
|
efi_status_t efi_ecpt_register(void)
|
|
{
|
|
struct efi_conformance_profiles_table *ecpt;
|
|
efi_status_t ret;
|
|
size_t ecpt_size;
|
|
|
|
static const efi_guid_t profiles[] = {
|
|
#if CONFIG_IS_ENABLED(EFI_EBBR_2_1_CONFORMANCE)
|
|
EFI_CONFORMANCE_PROFILE_EBBR_2_1_GUID,
|
|
#endif
|
|
};
|
|
|
|
ecpt_size = sizeof(profiles)
|
|
+ sizeof(struct efi_conformance_profiles_table);
|
|
ret = efi_allocate_pool(EFI_BOOT_SERVICES_DATA, ecpt_size,
|
|
(void **)&ecpt);
|
|
|
|
if (ret != EFI_SUCCESS) {
|
|
log_err("Out of memory\n");
|
|
|
|
return ret;
|
|
}
|
|
|
|
memcpy(ecpt->conformance_profiles, profiles, sizeof(profiles));
|
|
ecpt->version = EFI_CONFORMANCE_PROFILES_TABLE_VERSION;
|
|
ecpt->number_of_profiles = ARRAY_SIZE(profiles);
|
|
|
|
/* Install the ECPT in the system configuration table. */
|
|
ret = efi_install_configuration_table(&efi_ecpt_guid, (void *)ecpt);
|
|
if (ret != EFI_SUCCESS) {
|
|
log_err("Failed to install ECPT\n");
|
|
efi_free_pool(ecpt);
|
|
|
|
return ret;
|
|
}
|
|
|
|
log_debug("ECPT created\n");
|
|
|
|
return EFI_SUCCESS;
|
|
}
|