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