summaryrefslogtreecommitdiffstats
path: root/RedfishPkg/Include/Protocol/EdkIIRedfishPlatformConfig.h
blob: d20b2c980e5af2100be0b0b0d338159d9fe1e6b0 (plain)
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
/** @file
  This file defines the EDKII_REDFISH_PLATFORM_CONFIG_PROTOCOL interface.

  (C) Copyright 2021-2022 Hewlett Packard Enterprise Development LP<BR>
  Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.

  SPDX-License-Identifier: BSD-2-Clause-Patent

**/

#ifndef EDKII_REDFISH_PLATFORM_CONFIG_H_
#define EDKII_REDFISH_PLATFORM_CONFIG_H_

typedef struct _EDKII_REDFISH_PLATFORM_CONFIG_PROTOCOL EDKII_REDFISH_PLATFORM_CONFIG_PROTOCOL;

///
/// Definition of EDKII_REDFISH_TYPE_VALUE
///
typedef union {
  INT64      Integer;
  BOOLEAN    Boolean;
  CHAR8      *Buffer;
  CHAR8      **StringArray;
  INT64      *IntegerArray;
  BOOLEAN    *BooleanArray;
} EDKII_REDFISH_TYPE_VALUE;

///
/// Definition of EDKII_REDFISH_VALUE_TYPES
///
typedef enum {
  RedfishValueTypeUnknown = 0,
  RedfishValueTypeInteger,
  RedfishValueTypeBoolean,
  RedfishValueTypeString,
  RedfishValueTypeStringArray,
  RedfishValueTypeIntegerArray,
  RedfishValueTypeBooleanArray,
  RedfishValueTypeMax
} EDKII_REDFISH_VALUE_TYPES;

///
/// Definition of EDKII_REDFISH_ATTRIBUTE_TYPES
///
typedef enum {
  RedfishAttributeTypeUnknown = 0,
  RedfishAttributeTypeEnumeration,
  RedfishAttributeTypeString,
  RedfishAttributeTypeInteger,
  RedfishAttributeTypeBoolean,
  RedfishAttributeTypePassword
} EDKII_REDFISH_ATTRIBUTE_TYPES;

///
/// Definition of EDKII_REDFISH_VALUE
///
typedef struct {
  EDKII_REDFISH_VALUE_TYPES    Type;
  EDKII_REDFISH_TYPE_VALUE     Value;
  UINTN                        ArrayCount;
} EDKII_REDFISH_VALUE;

///
/// Definition of EDKII_REDFISH_ATTRIBUTE_VALUE
///
typedef struct {
  CHAR8    *ValueName;
  CHAR8    *ValueDisplayName;
} EDKII_REDFISH_ATTRIBUTE_VALUE;

///
/// Definition of EDKII_REDFISH_POSSIBLE_VALUES
///
typedef struct {
  UINTN                            ValueCount;
  EDKII_REDFISH_ATTRIBUTE_VALUE    *ValueArray;
} EDKII_REDFISH_POSSIBLE_VALUES;

///
/// Definition of EDKII_REDFISH_ATTRIBUTE
///
typedef struct {
  CHAR8                            *AttributeName;
  CHAR8                            *DisplayName;
  CHAR8                            *HelpText;
  CHAR8                            *MenuPath;
  EDKII_REDFISH_ATTRIBUTE_TYPES    Type;
  BOOLEAN                          ResetRequired;
  BOOLEAN                          ReadOnly;
  BOOLEAN                          GrayedOut;
  BOOLEAN                          Suppress;
  UINT64                           NumMaximum;
  UINT64                           NumMinimum;
  UINT64                           NumStep;
  UINT8                            StrMaxSize;
  UINT8                            StrMinSize;
  EDKII_REDFISH_POSSIBLE_VALUES    Values;
} EDKII_REDFISH_ATTRIBUTE;

/**
  Get Redfish value with the given Schema and Configure Language.

  @param[in]   This                Pointer to EDKII_REDFISH_PLATFORM_CONFIG_PROTOCOL instance.
  @param[in]   Schema              The Redfish schema to query.
  @param[in]   Version             The Redfish version to query.
  @param[in]   ConfigureLang       The target value which match this configure Language.
  @param[out]  Value               The returned value.

  @retval EFI_SUCCESS              Value is returned successfully.
  @retval Others                   Some error happened.

**/
typedef
EFI_STATUS
(EFIAPI *EDKII_REDFISH_PLATFORM_CONFIG_GET_VALUE)(
  IN     EDKII_REDFISH_PLATFORM_CONFIG_PROTOCOL *This,
  IN     CHAR8                                  *Schema,
  IN     CHAR8                                  *Version,
  IN     EFI_STRING                             ConfigureLang,
  OUT    EDKII_REDFISH_VALUE                    *Value
  );

//
// Default class standard
//
#define EDKII_REDFISH_DEFAULT_CLASS_STANDARD  EFI_HII_DEFAULT_CLASS_STANDARD

/**
  Get Redfish default value with the given Schema and Configure Language.

  @param[in]   This                Pointer to EDKII_REDFISH_PLATFORM_CONFIG_PROTOCOL instance.
  @param[in]   Schema              The Redfish schema to query.
  @param[in]   Version             The Redfish version to query.
  @param[in]   ConfigureLang       The target value which match this configure Language.
  @param[in]   DefaultClass        The UEFI defined default class.
                                   Please refer to UEFI spec. 33.2.5.8 "defaults" for details.
  @param[out]  Value               The returned value.

  @retval EFI_SUCCESS              Value is returned successfully.
  @retval Others                   Some error happened.

**/
typedef
EFI_STATUS
(EFIAPI *EDKII_REDFISH_PLATFORM_CONFIG_GET_DEFAULT_VALUE)(
  IN     EDKII_REDFISH_PLATFORM_CONFIG_PROTOCOL *This,
  IN     CHAR8                                  *Schema,
  IN     CHAR8                                  *Version,
  IN     EFI_STRING                             ConfigureLang,
  IN     UINT16                                 DefaultClass,
  OUT    EDKII_REDFISH_VALUE                    *Value
  );

/**
  Set Redfish value with the given Schema and Configure Language.

  @param[in]   This                Pointer to EDKII_REDFISH_PLATFORM_CONFIG_PROTOCOL instance.
  @param[in]   Schema              The Redfish schema to query.
  @param[in]   Version             The Redfish version to query.
  @param[in]   ConfigureLang       The target value which match this configure Language.
  @param[in]   Value               The value to set.

  @retval EFI_SUCCESS              Value is returned successfully.
  @retval Others                   Some error happened.

**/
typedef
EFI_STATUS
(EFIAPI *EDKII_REDFISH_PLATFORM_CONFIG_SET_VALUE)(
  IN     EDKII_REDFISH_PLATFORM_CONFIG_PROTOCOL *This,
  IN     CHAR8                                  *Schema,
  IN     CHAR8                                  *Version,
  IN     EFI_STRING                             ConfigureLang,
  IN     EDKII_REDFISH_VALUE                    Value
  );

/**
  Get Redfish attribute value with the given Schema and Configure Language.

  @param[in]   This                Pointer to EDKII_REDFISH_PLATFORM_CONFIG_PROTOCOL instance.
  @param[in]   Schema              The Redfish schema to query.
  @param[in]   Version             The Redfish version to query.
  @param[in]   ConfigureLang       The target value which match this configure Language.
  @param[out]  AttributeValue      The attribute value.

  @retval EFI_SUCCESS              Value is returned successfully.
  @retval Others                   Some error happened.

**/
typedef
EFI_STATUS
(EFIAPI *EDKII_REDFISH_PLATFORM_CONFIG_GET_ATTRIBUTE)(
  IN     EDKII_REDFISH_PLATFORM_CONFIG_PROTOCOL *This,
  IN     CHAR8                                  *Schema,
  IN     CHAR8                                  *Version,
  IN     EFI_STRING                             ConfigureLang,
  OUT    EDKII_REDFISH_ATTRIBUTE                *AttributeValue
  );

/**
  Get the list of Configure Language from platform configuration by the given Schema and RegexPattern.

  @param[in]   This                Pointer to EDKII_REDFISH_PLATFORM_CONFIG_PROTOCOL instance.
  @param[in]   Schema              The Redfish schema to query.
  @param[in]   Version             The Redfish version to query.
  @param[in]   RegexPattern        The target Configure Language pattern. This is used for regular expression matching.
  @param[out]  ConfigureLangList   The list of Configure Language.
  @param[out]  Count               The number of Configure Language in ConfigureLangList.

  @retval EFI_SUCCESS              ConfigureLangList is returned successfully.
  @retval Others                   Some error happened.

**/
typedef
EFI_STATUS
(EFIAPI *EDKII_REDFISH_PLATFORM_CONFIG_GET_CONFIG_LANG)(
  IN     EDKII_REDFISH_PLATFORM_CONFIG_PROTOCOL *This,
  IN     CHAR8                                  *Schema,
  IN     CHAR8                                  *Version,
  IN     EFI_STRING                             RegexPattern,
  OUT    EFI_STRING                             **ConfigureLangList,
  OUT    UINTN                                  *Count
  );

/**
  Get the list of supported Redfish schema from platform configuration.

  @param[in]   This                Pointer to EDKII_REDFISH_PLATFORM_CONFIG_PROTOCOL instance.
  @param[out]  SupportedSchema     The supported schema list which is separated by ';'.
                                   For example: "x-uefi-redfish-Memory.v1_7_1;x-uefi-redfish-Boot.v1_0_1"
                                   The SupportedSchema is allocated by the callee. It's caller's
                                   responsibility to free this buffer using FreePool().

  @retval EFI_SUCCESS              Schema is returned successfully.
  @retval Others                   Some error happened.

**/
typedef
EFI_STATUS
(EFIAPI *EDKII_REDFISH_PLATFORM_CONFIG_GET_SUPPORTED_SCHEMA)(
  IN     EDKII_REDFISH_PLATFORM_CONFIG_PROTOCOL    *This,
  OUT    CHAR8                                     **SupportedSchema
  );

struct _EDKII_REDFISH_PLATFORM_CONFIG_PROTOCOL {
  UINT64                                                Revision;
  EDKII_REDFISH_PLATFORM_CONFIG_GET_VALUE               GetValue;
  EDKII_REDFISH_PLATFORM_CONFIG_SET_VALUE               SetValue;
  EDKII_REDFISH_PLATFORM_CONFIG_GET_DEFAULT_VALUE       GetDefaultValue;
  EDKII_REDFISH_PLATFORM_CONFIG_GET_ATTRIBUTE           GetAttribute;
  EDKII_REDFISH_PLATFORM_CONFIG_GET_CONFIG_LANG         GetConfigureLang;
  EDKII_REDFISH_PLATFORM_CONFIG_GET_SUPPORTED_SCHEMA    GetSupportedSchema;
};

extern EFI_GUID  gEdkIIRedfishPlatformConfigProtocolGuid;

#endif