2 Serial I/O status code reporting worker.
4 Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15 #include "StatusCodeHandlerRuntimeDxe.h"
18 Convert status code value and extended data to readable ASCII string, send string to serial I/O device.
20 @param CodeType Indicates the type of status code being reported.
21 @param Value Describes the current status of a hardware or software entity.
22 This included information about the class and subclass that is used to
23 classify the entity as well as an operation.
24 @param Instance The enumeration of a hardware or software entity within
25 the system. Valid instance numbers start with 1.
26 @param CallerId This optional parameter may be used to identify the caller.
27 This parameter allows the status code driver to apply different rules to
29 @param Data This optional parameter may be used to pass additional data.
31 @retval EFI_SUCCESS Status code reported to serial I/O successfully.
32 @retval EFI_DEVICE_ERROR EFI serial device cannot work after ExitBootService() is called.
33 @retval EFI_DEVICE_ERROR EFI serial device cannot work with TPL higher than TPL_CALLBACK.
38 SerialStatusCodeReportWorker (
39 IN EFI_STATUS_CODE_TYPE CodeType
,
40 IN EFI_STATUS_CODE_VALUE Value
,
42 IN EFI_GUID
*CallerId
,
43 IN EFI_STATUS_CODE_DATA
*Data OPTIONAL
49 CHAR8 Buffer
[EFI_STATUS_CODE_DATA_MAX_SIZE
];
58 ReportStatusCodeExtractAssertInfo (CodeType
, Value
, Data
, &Filename
, &Description
, &LineNumber
)) {
60 // Print ASSERT() information into output buffer.
62 CharCount
= AsciiSPrint (
65 "\n\rDXE_ASSERT!: %a (%d): %a\n\r",
70 } else if (Data
!= NULL
&&
71 ReportStatusCodeExtractDebugInfo (Data
, &ErrorLevel
, &Marker
, &Format
)) {
73 // Print DEBUG() information into output buffer.
75 CharCount
= AsciiBSPrint (
81 } else if ((CodeType
& EFI_STATUS_CODE_TYPE_MASK
) == EFI_ERROR_CODE
) {
83 // Print ERROR information into output buffer.
85 CharCount
= AsciiSPrint (
94 if (CallerId
!= NULL
) {
95 CharCount
+= AsciiSPrint (
96 &Buffer
[CharCount
- 1],
97 (sizeof (Buffer
) - (sizeof (Buffer
[0]) * CharCount
)),
104 CharCount
+= AsciiSPrint (
105 &Buffer
[CharCount
- 1],
106 (sizeof (Buffer
) - (sizeof (Buffer
[0]) * CharCount
)),
112 CharCount
+= AsciiSPrint (
113 &Buffer
[CharCount
- 1],
114 (sizeof (Buffer
) - (sizeof (Buffer
[0]) * CharCount
)),
117 } else if ((CodeType
& EFI_STATUS_CODE_TYPE_MASK
) == EFI_PROGRESS_CODE
) {
119 // Print PROGRESS information into output buffer.
121 CharCount
= AsciiSPrint (
124 "PROGRESS CODE: V%x I%x\n\r",
128 } else if (Data
!= NULL
&&
129 CompareGuid (&Data
->Type
, &gEfiStatusCodeDataTypeStringGuid
) &&
130 ((EFI_STATUS_CODE_STRING_DATA
*) Data
)->StringType
== EfiStringAscii
) {
132 // EFI_STATUS_CODE_STRING_DATA
134 CharCount
= AsciiSPrint (
138 ((EFI_STATUS_CODE_STRING_DATA
*) Data
)->String
.Ascii
142 // Code type is not defined.
144 CharCount
= AsciiSPrint (
147 "Undefined: C%x:V%x I%x\n\r",
155 // Call SerialPort Lib function to do print.
157 SerialPortWrite ((UINT8
*) Buffer
, CharCount
);