Update for SecurityPkg.
[mirror_edk2.git] / SecurityPkg / Tcg / TcgConfigDxe / TcgConfigImpl.h
CommitLineData
0c18794e 1/** @file\r
2 The header file of HII Config Access protocol implementation of TCG\r
3 configuration module.\r
4\r
5Copyright (c) 2011, 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
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 __TCG_CONFIG_IMPL_H__\r
17#define __TCG_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/TcgService.h>\r
24\r
25#include <Library/BaseLib.h>\r
26#include <Library/BaseMemoryLib.h>\r
27#include <Library/DebugLib.h>\r
28#include <Library/MemoryAllocationLib.h>\r
29#include <Library/UefiBootServicesTableLib.h>\r
30#include <Library/UefiRuntimeServicesTableLib.h>\r
31#include <Library/UefiHiiServicesLib.h>\r
32#include <Library/UefiLib.h>\r
33#include <Library/HiiLib.h>\r
34#include <Library/DevicePathLib.h>\r
35#include <Library/PcdLib.h>\r
36#include <Library/PrintLib.h>\r
37#include <Library/TpmCommLib.h>\r
38\r
39#include <Guid/MdeModuleHii.h>\r
40\r
41#include "TcgConfigNvData.h"\r
42\r
43//\r
44// Tool generated IFR binary data and String package data\r
45//\r
46extern UINT8 TcgConfigBin[];\r
47extern UINT8 TcgConfigDxeStrings[];\r
48\r
49///\r
50/// HII specific Vendor Device Path definition.\r
51///\r
52typedef struct {\r
53 VENDOR_DEVICE_PATH VendorDevicePath;\r
54 EFI_DEVICE_PATH_PROTOCOL End;\r
55} HII_VENDOR_DEVICE_PATH;\r
56\r
57typedef struct {\r
58 UINTN Signature;\r
59\r
60 EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess;\r
61 EFI_HII_HANDLE HiiHandle;\r
62 EFI_HANDLE DriverHandle; \r
63\r
64 EFI_TCG_PROTOCOL *TcgProtocol;\r
65\r
66 BOOLEAN HideTpm;\r
67} TCG_CONFIG_PRIVATE_DATA;\r
68\r
69extern TCG_CONFIG_PRIVATE_DATA mTcgConfigPrivateDateTemplate;\r
70\r
71#define TCG_CONFIG_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('T', 'C', 'G', 'D')\r
72#define TCG_CONFIG_PRIVATE_DATA_FROM_THIS(a) CR (a, TCG_CONFIG_PRIVATE_DATA, ConfigAccess, TCG_CONFIG_PRIVATE_DATA_SIGNATURE)\r
73\r
74\r
75/**\r
76 This function publish the TCG configuration Form for TPM device.\r
77\r
78 @param[in, out] PrivateData Points to TCG 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
86InstallTcgConfigForm (\r
87 IN OUT TCG_CONFIG_PRIVATE_DATA *PrivateData\r
88 );\r
89\r
90/**\r
91 This function removes TCG configuration Form.\r
92\r
93 @param[in, out] PrivateData Points to TCG configuration private data.\r
94\r
95**/\r
96VOID\r
97UninstallTcgConfigForm (\r
98 IN OUT TCG_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
129TcgExtractConfig (\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
156TcgRouteConfig (\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
186TcgCallback (\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