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