]>
Commit | Line | Data |
---|---|---|
63556485 ED |
1 | /** @file\r |
2 | Tcg PP storage library instance that does support any storage specific PPI.\r | |
3 | \r | |
4 | Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>\r | |
5 | This program and the accompanying materials\r | |
6 | are licensed and made available under the terms and conditions of the BSD License\r | |
7 | which accompanies this distribution. The full text of the license may be found at\r | |
8 | http://opensource.org/licenses/bsd-license.php\r | |
9 | \r | |
10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
12 | \r | |
13 | **/\r | |
14 | #include <PiDxe.h>\r | |
15 | \r | |
16 | #include <Guid/TcgPhysicalPresenceStorageData.h>\r | |
17 | #include <IndustryStandard/TcgPhysicalPresence.h>\r | |
18 | \r | |
19 | #include <Protocol/SmmVariable.h>\r | |
20 | \r | |
21 | \r | |
22 | \r | |
23 | #include <Library/TcgPhysicalPresenceStorageLib.h>\r | |
24 | #include <Library/DebugLib.h>\r | |
25 | #include <Library/SmmServicesTableLib.h>\r | |
26 | \r | |
27 | \r | |
28 | EFI_SMM_VARIABLE_PROTOCOL *mTcg2PpStorageSmmVariable;\r | |
29 | \r | |
30 | /**\r | |
31 | The handler for TPM physical presence function:\r | |
32 | Submit TPM Operation Request to Pre-OS Environment and\r | |
33 | Submit TPM Operation Request to Pre-OS Environment 2.\r | |
34 | \r | |
35 | Caution: This function may receive untrusted input.\r | |
36 | \r | |
37 | @param[in] OperationRequest TPM physical presence operation request.\r | |
38 | @param[in] RequestParameter TPM physical presence operation request parameter.\r | |
39 | \r | |
40 | @return Return Code for Submit TPM Operation Request to Pre-OS Environment and\r | |
41 | Submit TPM Operation Request to Pre-OS Environment 2.\r | |
42 | **/\r | |
43 | UINT32\r | |
44 | EFIAPI\r | |
45 | TcgPhysicalPresenceStorageLibSubmitRequestToPreOSFunction (\r | |
46 | IN UINT32 OperationRequest,\r | |
47 | IN UINT32 RequestParameter\r | |
48 | )\r | |
49 | {\r | |
50 | ASSERT (FALSE);\r | |
51 | \r | |
52 | return TCG_PP_RETURN_TPM_OPERATION_RESPONSE_SUCCESS;\r | |
53 | }\r | |
54 | \r | |
55 | /**\r | |
56 | The handler for TPM physical presence function:\r | |
57 | Return TPM Operation Response to OS Environment.\r | |
58 | \r | |
59 | @param[out] MostRecentRequest Most recent operation request.\r | |
60 | @param[out] Response Response to the most recent operation request.\r | |
61 | \r | |
62 | @return Return Code for Return TPM Operation Response to OS Environment.\r | |
63 | **/\r | |
64 | UINT32\r | |
65 | EFIAPI\r | |
66 | TcgPhysicalPresenceStorageLibReturnOperationResponseToOsFunction (\r | |
67 | OUT UINT32 *MostRecentRequest,\r | |
68 | OUT UINT32 *Response\r | |
69 | )\r | |
70 | {\r | |
71 | ASSERT (FALSE);\r | |
72 | \r | |
73 | return TCG_PP_RETURN_TPM_OPERATION_RESPONSE_SUCCESS;\r | |
74 | }\r | |
75 | \r | |
76 | /**\r | |
77 | Check if the pending TPM request needs user input to confirm.\r | |
78 | \r | |
79 | The TPM request may come from OS. This API will check if TPM request exists and need user\r | |
80 | input to confirmation.\r | |
81 | \r | |
82 | @retval TRUE TPM needs input to confirm user physical presence.\r | |
83 | @retval FALSE TPM doesn't need input to confirm user physical presence.\r | |
84 | \r | |
85 | **/\r | |
86 | BOOLEAN\r | |
87 | EFIAPI\r | |
88 | TcgPhysicalPresenceStorageLibNeedUserConfirm(\r | |
89 | VOID\r | |
90 | )\r | |
91 | {\r | |
92 | ASSERT (FALSE);\r | |
93 | \r | |
94 | return FALSE;\r | |
95 | }\r | |
96 | \r | |
97 | /**\r | |
98 | Check and execute the pending TPM request.\r | |
99 | \r | |
100 | The TPM request may come from OS or BIOS. This API will display request information and wait\r | |
101 | for user confirmation if TPM request exists. The TPM request will be sent to TPM device after\r | |
102 | the TPM request is confirmed, and one or more reset may be required to make TPM request to\r | |
103 | take effect.\r | |
104 | \r | |
105 | This API should be invoked after console in and console out are all ready as they are required\r | |
106 | to display request information and get user input to confirm the request.\r | |
107 | \r | |
108 | @param[in] PlatformAuth platform auth value. NULL means no platform auth change.\r | |
109 | **/\r | |
110 | VOID\r | |
111 | EFIAPI\r | |
112 | TcgPhysicalPresenceStorageLibProcessRequest (\r | |
113 | VOID\r | |
114 | )\r | |
115 | {\r | |
116 | ASSERT (FALSE);\r | |
117 | }\r | |
118 | \r | |
119 | /**\r | |
120 | The handler for TPM physical presence function:\r | |
121 | Return TPM Operation flag variable.\r | |
122 | \r | |
123 | @return Return Code for Return TPM Operation flag variable.\r | |
124 | **/\r | |
125 | UINT32\r | |
126 | EFIAPI\r | |
127 | TcgPhysicalPresenceStorageLibReturnStorageFlags (\r | |
128 | VOID\r | |
129 | )\r | |
130 | {\r | |
131 | UINTN DataSize;\r | |
132 | EFI_TCG_PHYSICAL_PRESENCE_STORAGE_FLAGS PpiFlags;\r | |
133 | EFI_STATUS Status;\r | |
134 | \r | |
135 | //\r | |
136 | // Get the Physical Presence storage flags\r | |
137 | //\r | |
138 | DataSize = sizeof (EFI_TCG_PHYSICAL_PRESENCE_STORAGE_FLAGS);\r | |
139 | Status = mTcg2PpStorageSmmVariable->SmmGetVariable (\r | |
140 | TCG_PHYSICAL_PRESENCE_STORAGE_FLAGS_VARIABLE,\r | |
141 | &gEfiTcgPhysicalPresenceStorageGuid,\r | |
142 | NULL,\r | |
143 | &DataSize,\r | |
144 | &PpiFlags\r | |
145 | );\r | |
146 | if (EFI_ERROR (Status)) {\r | |
147 | DEBUG ((EFI_D_ERROR, "[TPM2] Get PP storage flags failure! Status = %r\n", Status));\r | |
148 | PpiFlags.PPFlags = TCG_BIOS_STORAGE_MANAGEMENT_FLAG_DEFAULT;\r | |
149 | }\r | |
150 | \r | |
151 | return PpiFlags.PPFlags;\r | |
152 | }\r | |
153 | \r | |
154 | /**\r | |
155 | \r | |
156 | Install Boot Manager Menu driver.\r | |
157 | \r | |
158 | @param ImageHandle The image handle.\r | |
159 | @param SystemTable The system table.\r | |
160 | \r | |
161 | @retval EFI_SUCEESS Install Boot manager menu success.\r | |
162 | @retval Other Return error status.\r | |
163 | \r | |
164 | **/\r | |
165 | EFI_STATUS\r | |
166 | EFIAPI\r | |
167 | TcgPhysicalPresenceStorageLibConstructor (\r | |
168 | IN EFI_HANDLE ImageHandle,\r | |
169 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
170 | )\r | |
171 | {\r | |
172 | EFI_STATUS Status;\r | |
173 | \r | |
174 | //\r | |
175 | // Locate SmmVariableProtocol.\r | |
176 | //\r | |
177 | Status = gSmst->SmmLocateProtocol (&gEfiSmmVariableProtocolGuid, NULL, (VOID**)&mTcg2PpStorageSmmVariable);\r | |
178 | ASSERT_EFI_ERROR (Status);\r | |
179 | \r | |
180 | return EFI_SUCCESS;\r | |
181 | }\r |