summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Universal/StatusCodeHandler
diff options
context:
space:
mode:
authorkx <kx@radix.pro>2024-06-04 06:43:08 +0300
committerkx <kx@radix.pro>2024-06-04 06:43:08 +0300
commit7e2ccccace24636f29ddc210b94606abd4c7e42b (patch)
tree545d43ea12671048956cafeb12303e84d601e571 /MdeModulePkg/Universal/StatusCodeHandler
parent27b044605cd5f6b33a3d231576003850b3fe305b (diff)
downloadedk2-trunk.tar.xz
Renormalized end-of-lines from master@27b044605cd5f6b33a3d231576003850b3fe305btrunk
Diffstat (limited to 'MdeModulePkg/Universal/StatusCodeHandler')
-rw-r--r--MdeModulePkg/Universal/StatusCodeHandler/Pei/MemoryStausCodeWorker.c236
-rw-r--r--MdeModulePkg/Universal/StatusCodeHandler/Pei/SerialStatusCodeWorker.c326
-rw-r--r--MdeModulePkg/Universal/StatusCodeHandler/Pei/StatusCodeHandlerPei.c126
-rw-r--r--MdeModulePkg/Universal/StatusCodeHandler/Pei/StatusCodeHandlerPei.h230
-rw-r--r--MdeModulePkg/Universal/StatusCodeHandler/Pei/StatusCodeHandlerPei.inf130
-rw-r--r--MdeModulePkg/Universal/StatusCodeHandler/Pei/StatusCodeHandlerPei.uni32
-rw-r--r--MdeModulePkg/Universal/StatusCodeHandler/Pei/StatusCodeHandlerPeiExtra.uni28
-rw-r--r--MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/MemoryStatusCodeWorker.c212
-rw-r--r--MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/SerialStatusCodeWorker.c338
-rw-r--r--MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHandlerRuntimeDxe.c380
-rw-r--r--MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHandlerRuntimeDxe.h262
-rw-r--r--MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHandlerRuntimeDxe.inf142
-rw-r--r--MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHandlerRuntimeDxe.uni32
-rw-r--r--MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHandlerRuntimeDxeExtra.uni28
-rw-r--r--MdeModulePkg/Universal/StatusCodeHandler/Smm/MemoryStatusCodeWorker.c206
-rw-r--r--MdeModulePkg/Universal/StatusCodeHandler/Smm/SerialStatusCodeWorker.c316
-rw-r--r--MdeModulePkg/Universal/StatusCodeHandler/Smm/StatusCodeHandlerMm.c160
-rw-r--r--MdeModulePkg/Universal/StatusCodeHandler/Smm/StatusCodeHandlerMm.h258
-rw-r--r--MdeModulePkg/Universal/StatusCodeHandler/Smm/StatusCodeHandlerSmm.inf132
-rw-r--r--MdeModulePkg/Universal/StatusCodeHandler/Smm/StatusCodeHandlerSmm.uni32
-rw-r--r--MdeModulePkg/Universal/StatusCodeHandler/Smm/StatusCodeHandlerSmmExtra.uni28
-rw-r--r--MdeModulePkg/Universal/StatusCodeHandler/Smm/StatusCodeHandlerStandalone.c62
-rw-r--r--MdeModulePkg/Universal/StatusCodeHandler/Smm/StatusCodeHandlerStandaloneMm.inf126
-rw-r--r--MdeModulePkg/Universal/StatusCodeHandler/Smm/StatusCodeHandlerTraditional.c62
24 files changed, 1942 insertions, 1942 deletions
diff --git a/MdeModulePkg/Universal/StatusCodeHandler/Pei/MemoryStausCodeWorker.c b/MdeModulePkg/Universal/StatusCodeHandler/Pei/MemoryStausCodeWorker.c
index 1980ab8c53..b2da1e7620 100644
--- a/MdeModulePkg/Universal/StatusCodeHandler/Pei/MemoryStausCodeWorker.c
+++ b/MdeModulePkg/Universal/StatusCodeHandler/Pei/MemoryStausCodeWorker.c
@@ -1,118 +1,118 @@
-/** @file
- PEI memory status code worker.
-
- Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include "StatusCodeHandlerPei.h"
-
-/**
- Create the first memory status code GUID'ed HOB as initialization for memory status code worker.
-
- @retval EFI_SUCCESS The GUID'ed HOB is created successfully.
-
-**/
-EFI_STATUS
-MemoryStatusCodeInitializeWorker (
- VOID
- )
-{
- //
- // Create memory status code GUID'ed HOB.
- //
- MEMORY_STATUSCODE_PACKET_HEADER *PacketHeader;
-
- //
- // Build GUID'ed HOB with PCD defined size.
- //
- PacketHeader = BuildGuidHob (
- &gMemoryStatusCodeRecordGuid,
- PcdGet16 (PcdStatusCodeMemorySize) * 1024 + sizeof (MEMORY_STATUSCODE_PACKET_HEADER)
- );
- ASSERT (PacketHeader != NULL);
-
- PacketHeader->MaxRecordsNumber = (PcdGet16 (PcdStatusCodeMemorySize) * 1024) / sizeof (MEMORY_STATUSCODE_RECORD);
- PacketHeader->PacketIndex = 0;
- PacketHeader->RecordIndex = 0;
-
- return EFI_SUCCESS;
-}
-
-/**
- Report status code into GUID'ed HOB.
-
- This function reports status code into GUID'ed HOB. If not all packets are full, then
- write status code into available entry. Otherwise, create a new packet for it.
-
- @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
- @param CodeType Indicates the type of status code being reported.
- @param Value Describes the current status of a hardware or
- software entity. This includes information about the class and
- subclass that is used to classify the entity as well as an operation.
- For progress codes, the operation is the current activity.
- For error codes, it is the exception.For debug codes,it is not defined at this time.
- @param Instance The enumeration of a hardware or software entity within
- the system. A system may contain multiple entities that match a class/subclass
- pairing. The instance differentiates between them. An instance of 0 indicates
- that instance information is unavailable, not meaningful, or not relevant.
- Valid instance numbers start with 1.
- @param CallerId This optional parameter may be used to identify the caller.
- This parameter allows the status code driver to apply different rules to
- different callers.
- @param Data This optional parameter may be used to pass additional data.
-
- @retval EFI_SUCCESS The function always return EFI_SUCCESS.
-
-**/
-EFI_STATUS
-EFIAPI
-MemoryStatusCodeReportWorker (
- IN CONST EFI_PEI_SERVICES **PeiServices,
- IN EFI_STATUS_CODE_TYPE CodeType,
- IN EFI_STATUS_CODE_VALUE Value,
- IN UINT32 Instance,
- IN CONST EFI_GUID *CallerId,
- IN CONST EFI_STATUS_CODE_DATA *Data OPTIONAL
- )
-{
- EFI_PEI_HOB_POINTERS Hob;
- MEMORY_STATUSCODE_PACKET_HEADER *PacketHeader;
- MEMORY_STATUSCODE_RECORD *Record;
-
- //
- // Find GUID'ed HOBs to locate current record buffer.
- //
- Hob.Raw = GetFirstGuidHob (&gMemoryStatusCodeRecordGuid);
- ASSERT (Hob.Raw != NULL);
-
- PacketHeader = (MEMORY_STATUSCODE_PACKET_HEADER *)GET_GUID_HOB_DATA (Hob.Guid);
- Record = (MEMORY_STATUSCODE_RECORD *)(PacketHeader + 1);
- Record = &Record[PacketHeader->RecordIndex++];
-
- //
- // Save status code.
- //
- Record->CodeType = CodeType;
- Record->Instance = Instance;
- Record->Value = Value;
-
- //
- // If record index equals to max record number, then wrap around record index to zero.
- //
- // The reader of status code should compare the number of records with max records number,
- // If it is equal to or larger than the max number, then the wrap-around had happened,
- // so the first record is pointed by record index.
- // If it is less then max number, index of the first record is zero.
- //
- if (PacketHeader->RecordIndex == PacketHeader->MaxRecordsNumber) {
- //
- // Wrap around record index.
- //
- PacketHeader->RecordIndex = 0;
- PacketHeader->PacketIndex++;
- }
-
- return EFI_SUCCESS;
-}
+/** @file
+ PEI memory status code worker.
+
+ Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include "StatusCodeHandlerPei.h"
+
+/**
+ Create the first memory status code GUID'ed HOB as initialization for memory status code worker.
+
+ @retval EFI_SUCCESS The GUID'ed HOB is created successfully.
+
+**/
+EFI_STATUS
+MemoryStatusCodeInitializeWorker (
+ VOID
+ )
+{
+ //
+ // Create memory status code GUID'ed HOB.
+ //
+ MEMORY_STATUSCODE_PACKET_HEADER *PacketHeader;
+
+ //
+ // Build GUID'ed HOB with PCD defined size.
+ //
+ PacketHeader = BuildGuidHob (
+ &gMemoryStatusCodeRecordGuid,
+ PcdGet16 (PcdStatusCodeMemorySize) * 1024 + sizeof (MEMORY_STATUSCODE_PACKET_HEADER)
+ );
+ ASSERT (PacketHeader != NULL);
+
+ PacketHeader->MaxRecordsNumber = (PcdGet16 (PcdStatusCodeMemorySize) * 1024) / sizeof (MEMORY_STATUSCODE_RECORD);
+ PacketHeader->PacketIndex = 0;
+ PacketHeader->RecordIndex = 0;
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Report status code into GUID'ed HOB.
+
+ This function reports status code into GUID'ed HOB. If not all packets are full, then
+ write status code into available entry. Otherwise, create a new packet for it.
+
+ @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
+ @param CodeType Indicates the type of status code being reported.
+ @param Value Describes the current status of a hardware or
+ software entity. This includes information about the class and
+ subclass that is used to classify the entity as well as an operation.
+ For progress codes, the operation is the current activity.
+ For error codes, it is the exception.For debug codes,it is not defined at this time.
+ @param Instance The enumeration of a hardware or software entity within
+ the system. A system may contain multiple entities that match a class/subclass
+ pairing. The instance differentiates between them. An instance of 0 indicates
+ that instance information is unavailable, not meaningful, or not relevant.
+ Valid instance numbers start with 1.
+ @param CallerId This optional parameter may be used to identify the caller.
+ This parameter allows the status code driver to apply different rules to
+ different callers.
+ @param Data This optional parameter may be used to pass additional data.
+
+ @retval EFI_SUCCESS The function always return EFI_SUCCESS.
+
+**/
+EFI_STATUS
+EFIAPI
+MemoryStatusCodeReportWorker (
+ IN CONST EFI_PEI_SERVICES **PeiServices,
+ IN EFI_STATUS_CODE_TYPE CodeType,
+ IN EFI_STATUS_CODE_VALUE Value,
+ IN UINT32 Instance,
+ IN CONST EFI_GUID *CallerId,
+ IN CONST EFI_STATUS_CODE_DATA *Data OPTIONAL
+ )
+{
+ EFI_PEI_HOB_POINTERS Hob;
+ MEMORY_STATUSCODE_PACKET_HEADER *PacketHeader;
+ MEMORY_STATUSCODE_RECORD *Record;
+
+ //
+ // Find GUID'ed HOBs to locate current record buffer.
+ //
+ Hob.Raw = GetFirstGuidHob (&gMemoryStatusCodeRecordGuid);
+ ASSERT (Hob.Raw != NULL);
+
+ PacketHeader = (MEMORY_STATUSCODE_PACKET_HEADER *)GET_GUID_HOB_DATA (Hob.Guid);
+ Record = (MEMORY_STATUSCODE_RECORD *)(PacketHeader + 1);
+ Record = &Record[PacketHeader->RecordIndex++];
+
+ //
+ // Save status code.
+ //
+ Record->CodeType = CodeType;
+ Record->Instance = Instance;
+ Record->Value = Value;
+
+ //
+ // If record index equals to max record number, then wrap around record index to zero.
+ //
+ // The reader of status code should compare the number of records with max records number,
+ // If it is equal to or larger than the max number, then the wrap-around had happened,
+ // so the first record is pointed by record index.
+ // If it is less then max number, index of the first record is zero.
+ //
+ if (PacketHeader->RecordIndex == PacketHeader->MaxRecordsNumber) {
+ //
+ // Wrap around record index.
+ //
+ PacketHeader->RecordIndex = 0;
+ PacketHeader->PacketIndex++;
+ }
+
+ return EFI_SUCCESS;
+}
diff --git a/MdeModulePkg/Universal/StatusCodeHandler/Pei/SerialStatusCodeWorker.c b/MdeModulePkg/Universal/StatusCodeHandler/Pei/SerialStatusCodeWorker.c
index c0ad678c7b..e8312a2a37 100644
--- a/MdeModulePkg/Universal/StatusCodeHandler/Pei/SerialStatusCodeWorker.c
+++ b/MdeModulePkg/Universal/StatusCodeHandler/Pei/SerialStatusCodeWorker.c
@@ -1,163 +1,163 @@
-/** @file
- Serial I/O status code reporting worker.
-
- Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-**/
-
-#include "StatusCodeHandlerPei.h"
-
-/**
- Convert status code value and extended data to readable ASCII string, send string to serial I/O device.
-
- @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
- @param CodeType Indicates the type of status code being reported.
- @param Value Describes the current status of a hardware or
- software entity. This includes information about the class and
- subclass that is used to classify the entity as well as an operation.
- For progress codes, the operation is the current activity.
- For error codes, it is the exception.For debug codes,it is not defined at this time.
- @param Instance The enumeration of a hardware or software entity within
- the system. A system may contain multiple entities that match a class/subclass
- pairing. The instance differentiates between them. An instance of 0 indicates
- that instance information is unavailable, not meaningful, or not relevant.
- Valid instance numbers start with 1.
- @param CallerId This optional parameter may be used to identify the caller.
- This parameter allows the status code driver to apply different rules to
- different callers.
- @param Data This optional parameter may be used to pass additional data.
-
- @retval EFI_SUCCESS Status code reported to serial I/O successfully.
-
-**/
-EFI_STATUS
-EFIAPI
-SerialStatusCodeReportWorker (
- IN CONST EFI_PEI_SERVICES **PeiServices,
- IN EFI_STATUS_CODE_TYPE CodeType,
- IN EFI_STATUS_CODE_VALUE Value,
- IN UINT32 Instance,
- IN CONST EFI_GUID *CallerId,
- IN CONST EFI_STATUS_CODE_DATA *Data OPTIONAL
- )
-{
- CHAR8 *Filename;
- CHAR8 *Description;
- CHAR8 *Format;
- CHAR8 Buffer[MAX_DEBUG_MESSAGE_LENGTH];
- UINT32 ErrorLevel;
- UINT32 LineNumber;
- UINTN CharCount;
- BASE_LIST Marker;
-
- Buffer[0] = '\0';
-
- if ((Data != NULL) &&
- ReportStatusCodeExtractAssertInfo (CodeType, Value, Data, &Filename, &Description, &LineNumber))
- {
- //
- // Print ASSERT() information into output buffer.
- //
- CharCount = AsciiSPrint (
- Buffer,
- sizeof (Buffer),
- "\n\rPEI_ASSERT!: %a (%d): %a\n\r",
- Filename,
- LineNumber,
- Description
- );
- } else if ((Data != NULL) &&
- ReportStatusCodeExtractDebugInfo (Data, &ErrorLevel, &Marker, &Format))
- {
- //
- // Print DEBUG() information into output buffer.
- //
- CharCount = AsciiBSPrint (
- Buffer,
- sizeof (Buffer),
- Format,
- Marker
- );
- } else if ((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_ERROR_CODE) {
- //
- // Print ERROR information into output buffer.
- //
- CharCount = AsciiSPrint (
- Buffer,
- sizeof (Buffer),
- "ERROR: C%08x:V%08x I%x",
- CodeType,
- Value,
- Instance
- );
-
- ASSERT (CharCount > 0);
-
- if (CallerId != NULL) {
- CharCount += AsciiSPrint (
- &Buffer[CharCount],
- (sizeof (Buffer) - (sizeof (Buffer[0]) * CharCount)),
- " %g",
- CallerId
- );
- }
-
- if (Data != NULL) {
- CharCount += AsciiSPrint (
- &Buffer[CharCount],
- (sizeof (Buffer) - (sizeof (Buffer[0]) * CharCount)),
- " %x",
- Data
- );
- }
-
- CharCount += AsciiSPrint (
- &Buffer[CharCount],
- (sizeof (Buffer) - (sizeof (Buffer[0]) * CharCount)),
- "\n\r"
- );
- } else if ((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_PROGRESS_CODE) {
- //
- // Print PROGRESS information into output buffer.
- //
- CharCount = AsciiSPrint (
- Buffer,
- sizeof (Buffer),
- "PROGRESS CODE: V%08x I%x\n\r",
- Value,
- Instance
- );
- } else if ((Data != NULL) &&
- CompareGuid (&Data->Type, &gEfiStatusCodeDataTypeStringGuid) &&
- (((EFI_STATUS_CODE_STRING_DATA *)Data)->StringType == EfiStringAscii))
- {
- //
- // EFI_STATUS_CODE_STRING_DATA
- //
- CharCount = AsciiSPrint (
- Buffer,
- sizeof (Buffer),
- "%a",
- ((EFI_STATUS_CODE_STRING_DATA *)Data)->String.Ascii
- );
- } else {
- //
- // Code type is not defined.
- //
- CharCount = AsciiSPrint (
- Buffer,
- sizeof (Buffer),
- "Undefined: C%08x:V%08x I%x\n\r",
- CodeType,
- Value,
- Instance
- );
- }
-
- //
- // Call SerialPort Lib function to do print.
- //
- SerialPortWrite ((UINT8 *)Buffer, CharCount);
-
- return EFI_SUCCESS;
-}
+/** @file
+ Serial I/O status code reporting worker.
+
+ Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#include "StatusCodeHandlerPei.h"
+
+/**
+ Convert status code value and extended data to readable ASCII string, send string to serial I/O device.
+
+ @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
+ @param CodeType Indicates the type of status code being reported.
+ @param Value Describes the current status of a hardware or
+ software entity. This includes information about the class and
+ subclass that is used to classify the entity as well as an operation.
+ For progress codes, the operation is the current activity.
+ For error codes, it is the exception.For debug codes,it is not defined at this time.
+ @param Instance The enumeration of a hardware or software entity within
+ the system. A system may contain multiple entities that match a class/subclass
+ pairing. The instance differentiates between them. An instance of 0 indicates
+ that instance information is unavailable, not meaningful, or not relevant.
+ Valid instance numbers start with 1.
+ @param CallerId This optional parameter may be used to identify the caller.
+ This parameter allows the status code driver to apply different rules to
+ different callers.
+ @param Data This optional parameter may be used to pass additional data.
+
+ @retval EFI_SUCCESS Status code reported to serial I/O successfully.
+
+**/
+EFI_STATUS
+EFIAPI
+SerialStatusCodeReportWorker (
+ IN CONST EFI_PEI_SERVICES **PeiServices,
+ IN EFI_STATUS_CODE_TYPE CodeType,
+ IN EFI_STATUS_CODE_VALUE Value,
+ IN UINT32 Instance,
+ IN CONST EFI_GUID *CallerId,
+ IN CONST EFI_STATUS_CODE_DATA *Data OPTIONAL
+ )
+{
+ CHAR8 *Filename;
+ CHAR8 *Description;
+ CHAR8 *Format;
+ CHAR8 Buffer[MAX_DEBUG_MESSAGE_LENGTH];
+ UINT32 ErrorLevel;
+ UINT32 LineNumber;
+ UINTN CharCount;
+ BASE_LIST Marker;
+
+ Buffer[0] = '\0';
+
+ if ((Data != NULL) &&
+ ReportStatusCodeExtractAssertInfo (CodeType, Value, Data, &Filename, &Description, &LineNumber))
+ {
+ //
+ // Print ASSERT() information into output buffer.
+ //
+ CharCount = AsciiSPrint (
+ Buffer,
+ sizeof (Buffer),
+ "\n\rPEI_ASSERT!: %a (%d): %a\n\r",
+ Filename,
+ LineNumber,
+ Description
+ );
+ } else if ((Data != NULL) &&
+ ReportStatusCodeExtractDebugInfo (Data, &ErrorLevel, &Marker, &Format))
+ {
+ //
+ // Print DEBUG() information into output buffer.
+ //
+ CharCount = AsciiBSPrint (
+ Buffer,
+ sizeof (Buffer),
+ Format,
+ Marker
+ );
+ } else if ((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_ERROR_CODE) {
+ //
+ // Print ERROR information into output buffer.
+ //
+ CharCount = AsciiSPrint (
+ Buffer,
+ sizeof (Buffer),
+ "ERROR: C%08x:V%08x I%x",
+ CodeType,
+ Value,
+ Instance
+ );
+
+ ASSERT (CharCount > 0);
+
+ if (CallerId != NULL) {
+ CharCount += AsciiSPrint (
+ &Buffer[CharCount],
+ (sizeof (Buffer) - (sizeof (Buffer[0]) * CharCount)),
+ " %g",
+ CallerId
+ );
+ }
+
+ if (Data != NULL) {
+ CharCount += AsciiSPrint (
+ &Buffer[CharCount],
+ (sizeof (Buffer) - (sizeof (Buffer[0]) * CharCount)),
+ " %x",
+ Data
+ );
+ }
+
+ CharCount += AsciiSPrint (
+ &Buffer[CharCount],
+ (sizeof (Buffer) - (sizeof (Buffer[0]) * CharCount)),
+ "\n\r"
+ );
+ } else if ((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_PROGRESS_CODE) {
+ //
+ // Print PROGRESS information into output buffer.
+ //
+ CharCount = AsciiSPrint (
+ Buffer,
+ sizeof (Buffer),
+ "PROGRESS CODE: V%08x I%x\n\r",
+ Value,
+ Instance
+ );
+ } else if ((Data != NULL) &&
+ CompareGuid (&Data->Type, &gEfiStatusCodeDataTypeStringGuid) &&
+ (((EFI_STATUS_CODE_STRING_DATA *)Data)->StringType == EfiStringAscii))
+ {
+ //
+ // EFI_STATUS_CODE_STRING_DATA
+ //
+ CharCount = AsciiSPrint (
+ Buffer,
+ sizeof (Buffer),
+ "%a",
+ ((EFI_STATUS_CODE_STRING_DATA *)Data)->String.Ascii
+ );
+ } else {
+ //
+ // Code type is not defined.
+ //
+ CharCount = AsciiSPrint (
+ Buffer,
+ sizeof (Buffer),
+ "Undefined: C%08x:V%08x I%x\n\r",
+ CodeType,
+ Value,
+ Instance
+ );
+ }
+
+ //
+ // Call SerialPort Lib function to do print.
+ //
+ SerialPortWrite ((UINT8 *)Buffer, CharCount);
+
+ return EFI_SUCCESS;
+}
diff --git a/MdeModulePkg/Universal/StatusCodeHandler/Pei/StatusCodeHandlerPei.c b/MdeModulePkg/Universal/StatusCodeHandler/Pei/StatusCodeHandlerPei.c
index d740a62478..9014cd44d9 100644
--- a/MdeModulePkg/Universal/StatusCodeHandler/Pei/StatusCodeHandlerPei.c
+++ b/MdeModulePkg/Universal/StatusCodeHandler/Pei/StatusCodeHandlerPei.c
@@ -1,63 +1,63 @@
-/** @file
- Report Status Code Handler PEIM which produces general handlers and hook them
- onto the PEI status code router.
-
- Copyright (c) 2009 - 2020, Intel Corporation. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include "StatusCodeHandlerPei.h"
-
-/**
- Entry point of Status Code PEIM.
-
- This function is the entry point of this Status Code PEIM.
- It initializes supported status code devices according to PCD settings,
- and installs Status Code PPI.
-
- @param FileHandle Handle of the file being invoked.
- @param PeiServices Describes the list of possible PEI Services.
-
- @retval EFI_SUCESS The entry point of DXE IPL PEIM executes successfully.
-
-**/
-EFI_STATUS
-EFIAPI
-StatusCodeHandlerPeiEntry (
- IN EFI_PEI_FILE_HANDLE FileHandle,
- IN CONST EFI_PEI_SERVICES **PeiServices
- )
-{
- EFI_STATUS Status;
- EFI_PEI_RSC_HANDLER_PPI *RscHandlerPpi;
-
- Status = PeiServicesLocatePpi (
- &gEfiPeiRscHandlerPpiGuid,
- 0,
- NULL,
- (VOID **)&RscHandlerPpi
- );
- ASSERT_EFI_ERROR (Status);
-
- //
- // Dispatch initialization request to sub-statuscode-devices.
- // If enable UseSerial, then initialize serial port.
- // if enable UseMemory, then initialize memory status code worker.
- //
- if (PcdGetBool (PcdStatusCodeUseSerial)) {
- Status = SerialPortInitialize ();
- ASSERT_EFI_ERROR (Status);
- Status = RscHandlerPpi->Register (SerialStatusCodeReportWorker);
- ASSERT_EFI_ERROR (Status);
- }
-
- if (PcdGetBool (PcdStatusCodeUseMemory)) {
- Status = MemoryStatusCodeInitializeWorker ();
- ASSERT_EFI_ERROR (Status);
- Status = RscHandlerPpi->Register (MemoryStatusCodeReportWorker);
- ASSERT_EFI_ERROR (Status);
- }
-
- return EFI_SUCCESS;
-}
+/** @file
+ Report Status Code Handler PEIM which produces general handlers and hook them
+ onto the PEI status code router.
+
+ Copyright (c) 2009 - 2020, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include "StatusCodeHandlerPei.h"
+
+/**
+ Entry point of Status Code PEIM.
+
+ This function is the entry point of this Status Code PEIM.
+ It initializes supported status code devices according to PCD settings,
+ and installs Status Code PPI.
+
+ @param FileHandle Handle of the file being invoked.
+ @param PeiServices Describes the list of possible PEI Services.
+
+ @retval EFI_SUCESS The entry point of DXE IPL PEIM executes successfully.
+
+**/
+EFI_STATUS
+EFIAPI
+StatusCodeHandlerPeiEntry (
+ IN EFI_PEI_FILE_HANDLE FileHandle,
+ IN CONST EFI_PEI_SERVICES **PeiServices
+ )
+{
+ EFI_STATUS Status;
+ EFI_PEI_RSC_HANDLER_PPI *RscHandlerPpi;
+
+ Status = PeiServicesLocatePpi (
+ &gEfiPeiRscHandlerPpiGuid,
+ 0,
+ NULL,
+ (VOID **)&RscHandlerPpi
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ //
+ // Dispatch initialization request to sub-statuscode-devices.
+ // If enable UseSerial, then initialize serial port.
+ // if enable UseMemory, then initialize memory status code worker.
+ //
+ if (PcdGetBool (PcdStatusCodeUseSerial)) {
+ Status = SerialPortInitialize ();
+ ASSERT_EFI_ERROR (Status);
+ Status = RscHandlerPpi->Register (SerialStatusCodeReportWorker);
+ ASSERT_EFI_ERROR (Status);
+ }
+
+ if (PcdGetBool (PcdStatusCodeUseMemory)) {
+ Status = MemoryStatusCodeInitializeWorker ();
+ ASSERT_EFI_ERROR (Status);
+ Status = RscHandlerPpi->Register (MemoryStatusCodeReportWorker);
+ ASSERT_EFI_ERROR (Status);
+ }
+
+ return EFI_SUCCESS;
+}
diff --git a/MdeModulePkg/Universal/StatusCodeHandler/Pei/StatusCodeHandlerPei.h b/MdeModulePkg/Universal/StatusCodeHandler/Pei/StatusCodeHandlerPei.h
index 20cba5d9f9..9a1a0cf235 100644
--- a/MdeModulePkg/Universal/StatusCodeHandler/Pei/StatusCodeHandlerPei.h
+++ b/MdeModulePkg/Universal/StatusCodeHandler/Pei/StatusCodeHandlerPei.h
@@ -1,115 +1,115 @@
-/** @file
- Internal include file for Status Code Handler PEIM.
-
- Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __STATUS_CODE_HANDLER_PEI_H__
-#define __STATUS_CODE_HANDLER_PEI_H__
-
-#include <Ppi/ReportStatusCodeHandler.h>
-
-#include <Guid/MemoryStatusCodeRecord.h>
-#include <Guid/StatusCodeDataTypeId.h>
-#include <Guid/StatusCodeDataTypeDebug.h>
-
-#include <Library/DebugLib.h>
-#include <Library/PrintLib.h>
-#include <Library/ReportStatusCodeLib.h>
-#include <Library/SerialPortLib.h>
-#include <Library/HobLib.h>
-#include <Library/PcdLib.h>
-#include <Library/PeiServicesLib.h>
-#include <Library/PeimEntryPoint.h>
-#include <Library/BaseMemoryLib.h>
-
-//
-// Define the maximum message length
-//
-#define MAX_DEBUG_MESSAGE_LENGTH 0x100
-
-/**
- Convert status code value and extended data to readable ASCII string, send string to serial I/O device.
-
- @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
- @param CodeType Indicates the type of status code being reported.
- @param Value Describes the current status of a hardware or
- software entity. This includes information about the class and
- subclass that is used to classify the entity as well as an operation.
- For progress codes, the operation is the current activity.
- For error codes, it is the exception.For debug codes,it is not defined at this time.
- @param Instance The enumeration of a hardware or software entity within
- the system. A system may contain multiple entities that match a class/subclass
- pairing. The instance differentiates between them. An instance of 0 indicates
- that instance information is unavailable, not meaningful, or not relevant.
- Valid instance numbers start with 1.
- @param CallerId This optional parameter may be used to identify the caller.
- This parameter allows the status code driver to apply different rules to
- different callers.
- @param Data This optional parameter may be used to pass additional data.
-
- @retval EFI_SUCCESS Status code reported to serial I/O successfully.
-
-**/
-EFI_STATUS
-EFIAPI
-SerialStatusCodeReportWorker (
- IN CONST EFI_PEI_SERVICES **PeiServices,
- IN EFI_STATUS_CODE_TYPE CodeType,
- IN EFI_STATUS_CODE_VALUE Value,
- IN UINT32 Instance,
- IN CONST EFI_GUID *CallerId,
- IN CONST EFI_STATUS_CODE_DATA *Data OPTIONAL
- );
-
-/**
- Create the first memory status code GUID'ed HOB as initialization for memory status code worker.
-
- @retval EFI_SUCCESS The GUID'ed HOB is created successfully.
-
-**/
-EFI_STATUS
-MemoryStatusCodeInitializeWorker (
- VOID
- );
-
-/**
- Report status code into GUID'ed HOB.
-
- This function reports status code into GUID'ed HOB. If not all packets are full, then
- write status code into available entry. Otherwise, create a new packet for it.
-
- @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
- @param CodeType Indicates the type of status code being reported.
- @param Value Describes the current status of a hardware or
- software entity. This includes information about the class and
- subclass that is used to classify the entity as well as an operation.
- For progress codes, the operation is the current activity.
- For error codes, it is the exception.For debug codes,it is not defined at this time.
- @param Instance The enumeration of a hardware or software entity within
- the system. A system may contain multiple entities that match a class/subclass
- pairing. The instance differentiates between them. An instance of 0 indicates
- that instance information is unavailable, not meaningful, or not relevant.
- Valid instance numbers start with 1.
- @param CallerId This optional parameter may be used to identify the caller.
- This parameter allows the status code driver to apply different rules to
- different callers.
- @param Data This optional parameter may be used to pass additional data.
-
- @retval EFI_SUCCESS The function always return EFI_SUCCESS.
-
-**/
-EFI_STATUS
-EFIAPI
-MemoryStatusCodeReportWorker (
- IN CONST EFI_PEI_SERVICES **PeiServices,
- IN EFI_STATUS_CODE_TYPE CodeType,
- IN EFI_STATUS_CODE_VALUE Value,
- IN UINT32 Instance,
- IN CONST EFI_GUID *CallerId,
- IN CONST EFI_STATUS_CODE_DATA *Data OPTIONAL
- );
-
-#endif
+/** @file
+ Internal include file for Status Code Handler PEIM.
+
+ Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef __STATUS_CODE_HANDLER_PEI_H__
+#define __STATUS_CODE_HANDLER_PEI_H__
+
+#include <Ppi/ReportStatusCodeHandler.h>
+
+#include <Guid/MemoryStatusCodeRecord.h>
+#include <Guid/StatusCodeDataTypeId.h>
+#include <Guid/StatusCodeDataTypeDebug.h>
+
+#include <Library/DebugLib.h>
+#include <Library/PrintLib.h>
+#include <Library/ReportStatusCodeLib.h>
+#include <Library/SerialPortLib.h>
+#include <Library/HobLib.h>
+#include <Library/PcdLib.h>
+#include <Library/PeiServicesLib.h>
+#include <Library/PeimEntryPoint.h>
+#include <Library/BaseMemoryLib.h>
+
+//
+// Define the maximum message length
+//
+#define MAX_DEBUG_MESSAGE_LENGTH 0x100
+
+/**
+ Convert status code value and extended data to readable ASCII string, send string to serial I/O device.
+
+ @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
+ @param CodeType Indicates the type of status code being reported.
+ @param Value Describes the current status of a hardware or
+ software entity. This includes information about the class and
+ subclass that is used to classify the entity as well as an operation.
+ For progress codes, the operation is the current activity.
+ For error codes, it is the exception.For debug codes,it is not defined at this time.
+ @param Instance The enumeration of a hardware or software entity within
+ the system. A system may contain multiple entities that match a class/subclass
+ pairing. The instance differentiates between them. An instance of 0 indicates
+ that instance information is unavailable, not meaningful, or not relevant.
+ Valid instance numbers start with 1.
+ @param CallerId This optional parameter may be used to identify the caller.
+ This parameter allows the status code driver to apply different rules to
+ different callers.
+ @param Data This optional parameter may be used to pass additional data.
+
+ @retval EFI_SUCCESS Status code reported to serial I/O successfully.
+
+**/
+EFI_STATUS
+EFIAPI
+SerialStatusCodeReportWorker (
+ IN CONST EFI_PEI_SERVICES **PeiServices,
+ IN EFI_STATUS_CODE_TYPE CodeType,
+ IN EFI_STATUS_CODE_VALUE Value,
+ IN UINT32 Instance,
+ IN CONST EFI_GUID *CallerId,
+ IN CONST EFI_STATUS_CODE_DATA *Data OPTIONAL
+ );
+
+/**
+ Create the first memory status code GUID'ed HOB as initialization for memory status code worker.
+
+ @retval EFI_SUCCESS The GUID'ed HOB is created successfully.
+
+**/
+EFI_STATUS
+MemoryStatusCodeInitializeWorker (
+ VOID
+ );
+
+/**
+ Report status code into GUID'ed HOB.
+
+ This function reports status code into GUID'ed HOB. If not all packets are full, then
+ write status code into available entry. Otherwise, create a new packet for it.
+
+ @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
+ @param CodeType Indicates the type of status code being reported.
+ @param Value Describes the current status of a hardware or
+ software entity. This includes information about the class and
+ subclass that is used to classify the entity as well as an operation.
+ For progress codes, the operation is the current activity.
+ For error codes, it is the exception.For debug codes,it is not defined at this time.
+ @param Instance The enumeration of a hardware or software entity within
+ the system. A system may contain multiple entities that match a class/subclass
+ pairing. The instance differentiates between them. An instance of 0 indicates
+ that instance information is unavailable, not meaningful, or not relevant.
+ Valid instance numbers start with 1.
+ @param CallerId This optional parameter may be used to identify the caller.
+ This parameter allows the status code driver to apply different rules to
+ different callers.
+ @param Data This optional parameter may be used to pass additional data.
+
+ @retval EFI_SUCCESS The function always return EFI_SUCCESS.
+
+**/
+EFI_STATUS
+EFIAPI
+MemoryStatusCodeReportWorker (
+ IN CONST EFI_PEI_SERVICES **PeiServices,
+ IN EFI_STATUS_CODE_TYPE CodeType,
+ IN EFI_STATUS_CODE_VALUE Value,
+ IN UINT32 Instance,
+ IN CONST EFI_GUID *CallerId,
+ IN CONST EFI_STATUS_CODE_DATA *Data OPTIONAL
+ );
+
+#endif
diff --git a/MdeModulePkg/Universal/StatusCodeHandler/Pei/StatusCodeHandlerPei.inf b/MdeModulePkg/Universal/StatusCodeHandler/Pei/StatusCodeHandlerPei.inf
index 64380ddfac..7b3e79a401 100644
--- a/MdeModulePkg/Universal/StatusCodeHandler/Pei/StatusCodeHandlerPei.inf
+++ b/MdeModulePkg/Universal/StatusCodeHandler/Pei/StatusCodeHandlerPei.inf
@@ -1,65 +1,65 @@
-## @file
-# Report Status Code Handler PEIM which produces general handlers and hook them onto the PEI status code router.
-#
-# Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
-#
-# SPDX-License-Identifier: BSD-2-Clause-Patent
-#
-#
-##
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = StatusCodeHandlerPei
- MODULE_UNI_FILE = StatusCodeHandlerPei.uni
- FILE_GUID = 9D225237-FA01-464C-A949-BAABC02D31D0
- MODULE_TYPE = PEIM
- VERSION_STRING = 1.0
- ENTRY_POINT = StatusCodeHandlerPeiEntry
-
-#
-# The following information is for reference only and not required by the build tools.
-#
-# VALID_ARCHITECTURES = IA32 X64 EBC (EBC is only for build)
-#
-
-[Sources]
- StatusCodeHandlerPei.c
- StatusCodeHandlerPei.h
- SerialStatusCodeWorker.c
- MemoryStausCodeWorker.c
-
-[Packages]
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
-
-[LibraryClasses]
- PeimEntryPoint
- PeiServicesLib
- PcdLib
- HobLib
- SerialPortLib
- ReportStatusCodeLib
- PrintLib
- DebugLib
- BaseMemoryLib
-
-[Guids]
- ## SOMETIMES_PRODUCES ## HOB
- ## SOMETIMES_CONSUMES ## HOB
- gMemoryStatusCodeRecordGuid
- gEfiStatusCodeDataTypeStringGuid ## SOMETIMES_CONSUMES ## UNDEFINED
-
-[Ppis]
- gEfiPeiRscHandlerPpiGuid ## CONSUMES
-
-[Pcd]
- gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeUseSerial ## CONSUMES
- gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeUseMemory ## CONSUMES
- gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeMemorySize|1|gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeUseMemory ## SOMETIMES_CONSUMES
-
-[Depex]
- gEfiPeiRscHandlerPpiGuid
-
-[UserExtensions.TianoCore."ExtraFiles"]
- StatusCodeHandlerPeiExtra.uni
+## @file
+# Report Status Code Handler PEIM which produces general handlers and hook them onto the PEI status code router.
+#
+# Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+#
+##
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = StatusCodeHandlerPei
+ MODULE_UNI_FILE = StatusCodeHandlerPei.uni
+ FILE_GUID = 9D225237-FA01-464C-A949-BAABC02D31D0
+ MODULE_TYPE = PEIM
+ VERSION_STRING = 1.0
+ ENTRY_POINT = StatusCodeHandlerPeiEntry
+
+#
+# The following information is for reference only and not required by the build tools.
+#
+# VALID_ARCHITECTURES = IA32 X64 EBC (EBC is only for build)
+#
+
+[Sources]
+ StatusCodeHandlerPei.c
+ StatusCodeHandlerPei.h
+ SerialStatusCodeWorker.c
+ MemoryStausCodeWorker.c
+
+[Packages]
+ MdePkg/MdePkg.dec
+ MdeModulePkg/MdeModulePkg.dec
+
+[LibraryClasses]
+ PeimEntryPoint
+ PeiServicesLib
+ PcdLib
+ HobLib
+ SerialPortLib
+ ReportStatusCodeLib
+ PrintLib
+ DebugLib
+ BaseMemoryLib
+
+[Guids]
+ ## SOMETIMES_PRODUCES ## HOB
+ ## SOMETIMES_CONSUMES ## HOB
+ gMemoryStatusCodeRecordGuid
+ gEfiStatusCodeDataTypeStringGuid ## SOMETIMES_CONSUMES ## UNDEFINED
+
+[Ppis]
+ gEfiPeiRscHandlerPpiGuid ## CONSUMES
+
+[Pcd]
+ gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeUseSerial ## CONSUMES
+ gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeUseMemory ## CONSUMES
+ gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeMemorySize|1|gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeUseMemory ## SOMETIMES_CONSUMES
+
+[Depex]
+ gEfiPeiRscHandlerPpiGuid
+
+[UserExtensions.TianoCore."ExtraFiles"]
+ StatusCodeHandlerPeiExtra.uni
diff --git a/MdeModulePkg/Universal/StatusCodeHandler/Pei/StatusCodeHandlerPei.uni b/MdeModulePkg/Universal/StatusCodeHandler/Pei/StatusCodeHandlerPei.uni
index 6464cb9fe9..5a8309f56a 100644
--- a/MdeModulePkg/Universal/StatusCodeHandler/Pei/StatusCodeHandlerPei.uni
+++ b/MdeModulePkg/Universal/StatusCodeHandler/Pei/StatusCodeHandlerPei.uni
@@ -1,16 +1,16 @@
-// /** @file
-// Report Status Code Handler PEIM which produces general handlers and hook them onto the PEI status code router.
-//
-// This is the Report Status Code Handler PEIM that produces general handlers and hooks them onto the PEI status code router.
-//
-// Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>
-//
-// SPDX-License-Identifier: BSD-2-Clause-Patent
-//
-// **/
-
-
-#string STR_MODULE_ABSTRACT #language en-US "PEIM that produces general handlers and hooks them onto the PEI status code router"
-
-#string STR_MODULE_DESCRIPTION #language en-US "This is the Report Status Code Handler PEIM that produces general handlers and hooks them onto the PEI status code router."
-
+// /** @file
+// Report Status Code Handler PEIM which produces general handlers and hook them onto the PEI status code router.
+//
+// This is the Report Status Code Handler PEIM that produces general handlers and hooks them onto the PEI status code router.
+//
+// Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>
+//
+// SPDX-License-Identifier: BSD-2-Clause-Patent
+//
+// **/
+
+
+#string STR_MODULE_ABSTRACT #language en-US "PEIM that produces general handlers and hooks them onto the PEI status code router"
+
+#string STR_MODULE_DESCRIPTION #language en-US "This is the Report Status Code Handler PEIM that produces general handlers and hooks them onto the PEI status code router."
+
diff --git a/MdeModulePkg/Universal/StatusCodeHandler/Pei/StatusCodeHandlerPeiExtra.uni b/MdeModulePkg/Universal/StatusCodeHandler/Pei/StatusCodeHandlerPeiExtra.uni
index 6ee6903ed5..3f039031fa 100644
--- a/MdeModulePkg/Universal/StatusCodeHandler/Pei/StatusCodeHandlerPeiExtra.uni
+++ b/MdeModulePkg/Universal/StatusCodeHandler/Pei/StatusCodeHandlerPeiExtra.uni
@@ -1,14 +1,14 @@
-// /** @file
-// StatusCodeHandlerPei Localized Strings and Content
-//
-// Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.<BR>
-//
-// SPDX-License-Identifier: BSD-2-Clause-Patent
-//
-// **/
-
-#string STR_PROPERTIES_MODULE_NAME
-#language en-US
-"Status Code Handler PEI Module"
-
-
+// /** @file
+// StatusCodeHandlerPei Localized Strings and Content
+//
+// Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.<BR>
+//
+// SPDX-License-Identifier: BSD-2-Clause-Patent
+//
+// **/
+
+#string STR_PROPERTIES_MODULE_NAME
+#language en-US
+"Status Code Handler PEI Module"
+
+
diff --git a/MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/MemoryStatusCodeWorker.c b/MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/MemoryStatusCodeWorker.c
index 33978209fb..150a79180c 100644
--- a/MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/MemoryStatusCodeWorker.c
+++ b/MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/MemoryStatusCodeWorker.c
@@ -1,106 +1,106 @@
-/** @file
- Runtime memory status code worker.
-
- Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
- (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include "StatusCodeHandlerRuntimeDxe.h"
-
-RUNTIME_MEMORY_STATUSCODE_HEADER *mRtMemoryStatusCodeTable;
-
-/**
- Initialize runtime memory status code table as initialization for runtime memory status code worker
-
- @retval EFI_SUCCESS Runtime memory status code table successfully initialized.
- @retval others Errors from gBS->InstallConfigurationTable().
-
-**/
-EFI_STATUS
-RtMemoryStatusCodeInitializeWorker (
- VOID
- )
-{
- EFI_STATUS Status;
-
- //
- // Allocate runtime memory status code pool.
- //
- mRtMemoryStatusCodeTable = AllocateRuntimePool (
- sizeof (RUNTIME_MEMORY_STATUSCODE_HEADER) +
- PcdGet16 (PcdStatusCodeMemorySize) * 1024
- );
- ASSERT (mRtMemoryStatusCodeTable != NULL);
-
- mRtMemoryStatusCodeTable->RecordIndex = 0;
- mRtMemoryStatusCodeTable->NumberOfRecords = 0;
- mRtMemoryStatusCodeTable->MaxRecordsNumber =
- (PcdGet16 (PcdStatusCodeMemorySize) * 1024) / sizeof (MEMORY_STATUSCODE_RECORD);
- Status = gBS->InstallConfigurationTable (&gMemoryStatusCodeRecordGuid, mRtMemoryStatusCodeTable);
-
- return Status;
-}
-
-/**
- Report status code into runtime memory. If the runtime pool is full, roll back to the
- first record and overwrite it.
-
- @param CodeType Indicates the type of status code being reported.
- @param Value Describes the current status of a hardware or software entity.
- This included information about the class and subclass that is used to
- classify the entity as well as an operation.
- @param Instance The enumeration of a hardware or software entity within
- the system. Valid instance numbers start with 1.
- @param CallerId This optional parameter may be used to identify the caller.
- This parameter allows the status code driver to apply different rules to
- different callers.
- @param Data This optional parameter may be used to pass additional data.
-
- @retval EFI_SUCCESS Status code successfully recorded in runtime memory status code table.
-
-**/
-EFI_STATUS
-EFIAPI
-RtMemoryStatusCodeReportWorker (
- IN EFI_STATUS_CODE_TYPE CodeType,
- IN EFI_STATUS_CODE_VALUE Value,
- IN UINT32 Instance,
- IN EFI_GUID *CallerId,
- IN EFI_STATUS_CODE_DATA *Data OPTIONAL
- )
-{
- MEMORY_STATUSCODE_RECORD *Record;
-
- //
- // Locate current record buffer.
- //
- Record = (MEMORY_STATUSCODE_RECORD *)(mRtMemoryStatusCodeTable + 1);
- Record = &Record[mRtMemoryStatusCodeTable->RecordIndex++];
-
- //
- // Save status code.
- //
- Record->CodeType = CodeType;
- Record->Value = Value;
- Record->Instance = Instance;
-
- //
- // If record index equals to max record number, then wrap around record index to zero.
- //
- // The reader of status code should compare the number of records with max records number,
- // If it is equal to or larger than the max number, then the wrap-around had happened,
- // so the first record is pointed by record index.
- // If it is less then max number, index of the first record is zero.
- //
- mRtMemoryStatusCodeTable->NumberOfRecords++;
- if (mRtMemoryStatusCodeTable->RecordIndex == mRtMemoryStatusCodeTable->MaxRecordsNumber) {
- //
- // Wrap around record index.
- //
- mRtMemoryStatusCodeTable->RecordIndex = 0;
- }
-
- return EFI_SUCCESS;
-}
+/** @file
+ Runtime memory status code worker.
+
+ Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
+ (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include "StatusCodeHandlerRuntimeDxe.h"
+
+RUNTIME_MEMORY_STATUSCODE_HEADER *mRtMemoryStatusCodeTable;
+
+/**
+ Initialize runtime memory status code table as initialization for runtime memory status code worker
+
+ @retval EFI_SUCCESS Runtime memory status code table successfully initialized.
+ @retval others Errors from gBS->InstallConfigurationTable().
+
+**/
+EFI_STATUS
+RtMemoryStatusCodeInitializeWorker (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+
+ //
+ // Allocate runtime memory status code pool.
+ //
+ mRtMemoryStatusCodeTable = AllocateRuntimePool (
+ sizeof (RUNTIME_MEMORY_STATUSCODE_HEADER) +
+ PcdGet16 (PcdStatusCodeMemorySize) * 1024
+ );
+ ASSERT (mRtMemoryStatusCodeTable != NULL);
+
+ mRtMemoryStatusCodeTable->RecordIndex = 0;
+ mRtMemoryStatusCodeTable->NumberOfRecords = 0;
+ mRtMemoryStatusCodeTable->MaxRecordsNumber =
+ (PcdGet16 (PcdStatusCodeMemorySize) * 1024) / sizeof (MEMORY_STATUSCODE_RECORD);
+ Status = gBS->InstallConfigurationTable (&gMemoryStatusCodeRecordGuid, mRtMemoryStatusCodeTable);
+
+ return Status;
+}
+
+/**
+ Report status code into runtime memory. If the runtime pool is full, roll back to the
+ first record and overwrite it.
+
+ @param CodeType Indicates the type of status code being reported.
+ @param Value Describes the current status of a hardware or software entity.
+ This included information about the class and subclass that is used to
+ classify the entity as well as an operation.
+ @param Instance The enumeration of a hardware or software entity within
+ the system. Valid instance numbers start with 1.
+ @param CallerId This optional parameter may be used to identify the caller.
+ This parameter allows the status code driver to apply different rules to
+ different callers.
+ @param Data This optional parameter may be used to pass additional data.
+
+ @retval EFI_SUCCESS Status code successfully recorded in runtime memory status code table.
+
+**/
+EFI_STATUS
+EFIAPI
+RtMemoryStatusCodeReportWorker (
+ IN EFI_STATUS_CODE_TYPE CodeType,
+ IN EFI_STATUS_CODE_VALUE Value,
+ IN UINT32 Instance,
+ IN EFI_GUID *CallerId,
+ IN EFI_STATUS_CODE_DATA *Data OPTIONAL
+ )
+{
+ MEMORY_STATUSCODE_RECORD *Record;
+
+ //
+ // Locate current record buffer.
+ //
+ Record = (MEMORY_STATUSCODE_RECORD *)(mRtMemoryStatusCodeTable + 1);
+ Record = &Record[mRtMemoryStatusCodeTable->RecordIndex++];
+
+ //
+ // Save status code.
+ //
+ Record->CodeType = CodeType;
+ Record->Value = Value;
+ Record->Instance = Instance;
+
+ //
+ // If record index equals to max record number, then wrap around record index to zero.
+ //
+ // The reader of status code should compare the number of records with max records number,
+ // If it is equal to or larger than the max number, then the wrap-around had happened,
+ // so the first record is pointed by record index.
+ // If it is less then max number, index of the first record is zero.
+ //
+ mRtMemoryStatusCodeTable->NumberOfRecords++;
+ if (mRtMemoryStatusCodeTable->RecordIndex == mRtMemoryStatusCodeTable->MaxRecordsNumber) {
+ //
+ // Wrap around record index.
+ //
+ mRtMemoryStatusCodeTable->RecordIndex = 0;
+ }
+
+ return EFI_SUCCESS;
+}
diff --git a/MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/SerialStatusCodeWorker.c b/MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/SerialStatusCodeWorker.c
index 09ba5d797a..89998ca601 100644
--- a/MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/SerialStatusCodeWorker.c
+++ b/MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/SerialStatusCodeWorker.c
@@ -1,169 +1,169 @@
-/** @file
- Serial I/O status code reporting worker.
-
- Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include "StatusCodeHandlerRuntimeDxe.h"
-
-/**
- Convert status code value and extended data to readable ASCII string, send string to serial I/O device.
-
- @param CodeType Indicates the type of status code being reported.
- @param Value Describes the current status of a hardware or software entity.
- This included information about the class and subclass that is used to
- classify the entity as well as an operation.
- @param Instance The enumeration of a hardware or software entity within
- the system. Valid instance numbers start with 1.
- @param CallerId This optional parameter may be used to identify the caller.
- This parameter allows the status code driver to apply different rules to
- different callers.
- @param Data This optional parameter may be used to pass additional data.
-
- @retval EFI_SUCCESS Status code reported to serial I/O successfully.
- @retval EFI_DEVICE_ERROR EFI serial device cannot work after ExitBootService() is called.
- @retval EFI_DEVICE_ERROR EFI serial device cannot work with TPL higher than TPL_CALLBACK.
-
-**/
-EFI_STATUS
-EFIAPI
-SerialStatusCodeReportWorker (
- IN EFI_STATUS_CODE_TYPE CodeType,
- IN EFI_STATUS_CODE_VALUE Value,
- IN UINT32 Instance,
- IN EFI_GUID *CallerId,
- IN EFI_STATUS_CODE_DATA *Data OPTIONAL
- )
-{
- CHAR8 *Filename;
- CHAR8 *Description;
- CHAR8 *Format;
- CHAR8 Buffer[MAX_DEBUG_MESSAGE_LENGTH];
- UINT32 ErrorLevel;
- UINT32 LineNumber;
- UINTN CharCount;
- BASE_LIST Marker;
-
- Buffer[0] = '\0';
-
- if ((Data != NULL) &&
- ReportStatusCodeExtractAssertInfo (CodeType, Value, Data, &Filename, &Description, &LineNumber))
- {
- //
- // Print ASSERT() information into output buffer.
- //
- CharCount = AsciiSPrint (
- Buffer,
- sizeof (Buffer),
- "\n\rDXE_ASSERT!: %a (%d): %a\n\r",
- Filename,
- LineNumber,
- Description
- );
- } else if ((Data != NULL) &&
- ReportStatusCodeExtractDebugInfo (Data, &ErrorLevel, &Marker, &Format))
- {
- //
- // Print DEBUG() information into output buffer.
- //
- CharCount = AsciiBSPrint (
- Buffer,
- sizeof (Buffer),
- Format,
- Marker
- );
- } else if ((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_ERROR_CODE) {
- //
- // Print ERROR information into output buffer.
- //
- CharCount = AsciiSPrint (
- Buffer,
- sizeof (Buffer),
- "ERROR: C%08x:V%08x I%x",
- CodeType,
- Value,
- Instance
- );
- ASSERT (CharCount > 0);
-
- if (CallerId != NULL) {
- CharCount += AsciiSPrint (
- &Buffer[CharCount],
- (sizeof (Buffer) - (sizeof (Buffer[0]) * CharCount)),
- " %g",
- CallerId
- );
- }
-
- if (Data != NULL) {
- CharCount += AsciiSPrint (
- &Buffer[CharCount],
- (sizeof (Buffer) - (sizeof (Buffer[0]) * CharCount)),
- " %x",
- Data
- );
- }
-
- CharCount += AsciiSPrint (
- &Buffer[CharCount],
- (sizeof (Buffer) - (sizeof (Buffer[0]) * CharCount)),
- "\n\r"
- );
- } else if ((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_PROGRESS_CODE) {
- //
- // Print PROGRESS information into output buffer.
- //
- CharCount = AsciiSPrint (
- Buffer,
- sizeof (Buffer),
- "PROGRESS CODE: V%08x I%x\n\r",
- Value,
- Instance
- );
- } else if ((Data != NULL) &&
- CompareGuid (&Data->Type, &gEfiStatusCodeDataTypeStringGuid) &&
- (((EFI_STATUS_CODE_STRING_DATA *)Data)->StringType == EfiStringAscii))
- {
- //
- // EFI_STATUS_CODE_STRING_DATA
- //
- CharCount = AsciiSPrint (
- Buffer,
- sizeof (Buffer),
- "%a",
- ((EFI_STATUS_CODE_STRING_DATA *)Data)->String.Ascii
- );
- } else {
- //
- // Code type is not defined.
- //
- CharCount = AsciiSPrint (
- Buffer,
- sizeof (Buffer),
- "Undefined: C%08x:V%08x I%x\n\r",
- CodeType,
- Value,
- Instance
- );
- }
-
- //
- // Call SerialPort Lib function to do print.
- //
- SerialPortWrite ((UINT8 *)Buffer, CharCount);
-
- //
- // If register an unregister function of gEfiEventExitBootServicesGuid,
- // then some log called in ExitBootServices() will be lost,
- // so unregister the handler after receive the value of exit boot service.
- //
- if (((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_PROGRESS_CODE) &&
- (Value == (EFI_SOFTWARE_EFI_BOOT_SERVICE | EFI_SW_BS_PC_EXIT_BOOT_SERVICES)))
- {
- UnregisterSerialBootTimeHandlers ();
- }
-
- return EFI_SUCCESS;
-}
+/** @file
+ Serial I/O status code reporting worker.
+
+ Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include "StatusCodeHandlerRuntimeDxe.h"
+
+/**
+ Convert status code value and extended data to readable ASCII string, send string to serial I/O device.
+
+ @param CodeType Indicates the type of status code being reported.
+ @param Value Describes the current status of a hardware or software entity.
+ This included information about the class and subclass that is used to
+ classify the entity as well as an operation.
+ @param Instance The enumeration of a hardware or software entity within
+ the system. Valid instance numbers start with 1.
+ @param CallerId This optional parameter may be used to identify the caller.
+ This parameter allows the status code driver to apply different rules to
+ different callers.
+ @param Data This optional parameter may be used to pass additional data.
+
+ @retval EFI_SUCCESS Status code reported to serial I/O successfully.
+ @retval EFI_DEVICE_ERROR EFI serial device cannot work after ExitBootService() is called.
+ @retval EFI_DEVICE_ERROR EFI serial device cannot work with TPL higher than TPL_CALLBACK.
+
+**/
+EFI_STATUS
+EFIAPI
+SerialStatusCodeReportWorker (
+ IN EFI_STATUS_CODE_TYPE CodeType,
+ IN EFI_STATUS_CODE_VALUE Value,
+ IN UINT32 Instance,
+ IN EFI_GUID *CallerId,
+ IN EFI_STATUS_CODE_DATA *Data OPTIONAL
+ )
+{
+ CHAR8 *Filename;
+ CHAR8 *Description;
+ CHAR8 *Format;
+ CHAR8 Buffer[MAX_DEBUG_MESSAGE_LENGTH];
+ UINT32 ErrorLevel;
+ UINT32 LineNumber;
+ UINTN CharCount;
+ BASE_LIST Marker;
+
+ Buffer[0] = '\0';
+
+ if ((Data != NULL) &&
+ ReportStatusCodeExtractAssertInfo (CodeType, Value, Data, &Filename, &Description, &LineNumber))
+ {
+ //
+ // Print ASSERT() information into output buffer.
+ //
+ CharCount = AsciiSPrint (
+ Buffer,
+ sizeof (Buffer),
+ "\n\rDXE_ASSERT!: %a (%d): %a\n\r",
+ Filename,
+ LineNumber,
+ Description
+ );
+ } else if ((Data != NULL) &&
+ ReportStatusCodeExtractDebugInfo (Data, &ErrorLevel, &Marker, &Format))
+ {
+ //
+ // Print DEBUG() information into output buffer.
+ //
+ CharCount = AsciiBSPrint (
+ Buffer,
+ sizeof (Buffer),
+ Format,
+ Marker
+ );
+ } else if ((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_ERROR_CODE) {
+ //
+ // Print ERROR information into output buffer.
+ //
+ CharCount = AsciiSPrint (
+ Buffer,
+ sizeof (Buffer),
+ "ERROR: C%08x:V%08x I%x",
+ CodeType,
+ Value,
+ Instance
+ );
+ ASSERT (CharCount > 0);
+
+ if (CallerId != NULL) {
+ CharCount += AsciiSPrint (
+ &Buffer[CharCount],
+ (sizeof (Buffer) - (sizeof (Buffer[0]) * CharCount)),
+ " %g",
+ CallerId
+ );
+ }
+
+ if (Data != NULL) {
+ CharCount += AsciiSPrint (
+ &Buffer[CharCount],
+ (sizeof (Buffer) - (sizeof (Buffer[0]) * CharCount)),
+ " %x",
+ Data
+ );
+ }
+
+ CharCount += AsciiSPrint (
+ &Buffer[CharCount],
+ (sizeof (Buffer) - (sizeof (Buffer[0]) * CharCount)),
+ "\n\r"
+ );
+ } else if ((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_PROGRESS_CODE) {
+ //
+ // Print PROGRESS information into output buffer.
+ //
+ CharCount = AsciiSPrint (
+ Buffer,
+ sizeof (Buffer),
+ "PROGRESS CODE: V%08x I%x\n\r",
+ Value,
+ Instance
+ );
+ } else if ((Data != NULL) &&
+ CompareGuid (&Data->Type, &gEfiStatusCodeDataTypeStringGuid) &&
+ (((EFI_STATUS_CODE_STRING_DATA *)Data)->StringType == EfiStringAscii))
+ {
+ //
+ // EFI_STATUS_CODE_STRING_DATA
+ //
+ CharCount = AsciiSPrint (
+ Buffer,
+ sizeof (Buffer),
+ "%a",
+ ((EFI_STATUS_CODE_STRING_DATA *)Data)->String.Ascii
+ );
+ } else {
+ //
+ // Code type is not defined.
+ //
+ CharCount = AsciiSPrint (
+ Buffer,
+ sizeof (Buffer),
+ "Undefined: C%08x:V%08x I%x\n\r",
+ CodeType,
+ Value,
+ Instance
+ );
+ }
+
+ //
+ // Call SerialPort Lib function to do print.
+ //
+ SerialPortWrite ((UINT8 *)Buffer, CharCount);
+
+ //
+ // If register an unregister function of gEfiEventExitBootServicesGuid,
+ // then some log called in ExitBootServices() will be lost,
+ // so unregister the handler after receive the value of exit boot service.
+ //
+ if (((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_PROGRESS_CODE) &&
+ (Value == (EFI_SOFTWARE_EFI_BOOT_SERVICE | EFI_SW_BS_PC_EXIT_BOOT_SERVICES)))
+ {
+ UnregisterSerialBootTimeHandlers ();
+ }
+
+ return EFI_SUCCESS;
+}
diff --git a/MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHandlerRuntimeDxe.c b/MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHandlerRuntimeDxe.c
index 6ef41ce101..115f09920e 100644
--- a/MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHandlerRuntimeDxe.c
+++ b/MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHandlerRuntimeDxe.c
@@ -1,190 +1,190 @@
-/** @file
- Status Code Handler Driver which produces general handlers and hook them
- onto the DXE status code router.
-
- Copyright (c) 2006 - 2020, Intel Corporation. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include "StatusCodeHandlerRuntimeDxe.h"
-
-EFI_EVENT mVirtualAddressChangeEvent = NULL;
-EFI_RSC_HANDLER_PROTOCOL *mRscHandlerProtocol = NULL;
-
-/**
- Unregister status code callback functions only available at boot time from
- report status code router when exiting boot services.
-
-**/
-VOID
-EFIAPI
-UnregisterSerialBootTimeHandlers (
- VOID
- )
-{
- if (PcdGetBool (PcdStatusCodeUseSerial)) {
- mRscHandlerProtocol->Unregister (SerialStatusCodeReportWorker);
- }
-}
-
-/**
- Virtual address change notification call back. It converts global pointer
- to virtual address.
-
- @param Event Event whose notification function is being invoked.
- @param Context Pointer to the notification function's context, which is
- always zero in current implementation.
-
-**/
-VOID
-EFIAPI
-VirtualAddressChangeCallBack (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-{
- //
- // Convert memory status code table to virtual address;
- //
- EfiConvertPointer (
- 0,
- (VOID **)&mRtMemoryStatusCodeTable
- );
-}
-
-/**
- Dispatch initialization request to sub status code devices based on
- customized feature flags.
-
-**/
-VOID
-InitializationDispatcherWorker (
- VOID
- )
-{
- EFI_PEI_HOB_POINTERS Hob;
- EFI_STATUS Status;
- MEMORY_STATUSCODE_PACKET_HEADER *PacketHeader;
- MEMORY_STATUSCODE_RECORD *Record;
- UINTN Index;
- UINTN MaxRecordNumber;
-
- //
- // If enable UseSerial, then initialize serial port.
- // if enable UseRuntimeMemory, then initialize runtime memory status code worker.
- //
- if (PcdGetBool (PcdStatusCodeUseSerial)) {
- //
- // Call Serial Port Lib API to initialize serial port.
- //
- Status = SerialPortInitialize ();
- ASSERT_EFI_ERROR (Status);
- }
-
- if (PcdGetBool (PcdStatusCodeUseMemory)) {
- Status = RtMemoryStatusCodeInitializeWorker ();
- ASSERT_EFI_ERROR (Status);
- }
-
- //
- // Replay Status code which saved in GUID'ed HOB to all supported devices.
- //
- if (FeaturePcdGet (PcdStatusCodeReplayIn)) {
- //
- // Journal GUID'ed HOBs to find all record entry, if found,
- // then output record to support replay device.
- //
- Hob.Raw = GetFirstGuidHob (&gMemoryStatusCodeRecordGuid);
- if (Hob.Raw != NULL) {
- PacketHeader = (MEMORY_STATUSCODE_PACKET_HEADER *)GET_GUID_HOB_DATA (Hob.Guid);
- Record = (MEMORY_STATUSCODE_RECORD *)(PacketHeader + 1);
- MaxRecordNumber = (UINTN)PacketHeader->RecordIndex;
- if (PacketHeader->PacketIndex > 0) {
- //
- // Record has been wrapped around. So, record number has arrived at max number.
- //
- MaxRecordNumber = (UINTN)PacketHeader->MaxRecordsNumber;
- }
-
- for (Index = 0; Index < MaxRecordNumber; Index++) {
- //
- // Dispatch records to devices based on feature flag.
- //
- if (PcdGetBool (PcdStatusCodeUseSerial)) {
- SerialStatusCodeReportWorker (
- Record[Index].CodeType,
- Record[Index].Value,
- Record[Index].Instance,
- NULL,
- NULL
- );
- }
-
- if (PcdGetBool (PcdStatusCodeUseMemory)) {
- RtMemoryStatusCodeReportWorker (
- Record[Index].CodeType,
- Record[Index].Value,
- Record[Index].Instance,
- NULL,
- NULL
- );
- }
- }
- }
- }
-}
-
-/**
- Entry point of DXE Status Code Driver.
-
- This function is the entry point of this DXE Status Code Driver.
- It initializes registers status code handlers, and registers event for EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE.
-
- @param ImageHandle The firmware allocated handle for the EFI image.
- @param SystemTable A pointer to the EFI System Table.
-
- @retval EFI_SUCCESS The entry point is executed successfully.
-
-**/
-EFI_STATUS
-EFIAPI
-StatusCodeHandlerRuntimeDxeEntry (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- EFI_STATUS Status;
-
- Status = gBS->LocateProtocol (
- &gEfiRscHandlerProtocolGuid,
- NULL,
- (VOID **)&mRscHandlerProtocol
- );
- ASSERT_EFI_ERROR (Status);
-
- //
- // Dispatch initialization request to supported devices
- //
- InitializationDispatcherWorker ();
-
- if (PcdGetBool (PcdStatusCodeUseSerial)) {
- mRscHandlerProtocol->Register (SerialStatusCodeReportWorker, TPL_HIGH_LEVEL);
- }
-
- if (PcdGetBool (PcdStatusCodeUseMemory)) {
- mRscHandlerProtocol->Register (RtMemoryStatusCodeReportWorker, TPL_HIGH_LEVEL);
- }
-
- Status = gBS->CreateEventEx (
- EVT_NOTIFY_SIGNAL,
- TPL_NOTIFY,
- VirtualAddressChangeCallBack,
- NULL,
- &gEfiEventVirtualAddressChangeGuid,
- &mVirtualAddressChangeEvent
- );
- ASSERT_EFI_ERROR (Status);
-
- return EFI_SUCCESS;
-}
+/** @file
+ Status Code Handler Driver which produces general handlers and hook them
+ onto the DXE status code router.
+
+ Copyright (c) 2006 - 2020, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include "StatusCodeHandlerRuntimeDxe.h"
+
+EFI_EVENT mVirtualAddressChangeEvent = NULL;
+EFI_RSC_HANDLER_PROTOCOL *mRscHandlerProtocol = NULL;
+
+/**
+ Unregister status code callback functions only available at boot time from
+ report status code router when exiting boot services.
+
+**/
+VOID
+EFIAPI
+UnregisterSerialBootTimeHandlers (
+ VOID
+ )
+{
+ if (PcdGetBool (PcdStatusCodeUseSerial)) {
+ mRscHandlerProtocol->Unregister (SerialStatusCodeReportWorker);
+ }
+}
+
+/**
+ Virtual address change notification call back. It converts global pointer
+ to virtual address.
+
+ @param Event Event whose notification function is being invoked.
+ @param Context Pointer to the notification function's context, which is
+ always zero in current implementation.
+
+**/
+VOID
+EFIAPI
+VirtualAddressChangeCallBack (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+{
+ //
+ // Convert memory status code table to virtual address;
+ //
+ EfiConvertPointer (
+ 0,
+ (VOID **)&mRtMemoryStatusCodeTable
+ );
+}
+
+/**
+ Dispatch initialization request to sub status code devices based on
+ customized feature flags.
+
+**/
+VOID
+InitializationDispatcherWorker (
+ VOID
+ )
+{
+ EFI_PEI_HOB_POINTERS Hob;
+ EFI_STATUS Status;
+ MEMORY_STATUSCODE_PACKET_HEADER *PacketHeader;
+ MEMORY_STATUSCODE_RECORD *Record;
+ UINTN Index;
+ UINTN MaxRecordNumber;
+
+ //
+ // If enable UseSerial, then initialize serial port.
+ // if enable UseRuntimeMemory, then initialize runtime memory status code worker.
+ //
+ if (PcdGetBool (PcdStatusCodeUseSerial)) {
+ //
+ // Call Serial Port Lib API to initialize serial port.
+ //
+ Status = SerialPortInitialize ();
+ ASSERT_EFI_ERROR (Status);
+ }
+
+ if (PcdGetBool (PcdStatusCodeUseMemory)) {
+ Status = RtMemoryStatusCodeInitializeWorker ();
+ ASSERT_EFI_ERROR (Status);
+ }
+
+ //
+ // Replay Status code which saved in GUID'ed HOB to all supported devices.
+ //
+ if (FeaturePcdGet (PcdStatusCodeReplayIn)) {
+ //
+ // Journal GUID'ed HOBs to find all record entry, if found,
+ // then output record to support replay device.
+ //
+ Hob.Raw = GetFirstGuidHob (&gMemoryStatusCodeRecordGuid);
+ if (Hob.Raw != NULL) {
+ PacketHeader = (MEMORY_STATUSCODE_PACKET_HEADER *)GET_GUID_HOB_DATA (Hob.Guid);
+ Record = (MEMORY_STATUSCODE_RECORD *)(PacketHeader + 1);
+ MaxRecordNumber = (UINTN)PacketHeader->RecordIndex;
+ if (PacketHeader->PacketIndex > 0) {
+ //
+ // Record has been wrapped around. So, record number has arrived at max number.
+ //
+ MaxRecordNumber = (UINTN)PacketHeader->MaxRecordsNumber;
+ }
+
+ for (Index = 0; Index < MaxRecordNumber; Index++) {
+ //
+ // Dispatch records to devices based on feature flag.
+ //
+ if (PcdGetBool (PcdStatusCodeUseSerial)) {
+ SerialStatusCodeReportWorker (
+ Record[Index].CodeType,
+ Record[Index].Value,
+ Record[Index].Instance,
+ NULL,
+ NULL
+ );
+ }
+
+ if (PcdGetBool (PcdStatusCodeUseMemory)) {
+ RtMemoryStatusCodeReportWorker (
+ Record[Index].CodeType,
+ Record[Index].Value,
+ Record[Index].Instance,
+ NULL,
+ NULL
+ );
+ }
+ }
+ }
+ }
+}
+
+/**
+ Entry point of DXE Status Code Driver.
+
+ This function is the entry point of this DXE Status Code Driver.
+ It initializes registers status code handlers, and registers event for EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE.
+
+ @param ImageHandle The firmware allocated handle for the EFI image.
+ @param SystemTable A pointer to the EFI System Table.
+
+ @retval EFI_SUCCESS The entry point is executed successfully.
+
+**/
+EFI_STATUS
+EFIAPI
+StatusCodeHandlerRuntimeDxeEntry (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+
+ Status = gBS->LocateProtocol (
+ &gEfiRscHandlerProtocolGuid,
+ NULL,
+ (VOID **)&mRscHandlerProtocol
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ //
+ // Dispatch initialization request to supported devices
+ //
+ InitializationDispatcherWorker ();
+
+ if (PcdGetBool (PcdStatusCodeUseSerial)) {
+ mRscHandlerProtocol->Register (SerialStatusCodeReportWorker, TPL_HIGH_LEVEL);
+ }
+
+ if (PcdGetBool (PcdStatusCodeUseMemory)) {
+ mRscHandlerProtocol->Register (RtMemoryStatusCodeReportWorker, TPL_HIGH_LEVEL);
+ }
+
+ Status = gBS->CreateEventEx (
+ EVT_NOTIFY_SIGNAL,
+ TPL_NOTIFY,
+ VirtualAddressChangeCallBack,
+ NULL,
+ &gEfiEventVirtualAddressChangeGuid,
+ &mVirtualAddressChangeEvent
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ return EFI_SUCCESS;
+}
diff --git a/MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHandlerRuntimeDxe.h b/MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHandlerRuntimeDxe.h
index 7fa06389bb..98dfb23421 100644
--- a/MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHandlerRuntimeDxe.h
+++ b/MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHandlerRuntimeDxe.h
@@ -1,131 +1,131 @@
-/** @file
- Internal include file for Status Code Handler Driver.
-
- Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
- (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __STATUS_CODE_HANDLER_RUNTIME_DXE_H__
-#define __STATUS_CODE_HANDLER_RUNTIME_DXE_H__
-
-#include <Protocol/ReportStatusCodeHandler.h>
-
-#include <Guid/MemoryStatusCodeRecord.h>
-#include <Guid/StatusCodeDataTypeId.h>
-#include <Guid/StatusCodeDataTypeDebug.h>
-#include <Guid/EventGroup.h>
-
-#include <Library/SynchronizationLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/DebugLib.h>
-#include <Library/ReportStatusCodeLib.h>
-#include <Library/PrintLib.h>
-#include <Library/PcdLib.h>
-#include <Library/HobLib.h>
-#include <Library/UefiDriverEntryPoint.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/UefiRuntimeLib.h>
-#include <Library/SerialPortLib.h>
-
-//
-// Define the maximum message length
-//
-#define MAX_DEBUG_MESSAGE_LENGTH 0x100
-
-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.
-
- @param CodeType Indicates the type of status code being reported.
- @param Value Describes the current status of a hardware or software entity.
- This included information about the class and subclass that is used to
- classify the entity as well as an operation.
- @param Instance The enumeration of a hardware or software entity within
- the system. Valid instance numbers start with 1.
- @param CallerId This optional parameter may be used to identify the caller.
- This parameter allows the status code driver to apply different rules to
- different callers.
- @param Data This optional parameter may be used to pass additional data.
-
- @retval EFI_SUCCESS Status code reported to serial I/O successfully.
- @retval EFI_DEVICE_ERROR EFI serial device cannot work after ExitBootService() is called.
- @retval EFI_DEVICE_ERROR EFI serial device cannot work with TPL higher than TPL_CALLBACK.
-
-**/
-EFI_STATUS
-EFIAPI
-SerialStatusCodeReportWorker (
- IN EFI_STATUS_CODE_TYPE CodeType,
- IN EFI_STATUS_CODE_VALUE Value,
- IN UINT32 Instance,
- IN EFI_GUID *CallerId,
- IN EFI_STATUS_CODE_DATA *Data OPTIONAL
- );
-
-/**
- Initialize runtime memory status code table as initialization for runtime memory status code worker
-
- @retval EFI_SUCCESS Runtime memory status code table successfully initialized.
- @retval others Errors from gBS->InstallConfigurationTable().
-
-**/
-EFI_STATUS
-RtMemoryStatusCodeInitializeWorker (
- VOID
- );
-
-/**
- Report status code into runtime memory. If the runtime pool is full, roll back to the
- first record and overwrite it.
-
- @param CodeType Indicates the type of status code being reported.
- @param Value Describes the current status of a hardware or software entity.
- This included information about the class and subclass that is used to
- classify the entity as well as an operation.
- @param Instance The enumeration of a hardware or software entity within
- the system. Valid instance numbers start with 1.
- @param CallerId This optional parameter may be used to identify the caller.
- This parameter allows the status code driver to apply different rules to
- different callers.
- @param Data This optional parameter may be used to pass additional data.
-
- @retval EFI_SUCCESS Status code successfully recorded in runtime memory status code table.
-
-**/
-EFI_STATUS
-EFIAPI
-RtMemoryStatusCodeReportWorker (
- IN EFI_STATUS_CODE_TYPE CodeType,
- IN EFI_STATUS_CODE_VALUE Value,
- IN UINT32 Instance,
- IN EFI_GUID *CallerId,
- IN EFI_STATUS_CODE_DATA *Data OPTIONAL
- );
-
-/**
- Unregister status code callback functions only available at boot time from
- report status code router when exiting boot services.
-
-**/
-VOID
-EFIAPI
-UnregisterSerialBootTimeHandlers (
- VOID
- );
-
-#endif
+/** @file
+ Internal include file for Status Code Handler Driver.
+
+ Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
+ (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef __STATUS_CODE_HANDLER_RUNTIME_DXE_H__
+#define __STATUS_CODE_HANDLER_RUNTIME_DXE_H__
+
+#include <Protocol/ReportStatusCodeHandler.h>
+
+#include <Guid/MemoryStatusCodeRecord.h>
+#include <Guid/StatusCodeDataTypeId.h>
+#include <Guid/StatusCodeDataTypeDebug.h>
+#include <Guid/EventGroup.h>
+
+#include <Library/SynchronizationLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/DebugLib.h>
+#include <Library/ReportStatusCodeLib.h>
+#include <Library/PrintLib.h>
+#include <Library/PcdLib.h>
+#include <Library/HobLib.h>
+#include <Library/UefiDriverEntryPoint.h>
+#include <Library/UefiBootServicesTableLib.h>
+#include <Library/MemoryAllocationLib.h>
+#include <Library/UefiRuntimeLib.h>
+#include <Library/SerialPortLib.h>
+
+//
+// Define the maximum message length
+//
+#define MAX_DEBUG_MESSAGE_LENGTH 0x100
+
+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.
+
+ @param CodeType Indicates the type of status code being reported.
+ @param Value Describes the current status of a hardware or software entity.
+ This included information about the class and subclass that is used to
+ classify the entity as well as an operation.
+ @param Instance The enumeration of a hardware or software entity within
+ the system. Valid instance numbers start with 1.
+ @param CallerId This optional parameter may be used to identify the caller.
+ This parameter allows the status code driver to apply different rules to
+ different callers.
+ @param Data This optional parameter may be used to pass additional data.
+
+ @retval EFI_SUCCESS Status code reported to serial I/O successfully.
+ @retval EFI_DEVICE_ERROR EFI serial device cannot work after ExitBootService() is called.
+ @retval EFI_DEVICE_ERROR EFI serial device cannot work with TPL higher than TPL_CALLBACK.
+
+**/
+EFI_STATUS
+EFIAPI
+SerialStatusCodeReportWorker (
+ IN EFI_STATUS_CODE_TYPE CodeType,
+ IN EFI_STATUS_CODE_VALUE Value,
+ IN UINT32 Instance,
+ IN EFI_GUID *CallerId,
+ IN EFI_STATUS_CODE_DATA *Data OPTIONAL
+ );
+
+/**
+ Initialize runtime memory status code table as initialization for runtime memory status code worker
+
+ @retval EFI_SUCCESS Runtime memory status code table successfully initialized.
+ @retval others Errors from gBS->InstallConfigurationTable().
+
+**/
+EFI_STATUS
+RtMemoryStatusCodeInitializeWorker (
+ VOID
+ );
+
+/**
+ Report status code into runtime memory. If the runtime pool is full, roll back to the
+ first record and overwrite it.
+
+ @param CodeType Indicates the type of status code being reported.
+ @param Value Describes the current status of a hardware or software entity.
+ This included information about the class and subclass that is used to
+ classify the entity as well as an operation.
+ @param Instance The enumeration of a hardware or software entity within
+ the system. Valid instance numbers start with 1.
+ @param CallerId This optional parameter may be used to identify the caller.
+ This parameter allows the status code driver to apply different rules to
+ different callers.
+ @param Data This optional parameter may be used to pass additional data.
+
+ @retval EFI_SUCCESS Status code successfully recorded in runtime memory status code table.
+
+**/
+EFI_STATUS
+EFIAPI
+RtMemoryStatusCodeReportWorker (
+ IN EFI_STATUS_CODE_TYPE CodeType,
+ IN EFI_STATUS_CODE_VALUE Value,
+ IN UINT32 Instance,
+ IN EFI_GUID *CallerId,
+ IN EFI_STATUS_CODE_DATA *Data OPTIONAL
+ );
+
+/**
+ Unregister status code callback functions only available at boot time from
+ report status code router when exiting boot services.
+
+**/
+VOID
+EFIAPI
+UnregisterSerialBootTimeHandlers (
+ VOID
+ );
+
+#endif
diff --git a/MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHandlerRuntimeDxe.inf b/MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHandlerRuntimeDxe.inf
index faadfd9578..d8ae0eed7c 100644
--- a/MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHandlerRuntimeDxe.inf
+++ b/MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHandlerRuntimeDxe.inf
@@ -1,71 +1,71 @@
-## @file
-# Status Code Handler Driver which produces general handlers and hook them onto the DXE status code router.
-#
-# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
-# (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
-#
-# SPDX-License-Identifier: BSD-2-Clause-Patent
-#
-#
-##
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = StatusCodeHandlerRuntimeDxe
- MODULE_UNI_FILE = StatusCodeHandlerRuntimeDxe.uni
- FILE_GUID = 6C2004EF-4E0E-4BE4-B14C-340EB4AA5891
- MODULE_TYPE = DXE_RUNTIME_DRIVER
- VERSION_STRING = 1.0
- ENTRY_POINT = StatusCodeHandlerRuntimeDxeEntry
-
-#
-# The following information is for reference only and not required by the build tools.
-#
-# VALID_ARCHITECTURES = IA32 X64 EBC
-#
-
-[Sources]
- StatusCodeHandlerRuntimeDxe.c
- StatusCodeHandlerRuntimeDxe.h
- SerialStatusCodeWorker.c
- MemoryStatusCodeWorker.c
-
-[Packages]
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
-
-[LibraryClasses]
- SerialPortLib
- UefiRuntimeLib
- MemoryAllocationLib
- UefiBootServicesTableLib
- UefiDriverEntryPoint
- HobLib
- PcdLib
- PrintLib
- ReportStatusCodeLib
- DebugLib
- BaseMemoryLib
-
-[Guids]
- ## SOMETIMES_CONSUMES ## HOB
- ## SOMETIMES_PRODUCES ## SystemTable
- gMemoryStatusCodeRecordGuid
- gEfiStatusCodeDataTypeStringGuid ## SOMETIMES_CONSUMES ## UNDEFINED
- gEfiEventVirtualAddressChangeGuid ## CONSUMES ## Event
- gEfiEventExitBootServicesGuid ## CONSUMES ## Event
-
-[Protocols]
- gEfiRscHandlerProtocolGuid ## CONSUMES
-
-[Pcd]
- gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeReplayIn ## CONSUMES
- gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeUseSerial ## CONSUMES
- gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeUseMemory ## CONSUMES
- gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeMemorySize |128| gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeUseMemory ## SOMETIMES_CONSUMES
-
-[Depex]
- gEfiRscHandlerProtocolGuid
-
-[UserExtensions.TianoCore."ExtraFiles"]
- StatusCodeHandlerRuntimeDxeExtra.uni
+## @file
+# Status Code Handler Driver which produces general handlers and hook them onto the DXE status code router.
+#
+# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
+# (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+#
+##
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = StatusCodeHandlerRuntimeDxe
+ MODULE_UNI_FILE = StatusCodeHandlerRuntimeDxe.uni
+ FILE_GUID = 6C2004EF-4E0E-4BE4-B14C-340EB4AA5891
+ MODULE_TYPE = DXE_RUNTIME_DRIVER
+ VERSION_STRING = 1.0
+ ENTRY_POINT = StatusCodeHandlerRuntimeDxeEntry
+
+#
+# The following information is for reference only and not required by the build tools.
+#
+# VALID_ARCHITECTURES = IA32 X64 EBC
+#
+
+[Sources]
+ StatusCodeHandlerRuntimeDxe.c
+ StatusCodeHandlerRuntimeDxe.h
+ SerialStatusCodeWorker.c
+ MemoryStatusCodeWorker.c
+
+[Packages]
+ MdePkg/MdePkg.dec
+ MdeModulePkg/MdeModulePkg.dec
+
+[LibraryClasses]
+ SerialPortLib
+ UefiRuntimeLib
+ MemoryAllocationLib
+ UefiBootServicesTableLib
+ UefiDriverEntryPoint
+ HobLib
+ PcdLib
+ PrintLib
+ ReportStatusCodeLib
+ DebugLib
+ BaseMemoryLib
+
+[Guids]
+ ## SOMETIMES_CONSUMES ## HOB
+ ## SOMETIMES_PRODUCES ## SystemTable
+ gMemoryStatusCodeRecordGuid
+ gEfiStatusCodeDataTypeStringGuid ## SOMETIMES_CONSUMES ## UNDEFINED
+ gEfiEventVirtualAddressChangeGuid ## CONSUMES ## Event
+ gEfiEventExitBootServicesGuid ## CONSUMES ## Event
+
+[Protocols]
+ gEfiRscHandlerProtocolGuid ## CONSUMES
+
+[Pcd]
+ gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeReplayIn ## CONSUMES
+ gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeUseSerial ## CONSUMES
+ gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeUseMemory ## CONSUMES
+ gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeMemorySize |128| gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeUseMemory ## SOMETIMES_CONSUMES
+
+[Depex]
+ gEfiRscHandlerProtocolGuid
+
+[UserExtensions.TianoCore."ExtraFiles"]
+ StatusCodeHandlerRuntimeDxeExtra.uni
diff --git a/MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHandlerRuntimeDxe.uni b/MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHandlerRuntimeDxe.uni
index a886049e89..0c36c09bd0 100644
--- a/MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHandlerRuntimeDxe.uni
+++ b/MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHandlerRuntimeDxe.uni
@@ -1,16 +1,16 @@
-// /** @file
-// Status Code Handler Driver which produces general handlers and hook them onto the DXE status code router.
-//
-// The Status Code Handler Driver that produces general handlers and hooks them onto the DXE status code router.
-//
-// Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
-//
-// SPDX-License-Identifier: BSD-2-Clause-Patent
-//
-// **/
-
-
-#string STR_MODULE_ABSTRACT #language en-US "Produces general handlers and hooks them onto the DXE status code router"
-
-#string STR_MODULE_DESCRIPTION #language en-US "The Status Code Handler Driver that produces general handlers and hooks them onto the DXE status code router."
-
+// /** @file
+// Status Code Handler Driver which produces general handlers and hook them onto the DXE status code router.
+//
+// The Status Code Handler Driver that produces general handlers and hooks them onto the DXE status code router.
+//
+// Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
+//
+// SPDX-License-Identifier: BSD-2-Clause-Patent
+//
+// **/
+
+
+#string STR_MODULE_ABSTRACT #language en-US "Produces general handlers and hooks them onto the DXE status code router"
+
+#string STR_MODULE_DESCRIPTION #language en-US "The Status Code Handler Driver that produces general handlers and hooks them onto the DXE status code router."
+
diff --git a/MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHandlerRuntimeDxeExtra.uni b/MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHandlerRuntimeDxeExtra.uni
index c5ed8a2608..300c415b55 100644
--- a/MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHandlerRuntimeDxeExtra.uni
+++ b/MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHandlerRuntimeDxeExtra.uni
@@ -1,14 +1,14 @@
-// /** @file
-// StatusCodeHandlerRuntimeDxe Localized Strings and Content
-//
-// Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.<BR>
-//
-// SPDX-License-Identifier: BSD-2-Clause-Patent
-//
-// **/
-
-#string STR_PROPERTIES_MODULE_NAME
-#language en-US
-"Status Code Handler DXE Driver"
-
-
+// /** @file
+// StatusCodeHandlerRuntimeDxe Localized Strings and Content
+//
+// Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.<BR>
+//
+// SPDX-License-Identifier: BSD-2-Clause-Patent
+//
+// **/
+
+#string STR_PROPERTIES_MODULE_NAME
+#language en-US
+"Status Code Handler DXE Driver"
+
+
diff --git a/MdeModulePkg/Universal/StatusCodeHandler/Smm/MemoryStatusCodeWorker.c b/MdeModulePkg/Universal/StatusCodeHandler/Smm/MemoryStatusCodeWorker.c
index 80c94e4682..fabb5faed9 100644
--- a/MdeModulePkg/Universal/StatusCodeHandler/Smm/MemoryStatusCodeWorker.c
+++ b/MdeModulePkg/Universal/StatusCodeHandler/Smm/MemoryStatusCodeWorker.c
@@ -1,103 +1,103 @@
-/** @file
- Runtime memory status code worker.
-
- Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
- (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include "StatusCodeHandlerMm.h"
-
-RUNTIME_MEMORY_STATUSCODE_HEADER *mMmMemoryStatusCodeTable;
-
-/**
- Initialize MM memory status code table as initialization for memory status code worker
-
- @retval EFI_SUCCESS MM memory status code table successfully initialized.
- @retval others Errors from gMmst->MmInstallConfigurationTable().
-**/
-EFI_STATUS
-MemoryStatusCodeInitializeWorker (
- VOID
- )
-{
- EFI_STATUS Status;
-
- //
- // Allocate MM memory status code pool.
- //
- mMmMemoryStatusCodeTable = (RUNTIME_MEMORY_STATUSCODE_HEADER *)AllocateZeroPool (sizeof (RUNTIME_MEMORY_STATUSCODE_HEADER) + PcdGet16 (PcdStatusCodeMemorySize) * 1024);
- ASSERT (mMmMemoryStatusCodeTable != NULL);
-
- mMmMemoryStatusCodeTable->MaxRecordsNumber = (PcdGet16 (PcdStatusCodeMemorySize) * 1024) / sizeof (MEMORY_STATUSCODE_RECORD);
- Status = gMmst->MmInstallConfigurationTable (
- gMmst,
- &gMemoryStatusCodeRecordGuid,
- &mMmMemoryStatusCodeTable,
- sizeof (mMmMemoryStatusCodeTable)
- );
- return Status;
-}
-
-/**
- Report status code into runtime memory. If the runtime pool is full, roll back to the
- first record and overwrite it.
-
- @param CodeType Indicates the type of status code being reported.
- @param Value Describes the current status of a hardware or software entity.
- This included information about the class and subclass that is used to
- classify the entity as well as an operation.
- @param Instance The enumeration of a hardware or software entity within
- the system. Valid instance numbers start with 1.
- @param CallerId This optional parameter may be used to identify the caller.
- This parameter allows the status code driver to apply different rules to
- different callers.
- @param Data This optional parameter may be used to pass additional data.
-
- @retval EFI_SUCCESS Status code successfully recorded in runtime memory status code table.
-
-**/
-EFI_STATUS
-EFIAPI
-MemoryStatusCodeReportWorker (
- IN EFI_STATUS_CODE_TYPE CodeType,
- IN EFI_STATUS_CODE_VALUE Value,
- IN UINT32 Instance,
- IN EFI_GUID *CallerId,
- IN EFI_STATUS_CODE_DATA *Data OPTIONAL
- )
-{
- MEMORY_STATUSCODE_RECORD *Record;
-
- //
- // Locate current record buffer.
- //
- Record = (MEMORY_STATUSCODE_RECORD *)(mMmMemoryStatusCodeTable + 1);
- Record = &Record[mMmMemoryStatusCodeTable->RecordIndex++];
-
- //
- // Save status code.
- //
- Record->CodeType = CodeType;
- Record->Value = Value;
- Record->Instance = Instance;
-
- //
- // If record index equals to max record number, then wrap around record index to zero.
- //
- // The reader of status code should compare the number of records with max records number,
- // If it is equal to or larger than the max number, then the wrap-around had happened,
- // so the first record is pointed by record index.
- // If it is less then max number, index of the first record is zero.
- //
- mMmMemoryStatusCodeTable->NumberOfRecords++;
- if (mMmMemoryStatusCodeTable->RecordIndex == mMmMemoryStatusCodeTable->MaxRecordsNumber) {
- //
- // Wrap around record index.
- //
- mMmMemoryStatusCodeTable->RecordIndex = 0;
- }
-
- return EFI_SUCCESS;
-}
+/** @file
+ Runtime memory status code worker.
+
+ Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
+ (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include "StatusCodeHandlerMm.h"
+
+RUNTIME_MEMORY_STATUSCODE_HEADER *mMmMemoryStatusCodeTable;
+
+/**
+ Initialize MM memory status code table as initialization for memory status code worker
+
+ @retval EFI_SUCCESS MM memory status code table successfully initialized.
+ @retval others Errors from gMmst->MmInstallConfigurationTable().
+**/
+EFI_STATUS
+MemoryStatusCodeInitializeWorker (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+
+ //
+ // Allocate MM memory status code pool.
+ //
+ mMmMemoryStatusCodeTable = (RUNTIME_MEMORY_STATUSCODE_HEADER *)AllocateZeroPool (sizeof (RUNTIME_MEMORY_STATUSCODE_HEADER) + PcdGet16 (PcdStatusCodeMemorySize) * 1024);
+ ASSERT (mMmMemoryStatusCodeTable != NULL);
+
+ mMmMemoryStatusCodeTable->MaxRecordsNumber = (PcdGet16 (PcdStatusCodeMemorySize) * 1024) / sizeof (MEMORY_STATUSCODE_RECORD);
+ Status = gMmst->MmInstallConfigurationTable (
+ gMmst,
+ &gMemoryStatusCodeRecordGuid,
+ &mMmMemoryStatusCodeTable,
+ sizeof (mMmMemoryStatusCodeTable)
+ );
+ return Status;
+}
+
+/**
+ Report status code into runtime memory. If the runtime pool is full, roll back to the
+ first record and overwrite it.
+
+ @param CodeType Indicates the type of status code being reported.
+ @param Value Describes the current status of a hardware or software entity.
+ This included information about the class and subclass that is used to
+ classify the entity as well as an operation.
+ @param Instance The enumeration of a hardware or software entity within
+ the system. Valid instance numbers start with 1.
+ @param CallerId This optional parameter may be used to identify the caller.
+ This parameter allows the status code driver to apply different rules to
+ different callers.
+ @param Data This optional parameter may be used to pass additional data.
+
+ @retval EFI_SUCCESS Status code successfully recorded in runtime memory status code table.
+
+**/
+EFI_STATUS
+EFIAPI
+MemoryStatusCodeReportWorker (
+ IN EFI_STATUS_CODE_TYPE CodeType,
+ IN EFI_STATUS_CODE_VALUE Value,
+ IN UINT32 Instance,
+ IN EFI_GUID *CallerId,
+ IN EFI_STATUS_CODE_DATA *Data OPTIONAL
+ )
+{
+ MEMORY_STATUSCODE_RECORD *Record;
+
+ //
+ // Locate current record buffer.
+ //
+ Record = (MEMORY_STATUSCODE_RECORD *)(mMmMemoryStatusCodeTable + 1);
+ Record = &Record[mMmMemoryStatusCodeTable->RecordIndex++];
+
+ //
+ // Save status code.
+ //
+ Record->CodeType = CodeType;
+ Record->Value = Value;
+ Record->Instance = Instance;
+
+ //
+ // If record index equals to max record number, then wrap around record index to zero.
+ //
+ // The reader of status code should compare the number of records with max records number,
+ // If it is equal to or larger than the max number, then the wrap-around had happened,
+ // so the first record is pointed by record index.
+ // If it is less then max number, index of the first record is zero.
+ //
+ mMmMemoryStatusCodeTable->NumberOfRecords++;
+ if (mMmMemoryStatusCodeTable->RecordIndex == mMmMemoryStatusCodeTable->MaxRecordsNumber) {
+ //
+ // Wrap around record index.
+ //
+ mMmMemoryStatusCodeTable->RecordIndex = 0;
+ }
+
+ return EFI_SUCCESS;
+}
diff --git a/MdeModulePkg/Universal/StatusCodeHandler/Smm/SerialStatusCodeWorker.c b/MdeModulePkg/Universal/StatusCodeHandler/Smm/SerialStatusCodeWorker.c
index e994e69e48..e764d8ca40 100644
--- a/MdeModulePkg/Universal/StatusCodeHandler/Smm/SerialStatusCodeWorker.c
+++ b/MdeModulePkg/Universal/StatusCodeHandler/Smm/SerialStatusCodeWorker.c
@@ -1,158 +1,158 @@
-/** @file
- Serial I/O status code reporting worker.
-
- Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include "StatusCodeHandlerMm.h"
-
-/**
- Convert status code value and extended data to readable ASCII string, send string to serial I/O device.
-
- @param CodeType Indicates the type of status code being reported.
- @param Value Describes the current status of a hardware or software entity.
- This included information about the class and subclass that is used to
- classify the entity as well as an operation.
- @param Instance The enumeration of a hardware or software entity within
- the system. Valid instance numbers start with 1.
- @param CallerId This optional parameter may be used to identify the caller.
- This parameter allows the status code driver to apply different rules to
- different callers.
- @param Data This optional parameter may be used to pass additional data.
-
- @retval EFI_SUCCESS Status code reported to serial I/O successfully.
- @retval EFI_DEVICE_ERROR EFI serial device cannot work after ExitBootService() is called.
- @retval EFI_DEVICE_ERROR EFI serial device cannot work with TPL higher than TPL_CALLBACK.
-
-**/
-EFI_STATUS
-EFIAPI
-SerialStatusCodeReportWorker (
- IN EFI_STATUS_CODE_TYPE CodeType,
- IN EFI_STATUS_CODE_VALUE Value,
- IN UINT32 Instance,
- IN EFI_GUID *CallerId,
- IN EFI_STATUS_CODE_DATA *Data OPTIONAL
- )
-{
- CHAR8 *Filename;
- CHAR8 *Description;
- CHAR8 *Format;
- CHAR8 Buffer[MAX_DEBUG_MESSAGE_LENGTH];
- UINT32 ErrorLevel;
- UINT32 LineNumber;
- UINTN CharCount;
- BASE_LIST Marker;
-
- Buffer[0] = '\0';
-
- if ((Data != NULL) &&
- ReportStatusCodeExtractAssertInfo (CodeType, Value, Data, &Filename, &Description, &LineNumber))
- {
- //
- // Print ASSERT() information into output buffer.
- //
- CharCount = AsciiSPrint (
- Buffer,
- sizeof (Buffer),
- "\n\rDXE_ASSERT!: %a (%d): %a\n\r",
- Filename,
- LineNumber,
- Description
- );
- } else if ((Data != NULL) &&
- ReportStatusCodeExtractDebugInfo (Data, &ErrorLevel, &Marker, &Format))
- {
- //
- // Print DEBUG() information into output buffer.
- //
- CharCount = AsciiBSPrint (
- Buffer,
- sizeof (Buffer),
- Format,
- Marker
- );
- } else if ((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_ERROR_CODE) {
- //
- // Print ERROR information into output buffer.
- //
- CharCount = AsciiSPrint (
- Buffer,
- sizeof (Buffer),
- "ERROR: C%08x:V%08x I%x",
- CodeType,
- Value,
- Instance
- );
- ASSERT (CharCount > 0);
-
- if (CallerId != NULL) {
- CharCount += AsciiSPrint (
- &Buffer[CharCount],
- (sizeof (Buffer) - (sizeof (Buffer[0]) * CharCount)),
- " %g",
- CallerId
- );
- }
-
- if (Data != NULL) {
- CharCount += AsciiSPrint (
- &Buffer[CharCount],
- (sizeof (Buffer) - (sizeof (Buffer[0]) * CharCount)),
- " %x",
- Data
- );
- }
-
- CharCount += AsciiSPrint (
- &Buffer[CharCount],
- (sizeof (Buffer) - (sizeof (Buffer[0]) * CharCount)),
- "\n\r"
- );
- } else if ((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_PROGRESS_CODE) {
- //
- // Print PROGRESS information into output buffer.
- //
- CharCount = AsciiSPrint (
- Buffer,
- sizeof (Buffer),
- "PROGRESS CODE: V%08x I%x\n\r",
- Value,
- Instance
- );
- } else if ((Data != NULL) &&
- CompareGuid (&Data->Type, &gEfiStatusCodeDataTypeStringGuid) &&
- (((EFI_STATUS_CODE_STRING_DATA *)Data)->StringType == EfiStringAscii))
- {
- //
- // EFI_STATUS_CODE_STRING_DATA
- //
- CharCount = AsciiSPrint (
- Buffer,
- sizeof (Buffer),
- "%a",
- ((EFI_STATUS_CODE_STRING_DATA *)Data)->String.Ascii
- );
- } else {
- //
- // Code type is not defined.
- //
- CharCount = AsciiSPrint (
- Buffer,
- sizeof (Buffer),
- "Undefined: C%08x:V%08x I%x\n\r",
- CodeType,
- Value,
- Instance
- );
- }
-
- //
- // Call SerialPort Lib function to do print.
- //
- SerialPortWrite ((UINT8 *)Buffer, CharCount);
-
- return EFI_SUCCESS;
-}
+/** @file
+ Serial I/O status code reporting worker.
+
+ Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include "StatusCodeHandlerMm.h"
+
+/**
+ Convert status code value and extended data to readable ASCII string, send string to serial I/O device.
+
+ @param CodeType Indicates the type of status code being reported.
+ @param Value Describes the current status of a hardware or software entity.
+ This included information about the class and subclass that is used to
+ classify the entity as well as an operation.
+ @param Instance The enumeration of a hardware or software entity within
+ the system. Valid instance numbers start with 1.
+ @param CallerId This optional parameter may be used to identify the caller.
+ This parameter allows the status code driver to apply different rules to
+ different callers.
+ @param Data This optional parameter may be used to pass additional data.
+
+ @retval EFI_SUCCESS Status code reported to serial I/O successfully.
+ @retval EFI_DEVICE_ERROR EFI serial device cannot work after ExitBootService() is called.
+ @retval EFI_DEVICE_ERROR EFI serial device cannot work with TPL higher than TPL_CALLBACK.
+
+**/
+EFI_STATUS
+EFIAPI
+SerialStatusCodeReportWorker (
+ IN EFI_STATUS_CODE_TYPE CodeType,
+ IN EFI_STATUS_CODE_VALUE Value,
+ IN UINT32 Instance,
+ IN EFI_GUID *CallerId,
+ IN EFI_STATUS_CODE_DATA *Data OPTIONAL
+ )
+{
+ CHAR8 *Filename;
+ CHAR8 *Description;
+ CHAR8 *Format;
+ CHAR8 Buffer[MAX_DEBUG_MESSAGE_LENGTH];
+ UINT32 ErrorLevel;
+ UINT32 LineNumber;
+ UINTN CharCount;
+ BASE_LIST Marker;
+
+ Buffer[0] = '\0';
+
+ if ((Data != NULL) &&
+ ReportStatusCodeExtractAssertInfo (CodeType, Value, Data, &Filename, &Description, &LineNumber))
+ {
+ //
+ // Print ASSERT() information into output buffer.
+ //
+ CharCount = AsciiSPrint (
+ Buffer,
+ sizeof (Buffer),
+ "\n\rDXE_ASSERT!: %a (%d): %a\n\r",
+ Filename,
+ LineNumber,
+ Description
+ );
+ } else if ((Data != NULL) &&
+ ReportStatusCodeExtractDebugInfo (Data, &ErrorLevel, &Marker, &Format))
+ {
+ //
+ // Print DEBUG() information into output buffer.
+ //
+ CharCount = AsciiBSPrint (
+ Buffer,
+ sizeof (Buffer),
+ Format,
+ Marker
+ );
+ } else if ((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_ERROR_CODE) {
+ //
+ // Print ERROR information into output buffer.
+ //
+ CharCount = AsciiSPrint (
+ Buffer,
+ sizeof (Buffer),
+ "ERROR: C%08x:V%08x I%x",
+ CodeType,
+ Value,
+ Instance
+ );
+ ASSERT (CharCount > 0);
+
+ if (CallerId != NULL) {
+ CharCount += AsciiSPrint (
+ &Buffer[CharCount],
+ (sizeof (Buffer) - (sizeof (Buffer[0]) * CharCount)),
+ " %g",
+ CallerId
+ );
+ }
+
+ if (Data != NULL) {
+ CharCount += AsciiSPrint (
+ &Buffer[CharCount],
+ (sizeof (Buffer) - (sizeof (Buffer[0]) * CharCount)),
+ " %x",
+ Data
+ );
+ }
+
+ CharCount += AsciiSPrint (
+ &Buffer[CharCount],
+ (sizeof (Buffer) - (sizeof (Buffer[0]) * CharCount)),
+ "\n\r"
+ );
+ } else if ((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_PROGRESS_CODE) {
+ //
+ // Print PROGRESS information into output buffer.
+ //
+ CharCount = AsciiSPrint (
+ Buffer,
+ sizeof (Buffer),
+ "PROGRESS CODE: V%08x I%x\n\r",
+ Value,
+ Instance
+ );
+ } else if ((Data != NULL) &&
+ CompareGuid (&Data->Type, &gEfiStatusCodeDataTypeStringGuid) &&
+ (((EFI_STATUS_CODE_STRING_DATA *)Data)->StringType == EfiStringAscii))
+ {
+ //
+ // EFI_STATUS_CODE_STRING_DATA
+ //
+ CharCount = AsciiSPrint (
+ Buffer,
+ sizeof (Buffer),
+ "%a",
+ ((EFI_STATUS_CODE_STRING_DATA *)Data)->String.Ascii
+ );
+ } else {
+ //
+ // Code type is not defined.
+ //
+ CharCount = AsciiSPrint (
+ Buffer,
+ sizeof (Buffer),
+ "Undefined: C%08x:V%08x I%x\n\r",
+ CodeType,
+ Value,
+ Instance
+ );
+ }
+
+ //
+ // Call SerialPort Lib function to do print.
+ //
+ SerialPortWrite ((UINT8 *)Buffer, CharCount);
+
+ return EFI_SUCCESS;
+}
diff --git a/MdeModulePkg/Universal/StatusCodeHandler/Smm/StatusCodeHandlerMm.c b/MdeModulePkg/Universal/StatusCodeHandler/Smm/StatusCodeHandlerMm.c
index 6286210aad..c8d724df2e 100644
--- a/MdeModulePkg/Universal/StatusCodeHandler/Smm/StatusCodeHandlerMm.c
+++ b/MdeModulePkg/Universal/StatusCodeHandler/Smm/StatusCodeHandlerMm.c
@@ -1,80 +1,80 @@
-/** @file
- Status Code Handler Driver which produces general handlers and hook them
- onto the MM status code router.
-
- Copyright (c) 2009 - 2020, Intel Corporation. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include "StatusCodeHandlerMm.h"
-
-EFI_MM_RSC_HANDLER_PROTOCOL *mRscHandlerProtocol = NULL;
-
-/**
- Dispatch initialization request to sub status code devices based on
- customized feature flags.
-
-**/
-VOID
-InitializationDispatcherWorker (
- VOID
- )
-{
- EFI_STATUS Status;
-
- //
- // If enable UseSerial, then initialize serial port.
- // if enable UseRuntimeMemory, then initialize runtime memory status code worker.
- //
- if (PcdGetBool (PcdStatusCodeUseSerial)) {
- //
- // Call Serial Port Lib API to initialize serial port.
- //
- Status = SerialPortInitialize ();
- ASSERT_EFI_ERROR (Status);
- }
-
- if (PcdGetBool (PcdStatusCodeUseMemory)) {
- Status = MemoryStatusCodeInitializeWorker ();
- ASSERT_EFI_ERROR (Status);
- }
-}
-
-/**
- Entry point of Common MM Status Code Driver.
-
- This function is the entry point of MM Status Code Driver.
-
- @retval EFI_SUCCESS The entry point is executed successfully.
-
-**/
-EFI_STATUS
-StatusCodeHandlerCommonEntry (
- VOID
- )
-{
- EFI_STATUS Status;
-
- Status = gMmst->MmLocateProtocol (
- &gEfiMmRscHandlerProtocolGuid,
- NULL,
- (VOID **)&mRscHandlerProtocol
- );
- ASSERT_EFI_ERROR (Status);
-
- //
- // Dispatch initialization request to supported devices
- //
- InitializationDispatcherWorker ();
-
- if (PcdGetBool (PcdStatusCodeUseSerial)) {
- mRscHandlerProtocol->Register (SerialStatusCodeReportWorker);
- }
-
- if (PcdGetBool (PcdStatusCodeUseMemory)) {
- mRscHandlerProtocol->Register (MemoryStatusCodeReportWorker);
- }
-
- return EFI_SUCCESS;
-}
+/** @file
+ Status Code Handler Driver which produces general handlers and hook them
+ onto the MM status code router.
+
+ Copyright (c) 2009 - 2020, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include "StatusCodeHandlerMm.h"
+
+EFI_MM_RSC_HANDLER_PROTOCOL *mRscHandlerProtocol = NULL;
+
+/**
+ Dispatch initialization request to sub status code devices based on
+ customized feature flags.
+
+**/
+VOID
+InitializationDispatcherWorker (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+
+ //
+ // If enable UseSerial, then initialize serial port.
+ // if enable UseRuntimeMemory, then initialize runtime memory status code worker.
+ //
+ if (PcdGetBool (PcdStatusCodeUseSerial)) {
+ //
+ // Call Serial Port Lib API to initialize serial port.
+ //
+ Status = SerialPortInitialize ();
+ ASSERT_EFI_ERROR (Status);
+ }
+
+ if (PcdGetBool (PcdStatusCodeUseMemory)) {
+ Status = MemoryStatusCodeInitializeWorker ();
+ ASSERT_EFI_ERROR (Status);
+ }
+}
+
+/**
+ Entry point of Common MM Status Code Driver.
+
+ This function is the entry point of MM Status Code Driver.
+
+ @retval EFI_SUCCESS The entry point is executed successfully.
+
+**/
+EFI_STATUS
+StatusCodeHandlerCommonEntry (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+
+ Status = gMmst->MmLocateProtocol (
+ &gEfiMmRscHandlerProtocolGuid,
+ NULL,
+ (VOID **)&mRscHandlerProtocol
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ //
+ // Dispatch initialization request to supported devices
+ //
+ InitializationDispatcherWorker ();
+
+ if (PcdGetBool (PcdStatusCodeUseSerial)) {
+ mRscHandlerProtocol->Register (SerialStatusCodeReportWorker);
+ }
+
+ if (PcdGetBool (PcdStatusCodeUseMemory)) {
+ mRscHandlerProtocol->Register (MemoryStatusCodeReportWorker);
+ }
+
+ return EFI_SUCCESS;
+}
diff --git a/MdeModulePkg/Universal/StatusCodeHandler/Smm/StatusCodeHandlerMm.h b/MdeModulePkg/Universal/StatusCodeHandler/Smm/StatusCodeHandlerMm.h
index e416220cb5..075bcc8829 100644
--- a/MdeModulePkg/Universal/StatusCodeHandler/Smm/StatusCodeHandlerMm.h
+++ b/MdeModulePkg/Universal/StatusCodeHandler/Smm/StatusCodeHandlerMm.h
@@ -1,129 +1,129 @@
-/** @file
- Internal include file for Status Code Handler Driver.
-
- Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
- (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __STATUS_CODE_HANDLER_MM_H__
-#define __STATUS_CODE_HANDLER_MM_H__
-
-#include <Protocol/MmReportStatusCodeHandler.h>
-
-#include <Guid/MemoryStatusCodeRecord.h>
-#include <Guid/StatusCodeDataTypeId.h>
-#include <Guid/StatusCodeDataTypeDebug.h>
-
-#include <Library/SynchronizationLib.h>
-#include <Library/DebugLib.h>
-#include <Library/ReportStatusCodeLib.h>
-#include <Library/PrintLib.h>
-#include <Library/PcdLib.h>
-#include <Library/UefiDriverEntryPoint.h>
-#include <Library/MmServicesTableLib.h>
-#include <Library/SerialPortLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/BaseMemoryLib.h>
-
-//
-// Define the maximum message length
-//
-#define MAX_DEBUG_MESSAGE_LENGTH 0x100
-
-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.
-
- @param CodeType Indicates the type of status code being reported.
- @param Value Describes the current status of a hardware or software entity.
- This included information about the class and subclass that is used to
- classify the entity as well as an operation.
- @param Instance The enumeration of a hardware or software entity within
- the system. Valid instance numbers start with 1.
- @param CallerId This optional parameter may be used to identify the caller.
- This parameter allows the status code driver to apply different rules to
- different callers.
- @param Data This optional parameter may be used to pass additional data.
-
- @retval EFI_SUCCESS Status code reported to serial I/O successfully.
- @retval EFI_DEVICE_ERROR EFI serial device cannot work after ExitBootService() is called.
- @retval EFI_DEVICE_ERROR EFI serial device cannot work with TPL higher than TPL_CALLBACK.
-
-**/
-EFI_STATUS
-EFIAPI
-SerialStatusCodeReportWorker (
- IN EFI_STATUS_CODE_TYPE CodeType,
- IN EFI_STATUS_CODE_VALUE Value,
- IN UINT32 Instance,
- IN EFI_GUID *CallerId,
- IN EFI_STATUS_CODE_DATA *Data OPTIONAL
- );
-
-/**
- Initialize runtime memory status code table as initialization for runtime memory status code worker
-
- @retval EFI_SUCCESS Runtime memory status code table successfully initialized.
-
-**/
-EFI_STATUS
-MemoryStatusCodeInitializeWorker (
- VOID
- );
-
-/**
- Report status code into runtime memory. If the runtime pool is full, roll back to the
- first record and overwrite it.
-
- @param CodeType Indicates the type of status code being reported.
- @param Value Describes the current status of a hardware or software entity.
- This included information about the class and subclass that is used to
- classify the entity as well as an operation.
- @param Instance The enumeration of a hardware or software entity within
- the system. Valid instance numbers start with 1.
- @param CallerId This optional parameter may be used to identify the caller.
- This parameter allows the status code driver to apply different rules to
- different callers.
- @param Data This optional parameter may be used to pass additional data.
-
- @retval EFI_SUCCESS Status code successfully recorded in runtime memory status code table.
-
-**/
-EFI_STATUS
-EFIAPI
-MemoryStatusCodeReportWorker (
- IN EFI_STATUS_CODE_TYPE CodeType,
- IN EFI_STATUS_CODE_VALUE Value,
- IN UINT32 Instance,
- IN EFI_GUID *CallerId,
- IN EFI_STATUS_CODE_DATA *Data OPTIONAL
- );
-
-/**
- Entry point of Common MM Status Code Driver.
-
- This function is the entry point of MM Status Code Driver.
-
- @retval EFI_SUCCESS The entry point is executed successfully.
-
-**/
-EFI_STATUS
-StatusCodeHandlerCommonEntry (
- VOID
- );
-
-#endif
+/** @file
+ Internal include file for Status Code Handler Driver.
+
+ Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
+ (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef __STATUS_CODE_HANDLER_MM_H__
+#define __STATUS_CODE_HANDLER_MM_H__
+
+#include <Protocol/MmReportStatusCodeHandler.h>
+
+#include <Guid/MemoryStatusCodeRecord.h>
+#include <Guid/StatusCodeDataTypeId.h>
+#include <Guid/StatusCodeDataTypeDebug.h>
+
+#include <Library/SynchronizationLib.h>
+#include <Library/DebugLib.h>
+#include <Library/ReportStatusCodeLib.h>
+#include <Library/PrintLib.h>
+#include <Library/PcdLib.h>
+#include <Library/UefiDriverEntryPoint.h>
+#include <Library/MmServicesTableLib.h>
+#include <Library/SerialPortLib.h>
+#include <Library/MemoryAllocationLib.h>
+#include <Library/BaseMemoryLib.h>
+
+//
+// Define the maximum message length
+//
+#define MAX_DEBUG_MESSAGE_LENGTH 0x100
+
+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.
+
+ @param CodeType Indicates the type of status code being reported.
+ @param Value Describes the current status of a hardware or software entity.
+ This included information about the class and subclass that is used to
+ classify the entity as well as an operation.
+ @param Instance The enumeration of a hardware or software entity within
+ the system. Valid instance numbers start with 1.
+ @param CallerId This optional parameter may be used to identify the caller.
+ This parameter allows the status code driver to apply different rules to
+ different callers.
+ @param Data This optional parameter may be used to pass additional data.
+
+ @retval EFI_SUCCESS Status code reported to serial I/O successfully.
+ @retval EFI_DEVICE_ERROR EFI serial device cannot work after ExitBootService() is called.
+ @retval EFI_DEVICE_ERROR EFI serial device cannot work with TPL higher than TPL_CALLBACK.
+
+**/
+EFI_STATUS
+EFIAPI
+SerialStatusCodeReportWorker (
+ IN EFI_STATUS_CODE_TYPE CodeType,
+ IN EFI_STATUS_CODE_VALUE Value,
+ IN UINT32 Instance,
+ IN EFI_GUID *CallerId,
+ IN EFI_STATUS_CODE_DATA *Data OPTIONAL
+ );
+
+/**
+ Initialize runtime memory status code table as initialization for runtime memory status code worker
+
+ @retval EFI_SUCCESS Runtime memory status code table successfully initialized.
+
+**/
+EFI_STATUS
+MemoryStatusCodeInitializeWorker (
+ VOID
+ );
+
+/**
+ Report status code into runtime memory. If the runtime pool is full, roll back to the
+ first record and overwrite it.
+
+ @param CodeType Indicates the type of status code being reported.
+ @param Value Describes the current status of a hardware or software entity.
+ This included information about the class and subclass that is used to
+ classify the entity as well as an operation.
+ @param Instance The enumeration of a hardware or software entity within
+ the system. Valid instance numbers start with 1.
+ @param CallerId This optional parameter may be used to identify the caller.
+ This parameter allows the status code driver to apply different rules to
+ different callers.
+ @param Data This optional parameter may be used to pass additional data.
+
+ @retval EFI_SUCCESS Status code successfully recorded in runtime memory status code table.
+
+**/
+EFI_STATUS
+EFIAPI
+MemoryStatusCodeReportWorker (
+ IN EFI_STATUS_CODE_TYPE CodeType,
+ IN EFI_STATUS_CODE_VALUE Value,
+ IN UINT32 Instance,
+ IN EFI_GUID *CallerId,
+ IN EFI_STATUS_CODE_DATA *Data OPTIONAL
+ );
+
+/**
+ Entry point of Common MM Status Code Driver.
+
+ This function is the entry point of MM Status Code Driver.
+
+ @retval EFI_SUCCESS The entry point is executed successfully.
+
+**/
+EFI_STATUS
+StatusCodeHandlerCommonEntry (
+ VOID
+ );
+
+#endif
diff --git a/MdeModulePkg/Universal/StatusCodeHandler/Smm/StatusCodeHandlerSmm.inf b/MdeModulePkg/Universal/StatusCodeHandler/Smm/StatusCodeHandlerSmm.inf
index 90abe662d2..2dfeba718d 100644
--- a/MdeModulePkg/Universal/StatusCodeHandler/Smm/StatusCodeHandlerSmm.inf
+++ b/MdeModulePkg/Universal/StatusCodeHandler/Smm/StatusCodeHandlerSmm.inf
@@ -1,66 +1,66 @@
-## @file
-# Status Code Handler Driver which produces general handlers and hook them onto the MM status code router.
-#
-# Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
-# (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
-#
-# SPDX-License-Identifier: BSD-2-Clause-Patent
-#
-#
-##
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = StatusCodeHandlerSmm
- MODULE_UNI_FILE = StatusCodeHandlerSmm.uni
- FILE_GUID = 79CD78D8-6EDC-4978-BD02-3299C387AB17
- MODULE_TYPE = DXE_SMM_DRIVER
- PI_SPECIFICATION_VERSION = 0x0001000A
- VERSION_STRING = 1.0
- ENTRY_POINT = StatusCodeHandlerTraditionalMmEntry
-
-#
-# The following information is for reference only and not required by the build tools.
-#
-# VALID_ARCHITECTURES = IA32 X64
-#
-
-[Sources]
- StatusCodeHandlerMm.c
- StatusCodeHandlerMm.h
- StatusCodeHandlerTraditional.c
- SerialStatusCodeWorker.c
- MemoryStatusCodeWorker.c
-
-[Packages]
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
-
-[LibraryClasses]
- SerialPortLib
- MmServicesTableLib
- UefiDriverEntryPoint
- PcdLib
- PrintLib
- ReportStatusCodeLib
- DebugLib
- MemoryAllocationLib
- BaseMemoryLib
-
-[Guids]
- gEfiStatusCodeDataTypeStringGuid ## SOMETIMES_CONSUMES ## UNDEFINED
- gMemoryStatusCodeRecordGuid ## SOMETIMES_PRODUCES ## UNDEFINED # SmmSystemTable
-
-[Protocols]
- gEfiMmRscHandlerProtocolGuid ## CONSUMES
-
-[Pcd]
- gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeUseSerial ## CONSUMES
- gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeUseMemory ## CONSUMES
- gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeMemorySize |128| gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeUseMemory ## SOMETIMES_CONSUMES
-
-[Depex]
- gEfiMmRscHandlerProtocolGuid
-
-[UserExtensions.TianoCore."ExtraFiles"]
- StatusCodeHandlerSmmExtra.uni
+## @file
+# Status Code Handler Driver which produces general handlers and hook them onto the MM status code router.
+#
+# Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
+# (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+#
+##
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = StatusCodeHandlerSmm
+ MODULE_UNI_FILE = StatusCodeHandlerSmm.uni
+ FILE_GUID = 79CD78D8-6EDC-4978-BD02-3299C387AB17
+ MODULE_TYPE = DXE_SMM_DRIVER
+ PI_SPECIFICATION_VERSION = 0x0001000A
+ VERSION_STRING = 1.0
+ ENTRY_POINT = StatusCodeHandlerTraditionalMmEntry
+
+#
+# The following information is for reference only and not required by the build tools.
+#
+# VALID_ARCHITECTURES = IA32 X64
+#
+
+[Sources]
+ StatusCodeHandlerMm.c
+ StatusCodeHandlerMm.h
+ StatusCodeHandlerTraditional.c
+ SerialStatusCodeWorker.c
+ MemoryStatusCodeWorker.c
+
+[Packages]
+ MdePkg/MdePkg.dec
+ MdeModulePkg/MdeModulePkg.dec
+
+[LibraryClasses]
+ SerialPortLib
+ MmServicesTableLib
+ UefiDriverEntryPoint
+ PcdLib
+ PrintLib
+ ReportStatusCodeLib
+ DebugLib
+ MemoryAllocationLib
+ BaseMemoryLib
+
+[Guids]
+ gEfiStatusCodeDataTypeStringGuid ## SOMETIMES_CONSUMES ## UNDEFINED
+ gMemoryStatusCodeRecordGuid ## SOMETIMES_PRODUCES ## UNDEFINED # SmmSystemTable
+
+[Protocols]
+ gEfiMmRscHandlerProtocolGuid ## CONSUMES
+
+[Pcd]
+ gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeUseSerial ## CONSUMES
+ gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeUseMemory ## CONSUMES
+ gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeMemorySize |128| gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeUseMemory ## SOMETIMES_CONSUMES
+
+[Depex]
+ gEfiMmRscHandlerProtocolGuid
+
+[UserExtensions.TianoCore."ExtraFiles"]
+ StatusCodeHandlerSmmExtra.uni
diff --git a/MdeModulePkg/Universal/StatusCodeHandler/Smm/StatusCodeHandlerSmm.uni b/MdeModulePkg/Universal/StatusCodeHandler/Smm/StatusCodeHandlerSmm.uni
index fa568441b7..70df057ffd 100644
--- a/MdeModulePkg/Universal/StatusCodeHandler/Smm/StatusCodeHandlerSmm.uni
+++ b/MdeModulePkg/Universal/StatusCodeHandler/Smm/StatusCodeHandlerSmm.uni
@@ -1,16 +1,16 @@
-// /** @file
-// Status Code Handler Driver which produces general handlers and hook them onto the SMM status code router.
-//
-// This is the Status Code Handler Driver that produces general handlers and hooks them onto the SMM status code router.
-//
-// Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>
-//
-// SPDX-License-Identifier: BSD-2-Clause-Patent
-//
-// **/
-
-
-#string STR_MODULE_ABSTRACT #language en-US "Produces general handlers and hooks them onto the SMM status code router"
-
-#string STR_MODULE_DESCRIPTION #language en-US "This is the Status Code Handler Driver that produces general handlers and hooks them onto the SMM status code router."
-
+// /** @file
+// Status Code Handler Driver which produces general handlers and hook them onto the SMM status code router.
+//
+// This is the Status Code Handler Driver that produces general handlers and hooks them onto the SMM status code router.
+//
+// Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>
+//
+// SPDX-License-Identifier: BSD-2-Clause-Patent
+//
+// **/
+
+
+#string STR_MODULE_ABSTRACT #language en-US "Produces general handlers and hooks them onto the SMM status code router"
+
+#string STR_MODULE_DESCRIPTION #language en-US "This is the Status Code Handler Driver that produces general handlers and hooks them onto the SMM status code router."
+
diff --git a/MdeModulePkg/Universal/StatusCodeHandler/Smm/StatusCodeHandlerSmmExtra.uni b/MdeModulePkg/Universal/StatusCodeHandler/Smm/StatusCodeHandlerSmmExtra.uni
index d861e36e29..0ba54e22d1 100644
--- a/MdeModulePkg/Universal/StatusCodeHandler/Smm/StatusCodeHandlerSmmExtra.uni
+++ b/MdeModulePkg/Universal/StatusCodeHandler/Smm/StatusCodeHandlerSmmExtra.uni
@@ -1,14 +1,14 @@
-// /** @file
-// StatusCodeHandlerSmm Localized Strings and Content
-//
-// Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.<BR>
-//
-// SPDX-License-Identifier: BSD-2-Clause-Patent
-//
-// **/
-
-#string STR_PROPERTIES_MODULE_NAME
-#language en-US
-"Status Code Handler SMM Driver"
-
-
+// /** @file
+// StatusCodeHandlerSmm Localized Strings and Content
+//
+// Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.<BR>
+//
+// SPDX-License-Identifier: BSD-2-Clause-Patent
+//
+// **/
+
+#string STR_PROPERTIES_MODULE_NAME
+#language en-US
+"Status Code Handler SMM Driver"
+
+
diff --git a/MdeModulePkg/Universal/StatusCodeHandler/Smm/StatusCodeHandlerStandalone.c b/MdeModulePkg/Universal/StatusCodeHandler/Smm/StatusCodeHandlerStandalone.c
index 11a61705d6..7b9530ef32 100644
--- a/MdeModulePkg/Universal/StatusCodeHandler/Smm/StatusCodeHandlerStandalone.c
+++ b/MdeModulePkg/Universal/StatusCodeHandler/Smm/StatusCodeHandlerStandalone.c
@@ -1,31 +1,31 @@
-/** @file
- Abstraction layer that contains Standalone MM specific implementation for
- Status Code Handler Driver.
-
- Copyright (c) Microsoft Corporation.
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include "StatusCodeHandlerMm.h"
-
-/**
- Entry point of Standalone MM Status Code Driver.
-
- This function is the entry point of Standalone MM Status Code Driver.
-
- @param ImageHandle The firmware allocated handle for the EFI image.
- @param SystemTable A pointer to the EFI MM System Table.
-
- @retval EFI_SUCCESS The entry point is executed successfully.
-
-**/
-EFI_STATUS
-EFIAPI
-StatusCodeHandlerStandaloneMmEntry (
- IN EFI_HANDLE ImageHandle,
- IN EFI_MM_SYSTEM_TABLE *SystemTable
- )
-{
- return StatusCodeHandlerCommonEntry ();
-}
+/** @file
+ Abstraction layer that contains Standalone MM specific implementation for
+ Status Code Handler Driver.
+
+ Copyright (c) Microsoft Corporation.
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include "StatusCodeHandlerMm.h"
+
+/**
+ Entry point of Standalone MM Status Code Driver.
+
+ This function is the entry point of Standalone MM Status Code Driver.
+
+ @param ImageHandle The firmware allocated handle for the EFI image.
+ @param SystemTable A pointer to the EFI MM System Table.
+
+ @retval EFI_SUCCESS The entry point is executed successfully.
+
+**/
+EFI_STATUS
+EFIAPI
+StatusCodeHandlerStandaloneMmEntry (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_MM_SYSTEM_TABLE *SystemTable
+ )
+{
+ return StatusCodeHandlerCommonEntry ();
+}
diff --git a/MdeModulePkg/Universal/StatusCodeHandler/Smm/StatusCodeHandlerStandaloneMm.inf b/MdeModulePkg/Universal/StatusCodeHandler/Smm/StatusCodeHandlerStandaloneMm.inf
index d7c863bf06..e0d2bd7e40 100644
--- a/MdeModulePkg/Universal/StatusCodeHandler/Smm/StatusCodeHandlerStandaloneMm.inf
+++ b/MdeModulePkg/Universal/StatusCodeHandler/Smm/StatusCodeHandlerStandaloneMm.inf
@@ -1,63 +1,63 @@
-## @file
-# Status Code Handler Driver which produces general handlers and hook them onto the MM status code router.
-#
-# Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
-# (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
-# Copyright (c) Microsoft Corporation.
-#
-# SPDX-License-Identifier: BSD-2-Clause-Patent
-#
-#
-##
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = StatusCodeHandlerStandaloneMm
- FILE_GUID = EBE7802F-5E11-4D4E-B463-22D2425D156B
- MODULE_TYPE = MM_STANDALONE
- PI_SPECIFICATION_VERSION = 0x00010032
- VERSION_STRING = 1.0
- ENTRY_POINT = StatusCodeHandlerStandaloneMmEntry
-
-#
-# The following information is for reference only and not required by the build tools.
-#
-# VALID_ARCHITECTURES = IA32 X64
-#
-
-[Sources]
- StatusCodeHandlerMm.c
- StatusCodeHandlerMm.h
- StatusCodeHandlerStandalone.c
- SerialStatusCodeWorker.c
- MemoryStatusCodeWorker.c
-
-[Packages]
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
-
-[LibraryClasses]
- SerialPortLib
- MmServicesTableLib
- StandaloneMmDriverEntryPoint
- PcdLib
- PrintLib
- ReportStatusCodeLib
- DebugLib
- MemoryAllocationLib
- BaseMemoryLib
-
-[Guids]
- gEfiStatusCodeDataTypeStringGuid ## SOMETIMES_CONSUMES ## UNDEFINED
- gMemoryStatusCodeRecordGuid ## SOMETIMES_PRODUCES ## UNDEFINED # MmSystemTable
-
-[Protocols]
- gEfiMmRscHandlerProtocolGuid ## CONSUMES
-
-[Pcd]
- gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeUseSerial ## CONSUMES
- gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeUseMemory ## CONSUMES
- gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeMemorySize |128| gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeUseMemory ## SOMETIMES_CONSUMES
-
-[Depex]
- gEfiMmRscHandlerProtocolGuid
+## @file
+# Status Code Handler Driver which produces general handlers and hook them onto the MM status code router.
+#
+# Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
+# (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
+# Copyright (c) Microsoft Corporation.
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+#
+##
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = StatusCodeHandlerStandaloneMm
+ FILE_GUID = EBE7802F-5E11-4D4E-B463-22D2425D156B
+ MODULE_TYPE = MM_STANDALONE
+ PI_SPECIFICATION_VERSION = 0x00010032
+ VERSION_STRING = 1.0
+ ENTRY_POINT = StatusCodeHandlerStandaloneMmEntry
+
+#
+# The following information is for reference only and not required by the build tools.
+#
+# VALID_ARCHITECTURES = IA32 X64
+#
+
+[Sources]
+ StatusCodeHandlerMm.c
+ StatusCodeHandlerMm.h
+ StatusCodeHandlerStandalone.c
+ SerialStatusCodeWorker.c
+ MemoryStatusCodeWorker.c
+
+[Packages]
+ MdePkg/MdePkg.dec
+ MdeModulePkg/MdeModulePkg.dec
+
+[LibraryClasses]
+ SerialPortLib
+ MmServicesTableLib
+ StandaloneMmDriverEntryPoint
+ PcdLib
+ PrintLib
+ ReportStatusCodeLib
+ DebugLib
+ MemoryAllocationLib
+ BaseMemoryLib
+
+[Guids]
+ gEfiStatusCodeDataTypeStringGuid ## SOMETIMES_CONSUMES ## UNDEFINED
+ gMemoryStatusCodeRecordGuid ## SOMETIMES_PRODUCES ## UNDEFINED # MmSystemTable
+
+[Protocols]
+ gEfiMmRscHandlerProtocolGuid ## CONSUMES
+
+[Pcd]
+ gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeUseSerial ## CONSUMES
+ gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeUseMemory ## CONSUMES
+ gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeMemorySize |128| gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeUseMemory ## SOMETIMES_CONSUMES
+
+[Depex]
+ gEfiMmRscHandlerProtocolGuid
diff --git a/MdeModulePkg/Universal/StatusCodeHandler/Smm/StatusCodeHandlerTraditional.c b/MdeModulePkg/Universal/StatusCodeHandler/Smm/StatusCodeHandlerTraditional.c
index da4982908d..a78468c85c 100644
--- a/MdeModulePkg/Universal/StatusCodeHandler/Smm/StatusCodeHandlerTraditional.c
+++ b/MdeModulePkg/Universal/StatusCodeHandler/Smm/StatusCodeHandlerTraditional.c
@@ -1,31 +1,31 @@
-/** @file
- Abstraction layer that contains Standalone MM specific implementation for
- Status Code Handler Driver.
-
- Copyright (c) Microsoft Corporation.
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include "StatusCodeHandlerMm.h"
-
-/**
- Entry point of Traditional MM Status Code Driver.
-
- This function is the entry point of Traditional MM Status Code Driver.
-
- @param ImageHandle The firmware allocated handle for the EFI image.
- @param SystemTable A pointer to the EFI System Table.
-
- @retval EFI_SUCCESS The entry point is executed successfully.
-
-**/
-EFI_STATUS
-EFIAPI
-StatusCodeHandlerTraditionalMmEntry (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- return StatusCodeHandlerCommonEntry ();
-}
+/** @file
+ Abstraction layer that contains Standalone MM specific implementation for
+ Status Code Handler Driver.
+
+ Copyright (c) Microsoft Corporation.
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include "StatusCodeHandlerMm.h"
+
+/**
+ Entry point of Traditional MM Status Code Driver.
+
+ This function is the entry point of Traditional MM Status Code Driver.
+
+ @param ImageHandle The firmware allocated handle for the EFI image.
+ @param SystemTable A pointer to the EFI System Table.
+
+ @retval EFI_SUCCESS The entry point is executed successfully.
+
+**/
+EFI_STATUS
+EFIAPI
+StatusCodeHandlerTraditionalMmEntry (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ return StatusCodeHandlerCommonEntry ();
+}