34#define START_METHOD_ACPI_PARAM_SIZE_MIN 4
35#define START_METHOD_CRB_WITH_SMC_PARAM_SIZE 12
69 ASSERT (TpmInfo !=
NULL);
73 return EFI_INVALID_PARAMETER;
77 if (((TpmInfo->
Laml > 0) && (TpmInfo->
Lasa == 0)) ||
78 ((TpmInfo->
Laml == 0) && (TpmInfo->
Lasa != 0)))
80 return EFI_INVALID_PARAMETER;
85 case EFI_TPM2_ACPI_TABLE_START_METHOD_ACPI:
89 return EFI_INVALID_PARAMETER;
93 return EFI_INVALID_PARAMETER;
98 case EFI_TPM2_ACPI_TABLE_START_METHOD_COMMAND_RESPONSE_BUFFER_INTERFACE_WITH_SMC:
101 return EFI_INVALID_PARAMETER;
106 case EFI_TPM2_ACPI_TABLE_START_METHOD_TIS:
107 case EFI_TPM2_ACPI_TABLE_START_METHOD_COMMAND_RESPONSE_BUFFER_INTERFACE:
108 case EFI_TPM2_ACPI_TABLE_START_METHOD_COMMAND_RESPONSE_BUFFER_INTERFACE_WITH_ACPI:
112 return EFI_INVALID_PARAMETER;
163 (AcpiTableInfo !=
NULL) &&
164 (CfgMgrProtocol !=
NULL) &&
166 (AcpiTableInfo->TableGeneratorId == This->GeneratorID) &&
167 (AcpiTableInfo->AcpiTableSignature == This->AcpiTableSignature)
170 if ((AcpiTableInfo->AcpiTableRevision < This->MinAcpiTableRevision) ||
171 (AcpiTableInfo->AcpiTableRevision > This->AcpiTableRevision))
175 "ERROR: TPM2: Requested table revision = %d is not supported. "
176 "Supported table revisions: Minimum = %d. Maximum = %d\n",
177 AcpiTableInfo->AcpiTableRevision,
178 This->MinAcpiTableRevision,
179 This->AcpiTableRevision
181 return EFI_INVALID_PARAMETER;
184 Status = GetEArchCommonObjTpm2InterfaceInfo (
190 if (EFI_ERROR (Status)) {
193 "%a: Failed to get TPM interface CM Object %r\n",
202 if (EFI_ERROR (Status)) {
205 "ERROR: TPM2: Unexpected StartMethod %u with parameters size %u\n",
209 return EFI_INVALID_PARAMETER;
214 if (TpmInfo->
Laml == 0) {
219 TableSize += EFI_TPM2_ACPI_TABLE_START_METHOD_SPECIFIC_PARAMETERS_MAX_SIZE_REVISION_4;
220 TableSize +=
sizeof (TpmInfo->
Laml) +
sizeof (TpmInfo->
Lasa);
225 if (*Table ==
NULL) {
228 "ERROR: TPM2: Failed to allocate memory for TPM2 Table, Size = %d," \
233 return EFI_OUT_OF_RESOURCES;
245 if (EFI_ERROR (Status)) {
248 "ERROR: TPM2: Failed to add ACPI header. Status = %r\n",
264 if (TpmInfo->
Laml > 0) {
266 EFI_TPM2_ACPI_TABLE_START_METHOD_SPECIFIC_PARAMETERS_MAX_SIZE_REVISION_4);
267 Lasa = (UINT64 *)((UINT8 *)Laml +
sizeof (TpmInfo->
Laml));
268 *Laml = TpmInfo->
Laml;
269 *Lasa = TpmInfo->
Lasa;
276 if (*Table !=
NULL) {
307 (AcpiTableInfo !=
NULL) &&
308 (CfgMgrProtocol !=
NULL) &&
309 (AcpiTableInfo->TableGeneratorId == This->GeneratorID) &&
310 (AcpiTableInfo->AcpiTableSignature == This->AcpiTableSignature)
313 if ((Table ==
NULL) || (*Table ==
NULL)) {
314 DEBUG ((DEBUG_ERROR,
"ERROR: TPM2: Invalid Table Pointer\n"));
315 return EFI_INVALID_PARAMETER;
326#define TPM2_GENERATOR_REVISION CREATE_REVISION (1, 0)
336 L
"ACPI.STD.TPM2.GENERATOR",
340 EFI_TPM2_ACPI_TABLE_REVISION_4,
342 EFI_TPM2_ACPI_TABLE_REVISION_4,
378 DEBUG ((DEBUG_INFO,
"TPM2: Register Generator. Status = %r\n", Status));
402 DEBUG ((DEBUG_INFO,
"TPM2: Deregister Generator. Status = %r\n", Status));
#define EFI_ACPI_6_4_TRUSTED_COMPUTING_PLATFORM_2_TABLE_SIGNATURE
EFI_STATUS EFIAPI RegisterAcpiTableGenerator(IN CONST ACPI_TABLE_GENERATOR *CONST Generator)
EFI_STATUS EFIAPI DeregisterAcpiTableGenerator(IN CONST ACPI_TABLE_GENERATOR *CONST Generator)
#define CREATE_STD_ACPI_TABLE_GEN_ID(TableId)
#define TABLE_GENERATOR_CREATOR_ID
@ EStdAcpiTableIdTpm2
TPM2 Generator.
@ EArchCommonObjTpm2InterfaceInfo
26 - TPM Interface Info
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
#define GET_OBJECT_LIST(CmObjectNameSpace, CmObjectId, Type)
@ EObjNameSpaceArchCommon
Arch Common Objects Namespace.
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
#define ASSERT_EFI_ERROR(StatusParameter)
#define DEBUG(Expression)
EFI_STATUS EFIAPI AddAcpiHeader(IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol, IN CONST ACPI_TABLE_GENERATOR *CONST Generator, IN OUT EFI_ACPI_DESCRIPTION_HEADER *CONST AcpiHeader, IN CONST CM_STD_OBJ_ACPI_TABLE_INFO *CONST AcpiTableInfo, IN CONST UINT32 Length)
STATIC EFI_STATUS EFIAPI FreeTpm2TableResources(IN CONST ACPI_TABLE_GENERATOR *CONST This, IN CONST CM_STD_OBJ_ACPI_TABLE_INFO *CONST AcpiTableInfo, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol, IN OUT EFI_ACPI_DESCRIPTION_HEADER **CONST Table)
STATIC EFI_STATUS EFIAPI BuildTpm2Table(IN CONST ACPI_TABLE_GENERATOR *CONST This, IN CONST CM_STD_OBJ_ACPI_TABLE_INFO *CONST AcpiTableInfo, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol, OUT EFI_ACPI_DESCRIPTION_HEADER **CONST Table)
EFI_STATUS EFIAPI AcpiTpm2LibConstructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
STATIC CONST ACPI_TABLE_GENERATOR Tpm2Generator
STATIC EFI_STATUS AcpiTpm2CheckStartMethodParameters(CM_ARCH_COMMON_TPM2_INTERFACE_INFO *TpmInfo)
EFI_STATUS EFIAPI AcpiTpm2LibDestructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
#define TPM2_GENERATOR_REVISION
UINT8 StartMethodParameters[EFI_TPM2_ACPI_TABLE_START_METHOD_SPECIFIC_PARAMETERS_MAX_SIZE]
UINT8 StartMethodParametersSize
UINT64 AddressOfControlArea