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