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