]> git.proxmox.com Git - mirror_edk2.git/blame - EdkModulePkg/Universal/StatusCode/Dxe/DxeStatusCode.c
Fix bug which define different PCD with same token number in EdkModulePkg.spd.
[mirror_edk2.git] / EdkModulePkg / Universal / StatusCode / Dxe / DxeStatusCode.c
CommitLineData
56836fe9 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. All rights reserved. \r
17// This software and associated documentation (if any) is furnished\r
18// under a license and may only be used or copied in accordance\r
19// with the terms of the license. Except as permitted by such\r
20// license, no part of this software or documentation may be\r
21// reproduced, stored in a retrieval system, or transmitted in any\r
22// form or by any means without the express written consent of\r
23// Intel Corporation.\r
24\r
25 Module Name: StatusCode.c\r
26\r
27**/\r
28\r
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 MEMORY_STATUSCODE_PACKET_HEADER *PacketHeader;\r
44 MEMORY_STATUSCODE_RECORD *Record;\r
45 UINTN ExpectedPacketIndex = 0;\r
46 UINTN Index;\r
47 VOID *HobStart;\r
48\r
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 EfiSerialStatusCodeInitializeWorker ();\r
56 }\r
57 if (FeaturePcdGet (PcdStatusCodeUseHardSerial)) {\r
58 SerialPortInitialize ();\r
59 }\r
60 if (FeaturePcdGet (PcdStatusCodeUseRuntimeMemory)) {\r
61 RtMemoryStatusCodeInitializeWorker ();\r
62 }\r
63 if (FeaturePcdGet (PcdStatusCodeUseDataHub)) {\r
64 DataHubStatusCodeInitializeWorker ();\r
65 }\r
66 if (FeaturePcdGet (PcdStatusCodeUseOEM)) {\r
67 OemHookStatusCodeInitialize ();\r
68 }\r
69\r
70 //\r
71 // Replay Status code which saved in GUID'ed HOB to all supported device. \r
72 //\r
73\r
74 // \r
75 // Journal GUID'ed HOBs to find all record entry, if found, \r
76 // then output record to support replay device.\r
77 //\r
78 Hob.Raw = GetFirstGuidHob (&gMemoryStatusCodeRecordGuid);\r
79 HobStart = Hob.Raw;\r
80 while (Hob.Raw != NULL) {\r
81 PacketHeader = (MEMORY_STATUSCODE_PACKET_HEADER *) GET_GUID_HOB_DATA (Hob.Guid);\r
82 if (PacketHeader->PacketIndex == ExpectedPacketIndex) {\r
83 Record = (MEMORY_STATUSCODE_RECORD *) (PacketHeader + 1);\r
84 for (Index = 0; Index < PacketHeader->RecordIndex; Index++) {\r
85 //\r
86 // Dispatch records to devices based on feature flag.\r
87 //\r
88 if (FeaturePcdGet (PcdStatusCodeReplayInSerial) && \r
89 (FeaturePcdGet (PcdStatusCodeUseHardSerial) ||\r
90 FeaturePcdGet (PcdStatusCodeUseEfiSerial))) {\r
91 SerialStatusCodeReportWorker (\r
92 Record[Index].CodeType,\r
93 Record[Index].Value,\r
94 Record[Index].Instance,\r
95 NULL,\r
96 NULL\r
97 );\r
98 }\r
99 if (FeaturePcdGet (PcdStatusCodeReplayInRuntimeMemory) &&\r
100 FeaturePcdGet (PcdStatusCodeUseRuntimeMemory)) {\r
101 RtMemoryStatusCodeReportWorker (\r
102 gDxeStatusCode.RtMemoryStatusCodeTable[PHYSICAL_MODE],\r
103 Record[Index].CodeType,\r
104 Record[Index].Value,\r
105 Record[Index].Instance\r
106 );\r
107 }\r
108 if (FeaturePcdGet (PcdStatusCodeReplayInDataHub) &&\r
109 FeaturePcdGet (PcdStatusCodeUseDataHub)) {\r
110 DataHubStatusCodeReportWorker (\r
111 Record[Index].CodeType,\r
112 Record[Index].Value,\r
113 Record[Index].Instance,\r
114 NULL,\r
115 NULL\r
116 );\r
117 }\r
118 if (FeaturePcdGet (PcdStatusCodeReplayInOEM) &&\r
119 FeaturePcdGet (PcdStatusCodeUseOEM)) {\r
120 OemHookStatusCodeReport (\r
121 Record[Index].CodeType,\r
122 Record[Index].Value,\r
123 Record[Index].Instance,\r
124 NULL,\r
125 NULL\r
126 );\r
127 }\r
128 }\r
129 ExpectedPacketIndex++;\r
130\r
131 //\r
132 // See whether there is gap of packet or not\r
133 //\r
134 if (HobStart) {\r
135 HobStart = NULL;\r
136 Hob.Raw = HobStart;\r
137 continue;\r
138 }\r
139 } else if (HobStart != NULL) {\r
140 //\r
141 // Cache the found packet for improve the performance\r
142 //\r
143 HobStart = Hob.Raw;\r
144 }\r
145\r
146 Hob.Raw = GetNextGuidHob (&gMemoryStatusCodeRecordGuid, Hob.Raw);\r
147 }\r
148}\r
149\r