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