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