-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
RedfishClientPkg/RedfishMessageLib: add library to keep Redfish message
Introduce new library to handle Redfish message. This library associate Redfish message to corresponding Redfish URI. When Redfish resource is ready for provisioning, driver can get all Redfish messages associated with this Redfish URI and add them into provision data. Signed-off-by: Nickle Wang <[email protected]>
- Loading branch information
Showing
5 changed files
with
798 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
/** @file | ||
This file defines the Redfish message library interface. | ||
Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
SPDX-License-Identifier: BSD-2-Clause-Patent | ||
**/ | ||
|
||
#ifndef REDFISH_MESSAGE_LIB_H_ | ||
#define REDFISH_MESSAGE_LIB_H_ | ||
|
||
#include <Uefi.h> | ||
|
||
/// | ||
/// Definition of REDFISH_MESSAGE_SEVERITY | ||
/// | ||
typedef enum { | ||
RedfishMessageSeverityOk = 0x0, | ||
RedfishMessageSeverityWarning, | ||
RedfishMessageSeverityCritical, | ||
RedfishMessageSeverityMax | ||
} REDFISH_MESSAGE_SEVERITY; | ||
|
||
typedef struct { | ||
CHAR8 *Message; | ||
CHAR8 *Resolution; | ||
REDFISH_MESSAGE_SEVERITY MessageSeverity; | ||
} REDFISH_MESSAGE_DATA; | ||
|
||
/** | ||
Add Redfish message to given resource URI. | ||
@param[in] ResourceUri Report Redfish message to this resource URI. | ||
@param[in] Message String message. | ||
@param[in] Resolution Resolution message. This is optional. | ||
@param[in] MessageSeverity Message severity. | ||
@retval EFI_SUCCESS Redfish message is reported. | ||
@retval Others Error occurs. | ||
**/ | ||
EFI_STATUS | ||
RedfishMessageReport ( | ||
IN EFI_STRING ResourceUri, | ||
IN CHAR8 *Message, | ||
IN CHAR8 *Resolution OPTIONAL, | ||
IN REDFISH_MESSAGE_SEVERITY MessageSeverity | ||
); | ||
|
||
/** | ||
Get all messages reported to given URI. It's caller's responsibility to release | ||
MessageArray by calling RedfishMessageFree(). | ||
@param[in] TargetUri Report Redfish message to this resource URI. | ||
@param[out] MessageArray The array of REDFISH_MESSAGE_DATA. | ||
@param[out] MessageCount The number of REDFISH_MESSAGE_DATA in MessageArray. | ||
@retval EFI_SUCCESS Redfish message is reported. | ||
@retval Others Error occurs. | ||
**/ | ||
EFI_STATUS | ||
RedfishMessageGet ( | ||
IN EFI_STRING TargetUri, | ||
OUT REDFISH_MESSAGE_DATA **MessageArray, | ||
OUT UINTN *MessageCount | ||
); | ||
|
||
/** | ||
Release MessageArray. | ||
@param[in] MessageArray The array of REDFISH_MESSAGE_DATA. | ||
@param[in] MessageCount The number of REDFISH_MESSAGE_DATA in MessageArray. | ||
@retval EFI_SUCCESS Redfish message is released. | ||
@retval Others Error occurs. | ||
**/ | ||
EFI_STATUS | ||
RedfishMessageFree ( | ||
IN REDFISH_MESSAGE_DATA *MessageArray, | ||
IN UINTN MessageCount | ||
); | ||
|
||
#endif |
57 changes: 57 additions & 0 deletions
57
RedfishClientPkg/Library/RedfishMessageLib/RedfishMessageInternal.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/** @file | ||
Redfish message library internal header file. | ||
Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
SPDX-License-Identifier: BSD-2-Clause-Patent | ||
**/ | ||
|
||
#ifndef REDFISH_MESSAGE_INTERNAL_H_ | ||
#define REDFISH_MESSAGE_INTERNAL_H_ | ||
|
||
#include <Uefi.h> | ||
#include <RedfishBase.h> | ||
#include <Library/UefiLib.h> | ||
#include <Library/BaseLib.h> | ||
#include <Library/DebugLib.h> | ||
#include <Library/BaseMemoryLib.h> | ||
#include <Library/MemoryAllocationLib.h> | ||
#include <Library/RedfishMessageLib.h> | ||
|
||
#define REDFISH_MESSAGE_DEBUG DEBUG_ERROR | ||
#define REDFISH_MESSAGE_MAX 0xFF | ||
|
||
/// | ||
/// Definition of REDFISH_MESSAGE_RECORD | ||
/// | ||
typedef struct { | ||
LIST_ENTRY List; | ||
CHAR8 *Message; | ||
CHAR8 *Resolution; | ||
REDFISH_MESSAGE_SEVERITY MessageSeverity; | ||
} REDFISH_MESSAGE_RECORD; | ||
|
||
#define REDFISH_MESSAGE_RECORD_FROM_LIST(a) BASE_CR (a, REDFISH_MESSAGE_RECORD, List) | ||
|
||
/// | ||
/// Definition of REDFISH_MESSAGE_ENTRY | ||
/// | ||
typedef struct { | ||
LIST_ENTRY List; | ||
EFI_STRING Uri; | ||
LIST_ENTRY MessageHead; | ||
UINTN Count; | ||
} REDFISH_MESSAGE_ENTRY; | ||
|
||
#define REDFISH_MESSAGE_ENTRY_FROM_LIST(a) BASE_CR (a, REDFISH_MESSAGE_ENTRY, List) | ||
|
||
/// | ||
/// Definition of REDFISH_MESSAGE_INFO | ||
/// | ||
typedef struct { | ||
LIST_ENTRY ListHead; | ||
UINTN Count; | ||
} REDFISH_MESSAGE_PRIVATE; | ||
|
||
#endif |
Oops, something went wrong.