VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/Firmware/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigImpl.h

Last change on this file was 105670, checked in by vboxsync, 7 months ago

Devices/EFI/FirmwareNew: Merge edk2-stable-202405 and make it build on aarch64, bugref:4643

  • Property svn:eol-style set to native
File size: 15.1 KB
Line 
1/** @file
2 This file defines the EDKII Redfish Platform Config Protocol private structure.
3
4 (C) Copyright 2021-2022 Hewlett Packard Enterprise Development LP<BR>
5 Copyright (c) 2022-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
6 Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.<BR>
7
8 SPDX-License-Identifier: BSD-2-Clause-Patent
9
10**/
11
12#ifndef EDKII_REDFISH_PLATFORM_CONFIG_IMPL_H_
13#define EDKII_REDFISH_PLATFORM_CONFIG_IMPL_H_
14
15#include <Uefi.h>
16
17//
18// Libraries
19//
20#include <Library/BaseLib.h>
21#include <Library/BaseMemoryLib.h>
22#include <Library/DebugLib.h>
23#include <Library/DevicePathLib.h>
24#include <Library/HiiUtilityLib.h>
25#include <Library/HiiLib.h>
26#include <Library/MemoryAllocationLib.h>
27#include <Library/UefiBootServicesTableLib.h>
28#include <Library/UefiLib.h>
29
30#define IS_EMPTY_STRING(a) (a == NULL || a[0] == L'\0')
31#define ENGLISH_LANGUAGE_CODE "en-US"
32#define X_UEFI_SCHEMA_PREFIX "x-UEFI-redfish-"
33
34#define MAX_X_UEFI_REDFISH_STRING_SIZE (128 * 2)// 128 character in UCS.
35
36typedef struct _REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE;
37
38//
39// Definition of REDFISH_PLATFORM_CONFIG_PRIVATE.
40//
41typedef struct {
42 LIST_ENTRY Link;
43 EFI_HII_HANDLE HiiHandle;
44 BOOLEAN IsDeleted;
45} REDFISH_PLATFORM_CONFIG_PENDING_LIST;
46
47#define REDFISH_PLATFORM_CONFIG_PENDING_LIST_FROM_LINK(a) BASE_CR (a, REDFISH_PLATFORM_CONFIG_PENDING_LIST, Link)
48
49typedef struct {
50 UINTN Count; // Number of schema in list
51 CHAR8 **SchemaList; // Schema list
52} REDFISH_PLATFORM_CONFIG_SCHEMA;
53
54// Defines the number of elements in array
55#define X_UEFI_REDFISH_STRING_ARRAY_ENTRY_NUMBER 1024
56
57//
58// Definition of x-UEFI-redfish string element.
59//
60typedef struct {
61 EFI_STRING_ID StringId;
62 CHAR16 *UcsString;
63} REDFISH_X_UEFI_STRINGS_ARRAY_ELEMENT;
64
65//
66// Discrete string array buffer, each has X_UEFI_REDFISH_STRING_ARRAY_NUMBER element.
67//
68typedef struct {
69 LIST_ENTRY NextArray;
70 REDFISH_X_UEFI_STRINGS_ARRAY_ELEMENT *ArrayEntryAddress;
71} REDFISH_X_UEFI_STRINGS_ARRAY;
72
73//
74// x-UEFI-redfish string database, x-UEFI-redfish language based.
75//
76typedef struct {
77 LIST_ENTRY NextXuefiRedfishLanguage; // Link to the next suppoted x-UEFI-Redfish language.
78 CHAR8 *XuefiRedfishLanguage; // x-UEFI-redfish language.
79 UINTN StringsArrayBlocks; // Number of the array blocks that accommodate X_UEFI_REDFISH_STRING_ARRAY_NUMBER
80 // elements in each.
81 LIST_ENTRY XuefiRedfishStringArrays; // Link entry of x-UEFI-redfish string array.
82} REDFISH_X_UEFI_STRING_DATABASE;
83
84//
85// Definition of REDFISH_PLATFORM_CONFIG_FORM_SET_PRIVATE
86//
87typedef struct {
88 LIST_ENTRY Link;
89 HII_FORMSET *HiiFormSet; // Pointer to HII formset data.
90 EFI_GUID Guid; // Formset GUID.
91 EFI_HII_HANDLE HiiHandle; // Hii Handle of this formset.
92 EFI_HII_PACKAGE_LIST_HEADER *HiiPackageListHeader; // Hii Package list header.
93 LIST_ENTRY HiiFormList; // Form list that keep form data under this formset.
94 CHAR16 *DevicePathStr; // Device path of this formset.
95 REDFISH_PLATFORM_CONFIG_SCHEMA SupportedSchema; // Schema that is supported in this formset.
96 LIST_ENTRY XuefiRedfishStringDatabase; // x-UEFI-redfish string/Id data base;
97} REDFISH_PLATFORM_CONFIG_FORM_SET_PRIVATE;
98
99#define REDFISH_PLATFORM_CONFIG_FORMSET_FROM_LINK(a) BASE_CR (a, REDFISH_PLATFORM_CONFIG_FORM_SET_PRIVATE, Link)
100
101//
102// Definition of REDFISH_PLATFORM_CONFIG_FORM_PRIVATE
103//
104typedef struct {
105 LIST_ENTRY Link;
106 UINT16 Id; // Form ID.
107 EFI_STRING_ID Title; // String token of form title.
108 REDFISH_PLATFORM_CONFIG_FORM_SET_PRIVATE *ParentFormset;
109 HII_FORM *HiiForm; // Pointer to HII form data.
110 LIST_ENTRY StatementList; // Statement list that keep statement under this form.
111 BOOLEAN Suppressed; // Form is suppressed
112} REDFISH_PLATFORM_CONFIG_FORM_PRIVATE;
113
114#define REDFISH_PLATFORM_CONFIG_FORM_FROM_LINK(a) BASE_CR (a, REDFISH_PLATFORM_CONFIG_FORM_PRIVATE, Link)
115
116//
117// Definition of REDFISH_PLATFORM_CONFIG_STATEMENT_DATA
118//
119typedef struct {
120 UINT64 NumMinimum;
121 UINT64 NumMaximum;
122 UINT64 NumStep;
123 UINT8 StrMinSize;
124 UINT8 StrMaxSize;
125} REDFISH_PLATFORM_CONFIG_STATEMENT_DATA;
126
127//
128// Definition of REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE
129//
130struct _REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE {
131 LIST_ENTRY Link;
132 REDFISH_PLATFORM_CONFIG_FORM_PRIVATE *ParentForm;
133 HII_STATEMENT *HiiStatement; // Pointer to HII statement data.
134 EFI_QUESTION_ID QuestionId; // Question ID of this statement.
135 EFI_STRING_ID Description; // String token of this question.
136 CHAR16 *XuefiRedfishStr; // x-UEFI-redfish string of this question.
137 EFI_STRING_ID Help; // String token of help message.
138 UINT8 Flags; // The statement flag.
139 REDFISH_PLATFORM_CONFIG_STATEMENT_DATA StatementData; // The max/min for statement value.
140 BOOLEAN Suppressed; // Statement is suppressed.
141 BOOLEAN GrayedOut; // Statement is GrayedOut.
142};
143
144#define REDFISH_PLATFORM_CONFIG_STATEMENT_FROM_LINK(a) BASE_CR (a, REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE, Link)
145
146//
147// Definition of REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE_REF
148//
149typedef struct {
150 LIST_ENTRY Link;
151 REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE *Statement;
152} REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE_REF;
153
154#define REDFISH_PLATFORM_CONFIG_STATEMENT_REF_FROM_LINK(a) BASE_CR (a, REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE_REF, Link)
155
156//
157// Definition of REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE_LIST
158//
159typedef struct {
160 LIST_ENTRY StatementList; // List of REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE_REF
161 UINTN Count;
162} REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE_LIST;
163
164/**
165 Release formset list and all the forms that belong to this formset.
166
167 @param[in] FormsetList Pointer to formset list that needs to be
168 released.
169
170 @retval EFI_STATUS
171
172**/
173EFI_STATUS
174ReleaseFormsetList (
175 IN LIST_ENTRY *FormsetList
176 );
177
178/**
179 Release formset list and all the forms that belong to this formset.
180
181 @param[in] FormsetList Pointer to formset list that needs to be
182 released.
183
184 @retval EFI_STATUS
185
186**/
187EFI_STATUS
188LoadFormsetList (
189 IN EFI_HII_HANDLE *HiiHandle,
190 OUT LIST_ENTRY *FormsetList
191 );
192
193/**
194 When HII database is updated. Keep updated HII handle into pending list so
195 we can process them later.
196
197 @param[in] HiiHandle HII handle instance.
198 @param[in] PendingList Pending list to keep HII handle which is recently updated.
199
200 @retval EFI_SUCCESS HII handle is saved in pending list.
201 @retval EFI_INVALID_PARAMETER HiiHandle is NULL or PendingList is NULL.
202 @retval EFI_OUT_OF_RESOURCES System is out of memory.
203
204**/
205EFI_STATUS
206NotifyFormsetUpdate (
207 IN EFI_HII_HANDLE *HiiHandle,
208 IN LIST_ENTRY *PendingList
209 );
210
211/**
212 When HII database is updated and form-set is deleted. Keep deleted HII handle into pending list so
213 we can process them later.
214
215 @param[in] HiiHandle HII handle instance.
216 @param[in] PendingList Pending list to keep HII handle which is recently updated.
217
218 @retval EFI_SUCCESS HII handle is saved in pending list.
219 @retval EFI_INVALID_PARAMETER HiiHandle is NULL or PendingList is NULL.
220 @retval EFI_OUT_OF_RESOURCES System is out of memory.
221
222**/
223EFI_STATUS
224NotifyFormsetDeleted (
225 IN EFI_HII_HANDLE *HiiHandle,
226 IN LIST_ENTRY *PendingList
227 );
228
229/**
230 Get statement private instance by the given configure language.
231
232 @param[in] FormsetList Form-set list to search.
233 @param[in] Schema Schema to be matched.
234 @param[in] ConfigureLang Configure language.
235
236 @retval REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE * Pointer to statement private instance.
237
238**/
239REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE *
240GetStatementPrivateByConfigureLang (
241 IN LIST_ENTRY *FormsetList,
242 IN CHAR8 *Schema,
243 IN EFI_STRING ConfigureLang
244 );
245
246/**
247 Search and find statement private instance by given regular expression pattern
248 which describes the Configure Language.
249
250 @param[in] RegularExpressionProtocol Regular express protocol.
251 @param[in] FormsetList Form-set list to search.
252 @param[in] Schema Schema to be matched.
253 @param[in] Pattern Regular expression pattern.
254 @param[out] StatementList Statement list that match above pattern.
255
256 @retval EFI_SUCCESS Statement list is returned.
257 @retval EFI_INVALID_PARAMETER Input parameter is NULL.
258 @retval EFI_NOT_READY Regular express protocol is NULL.
259 @retval EFI_NOT_FOUND No statement is found.
260 @retval EFI_OUT_OF_RESOURCES System is out of memory.
261
262**/
263EFI_STATUS
264GetStatementPrivateByConfigureLangRegex (
265 IN EFI_REGULAR_EXPRESSION_PROTOCOL *RegularExpressionProtocol,
266 IN LIST_ENTRY *FormsetList,
267 IN CHAR8 *Schema,
268 IN EFI_STRING Pattern,
269 OUT REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE_LIST *StatementList
270 );
271
272/**
273 There are HII database update and we need to process them accordingly so that we
274 won't use stale data. This function will parse updated HII handle again in order
275 to get updated data-set.
276
277 @param[in] FormsetList List to keep HII form-set.
278 @param[in] PendingList List to keep HII handle that is updated.
279
280 @retval EFI_SUCCESS HII handle is saved in pending list.
281 @retval EFI_INVALID_PARAMETER FormsetList is NULL or PendingList is NULL.
282
283**/
284EFI_STATUS
285ProcessPendingList (
286 IN LIST_ENTRY *FormsetList,
287 IN LIST_ENTRY *PendingList
288 );
289
290/**
291 Delete a string from HII Package List by given HiiHandle.
292
293 @param[in] StringId Id of the string in HII database.
294 @param[in] HiiHandle The HII package list handle.
295
296 @retval EFI_SUCCESS The string was deleted successfully.
297 @retval EFI_INVALID_PARAMETER StringId is zero.
298
299**/
300EFI_STATUS
301HiiDeleteString (
302 IN EFI_STRING_ID StringId,
303 IN EFI_HII_HANDLE HiiHandle
304 );
305
306/**
307 Retrieves a unicode string from a string package in a given language. The
308 returned string is allocated using AllocatePool(). The caller is responsible
309 for freeing the allocated buffer using FreePool().
310
311 If HiiHandle is NULL, then ASSERT().
312 If StringId is 0, then ASSET.
313
314 @param[in] HiiHandle A handle that was previously registered in the HII Database.
315 @param[in] Language The specified configure language to get string.
316 @param[in] StringId The identifier of the string to retrieved from the string
317 package associated with HiiHandle.
318
319 @retval NULL The string specified by StringId is not present in the string package.
320 @retval Other The string was returned.
321
322**/
323EFI_STRING
324HiiGetRedfishString (
325 IN EFI_HII_HANDLE HiiHandle,
326 IN CHAR8 *Language,
327 IN EFI_STRING_ID StringId
328 );
329
330/**
331 Retrieves a ASCII string from a string package in a given language. The
332 returned string is allocated using AllocatePool(). The caller is responsible
333 for freeing the allocated buffer using FreePool().
334
335 If HiiHandle is NULL, then ASSERT().
336 If StringId is 0, then ASSET.
337
338 @param[in] HiiHandle A handle that was previously registered in the HII Database.
339 @param[in] Language The specified configure language to get string.
340 @param[in] StringId The identifier of the string to retrieved from the string
341 package associated with HiiHandle.
342
343 @retval NULL The string specified by StringId is not present in the string package.
344 @retval Other The string was returned.
345
346**/
347CHAR8 *
348HiiGetRedfishAsciiString (
349 IN EFI_HII_HANDLE HiiHandle,
350 IN CHAR8 *Language,
351 IN EFI_STRING_ID StringId
352 );
353
354/**
355 Get ASCII string from HII database in English language. The returned string is allocated
356 using AllocatePool(). The caller is responsible for freeing the allocated buffer using
357 FreePool().
358
359 @param[in] HiiHandle A handle that was previously registered in the HII Database.
360 @param[in] StringId The identifier of the string to retrieved from the string
361 package associated with HiiHandle.
362
363 @retval NULL The string specified by StringId is not present in the string package.
364 @retval Other The string was returned.
365
366**/
367CHAR8 *
368HiiGetEnglishAsciiString (
369 IN EFI_HII_HANDLE HiiHandle,
370 IN EFI_STRING_ID StringId
371 );
372
373/**
374 Release all resource in statement list.
375
376 @param[in] StatementList Statement list to be released.
377
378 @retval EFI_SUCCESS All resource are released.
379 @retval EFI_INVALID_PARAMETER StatementList is NULL.
380
381**/
382EFI_STATUS
383ReleaseStatementList (
384 IN REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE_LIST *StatementList
385 );
386
387/**
388 Return the HII string length. We don't check word alignment
389 of the input string as the same as the checking in StrLen
390 function. Because the HII string in the database is compact
391 at the byte alignment.
392
393 @param[in] String Input UCS format string.
394
395 @retval Length of
396
397**/
398UINTN
399EFIAPI
400HiiStrLen (
401 IN CONST CHAR16 *String
402 );
403
404/**
405 Return the HII string size. We don't check word alignment
406 of the input string as the same as the checking in StrLen
407 function. Because the HII string in the database is compact
408 at the byte alignment.
409
410 @param[in] String Input UCS format string.
411
412 @retval Size of the string.
413
414**/
415UINTN
416EFIAPI
417HiiStrSize (
418 IN CONST CHAR16 *String
419 );
420
421/**
422 Check if the debug property is enabled or not.
423
424 @param[in] DebugType Debug enablement type
425
426 @retval TRUE, the debug property is enabled.
427 FALSE, the debug property is not enabled.
428
429**/
430BOOLEAN
431RedfishPlatformConfigDebugProp (
432 IN UINT64 DebugProp
433 );
434
435/**
436 Check if the Platform Configure feature is enabled or not.
437
438 @param[in] FeatureType Redfish platform config feature enablement
439
440 @retval TRUE, the feature is enabled.
441 FALSE, the feature is not enabled.
442
443**/
444BOOLEAN
445RedfishPlatformConfigFeatureProp (
446 IN UINT64 FeatureProp
447 );
448
449#endif
Note: See TracBrowser for help on using the repository browser.

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