]> git.proxmox.com Git - mirror_edk2.git/blame - SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigImpl.h
SecurityPkg: Tcg2ConfigDxe: Display TPM2 HID in Tcg2Config
[mirror_edk2.git] / SecurityPkg / Tcg / Tcg2Config / Tcg2ConfigImpl.h
CommitLineData
1abfa4ce
JY
1/** @file\r
2 The header file of HII Config Access protocol implementation of TCG2\r
3 configuration module.\r
4\r
a6e0e994 5Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.<BR>\r
1abfa4ce
JY
6This program and the accompanying materials \r
7are licensed and made available under the terms and conditions of the BSD License \r
8which accompanies this distribution. The full text of the license may be found at \r
9http://opensource.org/licenses/bsd-license.php\r
10\r
11THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
12WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
13\r
14**/\r
15\r
16#ifndef __TCG2_CONFIG_IMPL_H__\r
17#define __TCG2_CONFIG_IMPL_H__\r
18\r
19#include <Uefi.h>\r
20\r
21#include <Protocol/HiiConfigAccess.h>\r
22#include <Protocol/HiiConfigRouting.h>\r
23#include <Protocol/Tcg2Protocol.h>\r
24#include <Protocol/VariableLock.h>\r
25\r
26#include <Library/BaseLib.h>\r
27#include <Library/BaseMemoryLib.h>\r
28#include <Library/DebugLib.h>\r
29#include <Library/MemoryAllocationLib.h>\r
30#include <Library/UefiBootServicesTableLib.h>\r
31#include <Library/UefiRuntimeServicesTableLib.h>\r
32#include <Library/UefiHiiServicesLib.h>\r
33#include <Library/UefiLib.h>\r
34#include <Library/HiiLib.h>\r
35#include <Library/DevicePathLib.h>\r
36#include <Library/PcdLib.h>\r
37#include <Library/PrintLib.h>\r
38#include <Library/Tcg2PhysicalPresenceLib.h>\r
39\r
40#include <Guid/MdeModuleHii.h>\r
41\r
42#include "Tcg2ConfigNvData.h"\r
43\r
44//\r
45// Tool generated IFR binary data and String package data\r
46//\r
47extern UINT8 Tcg2ConfigBin[];\r
48extern UINT8 Tcg2ConfigDxeStrings[];\r
49\r
50///\r
51/// HII specific Vendor Device Path definition.\r
52///\r
53typedef struct {\r
54 VENDOR_DEVICE_PATH VendorDevicePath;\r
55 EFI_DEVICE_PATH_PROTOCOL End;\r
56} HII_VENDOR_DEVICE_PATH;\r
57\r
58typedef struct {\r
59 UINTN Signature;\r
60\r
61 EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess;\r
62 EFI_HII_HANDLE HiiHandle;\r
63 EFI_HANDLE DriverHandle; \r
64\r
65 UINT8 TpmDeviceDetected;\r
66 EFI_TCG2_PROTOCOL *Tcg2Protocol;\r
67 EFI_TCG2_BOOT_SERVICE_CAPABILITY ProtocolCapability;\r
68 UINT32 PCRBanksDesired;\r
69} TCG2_CONFIG_PRIVATE_DATA;\r
70\r
71extern TCG2_CONFIG_PRIVATE_DATA mTcg2ConfigPrivateDateTemplate;\r
72extern TCG2_CONFIG_PRIVATE_DATA *mTcg2ConfigPrivateDate;\r
73#define TCG2_CONFIG_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('T', 'r', 'E', 'D')\r
74#define TCG2_CONFIG_PRIVATE_DATA_FROM_THIS(a) CR (a, TCG2_CONFIG_PRIVATE_DATA, ConfigAccess, TCG2_CONFIG_PRIVATE_DATA_SIGNATURE)\r
75\r
a6e0e994
ZC
76#define TPM_HID_PNP_SIZE 8\r
77#define TPM_HID_ACPI_SIZE 9\r
1abfa4ce
JY
78\r
79/**\r
80 This function publish the TCG2 configuration Form for TPM device.\r
81\r
82 @param[in, out] PrivateData Points to TCG2 configuration private data.\r
83\r
84 @retval EFI_SUCCESS HII Form is installed for this network device.\r
85 @retval EFI_OUT_OF_RESOURCES Not enough resource for HII Form installation.\r
86 @retval Others Other errors as indicated.\r
87\r
88**/\r
89EFI_STATUS\r
90InstallTcg2ConfigForm (\r
91 IN OUT TCG2_CONFIG_PRIVATE_DATA *PrivateData\r
92 );\r
93\r
94/**\r
95 This function removes TCG2 configuration Form.\r
96\r
97 @param[in, out] PrivateData Points to TCG2 configuration private data.\r
98\r
99**/\r
100VOID\r
101UninstallTcg2ConfigForm (\r
102 IN OUT TCG2_CONFIG_PRIVATE_DATA *PrivateData\r
103 );\r
104\r
105/**\r
106 This function allows a caller to extract the current configuration for one\r
107 or more named elements from the target driver.\r
108\r
109 @param[in] This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
110 @param[in] Request A null-terminated Unicode string in\r
111 <ConfigRequest> format.\r
112 @param[out] Progress On return, points to a character in the Request\r
113 string. Points to the string's null terminator if\r
114 request was successful. Points to the most recent\r
115 '&' before the first failing name/value pair (or\r
116 the beginning of the string if the failure is in\r
117 the first name/value pair) if the request was not\r
118 successful.\r
119 @param[out] Results A null-terminated Unicode string in\r
120 <ConfigAltResp> format which has all values filled\r
121 in for the names in the Request string. String to\r
122 be allocated by the called function.\r
123\r
124 @retval EFI_SUCCESS The Results is filled with the requested values.\r
125 @retval EFI_OUT_OF_RESOURCES Not enough memory to store the results.\r
126 @retval EFI_INVALID_PARAMETER Request is illegal syntax, or unknown name.\r
127 @retval EFI_NOT_FOUND Routing data doesn't match any storage in this\r
128 driver.\r
129\r
130**/\r
131EFI_STATUS\r
132EFIAPI\r
133Tcg2ExtractConfig (\r
134 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,\r
135 IN CONST EFI_STRING Request,\r
136 OUT EFI_STRING *Progress,\r
137 OUT EFI_STRING *Results\r
138 );\r
139\r
140/**\r
141 This function processes the results of changes in configuration.\r
142\r
143 @param[in] This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
144 @param[in] Configuration A null-terminated Unicode string in <ConfigResp>\r
145 format.\r
146 @param[out] Progress A pointer to a string filled in with the offset of\r
147 the most recent '&' before the first failing\r
148 name/value pair (or the beginning of the string if\r
149 the failure is in the first name/value pair) or\r
150 the terminating NULL if all was successful.\r
151\r
152 @retval EFI_SUCCESS The Results is processed successfully.\r
153 @retval EFI_INVALID_PARAMETER Configuration is NULL.\r
154 @retval EFI_NOT_FOUND Routing data doesn't match any storage in this\r
155 driver.\r
156\r
157**/\r
158EFI_STATUS\r
159EFIAPI\r
160Tcg2RouteConfig (\r
161 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,\r
162 IN CONST EFI_STRING Configuration,\r
163 OUT EFI_STRING *Progress\r
164 );\r
165\r
166/**\r
167 This function processes the results of changes in configuration.\r
168\r
169 @param[in] This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
170 @param[in] Action Specifies the type of action taken by the browser.\r
171 @param[in] QuestionId A unique value which is sent to the original\r
172 exporting driver so that it can identify the type\r
173 of data to expect.\r
174 @param[in] Type The type of value for the question.\r
175 @param[in] Value A pointer to the data being sent to the original\r
176 exporting driver.\r
177 @param[out] ActionRequest On return, points to the action requested by the\r
178 callback function.\r
179\r
180 @retval EFI_SUCCESS The callback successfully handled the action.\r
181 @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the\r
182 variable and its data.\r
183 @retval EFI_DEVICE_ERROR The variable could not be saved.\r
184 @retval EFI_UNSUPPORTED The specified Action is not supported by the\r
185 callback.\r
186\r
187**/\r
188EFI_STATUS\r
189EFIAPI\r
190Tcg2Callback (\r
191 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,\r
192 IN EFI_BROWSER_ACTION Action,\r
193 IN EFI_QUESTION_ID QuestionId,\r
194 IN UINT8 Type,\r
195 IN EFI_IFR_TYPE_VALUE *Value,\r
196 OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest\r
197 );\r
198\r
199#endif\r