]> git.proxmox.com Git - mirror_edk2.git/blame - IntelFrameworkModulePkg/Universal/StatusCode/Dxe/DxeStatusCode.c
StatusCode driver is optional dependent on gEfiDataHubProtocolGuid but not always...
[mirror_edk2.git] / IntelFrameworkModulePkg / Universal / StatusCode / Dxe / DxeStatusCode.c
CommitLineData
ad1a1798 1/** @file\r
2 Status Code Architectural Protocol implementation as defined in Tiano\r
3 Architecture Specification.\r
4\r
5 This driver has limited functionality at runtime and will not log to Data Hub\r
6 at runtime.\r
7\r
8 Notes:\r
9 This driver assumes the following ReportStatusCode strategy:\r
10 PEI -> uses PeiReportStatusCode\r
11 DXE IPL -> uses PeiReportStatusCode\r
12 early DXE -> uses PeiReportStatusCode via HOB\r
13 DXE -> This driver\r
14 RT -> This driver\r
15\r
16 Copyright (c) 2006, Intel Corporation \r
17 All rights reserved. This program and the accompanying materials \r
18 are licensed and made available under the terms and conditions of the BSD License \r
19 which accompanies this distribution. The full text of the license may be found at \r
20 http://opensource.org/licenses/bsd-license.php \r
21 \r
22 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
23 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
24\r
ad1a1798 25**/\r
26\r
ad1a1798 27#include "DxeStatusCode.h"\r
28\r
29/**\r
30 \r
31 Dispatch initialization request to sub status code devices based on \r
32 customized feature flags.\r
33 \r
34**/\r
35VOID\r
36InitializationDispatcherWorker (\r
37 VOID\r
38 )\r
39{\r
40 EFI_PEI_HOB_POINTERS Hob;\r
41 EFI_STATUS Status;\r
42 MEMORY_STATUSCODE_PACKET_HEADER *PacketHeader;\r
43 MEMORY_STATUSCODE_RECORD *Record;\r
44 UINTN ExpectedPacketIndex = 0;\r
45 UINTN Index;\r
46 VOID *HobStart;\r
47\r
60bb2715 48 CpuDeadLoop();\r
ad1a1798 49 //\r
50 // If enable UseSerial, then initialize serial port.\r
51 // if enable UseRuntimeMemory, then initialize runtime memory status code worker.\r
52 // if enable UseDataHub, then initialize data hub status code worker.\r
53 //\r
54 if (FeaturePcdGet (PcdStatusCodeUseEfiSerial)) {\r
55 Status = EfiSerialStatusCodeInitializeWorker ();\r
56 ASSERT_EFI_ERROR (Status);\r
57 }\r
58 if (FeaturePcdGet (PcdStatusCodeUseHardSerial)) {\r
59 Status = SerialPortInitialize ();\r
60 ASSERT_EFI_ERROR (Status);\r
61 }\r
62 if (FeaturePcdGet (PcdStatusCodeUseRuntimeMemory)) {\r
63 Status = RtMemoryStatusCodeInitializeWorker ();\r
64 ASSERT_EFI_ERROR (Status);\r
65 }\r
66 if (FeaturePcdGet (PcdStatusCodeUseDataHub)) {\r
67 Status = DataHubStatusCodeInitializeWorker ();\r
68 ASSERT_EFI_ERROR (Status);\r
69 }\r
70 if (FeaturePcdGet (PcdStatusCodeUseOEM)) {\r
71 Status = OemHookStatusCodeInitialize ();\r
72 ASSERT_EFI_ERROR (Status);\r
73 }\r
74\r
75 //\r
76 // Replay Status code which saved in GUID'ed HOB to all supported device. \r
77 //\r
78\r
79 // \r
80 // Journal GUID'ed HOBs to find all record entry, if found, \r
81 // then output record to support replay device.\r
82 //\r
83 Hob.Raw = GetFirstGuidHob (&gMemoryStatusCodeRecordGuid);\r
84 HobStart = Hob.Raw;\r
85 while (Hob.Raw != NULL) {\r
86 PacketHeader = (MEMORY_STATUSCODE_PACKET_HEADER *) GET_GUID_HOB_DATA (Hob.Guid);\r
87 if (PacketHeader->PacketIndex == ExpectedPacketIndex) {\r
88 Record = (MEMORY_STATUSCODE_RECORD *) (PacketHeader + 1);\r
89 for (Index = 0; Index < PacketHeader->RecordIndex; Index++) {\r
90 //\r
91 // Dispatch records to devices based on feature flag.\r
92 //\r
93 if (FeaturePcdGet (PcdStatusCodeReplayInSerial) && \r
94 (FeaturePcdGet (PcdStatusCodeUseHardSerial) ||\r
95 FeaturePcdGet (PcdStatusCodeUseEfiSerial))) {\r
96 SerialStatusCodeReportWorker (\r
97 Record[Index].CodeType,\r
98 Record[Index].Value,\r
99 Record[Index].Instance,\r
100 NULL,\r
101 NULL\r
102 );\r
103 }\r
104 if (FeaturePcdGet (PcdStatusCodeReplayInRuntimeMemory) &&\r
105 FeaturePcdGet (PcdStatusCodeUseRuntimeMemory)) {\r
106 RtMemoryStatusCodeReportWorker (\r
107 gDxeStatusCode.RtMemoryStatusCodeTable[PHYSICAL_MODE],\r
108 Record[Index].CodeType,\r
109 Record[Index].Value,\r
110 Record[Index].Instance\r
111 );\r
112 }\r
113 if (FeaturePcdGet (PcdStatusCodeReplayInDataHub) &&\r
114 FeaturePcdGet (PcdStatusCodeUseDataHub)) {\r
115 DataHubStatusCodeReportWorker (\r
116 Record[Index].CodeType,\r
117 Record[Index].Value,\r
118 Record[Index].Instance,\r
119 NULL,\r
120 NULL\r
121 );\r
122 }\r
123 if (FeaturePcdGet (PcdStatusCodeReplayInOEM) &&\r
124 FeaturePcdGet (PcdStatusCodeUseOEM)) {\r
125 OemHookStatusCodeReport (\r
126 Record[Index].CodeType,\r
127 Record[Index].Value,\r
128 Record[Index].Instance,\r
129 NULL,\r
130 NULL\r
131 );\r
132 }\r
133 }\r
134 ExpectedPacketIndex++;\r
135\r
136 //\r
137 // See whether there is gap of packet or not\r
138 //\r
139 if (NULL != HobStart) {\r
140 HobStart = NULL;\r
141 Hob.Raw = HobStart;\r
142 continue;\r
143 }\r
144 } else if (HobStart != NULL) {\r
145 //\r
146 // Cache the found packet for improve the performance\r
147 //\r
148 HobStart = Hob.Raw;\r
149 }\r
150\r
151 Hob.Raw = GetNextGuidHob (&gMemoryStatusCodeRecordGuid, Hob.Raw);\r
152 }\r
153}\r
154\r