EDK2 doxygen online documents - Firmware Encoding Index 1
EDK2 doxygen online documents - Firmware Encoding Index

MdeModulePkg/Universal/StatusCodeHandler/Smm/SerialStatusCodeWorker.c

Go to the documentation of this file.
00001 
00015 #include "StatusCodeHandlerSmm.h"
00016 
00036 EFI_STATUS
00037 EFIAPI
00038 SerialStatusCodeReportWorker (
00039   IN EFI_STATUS_CODE_TYPE     CodeType,
00040   IN EFI_STATUS_CODE_VALUE    Value,
00041   IN UINT32                   Instance,
00042   IN EFI_GUID                 *CallerId,
00043   IN EFI_STATUS_CODE_DATA     *Data OPTIONAL
00044   )
00045 {
00046   CHAR8           *Filename;
00047   CHAR8           *Description;
00048   CHAR8           *Format;
00049   CHAR8           Buffer[EFI_STATUS_CODE_DATA_MAX_SIZE];
00050   UINT32          ErrorLevel;
00051   UINT32          LineNumber;
00052   UINTN           CharCount;
00053   BASE_LIST       Marker;
00054 
00055   Buffer[0] = '\0';
00056 
00057   if (Data != NULL &&
00058       ReportStatusCodeExtractAssertInfo (CodeType, Value, Data, &Filename, &Description, &LineNumber)) {
00059     //
00060     // Print ASSERT() information into output buffer.
00061     //
00062     CharCount = AsciiSPrint (
00063                   Buffer,
00064                   sizeof (Buffer),
00065                   "\n\rDXE_ASSERT!: %a (%d): %a\n\r",
00066                   Filename,
00067                   LineNumber,
00068                   Description
00069                   );
00070   } else if (Data != NULL &&
00071              ReportStatusCodeExtractDebugInfo (Data, &ErrorLevel, &Marker, &Format)) {
00072     //
00073     // Print DEBUG() information into output buffer.
00074     //
00075     CharCount = AsciiBSPrint (
00076                   Buffer, 
00077                   sizeof (Buffer), 
00078                   Format, 
00079                   Marker
00080                   );
00081   } else if ((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_ERROR_CODE) {
00082     //
00083     // Print ERROR information into output buffer.
00084     //
00085     CharCount = AsciiSPrint (
00086                   Buffer, 
00087                   sizeof (Buffer), 
00088                   "ERROR: C%x:V%x I%x", 
00089                   CodeType, 
00090                   Value, 
00091                   Instance
00092                   );
00093     ASSERT (CharCount > 0);
00094    
00095     if (CallerId != NULL) {
00096       CharCount += AsciiSPrint (
00097                      &Buffer[CharCount],
00098                      (sizeof (Buffer) - (sizeof (Buffer[0]) * CharCount)),
00099                      " %g",
00100                      CallerId
00101                      );
00102     }
00103 
00104     if (Data != NULL) {
00105       CharCount += AsciiSPrint (
00106                      &Buffer[CharCount],
00107                      (sizeof (Buffer) - (sizeof (Buffer[0]) * CharCount)),
00108                      " %x",
00109                      Data
00110                      );
00111     }
00112 
00113     CharCount += AsciiSPrint (
00114                    &Buffer[CharCount],
00115                    (sizeof (Buffer) - (sizeof (Buffer[0]) * CharCount)),
00116                    "\n\r"
00117                    );
00118   } else if ((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_PROGRESS_CODE) {
00119     //
00120     // Print PROGRESS information into output buffer.
00121     //
00122     CharCount = AsciiSPrint (
00123                   Buffer, 
00124                   sizeof (Buffer), 
00125                   "PROGRESS CODE: V%x I%x\n\r", 
00126                   Value, 
00127                   Instance
00128                   );
00129   } else if (Data != NULL &&
00130              CompareGuid (&Data->Type, &gEfiStatusCodeDataTypeStringGuid) &&
00131              ((EFI_STATUS_CODE_STRING_DATA *) Data)->StringType == EfiStringAscii) {
00132     //
00133     // EFI_STATUS_CODE_STRING_DATA
00134     //
00135     CharCount = AsciiSPrint (
00136                   Buffer,
00137                   sizeof (Buffer),
00138                   "%a\n\r",
00139                   ((EFI_STATUS_CODE_STRING_DATA *) Data)->String.Ascii
00140                   );
00141   } else {
00142     //
00143     // Code type is not defined.
00144     //
00145     CharCount = AsciiSPrint (
00146                   Buffer, 
00147                   sizeof (Buffer), 
00148                   "Undefined: C%x:V%x I%x\n\r", 
00149                   CodeType, 
00150                   Value, 
00151                   Instance
00152                   );
00153   }
00154 
00155   //
00156   // Call SerialPort Lib function to do print.
00157   //
00158   SerialPortWrite ((UINT8 *) Buffer, CharCount);
00159 
00160   return EFI_SUCCESS;
00161 }
00162 
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Defines