2 Status Code Architectural Protocol implementation as defined in Tiano
3 Architecture Specification.
5 This driver has limited functionality at runtime and will not log to Data Hub
9 This driver assumes the following ReportStatusCode strategy:
10 PEI -> uses PeiReportStatusCode
11 DXE IPL -> uses PeiReportStatusCode
12 early DXE -> uses PeiReportStatusCode via HOB
16 // Copyright (c) 2006, Intel Corporation. All rights reserved.
17 // This software and associated documentation (if any) is furnished
18 // under a license and may only be used or copied in accordance
19 // with the terms of the license. Except as permitted by such
20 // license, no part of this software or documentation may be
21 // reproduced, stored in a retrieval system, or transmitted in any
22 // form or by any means without the express written consent of
25 Module Name: StatusCode.c
29 #include "DxeStatusCode.h"
33 Dispatch initialization request to sub status code devices based on
34 customized feature flags.
38 InitializationDispatcherWorker (
42 EFI_PEI_HOB_POINTERS Hob
;
43 MEMORY_STATUSCODE_PACKET_HEADER
*PacketHeader
;
44 MEMORY_STATUSCODE_RECORD
*Record
;
45 UINTN ExpectedPacketIndex
= 0;
50 // If enable UseSerial, then initialize serial port.
51 // if enable UseRuntimeMemory, then initialize runtime memory status code worker.
52 // if enable UseDataHub, then initialize data hub status code worker.
54 if (FeaturePcdGet (PcdStatusCodeUseEfiSerial
)) {
55 EfiSerialStatusCodeInitializeWorker ();
57 if (FeaturePcdGet (PcdStatusCodeUseHardSerial
)) {
58 SerialPortInitialize ();
60 if (FeaturePcdGet (PcdStatusCodeUseRuntimeMemory
)) {
61 RtMemoryStatusCodeInitializeWorker ();
63 if (FeaturePcdGet (PcdStatusCodeUseDataHub
)) {
64 DataHubStatusCodeInitializeWorker ();
66 if (FeaturePcdGet (PcdStatusCodeUseOEM
)) {
67 OemHookStatusCodeInitialize ();
71 // Replay Status code which saved in GUID'ed HOB to all supported device.
75 // Journal GUID'ed HOBs to find all record entry, if found,
76 // then output record to support replay device.
78 Hob
.Raw
= GetFirstGuidHob (&gMemoryStatusCodeRecordGuid
);
80 while (Hob
.Raw
!= NULL
) {
81 PacketHeader
= (MEMORY_STATUSCODE_PACKET_HEADER
*) GET_GUID_HOB_DATA (Hob
.Guid
);
82 if (PacketHeader
->PacketIndex
== ExpectedPacketIndex
) {
83 Record
= (MEMORY_STATUSCODE_RECORD
*) (PacketHeader
+ 1);
84 for (Index
= 0; Index
< PacketHeader
->RecordIndex
; Index
++) {
86 // Dispatch records to devices based on feature flag.
88 if (FeaturePcdGet (PcdStatusCodeReplayInSerial
) &&
89 (FeaturePcdGet (PcdStatusCodeUseHardSerial
) ||
90 FeaturePcdGet (PcdStatusCodeUseEfiSerial
))) {
91 SerialStatusCodeReportWorker (
92 Record
[Index
].CodeType
,
94 Record
[Index
].Instance
,
99 if (FeaturePcdGet (PcdStatusCodeReplayInRuntimeMemory
) &&
100 FeaturePcdGet (PcdStatusCodeUseRuntimeMemory
)) {
101 RtMemoryStatusCodeReportWorker (
102 gDxeStatusCode
.RtMemoryStatusCodeTable
[PHYSICAL_MODE
],
103 Record
[Index
].CodeType
,
105 Record
[Index
].Instance
108 if (FeaturePcdGet (PcdStatusCodeReplayInDataHub
) &&
109 FeaturePcdGet (PcdStatusCodeUseDataHub
)) {
110 DataHubStatusCodeReportWorker (
111 Record
[Index
].CodeType
,
113 Record
[Index
].Instance
,
118 if (FeaturePcdGet (PcdStatusCodeReplayInOEM
) &&
119 FeaturePcdGet (PcdStatusCodeUseOEM
)) {
120 OemHookStatusCodeReport (
121 Record
[Index
].CodeType
,
123 Record
[Index
].Instance
,
129 ExpectedPacketIndex
++;
132 // See whether there is gap of packet or not
139 } else if (HobStart
!= NULL
) {
141 // Cache the found packet for improve the performance
146 Hob
.Raw
= GetNextGuidHob (&gMemoryStatusCodeRecordGuid
, Hob
.Raw
);