public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH 0/3] Small SMM status code handler fixes
@ 2023-07-06  2:48 Isaac Oram
  2023-07-06  2:48 ` [PATCH 1/3] MdeModulePkg/StatusCodeHandlerSmm: Remove unused code Isaac Oram
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Isaac Oram @ 2023-07-06  2:48 UTC (permalink / raw)
  To: devel; +Cc: Isaac Oram, Dandan Bi, Liming Gao, Michael D Kinney, Zhiguang Liu

This is some minor housekeeping on SMM status code handling.
https://github.com/tianocore/edk2/pull/4610

Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Signed-off-by: Isaac Oram <isaac.w.oram@intel.com>

Isaac Oram (3):
  MdeModulePkg/StatusCodeHandlerSmm: Remove unused code
  MdeModulePkg/StatusCodeHandlerSmm: Clarify ASSERT source
  MdePkg/ReportStatusCodeLib: Add macros to identify status codes

 .../Include/Guid/MemoryStatusCodeRecord.h     |  2 +-
 .../RuntimeDxe/StatusCodeHandlerRuntimeDxe.h  | 11 ----
 .../Smm/SerialStatusCodeWorker.c              |  2 +-
 .../Smm/StatusCodeHandlerMm.h                 | 11 ----
 MdePkg/Include/Library/ReportStatusCodeLib.h  | 61 +++++++++++--------
 5 files changed, 36 insertions(+), 51 deletions(-)

--
2.40.0.windows.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/3] MdeModulePkg/StatusCodeHandlerSmm: Remove unused code
  2023-07-06  2:48 [PATCH 0/3] Small SMM status code handler fixes Isaac Oram
@ 2023-07-06  2:48 ` Isaac Oram
  2023-07-06  2:48 ` [PATCH 2/3] MdeModulePkg/StatusCodeHandlerSmm: Clarify ASSERT source Isaac Oram
  2023-07-06  2:48 ` [PATCH 3/3] MdePkg/ReportStatusCodeLib: Add macros to identify status codes Isaac Oram
  2 siblings, 0 replies; 4+ messages in thread
From: Isaac Oram @ 2023-07-06  2:48 UTC (permalink / raw)
  To: devel; +Cc: Isaac Oram, Dandan Bi, Liming Gao, Michael D Kinney

Serial worker does not have this initialization function implemented.

Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Signed-off-by: Isaac Oram <isaac.w.oram@intel.com>
---
 .../RuntimeDxe/StatusCodeHandlerRuntimeDxe.h          | 11 -----------
 .../StatusCodeHandler/Smm/StatusCodeHandlerMm.h       | 11 -----------
 2 files changed, 22 deletions(-)

diff --git a/MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHandlerRuntimeDxe.h b/MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHandlerRuntimeDxe.h
index 7fa06389bb..26ad9e3585 100644
--- a/MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHandlerRuntimeDxe.h
+++ b/MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHandlerRuntimeDxe.h
@@ -37,17 +37,6 @@
 
 extern RUNTIME_MEMORY_STATUSCODE_HEADER  *mRtMemoryStatusCodeTable;
 
-/**
-  Locates Serial I/O Protocol as initialization for serial status code worker.
-
-  @retval EFI_SUCCESS  Serial I/O Protocol is successfully located.
-
-**/
-EFI_STATUS
-EfiSerialStatusCodeInitializeWorker (
-  VOID
-  );
-
 /**
   Convert status code value and extended data to readable ASCII string, send string to serial I/O device.
 
diff --git a/MdeModulePkg/Universal/StatusCodeHandler/Smm/StatusCodeHandlerMm.h b/MdeModulePkg/Universal/StatusCodeHandler/Smm/StatusCodeHandlerMm.h
index e416220cb5..8196b0963d 100644
--- a/MdeModulePkg/Universal/StatusCodeHandler/Smm/StatusCodeHandlerMm.h
+++ b/MdeModulePkg/Universal/StatusCodeHandler/Smm/StatusCodeHandlerMm.h
@@ -34,17 +34,6 @@
 
 extern RUNTIME_MEMORY_STATUSCODE_HEADER  *mMmMemoryStatusCodeTable;
 
-/**
-  Locates Serial I/O Protocol as initialization for serial status code worker.
-
-  @retval EFI_SUCCESS  Serial I/O Protocol is successfully located.
-
-**/
-EFI_STATUS
-EfiSerialStatusCodeInitializeWorker (
-  VOID
-  );
-
 /**
   Convert status code value and extended data to readable ASCII string, send string to serial I/O device.
 
-- 
2.40.0.windows.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/3] MdeModulePkg/StatusCodeHandlerSmm: Clarify ASSERT source
  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 ` Isaac Oram
  2023-07-06  2:48 ` [PATCH 3/3] MdePkg/ReportStatusCodeLib: Add macros to identify status codes Isaac Oram
  2 siblings, 0 replies; 4+ messages in thread
From: Isaac Oram @ 2023-07-06  2:48 UTC (permalink / raw)
  To: devel; +Cc: Isaac Oram, Dandan Bi, Liming Gao, Michael D Kinney

Disambiguate SMM sourced asserts from other DXE asserts.

Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Signed-off-by: Isaac Oram <isaac.w.oram@intel.com>
---
 .../Universal/StatusCodeHandler/Smm/SerialStatusCodeWorker.c    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/MdeModulePkg/Universal/StatusCodeHandler/Smm/SerialStatusCodeWorker.c b/MdeModulePkg/Universal/StatusCodeHandler/Smm/SerialStatusCodeWorker.c
index e994e69e48..8a11c0f6bb 100644
--- a/MdeModulePkg/Universal/StatusCodeHandler/Smm/SerialStatusCodeWorker.c
+++ b/MdeModulePkg/Universal/StatusCodeHandler/Smm/SerialStatusCodeWorker.c
@@ -57,7 +57,7 @@ SerialStatusCodeReportWorker (
     CharCount = AsciiSPrint (
                   Buffer,
                   sizeof (Buffer),
-                  "\n\rDXE_ASSERT!: %a (%d): %a\n\r",
+                  "\n\rSMM_ASSERT!: %a (%d): %a\n\r",
                   Filename,
                   LineNumber,
                   Description
-- 
2.40.0.windows.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 3/3] MdePkg/ReportStatusCodeLib: Add macros to identify status codes
  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
  2 siblings, 0 replies; 4+ messages in thread
From: Isaac Oram @ 2023-07-06  2:48 UTC (permalink / raw)
  To: devel; +Cc: Isaac Oram, Michael D Kinney, Liming Gao, Zhiguang Liu

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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-07-06  2:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [PATCH 3/3] MdePkg/ReportStatusCodeLib: Add macros to identify status codes Isaac Oram

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox