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