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: 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
;
44 MEMORY_STATUSCODE_PACKET_HEADER
*PacketHeader
;
45 MEMORY_STATUSCODE_RECORD
*Record
;
46 UINTN ExpectedPacketIndex
= 0;
51 // If enable UseSerial, then initialize serial port.
52 // if enable UseRuntimeMemory, then initialize runtime memory status code worker.
53 // if enable UseDataHub, then initialize data hub status code worker.
55 if (FeaturePcdGet (PcdStatusCodeUseEfiSerial
)) {
56 Status
= EfiSerialStatusCodeInitializeWorker ();
57 ASSERT_EFI_ERROR (Status
);
59 if (FeaturePcdGet (PcdStatusCodeUseHardSerial
)) {
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
)) {
72 Status
= OemHookStatusCodeInitialize ();
73 ASSERT_EFI_ERROR (Status
);
77 // Replay Status code which saved in GUID'ed HOB to all supported device.
81 // Journal GUID'ed HOBs to find all record entry, if found,
82 // then output record to support replay device.
84 Hob
.Raw
= GetFirstGuidHob (&gMemoryStatusCodeRecordGuid
);
86 while (Hob
.Raw
!= NULL
) {
87 PacketHeader
= (MEMORY_STATUSCODE_PACKET_HEADER
*) GET_GUID_HOB_DATA (Hob
.Guid
);
88 if (PacketHeader
->PacketIndex
== ExpectedPacketIndex
) {
89 Record
= (MEMORY_STATUSCODE_RECORD
*) (PacketHeader
+ 1);
90 for (Index
= 0; Index
< PacketHeader
->RecordIndex
; Index
++) {
92 // Dispatch records to devices based on feature flag.
94 if (FeaturePcdGet (PcdStatusCodeReplayInSerial
) &&
95 (FeaturePcdGet (PcdStatusCodeUseHardSerial
) ||
96 FeaturePcdGet (PcdStatusCodeUseEfiSerial
))) {
97 SerialStatusCodeReportWorker (
98 Record
[Index
].CodeType
,
100 Record
[Index
].Instance
,
105 if (FeaturePcdGet (PcdStatusCodeReplayInRuntimeMemory
) &&
106 FeaturePcdGet (PcdStatusCodeUseRuntimeMemory
)) {
107 RtMemoryStatusCodeReportWorker (
108 gDxeStatusCode
.RtMemoryStatusCodeTable
[PHYSICAL_MODE
],
109 Record
[Index
].CodeType
,
111 Record
[Index
].Instance
114 if (FeaturePcdGet (PcdStatusCodeReplayInDataHub
) &&
115 FeaturePcdGet (PcdStatusCodeUseDataHub
)) {
116 DataHubStatusCodeReportWorker (
117 Record
[Index
].CodeType
,
119 Record
[Index
].Instance
,
124 if (FeaturePcdGet (PcdStatusCodeReplayInOEM
) &&
125 FeaturePcdGet (PcdStatusCodeUseOEM
)) {
126 OemHookStatusCodeReport (
127 Record
[Index
].CodeType
,
129 Record
[Index
].Instance
,
135 ExpectedPacketIndex
++;
138 // See whether there is gap of packet or not
145 } else if (HobStart
!= NULL
) {
147 // Cache the found packet for improve the performance
152 Hob
.Raw
= GetNextGuidHob (&gMemoryStatusCodeRecordGuid
, Hob
.Raw
);