VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/Firmware/RedfishPkg/Library/HiiUtilityLib/HiiInternal.h@ 105681

Last change on this file since 105681 was 101291, checked in by vboxsync, 17 months ago

EFI/FirmwareNew: Make edk2-stable202308 build on all supported platforms (using gcc at least, msvc not tested yet), bugref:4643

  • Property svn:eol-style set to native
File size: 10.5 KB
Line 
1/** @file
2 HII internal header file.
3
4 Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
5 (C) Copyright 2021 Hewlett Packard Enterprise Development LP<BR>
6 Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
7
8 SPDX-License-Identifier: BSD-2-Clause-Patent
9
10**/
11
12#ifndef HII_INTERNAL_H_
13#define HII_INTERNAL_H_
14
15#include <Uefi.h>
16
17#include <Protocol/UnicodeCollation.h>
18#include <Protocol/HiiConfigRouting.h>
19#include <Protocol/HiiDatabase.h>
20#include <Protocol/UserManager.h>
21#include <Protocol/DevicePathFromText.h>
22#include <Protocol/RegularExpressionProtocol.h>
23
24#include <Guid/MdeModuleHii.h>
25#include <Guid/ZeroGuid.h>
26#include <Guid/HiiPlatformSetupFormset.h>
27#include <Guid/HiiFormMapMethodGuid.h>
28
29#include <Library/PrintLib.h>
30#include <Library/DebugLib.h>
31#include <Library/BaseMemoryLib.h>
32#include <Library/UefiRuntimeServicesTableLib.h>
33#include <Library/UefiBootServicesTableLib.h>
34#include <Library/MemoryAllocationLib.h>
35#include <Library/HiiLib.h>
36#include <Library/DevicePathLib.h>
37#include <Library/UefiLib.h>
38
39#include "HiiExpression.h"
40#include <Library/HiiUtilityLib.h>
41
42#define EXPRESSION_STACK_SIZE_INCREMENT 0x100
43#define EFI_IFR_SPECIFICATION_VERSION (UINT16) (((EFI_SYSTEM_TABLE_REVISION >> 16) << 8) | (((EFI_SYSTEM_TABLE_REVISION & 0xFFFF) / 10) << 4) | ((EFI_SYSTEM_TABLE_REVISION & 0xFFFF) % 10))
44
45///
46/// Definition of HII_FORM_CONFIG_REQUEST
47//
48typedef struct {
49 UINTN Signature;
50 LIST_ENTRY Link;
51
52 CHAR16 *ConfigRequest; ///< <ConfigRequest> = <ConfigHdr> + <RequestElement>
53 CHAR16 *ConfigAltResp; ///< Alt config response string for this ConfigRequest.
54 UINTN ElementCount; ///< Number of <RequestElement> in the <ConfigRequest>
55 UINTN SpareStrLen;
56 CHAR16 *RestoreConfigRequest; ///< When submit form fail, the element need to be restored
57 CHAR16 *SyncConfigRequest; ///< When submit form fail, the element need to be synced
58
59 HII_FORMSET_STORAGE *Storage;
60} HII_FORM_CONFIG_REQUEST;
61
62#define HII_FORM_CONFIG_REQUEST_SIGNATURE SIGNATURE_32 ('F', 'C', 'R', 'S')
63#define HII_FORM_CONFIG_REQUEST_FROM_LINK(a) CR (a, HII_FORM_CONFIG_REQUEST, Link, HII_FORM_CONFIG_REQUEST_SIGNATURE)
64
65///
66/// Incremental string length of ConfigRequest
67///
68#define CONFIG_REQUEST_STRING_INCREMENTAL 1024
69
70/**
71 Allocate new memory and then copy the Unicode string Source to Destination.
72
73 @param[in,out] Dest Location to copy string
74 @param[in] Src String to copy
75
76**/
77VOID
78NewStringCopy (
79 IN OUT CHAR16 **Dest,
80 IN CHAR16 *Src
81 );
82
83/**
84 Set Value of given Name in a NameValue Storage.
85
86 @param[in] Storage The NameValue Storage.
87 @param[in] Name The Name.
88 @param[in] Value The Value to set.
89 @param[out] ReturnNode The node use the input name.
90
91 @retval EFI_SUCCESS Value found for given Name.
92 @retval EFI_NOT_FOUND No such Name found in NameValue storage.
93
94**/
95EFI_STATUS
96SetValueByName (
97 IN HII_FORMSET_STORAGE *Storage,
98 IN CHAR16 *Name,
99 IN CHAR16 *Value,
100 OUT HII_NAME_VALUE_NODE **ReturnNode
101 );
102
103/**
104 Get bit field value from the buffer and then set the value for the question.
105 Note: Data type UINT32 can cover all the bit field value.
106
107 @param[in] Question The question refer to bit field.
108 @param[in] Buffer Point to the buffer which the question value get from.
109 @param[out] QuestionValue The Question Value retrieved from Bits.
110
111**/
112VOID
113GetBitsQuestionValue (
114 IN HII_STATEMENT *Question,
115 IN UINT8 *Buffer,
116 OUT HII_STATEMENT_VALUE *QuestionValue
117 );
118
119/**
120 Set bit field value to the buffer.
121 Note: Data type UINT32 can cover all the bit field value.
122
123 @param[in] Question The question refer to bit field.
124 @param[in,out] Buffer Point to the buffer which the question value set to.
125 @param[in] Value The bit field value need to set.
126
127**/
128VOID
129SetBitsQuestionValue (
130 IN HII_STATEMENT *Question,
131 IN OUT UINT8 *Buffer,
132 IN UINT32 Value
133 );
134
135/**
136 Convert the buffer value to HiiValue.
137
138 @param[in] Question The question.
139 @param[in] Value Unicode buffer save the question value.
140 @param[out] QuestionValue The Question Value retrieved from Buffer.
141
142 @retval Status whether convert the value success.
143
144**/
145EFI_STATUS
146BufferToQuestionValue (
147 IN HII_STATEMENT *Question,
148 IN CHAR16 *Value,
149 OUT HII_STATEMENT_VALUE *QuestionValue
150 );
151
152/**
153 Get the string based on the StringId and HII Package List Handle.
154
155 @param[in] Token The String's ID.
156 @param[in] HiiHandle The package list in the HII database to search for
157 the specified string.
158
159 @return The output string.
160
161**/
162CHAR16 *
163GetTokenString (
164 IN EFI_STRING_ID Token,
165 IN EFI_HII_HANDLE HiiHandle
166 );
167
168/**
169 Converts the unicode character of the string from uppercase to lowercase.
170 This is a internal function.
171
172 @param[in] ConfigString String to be converted
173
174**/
175VOID
176EFIAPI
177HiiStringToLowercase (
178 IN EFI_STRING ConfigString
179 );
180
181/**
182 Evaluate if the result is a non-zero value.
183
184 @param[in] Result The result to be evaluated.
185
186 @retval TRUE It is a non-zero value.
187 @retval FALSE It is a zero value.
188
189**/
190BOOLEAN
191IsHiiValueTrue (
192 IN EFI_HII_VALUE *Result
193 );
194
195/**
196 Set a new string to string package.
197
198 @param[in] String A pointer to the Null-terminated Unicode string
199 to add or update in the String Package associated
200 with HiiHandle.
201 @param[in] HiiHandle A handle that was previously registered in the
202 HII Database.
203
204 @return the Id for this new string.
205
206**/
207EFI_STRING_ID
208NewHiiString (
209 IN CHAR16 *String,
210 IN EFI_HII_HANDLE HiiHandle
211 );
212
213/**
214 Perform nosubmitif check for a Form.
215
216 @param[in] FormSet FormSet data structure.
217 @param[in] Form Form data structure.
218 @param[in] Question The Question to be validated.
219
220 @retval EFI_SUCCESS Form validation pass.
221 @retval other Form validation failed.
222
223**/
224EFI_STATUS
225ValidateNoSubmit (
226 IN HII_FORMSET *FormSet,
227 IN HII_FORM *Form,
228 IN HII_STATEMENT *Question
229 );
230
231/**
232 Perform NoSubmit check for each Form in FormSet.
233
234 @param[in] FormSet FormSet data structure.
235 @param[in,out] CurrentForm Current input form data structure.
236 @param[out] Statement The statement for this check.
237
238 @retval EFI_SUCCESS Form validation pass.
239 @retval other Form validation failed.
240
241**/
242EFI_STATUS
243NoSubmitCheck (
244 IN HII_FORMSET *FormSet,
245 IN OUT HII_FORM **CurrentForm,
246 OUT HII_STATEMENT **Statement
247 );
248
249/**
250 Convert setting of Buffer Storage or NameValue Storage to <ConfigResp>.
251
252 @param[in] Storage The Storage to be converted.
253 @param[in] ConfigResp The returned <ConfigResp>.
254 @param[in] ConfigRequest The ConfigRequest string.
255
256 @retval EFI_SUCCESS Convert success.
257 @retval EFI_INVALID_PARAMETER Incorrect storage type.
258
259**/
260EFI_STATUS
261StorageToConfigResp (
262 IN HII_FORMSET_STORAGE *Storage,
263 IN CHAR16 **ConfigResp,
264 IN CHAR16 *ConfigRequest
265 );
266
267/**
268 Convert <ConfigResp> to settings in Buffer Storage or NameValue Storage.
269
270 @param[in] Storage The Storage to receive the settings.
271 @param[in] ConfigResp The <ConfigResp> to be converted.
272
273 @retval EFI_SUCCESS Convert success.
274 @retval EFI_INVALID_PARAMETER Incorrect storage type.
275
276**/
277EFI_STATUS
278ConfigRespToStorage (
279 IN HII_FORMSET_STORAGE *Storage,
280 IN CHAR16 *ConfigResp
281 );
282
283/**
284 Fetch the Ifr binary data of a FormSet.
285
286 @param[in] Handle PackageList Handle
287 @param[in,out] FormSetGuid On input, GUID or class GUID of a formset. If not
288 specified (NULL or zero GUID), take the first
289 FormSet with class GUID EFI_HII_PLATFORM_SETUP_FORMSET_GUID
290 found in package list.
291 On output, GUID of the formset found(if not NULL).
292 @param[out] BinaryLength The length of the FormSet IFR binary.
293 @param[out] BinaryData The buffer designed to receive the FormSet.
294
295 @retval EFI_SUCCESS Buffer filled with the requested FormSet.
296 BufferLength was updated.
297 @retval EFI_INVALID_PARAMETER The handle is unknown.
298 @retval EFI_NOT_FOUND A form or FormSet on the requested handle cannot
299 be found with the requested FormId.
300
301**/
302EFI_STATUS
303GetIfrBinaryData (
304 IN EFI_HII_HANDLE Handle,
305 IN OUT EFI_GUID *FormSetGuid,
306 OUT UINTN *BinaryLength,
307 OUT UINT8 **BinaryData
308 );
309
310/**
311 Fill storage with settings requested from Configuration Driver.
312
313 @param[in] FormSet FormSet data structure.
314 @param[in] Storage Buffer Storage.
315
316**/
317VOID
318LoadFormSetStorage (
319 IN HII_FORMSET *FormSet,
320 IN HII_FORMSET_STORAGE *Storage
321 );
322
323/**
324 Free resources of a Form.
325
326 @param[in] FormSet Pointer of the FormSet
327 @param[in,out] Form Pointer of the Form.
328
329**/
330VOID
331DestroyForm (
332 IN HII_FORMSET *FormSet,
333 IN OUT HII_FORM *Form
334 );
335
336/**
337 Get formset storage based on the input varstoreid info.
338
339 @param[in] FormSet Pointer of the current FormSet.
340 @param[in] VarStoreId Varstore ID info.
341
342 @return Pointer to a HII_FORMSET_STORAGE data structure.
343
344**/
345HII_FORMSET_STORAGE *
346GetFstStgFromVarId (
347 IN HII_FORMSET *FormSet,
348 IN EFI_VARSTORE_ID VarStoreId
349 );
350
351/**
352 Zero extend integer/boolean/date/time to UINT64 for comparing.
353
354 @param[in] Value HII Value to be converted.
355
356**/
357VOID
358ExtendValueToU64 (
359 IN HII_STATEMENT_VALUE *Value
360 );
361
362/**
363 Parse opcodes in the formset IFR binary.
364
365 @param[in] FormSet Pointer of the FormSet data structure.
366
367 @retval EFI_SUCCESS Opcode parse success.
368 @retval Other Opcode parse fail.
369
370**/
371EFI_STATUS
372ParseOpCodes (
373 IN HII_FORMSET *FormSet
374 );
375
376#endif // HII_INTERNAL_H_
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette