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.
27 #include "DxeStatusCode.h"
31 Dispatch initialization request to sub status code devices based on
32 customized feature flags.
36 InitializationDispatcherWorker (
40 EFI_PEI_HOB_POINTERS Hob
;
42 MEMORY_STATUSCODE_PACKET_HEADER
*PacketHeader
;
43 MEMORY_STATUSCODE_RECORD
*Record
;
44 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 Status
= EfiSerialStatusCodeInitializeWorker ();
56 ASSERT_EFI_ERROR (Status
);
58 if (FeaturePcdGet (PcdStatusCodeUseHardSerial
)) {
59 Status
= SerialPortInitialize ();
60 ASSERT_EFI_ERROR (Status
);
62 if (FeaturePcdGet (PcdStatusCodeUseRuntimeMemory
)) {
63 Status
= RtMemoryStatusCodeInitializeWorker ();
64 ASSERT_EFI_ERROR (Status
);
66 if (FeaturePcdGet (PcdStatusCodeUseDataHub
)) {
67 Status
= DataHubStatusCodeInitializeWorker ();
68 ASSERT_EFI_ERROR (Status
);
70 if (FeaturePcdGet (PcdStatusCodeUseOEM
)) {
71 Status
= OemHookStatusCodeInitialize ();
72 ASSERT_EFI_ERROR (Status
);
76 // Replay Status code which saved in GUID'ed HOB to all supported device.
80 // Journal GUID'ed HOBs to find all record entry, if found,
81 // then output record to support replay device.
83 Hob
.Raw
= GetFirstGuidHob (&gMemoryStatusCodeRecordGuid
);
85 while (Hob
.Raw
!= NULL
) {
86 PacketHeader
= (MEMORY_STATUSCODE_PACKET_HEADER
*) GET_GUID_HOB_DATA (Hob
.Guid
);
87 if (PacketHeader
->PacketIndex
== ExpectedPacketIndex
) {
88 Record
= (MEMORY_STATUSCODE_RECORD
*) (PacketHeader
+ 1);
89 for (Index
= 0; Index
< PacketHeader
->RecordIndex
; Index
++) {
91 // Dispatch records to devices based on feature flag.
93 if (FeaturePcdGet (PcdStatusCodeReplayInSerial
) &&
94 (FeaturePcdGet (PcdStatusCodeUseHardSerial
) ||
95 FeaturePcdGet (PcdStatusCodeUseEfiSerial
))) {
96 SerialStatusCodeReportWorker (
97 Record
[Index
].CodeType
,
99 Record
[Index
].Instance
,
104 if (FeaturePcdGet (PcdStatusCodeReplayInRuntimeMemory
) &&
105 FeaturePcdGet (PcdStatusCodeUseRuntimeMemory
)) {
106 RtMemoryStatusCodeReportWorker (
107 gDxeStatusCode
.RtMemoryStatusCodeTable
[PHYSICAL_MODE
],
108 Record
[Index
].CodeType
,
110 Record
[Index
].Instance
113 if (FeaturePcdGet (PcdStatusCodeReplayInDataHub
) &&
114 FeaturePcdGet (PcdStatusCodeUseDataHub
)) {
115 DataHubStatusCodeReportWorker (
116 Record
[Index
].CodeType
,
118 Record
[Index
].Instance
,
123 if (FeaturePcdGet (PcdStatusCodeReplayInOEM
) &&
124 FeaturePcdGet (PcdStatusCodeUseOEM
)) {
125 OemHookStatusCodeReport (
126 Record
[Index
].CodeType
,
128 Record
[Index
].Instance
,
134 ExpectedPacketIndex
++;
137 // See whether there is gap of packet or not
139 if (NULL
!= HobStart
) {
144 } else if (HobStart
!= NULL
) {
146 // Cache the found packet for improve the performance
151 Hob
.Raw
= GetNextGuidHob (&gMemoryStatusCodeRecordGuid
, Hob
.Raw
);