summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNickle Wang <nicklew@nvidia.com>2024-09-09 11:09:35 +0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2024-09-27 18:59:04 +0000
commit48b5815d7771b92f343bfa2b32b70be36c98e6f3 (patch)
tree8889553ea8c46527be248d4b86438f6f94ff6e9c
parent8b295e0aad55cdf0c20eba6398862832ce188a0c (diff)
downloadedk2-48b5815d7771b92f343bfa2b32b70be36c98e6f3.tar.gz
edk2-48b5815d7771b92f343bfa2b32b70be36c98e6f3.tar.bz2
edk2-48b5815d7771b92f343bfa2b32b70be36c98e6f3.zip
RedfishPkg/Include: add common RedfishPkg header file.
IS_EMPTY_STRING macro is defined in multiple drivers in RedfishPkg. So, I create RedfishCommon.h to keep common macros that we can use in RedfishPkg. Signed-off-by: Nickle Wang <nicklew@nvidia.com>
-rw-r--r--RedfishPkg/Include/RedfishCommon.h17
-rw-r--r--RedfishPkg/Library/RedfishDebugLib/RedfishDebugLib.c6
-rw-r--r--RedfishPkg/RedfishCredentialDxe/RedfishCredentialDxe.h6
-rw-r--r--RedfishPkg/RedfishHttpDxe/RedfishHttpDxe.h2
-rw-r--r--RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigImpl.h2
5 files changed, 22 insertions, 11 deletions
diff --git a/RedfishPkg/Include/RedfishCommon.h b/RedfishPkg/Include/RedfishCommon.h
new file mode 100644
index 0000000000..18244e9855
--- /dev/null
+++ b/RedfishPkg/Include/RedfishCommon.h
@@ -0,0 +1,17 @@
+/** @file
+ This header file defines common macros for the use in RedfishPkg.
+
+ Copyright (c) 2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef REDFISH_COMMON_H_
+#define REDFISH_COMMON_H_
+
+#ifndef IS_EMPTY_STRING
+#define IS_EMPTY_STRING(a) ((a) == NULL || (a)[0] == '\0')
+#endif
+
+#endif
diff --git a/RedfishPkg/Library/RedfishDebugLib/RedfishDebugLib.c b/RedfishPkg/Library/RedfishDebugLib/RedfishDebugLib.c
index f8bb51ff53..694a087815 100644
--- a/RedfishPkg/Library/RedfishDebugLib/RedfishDebugLib.c
+++ b/RedfishPkg/Library/RedfishDebugLib/RedfishDebugLib.c
@@ -9,7 +9,7 @@
**/
#include <Uefi.h>
-
+#include <RedfishCommon.h>
#include <Library/BaseLib.h>
#include <Library/DebugLib.h>
#include <Library/MemoryAllocationLib.h>
@@ -17,10 +17,6 @@
#include <Library/RedfishHttpLib.h>
#include <Library/UefiLib.h>
-#ifndef IS_EMPTY_STRING
-#define IS_EMPTY_STRING(a) ((a) == NULL || (a)[0] == '\0')
-#endif
-
#define REDFISH_JSON_STRING_LENGTH 200
#define REDFISH_JSON_OUTPUT_FORMAT (EDKII_JSON_COMPACT | EDKII_JSON_INDENT(2))
#define REDFISH_PRINT_BUFFER_BYTES_PER_ROW 16
diff --git a/RedfishPkg/RedfishCredentialDxe/RedfishCredentialDxe.h b/RedfishPkg/RedfishCredentialDxe/RedfishCredentialDxe.h
index 4988afab44..271f884ec9 100644
--- a/RedfishPkg/RedfishCredentialDxe/RedfishCredentialDxe.h
+++ b/RedfishPkg/RedfishCredentialDxe/RedfishCredentialDxe.h
@@ -3,6 +3,7 @@
(C) Copyright 2020 Hewlett Packard Enterprise Development LP<BR>
(C) Copyright 2024 American Megatrends International LLC<BR>
+ Copyright (c) 2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -11,6 +12,7 @@
#ifndef EDKII_REDFISH_CREDENTIAL_DXE_H_
#define EDKII_REDFISH_CREDENTIAL_DXE_H_
+#include <RedfishCommon.h>
#include <Protocol/EdkIIRedfishCredential2.h>
#include <Library/BaseLib.h>
@@ -29,10 +31,6 @@
#define REDFISH_MANAGER_ACCOUNT_COLLECTION_URI L"AccountService/Accounts"
#define REDFISH_URI_LENGTH 128
-#ifndef IS_EMPTY_STRING
-#define IS_EMPTY_STRING(a) ((a) == NULL || (a)[0] == '\0')
-#endif
-
///
/// Definition of REDFISH_SERVICE_LIST
///
diff --git a/RedfishPkg/RedfishHttpDxe/RedfishHttpDxe.h b/RedfishPkg/RedfishHttpDxe/RedfishHttpDxe.h
index 0c40423655..38c3cd24a4 100644
--- a/RedfishPkg/RedfishHttpDxe/RedfishHttpDxe.h
+++ b/RedfishPkg/RedfishHttpDxe/RedfishHttpDxe.h
@@ -11,6 +11,7 @@
#define EDKII_REDFISH_HTTP_DXE_H_
#include <Uefi.h>
+#include <RedfishCommon.h>
#include <IndustryStandard/Http11.h>
#include <Library/UefiLib.h>
@@ -31,7 +32,6 @@
#include <Protocol/EdkIIRedfishCredential2.h>
#include <Protocol/RestEx.h>
-#define IS_EMPTY_STRING(a) ((a) == NULL || (a)[0] == '\0')
#define REDFISH_HTTP_CACHE_LIST_SIZE 0x80
#define REDFISH_ERROR_MSG_MAX 128
#define REDFISH_DEBUG_STRING_LENGTH 200
diff --git a/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigImpl.h b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigImpl.h
index 525ca43fa9..9ac7f26857 100644
--- a/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigImpl.h
+++ b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigImpl.h
@@ -13,6 +13,7 @@
#define EDKII_REDFISH_PLATFORM_CONFIG_IMPL_H_
#include <Uefi.h>
+#include <RedfishCommon.h>
//
// Libraries
@@ -27,7 +28,6 @@
#include <Library/UefiBootServicesTableLib.h>
#include <Library/UefiLib.h>
-#define IS_EMPTY_STRING(a) (a == NULL || a[0] == L'\0')
#define ENGLISH_LANGUAGE_CODE "en-US"
#define X_UEFI_SCHEMA_PREFIX "x-UEFI-redfish-"