]> git.proxmox.com Git - mirror_edk2.git/blame - IntelFrameworkModulePkg/Universal/StatusCode/Dxe/DxeStatusCode.c
Remove CpuDeadLoop().
[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
48 //\r
49 // If enable UseSerial, then initialize serial port.\r
50 // if enable UseRuntimeMemory, then initialize runtime memory status code worker.\r
51 // if enable UseDataHub, then initialize data hub status code worker.\r
52 //\r
53 if (FeaturePcdGet (PcdStatusCodeUseEfiSerial)) {\r
54 Status = EfiSerialStatusCodeInitializeWorker ();\r
55 ASSERT_EFI_ERROR (Status);\r
56 }\r
57 if (FeaturePcdGet (PcdStatusCodeUseHardSerial)) {\r
58 Status = SerialPortInitialize ();\r
59 ASSERT_EFI_ERROR (Status);\r
60 }\r
61 if (FeaturePcdGet (PcdStatusCodeUseRuntimeMemory)) {\r
62 Status = RtMemoryStatusCodeInitializeWorker ();\r
63 ASSERT_EFI_ERROR (Status);\r
64 }\r
65 if (FeaturePcdGet (PcdStatusCodeUseDataHub)) {\r
66 Status = DataHubStatusCodeInitializeWorker ();\r
67 ASSERT_EFI_ERROR (Status);\r
68 }\r
69 if (FeaturePcdGet (PcdStatusCodeUseOEM)) {\r
70 Status = OemHookStatusCodeInitialize ();\r
71 ASSERT_EFI_ERROR (Status);\r
72 }\r
73\r
74 //\r
75 // Replay Status code which saved in GUID'ed HOB to all supported device. \r
76 //\r
77\r
78 // \r
79 // Journal GUID'ed HOBs to find all record entry, if found, \r
80 // then output record to support replay device.\r
81 //\r
82 Hob.Raw = GetFirstGuidHob (&gMemoryStatusCodeRecordGuid);\r
83 HobStart = Hob.Raw;\r
84 while (Hob.Raw != NULL) {\r
85 PacketHeader = (MEMORY_STATUSCODE_PACKET_HEADER *) GET_GUID_HOB_DATA (Hob.Guid);\r
86 if (PacketHeader->PacketIndex == ExpectedPacketIndex) {\r
87 Record = (MEMORY_STATUSCODE_RECORD *) (PacketHeader + 1);\r
88 for (Index = 0; Index < PacketHeader->RecordIndex; Index++) {\r
89 //\r
90 // Dispatch records to devices based on feature flag.\r
91 //\r
92 if (FeaturePcdGet (PcdStatusCodeReplayInSerial) && \r
93 (FeaturePcdGet (PcdStatusCodeUseHardSerial) ||\r
94 FeaturePcdGet (PcdStatusCodeUseEfiSerial))) {\r
95 SerialStatusCodeReportWorker (\r
96 Record[Index].CodeType,\r
97 Record[Index].Value,\r
98 Record[Index].Instance,\r
99 NULL,\r
100 NULL\r
101 );\r
102 }\r
103 if (FeaturePcdGet (PcdStatusCodeReplayInRuntimeMemory) &&\r
104 FeaturePcdGet (PcdStatusCodeUseRuntimeMemory)) {\r
105 RtMemoryStatusCodeReportWorker (\r
106 gDxeStatusCode.RtMemoryStatusCodeTable[PHYSICAL_MODE],\r
107 Record[Index].CodeType,\r
108 Record[Index].Value,\r
109 Record[Index].Instance\r
110 );\r
111 }\r
112 if (FeaturePcdGet (PcdStatusCodeReplayInDataHub) &&\r
113 FeaturePcdGet (PcdStatusCodeUseDataHub)) {\r
114 DataHubStatusCodeReportWorker (\r
115 Record[Index].CodeType,\r
116 Record[Index].Value,\r
117 Record[Index].Instance,\r
118 NULL,\r
119 NULL\r
120 );\r
121 }\r
122 if (FeaturePcdGet (PcdStatusCodeReplayInOEM) &&\r
123 FeaturePcdGet (PcdStatusCodeUseOEM)) {\r
124 OemHookStatusCodeReport (\r
125 Record[Index].CodeType,\r
126 Record[Index].Value,\r
127 Record[Index].Instance,\r
128 NULL,\r
129 NULL\r
130 );\r
131 }\r
132 }\r
133 ExpectedPacketIndex++;\r
134\r
135 //\r
136 // See whether there is gap of packet or not\r
137 //\r
138 if (NULL != HobStart) {\r
139 HobStart = NULL;\r
140 Hob.Raw = HobStart;\r
141 continue;\r
142 }\r
143 } else if (HobStart != NULL) {\r
144 //\r
145 // Cache the found packet for improve the performance\r
146 //\r
147 HobStart = Hob.Raw;\r
148 }\r
149\r
150 Hob.Raw = GetNextGuidHob (&gMemoryStatusCodeRecordGuid, Hob.Raw);\r
151 }\r
152}\r
153\r