]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/ReportStatusCode.c
EdkCompatibilityPkg: Remove EdkCompatibilityPkg
[mirror_edk2.git] / EdkCompatibilityPkg / Foundation / Library / EfiCommonLib / ReportStatusCode.c
diff --git a/EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/ReportStatusCode.c b/EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/ReportStatusCode.c
deleted file mode 100644 (file)
index b23b345..0000000
+++ /dev/null
@@ -1,344 +0,0 @@
-/*++\r
-\r
-Copyright (c) 2004, Intel Corporation. All rights reserved.<BR>\r
-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
-\r
-Module Name:\r
-\r
-  ReportStatusCode.c\r
-\r
-Abstract:\r
-\r
-  Worker functions for ReportStatusCode\r
-\r
---*/\r
-\r
-#include "TianoCommon.h"\r
-#include "EfiCommonLib.h"\r
-#include EFI_GUID_DEFINITION (StatusCodeCallerId)\r
-#include EFI_GUID_DEFINITION (StatusCodeDataTypeId)\r
-\r
-\r
-VOID *\r
-EfiConstructStatusCodeData (\r
-  IN  UINT16                    DataSize,\r
-  IN  EFI_GUID                  *TypeGuid,\r
-  IN OUT  EFI_STATUS_CODE_DATA  *Data\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Construct stanader header for optional data passed into ReportStatusCode\r
-\r
-Arguments:\r
-\r
-  DataSize - Size of optional data. Does not include EFI_STATUS_CODE_DATA header\r
-  TypeGuid - GUID to place in EFI_STATUS_CODE_DATA\r
-  Data     - Buffer to use.\r
-\r
-Returns:\r
-\r
-  Return pointer to Data buffer pointing past the end of EFI_STATUS_CODE_DATA\r
-\r
---*/\r
-{\r
-  Data->HeaderSize = (UINT16) sizeof (EFI_STATUS_CODE_DATA);\r
-  Data->Size = (UINT16)(DataSize - sizeof (EFI_STATUS_CODE_DATA));\r
-  EfiCommonLibCopyMem (&Data->Type, TypeGuid, sizeof (EFI_GUID));\r
-  \r
-  return (VOID *)(Data + 1); \r
-}\r
-\r
-EFI_STATUS\r
-EfiDebugVPrintWorker (\r
-  IN  UINTN                   ErrorLevel,\r
-  IN  CHAR8                   *Format,\r
-  IN  VA_LIST                 Marker,\r
-  IN  UINTN                   BufferSize,\r
-  IN OUT VOID                 *Buffer\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Worker function for DEBUG(). If Error Logging hub is loaded log ASSERT\r
-  information. If Error Logging hub is not loaded do nothing.\r
-\r
-  The Format string might be truncated to fit into the status code struture\r
-  which has the max size of EFI_STATUS_CODE_DATA_MAX_SIZE.\r
-\r
-  We use UINT64 buffers due to IPF alignment concerns.\r
-\r
-Arguments:\r
-\r
-  ErrorLevel - If error level is set do the debug print.\r
-\r
-  Format     - String to use for the print, followed by Print arguments.\r
-\r
-  Marker     - VarArgs\r
-\r
-  BufferSize - Size of Buffer.\r
-\r
-  Buffer     - Caller allocated buffer, contains ReportStatusCode extended data\r
-  \r
-Returns:\r
-  \r
-  Status code\r
-  \r
-  EFI_SUCCESS             - Successfully printed\r
-\r
---*/\r
-{\r
-  UINTN                   Index;\r
-  UINTN                   FormatStrLen;\r
-  UINTN                   RemainingStrLen;\r
-  UINT64                  *Ptr;\r
-  EFI_DEBUG_INFO          *EfiDebug;\r
-\r
-  \r
-  //\r
-  // Build the type specific EFI_STATUS_CODE_DATA in order\r
-  //\r
-\r
-  //\r
-  // Fill in EFI_STATUS_CODE_DATA to Buffer.\r
-  //\r
-  EfiDebug = (EFI_DEBUG_INFO *)EfiConstructStatusCodeData (\r
-                                (UINT16)BufferSize, \r
-                                &gEfiStatusCodeDataTypeDebugGuid, \r
-                                Buffer\r
-                                );\r
-\r
-  //\r
-  // Then EFI_DEBUG_INFO\r
-  //\r
-  EfiDebug->ErrorLevel = (UINT32)ErrorLevel;\r
-\r
-  //\r
-  // 12 * sizeof (UINT64) byte mini Var Arg stack.\r
-  // That is followed by the format string.\r
-  //\r
-  for (Index = 0, Ptr = (UINT64 *)(EfiDebug + 1); Index < 12; Index++, Ptr++) {\r
-    *Ptr = VA_ARG (Marker, UINT64);\r
-  }\r
-\r
-  //\r
-  // Place Ascii Format string at the end\r
-  // Truncate it to fit into the status code structure\r
-  //\r
-  FormatStrLen    = EfiAsciiStrLen (Format);\r
-  RemainingStrLen = EFI_STATUS_CODE_DATA_MAX_SIZE\r
-    - sizeof (EFI_STATUS_CODE_DATA)\r
-    - sizeof (EFI_DEBUG_INFO)\r
-    - 12 * sizeof (UINT64) - 1;\r
-  if (FormatStrLen > RemainingStrLen) {\r
-    FormatStrLen = RemainingStrLen;\r
-  }\r
-  EfiCommonLibCopyMem (Ptr, Format, FormatStrLen);\r
-  *((CHAR8 *) Ptr + FormatStrLen) = '\0';\r
-\r
-  return EFI_SUCCESS;\r
-}\r
-\r
-\r
-\r
-EFI_STATUS\r
-EfiDebugAssertWorker (\r
-  IN CHAR8                    *Filename,\r
-  IN INTN                     LineNumber,\r
-  IN CHAR8                    *Description,\r
-  IN UINTN                    BufferSize,\r
-  IN OUT VOID                 *Buffer\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Worker function for ASSERT (). If Error Logging hub is loaded log ASSERT\r
-  information. If Error Logging hub is not loaded DEADLOOP ().\r
-\r
-  We use UINT64 buffers due to IPF alignment concerns.\r
-\r
-Arguments:\r
-\r
-  Filename    - File name of failing routine.\r
-\r
-  LineNumber  - Line number of failing ASSERT().\r
-\r
-  Description - Description, usually the assertion,\r
-  \r
-  BufferSize - Size of Buffer.\r
-\r
-  Buffer     - Caller allocated buffer, contains ReportStatusCode extendecd data\r
-\r
-Returns:\r
-  \r
-  Status code\r
-  \r
-  EFI_BUFFER_TOO_SMALL      - Buffer not large enough\r
-  \r
-  EFI_SUCCESS               - Function successfully done.\r
-\r
---*/\r
-{\r
-  EFI_DEBUG_ASSERT_DATA   *AssertData;\r
-  UINTN                   TotalSize;\r
-  CHAR8                   *EndOfStr;\r
-\r
-  //\r
-  // Make sure it will all fit in the passed in buffer\r
-  //\r
-  TotalSize = sizeof (EFI_STATUS_CODE_DATA) + sizeof (EFI_DEBUG_ASSERT_DATA);\r
-  TotalSize += EfiAsciiStrLen (Filename);\r
-  TotalSize += EfiAsciiStrLen (Description);\r
-  if (TotalSize > BufferSize) {\r
-    return EFI_BUFFER_TOO_SMALL;\r
-  }\r
-\r
-  //\r
-  // Fill in EFI_STATUS_CODE_DATA\r
-  //\r
-  AssertData =  (EFI_DEBUG_ASSERT_DATA *)\r
-                EfiConstructStatusCodeData (\r
-                  (UINT16)(TotalSize - sizeof (EFI_STATUS_CODE_DATA)),\r
-                  &gEfiStatusCodeDataTypeAssertGuid, \r
-                  Buffer\r
-                  );\r
-\r
-  //\r
-  // Fill in EFI_DEBUG_ASSERT_DATA\r
-  //\r
-  AssertData->LineNumber = (UINT32)LineNumber;\r
-\r
-  //\r
-  // Copy Ascii FileName including NULL.\r
-  //\r
-  EndOfStr = EfiAsciiStrCpy ((CHAR8 *)(AssertData + 1), Filename);\r
-\r
-  //\r
-  // Copy Ascii Description \r
-  //\r
-  EfiAsciiStrCpy (EndOfStr, Description);\r
-  return EFI_SUCCESS;\r
-}\r
-\r
-\r
-\r
-BOOLEAN\r
-ReportStatusCodeExtractAssertInfo (\r
-  IN EFI_STATUS_CODE_TYPE     CodeType,\r
-  IN EFI_STATUS_CODE_VALUE    Value,  \r
-  IN EFI_STATUS_CODE_DATA     *Data, \r
-  OUT CHAR8                   **Filename,\r
-  OUT CHAR8                   **Description,\r
-  OUT UINT32                  *LineNumber\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Extract assert information from status code data.\r
-\r
-Arguments:\r
-\r
-  CodeType    - Code type\r
-  Value       - Code value\r
-  Data        - Optional data associated with this status code.\r
-  Filename    - Filename extracted from Data\r
-  Description - Description extracted from Data\r
-  LineNumber  - Line number extracted from Data\r
-\r
-Returns:\r
-\r
-  TRUE      - Successfully extracted\r
-  \r
-  FALSE     - Extraction failed\r
-\r
---*/\r
-{\r
-  EFI_DEBUG_ASSERT_DATA   *AssertData;\r
-\r
-  if (((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_ERROR_CODE) && \r
-        ((CodeType & EFI_STATUS_CODE_SEVERITY_MASK) == EFI_ERROR_UNRECOVERED)) {\r
-    //\r
-    // Assume if we have an uncontained unrecoverable error that the data hub\r
-    // may not work. So we will print out data here. If we had an IPMI controller,\r
-    // or error log we could wack the hardware here.\r
-    //\r
-    if ((Value & EFI_STATUS_CODE_OPERATION_MASK) == EFI_SW_EC_ILLEGAL_SOFTWARE_STATE && (Data != NULL)) {\r
-      //\r
-      // ASSERT (Expresion) - \r
-      // ExtendedData == FileName\r
-      // Instance     == Line Nuber\r
-      // NULL         == String of Expresion\r
-      //\r
-      AssertData = (EFI_DEBUG_ASSERT_DATA *)(Data + 1);\r
-      *Filename = (CHAR8 *)(AssertData + 1);\r
-      *Description = *Filename + EfiAsciiStrLen (*Filename) + 1;\r
-      *LineNumber = AssertData->LineNumber;\r
-      return TRUE;\r
-    } \r
-  }\r
-  return FALSE;\r
-}\r
-\r
-\r
-BOOLEAN\r
-ReportStatusCodeExtractDebugInfo (\r
-  IN EFI_STATUS_CODE_DATA     *Data,\r
-  OUT UINT32                  *ErrorLevel,\r
-  OUT VA_LIST                 *Marker,\r
-  OUT CHAR8                   **Format\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Extract debug information from status code data.\r
-\r
-Arguments:\r
-\r
-  Data        - Optional data associated with status code.\r
-  ErrorLevel  - Error level extracted from Data\r
-  Marker      - VA_LIST extracted from Data\r
-  Format      - Format string extracted from Data\r
-\r
-Returns:\r
-\r
-  TRUE      - Successfully extracted\r
-  \r
-  FALSE     - Extraction failed\r
-\r
---*/\r
-{\r
-  EFI_DEBUG_INFO      *DebugInfo;\r
-\r
-  if ((Data == NULL) || (!EfiCompareGuid (&Data->Type, &gEfiStatusCodeDataTypeDebugGuid))) {\r
-    return FALSE;\r
-  }\r
-  \r
-  DebugInfo = (EFI_DEBUG_INFO *)(Data + 1);\r
-\r
-  *ErrorLevel = DebugInfo->ErrorLevel;\r
-\r
-  //\r
-  // The first 12 * UINTN bytes of the string are really an \r
-  // arguement stack to support varargs on the Format string.\r
-  //\r
-#if (defined (EFIARM) || defined (EFIAARCH64) || defined (__APPLE__) || defined (__GNUC__))\r
-  // It is not legal C code to cast VA_LIST to a pointer. VA_LIST can \r
-  // be a structure. \r
-  return FALSE;\r
-#else\r
-  *Marker = (VA_LIST) (DebugInfo + 1);\r
-  *Format = (CHAR8 *)(((UINT64 *)*Marker) + 12);\r
-  return TRUE;\r
-#endif\r
-}\r