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