]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EdkNt32Pkg/Library/Nt32OemHookStatusCodeLib/Nt32OemHookStatusCodeLib.c
Split Nt32OemHookStatusCodeLib to PEI/DXE instances
[mirror_edk2.git] / EdkNt32Pkg / Library / Nt32OemHookStatusCodeLib / Nt32OemHookStatusCodeLib.c
index de30da9a93559d019660c94f05cb2158276413a9..25f2c3c81ec12ecefd50f75e33ffde70bcab8093 100644 (file)
 \r
 **/\r
 \r
-#include <stdio.h>\r
-\r
 //\r
 // Cache of WinNtThunk protocol \r
-// \r
+//\r
+STATIC\r
 EFI_WIN_NT_THUNK_PROTOCOL   *mWinNt;\r
 \r
 //\r
 // Cache of standard output handle . \r
-// \r
+//\r
+STATIC\r
 HANDLE                      mStdOut;\r
 \r
 /**\r
@@ -47,11 +47,11 @@ OemHookStatusCodeInitialize (
     // Locate NtThunkPpi for retrieving standard output handle\r
     //\r
     Status = PeiServicesLocatePpi (\r
-              &gPeiNtThunkPpiGuid,\r
-              0,\r
-              NULL,\r
-              (VOID **) &NtThunkPpi\r
-              );\r
+               &gPeiNtThunkPpiGuid,\r
+               0,\r
+               NULL,\r
+               (VOID **) &NtThunkPpi\r
+               );\r
 \r
     ASSERT_EFI_ERROR (Status);\r
 \r
@@ -79,13 +79,13 @@ OemHookStatusCodeInitialize (
 /**\r
   Report status code to OEM device.\r
  \r
-  @param  CodeType      Indicates the type of status code being reported.  Type EFI_STATUS_CODE_TYPE is defined in "Related Definitions¡± below.\r
+  @param  CodeType      Indicates the type of status code being reported.  Type EFI_STATUS_CODE_TYPE is defined in "Related Definitions" below.\r
  \r
   @param  Value         Describes the current status of a hardware or software entity.  \r
                         This included information about the class and subclass that is used to classify the entity \r
                         as well as an operation.  For progress codes, the operation is the current activity. \r
                         For error codes, it is the exception.  For debug codes, it is not defined at this time. \r
-                        Type EFI_STATUS_CODE_VALUE is defined in ¡°Related Definitions¡± below.  \r
+                        Type EFI_STATUS_CODE_VALUE is defined in "Related Definitions" below.  \r
                         Specific values are discussed in the Intel? Platform Innovation Framework for EFI Status Code Specification.\r
  \r
   @param  Instance      The enumeration of a hardware or software entity within the system.  \r
@@ -151,8 +151,6 @@ OemHookStatusCodeReport (
               NULL\r
               );\r
 \r
-    CpuBreakpoint ();\r
-\r
     return EFI_SUCCESS;\r
 \r
   } else if (Data != NULL &&\r
@@ -181,7 +179,14 @@ OemHookStatusCodeReport (
     //\r
     // Print ERROR information into output buffer.\r
     //\r
-    CharCount = AsciiSPrint (Buffer, EFI_STATUS_CODE_DATA_MAX_SIZE, "ERROR: C%x:V%x I%x", CodeType, Value, Instance);\r
+    CharCount = AsciiSPrint (\r
+                  Buffer, \r
+                  EFI_STATUS_CODE_DATA_MAX_SIZE, \r
+                  "ERROR: C%x:V%x I%x", \r
+                  CodeType, \r
+                  Value, \r
+                  Instance\r
+                  );\r
 \r
     //\r
     // Make sure we don't try to print values that weren't intended to be printed, especially NULL GUID pointers.\r
@@ -196,7 +201,7 @@ OemHookStatusCodeReport (
                      );\r
     }\r
 \r
-    if (Data) {\r
+    if (Data != NULL) {\r
       CharCount += AsciiSPrint (\r
                      &Buffer[CharCount - 1],\r
                      (EFI_STATUS_CODE_DATA_MAX_SIZE - (sizeof (Buffer[0]) * CharCount)),\r
@@ -211,9 +216,22 @@ OemHookStatusCodeReport (
                    "\n\r"\r
                    );\r
   } else if ((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_PROGRESS_CODE) {\r
-    CharCount = AsciiSPrint (Buffer, EFI_STATUS_CODE_DATA_MAX_SIZE, "PROGRESS CODE: V%x I%x\n\r", Value, Instance);\r
+    CharCount = AsciiSPrint (\r
+                  Buffer, \r
+                  EFI_STATUS_CODE_DATA_MAX_SIZE, \r
+                  "PROGRESS CODE: V%x I%x\n\r", \r
+                  Value, \r
+                  Instance\r
+                  );\r
   } else {\r
-    CharCount = AsciiSPrint (Buffer, EFI_STATUS_CODE_DATA_MAX_SIZE, "Undefined: C%x:V%x I%x\n\r", CodeType, Value, Instance);\r
+    CharCount = AsciiSPrint (\r
+                  Buffer, \r
+                  EFI_STATUS_CODE_DATA_MAX_SIZE, \r
+                  "Undefined: C%x:V%x I%x\n\r", \r
+                  CodeType, \r
+                  Value, \r
+                  Instance\r
+                  );\r
   }\r
 \r
   //\r