Skip to content

Commit

Permalink
DynamicTablesPkg: ACPI TPM2 generator
Browse files Browse the repository at this point in the history
Generate ACPI TPM2 table using the information obtained from
Tpm2InterfaceInfo CM object.

Signed-off-by: Dat Mach <[email protected]>
  • Loading branch information
nvidia-dmach authored and mergify[bot] committed Aug 8, 2024
1 parent 2bff589 commit 75a9afa
Show file tree
Hide file tree
Showing 6 changed files with 479 additions and 0 deletions.
3 changes: 3 additions & 0 deletions DynamicTablesPkg/DynamicTables.dsc.inc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#
# Copyright (c) 2017 - 2022, Arm Limited. All rights reserved.<BR>
# Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.<BR>
# Copyright (c) 2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.<BR>
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
Expand Down Expand Up @@ -36,6 +37,7 @@
DynamicTablesPkg/Library/Acpi/Common/AcpiRawLib/AcpiRawLib.inf
DynamicTablesPkg/Library/Acpi/Common/AcpiSpcrLib/AcpiSpcrLib.inf
DynamicTablesPkg/Library/Acpi/Common/AcpiSratLib/AcpiSratLib.inf
DynamicTablesPkg/Library/Acpi/Common/AcpiTpm2Lib/AcpiTpm2Lib.inf

# AML Fixup (Common)
DynamicTablesPkg/Library/Acpi/Common/AcpiSsdtSerialPortLib/SsdtSerialPortLib.inf
Expand Down Expand Up @@ -86,6 +88,7 @@
NULL|DynamicTablesPkg/Library/Acpi/Common/AcpiRawLib/AcpiRawLib.inf
NULL|DynamicTablesPkg/Library/Acpi/Common/AcpiSpcrLib/AcpiSpcrLib.inf
NULL|DynamicTablesPkg/Library/Acpi/Common/AcpiSratLib/AcpiSratLib.inf
NULL|DynamicTablesPkg/Library/Acpi/Common/AcpiTpm2Lib/AcpiTpm2Lib.inf
# Arm specific
NULL|DynamicTablesPkg/Library/Acpi/Arm/AcpiGtdtLibArm/AcpiGtdtLibArm.inf
NULL|DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/AcpiIortLibArm.inf
Expand Down
2 changes: 2 additions & 0 deletions DynamicTablesPkg/Include/AcpiTableGenerator.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/** @file
Copyright (c) 2017 - 2022, Arm Limited. All rights reserved.<BR>
Copyright (c) 2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
Expand Down Expand Up @@ -99,6 +100,7 @@ typedef enum StdAcpiTableId {
EStdAcpiTableIdSsdtCpuTopology, ///< SSDT Cpu Topology
EStdAcpiTableIdSsdtPciExpress, ///< SSDT Pci Express Generator
EStdAcpiTableIdPcct, ///< PCCT Generator
EStdAcpiTableIdTpm2, ///< TPM2 Generator
EStdAcpiTableIdMax
} ESTD_ACPI_TABLE_ID;

Expand Down
39 changes: 39 additions & 0 deletions DynamicTablesPkg/Include/ArchCommonNameSpaceObjects.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/** @file
Copyright (c) 2024, Arm Limited. All rights reserved.<BR>
Copyright (c) 2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
Expand All @@ -16,6 +17,8 @@
#include <AcpiObjects.h>
#include <StandardNameSpaceObjects.h>

#include <IndustryStandard/Tpm2Acpi.h>

/** The EARCH_COMMON_OBJECT_ID enum describes the Object IDs
in the Arch Common Namespace
*/
Expand Down Expand Up @@ -46,6 +49,7 @@ typedef enum ArchCommonObjectID {
EArchCommonObjPccSubspaceType4Info, ///< 23 - Pcc Subspace Type 4 Info
EArchCommonObjPccSubspaceType5Info, ///< 24 - Pcc Subspace Type 5 Info
EArchCommonObjPsdInfo, ///< 25 - P-State Dependency (PSD) Info
EArchCommonObjTpm2InterfaceInfo, ///< 26 - TPM Interface Info
EArchCommonObjMax
} EARCH_COMMON_OBJECT_ID;

Expand Down Expand Up @@ -652,6 +656,41 @@ typedef struct CmArchCommonPccSubspaceType5Info {
*/
typedef AML_PSD_INFO CM_ARCH_COMMON_PSD_INFO;

/** A structure that describes TPM interface and access method.
TCG ACPI Specification 2.0
ID: EArchCommonObjTpm2InterfaceInfo
*/
typedef struct CmArchCommonTpm2InterfaceInfo {
/** Platform Class
0: Client platform
1: Server platform
*/
UINT16 PlatformClass;

/** Physical address of the Control Area */
UINT64 AddressOfControlArea;

/** The Start Method selector determines which mechanism the
device driver uses to notify the TPM 2.0 device that a
command is available for processing.
*/
UINT32 StartMethod;

/** The number of bytes stored in StartMethodParameters[] */
UINT8 StartMethodParametersSize;

/** Start method specific parameters */
UINT8 StartMethodParameters[EFI_TPM2_ACPI_TABLE_START_METHOD_SPECIFIC_PARAMETERS_MAX_SIZE];

/** Log Area Minimum Length */
UINT32 Laml;

/** Log Area Start Address */
UINT64 Lasa;
} CM_ARCH_COMMON_TPM2_INTERFACE_INFO;

#pragma pack()

#endif // ARCH_COMMON_NAMESPACE_OBJECTS_H_
29 changes: 29 additions & 0 deletions DynamicTablesPkg/Library/Acpi/Common/AcpiTpm2Lib/AcpiTpm2Lib.inf
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
## @file
# TPM2 Table Generator
#
# Copyright (c) 2022, ARM Limited. All rights reserved.
# Copyright (c) 2023 - 2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: BSD-2-Clause-Patent
##

[Defines]
INF_VERSION = 0x0001001B
BASE_NAME = AcpiTpm2Lib
FILE_GUID = 968fa07a-9076-11ed-8041-9bd740d3d45d
VERSION_STRING = 1.0
MODULE_TYPE = DXE_DRIVER
LIBRARY_CLASS = NULL|DXE_DRIVER
CONSTRUCTOR = AcpiTpm2LibConstructor
DESTRUCTOR = AcpiTpm2LibDestructor

[Sources]
Tpm2Generator.c

[Packages]
EmbeddedPkg/EmbeddedPkg.dec
DynamicTablesPkg/DynamicTablesPkg.dec
MdeModulePkg/MdeModulePkg.dec
MdePkg/MdePkg.dec

[LibraryClasses]
BaseLib
Loading

0 comments on commit 75a9afa

Please sign in to comment.