1 | /** @file
|
---|
2 | This file defines the EDKII Redfish Platform Config Protocol interface.
|
---|
3 |
|
---|
4 | (C) Copyright 2021 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_DXE_H_
|
---|
13 | #define EDKII_REDFISH_PLATFORM_CONFIG_DXE_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/MemoryAllocationLib.h>
|
---|
24 | #include <Library/PcdLib.h>
|
---|
25 | #include <Library/PrintLib.h>
|
---|
26 | #include <Library/RedfishDebugLib.h>
|
---|
27 | #include <Library/UefiLib.h>
|
---|
28 | #include <Library/UefiBootServicesTableLib.h>
|
---|
29 | #include <Library/UefiDriverEntryPoint.h>
|
---|
30 |
|
---|
31 | //
|
---|
32 | // Protocols
|
---|
33 | //
|
---|
34 | #include <Protocol/HiiDatabase.h>
|
---|
35 | #include <Protocol/HiiString.h>
|
---|
36 | #include <Protocol/RegularExpressionProtocol.h>
|
---|
37 |
|
---|
38 | //
|
---|
39 | // Produced Protocol
|
---|
40 | //
|
---|
41 | #include <Protocol/EdkIIRedfishPlatformConfig.h>
|
---|
42 |
|
---|
43 | //
|
---|
44 | // Debug message in DEBUG_REDFISH_COMPONENT_PLATFORM_CONFIG_DXE scope.
|
---|
45 | // To enable the debug message for this module, below PCDs must be set.
|
---|
46 | //
|
---|
47 | // 1. DEBUG_MANAGEABILITY must be set PcdDebugPrintErrorLevel.
|
---|
48 | //
|
---|
49 | // 2 RedfishPlatformConfigDxe debug enablement must be set in
|
---|
50 | // PcdRedfishDebugCategory (defined in RedfishPkg.dec)
|
---|
51 | //
|
---|
52 | // 3. The subordinate debug enablement for RedfishPlatformConfigDxe
|
---|
53 | // must be set in PcdRedfishPlatformConfigDebugProperty (defined
|
---|
54 | // in RedfishPkg.dec).
|
---|
55 | //
|
---|
56 | #define DEBUG_REDFISH_THIS_MODULE(DebugSubordinate, ...) \
|
---|
57 | while (RedfishPlatformConfigDebugProp (DebugSubordinate)) { \
|
---|
58 | DEBUG_REDFISH(DEBUG_REDFISH_COMPONENT_PLATFORM_CONFIG_DXE, ##__VA_ARGS__); \
|
---|
59 | break; \
|
---|
60 | }
|
---|
61 |
|
---|
62 | #define DEBUG_REDFISH_THIS_MODULE_CODE_BEGIN(DebugSubordinate) \
|
---|
63 | if (RedfishPlatformConfigDebugProp (DebugSubordinate)) {
|
---|
64 |
|
---|
65 | #define DEBUG_REDFISH_THIS_MODULE_CODE_END() }
|
---|
66 |
|
---|
67 | #define DEBUG_REDFISH_THIS_MODULE_CODE(DebugSubordinate, Expression) \
|
---|
68 | DEBUG_REDFISH_THIS_MODULE_CODE_BEGIN(DebugSubordinate) \
|
---|
69 | Expression \
|
---|
70 | DEBUG_REDFISH_THIS_MODULE_CODE_END()
|
---|
71 |
|
---|
72 | // Subordinate debug property for DEBUG_REDFISH_PLATFORM_CONFIG_DXE
|
---|
73 | #define REDFISH_PLATFORM_CONFIG_DEBUG_STRING_DATABASE 0x00000001
|
---|
74 | #define REDFISH_PLATFORM_CONFIG_DEBUG_DUMP_FORMSET 0x00000002
|
---|
75 | #define REDFISH_PLATFORM_CONFIG_DEBUG_CONFIG_LANG_SEARCH 0x00000004
|
---|
76 | #define REDFISH_PLATFORM_CONFIG_DEBUG_CONFIG_LANG_REGEX 0x00000008
|
---|
77 |
|
---|
78 | ///
|
---|
79 | /// Definition of EDKII_REDFISH_PLATFORM_CONFIG_NOTIFY.
|
---|
80 | ///
|
---|
81 | typedef struct {
|
---|
82 | EFI_EVENT ProtocolEvent; ///< Protocol notification event.
|
---|
83 | VOID *Registration; ///< Protocol notification registration.
|
---|
84 | } REDFISH_PLATFORM_CONFIG_NOTIFY;
|
---|
85 |
|
---|
86 | ///
|
---|
87 | /// Definition of REDFISH_PLATFORM_CONFIG_PRIVATE.
|
---|
88 | ///
|
---|
89 | typedef struct {
|
---|
90 | EFI_HANDLE ImageHandle; ///< Driver image handle.
|
---|
91 | EDKII_REDFISH_PLATFORM_CONFIG_PROTOCOL Protocol;
|
---|
92 | REDFISH_PLATFORM_CONFIG_NOTIFY HiiDbNotify;
|
---|
93 | EFI_HII_DATABASE_PROTOCOL *HiiDatabase; ///< The HII database protocol.
|
---|
94 | REDFISH_PLATFORM_CONFIG_NOTIFY HiiStringNotify;
|
---|
95 | EFI_HII_STRING_PROTOCOL *HiiString; ///< HII String Protocol.
|
---|
96 | REDFISH_PLATFORM_CONFIG_NOTIFY RegexNotify;
|
---|
97 | EFI_REGULAR_EXPRESSION_PROTOCOL *RegularExpressionProtocol; ///< Regular Expression Protocol.
|
---|
98 | EFI_HANDLE NotifyHandle; ///< The notify handle.
|
---|
99 | LIST_ENTRY FormsetList; ///< The list to keep cached HII formset.
|
---|
100 | LIST_ENTRY PendingList; ///< The list to keep updated HII handle.
|
---|
101 | } REDFISH_PLATFORM_CONFIG_PRIVATE;
|
---|
102 |
|
---|
103 | ///
|
---|
104 | /// Definition of REDFISH_STACK.
|
---|
105 | ///
|
---|
106 | typedef struct {
|
---|
107 | VOID **Pool;
|
---|
108 | UINTN Size;
|
---|
109 | UINTN Index;
|
---|
110 | } REDFISH_STACK;
|
---|
111 |
|
---|
112 | #define REDFISH_PLATFORM_CONFIG_PRIVATE_FROM_THIS(a) BASE_CR (a, REDFISH_PLATFORM_CONFIG_PRIVATE, Protocol)
|
---|
113 | #define REGULAR_EXPRESSION_INCLUDE_ALL L".*"
|
---|
114 | #define CONFIGURE_LANGUAGE_PREFIX "x-UEFI-redfish-"
|
---|
115 | #define REDFISH_PLATFORM_CONFIG_VERSION 0x00010000
|
---|
116 |
|
---|
117 | #define REDFISH_MENU_PATH_SIZE 8
|
---|
118 |
|
---|
119 | // Definitions of Redfish platform config capability
|
---|
120 | #define REDFISH_PLATFORM_CONFIG_BUILD_MENU_PATH 0x000000001
|
---|
121 | #define REDFISH_PLATFORM_CONFIG_ALLOW_SUPPRESSED 0x000000002
|
---|
122 |
|
---|
123 | /**
|
---|
124 | Convert input unicode string to ascii string. It's caller's
|
---|
125 | responsibility to free returned buffer using FreePool().
|
---|
126 |
|
---|
127 | @param[in] UnicodeString Unicode string to be converted.
|
---|
128 |
|
---|
129 | @retval CHAR8 * Ascii string on return.
|
---|
130 |
|
---|
131 | **/
|
---|
132 | CHAR8 *
|
---|
133 | StrToAsciiStr (
|
---|
134 | IN EFI_STRING UnicodeString
|
---|
135 | );
|
---|
136 |
|
---|
137 | #endif
|
---|