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
17 All rights reserved. This program and the accompanying materials
18 are licensed and made available under the terms and conditions of the BSD License
19 which accompanies this distribution. The full text of the license may be found at
20 http://opensource.org/licenses/bsd-license.php
22 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
23 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
25 Module Name: DxeStatusCode.c
30 // Include common header file for this module.
32 #include "CommonHeader.h"
34 #include "DxeStatusCode.h"
38 Dispatch initialization request to sub status code devices based on
39 customized feature flags.
43 InitializationDispatcherWorker (
47 EFI_PEI_HOB_POINTERS Hob
;
49 MEMORY_STATUSCODE_PACKET_HEADER
*PacketHeader
;
50 MEMORY_STATUSCODE_RECORD
*Record
;
51 UINTN ExpectedPacketIndex
= 0;
56 // If enable UseSerial, then initialize serial port.
57 // if enable UseRuntimeMemory, then initialize runtime memory status code worker.
58 // if enable UseDataHub, then initialize data hub status code worker.
60 if (FeaturePcdGet (PcdStatusCodeUseEfiSerial
)) {
61 Status
= EfiSerialStatusCodeInitializeWorker ();
62 ASSERT_EFI_ERROR (Status
);
64 if (FeaturePcdGet (PcdStatusCodeUseHardSerial
)) {
65 Status
= SerialPortInitialize ();
66 ASSERT_EFI_ERROR (Status
);
68 if (FeaturePcdGet (PcdStatusCodeUseRuntimeMemory
)) {
69 Status
= RtMemoryStatusCodeInitializeWorker ();
70 ASSERT_EFI_ERROR (Status
);
72 if (FeaturePcdGet (PcdStatusCodeUseDataHub
)) {
73 Status
= DataHubStatusCodeInitializeWorker ();
74 ASSERT_EFI_ERROR (Status
);
76 if (FeaturePcdGet (PcdStatusCodeUseOEM
)) {
77 Status
= OemHookStatusCodeInitialize ();
78 ASSERT_EFI_ERROR (Status
);
82 // Replay Status code which saved in GUID'ed HOB to all supported device.
86 // Journal GUID'ed HOBs to find all record entry, if found,
87 // then output record to support replay device.
89 Hob
.Raw
= GetFirstGuidHob (&gMemoryStatusCodeRecordGuid
);
91 while (Hob
.Raw
!= NULL
) {
92 PacketHeader
= (MEMORY_STATUSCODE_PACKET_HEADER
*) GET_GUID_HOB_DATA (Hob
.Guid
);
93 if (PacketHeader
->PacketIndex
== ExpectedPacketIndex
) {
94 Record
= (MEMORY_STATUSCODE_RECORD
*) (PacketHeader
+ 1);
95 for (Index
= 0; Index
< PacketHeader
->RecordIndex
; Index
++) {
97 // Dispatch records to devices based on feature flag.
99 if (FeaturePcdGet (PcdStatusCodeReplayInSerial
) &&
100 (FeaturePcdGet (PcdStatusCodeUseHardSerial
) ||
101 FeaturePcdGet (PcdStatusCodeUseEfiSerial
))) {
102 SerialStatusCodeReportWorker (
103 Record
[Index
].CodeType
,
105 Record
[Index
].Instance
,
110 if (FeaturePcdGet (PcdStatusCodeReplayInRuntimeMemory
) &&
111 FeaturePcdGet (PcdStatusCodeUseRuntimeMemory
)) {
112 RtMemoryStatusCodeReportWorker (
113 gDxeStatusCode
.RtMemoryStatusCodeTable
[PHYSICAL_MODE
],
114 Record
[Index
].CodeType
,
116 Record
[Index
].Instance
119 if (FeaturePcdGet (PcdStatusCodeReplayInDataHub
) &&
120 FeaturePcdGet (PcdStatusCodeUseDataHub
)) {
121 DataHubStatusCodeReportWorker (
122 Record
[Index
].CodeType
,
124 Record
[Index
].Instance
,
129 if (FeaturePcdGet (PcdStatusCodeReplayInOEM
) &&
130 FeaturePcdGet (PcdStatusCodeUseOEM
)) {
131 OemHookStatusCodeReport (
132 Record
[Index
].CodeType
,
134 Record
[Index
].Instance
,
140 ExpectedPacketIndex
++;
143 // See whether there is gap of packet or not
145 if (NULL
!= HobStart
) {
150 } else if (HobStart
!= NULL
) {
152 // Cache the found packet for improve the performance
157 Hob
.Raw
= GetNextGuidHob (&gMemoryStatusCodeRecordGuid
, Hob
.Raw
);