From 4ae84e3e876094a3a3dfd824671edb7ceab47b37 Mon Sep 17 00:00:00 2001 From: Sami Mujawar Date: Thu, 29 May 2025 16:26:50 +0100 Subject: [PATCH] MdePkg, SecurityPkg, OvmfPkg: Move CCEL table defs to ACPI header Although Table 5.5 "DESCRIPTION_HEADER Signatures for tables defined by ACPI" and the "Links to ACPI-Related Documents" still reference the "Virtual Firmware Confidential Computing Event Log Table," the CCEL table has now been formally included in the ACPI specification, see https://uefi.org/specs/ACPI/6.5/05_ACPI_Software_Programming_Model.html# description-header-signatures-for-tables-defined-by-acpi The CCEL (CC Event Log) table is defined in the ACPI 6.5 specification, section 5.2.34 "CC Event Log ACPI Table": https://uefi.org/specs/ACPI/6.5/05_ACPI_Software_Programming_Model.html# cc-event-log-acpi-table Therefore, move the CCEL table and related definitions to the standard ACPI header files and update the relevant code to reflect the structure and macro renaming. Also add the definitions to the ACPI 6.6 headers. Continuous-integration-options: PatchCheck.ignore-multi-package Signed-off-by: Sami Mujawar --- MdePkg/Include/IndustryStandard/Acpi65.h | 35 +++++++++++++++++ MdePkg/Include/IndustryStandard/Acpi66.h | 35 +++++++++++++++++ MdePkg/Include/Protocol/CcMeasurement.h | 38 +++++-------------- OvmfPkg/Tcg/TdTcg2Dxe/TdTcg2Dxe.c | 15 ++++---- .../DxeTpm2MeasureBootLib.c | 2 +- 5 files changed, 89 insertions(+), 36 deletions(-) diff --git a/MdePkg/Include/IndustryStandard/Acpi65.h b/MdePkg/Include/IndustryStandard/Acpi65.h index 8c8727f7c9..a1fe77e18c 100644 --- a/MdePkg/Include/IndustryStandard/Acpi65.h +++ b/MdePkg/Include/IndustryStandard/Acpi65.h @@ -3069,6 +3069,36 @@ typedef struct { #define EFI_ACPI_6_5_PHAT_RESET_REASON_REASON_POWER_LOSS 0x24 #define EFI_ACPI_6_5_PHAT_RESET_REASON_REASON_POWER_BUTTON 0x25 +/// +/// Confidential Computing Type definitions. +/// +#define EFI_ACPI_6_5_CC_TYPE_NONE 0 +#define EFI_ACPI_6_5_CC_TYPE_SEV 1 +#define EFI_ACPI_6_5_CC_TYPE_TDX 2 +#define EFI_ACPI_6_5_CC_TYPE_APTEE 3 + +/// +/// Confidential Computing Event Log ACPI Table (CCEL). +/// +typedef struct { + EFI_ACPI_DESCRIPTION_HEADER Header; + /// Confidential Computing (CC) type. + UINT8 Type; + /// Confidential Computing (CC) sub type. + UINT8 SubType; + /// Reserved. + UINT16 Reserved; + /// Log Area Minimum Length. + UINT64 Laml; + /// Log Area Start Address. + UINT64 Lasa; +} EFI_ACPI_6_5_CONFIDENTIAL_COMPUTING_EVENT_LOG_TABLE; + +/// +/// CCEL Revision (as defined in ACPI 6.5 spec.) +/// +#define EFI_ACPI_6_5_CONFIDENTIAL_COMPUTING_EVENT_LOG_TABLE_REVISION 0x01 + // // Known table signatures // @@ -3098,6 +3128,11 @@ typedef struct { /// #define EFI_ACPI_6_5_BOOT_GRAPHICS_RESOURCE_TABLE_SIGNATURE SIGNATURE_32('B', 'G', 'R', 'T') +/// +/// "CCEL" Confidential Compute Event Log Table +/// +#define EFI_ACPI_6_5_CONFIDENTIAL_COMPUTING_EVENT_LOG_TABLE_SIGNATURE SIGNATURE_32('C', 'C', 'E', 'L') + /// /// "CDIT" Component Distance Information Table /// diff --git a/MdePkg/Include/IndustryStandard/Acpi66.h b/MdePkg/Include/IndustryStandard/Acpi66.h index fcac6433ca..8c419ffebb 100644 --- a/MdePkg/Include/IndustryStandard/Acpi66.h +++ b/MdePkg/Include/IndustryStandard/Acpi66.h @@ -3232,6 +3232,36 @@ typedef struct { #define EFI_ACPI_6_6_RHCT_HART_INFO_NODE_STRUCTURE_VERSION 1 +/// +/// Confidential Computing Type definitions. +/// +#define EFI_ACPI_6_6_CC_TYPE_NONE 0 +#define EFI_ACPI_6_6_CC_TYPE_SEV 1 +#define EFI_ACPI_6_6_CC_TYPE_TDX 2 +#define EFI_ACPI_6_6_CC_TYPE_APTEE 3 + +/// +/// Confidential Computing Event Log ACPI Table (CCEL). +/// +typedef struct { + EFI_ACPI_DESCRIPTION_HEADER Header; + /// Confidential Computing (CC) type. + UINT8 Type; + /// Confidential Computing (CC) sub type. + UINT8 SubType; + /// Reserved. + UINT16 Reserved; + /// Log Area Minimum Length. + UINT64 Laml; + /// Log Area Start Address. + UINT64 Lasa; +} EFI_ACPI_6_6_CONFIDENTIAL_COMPUTING_EVENT_LOG_TABLE; + +/// +/// CCEL Revision (as defined in ACPI 6.6 spec.) +/// +#define EFI_ACPI_6_6_CONFIDENTIAL_COMPUTING_EVENT_LOG_TABLE_REVISION 0x01 + // // Known table signatures // @@ -3261,6 +3291,11 @@ typedef struct { /// #define EFI_ACPI_6_6_BOOT_GRAPHICS_RESOURCE_TABLE_SIGNATURE SIGNATURE_32('B', 'G', 'R', 'T') +/// +/// "CCEL" Confidential Compute Event Log Table +/// +#define EFI_ACPI_6_6_CONFIDENTIAL_COMPUTING_EVENT_LOG_TABLE_SIGNATURE SIGNATURE_32('C', 'C', 'E', 'L') + /// /// "CDIT" Component Distance Information Table /// diff --git a/MdePkg/Include/Protocol/CcMeasurement.h b/MdePkg/Include/Protocol/CcMeasurement.h index be70379dc0..af9d8d1bc6 100644 --- a/MdePkg/Include/Protocol/CcMeasurement.h +++ b/MdePkg/Include/Protocol/CcMeasurement.h @@ -16,6 +16,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #pragma once +#include #include #define EFI_CC_MEASUREMENT_PROTOCOL_GUID \ @@ -29,16 +30,18 @@ typedef struct { UINT8 Minor; } EFI_CC_VERSION; -// -// EFI_CC Type/SubType definition -// -#define EFI_CC_TYPE_NONE 0 -#define EFI_CC_TYPE_SEV 1 -#define EFI_CC_TYPE_TDX 2 -#define EFI_CC_TYPE_APTEE 3 +/** + A structure defining the Confidential Computing (CC) type and subtype. + The Type and Subtype field values must match the definitions in the ACPI + specification version 6.5 or later, + e.g. the macros EFI_ACPI_6_5_CC_TYPE_* must be used to populate the + Type field. +*/ typedef struct { + /// Confidential Computing (CC) type. UINT8 Type; + /// Confidential Computing (CC) sub type. UINT8 SubType; } EFI_CC_TYPE; @@ -298,24 +301,3 @@ typedef struct { {0xdd4a4648, 0x2de7, 0x4665, {0x96, 0x4d, 0x21, 0xd9, 0xef, 0x5f, 0xb4, 0x46}} extern EFI_GUID gEfiCcFinalEventsTableGuid; - -// -// Define the CC Measure EventLog ACPI Table -// -#pragma pack(1) - -typedef struct { - EFI_ACPI_DESCRIPTION_HEADER Header; - EFI_CC_TYPE CcType; - UINT16 Rsvd; - UINT64 Laml; - UINT64 Lasa; -} EFI_CC_EVENTLOG_ACPI_TABLE; - -#pragma pack() - -// -// Define the signature and revision of CC Measurement EventLog ACPI Table -// -#define EFI_CC_EVENTLOG_ACPI_TABLE_SIGNATURE SIGNATURE_32('C', 'C', 'E', 'L') -#define EFI_CC_EVENTLOG_ACPI_TABLE_REVISION 1 diff --git a/OvmfPkg/Tcg/TdTcg2Dxe/TdTcg2Dxe.c b/OvmfPkg/Tcg/TdTcg2Dxe/TdTcg2Dxe.c index 44a751d865..b3a69c5802 100644 --- a/OvmfPkg/Tcg/TdTcg2Dxe/TdTcg2Dxe.c +++ b/OvmfPkg/Tcg/TdTcg2Dxe/TdTcg2Dxe.c @@ -108,20 +108,21 @@ VARIABLE_TYPE mVariableType[] = { { EFI_IMAGE_SECURITY_DATABASE1, &gEfiImageSecurityDatabaseGuid }, }; -EFI_CC_EVENTLOG_ACPI_TABLE mTdxEventlogAcpiTemplate = { +EFI_ACPI_6_5_CONFIDENTIAL_COMPUTING_EVENT_LOG_TABLE mTdxEventlogAcpiTemplate = { { - EFI_CC_EVENTLOG_ACPI_TABLE_SIGNATURE, + EFI_ACPI_6_5_CONFIDENTIAL_COMPUTING_EVENT_LOG_TABLE_SIGNATURE, sizeof (mTdxEventlogAcpiTemplate), - EFI_CC_EVENTLOG_ACPI_TABLE_REVISION, + EFI_ACPI_6_5_CONFIDENTIAL_COMPUTING_EVENT_LOG_TABLE_REVISION, // // Compiler initializes the remaining bytes to 0 // These fields should be filled in production // }, - { EFI_CC_TYPE_TDX, 0 }, // CcType - 0, // rsvd - 0, // laml - 0, // lasa + EFI_ACPI_6_5_CC_TYPE_TDX, // CcType + 0, // CC Sub Type + 0, // Reserved + 0, // laml + 0, // lasa }; EFI_HANDLE mImageHandle; diff --git a/SecurityPkg/Library/DxeTpm2MeasureBootLib/DxeTpm2MeasureBootLib.c b/SecurityPkg/Library/DxeTpm2MeasureBootLib/DxeTpm2MeasureBootLib.c index acba11d695..9f2eb57e75 100644 --- a/SecurityPkg/Library/DxeTpm2MeasureBootLib/DxeTpm2MeasureBootLib.c +++ b/SecurityPkg/Library/DxeTpm2MeasureBootLib/DxeTpm2MeasureBootLib.c @@ -548,7 +548,7 @@ GetMeasureBootProtocols ( ZeroMem (&CcProtocolCapability, sizeof (CcProtocolCapability)); CcProtocolCapability.Size = sizeof (CcProtocolCapability); Status = CcProtocol->GetCapability (CcProtocol, &CcProtocolCapability); - if (EFI_ERROR (Status) || (CcProtocolCapability.CcType.Type == EFI_CC_TYPE_NONE)) { + if (EFI_ERROR (Status) || (CcProtocolCapability.CcType.Type == EFI_ACPI_6_5_CC_TYPE_NONE)) { DEBUG ((DEBUG_ERROR, " CcProtocol->GetCapability returns : %x, %r\n", CcProtocolCapability.CcType.Type, Status)); CcProtocol = NULL; }