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