]>
Commit | Line | Data |
---|---|---|
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 | |
b3548d32 LG |
6 | Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>\r |
7 | This program and the accompanying materials\r | |
8 | are licensed and made available under the terms and conditions of the BSD License\r | |
9 | which accompanies this distribution. The full text of the license may be found at\r | |
1abfa4ce JY |
10 | http://opensource.org/licenses/bsd-license.php\r |
11 | \r | |
b3548d32 | 12 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r |
1abfa4ce JY |
13 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r |
14 | \r | |
15 | **/\r | |
16 | \r | |
17 | #include <PiPei.h>\r | |
18 | \r | |
19 | #include <Guid/Tcg2PhysicalPresenceData.h>\r | |
20 | #include <Ppi/ReadOnlyVariable2.h>\r | |
21 | \r | |
22 | #include <Library/DebugLib.h>\r | |
23 | #include <Library/PeiServicesLib.h>\r | |
24 | #include <Library/PeiServicesTablePointerLib.h>\r | |
25 | #include <Library/Tcg2PhysicalPresenceLib.h>\r | |
26 | \r | |
27 | /**\r | |
28 | Return TPM2 ManagementFlags set by PP interface.\r | |
29 | \r | |
30 | @retval ManagementFlags TPM2 Management Flags.\r | |
31 | **/\r | |
32 | UINT32\r | |
33 | EFIAPI\r | |
34 | Tcg2PhysicalPresenceLibGetManagementFlags (\r | |
35 | VOID\r | |
36 | )\r | |
37 | {\r | |
38 | EFI_STATUS Status;\r | |
39 | EFI_PEI_READ_ONLY_VARIABLE2_PPI *VariablePpi;\r | |
40 | EFI_TCG2_PHYSICAL_PRESENCE_FLAGS PpiFlags;\r | |
41 | UINTN DataSize;\r | |
b3548d32 | 42 | \r |
1abfa4ce JY |
43 | Status = PeiServicesLocatePpi (&gEfiPeiReadOnlyVariable2PpiGuid, 0, NULL, (VOID **) &VariablePpi);\r |
44 | ASSERT_EFI_ERROR (Status);\r | |
45 | \r | |
46 | DataSize = sizeof (EFI_TCG2_PHYSICAL_PRESENCE_FLAGS);\r | |
47 | Status = VariablePpi->GetVariable (\r | |
48 | VariablePpi,\r | |
49 | TCG2_PHYSICAL_PRESENCE_FLAGS_VARIABLE,\r | |
50 | &gEfiTcg2PhysicalPresenceGuid,\r | |
51 | NULL,\r | |
52 | &DataSize,\r | |
53 | &PpiFlags\r | |
54 | );\r | |
55 | if (EFI_ERROR (Status)) {\r | |
e92ddda2 | 56 | PpiFlags.PPFlags = TCG2_BIOS_TPM_MANAGEMENT_FLAG_DEFAULT | TCG2_BIOS_STORAGE_MANAGEMENT_FLAG_DEFAULT;\r |
1abfa4ce JY |
57 | }\r |
58 | return PpiFlags.PPFlags;\r | |
59 | }\r |