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