Skip to content

Commit 1575012

Browse files
committed
[DROP ON REBASE] Revert "[CHERRY-PICK] SecurityPkg: Tcg2AcpiFfa: Fix endianness of partition ID"
This reverts commit 953b409.
1 parent 195f6d5 commit 1575012

1 file changed

Lines changed: 20 additions & 20 deletions

File tree

SecurityPkg/Tcg/Tcg2AcpiFfa/Tcg2AcpiFfa.c

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -69,21 +69,21 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
6969
#pragma pack(1)
7070

7171
typedef struct {
72-
EFI_ACPI_DESCRIPTION_HEADER Header;
72+
EFI_ACPI_DESCRIPTION_HEADER Header;
7373
// Flags field is replaced in version 4 and above
7474
// BIT0~15: PlatformClass This field is only valid for version 4 and above
7575
// BIT16~31: Reserved
76-
UINT32 Flags;
77-
UINT64 AddressOfControlArea;
78-
UINT32 StartMethod;
79-
EFI_TPM2_ACPI_START_METHOD_SPECIFIC_PARAMETERS_ARM_FFA FfaParameters;
80-
UINT32 Laml; // Optional
81-
UINT64 Lasa; // Optional
82-
} EFI_TPM2_ACPI_TABLE_V5;
76+
UINT32 Flags;
77+
UINT64 AddressOfControlArea;
78+
UINT32 StartMethod;
79+
UINT8 PlatformSpecificParameters[12]; // size up to 12
80+
UINT32 Laml; // Optional
81+
UINT64 Lasa; // Optional
82+
} EFI_TPM2_ACPI_TABLE_V4;
8383

8484
#pragma pack()
8585

86-
EFI_TPM2_ACPI_TABLE_V5 mTpm2AcpiTemplate = {
86+
EFI_TPM2_ACPI_TABLE_V4 mTpm2AcpiTemplate = {
8787
{
8888
EFI_ACPI_5_0_TRUSTED_COMPUTING_PLATFORM_2_TABLE_SIGNATURE,
8989
sizeof (mTpm2AcpiTemplate),
@@ -384,17 +384,17 @@ PublishTpm2 (
384384
PartitionId = PcdGet16 (PcdTpmServiceFfaPartitionId);
385385
ASSERT (PartitionId != 0);
386386
if (InterfaceType == Tpm2PtpInterfaceCrb) {
387-
mTpm2AcpiTemplate.StartMethod = EFI_TPM2_ACPI_TABLE_START_METHOD_COMMAND_RESPONSE_BUFFER_INTERFACE_WITH_FFA;
388-
mTpm2AcpiTemplate.AddressOfControlArea = PcdGet64 (PcdTpmBaseAddress) + 0x40;
389-
mTpm2AcpiTemplate.FfaParameters.Flags = 0x00; // Notifications Not Supported
390-
mTpm2AcpiTemplate.FfaParameters.Attributes = (EFI_TPM2_ACPI_TABLE_ARM_FFA_PARAMETER_ATTR_CRB_REGION_SIZE_4KB << EFI_TPM2_ACPI_TABLE_ARM_FFA_PARAMETER_ATTR_CRB_REGION_SIZE_SHIFT) |
391-
(EFI_TPM2_ACPI_TABLE_ARM_FFA_PARAMETER_ATTR_MEM_TYPE_NOT_CACHABLE << EFI_TPM2_ACPI_TABLE_ARM_FFA_PARAMETER_ATTR_MEM_TYPE_SHIFT);
392-
mTpm2AcpiTemplate.FfaParameters.PartitionId = PartitionId; // Partition ID
393-
ControlArea = (EFI_TPM2_ACPI_CONTROL_AREA *)(UINTN)mTpm2AcpiTemplate.AddressOfControlArea;
394-
ControlArea->CommandSize = 0xF80;
395-
ControlArea->ResponseSize = 0xF80;
396-
ControlArea->Command = PcdGet64 (PcdTpmBaseAddress) + 0x80;
397-
ControlArea->Response = PcdGet64 (PcdTpmBaseAddress) + 0x80;
387+
mTpm2AcpiTemplate.StartMethod = EFI_TPM2_ACPI_TABLE_START_METHOD_COMMAND_RESPONSE_BUFFER_INTERFACE_WITH_FFA;
388+
mTpm2AcpiTemplate.AddressOfControlArea = PcdGet64 (PcdTpmBaseAddress) + 0x40;
389+
mTpm2AcpiTemplate.PlatformSpecificParameters[0] = 0x00; // Notifications Not Supported
390+
mTpm2AcpiTemplate.PlatformSpecificParameters[1] = 0x00; // CRB 4KiB size, Not Cacheable
391+
mTpm2AcpiTemplate.PlatformSpecificParameters[2] = (PartitionId >> 8) & MAX_UINT8; // HI Byte of Partition ID
392+
mTpm2AcpiTemplate.PlatformSpecificParameters[3] = (PartitionId) & MAX_UINT8; // LO Byte of Partition ID
393+
ControlArea = (EFI_TPM2_ACPI_CONTROL_AREA *)(UINTN)mTpm2AcpiTemplate.AddressOfControlArea;
394+
ControlArea->CommandSize = 0xF80;
395+
ControlArea->ResponseSize = 0xF80;
396+
ControlArea->Command = PcdGet64 (PcdTpmBaseAddress) + 0x80;
397+
ControlArea->Response = PcdGet64 (PcdTpmBaseAddress) + 0x80;
398398
} else {
399399
DEBUG ((DEBUG_ERROR, "TPM2 InterfaceType get error! %d\n", InterfaceType));
400400
return EFI_UNSUPPORTED;

0 commit comments

Comments
 (0)