summaryrefslogtreecommitdiff
path: root/RedfishPkg/Include
diff options
context:
space:
mode:
authorAbner Chang <abner.chang@amd.com>2024-03-18 10:32:44 +0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2024-04-04 14:24:31 +0000
commitb0be42516e757ff54fb92b9a984ecb84512460d7 (patch)
tree786315f90ff3ddcc9edc98edbdbf0a5df6a44235 /RedfishPkg/Include
parent29114fc5744be0fb877ad9775b6463b92f92c32d (diff)
downloadedk2-b0be42516e757ff54fb92b9a984ecb84512460d7.zip
edk2-b0be42516e757ff54fb92b9a984ecb84512460d7.tar.gz
edk2-b0be42516e757ff54fb92b9a984ecb84512460d7.tar.bz2
RedfishPkg/RedfishDebugLib: Introduce Redfish DEBUG macro
Introduce DEBUG_REDFISH macro for the debug message of edk2 Redfish components. DEBUG_REDFISH can be used in any edk2 Redfish component with Redfish DebugCatagory as the first parameter. Whether the debug message is output or not depends on the platform setting of PcdRedfishDebugCatagory. Signed-off-by: Abner Chang <abner.chang@amd.com> Cc: Nickle Wang <nicklew@nvidia.com> Cc: Igor Kulchytskyy <igork@ami.com> Reviewed-by: Nickle Wang <nicklew@nvidia.com> Reviewed-by: Igor Kulchytskyy <igork@ami.com>
Diffstat (limited to 'RedfishPkg/Include')
-rw-r--r--RedfishPkg/Include/Library/RedfishDebugLib.h43
1 files changed, 32 insertions, 11 deletions
diff --git a/RedfishPkg/Include/Library/RedfishDebugLib.h b/RedfishPkg/Include/Library/RedfishDebugLib.h
index ad7a697..19e5a89 100644
--- a/RedfishPkg/Include/Library/RedfishDebugLib.h
+++ b/RedfishPkg/Include/Library/RedfishDebugLib.h
@@ -2,6 +2,7 @@
This file defines the Redfish debug library interface.
Copyright (c) 2023-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
@@ -11,28 +12,48 @@
#define REDFISH_DEBUG_LIB_H_
#include <Uefi.h>
+#include <Library/DebugLib.h>
#include <RedfishServiceData.h>
#include <Library/HiiUtilityLib.h>
#include <Library/JsonLib.h>
#include <Protocol/EdkIIRedfishPlatformConfig.h>
-#define DEBUG_REDFISH_NETWORK DEBUG_MANAGEABILITY ///< Debug error level for Redfish networking function
-#define DEBUG_REDFISH_HOST_INTERFACE DEBUG_MANAGEABILITY ///< Debug error level for Redfish networking function
+// Used with MdePKg DEBUG macro.
+#define DEBUG_REDFISH_NETWORK DEBUG_MANAGEABILITY ///< Debug error level for Redfish networking function
+#define DEBUG_REDFISH_HOST_INTERFACE DEBUG_MANAGEABILITY ///< Debug error level for Redfish Host INterface
+#define DEBUG_REDFISH_PLATFORM_CONFIG DEBUG_MANAGEABILITY ///< Debug error level for Redfish Platform Configure Driver
+
+//
+// Definitions of Redfish debug capability in Redfish component scope, used with DEBUG_REDFISH macro
+// For example, Redfish Platform Config Driver
+// DEBUG_REDFISH(DEBUG_REDFISH_PLATFORM_CONFIG_DXE, ...)
+//
+#define DEBUG_REDFISH_COMPONENT_PLATFORM_CONFIG_DXE 0x00000001
+
+#define DEBUG_REDFISH(DebugCategory, ...) \
+ do { \
+ if (!DebugPrintEnabled()) { \
+ break; \
+ } \
+ if (!DebugRedfishComponentEnabled (DebugCategory)) { \
+ break; \
+ } \
+ DEBUG ((DEBUG_MANAGEABILITY, ##__VA_ARGS__)); \
+ } while (FALSE)
/**
- Debug print the value of StatementValue.
+ Determine whether the Redfish debug category is enabled in
+ gEfiRedfishPkgTokenSpaceGuid.PcdRedfishDebugCategory.
- @param[in] ErrorLevel DEBUG macro error level.
- @param[in] StatementValue The statement value to print.
+ @param[in] DebugCategory Redfish debug category.
- @retval EFI_SUCCESS StatementValue is printed.
- @retval EFI_INVALID_PARAMETER StatementValue is NULL.
+ @retval TRUE This debug category is enabled.
+ @retval FALSE This debug category is disabled..
**/
-EFI_STATUS
-DumpHiiStatementValue (
- IN UINTN ErrorLevel,
- IN HII_STATEMENT_VALUE *StatementValue
+BOOLEAN
+DebugRedfishComponentEnabled (
+ IN UINT64 DebugCategory
);
/**