]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Nt32Pkg/Library/PeiNt32OemHookStatusCodeLib/Nt32OemHookStatusCodeLib.c
UefiCpuPkg: Remove double \r
[mirror_edk2.git] / Nt32Pkg / Library / PeiNt32OemHookStatusCodeLib / Nt32OemHookStatusCodeLib.c
index 2d715d78b983ab03d8d2fc8ce285957bdb526126..e7c2df046a3d231d015cc8eb01a9d5bc83fdd61d 100644 (file)
@@ -1,14 +1,8 @@
 /** @file\r
   OEM hook status code library functions with no library constructor/destructor\r
 \r
-  Copyright (c) 2006, Intel Corporation\r
-  All rights reserved. This program and the accompanying materials\r
-  are licensed and made available under the terms and conditions of the BSD License\r
-  which accompanies this distribution.  The full text of the license may be found at\r
-  http://opensource.org/licenses/bsd-license.php\r
-\r
-  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+  Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>\r
+  SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
   Module Name:  Nt32OemHookStatusCodeLib.c\r
 \r
 //\r
 // The package level header files this module uses\r
 //\r
-#include <FrameworkPei.h>\r
-#include <FrameworkModulePei.h>\r
 #include <WinNtPeim.h>\r
 \r
 //\r
 // The protocols, PPI and GUID defintions for this module\r
 //\r
 #include <Guid/StatusCodeDataTypeId.h>\r
+#include <Guid/StatusCodeDataTypeDebug.h>\r
 #include <Ppi/NtThunk.h>\r
 //\r
 // The Library classes this module consumes\r
 #include <Library/BaseMemoryLib.h>\r
 #include <Library/ReportStatusCodeLib.h>\r
 #include <Library/PeiServicesLib.h>\r
-#include <DebugInfo.h>\r
 \r
 //\r
 // Cache of WinNtThunk protocol\r
 //\r
-STATIC\r
 EFI_WIN_NT_THUNK_PROTOCOL   *mWinNt;\r
 \r
 //\r
 // Cache of standard output handle .\r
 //\r
-STATIC\r
 HANDLE                      mStdOut;\r
 \r
 /**\r
@@ -134,8 +124,7 @@ OemHookStatusCodeReport (
   UINT32          ErrorLevel;\r
   UINT32          LineNumber;\r
   UINTN           CharCount;\r
-  VA_LIST         Marker;\r
-  EFI_DEBUG_INFO  *DebugInfo;\r
+  BASE_LIST       Marker;\r
 \r
   Buffer[0] = '\0';\r
 \r
@@ -146,7 +135,7 @@ OemHookStatusCodeReport (
     //\r
     CharCount = AsciiSPrint (\r
                   Buffer,\r
-                  EFI_STATUS_CODE_DATA_MAX_SIZE,\r
+                  sizeof (Buffer),\r
                   "\n\rASSERT!: %a (%d): %a\n\r",\r
                   Filename,\r
                   LineNumber,\r
@@ -159,7 +148,7 @@ OemHookStatusCodeReport (
     mWinNt->WriteFile (\r
               mStdOut,\r
               Buffer,\r
-              CharCount,\r
+              (DWORD)CharCount,\r
               (LPDWORD)&CharCount,\r
               NULL\r
               );\r
@@ -171,30 +160,19 @@ OemHookStatusCodeReport (
     //\r
     // Print DEBUG() information into output buffer.\r
     //\r
-    CharCount = AsciiVSPrint (\r
+    CharCount = AsciiBSPrint (\r
                   Buffer,\r
-                  EFI_STATUS_CODE_DATA_MAX_SIZE,\r
+                  sizeof (Buffer),\r
                   Format,\r
                   Marker\r
                   );\r
-  } else if (Data != NULL &&\r
-             CompareGuid (&Data->Type, &gEfiStatusCodeSpecificDataGuid) &&\r
-             (CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_DEBUG_CODE) {\r
-    //\r
-    // Print specific data into output buffer.\r
-    //\r
-    DebugInfo = (EFI_DEBUG_INFO *) (Data + 1);\r
-    Marker    = (VA_LIST) (DebugInfo + 1);\r
-    Format    = (CHAR8 *) (((UINT64 *) Marker) + 12);\r
-\r
-    CharCount = AsciiVSPrint (Buffer, EFI_STATUS_CODE_DATA_MAX_SIZE, Format, Marker);\r
   } else if ((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_ERROR_CODE) {\r
     //\r
     // Print ERROR information into output buffer.\r
     //\r
     CharCount = AsciiSPrint (\r
                   Buffer,\r
-                  EFI_STATUS_CODE_DATA_MAX_SIZE,\r
+                  sizeof (Buffer),\r
                   "ERROR: C%x:V%x I%x",\r
                   CodeType,\r
                   Value,\r
@@ -208,7 +186,7 @@ OemHookStatusCodeReport (
     if (CallerId != NULL) {\r
       CharCount += AsciiSPrint (\r
                      &Buffer[CharCount - 1],\r
-                     (EFI_STATUS_CODE_DATA_MAX_SIZE - (sizeof (Buffer[0]) * CharCount)),\r
+                     (sizeof (Buffer) - (sizeof (Buffer[0]) * CharCount)),\r
                      " %g",\r
                      CallerId\r
                      );\r
@@ -217,7 +195,7 @@ OemHookStatusCodeReport (
     if (Data != NULL) {\r
       CharCount += AsciiSPrint (\r
                      &Buffer[CharCount - 1],\r
-                     (EFI_STATUS_CODE_DATA_MAX_SIZE - (sizeof (Buffer[0]) * CharCount)),\r
+                     (sizeof (Buffer) - (sizeof (Buffer[0]) * CharCount)),\r
                      " %p",\r
                      Data\r
                      );\r
@@ -225,13 +203,13 @@ OemHookStatusCodeReport (
 \r
     CharCount += AsciiSPrint (\r
                    &Buffer[CharCount - 1],\r
-                   (EFI_STATUS_CODE_DATA_MAX_SIZE - (sizeof (Buffer[0]) * CharCount)),\r
+                   (sizeof (Buffer) - (sizeof (Buffer[0]) * CharCount)),\r
                    "\n\r"\r
                    );\r
   } else if ((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_PROGRESS_CODE) {\r
     CharCount = AsciiSPrint (\r
                   Buffer,\r
-                  EFI_STATUS_CODE_DATA_MAX_SIZE,\r
+                  sizeof (Buffer),\r
                   "PROGRESS CODE: V%x I%x\n\r",\r
                   Value,\r
                   Instance\r
@@ -239,7 +217,7 @@ OemHookStatusCodeReport (
   } else {\r
     CharCount = AsciiSPrint (\r
                   Buffer,\r
-                  EFI_STATUS_CODE_DATA_MAX_SIZE,\r
+                  sizeof (Buffer),\r
                   "Undefined: C%x:V%x I%x\n\r",\r
                   CodeType,\r
                   Value,\r
@@ -253,7 +231,7 @@ OemHookStatusCodeReport (
   mWinNt->WriteFile (\r
             mStdOut,\r
             Buffer,\r
-            CharCount,\r
+            (DWORD)CharCount,\r
             (LPDWORD)&CharCount,\r
             NULL\r
             );\r