]> git.proxmox.com Git - mirror_edk2.git/blob - IntelFrameworkModulePkg/Universal/StatusCode/Dxe/DxeStatusCode.c
4fd3c76419548a9b67445ac7564c69052fb83792
[mirror_edk2.git] / IntelFrameworkModulePkg / Universal / StatusCode / Dxe / DxeStatusCode.c
1 /** @file
2 Status Code Architectural Protocol implementation as defined in Tiano
3 Architecture Specification.
4
5 This driver has limited functionality at runtime and will not log to Data Hub
6 at runtime.
7
8 Notes:
9 This driver assumes the following ReportStatusCode strategy:
10 PEI -> uses PeiReportStatusCode
11 DXE IPL -> uses PeiReportStatusCode
12 early DXE -> uses PeiReportStatusCode via HOB
13 DXE -> This driver
14 RT -> This driver
15
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
21
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.
24
25 **/
26
27 #include "DxeStatusCode.h"
28
29 /**
30
31 Dispatch initialization request to sub status code devices based on
32 customized feature flags.
33
34 **/
35 VOID
36 InitializationDispatcherWorker (
37 VOID
38 )
39 {
40 EFI_PEI_HOB_POINTERS Hob;
41 EFI_STATUS Status;
42 MEMORY_STATUSCODE_PACKET_HEADER *PacketHeader;
43 MEMORY_STATUSCODE_RECORD *Record;
44 UINTN ExpectedPacketIndex = 0;
45 UINTN Index;
46 VOID *HobStart;
47
48 CpuDeadLoop();
49 //
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.
53 //
54 if (FeaturePcdGet (PcdStatusCodeUseEfiSerial)) {
55 Status = EfiSerialStatusCodeInitializeWorker ();
56 ASSERT_EFI_ERROR (Status);
57 }
58 if (FeaturePcdGet (PcdStatusCodeUseHardSerial)) {
59 Status = SerialPortInitialize ();
60 ASSERT_EFI_ERROR (Status);
61 }
62 if (FeaturePcdGet (PcdStatusCodeUseRuntimeMemory)) {
63 Status = RtMemoryStatusCodeInitializeWorker ();
64 ASSERT_EFI_ERROR (Status);
65 }
66 if (FeaturePcdGet (PcdStatusCodeUseDataHub)) {
67 Status = DataHubStatusCodeInitializeWorker ();
68 ASSERT_EFI_ERROR (Status);
69 }
70 if (FeaturePcdGet (PcdStatusCodeUseOEM)) {
71 Status = OemHookStatusCodeInitialize ();
72 ASSERT_EFI_ERROR (Status);
73 }
74
75 //
76 // Replay Status code which saved in GUID'ed HOB to all supported device.
77 //
78
79 //
80 // Journal GUID'ed HOBs to find all record entry, if found,
81 // then output record to support replay device.
82 //
83 Hob.Raw = GetFirstGuidHob (&gMemoryStatusCodeRecordGuid);
84 HobStart = Hob.Raw;
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++) {
90 //
91 // Dispatch records to devices based on feature flag.
92 //
93 if (FeaturePcdGet (PcdStatusCodeReplayInSerial) &&
94 (FeaturePcdGet (PcdStatusCodeUseHardSerial) ||
95 FeaturePcdGet (PcdStatusCodeUseEfiSerial))) {
96 SerialStatusCodeReportWorker (
97 Record[Index].CodeType,
98 Record[Index].Value,
99 Record[Index].Instance,
100 NULL,
101 NULL
102 );
103 }
104 if (FeaturePcdGet (PcdStatusCodeReplayInRuntimeMemory) &&
105 FeaturePcdGet (PcdStatusCodeUseRuntimeMemory)) {
106 RtMemoryStatusCodeReportWorker (
107 gDxeStatusCode.RtMemoryStatusCodeTable[PHYSICAL_MODE],
108 Record[Index].CodeType,
109 Record[Index].Value,
110 Record[Index].Instance
111 );
112 }
113 if (FeaturePcdGet (PcdStatusCodeReplayInDataHub) &&
114 FeaturePcdGet (PcdStatusCodeUseDataHub)) {
115 DataHubStatusCodeReportWorker (
116 Record[Index].CodeType,
117 Record[Index].Value,
118 Record[Index].Instance,
119 NULL,
120 NULL
121 );
122 }
123 if (FeaturePcdGet (PcdStatusCodeReplayInOEM) &&
124 FeaturePcdGet (PcdStatusCodeUseOEM)) {
125 OemHookStatusCodeReport (
126 Record[Index].CodeType,
127 Record[Index].Value,
128 Record[Index].Instance,
129 NULL,
130 NULL
131 );
132 }
133 }
134 ExpectedPacketIndex++;
135
136 //
137 // See whether there is gap of packet or not
138 //
139 if (NULL != HobStart) {
140 HobStart = NULL;
141 Hob.Raw = HobStart;
142 continue;
143 }
144 } else if (HobStart != NULL) {
145 //
146 // Cache the found packet for improve the performance
147 //
148 HobStart = Hob.Raw;
149 }
150
151 Hob.Raw = GetNextGuidHob (&gMemoryStatusCodeRecordGuid, Hob.Raw);
152 }
153 }
154