2 Serial I/O status code reporting worker.
4 Copyright (c) 2006 - 2009, Intel Corporation
5 All rights reserved. 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 "StatusCodeRuntimeDxe.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.
37 SerialStatusCodeReportWorker (
38 IN EFI_STATUS_CODE_TYPE CodeType
,
39 IN EFI_STATUS_CODE_VALUE Value
,
41 IN EFI_GUID
*CallerId
,
42 IN EFI_STATUS_CODE_DATA
*Data OPTIONAL
48 CHAR8 Buffer
[EFI_STATUS_CODE_DATA_MAX_SIZE
];
57 ReportStatusCodeExtractAssertInfo (CodeType
, Value
, Data
, &Filename
, &Description
, &LineNumber
)) {
59 // Print ASSERT() information into output buffer.
61 CharCount
= AsciiSPrint (
64 "\n\rDXE_ASSERT!: %a (%d): %a\n\r",
69 } else if (Data
!= NULL
&&
70 ReportStatusCodeExtractDebugInfo (Data
, &ErrorLevel
, &Marker
, &Format
)) {
72 // Print DEBUG() information into output buffer.
74 CharCount
= AsciiBSPrint (
80 } else if ((CodeType
& EFI_STATUS_CODE_TYPE_MASK
) == EFI_ERROR_CODE
) {
82 // Print ERROR information into output buffer.
84 CharCount
= AsciiSPrint (
93 if (CallerId
!= NULL
) {
94 CharCount
+= AsciiSPrint (
95 &Buffer
[CharCount
- 1],
96 (sizeof (Buffer
) - (sizeof (Buffer
[0]) * CharCount
)),
103 CharCount
+= AsciiSPrint (
104 &Buffer
[CharCount
- 1],
105 (sizeof (Buffer
) - (sizeof (Buffer
[0]) * CharCount
)),
111 CharCount
+= AsciiSPrint (
112 &Buffer
[CharCount
- 1],
113 (sizeof (Buffer
) - (sizeof (Buffer
[0]) * CharCount
)),
116 } else if ((CodeType
& EFI_STATUS_CODE_TYPE_MASK
) == EFI_PROGRESS_CODE
) {
118 // Print PROGRESS information into output buffer.
120 CharCount
= AsciiSPrint (
123 "PROGRESS CODE: V%x I%x\n\r",
129 // Code type is not defined.
131 CharCount
= AsciiSPrint (
134 "Undefined: C%x:V%x I%x\n\r",
142 // Call SerialPort Lib function to do print.
144 SerialPortWrite ((UINT8
*) Buffer
, CharCount
);