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