]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Nt32Pkg/Sec/SecMain.c
Removed IntelFrameworkPkg references from SEC
[mirror_edk2.git] / Nt32Pkg / Sec / SecMain.c
index 3d2d4279e8c05d5be273fd666955c082291f9ce3..be30d2611d789546ce1abc310da1b96f46ef8266 100644 (file)
@@ -33,7 +33,7 @@ Abstract:
 --*/\r
 \r
 #include "SecMain.h"\r
-#pragma warning(disable : 4996)\r
+\r
 \r
 //\r
 // Globals\r
@@ -420,70 +420,8 @@ Returns:
   return EFI_SUCCESS;\r
 }\r
 \r
-#define BYTES_PER_RECORD  512\r
 \r
-/**\r
-  Extracts ASSERT() information from a status code structure.\r
-\r
-  Converts the status code specified by CodeType, Value, and Data to the ASSERT()\r
-  arguments specified by Filename, Description, and LineNumber.  If CodeType is \r
-  an EFI_ERROR_CODE, and CodeType has a severity of EFI_ERROR_UNRECOVERED, and \r
-  Value has an operation mask of EFI_SW_EC_ILLEGAL_SOFTWARE_STATE, extract \r
-  Filename, Description, and LineNumber from the optional data area of the \r
-  status code buffer specified by Data.  The optional data area of Data contains \r
-  a Null-terminated ASCII string for the FileName, followed by a Null-terminated \r
-  ASCII string for the Description, followed by a 32-bit LineNumber.  If the \r
-  ASSERT() information could be extracted from Data, then return TRUE.  \r
-  Otherwise, FALSE is returned.  \r
-\r
-  If Data is NULL, then ASSERT().\r
-  If Filename is NULL, then ASSERT().\r
-  If Description is NULL, then ASSERT().\r
-  If LineNumber is NULL, then ASSERT().\r
-\r
-  @param  CodeType     The type of status code being converted.\r
-  @param  Value        The status code value being converted.\r
-  @param  Data         Pointer to status code data buffer. \r
-  @param  Filename     Pointer to the source file name that generated the ASSERT().\r
-  @param  Description  Pointer to the description of the ASSERT().\r
-  @param  LineNumber   Pointer to source line number that generated the ASSERT().\r
-\r
-  @retval  TRUE   The status code specified by CodeType, Value, and Data was \r
-                  converted ASSERT() arguments specified by Filename, Description, \r
-                  and LineNumber.\r
-  @retval  FALSE  The status code specified by CodeType, Value, and Data could \r
-                  not be converted to ASSERT() arguments.\r
-\r
-**/\r
-STATIC\r
-BOOLEAN\r
-ReportStatusCodeExtractAssertInfo (\r
-  IN EFI_STATUS_CODE_TYPE        CodeType,\r
-  IN EFI_STATUS_CODE_VALUE       Value,  \r
-  IN CONST EFI_STATUS_CODE_DATA  *Data, \r
-  OUT CHAR8                      **Filename,\r
-  OUT CHAR8                      **Description,\r
-  OUT UINT32                     *LineNumber\r
-  )\r
-{\r
-  EFI_DEBUG_ASSERT_DATA  *AssertData;\r
-\r
-  ASSERT (Data        != NULL);\r
-  ASSERT (Filename    != NULL);\r
-  ASSERT (Description != NULL);\r
-  ASSERT (LineNumber  != NULL);\r
-\r
-  if (((CodeType & EFI_STATUS_CODE_TYPE_MASK)      == EFI_ERROR_CODE) && \r
-      ((CodeType & EFI_STATUS_CODE_SEVERITY_MASK)  == EFI_ERROR_UNRECOVERED) &&\r
-      ((Value    & EFI_STATUS_CODE_OPERATION_MASK) == EFI_SW_EC_ILLEGAL_SOFTWARE_STATE)) {\r
-    AssertData   = (EFI_DEBUG_ASSERT_DATA *)(Data + 1);\r
-    *Filename    = (CHAR8 *)(AssertData + 1);\r
-    *Description = *Filename + AsciiStrLen (*Filename) + 1;\r
-    *LineNumber  = AssertData->LineNumber;\r
-    return TRUE;\r
-  }\r
-  return FALSE;\r
-}\r
+#define BYTES_PER_RECORD  512\r
 \r
 EFI_STATUS\r
 EFIAPI\r
@@ -492,8 +430,8 @@ SecPeiReportStatusCode (
   IN EFI_STATUS_CODE_TYPE       CodeType,\r
   IN EFI_STATUS_CODE_VALUE      Value,\r
   IN UINT32                     Instance,\r
-  IN EFI_GUID                   * CallerId,\r
-  IN EFI_STATUS_CODE_DATA       * Data OPTIONAL\r
+  IN EFI_GUID                   *CallerId,\r
+  IN EFI_STATUS_CODE_DATA       *Data OPTIONAL\r
   )\r
 /*++\r
 \r
@@ -520,47 +458,27 @@ Returns:
 // TODO:    Data - add argument and description to function comment\r
 {\r
   CHAR8           *Format;\r
-  EFI_DEBUG_INFO  *DebugInfo;\r
   VA_LIST         Marker;\r
   CHAR8           PrintBuffer[BYTES_PER_RECORD * 2];\r
   CHAR8           *Filename;\r
   CHAR8           *Description;\r
   UINT32          LineNumber;\r
+  UINT32          ErrorLevel;\r
 \r
-  if ((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_DEBUG_CODE) {\r
-    //\r
-    // This supports DEBUG () marcos\r
-    // Data format\r
-    //  EFI_STATUS_CODE_DATA\r
-    //  EFI_DEBUG_INFO\r
+\r
+  if (Data == NULL) {\r
+  } else if (ReportStatusCodeExtractAssertInfo (CodeType, Value, Data, &Filename, &Description, &LineNumber)) {\r
     //\r
-    // The first 12 * UINT64 bytes of the string are really an\r
-    // arguement stack to support varargs on the Format string.\r
+    // Processes ASSERT ()\r
     //\r
-    if (Data != NULL) {\r
-      DebugInfo = (EFI_DEBUG_INFO *) (Data + 1);\r
-      Marker    = (VA_LIST) (DebugInfo + 1);\r
-      Format    = (CHAR8 *) (((UINT64 *) Marker) + 12);\r
+    printf ("ASSERT %s(%d): %s\n", Filename, LineNumber, Description);\r
 \r
-      AsciiVSPrint (PrintBuffer, BYTES_PER_RECORD, Format, Marker);\r
-      printf (PrintBuffer);\r
-    } else {\r
-      printf ("DEBUG <null>\n");\r
-    }\r
-  }\r
-\r
-  if (((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_ERROR_CODE) &&\r
-      ((CodeType & EFI_STATUS_CODE_SEVERITY_MASK) == EFI_ERROR_UNRECOVERED)\r
-      ) {\r
-    if (Data != NULL && ReportStatusCodeExtractAssertInfo (CodeType, Value, Data, &Filename, &Description, &LineNumber)) {\r
-      //\r
-      // Support ASSERT () macro\r
-      //\r
-      printf ("ASSERT %s(%d): %s\n", Filename, LineNumber, Description);\r
-    } else {\r
-      printf ("ASSERT <null>\n");\r
-    }\r
-    CpuBreakpoint ();\r
+  } else if (ReportStatusCodeExtractDebugInfo (Data, &ErrorLevel, &Marker, &Format)) {\r
+    //\r
+    // Process DEBUG () macro \r
+    //\r
+    AsciiVSPrint (PrintBuffer, BYTES_PER_RECORD, Format, Marker);\r
+    printf (PrintBuffer);\r
   }\r
 \r
   return EFI_SUCCESS;\r
@@ -1233,4 +1151,3 @@ _ModuleEntryPoint (
 {\r
 }\r
 \r
-#pragma warning(default : 4996)\r