ArmPkg: only attempt buildin MmCommunicationDxe for AArch64
[mirror_edk2.git] / SecurityPkg / Library / PeiTcg2PhysicalPresenceLib / PeiTcg2PhysicalPresenceLib.c
CommitLineData
1abfa4ce
JY
1/** @file\r
2 Get TPM 2.0 physical presence information.\r
b3548d32 3\r
1abfa4ce
JY
4 This library will get TPM 2.0 physical presence information.\r
5\r
1a2ad3ba 6Copyright (c) 2015 - 2020, Intel Corporation. All rights reserved.<BR>\r
289b714b 7SPDX-License-Identifier: BSD-2-Clause-Patent\r
1abfa4ce
JY
8\r
9**/\r
10\r
11#include <PiPei.h>\r
12\r
13#include <Guid/Tcg2PhysicalPresenceData.h>\r
14#include <Ppi/ReadOnlyVariable2.h>\r
15\r
16#include <Library/DebugLib.h>\r
17#include <Library/PeiServicesLib.h>\r
18#include <Library/PeiServicesTablePointerLib.h>\r
19#include <Library/Tcg2PhysicalPresenceLib.h>\r
20\r
21/**\r
22 Return TPM2 ManagementFlags set by PP interface.\r
23\r
24 @retval ManagementFlags TPM2 Management Flags.\r
25**/\r
26UINT32\r
27EFIAPI\r
28Tcg2PhysicalPresenceLibGetManagementFlags (\r
29 VOID\r
30 )\r
31{\r
32 EFI_STATUS Status;\r
33 EFI_PEI_READ_ONLY_VARIABLE2_PPI *VariablePpi;\r
34 EFI_TCG2_PHYSICAL_PRESENCE_FLAGS PpiFlags;\r
35 UINTN DataSize;\r
b3548d32 36\r
1abfa4ce
JY
37 Status = PeiServicesLocatePpi (&gEfiPeiReadOnlyVariable2PpiGuid, 0, NULL, (VOID **) &VariablePpi);\r
38 ASSERT_EFI_ERROR (Status);\r
39\r
40 DataSize = sizeof (EFI_TCG2_PHYSICAL_PRESENCE_FLAGS);\r
41 Status = VariablePpi->GetVariable (\r
42 VariablePpi,\r
43 TCG2_PHYSICAL_PRESENCE_FLAGS_VARIABLE,\r
44 &gEfiTcg2PhysicalPresenceGuid,\r
45 NULL,\r
46 &DataSize,\r
47 &PpiFlags\r
48 );\r
49 if (EFI_ERROR (Status)) {\r
1a2ad3ba 50 PpiFlags.PPFlags = PcdGet32(PcdTcg2PhysicalPresenceFlags);\r
1abfa4ce
JY
51 }\r
52 return PpiFlags.PPFlags;\r
53}\r