]> git.proxmox.com Git - mirror_edk2.git/blame - SecurityPkg/Library/PeiTcg2PhysicalPresenceLib/PeiTcg2PhysicalPresenceLib.c
SecurityPkg Tcg2PPLib: Support BlockSID related actions
[mirror_edk2.git] / SecurityPkg / Library / PeiTcg2PhysicalPresenceLib / PeiTcg2PhysicalPresenceLib.c
CommitLineData
1abfa4ce
JY
1/** @file\r
2 Get TPM 2.0 physical presence information.\r
3 \r
4 This library will get TPM 2.0 physical presence information.\r
5\r
e92ddda2 6Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.<BR>\r
1abfa4ce
JY
7This program and the accompanying materials \r
8are licensed and made available under the terms and conditions of the BSD License \r
9which accompanies this distribution. The full text of the license may be found at \r
10http://opensource.org/licenses/bsd-license.php\r
11\r
12THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
13WITHOUT 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
32UINT32\r
33EFIAPI\r
34Tcg2PhysicalPresenceLibGetManagementFlags (\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
42 \r
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