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;
49 // If enable UseSerial, then initialize serial port.
50 // if enable UseRuntimeMemory, then initialize runtime memory status code worker.
51 // if enable UseDataHub, then initialize data hub status code worker.
53 if (FeaturePcdGet (PcdStatusCodeUseEfiSerial
)) {
54 Status
= EfiSerialStatusCodeInitializeWorker ();
55 ASSERT_EFI_ERROR (Status
);
57 if (FeaturePcdGet (PcdStatusCodeUseHardSerial
)) {
58 Status
= SerialPortInitialize ();
59 ASSERT_EFI_ERROR (Status
);
61 if (FeaturePcdGet (PcdStatusCodeUseRuntimeMemory
)) {
62 Status
= RtMemoryStatusCodeInitializeWorker ();
63 ASSERT_EFI_ERROR (Status
);
65 if (FeaturePcdGet (PcdStatusCodeUseDataHub
)) {
66 Status
= DataHubStatusCodeInitializeWorker ();
67 ASSERT_EFI_ERROR (Status
);
69 if (FeaturePcdGet (PcdStatusCodeUseOEM
)) {
70 Status
= OemHookStatusCodeInitialize ();
71 ASSERT_EFI_ERROR (Status
);
75 // Replay Status code which saved in GUID'ed HOB to all supported device.
79 // Journal GUID'ed HOBs to find all record entry, if found,
80 // then output record to support replay device.
82 Hob
.Raw
= GetFirstGuidHob (&gMemoryStatusCodeRecordGuid
);
84 while (Hob
.Raw
!= NULL
) {
85 PacketHeader
= (MEMORY_STATUSCODE_PACKET_HEADER
*) GET_GUID_HOB_DATA (Hob
.Guid
);
86 if (PacketHeader
->PacketIndex
== ExpectedPacketIndex
) {
87 Record
= (MEMORY_STATUSCODE_RECORD
*) (PacketHeader
+ 1);
88 for (Index
= 0; Index
< PacketHeader
->RecordIndex
; Index
++) {
90 // Dispatch records to devices based on feature flag.
92 if (FeaturePcdGet (PcdStatusCodeReplayInSerial
) &&
93 (FeaturePcdGet (PcdStatusCodeUseHardSerial
) ||
94 FeaturePcdGet (PcdStatusCodeUseEfiSerial
))) {
95 SerialStatusCodeReportWorker (
96 Record
[Index
].CodeType
,
98 Record
[Index
].Instance
,
103 if (FeaturePcdGet (PcdStatusCodeReplayInRuntimeMemory
) &&
104 FeaturePcdGet (PcdStatusCodeUseRuntimeMemory
)) {
105 RtMemoryStatusCodeReportWorker (
106 gDxeStatusCode
.RtMemoryStatusCodeTable
[PHYSICAL_MODE
],
107 Record
[Index
].CodeType
,
109 Record
[Index
].Instance
112 if (FeaturePcdGet (PcdStatusCodeReplayInDataHub
) &&
113 FeaturePcdGet (PcdStatusCodeUseDataHub
)) {
114 DataHubStatusCodeReportWorker (
115 Record
[Index
].CodeType
,
117 Record
[Index
].Instance
,
122 if (FeaturePcdGet (PcdStatusCodeReplayInOEM
) &&
123 FeaturePcdGet (PcdStatusCodeUseOEM
)) {
124 OemHookStatusCodeReport (
125 Record
[Index
].CodeType
,
127 Record
[Index
].Instance
,
133 ExpectedPacketIndex
++;
136 // See whether there is gap of packet or not
138 if (NULL
!= HobStart
) {
143 } else if (HobStart
!= NULL
) {
145 // Cache the found packet for improve the performance
150 Hob
.Raw
= GetNextGuidHob (&gMemoryStatusCodeRecordGuid
, Hob
.Raw
);