2 Serial I/O status code reporting worker.
4 Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
8 #include "StatusCodePei.h"
11 Convert status code value and extended data to readable ASCII string, send string to serial I/O device.
13 @param CodeType Indicates the type of status code being reported.
14 @param Value Describes the current status of a hardware or
15 software entity. This includes information about the class and
16 subclass that is used to classify the entity as well as an operation.
17 For progress codes, the operation is the current activity.
18 For error codes, it is the exception.For debug codes,it is not defined at this time.
19 @param Instance The enumeration of a hardware or software entity within
20 the system. A system may contain multiple entities that match a class/subclass
21 pairing. The instance differentiates between them. An instance of 0 indicates
22 that instance information is unavailable, not meaningful, or not relevant.
23 Valid instance numbers start with 1.
24 @param CallerId This optional parameter may be used to identify the caller.
25 This parameter allows the status code driver to apply different rules to
27 @param Data This optional parameter may be used to pass additional data.
29 @retval EFI_SUCCESS Status code reported to serial I/O successfully.
33 SerialStatusCodeReportWorker (
34 IN EFI_STATUS_CODE_TYPE CodeType
,
35 IN EFI_STATUS_CODE_VALUE Value
,
37 IN CONST EFI_GUID
*CallerId
,
38 IN CONST EFI_STATUS_CODE_DATA
*Data OPTIONAL
44 CHAR8 Buffer
[EFI_STATUS_CODE_DATA_MAX_SIZE
];
53 ReportStatusCodeExtractAssertInfo (CodeType
, Value
, Data
, &Filename
, &Description
, &LineNumber
)) {
55 // Print ASSERT() information into output buffer.
57 CharCount
= AsciiSPrint (
60 "\n\rPEI_ASSERT!: %a (%d): %a\n\r",
65 } else if (Data
!= NULL
&&
66 ReportStatusCodeExtractDebugInfo (Data
, &ErrorLevel
, &Marker
, &Format
)) {
68 // Print DEBUG() information into output buffer.
70 CharCount
= AsciiBSPrint (
76 } else if ((CodeType
& EFI_STATUS_CODE_TYPE_MASK
) == EFI_ERROR_CODE
) {
78 // Print ERROR information into output buffer.
80 CharCount
= AsciiSPrint (
83 "ERROR: C%08x:V%08x I%x",
89 if (CallerId
!= NULL
) {
90 CharCount
+= AsciiSPrint (
92 (sizeof (Buffer
) - (sizeof (Buffer
[0]) * CharCount
)),
99 CharCount
+= AsciiSPrint (
101 (sizeof (Buffer
) - (sizeof (Buffer
[0]) * CharCount
)),
107 CharCount
+= AsciiSPrint (
109 (sizeof (Buffer
) - (sizeof (Buffer
[0]) * CharCount
)),
112 } else if ((CodeType
& EFI_STATUS_CODE_TYPE_MASK
) == EFI_PROGRESS_CODE
) {
114 // Print PROGRESS information into output buffer.
116 CharCount
= AsciiSPrint (
119 "PROGRESS CODE: V%08x I%x\n\r",
123 } else if (Data
!= NULL
&&
124 CompareGuid (&Data
->Type
, &gEfiStatusCodeDataTypeStringGuid
) &&
125 ((EFI_STATUS_CODE_STRING_DATA
*) Data
)->StringType
== EfiStringAscii
) {
127 // EFI_STATUS_CODE_STRING_DATA
129 CharCount
= AsciiSPrint (
133 ((EFI_STATUS_CODE_STRING_DATA
*) Data
)->String
.Ascii
137 // Code type is not defined.
139 CharCount
= AsciiSPrint (
142 "Undefined: C%08x:V%08x I%x\n\r",
150 // Call SerialPort Lib function to do print.
152 SerialPortWrite ((UINT8
*) Buffer
, CharCount
);