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.
14 #include "PeiStatusCode.h"
17 Convert status code value and extended data to readable ASCII string, send string to serial I/O device.
19 @param CodeType Indicates the type of status code being reported.
20 @param Value Describes the current status of a hardware or
21 software entity. This includes information about the class and
22 subclass that is used to classify the entity as well as an operation.
23 For progress codes, the operation is the current activity.
24 For error codes, it is the exception.For debug codes,it is not defined at this time.
25 @param Instance The enumeration of a hardware or software entity within
26 the system. A system may contain multiple entities that match a class/subclass
27 pairing. The instance differentiates between them. An instance of 0 indicates
28 that instance information is unavailable, not meaningful, or not relevant.
29 Valid instance numbers start with 1.
30 @param CallerId This optional parameter may be used to identify the caller.
31 This parameter allows the status code driver to apply different rules to
33 @param Data This optional parameter may be used to pass additional data.
35 @retval EFI_SUCCESS Status code reported to serial I/O successfully.
39 SerialStatusCodeReportWorker (
40 IN EFI_STATUS_CODE_TYPE CodeType
,
41 IN EFI_STATUS_CODE_VALUE Value
,
43 IN CONST EFI_GUID
*CallerId
,
44 IN CONST EFI_STATUS_CODE_DATA
*Data OPTIONAL
50 CHAR8 Buffer
[EFI_STATUS_CODE_DATA_MAX_SIZE
];
59 ReportStatusCodeExtractAssertInfo (CodeType
, Value
, Data
, &Filename
, &Description
, &LineNumber
)) {
61 // Print ASSERT() information into output buffer.
63 CharCount
= AsciiSPrint (
65 EFI_STATUS_CODE_DATA_MAX_SIZE
,
66 "\n\rPEI_ASSERT!: %a (%d): %a\n\r",
71 } else if (Data
!= NULL
&&
72 ReportStatusCodeExtractDebugInfo (Data
, &ErrorLevel
, &Marker
, &Format
)) {
74 // Print DEBUG() information into output buffer.
76 CharCount
= AsciiVSPrint (
78 EFI_STATUS_CODE_DATA_MAX_SIZE
,
82 } else if ((CodeType
& EFI_STATUS_CODE_TYPE_MASK
) == EFI_ERROR_CODE
) {
84 // Print ERROR information into output buffer.
86 CharCount
= AsciiSPrint (
88 EFI_STATUS_CODE_DATA_MAX_SIZE
,
95 if (CallerId
!= NULL
) {
96 CharCount
+= AsciiSPrint (
97 &Buffer
[CharCount
- 1],
98 (EFI_STATUS_CODE_DATA_MAX_SIZE
- (sizeof (Buffer
[0]) * CharCount
)),
105 CharCount
+= AsciiSPrint (
106 &Buffer
[CharCount
- 1],
107 (EFI_STATUS_CODE_DATA_MAX_SIZE
- (sizeof (Buffer
[0]) * CharCount
)),
113 CharCount
+= AsciiSPrint (
114 &Buffer
[CharCount
- 1],
115 (EFI_STATUS_CODE_DATA_MAX_SIZE
- (sizeof (Buffer
[0]) * CharCount
)),
118 } else if ((CodeType
& EFI_STATUS_CODE_TYPE_MASK
) == EFI_PROGRESS_CODE
) {
120 // Print PROGRESS information into output buffer.
122 CharCount
= AsciiSPrint (
124 EFI_STATUS_CODE_DATA_MAX_SIZE
,
125 "PROGRESS CODE: V%x I%x\n\r",
131 // Code type is not defined.
133 CharCount
= AsciiSPrint (
135 EFI_STATUS_CODE_DATA_MAX_SIZE
,
136 "Undefined: C%x:V%x I%x\n\r",
144 // Call SerialPort Lib function to do print.
146 SerialPortWrite ((UINT8
*) Buffer
, CharCount
);