From 6b92c1735205eef308a9e33ec90330a3e6d27fc3 Mon Sep 17 00:00:00 2001 From: Jose Marinho Date: Thu, 23 Dec 2021 14:51:07 +0000 Subject: efi: Create ECPT table The ECPT table will be included in the UEFI specification 2.9+. The ECPT table was introduced in UEFI following the code-first path. The acceptance ticket can be viewed at: https://bugzilla.tianocore.org/show_bug.cgi?id=3591 The Conformance Profiles table is a UEFI configuration table that contains GUID of the UEFI profiles that the UEFI implementation conforms with. The ECPT table is created when CONFIG_EFI_ECPT=y. The config is set by default. Signed-off-by: Jose Marinho Reviewed-by: Heinrich Schuchardt --- include/efi_api.h | 12 ++++++++++++ include/efi_loader.h | 7 +++++++ 2 files changed, 19 insertions(+) (limited to 'include') diff --git a/include/efi_api.h b/include/efi_api.h index 83c01085fde..58934bd0d58 100644 --- a/include/efi_api.h +++ b/include/efi_api.h @@ -226,6 +226,18 @@ enum efi_reset_type { EFI_GUID(0x6dcbd5ed, 0xe82d, 0x4c44, 0xbd, 0xa1, \ 0x71, 0x94, 0x19, 0x9a, 0xd9, 0x2a) +#define EFI_CONFORMANCE_PROFILES_TABLE_GUID \ + EFI_GUID(0x36122546, 0xf7ef, 0x4c8f, 0xbd, 0x9b, \ + 0xeb, 0x85, 0x25, 0xb5, 0x0c, 0x0b) + +#define EFI_CONFORMANCE_PROFILES_TABLE_VERSION 1 + +struct efi_conformance_profiles_table { + u16 version; + u16 number_of_profiles; + efi_guid_t conformance_profiles[]; +} __packed; + struct efi_capsule_header { efi_guid_t capsule_guid; u32 header_size; diff --git a/include/efi_loader.h b/include/efi_loader.h index 9611aec2deb..545ba06d946 100644 --- a/include/efi_loader.h +++ b/include/efi_loader.h @@ -1052,6 +1052,13 @@ extern u8 num_image_type_guids; */ efi_status_t efi_esrt_register(void); +/** + * efi_ecpt_register() - Install the ECPT system table. + * + * Return: status code + */ +efi_status_t efi_ecpt_register(void); + /** * efi_esrt_populate() - Populates the ESRT entries from the FMP instances * present in the system. -- cgit v1.3.1 From 648a8dcb39306ebd32353d6c503ac3b69e064190 Mon Sep 17 00:00:00 2001 From: Jose Marinho Date: Fri, 17 Dec 2021 12:55:05 +0000 Subject: efi: ECPT add EBBRv2.0 conformance profile Display the EBBRv2.0 conformance in the ECPT table. The EBBRv2.0 conformance profile is set in the ECPT if CONFIG_EFI_EBBR_2_0_CONFORMANCE=y. Signed-off-by: Jose Marinho Add dependencies for CONFIG_EFI_EBBR_2_0_CONFORMANCE. Enable the setting by default. Reviewed-by: Heinrich Schuchardt --- include/efi_api.h | 4 ++++ lib/efi_loader/Kconfig | 11 +++++++++++ lib/efi_loader/efi_conformance.c | 6 ++++++ 3 files changed, 21 insertions(+) (limited to 'include') diff --git a/include/efi_api.h b/include/efi_api.h index 58934bd0d58..9bb0d44ac8d 100644 --- a/include/efi_api.h +++ b/include/efi_api.h @@ -232,6 +232,10 @@ enum efi_reset_type { #define EFI_CONFORMANCE_PROFILES_TABLE_VERSION 1 +#define EFI_CONFORMANCE_PROFILE_EBBR_2_0_GUID \ + EFI_GUID(0xcce33c35, 0x74ac, 0x4087, 0xbc, 0xe7, \ + 0x8b, 0x29, 0xb0, 0x2e, 0xeb, 0x27) + struct efi_conformance_profiles_table { u16 version; u16 number_of_profiles; diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig index 2b2e9ae03ba..b8fb2701a74 100644 --- a/lib/efi_loader/Kconfig +++ b/lib/efi_loader/Kconfig @@ -391,6 +391,17 @@ config EFI_ECPT help Enabling this option created the ECPT UEFI table. +config EFI_EBBR_2_0_CONFORMANCE + bool "Add the EBBRv2.0 conformance entry to the ECPT table" + depends on EFI_ECPT + depends on EFI_LOADER_HII + depends on EFI_RISCV_BOOT_PROTOCOL || !RISCV + depends on EFI_RNG_PROTOCOL || !DM_RNG + depends on EFI_UNICODE_COLLATION_PROTOCOL2 + default y + help + Enabling this option adds the EBBRv2.0 conformance entry to the ECPT UEFI table. + config EFI_RISCV_BOOT_PROTOCOL bool "RISCV_EFI_BOOT_PROTOCOL support" default y diff --git a/lib/efi_loader/efi_conformance.c b/lib/efi_loader/efi_conformance.c index 385d76c793c..a49aae92497 100644 --- a/lib/efi_loader/efi_conformance.c +++ b/lib/efi_loader/efi_conformance.c @@ -12,6 +12,8 @@ #include static const efi_guid_t efi_ecpt_guid = EFI_CONFORMANCE_PROFILES_TABLE_GUID; +static const efi_guid_t efi_ebbr_2_0_guid = + EFI_CONFORMANCE_PROFILE_EBBR_2_0_GUID; /** * efi_ecpt_register() - Install the ECPT system table. @@ -36,6 +38,10 @@ efi_status_t efi_ecpt_register(void) return ret; } + if (CONFIG_IS_ENABLED(EFI_EBBR_2_0_CONFORMANCE)) + guidcpy(&ecpt->conformance_profiles[num_entries++], + &efi_ebbr_2_0_guid); + ecpt->version = EFI_CONFORMANCE_PROFILES_TABLE_VERSION; ecpt->number_of_profiles = num_entries; -- cgit v1.3.1