From: "Isaac Oram" <isaac.w.oram@intel.com>
To: devel@edk2.groups.io
Cc: Isaac Oram <isaac.w.oram@intel.com>,
Michael D Kinney <michael.d.kinney@intel.com>,
Liming Gao <gaoliming@byosoft.com.cn>,
Zhiguang Liu <zhiguang.liu@intel.com>
Subject: [PATCH 3/3] MdePkg/ReportStatusCodeLib: Add macros to identify status codes
Date: Wed, 5 Jul 2023 19:48:17 -0700 [thread overview]
Message-ID: <853fbda72e07356a1e3691373156c4ac4f18b0d6.1688611420.git.isaac.w.oram@intel.com> (raw)
In-Reply-To: <cover.1688611420.git.isaac.w.oram@intel.com>
Add macros that make it easier to determine if a status code
is an error, progress, or debug code.
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Signed-off-by: Isaac Oram <isaac.w.oram@intel.com>
---
.../Include/Guid/MemoryStatusCodeRecord.h | 2 +-
MdePkg/Include/Library/ReportStatusCodeLib.h | 61 +++++++++++--------
2 files changed, 35 insertions(+), 28 deletions(-)
diff --git a/MdeModulePkg/Include/Guid/MemoryStatusCodeRecord.h b/MdeModulePkg/Include/Guid/MemoryStatusCodeRecord.h
index a924c592c9..5e01600891 100644
--- a/MdeModulePkg/Include/Guid/MemoryStatusCodeRecord.h
+++ b/MdeModulePkg/Include/Guid/MemoryStatusCodeRecord.h
@@ -56,7 +56,7 @@ typedef struct {
///
typedef struct {
///
- /// The index pointing to the last recored being stored.
+ /// The index pointing to the last record being stored.
///
UINT32 RecordIndex;
///
diff --git a/MdePkg/Include/Library/ReportStatusCodeLib.h b/MdePkg/Include/Library/ReportStatusCodeLib.h
index 3763e69928..4b6647d91d 100644
--- a/MdePkg/Include/Library/ReportStatusCodeLib.h
+++ b/MdePkg/Include/Library/ReportStatusCodeLib.h
@@ -20,6 +20,13 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#define REPORT_STATUS_CODE_PROPERTY_ERROR_CODE_ENABLED 0x00000002
#define REPORT_STATUS_CODE_PROPERTY_DEBUG_CODE_ENABLED 0x00000004
+//
+// Helpers for parsing status codes
+//
+#define IS_ERROR_STATUS_CODE(Type) (((Type) & EFI_STATUS_CODE_TYPE_MASK) == EFI_ERROR_CODE)
+#define IS_PROGRESS_STATUS_CODE(Type) (((Type) & EFI_STATUS_CODE_TYPE_MASK) == EFI_PROGRESS_CODE)
+#define IS_DEBUG_STATUS_CODE(Type) (((Type) & EFI_STATUS_CODE_TYPE_MASK) == EFI_DEBUG_CODE)
+
/**
Converts a status code to an 8-bit POST code value.
@@ -363,13 +370,13 @@ ReportDebugCodeEnabled (
@retval EFI_UNSUPPORTED Report status code is not supported.
**/
-#define REPORT_STATUS_CODE(Type, Value) \
- (ReportProgressCodeEnabled() && ((Type) & EFI_STATUS_CODE_TYPE_MASK) == EFI_PROGRESS_CODE) ? \
- ReportStatusCode(Type,Value) : \
- (ReportErrorCodeEnabled() && ((Type) & EFI_STATUS_CODE_TYPE_MASK) == EFI_ERROR_CODE) ? \
- ReportStatusCode(Type,Value) : \
- (ReportDebugCodeEnabled() && ((Type) & EFI_STATUS_CODE_TYPE_MASK) == EFI_DEBUG_CODE) ? \
- ReportStatusCode(Type,Value) : \
+#define REPORT_STATUS_CODE(Type, Value) \
+ (ReportProgressCodeEnabled () && IS_PROGRESS_STATUS_CODE (Type)) ? \
+ ReportStatusCode (Type, Value) : \
+ (ReportErrorCodeEnabled () && IS_ERROR_STATUS_CODE (Type)) ? \
+ ReportStatusCode (Type, Value) : \
+ (ReportDebugCodeEnabled () && IS_DEBUG_STATUS_CODE (Type)) ? \
+ ReportStatusCode (Type, Value) : \
EFI_UNSUPPORTED
/**
@@ -393,13 +400,13 @@ ReportDebugCodeEnabled (
is already in progress.
**/
-#define REPORT_STATUS_CODE_WITH_DEVICE_PATH(Type, Value, DevicePathParameter) \
- (ReportProgressCodeEnabled() && ((Type) & EFI_STATUS_CODE_TYPE_MASK) == EFI_PROGRESS_CODE) ? \
- ReportStatusCodeWithDevicePath(Type,Value,DevicePathParameter) : \
- (ReportErrorCodeEnabled() && ((Type) & EFI_STATUS_CODE_TYPE_MASK) == EFI_ERROR_CODE) ? \
- ReportStatusCodeWithDevicePath(Type,Value,DevicePathParameter) : \
- (ReportDebugCodeEnabled() && ((Type) & EFI_STATUS_CODE_TYPE_MASK) == EFI_DEBUG_CODE) ? \
- ReportStatusCodeWithDevicePath(Type,Value,DevicePathParameter) : \
+#define REPORT_STATUS_CODE_WITH_DEVICE_PATH(Type, Value, DevicePathParameter) \
+ (ReportProgressCodeEnabled () && IS_PROGRESS_STATUS_CODE (Type)) ? \
+ ReportStatusCodeWithDevicePath (Type, Value, DevicePathParameter) : \
+ (ReportErrorCodeEnabled () && IS_ERROR_STATUS_CODE (Type)) ? \
+ ReportStatusCodeWithDevicePath (Type, Value, DevicePathParameter) : \
+ (ReportDebugCodeEnabled () && IS_DEBUG_STATUS_CODE (Type)) ? \
+ ReportStatusCodeWithDevicePath (Type, Value, DevicePathParameter) : \
EFI_UNSUPPORTED
/**
@@ -425,13 +432,13 @@ ReportDebugCodeEnabled (
is already in progress.
**/
-#define REPORT_STATUS_CODE_WITH_EXTENDED_DATA(Type, Value, ExtendedData, ExtendedDataSize) \
- (ReportProgressCodeEnabled() && ((Type) & EFI_STATUS_CODE_TYPE_MASK) == EFI_PROGRESS_CODE) ? \
- ReportStatusCodeWithExtendedData(Type,Value,ExtendedData,ExtendedDataSize) : \
- (ReportErrorCodeEnabled() && ((Type) & EFI_STATUS_CODE_TYPE_MASK) == EFI_ERROR_CODE) ? \
- ReportStatusCodeWithExtendedData(Type,Value,ExtendedData,ExtendedDataSize) : \
- (ReportDebugCodeEnabled() && ((Type) & EFI_STATUS_CODE_TYPE_MASK) == EFI_DEBUG_CODE) ? \
- ReportStatusCodeWithExtendedData(Type,Value,ExtendedData,ExtendedDataSize) : \
+#define REPORT_STATUS_CODE_WITH_EXTENDED_DATA(Type, Value, ExtendedData, ExtendedDataSize) \
+ (ReportProgressCodeEnabled () && IS_PROGRESS_STATUS_CODE (Type)) ? \
+ ReportStatusCodeWithExtendedData (Type, Value, ExtendedData, ExtendedDataSize) : \
+ (ReportErrorCodeEnabled () && IS_ERROR_STATUS_CODE (Type)) ? \
+ ReportStatusCodeWithExtendedData (Type, Value, ExtendedData, ExtendedDataSize) : \
+ (ReportDebugCodeEnabled () && IS_DEBUG_STATUS_CODE (Type)) ? \
+ ReportStatusCodeWithExtendedData (Type, Value, ExtendedData, ExtendedDataSize) : \
EFI_UNSUPPORTED
/**
@@ -463,12 +470,12 @@ ReportDebugCodeEnabled (
**/
#define REPORT_STATUS_CODE_EX(Type, Value, Instance, CallerId, ExtendedDataGuid, ExtendedData, ExtendedDataSize) \
- (ReportProgressCodeEnabled() && ((Type) & EFI_STATUS_CODE_TYPE_MASK) == EFI_PROGRESS_CODE) ? \
- ReportStatusCodeEx(Type,Value,Instance,CallerId,ExtendedDataGuid,ExtendedData,ExtendedDataSize) : \
- (ReportErrorCodeEnabled() && ((Type) & EFI_STATUS_CODE_TYPE_MASK) == EFI_ERROR_CODE) ? \
- ReportStatusCodeEx(Type,Value,Instance,CallerId,ExtendedDataGuid,ExtendedData,ExtendedDataSize) : \
- (ReportDebugCodeEnabled() && ((Type) & EFI_STATUS_CODE_TYPE_MASK) == EFI_DEBUG_CODE) ? \
- ReportStatusCodeEx(Type,Value,Instance,CallerId,ExtendedDataGuid,ExtendedData,ExtendedDataSize) : \
+ (ReportProgressCodeEnabled () && IS_PROGRESS_STATUS_CODE (Type)) ? \
+ ReportStatusCodeEx (Type, Value, Instance, CallerId, ExtendedDataGuid, ExtendedData, ExtendedDataSize) : \
+ (ReportErrorCodeEnabled () && IS_ERROR_STATUS_CODE (Type)) ? \
+ ReportStatusCodeEx (Type, Value, Instance, CallerId, ExtendedDataGuid, ExtendedData, ExtendedDataSize) : \
+ (ReportDebugCodeEnabled () && IS_DEBUG_STATUS_CODE (Type)) ? \
+ ReportStatusCodeEx (Type, Value, Instance, CallerId, ExtendedDataGuid, ExtendedData, ExtendedDataSize) : \
EFI_UNSUPPORTED
#endif
--
2.40.0.windows.1
prev parent reply other threads:[~2023-07-06 2:48 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-06 2:48 [PATCH 0/3] Small SMM status code handler fixes Isaac Oram
2023-07-06 2:48 ` [PATCH 1/3] MdeModulePkg/StatusCodeHandlerSmm: Remove unused code Isaac Oram
2023-07-06 2:48 ` [PATCH 2/3] MdeModulePkg/StatusCodeHandlerSmm: Clarify ASSERT source Isaac Oram
2023-07-06 2:48 ` Isaac Oram [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=853fbda72e07356a1e3691373156c4ac4f18b0d6.1688611420.git.isaac.w.oram@intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox