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 - 2009, 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"
30 Dispatch initialization request to sub status code devices based on
31 customized feature flags.
35 InitializationDispatcherWorker (
39 EFI_PEI_HOB_POINTERS Hob
;
41 MEMORY_STATUSCODE_PACKET_HEADER
*PacketHeader
;
42 MEMORY_STATUSCODE_RECORD
*Record
;
43 UINTN ExpectedPacketIndex
;
48 // If enable UseSerial, then initialize serial port.
49 // if enable UseRuntimeMemory, then initialize runtime memory status code worker.
50 // if enable UseDataHub, then initialize data hub status code worker.
52 if (FeaturePcdGet (PcdStatusCodeUseEfiSerial
)) {
53 Status
= EfiSerialStatusCodeInitializeWorker ();
54 ASSERT_EFI_ERROR (Status
);
56 if (FeaturePcdGet (PcdStatusCodeUseHardSerial
)) {
58 // Call Serial Port Lib API to initialize serial port.
60 Status
= SerialPortInitialize ();
61 ASSERT_EFI_ERROR (Status
);
63 if (FeaturePcdGet (PcdStatusCodeUseRuntimeMemory
)) {
64 Status
= RtMemoryStatusCodeInitializeWorker ();
65 ASSERT_EFI_ERROR (Status
);
67 if (FeaturePcdGet (PcdStatusCodeUseDataHub
)) {
68 Status
= DataHubStatusCodeInitializeWorker ();
69 ASSERT_EFI_ERROR (Status
);
71 if (FeaturePcdGet (PcdStatusCodeUseOEM
)) {
73 // Call OEM hook status code library API to initialize OEM device for status code.
75 Status
= OemHookStatusCodeInitialize ();
76 ASSERT_EFI_ERROR (Status
);
80 // Replay Status code which saved in GUID'ed HOB to all supported devices.
84 // Journal GUID'ed HOBs to find all record entry, if found,
85 // then output record to support replay device.
87 ExpectedPacketIndex
= 0;
88 Hob
.Raw
= GetFirstGuidHob (&gMemoryStatusCodeRecordGuid
);
90 while (Hob
.Raw
!= NULL
) {
91 PacketHeader
= (MEMORY_STATUSCODE_PACKET_HEADER
*) GET_GUID_HOB_DATA (Hob
.Guid
);
92 if (PacketHeader
->PacketIndex
== ExpectedPacketIndex
) {
93 Record
= (MEMORY_STATUSCODE_RECORD
*) (PacketHeader
+ 1);
94 for (Index
= 0; Index
< PacketHeader
->RecordIndex
; Index
++) {
96 // Dispatch records to devices based on feature flag.
98 if (FeaturePcdGet (PcdStatusCodeReplayInSerial
) &&
99 (FeaturePcdGet (PcdStatusCodeUseHardSerial
) ||
100 FeaturePcdGet (PcdStatusCodeUseEfiSerial
))) {
101 SerialStatusCodeReportWorker (
102 Record
[Index
].CodeType
,
104 Record
[Index
].Instance
,
109 if (FeaturePcdGet (PcdStatusCodeReplayInRuntimeMemory
) &&
110 FeaturePcdGet (PcdStatusCodeUseRuntimeMemory
)) {
111 RtMemoryStatusCodeReportWorker (
112 Record
[Index
].CodeType
,
114 Record
[Index
].Instance
117 if (FeaturePcdGet (PcdStatusCodeReplayInDataHub
) &&
118 FeaturePcdGet (PcdStatusCodeUseDataHub
)) {
119 DataHubStatusCodeReportWorker (
120 Record
[Index
].CodeType
,
122 Record
[Index
].Instance
,
127 if (FeaturePcdGet (PcdStatusCodeReplayInOEM
) &&
128 FeaturePcdGet (PcdStatusCodeUseOEM
)) {
130 // Call OEM hook status code library API to report status code to OEM device
132 OemHookStatusCodeReport (
133 Record
[Index
].CodeType
,
135 Record
[Index
].Instance
,
141 ExpectedPacketIndex
++;
144 // See whether there is gap of packet or not
146 if (HobStart
!= NULL
) {
151 } else if (HobStart
!= NULL
) {
153 // Cache the found packet for improve the performance
158 Hob
.Raw
= GetNextGuidHob (&gMemoryStatusCodeRecordGuid
, Hob
.Raw
);