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