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